[cfe-commits] r72594 - in /cfe/trunk/lib/Sema: SemaInherit.cpp SemaInherit.h
Anders Carlsson
andersca at mac.com
Fri May 29 16:42:06 PDT 2009
Author: andersca
Date: Fri May 29 18:42:05 2009
New Revision: 72594
URL: http://llvm.org/viewvc/llvm-project?rev=72594&view=rev
Log:
Make the LookupBase boolean an enum instead.
Modified:
cfe/trunk/lib/Sema/SemaInherit.cpp
cfe/trunk/lib/Sema/SemaInherit.h
Modified: cfe/trunk/lib/Sema/SemaInherit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInherit.cpp?rev=72594&r1=72593&r2=72594&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInherit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInherit.cpp Fri May 29 18:42:05 2009
@@ -175,10 +175,12 @@
// 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 @@
}
++Paths.ScratchPath.Decls.first;
}
+ break;
}
if (FoundPathToThisBase) {
Modified: cfe/trunk/lib/Sema/SemaInherit.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInherit.h?rev=72594&r1=72593&r2=72594&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInherit.h (original)
+++ cfe/trunk/lib/Sema/SemaInherit.h Fri May 29 18:42:05 2009
@@ -202,22 +202,29 @@
/// 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.
More information about the cfe-commits
mailing list