diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2015-07-25 15:27:04 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2015-07-25 15:27:04 +0000 |
commit | 1d38be985af424ab023dd8fbdb7345b573383919 (patch) | |
tree | 36b9a154f0e480b18ac9274e0819e9c8cb0804da /clang/lib/AST/CXXInheritance.cpp | |
parent | 6e4f6e1f06aaca0d1479e324c30162251692a59b (diff) | |
download | llvm-1d38be985af424ab023dd8fbdb7345b573383919.zip llvm-1d38be985af424ab023dd8fbdb7345b573383919.tar.gz llvm-1d38be985af424ab023dd8fbdb7345b573383919.tar.bz2 |
Capture 'this' so GCC 4.7 can find a static members.
llvm-svn: 243218
Diffstat (limited to 'clang/lib/AST/CXXInheritance.cpp')
-rw-r--r-- | clang/lib/AST/CXXInheritance.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/AST/CXXInheritance.cpp b/clang/lib/AST/CXXInheritance.cpp index c852919..75d775f 100644 --- a/clang/lib/AST/CXXInheritance.cpp +++ b/clang/lib/AST/CXXInheritance.cpp @@ -87,8 +87,9 @@ bool CXXRecordDecl::isDerivedFrom(const CXXRecordDecl *Base, Paths.setOrigin(const_cast<CXXRecordDecl*>(this)); const CXXRecordDecl *BaseDecl = Base->getCanonicalDecl(); + // FIXME: Capturing 'this' is a workaround for name lookup bugs in GCC 4.7. return lookupInBases( - [BaseDecl](const CXXBaseSpecifier *Specifier, CXXBasePath &Path) { + [this, BaseDecl](const CXXBaseSpecifier *Specifier, CXXBasePath &Path) { return FindBaseClass(Specifier, Path, BaseDecl); }, Paths); @@ -107,8 +108,9 @@ bool CXXRecordDecl::isVirtuallyDerivedFrom(const CXXRecordDecl *Base) const { Paths.setOrigin(const_cast<CXXRecordDecl*>(this)); const CXXRecordDecl *BaseDecl = Base->getCanonicalDecl(); + // FIXME: Capturing 'this' is a workaround for name lookup bugs in GCC 4.7. return lookupInBases( - [BaseDecl](const CXXBaseSpecifier *Specifier, CXXBasePath &Path) { + [this, BaseDecl](const CXXBaseSpecifier *Specifier, CXXBasePath &Path) { return FindVirtualBaseClass(Specifier, Path, BaseDecl); }, Paths); @@ -354,7 +356,7 @@ bool CXXRecordDecl::lookupInBases(BaseMatchesCallback BaseMatches, bool CXXRecordDecl::FindBaseClass(const CXXBaseSpecifier *Specifier, CXXBasePath &Path, const CXXRecordDecl *BaseRecord) { - assert(((Decl *)BaseRecord)->getCanonicalDecl() == BaseRecord && + assert(BaseRecord->getCanonicalDecl() == BaseRecord && "User data for FindBaseClass is not canonical!"); return Specifier->getType()->castAs<RecordType>()->getDecl() ->getCanonicalDecl() == BaseRecord; @@ -363,7 +365,7 @@ bool CXXRecordDecl::FindBaseClass(const CXXBaseSpecifier *Specifier, bool CXXRecordDecl::FindVirtualBaseClass(const CXXBaseSpecifier *Specifier, CXXBasePath &Path, const CXXRecordDecl *BaseRecord) { - assert(((Decl *)BaseRecord)->getCanonicalDecl() == BaseRecord && + assert(BaseRecord->getCanonicalDecl() == BaseRecord && "User data for FindBaseClass is not canonical!"); return Specifier->isVirtual() && Specifier->getType()->castAs<RecordType>()->getDecl() |