summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/Lexer.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-11-12 23:13:54 +0000
committerTed Kremenek <kremenek@apple.com>2008-11-12 23:13:54 +0000
commit66312a3ff419b291aa2977c110b79cd9cfa77886 (patch)
treea034556f3046e64dafaccfa0f5fd78dae0e474c4 /clang/lib/Lex/Lexer.cpp
parent88ba5f0b96970496885e3b818744f295ea88c8c5 (diff)
downloadbcm5719-llvm-66312a3ff419b291aa2977c110b79cd9cfa77886.tar.gz
bcm5719-llvm-66312a3ff419b291aa2977c110b79cd9cfa77886.zip
Move some diagnostic handling to PreprocessorLexer.
llvm-svn: 59191
Diffstat (limited to 'clang/lib/Lex/Lexer.cpp')
-rw-r--r--clang/lib/Lex/Lexer.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp
index b71452bc52e..4e93600a877 100644
--- a/clang/lib/Lex/Lexer.cpp
+++ b/clang/lib/Lex/Lexer.cpp
@@ -63,7 +63,7 @@ tok::ObjCKeywordKind Token::getObjCKeywordID() const {
/// outlive it, so it doesn't take ownership of either of them.
Lexer::Lexer(SourceLocation fileloc, Preprocessor &pp,
const char *BufStart, const char *BufEnd)
- : FileLoc(fileloc), PP(&pp), Features(pp.getLangOptions()) {
+ : PreprocessorLexer(&pp), FileLoc(fileloc), Features(pp.getLangOptions()) {
SourceManager &SourceMgr = PP->getSourceManager();
unsigned InputFileID = SourceMgr.getPhysicalLoc(FileLoc).getFileID();
@@ -110,7 +110,7 @@ Lexer::Lexer(SourceLocation fileloc, Preprocessor &pp,
Lexer::Lexer(SourceLocation fileloc, const LangOptions &features,
const char *BufStart, const char *BufEnd,
const llvm::MemoryBuffer *FromFile)
- : FileLoc(fileloc), PP(0), Features(features) {
+ : PreprocessorLexer(0), FileLoc(fileloc), Features(features) {
Is_PragmaLexer = false;
InitCharacterInfo();
@@ -312,13 +312,6 @@ void Lexer::Diag(const char *Loc, unsigned DiagID,
return;
PP->Diag(getSourceLocation(Loc), DiagID, Msg);
}
-void Lexer::Diag(SourceLocation Loc, unsigned DiagID,
- const std::string &Msg) const {
- if (LexingRawMode && Diagnostic::isBuiltinNoteWarningOrExtension(DiagID))
- return;
- PP->Diag(Loc, DiagID, Msg);
-}
-
//===----------------------------------------------------------------------===//
// Trigraph and Escaped Newline Handling Code.
@@ -1138,7 +1131,9 @@ bool Lexer::LexEndOfFile(Token &Result, const char *CurPtr) {
// If we are in a #if directive, emit an error.
while (!ConditionalStack.empty()) {
- Diag(ConditionalStack.back().IfLoc, diag::err_pp_unterminated_conditional);
+ PreprocessorLexer::Diag(ConditionalStack.back().IfLoc,
+ diag::err_pp_unterminated_conditional);
+
ConditionalStack.pop_back();
}
OpenPOWER on IntegriCloud