/// Diag - Forwarding function for diagnostics. This translate a source
/// position in the current buffer into a SourceLocation object for rendering.
DiagnosticBuilder Diag(const char *Loc, unsigned DiagID) const;
+ DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID) const;
/// getSourceLocation - Return a source location identifier for the specified
/// offset in the current file.
virtual void IndirectLex(Token& Result) = 0;
- /// Diag - Forwarding function for diagnostics. This translate a source
- /// position in the current buffer into a SourceLocation object for rendering.
- void Diag(SourceLocation Loc, unsigned DiagID,
- const std::string &Msg = std::string()) const;
-
//===--------------------------------------------------------------------===//
// #if directive handling.
return PP->Diag(getSourceLocation(Loc), DiagID);
}
+DiagnosticBuilder Lexer::Diag(SourceLocation Loc, unsigned DiagID) const {
+ return PP->Diag(Loc, DiagID);
+}
+
+
//===----------------------------------------------------------------------===//
// Trigraph and Escaped Newline Handling Code.
//===----------------------------------------------------------------------===//
// If we are in a #if directive, emit an error.
while (!ConditionalStack.empty()) {
- PreprocessorLexer::Diag(ConditionalStack.back().IfLoc,
- diag::err_pp_unterminated_conditional);
-
+ Diag(ConditionalStack.back().IfLoc, diag::err_pp_unterminated_conditional);
ConditionalStack.pop_back();
}
#include "clang/Lex/Preprocessor.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/SourceManager.h"
-
using namespace clang;
PreprocessorLexer::PreprocessorLexer(Preprocessor* pp, SourceLocation L)
PreprocessorLexer::~PreprocessorLexer() {}
-void PreprocessorLexer::Diag(SourceLocation Loc, unsigned DiagID,
- const std::string &Msg) const {
- PP->Diag(Loc, DiagID) << Msg;
-}
-
/// LexIncludeFilename - After the preprocessor has parsed a #include, lex and
/// (potentially) macro expand the filename.
void PreprocessorLexer::LexIncludeFilename(Token &FilenameTok) {
// No filename?
if (FilenameTok.is(tok::eom))
- Diag(FilenameTok.getLocation(), diag::err_pp_expects_filename);
+ PP->Diag(FilenameTok.getLocation(), diag::err_pp_expects_filename);
}