[cfe-commits] r86106 - in /cfe/trunk: include/clang/Lex/Preprocessor.h lib/Lex/Preprocessor.cpp
Daniel Dunbar
daniel at zuster.org
Wed Nov 4 17:53:53 PST 2009
Author: ddunbar
Date: Wed Nov 4 19:53:52 2009
New Revision: 86106
URL: http://llvm.org/viewvc/llvm-project?rev=86106&view=rev
Log:
Make LookUpIdentifierInfo const. This makes the Identifiers table mutable and is
a little fuzzy, but conceptually it's just uniquing the identifier.
Chris, please review. I debated splitting into const/non-const versions where
the const one propogated constness to the resulting IdentifierInfo*.
Modified:
cfe/trunk/include/clang/Lex/Preprocessor.h
cfe/trunk/lib/Lex/Preprocessor.cpp
Modified: cfe/trunk/include/clang/Lex/Preprocessor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Preprocessor.h?rev=86106&r1=86105&r2=86106&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/Preprocessor.h (original)
+++ cfe/trunk/include/clang/Lex/Preprocessor.h Wed Nov 4 19:53:52 2009
@@ -96,7 +96,7 @@
/// Identifiers - This is mapping/lookup information for all identifiers in
/// the program, including program keywords.
- IdentifierTable Identifiers;
+ mutable IdentifierTable Identifiers;
/// Selectors - This table contains all the selectors in the program. Unlike
/// IdentifierTable above, this table *isn't* populated by the preprocessor.
@@ -296,7 +296,7 @@
/// pointers is preferred unless the identifier is already available as a
/// string (this avoids allocation and copying of memory to construct an
/// std::string).
- IdentifierInfo *getIdentifierInfo(llvm::StringRef Name) {
+ IdentifierInfo *getIdentifierInfo(llvm::StringRef Name) const {
return &Identifiers.get(Name);
}
@@ -579,7 +579,7 @@
/// LookUpIdentifierInfo - Given a tok::identifier token, look up the
/// identifier information for the token and install it into the token.
IdentifierInfo *LookUpIdentifierInfo(Token &Identifier,
- const char *BufPtr = 0);
+ const char *BufPtr = 0) const;
/// HandleIdentifier - This callback is invoked when the lexer reads an
/// identifier and has filled in the tokens IdentifierInfo member. This
Modified: cfe/trunk/lib/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Preprocessor.cpp?rev=86106&r1=86105&r2=86106&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/lib/Lex/Preprocessor.cpp Wed Nov 4 19:53:52 2009
@@ -401,7 +401,7 @@
/// LookUpIdentifierInfo - Given a tok::identifier token, look up the
/// identifier information for the token and install it into the token.
IdentifierInfo *Preprocessor::LookUpIdentifierInfo(Token &Identifier,
- const char *BufPtr) {
+ const char *BufPtr) const {
assert(Identifier.is(tok::identifier) && "Not an identifier!");
assert(Identifier.getIdentifierInfo() == 0 && "Identinfo already exists!");
More information about the cfe-commits
mailing list