nickdesaulniers created this revision.
nickdesaulniers added reviewers: MaskRay, void, phosek, aaron.ballman.
nickdesaulniers requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

GCC has had this function attribute since GCC 7.1 for this purpose. I
add "no_profile" last week in D104475 <https://reviews.llvm.org/D104475>; 
rename this to
"no_profile_instrument_function" to improve compatibility with GCC.

Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80223#c11


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104658

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/test/CodeGen/no_profile.c
  clang/test/Sema/no_profile-attribute.c
  clang/test/Sema/no_profile_instrument_function-attribute.c


Index: clang/test/Sema/no_profile_instrument_function-attribute.c
===================================================================
--- /dev/null
+++ clang/test/Sema/no_profile_instrument_function-attribute.c
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+__attribute__((no_profile_instrument_function))
+void no_profile0(void);
+#if !__has_attribute(no_profile_instrument_function)
+#error "Where did the no_profile_instrument_function function attribute go?"
+#endif
+
+void no_profile1(__attribute__((no_profile_instrument_function)) int param); 
// expected-warning {{'no_profile_instrument_function' attribute only applies 
to functions}}
+__attribute__((no_profile_instrument_function(""))) // expected-error 
{{'no_profile_instrument_function' attribute takes no arguments}}
+void no_profile2(void);
+void no_profile3(void) {
+  __attribute__((no_profile_instrument_function)); // expected-error 
{{'no_profile_instrument_function' attribute cannot be applied to a statement}}
+}
Index: clang/test/Sema/no_profile-attribute.c
===================================================================
--- clang/test/Sema/no_profile-attribute.c
+++ /dev/null
@@ -1,13 +0,0 @@
-// RUN: %clang_cc1 %s -fsyntax-only -verify
-__attribute__((no_profile))
-void no_profile0(void);
-#if !__has_attribute(no_profile)
-#error "Where did the no_profile function attribute go?"
-#endif
-
-void no_profile1(__attribute__((no_profile)) int param); // expected-warning 
{{'no_profile' attribute only applies to functions}}
-__attribute__((no_profile(""))) // expected-error {{'no_profile' attribute 
takes no arguments}}
-void no_profile2(void);
-void no_profile3(void) {
-  __attribute__((no_profile)); // expected-error {{'no_profile' attribute 
cannot be applied to a statement}}
-}
Index: clang/test/CodeGen/no_profile.c
===================================================================
--- clang/test/CodeGen/no_profile.c
+++ clang/test/CodeGen/no_profile.c
@@ -8,7 +8,7 @@
 // RUN:   -emit-llvm -o - %s | FileCheck %s
 int g(int);
 
-void __attribute__((no_profile)) no_instr() {
+void __attribute__((no_profile_instrument_function)) no_instr() {
 // CHECK: define {{.*}}void @no_instr() [[ATTR:#[0-9]+]]
 }
 
Index: clang/include/clang/Basic/AttrDocs.td
===================================================================
--- clang/include/clang/Basic/AttrDocs.td
+++ clang/include/clang/Basic/AttrDocs.td
@@ -2559,12 +2559,12 @@
   }];
 }
 
