NoQ added a comment.

Very easy:

1. Put preprocessed file that crashes into `repro.cpp` (`.c`, `.m`, whatever).
2. Write `repro.sh` as follows:

  #!/bin/bash
  blah/blah/path/to/clang -cc1 -analyze 
-blah-blah-arguments-you-need-to-cause-a-crash repro.cpp 2>&1 | grep "Any 
assertion message or whatever"

3. Do:

  creduce repro.sh repro.cpp

4. Wait until it finishes.
5. `repro.cpp` now contains the reduced test case.

Tip for speed:

- The repro.sh script should be as fast as possible. Use a release+asserts 
build of clang.
- Also `-analyze-function top_function_that_we_analyze_when_we_crash` is a 
great flag to add to the run-line if possible, because it'll make the test much 
faster; see `-analyzer-display-progress` to figure out how to specify the 
function; if it's a lambda or a block you're out of luck because you'll need to 
specify line number which would change during reduce; you may also fail because 
top-level analyses are interacting a bit, so it may fail to crash if you 
restrict to a function.


https://reviews.llvm.org/D51300



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to