Skip to content
Snippets Groups Projects
Commit dbcf9811 authored by Kaelyn Takata's avatar Kaelyn Takata
Browse files

Make LookupResult be copyable to avoid decomposing an existing one and

initializing a new one every time a copy is needed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221724 91177308-0d34-0410-b5e6-96231b3b80d8
parent 35fad28c
No related branches found
No related tags found
No related merge requests found
......@@ -98,7 +98,7 @@ class UnresolvedSetImpl {
private:
template <unsigned N> friend class UnresolvedSet;
UnresolvedSetImpl() {}
UnresolvedSetImpl(const UnresolvedSetImpl &) LLVM_DELETED_FUNCTION;
UnresolvedSetImpl(const UnresolvedSetImpl &) {};
public:
// We don't currently support assignment through this iterator, so we might
......
......@@ -132,7 +132,7 @@ public:
: ResultKind(NotFound),
Paths(nullptr),
NamingClass(nullptr),
SemaRef(SemaRef),
SemaPtr(&SemaRef),
NameInfo(NameInfo),
LookupKind(LookupKind),
IDNS(0),
......@@ -154,7 +154,7 @@ public:
: ResultKind(NotFound),
Paths(nullptr),
NamingClass(nullptr),
SemaRef(SemaRef),
SemaPtr(&SemaRef),
NameInfo(Name, NameLoc),
LookupKind(LookupKind),
IDNS(0),
......@@ -174,7 +174,7 @@ public:
: ResultKind(NotFound),
Paths(nullptr),
NamingClass(nullptr),
SemaRef(Other.SemaRef),
SemaPtr(Other.SemaPtr),
NameInfo(Other.NameInfo),
LookupKind(Other.LookupKind),
IDNS(Other.IDNS),
......@@ -305,7 +305,7 @@ public:
if (!D->isInIdentifierNamespace(IDNS))
return nullptr;
if (isHiddenDeclarationVisible() || isVisible(SemaRef, D))
if (isHiddenDeclarationVisible() || isVisible(getSema(), D))
return D;
return getAcceptableDeclSlow(D);
......@@ -551,7 +551,7 @@ public:
/// \brief Get the Sema object that this lookup result is searching
/// with.
Sema &getSema() const { return SemaRef; }
Sema &getSema() const { return *SemaPtr; }
/// A class for iterating through a result set and possibly
/// filtering out results. The results returned are possibly
......@@ -630,9 +630,9 @@ public:
private:
void diagnose() {
if (isAmbiguous())
SemaRef.DiagnoseAmbiguousLookup(*this);
else if (isClassLookup() && SemaRef.getLangOpts().AccessControl)
SemaRef.CheckLookupAccess(*this);
getSema().DiagnoseAmbiguousLookup(*this);
else if (isClassLookup() && getSema().getLangOpts().AccessControl)
getSema().CheckLookupAccess(*this);
}
void setAmbiguous(AmbiguityKind AK) {
......@@ -664,7 +664,7 @@ private:
QualType BaseObjectType;
// Parameters.
Sema &SemaRef;
Sema *SemaPtr;
DeclarationNameInfo NameInfo;
SourceRange NameContextRange;
Sema::LookupNameKind LookupKind;
......
......@@ -285,7 +285,7 @@ static inline unsigned getIDNS(Sema::LookupNameKind NameKind,
}
void LookupResult::configure() {
IDNS = getIDNS(LookupKind, SemaRef.getLangOpts().CPlusPlus,
IDNS = getIDNS(LookupKind, getSema().getLangOpts().CPlusPlus,
isForRedeclaration());
// If we're looking for one of the allocation or deallocation
......@@ -296,7 +296,7 @@ void LookupResult::configure() {
case OO_Delete:
case OO_Array_New:
case OO_Array_Delete:
SemaRef.DeclareGlobalNewDelete();
getSema().DeclareGlobalNewDelete();
break;
default:
......@@ -307,7 +307,7 @@ void LookupResult::configure() {
// up being declared.
if (IdentifierInfo *Id = NameInfo.getName().getAsIdentifierInfo()) {
if (unsigned BuiltinID = Id->getBuiltinID()) {
if (!SemaRef.Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID))
if (!getSema().Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID))
AllowHidden = true;
}
}
......@@ -400,8 +400,8 @@ void LookupResult::resolveKind() {
// canonical type.
if (TypeDecl *TD = dyn_cast<TypeDecl>(D)) {
if (!TD->getDeclContext()->isRecord()) {
QualType T = SemaRef.Context.getTypeDeclType(TD);
if (!UniqueTypes.insert(SemaRef.Context.getCanonicalType(T))) {
QualType T = getSema().Context.getTypeDeclType(TD);
if (!UniqueTypes.insert(getSema().Context.getCanonicalType(T))) {
// The type is not unique; pull something off the back and continue
// at this index.
Decls[I] = Decls[--N];
......@@ -1265,7 +1265,7 @@ static NamedDecl *findAcceptableDecl(Sema &SemaRef, NamedDecl *D) {
}
NamedDecl *LookupResult::getAcceptableDeclSlow(NamedDecl *D) const {
return findAcceptableDecl(SemaRef, D);
return findAcceptableDecl(getSema(), D);
}
/// @brief Perform unqualified name lookup starting from a given
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment