[clang] [clang] Remove the EnableLifetimeWarnings flag in lifetime analysis. (PR #105884)
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 26 03:25:02 PDT 2024
================
@@ -408,7 +405,8 @@ static void visitFunctionCallArguments(IndirectLocalPath &Path, Expr *Call,
// Once we initialized a value with a reference, it can no longer dangle.
if (!Value) {
for (const IndirectLocalPathEntry &PE : llvm::reverse(Path)) {
- if (PE.Kind == IndirectLocalPathEntry::GslReferenceInit)
+ if (PE.Kind == IndirectLocalPathEntry::GslReferenceInit ||
----------------
hokein wrote:
This code isn't used elsewhere, so I think it's fine to leave it as is (and I'm not sure it's a good idea to expose it as a function).
I think this section could benefit from better documentation. Essentially, it bails out cases where we construct a GSL pointer from a reference, and before this change, the path could only contain GSL-specific IndirectLocalPathEntry. With this change, we should also consider the LifetimeBoundCall.
There’s also some refactoring and enhancement in this part of the code in #104556, and I’ll add more documentation there.
https://github.com/llvm/llvm-project/pull/105884
More information about the cfe-commits
mailing list