[clang] a98df67 - [NFC] [BoundsSan] use structured bindings (#123228)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 16 14:00:45 PST 2025
Author: Florian Mayer
Date: 2025-01-16T14:00:42-08:00
New Revision: a98df676140c9b3e44f6e094df40d49f53e9a89c
URL: https://github.com/llvm/llvm-project/commit/a98df676140c9b3e44f6e094df40d49f53e9a89c
DIFF: https://github.com/llvm/llvm-project/commit/a98df676140c9b3e44f6e094df40d49f53e9a89c.diff
LOG: [NFC] [BoundsSan] use structured bindings (#123228)
This slightly simplifies the code.
Added:
Modified:
clang/lib/CodeGen/CGExpr.cpp
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 6e5a21c8f01e78..9a9a8c7f6eae09 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -3607,18 +3607,15 @@ void CodeGenFunction::EmitCheck(
llvm::Value *RecoverableCond = nullptr;
llvm::Value *TrapCond = nullptr;
bool NoMerge = false;
- for (int i = 0, n = Checked.size(); i < n; ++i) {
- llvm::Value *Check = Checked[i].first;
+ for (auto &[Check, Ord] : Checked) {
// -fsanitize-trap= overrides -fsanitize-recover=.
- llvm::Value *&Cond =
- CGM.getCodeGenOpts().SanitizeTrap.has(Checked[i].second)
- ? TrapCond
- : CGM.getCodeGenOpts().SanitizeRecover.has(Checked[i].second)
- ? RecoverableCond
- : FatalCond;
+ llvm::Value *&Cond = CGM.getCodeGenOpts().SanitizeTrap.has(Ord) ? TrapCond
+ : CGM.getCodeGenOpts().SanitizeRecover.has(Ord)
+ ? RecoverableCond
+ : FatalCond;
Cond = Cond ? Builder.CreateAnd(Cond, Check) : Check;
- if (!CGM.getCodeGenOpts().SanitizeMergeHandlers.has(Checked[i].second))
+ if (!CGM.getCodeGenOpts().SanitizeMergeHandlers.has(Ord))
NoMerge = true;
}
More information about the cfe-commits
mailing list