[cfe-commits] r39326 - in /cfe/cfe/trunk: AST/Sema.h AST/SemaDecl.cpp Sema/Sema.h Sema/SemaDecl.cpp include/clang/Lex/IdentifierTable.h

sabre at cs.uiuc.edu sabre at cs.uiuc.edu
Wed Jul 11 09:43:08 PDT 2007


Author: sabre
Date: Wed Jul 11 11:43:07 2007
New Revision: 39326

URL: http://llvm.org/viewvc/llvm-project?rev=39326&view=rev
Log:
make LookupScopedDecl a method instead of a static function

Modified:
    cfe/cfe/trunk/AST/Sema.h
    cfe/cfe/trunk/AST/SemaDecl.cpp
    cfe/cfe/trunk/Sema/Sema.h
    cfe/cfe/trunk/Sema/SemaDecl.cpp
    cfe/cfe/trunk/include/clang/Lex/IdentifierTable.h

Modified: cfe/cfe/trunk/AST/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/Sema.h?rev=39326&r1=39325&r2=39326&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/Sema.h (original)
+++ cfe/cfe/trunk/AST/Sema.h Wed Jul 11 11:43:07 2007
@@ -74,6 +74,7 @@
   virtual DeclTy *ParseStartOfFunctionDef(Scope *S, Declarator &D);
   virtual DeclTy *ParseFunctionDefBody(DeclTy *Decl, StmtTy *Body);
   virtual void PopScope(SourceLocation Loc, Scope *S);
+  Decl *LookupScopedDecl(IdentifierInfo *II, unsigned NSI);
   
   TypedefDecl *ParseTypedefDecl(Scope *S, Declarator &D);
   TypedefDecl *MergeTypeDefDecl(TypedefDecl *New, Decl *Old);

Modified: cfe/cfe/trunk/AST/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/SemaDecl.cpp?rev=39326&r1=39325&r2=39326&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/SemaDecl.cpp (original)
+++ cfe/cfe/trunk/AST/SemaDecl.cpp Wed Jul 11 11:43:07 2007
@@ -67,20 +67,11 @@
   }
 }
 
-/// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
-/// no declarator (e.g. "struct foo;") is parsed.
-Sema::DeclTy *Sema::ParsedFreeStandingDeclSpec(Scope *S, DeclSpec &DS) {
-  // TODO: emit error on 'int;' or 'const enum foo;'.
-  // TODO: emit error on 'typedef int;'
-  // if (!DS.isMissingDeclaratorOk()) Diag(...);
-  
-  return 0;
-}
-
 /// LookupScopedDecl - Look up the inner-most declaration in the specified
 /// namespace.
-static Decl *LookupScopedDecl(IdentifierInfo *II, Decl::IdentifierNamespace NS){
+Decl *Sema::LookupScopedDecl(IdentifierInfo *II, unsigned NSI) {
   if (II == 0) return 0;
+  Decl::IdentifierNamespace NS = (Decl::IdentifierNamespace)NSI;
   
   // Scan up the scope chain looking for a decl that matches this identifier
   // that is in the appropriate namespace.  This search should not take long, as
@@ -88,6 +79,8 @@
   for (Decl *D = II->getFETokenInfo<Decl>(); D; D = D->getNext())
     if (D->getIdentifierNamespace() == NS)
       return D;
+  
+    
   return 0;
 }
 
@@ -164,6 +157,16 @@
   return New;
 }
 
