[cfe-commits] r43085 - in /cfe/trunk/Driver: TextDiagnosticPrinter.cpp TextDiagnostics.h clang.cpp
Chris Lattner
sabre at nondot.org
Wed Oct 17 13:53:57 PDT 2007
Author: lattner
Date: Wed Oct 17 15:53:57 2007
New Revision: 43085
URL: http://llvm.org/viewvc/llvm-project?rev=43085&view=rev
Log:
wean the diagnostics machinery off the preprocessor.
Modified:
cfe/trunk/Driver/TextDiagnosticPrinter.cpp
cfe/trunk/Driver/TextDiagnostics.h
cfe/trunk/Driver/clang.cpp
Modified: cfe/trunk/Driver/TextDiagnosticPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/TextDiagnosticPrinter.cpp?rev=43085&r1=43084&r2=43085&view=diff
==============================================================================
--- cfe/trunk/Driver/TextDiagnosticPrinter.cpp (original)
+++ cfe/trunk/Driver/TextDiagnosticPrinter.cpp Wed Oct 17 15:53:57 2007
@@ -104,13 +104,19 @@
// the token this macro expanded to.
Loc = SourceMgr.getLogicalLoc(Loc);
const char *StrData = SourceMgr.getCharacterData(Loc);
+ const char *BufEnd = SourceMgr.getBufferData(Loc.getFileID()).second;
// TODO: this could be special cased for common tokens like identifiers, ')',
// etc to make this faster, if it mattered. This could use
// Lexer::isObviouslySimpleCharacter for example.
+ // Create a langops struct and enable trigraphs. This is sufficient for
+ // measuring tokens.
+ LangOptions LangOpts;
+ LangOpts.Trigraphs = true;
+
// Create a lexer starting at the beginning of this token.
- Lexer TheLexer(Loc, *ThePreprocessor, StrData);
+ Lexer TheLexer(Loc, LangOpts, StrData, BufEnd);
Token TheTok;
TheLexer.LexRawToken(TheTok);
return TheTok.getLength();
Modified: cfe/trunk/Driver/TextDiagnostics.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/TextDiagnostics.h?rev=43085&r1=43084&r2=43085&view=diff
==============================================================================
--- cfe/trunk/Driver/TextDiagnostics.h (original)
+++ cfe/trunk/Driver/TextDiagnostics.h Wed Oct 17 15:53:57 2007
@@ -25,7 +25,6 @@
HeaderSearch *TheHeaderSearch;
protected:
SourceManager &SourceMgr;
- Preprocessor *ThePreprocessor;
std::string FormatDiagnostic(Diagnostic::Level Level,
diag::kind ID,
@@ -36,7 +35,6 @@
virtual ~TextDiagnostics();
void setHeaderSearch(HeaderSearch &HS) { TheHeaderSearch = &HS; }
- void setPreprocessor(Preprocessor &P) { ThePreprocessor = &P; }
virtual bool IgnoreDiagnostic(Diagnostic::Level Level,
SourceLocation Pos);
Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=43085&r1=43084&r2=43085&view=diff
==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Wed Oct 17 15:53:57 2007
@@ -908,7 +908,6 @@
for (unsigned i = 0, e = InputFilenames.size(); i != e; ++i) {
// Set up the preprocessor with these options.
Preprocessor PP(Diags, LangInfo, *Target, SourceMgr, HeaderInfo);
- DiagClient->setPreprocessor(PP);
const std::string &InFile = InputFilenames[i];
std::vector<char> PredefineBuffer;
unsigned MainFileID = InitializePreprocessor(PP, InFile, SourceMgr,
More information about the cfe-commits
mailing list