Index: clang/lib/StaticAnalyzer/Core/BugReporter.cpp =================================================================== --- clang/lib/StaticAnalyzer/Core/BugReporter.cpp +++ clang/lib/StaticAnalyzer/Core/BugReporter.cpp @@ -1892,6 +1892,7 @@ FullSourceLoc Loc = P->getLocation().asLocation().getExpansionLoc(); FileID FID = Loc.getFileID(); unsigned LineNo = Loc.getLineNumber(); + assert(FID.isValid()); ExecutedLines[FID].insert(LineNo); } } @@ -3022,6 +3023,8 @@ SourceLocation Start = SignatureSourceRange.getBegin(); SourceLocation End = Body ? Body->getSourceRange().getBegin() : SignatureSourceRange.getEnd(); + if (!Start.isValid() || !End.isValid()) + return; unsigned StartLine = SM.getExpansionLineNumber(Start); unsigned EndLine = SM.getExpansionLineNumber(End); @@ -3034,6 +3037,8 @@ const Stmt *S, SourceManager &SM, FilesToLineNumsMap &ExecutedLines) { SourceLocation Loc = S->getSourceRange().getBegin(); + if (!Loc.isValid()) + return; SourceLocation ExpansionLoc = SM.getExpansionLoc(Loc); FileID FID = SM.getFileID(ExpansionLoc); unsigned LineNo = SM.getExpansionLineNumber(ExpansionLoc);