[cfe-commits] r72570 - /cfe/trunk/lib/Sema/SemaExpr.cpp

Douglas Gregor dgregor at apple.com
Fri May 29 07:49:44 PDT 2009


Author: dgregor
Date: Fri May 29 09:49:33 2009
New Revision: 72570

URL: http://llvm.org/viewvc/llvm-project?rev=72570&view=rev
Log:
Some cleanups and commenting to our declaration-name handling

Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri May 29 09:49:33 2009
@@ -818,6 +818,7 @@
   //   An id-expression is type-dependent if it contains:
   //     -- a nested-name-specifier that contains a class-name that
   //        names a dependent type.
+  // FIXME: Member of the current instantiation.
   if (SS && isDependentScopeSpecifier(*SS)) {
     return Owned(new (Context) UnresolvedDeclRefExpr(Name, Context.DependentTy,
                                                      Loc, SS->getRange(), 
@@ -962,17 +963,7 @@
       if (!DType.isNull()) {
         // The pointer is type- and value-dependent if it points into something
         // dependent.
-        bool Dependent = false;
-        for (; DC; DC = DC->getParent()) {
-          // FIXME: could stop early at namespace scope.
-          if (DC->isRecord()) {
-            CXXRecordDecl *Record = cast<CXXRecordDecl>(DC);
-            if (Context.getTypeDeclType(Record)->isDependentType()) {
-              Dependent = true;
-              break;
-            }
-          }
-        }
+        bool Dependent = DC->isDependentContext();
         return Owned(BuildDeclRefExpr(D, DType, Loc, Dependent, Dependent, SS));
       }
     }
@@ -1083,6 +1074,9 @@
     // Warn about constructs like:
     //   if (void *X = foo()) { ... } else { X }.
     // In the else block, the pointer is always false.
+
+    // FIXME: In a template instantiation, we don't have scope
+    // information to check this property.
     if (Var->isDeclaredInCondition() && Var->getType()->isScalarType()) {
       Scope *CheckS = S;
       while (CheckS) {





More information about the cfe-commits mailing list