-def NoProfileDocs : Documentation {
+def NoProfileInstrumentFunctionDocs : Documentation {
   let Category = DocCatFunction;
   let Content = [{
-Use the ``no_profile`` attribute on a function declaration to denote that the
-compiler should not instrument the function with profile-related
-instrumentation, such as via the
+Use the ``no_profile_instrument_function`` attribute on a function declaration
+to denote that the compiler should not instrument the function with
+profile-related instrumentation, such as via the
 ``-fprofile-generate`` / ``-fprofile-instr-generate`` /
 ``-fcs-profile-generate`` / ``-fprofile-arcs`` flags.
 }];
Index: clang/include/clang/Basic/Attr.td
===================================================================
--- clang/include/clang/Basic/Attr.td
+++ clang/include/clang/Basic/Attr.td
@@ -1971,9 +1971,9 @@
 }
 
 def NoProfileFunction : InheritableAttr {
-  let Spellings = [Clang<"no_profile">];
+  let Spellings = [GCC<"no_profile_instrument_function">];
   let Subjects = SubjectList<[Function]>;
-  let Documentation = [NoProfileDocs];
+  let Documentation = [NoProfileInstrumentFunctionDocs];
   let SimpleHandler = 1;
 }
 


Index: clang/test/Sema/no_profile_instrument_function-attribute.c
===================================================================
--- /dev/null
+++ clang/test/Sema/no_profile_instrument_function-attribute.c
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+__attribute__((no_profile_instrument_function))
+void no_profile0(void);
+#if !__has_attribute(no_profile_instrument_function)
+#error "Where did the no_profile_instrument_function function attribute go?"
+#endif
+
+void no_profile1(__attribute__((no_profile_instrument_function)) int param); // expected-warning {{'no_profile_instrument_function' attribute only applies to functions}}
+__attribute__((no_profile_instrument_function(""))) // expected-error {{'no_profile_instrument_function' attribute takes no arguments}}
+void no_profile2(void);
+void no_profile3(void) {
+  __attribute__((no_profile_instrument_function)); // expected-error {{'no_profile_instrument_function' attribute cannot be applied to a statement}}
+}
Index: clang/test/Sema/no_profile-attribute.c
===================================================================
--- clang/test/Sema/no_profile-attribute.c
+++ /dev/null
@@ -1,13 +0,0 @@
-// RUN: %clang_cc1 %s -fsyntax-only -verify
-__attribute__((no_profile))
-void no_profile0(void);
-#if !__has_attribute(no_profile)
-#error "Where did the no_profile function attribute go?"
-#endif
-
-void no_profile1(__attribute__((no_profile)) int param); // expected-warning {{'no_profile' attribute only applies to functions}}
-__attribute__((no_profile(""))) // expected-error {{'no_profile' attribute takes no arguments}}
-void no_profile2(void);
-void no_profile3(void) {
-  __attribute__((no_profile)); // expected-error {{'no_profile' attribute cannot be applied to a statement}}
-}
Index: clang/test/CodeGen/no_profile.c
===================================================================
--- clang/test/CodeGen/no_profile.c
+++ clang/test/CodeGen/no_profile.c
@@ -8,7 +8,7 @@
 // RUN:   -emit-llvm -o - %s | FileCheck %s
 int g(int);
 
-void __attribute__((no_profile)) no_instr() {
+void __attribute__((no_profile_instrument_function)) no_instr() {
 // CHECK: define {{.*}}void @no_instr() [[ATTR:#[0-9]+]]
 }
 
Index: clang/include/clang/Basic/AttrDocs.td
===================================================================
--- clang/include/clang/Basic/AttrDocs.td
+++ clang/include/clang/Basic/AttrDocs.td
@@ -2559,12 +2559,12 @@
   }];
 }
 
-def NoProfileDocs : Documentation {
+def NoProfileInstrumentFunctionDocs : Documentation {
   let Category = DocCatFunction;
   let Content = [{
-Use the ``no_profile`` attribute on a function declaration to denote that the
-compiler should not instrument the function with profile-related
-instrumentation, such as via the
+Use the ``no_profile_instrument_function`` attribute on a function declaration
+to denote that the compiler should not instrument the function with
+profile-related instrumentation, such as via the
 ``-fprofile-generate`` / ``-fprofile-instr-generate`` /
 ``-fcs-profile-generate`` / ``-fprofile-arcs`` flags.
 }];
Index: clang/include/clang/Basic/Attr.td
===================================================================
--- clang/include/clang/Basic/Attr.td
+++ clang/include/clang/Basic/Attr.td
@@ -1971,9 +1971,9 @@
 }
 
 def NoProfileFunction : InheritableAttr {
-  let Spellings = [Clang<"no_profile">];
+  let Spellings = [GCC<"no_profile_instrument_function">];
   let Subjects = SubjectList<[Function]>;
-  let Documentation = [NoProfileDocs];
+  let Documentation = [NoProfileInstrumentFunctionDocs];
   let SimpleHandler = 1;
 }
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to