diff options
author | Jordan Rose <jordan_rose@apple.com> | 2013-03-08 22:25:36 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2013-03-08 22:25:36 +0000 |
commit | 0918989f0eed08870e50418df97d1486d977d773 (patch) | |
tree | 1ee344ae7a85e8ed7078211121495d797b313bef /lib/Sema/SemaTemplate.cpp | |
parent | c61361b102fcb9be7b64cc493fb797ea551eb8e7 (diff) |
Sema: Preserve attributes on parameters in instantiated function templates.
This was causing correctness issues for ARC and the static analyzer when a
function template has "consumed" Objective-C object parameters (i.e.
parameters that will be released by the function before returning).
The fix is threefold:
(1) Actually copy over the attributes from old ParmVarDecls to new ones.
(2) Have Sema::BuildFunctionType only work for building FunctionProtoTypes,
which it was doing anyway. This allows us to pass an ExtProtoInfo
instead of a plain ExtInfo and several flags.
(3) Drop param attributes as part of StripImplicitInstantiation, which is
used when an implicit instantiation is followed by an explicit one.
<rdar://problem/12685622>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176728 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplate.cpp')
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 75f255e945..fd0641995b 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -5648,11 +5648,15 @@ Decl *Sema::ActOnStartOfFunctionTemplateDef(Scope *FnBodyScope, /// \brief Strips various properties off an implicit instantiation /// that has just been explicitly specialized. static void StripImplicitInstantiation(NamedDecl *D) { - // FIXME: "make check" is clean if the call to dropAttrs() is commented out. D->dropAttrs(); if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { FD->setInlineSpecified(false); + + for (FunctionDecl::param_iterator I = FD->param_begin(), + E = FD->param_end(); + I != E; ++I) + (*I)->dropAttrs(); } } |