[LifetimeSafety] Enable lifetime analysis for C language
Clang lifetime safety analysis currently does not run for C code.
It would be useful to support C as well, at least for primitive objects and C-compatible attribute spelling such as __attribute__((lifetimebound)).
Example:
int *id(int *p __attribute__((lifetimebound))) {
return p;
}
int *bad(void) {
int local;
return id(&local);
}
Expected result: enabling lifetime safety warnings in C mode should diagnose cases where a pointer to a local object escapes its lifetime.
@llvm/issue-subscribers-clang-temporal-safety
Author: NeKon69
It would be useful to support C as well, at least for primitive objects and C-compatible attribute spelling such as __attribute__((lifetimebound)).
Example:
int *id(int *p __attribute__((lifetimebound))) {
return p;
}
int *bad(void) {
int local;
return id(&local);
}
Expected result: enabling lifetime safety warnings in C mode should diagnose cases where a pointer to a local object escapes its lifetime.
Reopened this as the PR was reverted.