diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h index ba6fd8bd7a764eb16dd651dba86fd2db5f80704a..bb7e8c7cfb8186d29b1980e7117fbe33a338674c 100644 --- a/include/clang/Lex/Preprocessor.h +++ b/include/clang/Lex/Preprocessor.h @@ -18,6 +18,7 @@ #include "clang/Lex/PTHLexer.h" #include "clang/Lex/PPCallbacks.h" #include "clang/Lex/TokenLexer.h" +#include "clang/Basic/Diagnostic.h" #include "clang/Basic/IdentifierTable.h" #include "clang/Basic/SourceLocation.h" #include "llvm/ADT/DenseMap.h" @@ -404,8 +405,14 @@ public: /// Diag - Forwarding function for diagnostics. This emits a diagnostic at /// the specified Token's location, translating the token's start /// position in the current buffer into a SourcePosition object for rendering. - DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID); - DiagnosticBuilder Diag(const Token &Tok, unsigned DiagID); + DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID) { + return Diags.Report(FullSourceLoc(Loc, getSourceManager()), DiagID); + } + + DiagnosticBuilder Diag(const Token &Tok, unsigned DiagID) { + return Diags.Report(FullSourceLoc(Tok.getLocation(), getSourceManager()), + DiagID); + } /// getSpelling() - Return the 'spelling' of the Tok token. The spelling of a /// token is the characters used to represent the token in the source file diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp index 7a5174c82ffa2a29abddb226e53a6a1a28f7796b..e9894fea4d513665f9b269a52c689de60e40ad96 100644 --- a/lib/Lex/Preprocessor.cpp +++ b/lib/Lex/Preprocessor.cpp @@ -114,18 +114,6 @@ Preprocessor::~Preprocessor() { delete Callbacks; } -/// Diag - Forwarding function for diagnostics. This emits a diagnostic at -/// the specified Token's location, translating the token's start -/// position in the current buffer into a SourcePosition object for rendering. -DiagnosticBuilder Preprocessor::Diag(SourceLocation Loc, unsigned DiagID) { - return Diags.Report(FullSourceLoc(Loc, getSourceManager()), DiagID); -} - -DiagnosticBuilder Preprocessor::Diag(const Token &Tok, unsigned DiagID) { - return Diags.Report(FullSourceLoc(Tok.getLocation(), getSourceManager()), - DiagID); -} - void Preprocessor::DumpToken(const Token &Tok, bool DumpFlags) const { llvm::cerr << tok::getTokenName(Tok.getKind()) << " '" << getSpelling(Tok) << "'";