diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Lex/Lexer.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Parse/Parser.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/Sema.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/Sema.h | 5 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExprObjC.cpp | 2 |
6 files changed, 10 insertions, 9 deletions
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index 4fbbe3cc464..8bce589f177 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -51,12 +51,6 @@ tok::ObjCKeywordKind Token::getObjCKeywordID() const { return specId ? specId->getObjCKeywordID() : tok::objc_not_keyword; } -/// isNamedIdentifier - Return true if this token is a ppidentifier with the -/// specified name. For example, tok.isNamedIdentifier("this"). -bool Token::isNamedIdentifier(const char *Name) const { - return IdentInfo && !strcmp(IdentInfo->getName(), Name); -} - //===----------------------------------------------------------------------===// // Lexer Class Implementation diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp index 7bd8b7b893a..a5e73cce326 100644 --- a/clang/lib/Parse/Parser.cpp +++ b/clang/lib/Parse/Parser.cpp @@ -267,6 +267,8 @@ void Parser::Initialize() { &PP.getIdentifierTable().get("nonatomic"); ObjCForCollectionInKW = &PP.getIdentifierTable().get("in"); } + + Ident_super = &PP.getIdentifierTable().get("super"); } /// ParseTopLevelDecl - Parse one top-level declaration, return whatever the diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 46c9e994ce1..c8d83bd4a50 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -103,6 +103,8 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer) KnownFunctionIDs[id_vsprintf] = &IT.get("vsprintf"); KnownFunctionIDs[id_vprintf] = &IT.get("vprintf"); + SuperID = &IT.get("super"); + TUScope = 0; if (getLangOptions().CPlusPlus) FieldCollector.reset(new CXXFieldCollector()); diff --git a/clang/lib/Sema/Sema.h b/clang/lib/Sema/Sema.h index d6dcaf2b9ae..98f98aa3536 100644 --- a/clang/lib/Sema/Sema.h +++ b/clang/lib/Sema/Sema.h @@ -137,7 +137,10 @@ public: /// kinds of checking (e.g. checking format string errors in printf calls). /// This list is populated upon the creation of a Sema object. IdentifierInfo* KnownFunctionIDs[ id_num_known_functions ]; - + + /// SuperID - Identifier for "super" used for Objective-C checking. + IdentifierInfo* SuperID; + /// Translation Unit Scope - useful to Objective-C actions that need /// to lookup file scope declarations in the "ordinary" C decl namespace. /// For example, user-defined classes, built-in "id" type, etc. diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 2e99b3dfe81..58a126be6c1 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -328,7 +328,7 @@ Sema::ExprResult Sema::ActOnIdentifierExpr(Scope *S, SourceLocation Loc, } } // Needed to implement property "super.method" notation. - if (SD == 0 && !strcmp(II.getName(), "super")) { + if (SD == 0 && &II == SuperID) { QualType T = Context.getPointerType(Context.getObjCInterfaceType( getCurMethodDecl()->getClassInterface())); return new PredefinedExpr(Loc, T, PredefinedExpr::ObjCSuper); diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index 75546ea903b..7c2f45b6db4 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/lib/Sema/SemaExprObjC.cpp @@ -150,7 +150,7 @@ Sema::ExprResult Sema::ActOnClassMessage( ObjCInterfaceDecl* ClassDecl = 0; bool isSuper = false; - if (!strcmp(receiverName->getName(), "super") && getCurMethodDecl()) { + if (receiverName == SuperID && getCurMethodDecl()) { isSuper = true; ClassDecl = getCurMethodDecl()->getClassInterface()->getSuperClass(); if (!ClassDecl) |