diff options
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaLookup.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 4 | ||||
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 20 | ||||
-rw-r--r-- | lib/Sema/SemaTemplateDeduction.cpp | 8 | ||||
-rw-r--r-- | lib/Sema/SemaTemplateInstantiate.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateDecl.cpp | 16 |
6 files changed, 28 insertions, 24 deletions
diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index c88321e1a3..d9dea66f82 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -217,7 +217,7 @@ MergeLookupResults(ASTContext &Context, LookupResultsTy &Results) { 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; diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index d0d61c6ed1..503f226fd6 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -3764,7 +3764,7 @@ Sema::ResolveAddressOfOverloadedFunction(Expr *From, QualType ToType, assert(FunctionType == Context.getCanonicalType(Specialization->getType())); Matches.insert( - cast<FunctionDecl>(Context.getCanonicalDecl(Specialization))); + cast<FunctionDecl>(Specialization->getCanonicalDecl())); } } @@ -3778,7 +3778,7 @@ Sema::ResolveAddressOfOverloadedFunction(Expr *From, QualType ToType, 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; } } diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 568d68c9a7..8fd9c58c83 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -56,7 +56,7 @@ TemplateNameKind Sema::isTemplateName(const IdentifierInfo &II, Scope *S, // 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 @@ static void CanonicalizeTemplateArguments(const TemplateArgument *TemplateArgs, 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 @@ bool Sema::CheckTemplateArgumentList(TemplateDecl *Template, // 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 @@ bool Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param, 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 @@ bool Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param, 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 @@ bool Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param, 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 @@ bool Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param, 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 @@ bool Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param, 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; } diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp index f6f9d105d9..80e0da1adc 100644 --- a/lib/Sema/SemaTemplateDeduction.cpp +++ b/lib/Sema/SemaTemplateDeduction.cpp @@ -170,8 +170,8 @@ DeduceTemplateArguments(ASTContext &Context, 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 @@ static bool isSameTemplateArg(ASTContext &Context, 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(); diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index 6ee50ab98c..c50faad587 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -968,7 +968,7 @@ Sema::InstantiateClassTemplateSpecialization( 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 diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index 8ff80af190..49271893f9 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -781,16 +781,16 @@ static bool isInstantiationOf(ASTContext &Ctx, NamedDecl *D, Decl *Other) { 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 @@ NamedDecl * Sema::InstantiateCurrentDeclRef(NamedDecl *D) { 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; } |