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

Jian Cai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 22 21:42:29 PDT 2020


jcai19 created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

When using -ftrivial-auto-var-init=* options to initiate automatic
variables in a file, to disable initialization on some variables,
currently we have to manually annotate the variables with uninitialized
attribute, such as

int dont_initialize_me __attribute((uninitialized));

Making pragma clang attribute to support this attribute would make
annotating variables much easier, and could be particular useful for
bisection efforts, e.g.

void use(void*);

void buggy() {

  int arr[256];
  int boom;
  float bam;
  struct { int oops; } oops;
  union { int oof; float aaaaa; } oof;
  
  use(&arr);
  use(&boom);
  use(&bam);
  use(&oops);
  use(&oof);

}


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78693

Files:
  clang/include/clang/Basic/Attr.td
  clang/test/CodeGenCXX/trivial-auto-var-init-attribute.cpp
  clang/test/Misc/pragma-attribute-supported-attributes-list.test
  clang/test/Parser/pragma-attribute.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78693.259474.patch
Type: text/x-patch
Size: 12537 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200423/3baf0070/attachment.bin>


More information about the cfe-commits mailing list