[cfe-commits] r61861 - in /cfe/trunk: include/clang/AST/Decl.h lib/Sema/SemaDecl.cpp

Douglas Gregor dgregor at apple.com
Wed Jan 7 08:34:42 PST 2009


Author: dgregor
Date: Wed Jan  7 10:34:42 2009
New Revision: 61861

URL: http://llvm.org/viewvc/llvm-project?rev=61861&view=rev
Log:
Use DeclContext::getLookupContext wherever necessary to ensure that we look through transparent contexts

Modified:
    cfe/trunk/include/clang/AST/Decl.h
    cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=61861&r1=61860&r2=61861&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Wed Jan  7 10:34:42 2009
@@ -195,7 +195,7 @@
   // be defined inside or outside a function etc).
   bool isDefinedOutsideFunctionOrMethod() const {
     if (getDeclContext())
-      return !getDeclContext()->isFunctionOrMethod();
+      return !getDeclContext()->getLookupContext()->isFunctionOrMethod();
     else
       return true;
   }
@@ -420,7 +420,7 @@
     if (getKind() != Decl::Var)
       return false;
     if (const DeclContext *DC = getDeclContext())
-      return DC->isFunctionOrMethod();
+      return DC->getLookupContext()->isFunctionOrMethod();
     return false;
   }
   
@@ -428,9 +428,11 @@
   bool isFileVarDecl() const {
     if (getKind() != Decl::Var)
       return false;
-    const DeclContext *Ctx = getDeclContext()->getLookupContext();
-    if (isa<TranslationUnitDecl>(Ctx) || isa<NamespaceDecl>(Ctx) )
-      return true;
+    if (const DeclContext *Ctx = getDeclContext()) {
+      Ctx = Ctx->getLookupContext();
+      if (isa<TranslationUnitDecl>(Ctx) || isa<NamespaceDecl>(Ctx) )
+        return true;
+    }
     return false;
   }
   

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Jan  7 10:34:42 2009
@@ -116,7 +116,8 @@
   //   in this case the class name or enumeration name is hidden.
   if (TagDecl *TD = dyn_cast<TagDecl>(D)) {
     // We are pushing the name of a tag (enum or class).
-    if (CurContext == TD->getDeclContext()) {
+    if (CurContext->getLookupContext() 
+          == TD->getDeclContext()->getLookupContext()) {
       // We're pushing the tag into the current context, which might
       // require some reshuffling in the identifier resolver.
       IdentifierResolver::iterator
@@ -679,7 +680,7 @@
   bool VDIsTentative = isTentativeDefinition(VD);
   bool VDIsIncompleteArray = VD->getType()->isIncompleteArrayType();
   
-  // FIXME: I don't this will actually see all of the
+  // FIXME: I don't think this will actually see all of the
   // redefinitions. Can't we check this property on-the-fly?
   for (IdentifierResolver::iterator
        I = IdResolver.begin(VD->getIdentifier(), 





More information about the cfe-commits mailing list