/// Hook into the preprocessor and extract comments containing expected /// errors and warnings. void VerifyDiagnosticConsumer::handleComment(Lexer &L, SourceRange Comment) { const llvm::SourceMgr &SM = L.getSourceManager(); SourceLocation CommentBegin = Comment.Start; const char *CommentRaw = CommentBegin.getPointer(); StringRef C(CommentRaw, Comment.End.getPointer() - CommentRaw); if (C.empty()) return; ParseDirective(C, &ED, SM, CommentBegin, L.getDiagnostics(), Status); }
static SourceLocation getLocWithOffset(SourceLocation L, intptr_t offset) { return SourceLocation::getFromPointer(L.getPointer() + offset); }