[PATCH] D26540: [Sema] Accept and ignore the leaf attribute

Petr Hosek via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 10 20:10:24 PST 2016


phosek created this revision.
phosek added a subscriber: cfe-commits.
phosek set the repository for this revision to rL LLVM.

This is a GCC extension, Clang should accept the attribute without a warning for compatibility with GCC.

https://llvm.org/bugs/show_bug.cgi?id=30980


Repository:
  rL LLVM

https://reviews.llvm.org/D26540

Files:
  include/clang/Basic/Attr.td
  test/Sema/attr-leaf.c


Index: test/Sema/attr-leaf.c
===================================================================
--- /dev/null
+++ test/Sema/attr-leaf.c
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -verify -fsyntax-only %s
+// expected-no-diagnostics
+
+void f(void) __attribute__((leaf));
Index: include/clang/Basic/Attr.td
===================================================================
--- include/clang/Basic/Attr.td
+++ include/clang/Basic/Attr.td
@@ -915,6 +915,11 @@
   let Documentation = [LayoutVersionDocs];
 }
 
+def Leaf : IgnoredAttr {
+  let Spellings = [GNU<"leaf">];
+  let Subjects = SubjectList<[Function]>;
+}
+
 def MaxFieldAlignment : InheritableAttr {
   // This attribute has no spellings as it is only ever created implicitly.
   let Spellings = [];


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26540.77593.patch
Type: text/x-patch
Size: 753 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161111/5f739a36/attachment.bin>


More information about the cfe-commits mailing list