[PATCH] D13925: Implement __attribute__((internal_linkage))

David Majnemer via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 20 18:56:50 PDT 2015


majnemer added a subscriber: majnemer.

================
Comment at: include/clang/Basic/Attr.td:2114
@@ +2113,3 @@
+  let Spellings = [GCC<"internal_linkage">];
+  let Subjects = SubjectList<[Function,Var]>;
+  let Documentation = [InternalLinkageDocs];
----------------
Space between `Function` and `Var`.

================
Comment at: lib/Sema/SemaDeclAttr.cpp:1580-1585
@@ -1577,3 +1579,8 @@
+
+  if (InternalLinkageAttr *Internal = D->getAttr<InternalLinkageAttr>()) {
+    S.Diag(Attr.getRange().getBegin(), diag::warn_attribute_ignored)
+        << Attr.getName();
+    S.Diag(Internal->getLocation(), diag::note_conflicting_attribute);
     return;
   }
 
----------------
Why is this here?  You've already got logic for this in `handleInternalLinkageAttr`

================
Comment at: lib/Sema/SemaDeclAttr.cpp:4563-4564
@@ +4562,4 @@
+  if (CommonAttr *Common = D->getAttr<CommonAttr>()) {
+    S.Diag(Attr.getRange().getBegin(), diag::warn_attribute_ignored)
+        << Attr.getName();
+    S.Diag(Common->getLocation(), diag::note_conflicting_attribute);
----------------
I'd expect a more serious diagnostic for a mismatch (an error) due to the nature of the attribute (namely, it's ABI implications).


Repository:
  rL LLVM

http://reviews.llvm.org/D13925





More information about the cfe-commits mailing list