setSeverity can take invalid source location. Fixes asserts.

The underlying issue is the setSeverity method compares if the given
source location was before or after a push diagnostic mappings (pragma push).
The problem is that we 'give' a wannabe source location, because the
memory buffer (which will expand it to a real source location) is not
parsed yet. Thus the pseudo-valid source location looks like a location
came from a pch, which causes a misbehavior in the logic of comparer.
This commit is contained in:
Vassil Vassilev 2014-08-19 13:54:58 +02:00 committed by sftnight
parent b9924057b4
commit cda43d3b52

View File

@ -966,15 +966,14 @@ namespace cling {
Diags.pushMappings(Loc);
// The source locations of #pragma warning ignore must be greater than
// the ones from #pragma push
//Loc = Loc.getLocWithOffset(1);
Diags.setSeverity(clang::diag::warn_unused_expr,
clang::diag::Severity::Ignored, Loc);
clang::diag::Severity::Ignored, SourceLocation());
Diags.setSeverity(clang::diag::warn_unused_call,
clang::diag::Severity::Ignored, Loc);
clang::diag::Severity::Ignored, SourceLocation());
Diags.setSeverity(clang::diag::warn_unused_comparison,
clang::diag::Severity::Ignored, Loc);
clang::diag::Severity::Ignored, SourceLocation());
Diags.setSeverity(clang::diag::ext_return_has_expr,
clang::diag::Severity::Ignored, Loc);
clang::diag::Severity::Ignored, SourceLocation());
if (Transaction* lastT = m_IncrParser->Compile(Wrapper, CO)) {
Loc = m_IncrParser->getLastMemoryBufferEndLoc().getLocWithOffset(1);
// if the location was the same we are in recursive calls and to avoid an