From cda43d3b52107273c11c4e2d3a5ff041ca574431 Mon Sep 17 00:00:00 2001 From: Vassil Vassilev Date: Tue, 19 Aug 2014 13:54:58 +0200 Subject: [PATCH] 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. --- lib/Interpreter/Interpreter.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/Interpreter/Interpreter.cpp b/lib/Interpreter/Interpreter.cpp index 66b2d4d3..9d9e2d23 100644 --- a/lib/Interpreter/Interpreter.cpp +++ b/lib/Interpreter/Interpreter.cpp @@ -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