]> granicus.if.org Git - clang/commitdiff
Merge attributes on typedef decls.
authorEli Friedman <eli.friedman@gmail.com>
Tue, 16 Jul 2013 02:07:49 +0000 (02:07 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Tue, 16 Jul 2013 02:07:49 +0000 (02:07 +0000)
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>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186373 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp
test/Sema/attr-deprecated.c

index 5e535da19a1464e01a4f68ee42bd4bad90a62983..38de4db8aea538d62bb8716853dbac7c8737f538 100644 (file)
@@ -1743,6 +1743,8 @@ void Sema::MergeTypedefNameDecl(TypedefNameDecl *New, LookupResult &OldDecls) {
   if (TypedefNameDecl *Typedef = dyn_cast<TypedefNameDecl>(Old))
     New->setPreviousDeclaration(Typedef);
 
+  mergeDeclAttributes(New, Old);
+
   if (getLangOpts().MicrosoftExt)
     return;
 
index 565be7ff59975fb99f5c8817722f56ba60c81cec..8124ab0ddd02f0021189e4dd925dc3c7761466b4 100644 (file)
@@ -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}}