// We report the first occurence only when we find the second one.
diag(Branches[i]->getBeginLoc(),
"repeated branch in conditional chain");
- diag(Lexer::getLocForEndOfToken(Branches[i]->getEndLoc(), 0,
- *Result.SourceManager, getLangOpts()),
- "end of the original", DiagnosticIDs::Note);
+ SourceLocation End =
+ Lexer::getLocForEndOfToken(Branches[i]->getEndLoc(), 0,
+ *Result.SourceManager, getLangOpts());
+ if (End.isValid()) {
+ diag(End, "end of the original", DiagnosticIDs::Note);
+ }
}
diag(Branches[j]->getBeginLoc(), "clone %0 starts here",
if (EndLoc.isMacroID())
EndLoc = Context.getSourceManager().getExpansionLoc(EndLoc);
+ EndLoc = Lexer::getLocForEndOfToken(EndLoc, 0, *Result.SourceManager,
+ getLangOpts());
- diag(Lexer::getLocForEndOfToken(EndLoc, 0, *Result.SourceManager,
- getLangOpts()),
- "last of these clones ends here", DiagnosticIDs::Note);
+ if (EndLoc.isValid()) {
+ diag(EndLoc, "last of these clones ends here", DiagnosticIDs::Note);
+ }
}
BeginCurrent = EndCurrent;
}