[cfe-commits] r111013 - /cfe/trunk/lib/Sema/SemaType.cpp
Abramo Bagnara
abramo.bagnara at gmail.com
Fri Aug 13 05:56:25 PDT 2010
Author: abramo
Date: Fri Aug 13 07:56:25 2010
New Revision: 111013
URL: http://llvm.org/viewvc/llvm-project?rev=111013&view=rev
Log:
Fixed NNS insertion in MemberPointerType.
Modified:
cfe/trunk/lib/Sema/SemaType.cpp
Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=111013&r1=111012&r2=111013&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Fri Aug 13 07:56:25 2010
@@ -1294,19 +1294,19 @@
}
case DeclaratorChunk::MemberPointer:
// The scope spec must refer to a class, or be dependent.
+ CXXScopeSpec &SS = DeclType.Mem.Scope();
QualType ClsType;
- if (DeclType.Mem.Scope().isInvalid()) {
+ if (SS.isInvalid()) {
// Avoid emitting extra errors if we already errored on the scope.
D.setInvalidType(true);
- } else if (isDependentScopeSpecifier(DeclType.Mem.Scope())
- || dyn_cast_or_null<CXXRecordDecl>(
- computeDeclContext(DeclType.Mem.Scope()))) {
+ } else if (isDependentScopeSpecifier(SS) ||
+ dyn_cast_or_null<CXXRecordDecl>(computeDeclContext(SS))) {
NestedNameSpecifier *NNS
- = (NestedNameSpecifier *)DeclType.Mem.Scope().getScopeRep();
+ = static_cast<NestedNameSpecifier*>(SS.getScopeRep());
NestedNameSpecifier *NNSPrefix = NNS->getPrefix();
switch (NNS->getKind()) {
case NestedNameSpecifier::Identifier:
- ClsType = Context.getDependentNameType(ETK_None, NNSPrefix,
+ ClsType = Context.getDependentNameType(ETK_None, NNSPrefix,
NNS->getAsIdentifier());
break;
@@ -1314,12 +1314,16 @@
case NestedNameSpecifier::Global:
llvm_unreachable("Nested-name-specifier must name a type");
break;
-
+
case NestedNameSpecifier::TypeSpec:
case NestedNameSpecifier::TypeSpecWithTemplate:
- // Note: NNSPrefix (if any) is included in ClsType
- // (hence, no need to wrap ClsType in an elaborated type).
ClsType = QualType(NNS->getAsType(), 0);
+ // Note: if NNS is dependent, then its prefix (if any) is already
+ // included in ClsType; this does not hold if the NNS is
+ // nondependent: in this case (if there is indeed a prefix)
+ // ClsType needs to be wrapped into an elaborated type.
+ if (NNSPrefix && !NNS->isDependent())
+ ClsType = Context.getElaboratedType(ETK_None, NNSPrefix, ClsType);
break;
}
} else {
More information about the cfe-commits
mailing list