[PATCH] D78693: Make "#pragma clang attribute" support uninitialized attribute.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 23 05:21:56 PDT 2020


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!



================
Comment at: clang/test/CodeGenCXX/trivial-auto-var-init-attribute.cpp:38-50
+// UNINIT-LABEL:  test_pragma_attribute_uninitialized_f2(
+// UNINIT:      alloca
+// UNINIT-NEXT: call void
+// ZERO-LABEL:    test_pragma_attribute_uninitialized_f2(
+// ZERO:      alloca
+// ZERO-NEXT: call void
+// PATTERN-LABEL: test_pragma_attribute_uninitialized_f2(
----------------
I think you can remove this test case as it's basically identical to the previous one.


================
Comment at: clang/test/Parser/pragma-attribute.cpp:190
+#pragma clang attribute pop
+#pragma clang attribute push([[clang::uninitialized]], apply_to = variable) // expected-error {{attribute 'uninitialized' can't be applied to 'variable'}}
+#pragma clang attribute pop
----------------
jfb wrote:
> Should variable work? Since it’s a superset of local it seems like maybe? But then again only local works, so ok not sure. 
I think this is correct. Requiring an explicit `is_local` here is a conservative approach. It means we can start supporting `[[clang::uninitialized]]` in other contexts without breaking code that uses `#pragma clang attribute` to apply it to more entities unexpectedly.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78693/new/

https://reviews.llvm.org/D78693





More information about the cfe-commits mailing list