summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclCXX.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-09-29 04:25:11 +0000
committerDouglas Gregor <dgregor@apple.com>2010-09-29 04:25:11 +0000
commit457104e98b957aeca55481574ed395c6ee503fbc (patch)
treec05cd6e56c9eb9e22fd14e49b80884fa5a1d1318 /clang/lib/AST/DeclCXX.cpp
parent0be2dbb6a28c8d63defebb18a6dca822db8266ae (diff)
downloadbcm5719-llvm-457104e98b957aeca55481574ed395c6ee503fbc.tar.gz
bcm5719-llvm-457104e98b957aeca55481574ed395c6ee503fbc.zip
Move the management of the set of conversion functions in a C++ class
into CXXRecordDecl. The only part that we do not handle this way are using declarations, since that would require extra name lookup that we don't currently want to pay for. This fixes <rdar://problem/8459981>, so that LLDB can build a CXXRecordDecl and magically get all of the right bits set. llvm-svn: 115026
Diffstat (limited to 'clang/lib/AST/DeclCXX.cpp')
-rw-r--r--clang/lib/AST/DeclCXX.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp
index 6e879ee9ee4..19caae5b7f2 100644
--- a/clang/lib/AST/DeclCXX.cpp
+++ b/clang/lib/AST/DeclCXX.cpp
@@ -493,6 +493,30 @@ void CXXRecordDecl::addedMember(Decl *D) {
data().PlainOldData = false;
}
+ // Keep the list of conversion functions up-to-date.
+ if (CXXConversionDecl *Conversion = dyn_cast<CXXConversionDecl>(D)) {
+ // We don't record specializations.
+ if (Conversion->getPrimaryTemplate())
+ return;
+
+ // FIXME: We intentionally don't use the decl's access here because it
+ // hasn't been set yet. That's really just a misdesign in Sema.
+
+ if (FunTmpl) {
+ if (FunTmpl->getPreviousDeclaration())
+ data().Conversions.replace(FunTmpl->getPreviousDeclaration(),
+ FunTmpl);
+ else
+ data().Conversions.addDecl(FunTmpl);
+ } else {
+ if (Conversion->getPreviousDeclaration())
+ data().Conversions.replace(Conversion->getPreviousDeclaration(),
+ Conversion);
+ else
+ data().Conversions.addDecl(Conversion);
+ }
+ }
+
return;
}
@@ -546,6 +570,12 @@ void CXXRecordDecl::addedMember(Decl *D) {
}
}
}
+
+ // Handle using declarations of conversion functions.
+ if (UsingShadowDecl *Shadow = dyn_cast<UsingShadowDecl>(D))
+ if (Shadow->getDeclName().getNameKind()
+ == DeclarationName::CXXConversionFunctionName)
+ data().Conversions.addDecl(Shadow, Shadow->getAccess());
}
static CanQualType GetConversionType(ASTContext &Context, NamedDecl *Conv) {
@@ -833,6 +863,12 @@ void CXXRecordDecl::completeDefinition(CXXFinalOverriderMap *FinalOverriders) {
}
}
}
+
+ // Set access bits correctly on the directly-declared conversions.
+ for (UnresolvedSetIterator I = data().Conversions.begin(),
+ E = data().Conversions.end();
+ I != E; ++I)
+ data().Conversions.setAccess(I, (*I)->getAccess());
}
bool CXXRecordDecl::mayBeAbstract() const {
OpenPOWER on IntegriCloud