+/// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
+/// no declarator (e.g. "struct foo;") is parsed.
+Sema::DeclTy *Sema::ParsedFreeStandingDeclSpec(Scope *S, DeclSpec &DS) {
+  // TODO: emit error on 'int;' or 'const enum foo;'.
+  // TODO: emit error on 'typedef int;'
+  // if (!DS.isMissingDeclaratorOk()) Diag(...);
+  
+  return 0;
+}
+
 
 Action::DeclTy *
 Sema::ParseDeclarator(Scope *S, Declarator &D, ExprTy *Init, 

Modified: cfe/cfe/trunk/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/Sema.h?rev=39326&r1=39325&r2=39326&view=diff

==============================================================================
--- cfe/cfe/trunk/Sema/Sema.h (original)
+++ cfe/cfe/trunk/Sema/Sema.h Wed Jul 11 11:43:07 2007
@@ -74,6 +74,7 @@
   virtual DeclTy *ParseStartOfFunctionDef(Scope *S, Declarator &D);
   virtual DeclTy *ParseFunctionDefBody(DeclTy *Decl, StmtTy *Body);
   virtual void PopScope(SourceLocation Loc, Scope *S);
+  Decl *LookupScopedDecl(IdentifierInfo *II, unsigned NSI);
   
   TypedefDecl *ParseTypedefDecl(Scope *S, Declarator &D);
   TypedefDecl *MergeTypeDefDecl(TypedefDecl *New, Decl *Old);

Modified: cfe/cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/SemaDecl.cpp?rev=39326&r1=39325&r2=39326&view=diff

==============================================================================
--- cfe/cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/cfe/trunk/Sema/SemaDecl.cpp Wed Jul 11 11:43:07 2007
@@ -67,20 +67,11 @@
   }
 }
 
-/// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
-/// no declarator (e.g. "struct foo;") is parsed.
-Sema::DeclTy *Sema::ParsedFreeStandingDeclSpec(Scope *S, DeclSpec &DS) {
-  // TODO: emit error on 'int;' or 'const enum foo;'.
-  // TODO: emit error on 'typedef int;'
-  // if (!DS.isMissingDeclaratorOk()) Diag(...);
-  
-  return 0;
-}
-
 /// LookupScopedDecl - Look up the inner-most declaration in the specified
 /// namespace.
-static Decl *LookupScopedDecl(IdentifierInfo *II, Decl::IdentifierNamespace NS){
+Decl *Sema::LookupScopedDecl(IdentifierInfo *II, unsigned NSI) {
   if (II == 0) return 0;
+  Decl::IdentifierNamespace NS = (Decl::IdentifierNamespace)NSI;
   
   // Scan up the scope chain looking for a decl that matches this identifier
   // that is in the appropriate namespace.  This search should not take long, as
@@ -88,6 +79,8 @@
   for (Decl *D = II->getFETokenInfo<Decl>(); D; D = D->getNext())
     if (D->getIdentifierNamespace() == NS)
       return D;
+  
+    
   return 0;
 }
 
@@ -164,6 +157,16 @@
   return New;
 }
 
+/// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
+/// no declarator (e.g. "struct foo;") is parsed.
+Sema::DeclTy *Sema::ParsedFreeStandingDeclSpec(Scope *S, DeclSpec &DS) {
+  // TODO: emit error on 'int;' or 'const enum foo;'.
+  // TODO: emit error on 'typedef int;'
+  // if (!DS.isMissingDeclaratorOk()) Diag(...);
+  
+  return 0;
+}
+
 
 Action::DeclTy *
 Sema::ParseDeclarator(Scope *S, Declarator &D, ExprTy *Init, 

Modified: cfe/cfe/trunk/include/clang/Lex/IdentifierTable.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Lex/IdentifierTable.h?rev=39326&r1=39325&r2=39326&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/Lex/IdentifierTable.h (original)
+++ cfe/cfe/trunk/include/clang/Lex/IdentifierTable.h Wed Jul 11 11:43:07 2007
@@ -31,8 +31,8 @@
 class IdentifierInfo {
   MacroInfo *Macro;                // Set if this identifier is #define'd.
   tok::TokenKind TokenID      : 8; // Front-end token ID or tok::identifier.
-  tok::PPKeywordKind PPID     : 5; // ID for preprocessor command like 'ifdef'.
-  tok::ObjCKeywordKind ObjCID : 5; // ID for preprocessor command like 'ifdef'.
+  tok::PPKeywordKind PPID     : 5; // ID for preprocessor command like #'ifdef'.
+  tok::ObjCKeywordKind ObjCID : 5; // ID for objc @ keyword like @'protocol'.
   bool IsExtension            : 1; // True if identifier is a lang extension.
   bool IsPoisoned             : 1; // True if identifier is poisoned.
   bool IsOtherTargetMacro     : 1; // True if ident is macro on another target.





More information about the cfe-commits mailing list