aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-05-29 14:49:33 +0000
committerDouglas Gregor <dgregor@apple.com>2009-05-29 14:49:33 +0000
commit00c4486243ac0baa77a387335541c742c4dd615a (patch)
tree4c2f1294ff70dccd64b7652778869d8a0c168d35
parent7b0a5723d6851a6f0365536508c2e4db678812b3 (diff)
Some cleanups and commenting to our declaration-name handling
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72570 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaExpr.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 9350caaca4..f4bfefca13 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -818,6 +818,7 @@ Sema::ActOnDeclarationNameExpr(Scope *S, SourceLocation Loc,
// 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 @@ Sema::ActOnDeclarationNameExpr(Scope *S, SourceLocation Loc,
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 @@ Sema::ActOnDeclarationNameExpr(Scope *S, SourceLocation Loc,
// 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) {