aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaLookup.cpp
diff options
context:
space:
mode:
authorSean Hunt <scshunt@csclub.uwaterloo.ca>2011-06-03 21:10:40 +0000
committerSean Hunt <scshunt@csclub.uwaterloo.ca>2011-06-03 21:10:40 +0000
commitc5c9b538de70124a57bee0adbfdd7853a582176e (patch)
tree939357d7dee5c145e1026e668d74ca5d50352b32 /lib/Sema/SemaLookup.cpp
parentc594abdb78b67d477c9bdd24c3600aec3dc2eda4 (diff)
Revert r132572 to figure out why it broke selfhost and clean it up as
suggested by Chandler. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132593 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaLookup.cpp')
-rw-r--r--lib/Sema/SemaLookup.cpp58
1 files changed, 8 insertions, 50 deletions
diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp
index 6a441a38d0..2bfa86cb55 100644
--- a/lib/Sema/SemaLookup.cpp
+++ b/lib/Sema/SemaLookup.cpp
@@ -14,7 +14,6 @@
#include "clang/Sema/Sema.h"
#include "clang/Sema/SemaInternal.h"
#include "clang/Sema/Lookup.h"
-#include "clang/Sema/Overload.h"
#include "clang/Sema/DeclSpec.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/ScopeInfo.h"
@@ -2137,51 +2136,6 @@ void Sema::LookupOverloadedOperatorName(OverloadedOperatorKind Op, Scope *S,
}
}
-Sema::SpecialMemberOverloadResult Sema::LookupSpecialMember(CXXRecordDecl *D,
- CXXSpecialMember SM,
- bool ConstArg,
- bool VolatileArg,
- bool RValueThis,
- bool ConstThis,
- bool VolatileThis) {
- D = D->getDefinition();
- assert((D && !D->isBeingDefined()) &&
- "doing special member lookup into record that isn't fully complete");
- if (RValueThis || ConstThis || VolatileThis)
- assert((SM == CXXCopyAssignment || SM == CXXMoveAssignment) &&
- "constructors and destructors always have unqualified lvalue this");
- if (ConstArg || VolatileArg)
- assert((SM != CXXDefaultConstructor && SM != CXXDestructor) &&
- "parameter-less special members can't have qualified arguments");
-
- // Check the cache for this member
- SpecialMemberID ID = {D, SM, ConstArg, VolatileArg, RValueThis, ConstThis,
- VolatileThis};
- SpecialMemberOverloadResult Blank;
- llvm::DenseMap<SpecialMemberID, SpecialMemberOverloadResult>::iterator It;
- bool New;
-
- llvm::tie(It, New) = SpecialMemberCache.insert(std::make_pair(ID, Blank));
- SpecialMemberOverloadResult &Result = It->second;
-
- // This was already cached
- if (!New)
- return Result;
-
- if (SM == CXXDestructor) {
- if (!D->hasDeclaredDestructor())
- DeclareImplicitDestructor(D);
- CXXDestructorDecl *DD = D->getDestructor();
- assert(DD && "record without a destructor");
- Result.setMethod(DD);
- Result.setSuccess(DD->isDeleted());
- Result.setConstParamMatch(false);
- return Result;
- }
-
- llvm_unreachable("haven't implemented this for non-destructors yet");
-}
-
/// \brief Look up the constructors for the given class.
DeclContext::lookup_result Sema::LookupConstructors(CXXRecordDecl *Class) {
// If the copy constructor has not yet been declared, do so now.
@@ -2199,13 +2153,17 @@ DeclContext::lookup_result Sema::LookupConstructors(CXXRecordDecl *Class) {
/// \brief Look for the destructor of the given class.
///
-/// The destructor will be declared if necessary.
+/// During semantic analysis, this routine should be used in lieu of
+/// CXXRecordDecl::getDestructor().
///
/// \returns The destructor for this class.
CXXDestructorDecl *Sema::LookupDestructor(CXXRecordDecl *Class) {
- return cast<CXXDestructorDecl>(LookupSpecialMember(Class, CXXDestructor,
- false, false, false,
- false, false).getMethod());
+ // If the destructor has not yet been declared, do so now.
+ if (CanDeclareSpecialMemberFunction(Context, Class) &&
+ !Class->hasDeclaredDestructor())
+ DeclareImplicitDestructor(Class);
+
+ return Class->getDestructor();
}
void ADLResult::insert(NamedDecl *New) {