[PATCH] D82904: [clang-tidy] Warn pointer captured in async block

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 7 08:00:38 PDT 2020


njames93 added inline comments.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/bugprone-no-escape.m:1
+// RUN: %check_clang_tidy %s bugprone-no-escape %t
+
----------------
aaron.ballman wrote:
> Can you add an additional RUN line so we get coverage of the blocks-enabled behavior? Something like:
> ```
> // RUN: %check_clang_tidy %s bugprone-no-escape %t -- -- -fblocks -x c
> ```
> I'm not 100% certain I have that syntax right, but the idea is to run the test as though it were a C compilation unit with blocks explicitly enabled.
check_clang_tidy will add `-fobjc-abi-version=2`, `-fobjc-arc` and `-fblocks` if the file extension is `.m` or `.mm`.
You can trick it with `assume-filename` to stop that happening
```
// RUN: %check_clang_tidy %s -assume-filename=bugprone-no-escape.c bugprone-no-escape %t -- -- -fblocks
```

Not 100% certain that is the right syntax but that feels like the designed way to run the test as a C compilation unit


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82904





More information about the cfe-commits mailing list