aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Sema/Lookup.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Sema/Lookup.h')
-rw-r--r--include/clang/Sema/Lookup.h27
1 files changed, 17 insertions, 10 deletions
diff --git a/include/clang/Sema/Lookup.h b/include/clang/Sema/Lookup.h
index 00cc164d964c..1c6c7bbbd997 100644
--- a/include/clang/Sema/Lookup.h
+++ b/include/clang/Sema/Lookup.h
@@ -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);
@@ -424,13 +424,20 @@ public:
Paths = nullptr;
}
} else {
- AmbiguityKind SavedAK = Ambiguity;
+ AmbiguityKind SavedAK;
+ bool WasAmbiguous = false;
+ if (ResultKind == Ambiguous) {
+ SavedAK = Ambiguity;
+ WasAmbiguous = true;
+ }
ResultKind = Found;
resolveKind();
// If we didn't make the lookup unambiguous, restore the old
// ambiguity kind.
if (ResultKind == Ambiguous) {
+ (void)WasAmbiguous;
+ assert(WasAmbiguous);
Ambiguity = SavedAK;
} else if (Paths) {
deletePaths(Paths);
@@ -544,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
@@ -623,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) {
@@ -657,7 +664,7 @@ private:
QualType BaseObjectType;
// Parameters.
- Sema &SemaRef;
+ Sema *SemaPtr;
DeclarationNameInfo NameInfo;
SourceRange NameContextRange;
Sema::LookupNameKind LookupKind;