[cfe-commits] r38549 - in /cfe/cfe/trunk: Driver/clang.cpp Lex/Lexer.cpp Lex/MacroInfo.cpp include/clang/Lex/Lexer.h include/clang/Lex/MacroInfo.h
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:22:29 PDT 2007
Author: sabre
Date: Wed Jul 11 11:22:28 2007
New Revision: 38549
URL: http://llvm.org/viewvc/llvm-project?rev=38549&view=rev
Log:
Fix a fixme by passing language options into LexerToken::dump, instead of
relying on TheLexer.
Modified:
cfe/cfe/trunk/Driver/clang.cpp
cfe/cfe/trunk/Lex/Lexer.cpp
cfe/cfe/trunk/Lex/MacroInfo.cpp
cfe/cfe/trunk/include/clang/Lex/Lexer.h
cfe/cfe/trunk/include/clang/Lex/MacroInfo.h
Modified: cfe/cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Driver/clang.cpp?rev=38549&r1=38548&r2=38549&view=diff
==============================================================================
--- cfe/cfe/trunk/Driver/clang.cpp (original)
+++ cfe/cfe/trunk/Driver/clang.cpp Wed Jul 11 11:22:28 2007
@@ -751,7 +751,7 @@
LexerToken Tok;
do {
PP.Lex(Tok);
- Tok.dump(true);
+ Tok.dump(Options, true);
std::cerr << "\n";
} while (Tok.getKind() != tok::eof);
break;
Modified: cfe/cfe/trunk/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/Lexer.cpp?rev=38549&r1=38548&r2=38549&view=diff
==============================================================================
--- cfe/cfe/trunk/Lex/Lexer.cpp (original)
+++ cfe/cfe/trunk/Lex/Lexer.cpp Wed Jul 11 11:22:28 2007
@@ -75,20 +75,12 @@
/// dump - Print the token to stderr, used for debugging.
///
-void LexerToken::dump(bool DumpFlags) const {
+void LexerToken::dump(const LangOptions &Features, bool DumpFlags) const {
std::cerr << clang::tok::getTokenName(Kind) << " '";
- if (needsCleaning()) {
- if (getLexer())
- std::cerr << getLexer()->getSpelling(*this);
- else {
- // FIXME: expansion from macros clears location info. Testcase:
- // #define TWELVE 1\ <whitespace only>
- // 2
- // TWELVE
- std::cerr << "*unspelled*" << std::string(getStart(), getEnd());
- }
- } else
+ if (needsCleaning())
+ std::cerr << Lexer::getSpelling(*this, Features);
+ else
std::cerr << std::string(getStart(), getEnd());
std::cerr << "'";
Modified: cfe/cfe/trunk/Lex/MacroInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/MacroInfo.cpp?rev=38549&r1=38548&r2=38549&view=diff
==============================================================================
--- cfe/cfe/trunk/Lex/MacroInfo.cpp (original)
+++ cfe/cfe/trunk/Lex/MacroInfo.cpp Wed Jul 11 11:22:28 2007
@@ -18,10 +18,10 @@
/// dump - Print the macro to stderr, used for debugging.
///
-void MacroInfo::dump() const {
+void MacroInfo::dump(const LangOptions &Features) const {
std::cerr << "MACRO: ";
for (unsigned i = 0, e = ReplacementTokens.size(); i != e; ++i) {
- ReplacementTokens[i].dump();
+ ReplacementTokens[i].dump(Features);
std::cerr << " ";
}
std::cerr << "\n";
Modified: cfe/cfe/trunk/include/clang/Lex/Lexer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Lex/Lexer.h?rev=38549&r1=38548&r2=38549&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/Lex/Lexer.h (original)
+++ cfe/cfe/trunk/include/clang/Lex/Lexer.h Wed Jul 11 11:22:28 2007
@@ -93,8 +93,6 @@
/// start of the token having already been set.
void SetEnd(const char *End) { Length = End-Start; }
- const Lexer *getLexer() const { return TheLexer; }
-
/// ClearFlags - Reset all flags to cleared.
///
void StartToken(const Lexer *L) {
@@ -150,7 +148,7 @@
/// dump - Print the token to stderr, used for debugging.
///
- void dump(bool DumpFlags = false) const;
+ void dump(const LangOptions &Features, bool DumpFlags = false) const;
};
/// PPConditionalInfo - Information about the conditional stack (#if directives)
Modified: cfe/cfe/trunk/include/clang/Lex/MacroInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Lex/MacroInfo.h?rev=38549&r1=38548&r2=38549&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/Lex/MacroInfo.h (original)
+++ cfe/cfe/trunk/include/clang/Lex/MacroInfo.h Wed Jul 11 11:22:28 2007
@@ -94,7 +94,7 @@
/// dump - Print the macro to stderr, used for debugging.
///
- void dump() const;
+ void dump(const LangOptions &Features) const;
// Todo:
// bool isDefinedInSystemHeader() { Look this up based on Location }
More information about the cfe-commits
mailing list