Skip to content

Commit a98df67

Browse files
authored
[NFC] [BoundsSan] use structured bindings (#123228)
This slightly simplifies the code.
1 parent 9be358f commit a98df67

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

clang/lib/CodeGen/CGExpr.cpp

+6-9
Original file line numberDiff line numberDiff line change
@@ -3607,18 +3607,15 @@ void CodeGenFunction::EmitCheck(
36073607
llvm::Value *RecoverableCond = nullptr;
36083608
llvm::Value *TrapCond = nullptr;
36093609
bool NoMerge = false;
3610-
for (int i = 0, n = Checked.size(); i < n; ++i) {
3611-
llvm::Value *Check = Checked[i].first;
3610+
for (auto &[Check, Ord] : Checked) {
36123611
// -fsanitize-trap= overrides -fsanitize-recover=.
3613-
llvm::Value *&Cond =
3614-
CGM.getCodeGenOpts().SanitizeTrap.has(Checked[i].second)
3615-
? TrapCond
3616-
: CGM.getCodeGenOpts().SanitizeRecover.has(Checked[i].second)
3617-
? RecoverableCond
3618-
: FatalCond;
3612+
llvm::Value *&Cond = CGM.getCodeGenOpts().SanitizeTrap.has(Ord) ? TrapCond
3613+
: CGM.getCodeGenOpts().SanitizeRecover.has(Ord)
3614+
? RecoverableCond
3615+
: FatalCond;
36193616
Cond = Cond ? Builder.CreateAnd(Cond, Check) : Check;
36203617

3621-
if (!CGM.getCodeGenOpts().SanitizeMergeHandlers.has(Checked[i].second))
3618+
if (!CGM.getCodeGenOpts().SanitizeMergeHandlers.has(Ord))
36223619
NoMerge = true;
36233620
}
36243621

0 commit comments

Comments
 (0)