diff options
author | Reid Kleckner <reid@kleckner.net> | 2015-04-07 20:46:51 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2015-04-07 20:46:51 +0000 |
commit | 0f764e57fc481bc7ca92e4f6e45f0a2d8b487bb2 (patch) | |
tree | b0c65f8545389d6502f9e5e981c041d64c74a85b /clang/lib | |
parent | 3c45cffd68cd9839d4737ea260ed2706ab304cc9 (diff) | |
download | bcm5719-llvm-0f764e57fc481bc7ca92e4f6e45f0a2d8b487bb2.tar.gz bcm5719-llvm-0f764e57fc481bc7ca92e4f6e45f0a2d8b487bb2.zip |
Revert "Mark instantiated function decls as inline specified if any pattern is"
It breaks down on this test case:
void foo();
template <typename T> class C {
friend void foo();
};
inline void foo() {}
C<int> c;
We shouldn't be marking the instantiation of the friend decl of foo as
inline-specified. It may be possible to fix this by determining if the
full definition is part of the current template, but it seems better to
rever tot green until we come up with a full solution.
This reverts commit r233817, as well as follow-ups r233820 and r233821.
llvm-svn: 234355
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index 677c3b8bb1d..6936539f1ca 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -1304,15 +1304,6 @@ static QualType adjustFunctionTypeForInstantiation(ASTContext &Context, NewFunc->getParamTypes(), NewEPI); } -/// Return true if any redeclaration of FD was inline specified. Useful for -/// propagating the 'inline' specifier onto function template instantiations. -static bool isAnyRedeclInlineSpecified(const FunctionDecl *FD) { - for (const auto *R : FD->redecls()) - if (R->isInlineSpecified()) - return true; - return false; -} - /// Normal class members are of more specific types and therefore /// don't make it here. This function serves two purposes: /// 1) instantiating function templates @@ -1381,8 +1372,7 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D, FunctionDecl::Create(SemaRef.Context, DC, D->getInnerLocStart(), D->getNameInfo(), T, TInfo, D->getCanonicalDecl()->getStorageClass(), - isAnyRedeclInlineSpecified(D), - D->hasWrittenPrototype(), + D->isInlineSpecified(), D->hasWrittenPrototype(), D->isConstexpr()); Function->setRangeEnd(D->getSourceRange().getEnd()); @@ -1679,7 +1669,7 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D, Method = CXXConstructorDecl::Create(SemaRef.Context, Record, StartLoc, NameInfo, T, TInfo, Constructor->isExplicit(), - isAnyRedeclInlineSpecified(Constructor), + Constructor->isInlineSpecified(), false, Constructor->isConstexpr()); // Claim that the instantiation of a constructor or constructor template @@ -1714,12 +1704,12 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D, } else if (CXXDestructorDecl *Destructor = dyn_cast<CXXDestructorDecl>(D)) { Method = CXXDestructorDecl::Create(SemaRef.Context, Record, StartLoc, NameInfo, T, TInfo, - isAnyRedeclInlineSpecified(Destructor), + Destructor->isInlineSpecified(), false); } else if (CXXConversionDecl *Conversion = dyn_cast<CXXConversionDecl>(D)) { Method = CXXConversionDecl::Create(SemaRef.Context, Record, StartLoc, NameInfo, T, TInfo, - isAnyRedeclInlineSpecified(Conversion), + Conversion->isInlineSpecified(), Conversion->isExplicit(), Conversion->isConstexpr(), Conversion->getLocEnd()); @@ -1727,7 +1717,7 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D, StorageClass SC = D->isStatic() ? SC_Static : SC_None; Method = CXXMethodDecl::Create(SemaRef.Context, Record, StartLoc, NameInfo, T, TInfo, - SC, isAnyRedeclInlineSpecified(D), + SC, D->isInlineSpecified(), D->isConstexpr(), D->getLocEnd()); } |