[clang] Diagnose misuse of the cleanup attribute (PR #80040)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 6 06:46:26 PST 2024


https://github.com/AaronBallman commented:

I think the only thing left is to add test coverage somewhere in `clang/test/Sema/`, probably in https://github.com/llvm/llvm-project/blob/main/clang/test/Sema/attr-cleanup.c.

You can probably test with something like:
```
extern void free(void *);
extern void *malloc(__typeof__(sizeof(0)));

void foo(void) {
  __attribute__((cleanup(free))) void *p = malloc(10);
}
```
but additional test coverage would make sense such as what I pointed out here: https://github.com/llvm/llvm-project/pull/80040#pullrequestreview-1856764787

https://github.com/llvm/llvm-project/pull/80040


More information about the cfe-commits mailing list