r230123 - Cleanup: remove artificial division between lookup results and const lookup
Richard Smith
richard-llvm at metafoo.co.uk
Fri Feb 20 18:45:19 PST 2015
Author: rsmith
Date: Fri Feb 20 20:45:19 2015
New Revision: 230123
URL: http://llvm.org/viewvc/llvm-project?rev=230123&view=rev
Log:
Cleanup: remove artificial division between lookup results and const lookup
results. No-one was ever modifying a lookup result, and it would not be
reasonable to do so.
Modified:
cfe/trunk/include/clang/AST/DeclBase.h
cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/AST/DeclBase.cpp
cfe/trunk/lib/AST/DeclCXX.cpp
cfe/trunk/lib/AST/DeclObjC.cpp
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Sema/SemaLookup.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp
cfe/trunk/tools/libclang/CXType.cpp
Modified: cfe/trunk/include/clang/AST/DeclBase.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=230123&r1=230122&r2=230123&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Fri Feb 20 20:45:19 2015
@@ -1063,9 +1063,6 @@ public:
}
};
-// FIXME: Remove this.
-typedef DeclContextLookupResult DeclContextLookupConstResult;
-
/// DeclContext - This is used only as base class of specific decl types that
/// can act as declaration contexts. These decls are (only the top classes
/// that directly derive from DeclContext are mentioned, not their subclasses):
@@ -1580,10 +1577,6 @@ public:
typedef DeclContextLookupResult lookup_result;
typedef lookup_result::iterator lookup_iterator;
- // FIXME: Remove these.
- typedef lookup_result lookup_const_result;
- typedef lookup_iterator lookup_const_iterator;
-
/// lookup - Find the declarations (if any) with the given Name in
/// this context. Returns a range of iterators that contains all of
/// the declarations with this name, with object, function, member,
Modified: cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ObjCMT.cpp?rev=230123&r1=230122&r2=230123&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Fri Feb 20 20:45:19 2015
@@ -624,7 +624,7 @@ ClassImplementsAllMethodsAndProperties(A
if (Property->getPropertyImplementation() == ObjCPropertyDecl::Optional)
continue;
HasAtleastOneRequiredProperty = true;
- DeclContext::lookup_const_result R = IDecl->lookup(Property->getDeclName());
+ DeclContext::lookup_result R = IDecl->lookup(Property->getDeclName());
if (R.size() == 0) {
// Relax the rule and look into class's implementation for a synthesize
// or dynamic declaration. Class is implementing a property coming from
@@ -655,7 +655,7 @@ ClassImplementsAllMethodsAndProperties(A
continue;
if (MD->getImplementationControl() == ObjCMethodDecl::Optional)
continue;
- DeclContext::lookup_const_result R = ImpDecl->lookup(MD->getDeclName());
+ DeclContext::lookup_result R = ImpDecl->lookup(MD->getDeclName());
if (R.size() == 0)
return false;
bool match = false;
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=230123&r1=230122&r2=230123&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Fri Feb 20 20:45:19 2015
@@ -2532,8 +2532,8 @@ FunctionDecl::getCorrespondingUnsizedGlo
// This is a sized deallocation function. Find the corresponding unsized
// deallocation function.
- lookup_const_result R = getDeclContext()->lookup(getDeclName());
- for (lookup_const_result::iterator RI = R.begin(), RE = R.end(); RI != RE;
+ lookup_result R = getDeclContext()->lookup(getDeclName());
+ for (lookup_result::iterator RI = R.begin(), RE = R.end(); RI != RE;
++RI)
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(*RI))
if (FD->getNumParams() == 1 && !FD->isVariadic())
Modified: cfe/trunk/lib/AST/DeclBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=230123&r1=230122&r2=230123&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Fri Feb 20 20:45:19 2015
@@ -1585,7 +1585,7 @@ UsingDirectiveDecl *DeclContext::udir_it
DeclContext::udir_range DeclContext::using_directives() const {
// FIXME: Use something more efficient than normal lookup for using
// directives. In C++, using directives are looked up more than anything else.
- lookup_const_result Result = lookup(UsingDirectiveDecl::getName());
+ lookup_result Result = lookup(UsingDirectiveDecl::getName());
return udir_range(Result.begin(), Result.end());
}
Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=230123&r1=230122&r2=230123&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Fri Feb 20 20:45:19 2015
@@ -991,7 +991,7 @@ CXXMethodDecl* CXXRecordDecl::getLambdaC
if (!isLambda()) return nullptr;
DeclarationName Name =
getASTContext().DeclarationNames.getCXXOperatorName(OO_Call);
- DeclContext::lookup_const_result Calls = lookup(Name);
+ DeclContext::lookup_result Calls = lookup(Name);
assert(!Calls.empty() && "Missing lambda call operator!");
assert(Calls.size() == 1 && "More than one lambda call operator!");
@@ -1008,7 +1008,7 @@ CXXMethodDecl* CXXRecordDecl::getLambdaS
if (!isLambda()) return nullptr;
DeclarationName Name =
&getASTContext().Idents.get(getLambdaStaticInvokerName());
- DeclContext::lookup_const_result Invoker = lookup(Name);
+ DeclContext::lookup_result Invoker = lookup(Name);
if (Invoker.empty()) return nullptr;
assert(Invoker.size() == 1 && "More than one static invoker operator!");
NamedDecl *InvokerFun = Invoker.front();
@@ -1307,7 +1307,7 @@ CXXDestructorDecl *CXXRecordDecl::getDes
= Context.DeclarationNames.getCXXDestructorName(
Context.getCanonicalType(ClassType));
- DeclContext::lookup_const_result R = lookup(Name);
+ DeclContext::lookup_result R = lookup(Name);
if (R.empty())
return nullptr;
@@ -1490,8 +1490,8 @@ bool CXXMethodDecl::isUsualDeallocationF
// This function is a usual deallocation function if there are no
// single-parameter deallocation functions of the same kind.
- DeclContext::lookup_const_result R = getDeclContext()->lookup(getDeclName());
- for (DeclContext::lookup_const_result::iterator I = R.begin(), E = R.end();
+ DeclContext::lookup_result R = getDeclContext()->lookup(getDeclName());
+ for (DeclContext::lookup_result::iterator I = R.begin(), E = R.end();
I != E; ++I) {
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(*I))
if (FD->getNumParams() == 1)
Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=230123&r1=230122&r2=230123&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Fri Feb 20 20:45:19 2015
@@ -54,8 +54,8 @@ void ObjCContainerDecl::anchor() { }
///
ObjCIvarDecl *
ObjCContainerDecl::getIvarDecl(IdentifierInfo *Id) const {
- lookup_const_result R = lookup(Id);
- for (lookup_const_iterator Ivar = R.begin(), IvarEnd = R.end();
+ lookup_result R = lookup(Id);
+ for (lookup_iterator Ivar = R.begin(), IvarEnd = R.end();
Ivar != IvarEnd; ++Ivar) {
if (ObjCIvarDecl *ivar = dyn_cast<ObjCIvarDecl>(*Ivar))
return ivar;
@@ -83,8 +83,8 @@ ObjCContainerDecl::getMethod(Selector Se
// + (float) class_method;
// @end
//
- lookup_const_result R = lookup(Sel);
- for (lookup_const_iterator Meth = R.begin(), MethEnd = R.end();
+ lookup_result R = lookup(Sel);
+ for (lookup_iterator Meth = R.begin(), MethEnd = R.end();
Meth != MethEnd; ++Meth) {
ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(*Meth);
if (MD && MD->isInstanceMethod() == isInstance)
@@ -101,8 +101,8 @@ ObjCContainerDecl::getMethod(Selector Se
bool ObjCContainerDecl::HasUserDeclaredSetterMethod(
const ObjCPropertyDecl *Property) const {
Selector Sel = Property->getSetterName();
- lookup_const_result R = lookup(Sel);
- for (lookup_const_iterator Meth = R.begin(), MethEnd = R.end();
+ lookup_result R = lookup(Sel);
+ for (lookup_iterator Meth = R.begin(), MethEnd = R.end();
Meth != MethEnd; ++Meth) {
ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(*Meth);
if (MD && MD->isInstanceMethod() && !MD->isImplicit())
@@ -161,8 +161,8 @@ ObjCPropertyDecl::findPropertyDecl(const
return nullptr;
}
- DeclContext::lookup_const_result R = DC->lookup(propertyID);
- for (DeclContext::lookup_const_iterator I = R.begin(), E = R.end(); I != E;
+ DeclContext::lookup_result R = DC->lookup(propertyID);
+ for (DeclContext::lookup_iterator I = R.begin(), E = R.end(); I != E;
++I)
if (ObjCPropertyDecl *PD = dyn_cast<ObjCPropertyDecl>(*I))
return PD;
Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=230123&r1=230122&r2=230123&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Fri Feb 20 20:45:19 2015
@@ -799,8 +799,8 @@ void ResultBuilder::MaybeAddConstructorR
DeclarationName ConstructorName
= Context.DeclarationNames.getCXXConstructorName(
Context.getCanonicalType(RecordTy));
- DeclContext::lookup_const_result Ctors = Record->lookup(ConstructorName);
- for (DeclContext::lookup_const_iterator I = Ctors.begin(),
+ DeclContext::lookup_result Ctors = Record->lookup(ConstructorName);
+ for (DeclContext::lookup_iterator I = Ctors.begin(),
E = Ctors.end();
I != E; ++I) {
R.Declaration = *I;
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=230123&r1=230122&r2=230123&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Fri Feb 20 20:45:19 2015
@@ -351,13 +351,13 @@ static bool isIntOrBool(Expr *Exp) {
// Check to see if the type is a smart pointer of some kind. We assume
// it's a smart pointer if it defines both operator-> and operator*.
static bool threadSafetyCheckIsSmartPointer(Sema &S, const RecordType* RT) {
- DeclContextLookupConstResult Res1 = RT->getDecl()->lookup(
- S.Context.DeclarationNames.getCXXOperatorName(OO_Star));
+ DeclContextLookupResult Res1 = RT->getDecl()->lookup(
+ S.Context.DeclarationNames.getCXXOperatorName(OO_Star));
if (Res1.empty())
return false;
- DeclContextLookupConstResult Res2 = RT->getDecl()->lookup(
- S.Context.DeclarationNames.getCXXOperatorName(OO_Arrow));
+ DeclContextLookupResult Res2 = RT->getDecl()->lookup(
+ S.Context.DeclarationNames.getCXXOperatorName(OO_Arrow));
if (Res2.empty())
return false;
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=230123&r1=230122&r2=230123&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Fri Feb 20 20:45:19 2015
@@ -9069,7 +9069,7 @@ private:
ASTContext &Context = SemaRef.Context;
DeclarationName Name = Context.DeclarationNames.getCXXConstructorName(
Context.getCanonicalType(Context.getRecordType(Base)));
- DeclContext::lookup_const_result Decls = Derived->lookup(Name);
+ DeclContext::lookup_result Decls = Derived->lookup(Name);
return Decls.empty() ? Derived->getLocation() : Decls[0]->getLocation();
}
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=230123&r1=230122&r2=230123&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Fri Feb 20 20:45:19 2015
@@ -3541,8 +3541,8 @@ static bool EvaluateUnaryTypeTrait(Sema
bool FoundConstructor = false;
unsigned FoundTQs;
- DeclContext::lookup_const_result R = Self.LookupConstructors(RD);
- for (DeclContext::lookup_const_iterator Con = R.begin(),
+ DeclContext::lookup_result R = Self.LookupConstructors(RD);
+ for (DeclContext::lookup_iterator Con = R.begin(),
ConEnd = R.end(); Con != ConEnd; ++Con) {
// A template constructor is never a copy constructor.
// FIXME: However, it may actually be selected at the actual overload
@@ -3581,8 +3581,8 @@ static bool EvaluateUnaryTypeTrait(Sema
return true;
bool FoundConstructor = false;
- DeclContext::lookup_const_result R = Self.LookupConstructors(RD);
- for (DeclContext::lookup_const_iterator Con = R.begin(),
+ DeclContext::lookup_result R = Self.LookupConstructors(RD);
+ for (DeclContext::lookup_iterator Con = R.begin(),
ConEnd = R.end(); Con != ConEnd; ++Con) {
// FIXME: In C++0x, a constructor template can be a default constructor.
if (isa<FunctionTemplateDecl>(*Con))
Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=230123&r1=230122&r2=230123&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Fri Feb 20 20:45:19 2015
@@ -673,8 +673,8 @@ static bool LookupDirect(Sema &S, Lookup
DeclareImplicitMemberFunctionsWithName(S, R.getLookupName(), DC);
// Perform lookup into this declaration context.
- DeclContext::lookup_const_result DR = DC->lookup(R.getLookupName());
- for (DeclContext::lookup_const_iterator I = DR.begin(), E = DR.end(); I != E;
+ DeclContext::lookup_result DR = DC->lookup(R.getLookupName());
+ for (DeclContext::lookup_iterator I = DR.begin(), E = DR.end(); I != E;
++I) {
NamedDecl *D = *I;
if ((D = R.getAcceptableDecl(D))) {
Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=230123&r1=230122&r2=230123&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriter.cpp Fri Feb 20 20:45:19 2015
@@ -3699,7 +3699,7 @@ void ASTWriter::AddUpdatedDeclContext(co
// Ensure we emit all the visible declarations.
visitLocalLookupResults(DC, DC->NeedToReconcileExternalVisibleStorage,
[&](DeclarationName Name,
- DeclContext::lookup_const_result Result) {
+ DeclContext::lookup_result Result) {
for (auto *Decl : Result)
GetDeclRef(getDeclForLocalLookup(getLangOpts(), Decl));
});
Modified: cfe/trunk/tools/libclang/CXType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXType.cpp?rev=230123&r1=230122&r2=230123&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CXType.cpp (original)
+++ cfe/trunk/tools/libclang/CXType.cpp Fri Feb 20 20:45:19 2015
@@ -804,7 +804,7 @@ long long clang_Type_getOffsetOf(CXType
ASTContext &Ctx = cxtu::getASTUnit(GetTU(PT))->getASTContext();
IdentifierInfo *II = &Ctx.Idents.get(S);
DeclarationName FieldName(II);
- RecordDecl::lookup_const_result Res = RD->lookup(FieldName);
+ RecordDecl::lookup_result Res = RD->lookup(FieldName);
// If a field of the parent record is incomplete, lookup will fail.
// and we would return InvalidFieldName instead of Incomplete.
// But this erroneous results does protects again a hidden assertion failure
More information about the cfe-commits
mailing list