aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-05-29 23:42:05 +0000
committerAnders Carlsson <andersca@mac.com>2009-05-29 23:42:05 +0000
commit9e8a72291465488e734c8aa5e20142d8b3cd981c (patch)
treee92ffe820bda6a4affba17497fc9e7749931e267
parent7267c1693abe7875b0c57268be05005ae013c6c9 (diff)
Make the LookupBase boolean an enum instead.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72594 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaInherit.cpp7
-rw-r--r--lib/Sema/SemaInherit.h17
2 files changed, 17 insertions, 7 deletions
diff --git a/lib/Sema/SemaInherit.cpp b/lib/Sema/SemaInherit.cpp
index f5c7a7f2d0..5eef1eb4c0 100644
--- a/lib/Sema/SemaInherit.cpp
+++ b/lib/Sema/SemaInherit.cpp
@@ -175,10 +175,12 @@ bool Sema::LookupInBases(CXXRecordDecl *Class,
// type to see if we've found a member that meets the search
// criteria.
bool FoundPathToThisBase = false;
- if (Criteria.LookupBase) {
+ switch (Criteria.Kind) {
+ case MemberLookupCriteria::LK_Base:
FoundPathToThisBase
= (Context.getCanonicalType(BaseSpec->getType()) == Criteria.Base);
- } else {
+ break;
+ case MemberLookupCriteria::LK_NamedMember:
Paths.ScratchPath.Decls = BaseRecord->lookup(Context, Criteria.Name);
while (Paths.ScratchPath.Decls.first != Paths.ScratchPath.Decls.second) {
if (isAcceptableLookupResult(*Paths.ScratchPath.Decls.first,
@@ -188,6 +190,7 @@ bool Sema::LookupInBases(CXXRecordDecl *Class,
}
++Paths.ScratchPath.Decls.first;
}
+ break;
}
if (FoundPathToThisBase) {
diff --git a/lib/Sema/SemaInherit.h b/lib/Sema/SemaInherit.h
index a71ae8dbab..3319963691 100644
--- a/lib/Sema/SemaInherit.h
+++ b/lib/Sema/SemaInherit.h
@@ -202,22 +202,29 @@ namespace clang {
/// member of a C++ class. Objects of this type are used to direct
/// Sema::LookupCXXClassMember.
struct MemberLookupCriteria {
+ /// LookupKind - the kind of lookup we're doing.
+ enum LookupKind {
+ LK_Base,
+ LK_NamedMember
+ };
+
/// MemberLookupCriteria - Constructs member lookup criteria to
/// search for a base class of type Base.
explicit MemberLookupCriteria(QualType Base)
- : LookupBase(true), Base(Base) { }
+ : Kind(LK_Base), Base(Base) { }
/// MemberLookupCriteria - Constructs member lookup criteria to
/// search for a class member with the given Name.
explicit MemberLookupCriteria(DeclarationName Name,
Sema::LookupNameKind NameKind,
unsigned IDNS)
- : LookupBase(false), Name(Name), NameKind(NameKind), IDNS(IDNS) { }
+ : Kind(LK_NamedMember), Name(Name), NameKind(NameKind), IDNS(IDNS) { }
- /// LookupBase - True if we are looking for a base class (whose
- /// type is Base). If false, we are looking for a named member of
+ /// Kind - The kind of lookup we're doing.
+ /// LK_Base if we are looking for a base class (whose
+ /// type is Base). LK_NamedMember if we are looking for a named member of
/// the class (with the name Name).
- bool LookupBase;
+ LookupKind Kind;
/// Base - The type of the base class we're searching for, if
/// LookupBase is true.