[PATCH] D77168: Add a flag to debug automatic variable initialization

JF Bastien via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 16 16:10:53 PDT 2020


jfb added a comment.

In D77168#1984109 <https://reviews.llvm.org/D77168#1984109>, @jcai19 wrote:

> > Right, support needs to be added, and I was wondering if you'd want to do this because it seems like a tool that would help you out.
>
> Sorry for the delay. Yes the biggest advantage of this option would be to make automating bisection much easier. Or are you suggesting we should do it differently, like a tool that can automatically inserts macros in the source code?


I suggest implementing support for this:

  void use(void*);
  
  #pragma clang attribute push ([[clang::uninitialized]], apply_to = variable)
  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);
  }
  #pragma clang attribute pop

`pragma clang attribute` is already a feature, we just need to teach it about this one attribute.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77168





More information about the cfe-commits mailing list