[all-commits] [llvm/llvm-project] fcbc61: Make "#pragma clang attribute" support uninitializ...

Jian Cai via All-commits all-commits at lists.llvm.org
Thu Apr 23 14:25:39 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: fcbc613ad8b7785f710996f58726f26ad4ace50b
      https://github.com/llvm/llvm-project/commit/fcbc613ad8b7785f710996f58726f26ad4ace50b
  Author: Jian Cai <caij2003 at gmail.com>
  Date:   2020-04-23 (Thu, 23 Apr 2020)

  Changed paths:
    M clang/docs/LanguageExtensions.rst
    M clang/include/clang/Basic/Attr.td
    M clang/test/CodeGenCXX/trivial-auto-var-init-attribute.cpp
    M clang/test/Misc/pragma-attribute-supported-attributes-list.test
    M clang/test/Parser/pragma-attribute.cpp

  Log Message:
  -----------
  Make "#pragma clang attribute" support uninitialized attribute.

Summary:
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);
}

Reviewers: jfb, rjmccall, aaron.ballman

Reviewed By: jfb, aaron.ballman

Subscribers: aaron.ballman, george.burgess.iv, dexonsmith, MaskRay, phosek, hubert.reinterpretcast, gbiv, manojgupta, llozano, srhines, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78693




More information about the All-commits mailing list