[cfe-commits] r76274 - in /cfe/trunk: include/clang/AST/ASTContext.h lib/AST/ASTContext.cpp lib/AST/DeclTemplate.cpp lib/Sema/SemaLookup.cpp lib/Sema/SemaOverload.cpp lib/Sema/SemaTemplate.cpp lib/Sema/SemaTemplateDeduction.cpp lib/Sema/SemaTemplateInstantiate.cpp lib/Sema/SemaTemplateInstantiateDecl.cpp
Argiris Kirtzidis
akyrtzi at gmail.com
Fri Jul 17 17:34:25 PDT 2009
Author: akirtzidis
Date: Fri Jul 17 19:34:25 2009
New Revision: 76274
URL: http://llvm.org/viewvc/llvm-project?rev=76274&view=rev
Log:
Remove ASTContext::getCanonicalDecl() and use Decl::getCanonicalDecl in its place.
Modified:
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/AST/DeclTemplate.cpp
cfe/trunk/lib/Sema/SemaLookup.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=76274&r1=76273&r2=76274&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Fri Jul 17 19:34:25 2009
@@ -643,19 +643,6 @@
return T1.getUnqualifiedType() == T2.getUnqualifiedType();
}
- /// \brief Retrieves the "canonical" declaration of the given declaration.
- Decl *getCanonicalDecl(Decl *D);
-
- /// \brief Retrieves the "canonical" declaration of the given tag
- /// declaration.
- ///
- /// The canonical declaration for the given tag declaration is
- /// either the definition of the tag (if it is a complete type) or
- /// the first declaration of that tag.
- TagDecl *getCanonicalDecl(TagDecl *Tag) {
- return cast<TagDecl>(getCanonicalDecl((Decl *)Tag));
- }
-
/// \brief Retrieves the "canonical" declaration of
/// \brief Retrieves the "canonical" nested name specifier for a
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=76274&r1=76273&r2=76274&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Fri Jul 17 19:34:25 2009
@@ -2082,17 +2082,11 @@
VAT->getBracketsRange());
}
-Decl *ASTContext::getCanonicalDecl(Decl *D) {
- if (!D)
- return 0;
- return D->getCanonicalDecl();
-}
-
TemplateName ASTContext::getCanonicalTemplateName(TemplateName Name) {
// If this template name refers to a template, the canonical
// template name merely stores the template itself.
if (TemplateDecl *Template = Name.getAsTemplateDecl())
- return TemplateName(cast<TemplateDecl>(getCanonicalDecl(Template)));
+ return TemplateName(cast<TemplateDecl>(Template->getCanonicalDecl()));
DependentTemplateName *DTN = Name.getAsDependentTemplateName();
assert(DTN && "Non-dependent template names must refer to template decls.");
Modified: cfe/trunk/lib/AST/DeclTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclTemplate.cpp?rev=76274&r1=76273&r2=76274&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclTemplate.cpp (original)
+++ cfe/trunk/lib/AST/DeclTemplate.cpp Fri Jul 17 19:34:25 2009
@@ -200,7 +200,7 @@
TemplateTemplateParmDecl *TTP = cast<TemplateTemplateParmDecl>(*Param);
TemplateArgs.push_back(TemplateArgument(TTP->getLocation(), TTP));
CanonTemplateArgs.push_back(TemplateArgument(TTP->getLocation(),
- Context.getCanonicalDecl(TTP)));
+ TTP->getCanonicalDecl()));
}
}
Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=76274&r1=76273&r2=76274&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Fri Jul 17 19:34:25 2009
@@ -217,7 +217,7 @@
NamedDecl *ND = I->getAsDecl()->getUnderlyingDecl();
if (TagDecl *TD = dyn_cast<TagDecl>(ND)) {
- TagFound = Context.getCanonicalDecl(TD);
+ TagFound = TD->getCanonicalDecl();
TagNames += FoundDecls.insert(TagFound)? 1 : 0;
} else if (ND->isFunctionOrFunctionTemplate())
Functions += FoundDecls.insert(ND)? 1 : 0;
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=76274&r1=76273&r2=76274&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Fri Jul 17 19:34:25 2009
@@ -3764,7 +3764,7 @@
assert(FunctionType
== Context.getCanonicalType(Specialization->getType()));
Matches.insert(
- cast<FunctionDecl>(Context.getCanonicalDecl(Specialization)));
+ cast<FunctionDecl>(Specialization->getCanonicalDecl()));
}
}
@@ -3778,7 +3778,7 @@
if (FunctionDecl *FunDecl = dyn_cast<FunctionDecl>(*Fun)) {
if (FunctionType == Context.getCanonicalType(FunDecl->getType())) {
- Matches.insert(cast<FunctionDecl>(Context.getCanonicalDecl(*Fun)));
+ Matches.insert(cast<FunctionDecl>(Fun->getCanonicalDecl()));
FoundNonTemplateFunction = true;
}
}
Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=76274&r1=76273&r2=76274&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Fri Jul 17 19:34:25 2009
@@ -56,7 +56,7 @@
// which could be the current specialization or another
// specialization.
if (Record->isInjectedClassName()) {
- Record = cast<CXXRecordDecl>(Context.getCanonicalDecl(Record));
+ Record = cast<CXXRecordDecl>(Record->getCanonicalDecl());
if ((Template = Record->getDescribedClassTemplate()))
TNK = TNK_Type_template;
else if (ClassTemplateSpecializationDecl *Spec
@@ -795,7 +795,7 @@
case TemplateArgument::Declaration:
Canonical.push_back(
TemplateArgument(SourceLocation(),
- Context.getCanonicalDecl(TemplateArgs[Idx].getAsDecl())));
+ TemplateArgs[Idx].getAsDecl()->getCanonicalDecl()));
break;
case TemplateArgument::Integral:
@@ -1278,7 +1278,7 @@
// Add the converted template argument.
Decl *D
- = Context.getCanonicalDecl(cast<DeclRefExpr>(ArgExpr)->getDecl());
+ = cast<DeclRefExpr>(ArgExpr)->getDecl()->getCanonicalDecl();
Converted.Append(TemplateArgument(Arg.getLocation(), D));
continue;
}
@@ -1702,7 +1702,8 @@
if (CheckTemplateArgumentPointerToMember(Arg, Member))
return true;
- Member = cast_or_null<NamedDecl>(Context.getCanonicalDecl(Member));
+ if (Member)
+ Member = cast<NamedDecl>(Member->getCanonicalDecl());
Converted = TemplateArgument(StartLoc, Member);
return false;
}
@@ -1711,7 +1712,8 @@
if (CheckTemplateArgumentAddressOfObjectOrFunction(Arg, Entity))
return true;
- Entity = cast_or_null<NamedDecl>(Context.getCanonicalDecl(Entity));
+ if (Entity)
+ Entity = cast<NamedDecl>(Entity->getCanonicalDecl());
Converted = TemplateArgument(StartLoc, Entity);
return false;
}
@@ -1750,7 +1752,8 @@
if (CheckTemplateArgumentAddressOfObjectOrFunction(Arg, Entity))
return true;
- Entity = cast_or_null<NamedDecl>(Context.getCanonicalDecl(Entity));
+ if (Entity)
+ Entity = cast<NamedDecl>(Entity->getCanonicalDecl());
Converted = TemplateArgument(StartLoc, Entity);
return false;
}
@@ -1791,7 +1794,7 @@
if (CheckTemplateArgumentAddressOfObjectOrFunction(Arg, Entity))
return true;
- Entity = cast<NamedDecl>(Context.getCanonicalDecl(Entity));
+ Entity = cast<NamedDecl>(Entity->getCanonicalDecl());
Converted = TemplateArgument(StartLoc, Entity);
return false;
}
@@ -1820,7 +1823,8 @@
if (CheckTemplateArgumentPointerToMember(Arg, Member))
return true;
- Member = cast_or_null<NamedDecl>(Context.getCanonicalDecl(Member));
+ if (Member)
+ Member = cast<NamedDecl>(Member->getCanonicalDecl());
Converted = TemplateArgument(StartLoc, Member);
return false;
}
Modified: cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp?rev=76274&r1=76273&r2=76274&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp Fri Jul 17 19:34:25 2009
@@ -170,8 +170,8 @@
return Sema::TDK_Inconsistent;
}
- ParamDecl = cast<TemplateDecl>(Context.getCanonicalDecl(ParamDecl));
- ArgDecl = cast<TemplateDecl>(Context.getCanonicalDecl(ArgDecl));
+ ParamDecl = cast<TemplateDecl>(ParamDecl->getCanonicalDecl());
+ ArgDecl = cast<TemplateDecl>(ArgDecl->getCanonicalDecl());
if (ParamDecl != ArgDecl) {
// FIXME: fill in Info.Param/Info.FirstArg
return Sema::TDK_Inconsistent;
@@ -799,8 +799,8 @@
Context.getCanonicalType(Y.getAsType());
case TemplateArgument::Declaration:
- return Context.getCanonicalDecl(X.getAsDecl()) ==
- Context.getCanonicalDecl(Y.getAsDecl());
+ return X.getAsDecl()->getCanonicalDecl() ==
+ Y.getAsDecl()->getCanonicalDecl();
case TemplateArgument::Integral:
return *X.getAsIntegral() == *Y.getAsIntegral();
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=76274&r1=76273&r2=76274&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Fri Jul 17 19:34:25 2009
@@ -968,7 +968,7 @@
bool ExplicitInstantiation) {
// Perform the actual instantiation on the canonical declaration.
ClassTemplateSpec = cast<ClassTemplateSpecializationDecl>(
- Context.getCanonicalDecl(ClassTemplateSpec));
+ ClassTemplateSpec->getCanonicalDecl());
// We can only instantiate something that hasn't already been
// instantiated or specialized. Fail without any diagnostics: our
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=76274&r1=76273&r2=76274&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Fri Jul 17 19:34:25 2009
@@ -781,16 +781,16 @@
return false;
if (CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(Other))
- return Ctx.getCanonicalDecl(Record->getInstantiatedFromMemberClass())
- == Ctx.getCanonicalDecl(D);
+ return Record->getInstantiatedFromMemberClass()->getCanonicalDecl()
+ == D->getCanonicalDecl();
if (FunctionDecl *Function = dyn_cast<FunctionDecl>(Other))
- return Ctx.getCanonicalDecl(Function->getInstantiatedFromMemberFunction())
- == Ctx.getCanonicalDecl(D);
+ return Function->getInstantiatedFromMemberFunction()->getCanonicalDecl()
+ == D->getCanonicalDecl();
if (EnumDecl *Enum = dyn_cast<EnumDecl>(Other))
- return Ctx.getCanonicalDecl(Enum->getInstantiatedFromMemberEnum())
- == Ctx.getCanonicalDecl(D);
+ return Enum->getInstantiatedFromMemberEnum()->getCanonicalDecl()
+ == D->getCanonicalDecl();
// FIXME: How can we find instantiations of anonymous unions?
@@ -891,8 +891,8 @@
DC = DC->getParent()) {
if (ClassTemplateSpecializationDecl *Spec
= dyn_cast<ClassTemplateSpecializationDecl>(DC))
- if (Context.getCanonicalDecl(Spec->getSpecializedTemplate())
- == Context.getCanonicalDecl(ClassTemplate))
+ if (Spec->getSpecializedTemplate()->getCanonicalDecl()
+ == ClassTemplate->getCanonicalDecl())
return Spec;
}
More information about the cfe-commits
mailing list