r186373 - Merge attributes on typedef decls.
Eli Friedman
eli.friedman at gmail.com
Mon Jul 15 19:07:49 PDT 2013
Author: efriedma
Date: Mon Jul 15 21:07:49 2013
New Revision: 186373
URL: http://llvm.org/viewvc/llvm-project?rev=186373&view=rev
Log:
Merge attributes on typedef decls.
Not completely sure this is right, but it's clearly better than what
we did before this commit (effectively dropping the attribute).
<rdar://problem/14413117>
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Sema/attr-deprecated.c
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=186373&r1=186372&r2=186373&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Jul 15 21:07:49 2013
@@ -1743,6 +1743,8 @@ void Sema::MergeTypedefNameDecl(TypedefN
if (TypedefNameDecl *Typedef = dyn_cast<TypedefNameDecl>(Old))
New->setPreviousDeclaration(Typedef);
+ mergeDeclAttributes(New, Old);
+
if (getLangOpts().MicrosoftExt)
return;
Modified: cfe/trunk/test/Sema/attr-deprecated.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-deprecated.c?rev=186373&r1=186372&r2=186373&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-deprecated.c (original)
+++ cfe/trunk/test/Sema/attr-deprecated.c Mon Jul 15 21:07:49 2013
@@ -120,3 +120,7 @@ struct test22 {
foo_dep c, d __attribute((deprecated)); // expected-warning {{'foo_dep' is deprecated}}
__attribute((deprecated)) foo_dep e, f;
};
+
+typedef int test23_ty __attribute((deprecated)); // expected-note {{previous definition is here}}
+typedef int test23_ty; // expected-note {{'test23_ty' declared here}} expected-warning {{redefinition of typedef 'test23_ty' is a C11 feature}}
+test23_ty test23_v; // expected-warning {{'test23_ty' is deprecated}}
More information about the cfe-commits
mailing list