[clang] [clang][CodeGen] Detect backward jumps for C lifetime markers (PR #238919)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 4 14:53:51 PST 2026
================
@@ -50,35 +53,110 @@ void VarBypassDetector::Init(CodeGenModule &CGM, const Stmt *Body) {
FromScopes.clear();
ToScopes.clear();
Bypasses.clear();
+ BackwardBypassedVars.clear();
+ BackwardBypassedCLs.clear();
BypassedVarsAtSource.clear();
- Scopes = {{~0U, nullptr}};
+ Scopes = {{~0U, 0, nullptr}};
+ CurEnclosingBlockScope = 0;
AlwaysBypassed = false;
+ Initialized = true;
if (!hasJumpStmts(Body))
return;
unsigned ParentScope = 0;
AlwaysBypassed = !BuildScopeInformation(CGM, Body, ParentScope);
if (!AlwaysBypassed)
- Detect();
+ Detect(CGM.getLangOpts().CPlusPlus);
+}
+
+bool VarBypassDetector::BuildScopeInformation(CodeGenModule &CGM, QualType Ty,
+ unsigned &ParentScope) {
+ while (!Ty.isNull() && Ty->isVariablyModifiedType()) {
+ const Type *T = Ty.getTypePtr();
+ if (isa<TypedefType, DecltypeType, AutoType,
----------------
efriedma-quic wrote:
Why are we skipping decltype?
https://github.com/llvm/llvm-project/pull/238919
More information about the cfe-commits
mailing list