[cfe-commits] r90270 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/SemaCXX/member-expr.cpp
John McCall
rjmccall at apple.com
Tue Dec 1 14:28:41 PST 2009
Author: rjmccall
Date: Tue Dec 1 16:28:41 2009
New Revision: 90270
URL: http://llvm.org/viewvc/llvm-project?rev=90270&view=rev
Log:
Fix IsProvablyNotDerivedFrom to always use record definitions when available.
Gets clang-on-clang passing again.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/SemaCXX/member-expr.cpp
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=90270&r1=90269&r2=90270&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Dec 1 16:28:41 2009
@@ -711,10 +711,13 @@
static bool IsProvablyNotDerivedFrom(Sema &SemaRef,
CXXRecordDecl *Record,
const llvm::SmallPtrSet<CXXRecordDecl*, 4> &Bases) {
- Record = Record->getCanonicalDecl();
- if (Bases.count(Record))
+ if (Bases.count(Record->getCanonicalDecl()))
return false;
+ RecordDecl *RD = Record->getDefinition(SemaRef.Context);
+ if (!RD) return false;
+ Record = cast<CXXRecordDecl>(RD);
+
for (CXXRecordDecl::base_class_iterator I = Record->bases_begin(),
E = Record->bases_end(); I != E; ++I) {
CanQualType BaseT = SemaRef.Context.getCanonicalType((*I).getType());
@@ -722,9 +725,6 @@
if (!BaseRT) return false;
CXXRecordDecl *BaseRecord = cast<CXXRecordDecl>(BaseRT->getDecl());
- if (!BaseRecord->isDefinition())
- return false;
-
if (!IsProvablyNotDerivedFrom(SemaRef, BaseRecord, Bases))
return false;
}
Modified: cfe/trunk/test/SemaCXX/member-expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/member-expr.cpp?rev=90270&r1=90269&r2=90270&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/member-expr.cpp (original)
+++ cfe/trunk/test/SemaCXX/member-expr.cpp Tue Dec 1 16:28:41 2009
@@ -41,3 +41,18 @@
xp->::i = 7; // expected-error{{qualified member access refers to a member in the global namespace}}
xp->C::i = 7; // expected-error{{qualified member access refers to a member in namespace 'C'}}
}
+
+
+namespace test3 {
+ struct NamespaceDecl;
+
+ struct NamedDecl {
+ void *getIdentifier() const;
+ };
+
+ struct NamespaceDecl : NamedDecl {
+ bool isAnonymousNamespace() const {
+ return !getIdentifier();
+ }
+ };
+}
More information about the cfe-commits
mailing list