diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-11-12 23:13:54 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-11-12 23:13:54 +0000 |
commit | d6a2e7d71e9a910c45a3eb0268a5d94635003d58 (patch) | |
tree | 17c208f99eaa5e4b60d56cc6fc5060af02bcc51e /include | |
parent | 2c71d0f00e40b7b0a85561d430f52247b9c6e7f2 (diff) |
Move some diagnostic handling to PreprocessorLexer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59191 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/Lex/Lexer.h | 3 | ||||
-rw-r--r-- | include/clang/Lex/PTHLexer.h | 4 | ||||
-rw-r--r-- | include/clang/Lex/PreprocessorLexer.h | 16 |
3 files changed, 12 insertions, 11 deletions
diff --git a/include/clang/Lex/Lexer.h b/include/clang/Lex/Lexer.h index f3f8c739cf..3542ff4bc7 100644 --- a/include/clang/Lex/Lexer.h +++ b/include/clang/Lex/Lexer.h @@ -36,7 +36,6 @@ class Lexer : public PreprocessorLexer { const char *BufferStart; // Start of the buffer. const char *BufferEnd; // End of the buffer. SourceLocation FileLoc; // Location for start of file. - Preprocessor *PP; // Preprocessor object controlling lexing. LangOptions Features; // Features enabled by this language (cache). bool Is_PragmaLexer; // True if lexer for _Pragma handling. @@ -171,8 +170,6 @@ public: /// position in the current buffer into a SourceLocation object for rendering. void Diag(const char *Loc, unsigned DiagID, const std::string &Msg = std::string()) const; - void Diag(SourceLocation Loc, unsigned DiagID, - const std::string &Msg = std::string()) const; /// getSourceLocation - Return a source location identifier for the specified /// offset in the current file. diff --git a/include/clang/Lex/PTHLexer.h b/include/clang/Lex/PTHLexer.h index cdca3419a2..2985b24cb5 100644 --- a/include/clang/Lex/PTHLexer.h +++ b/include/clang/Lex/PTHLexer.h @@ -19,10 +19,6 @@ namespace clang { class PTHLexer : public PreprocessorLexer { - - /// PP - Preprocessor. - Preprocessor& PP; - /// FileLoc - Location for the start of the file. /// SourceLocation FileLoc; diff --git a/include/clang/Lex/PreprocessorLexer.h b/include/clang/Lex/PreprocessorLexer.h index bbe6dbeeac..de9c6b780a 100644 --- a/include/clang/Lex/PreprocessorLexer.h +++ b/include/clang/Lex/PreprocessorLexer.h @@ -17,14 +17,19 @@ #include "clang/Lex/MultipleIncludeOpt.h" #include "clang/Lex/Token.h" #include <vector> - +#include <string> + namespace clang { class Preprocessor; class PreprocessorLexer { -protected: +protected: + Preprocessor *PP; // Preprocessor object controlling lexing. + + //===--------------------------------------------------------------------===// // Context-specific lexing flags set by the preprocessor. + //===--------------------------------------------------------------------===// /// ParsingPreprocessorDirective - This is true when parsing #XXX. This turns /// '\n' into a tok::eom token. @@ -59,12 +64,15 @@ protected: void operator=(const PreprocessorLexer&); // DO NOT IMPLEMENT friend class Preprocessor; - PreprocessorLexer() {} + PreprocessorLexer(Preprocessor* pp) : PP(pp) {} virtual ~PreprocessorLexer(); virtual void IndirectLex(Token& Result) = 0; -protected: + /// 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. |