[clang] [Clang][CodeGen][UBSan] Add more precise attributes to recoverable ubsan handlers (PR #130990)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 12 09:45:22 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 57a90883ca541a90a7a4a22d715832ec0ceb0599 f5297c7e45452b39e1ceec6ff3ab50fd6792f393 --extensions cpp,c -- clang/test/CodeGen/ubsan-attr.cpp clang/lib/CodeGen/CGExpr.cpp clang/test/CodeGen/allow-ubsan-check.c clang/test/CodeGen/attr-counted-by.c
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 845b176fa6..b04bec6bc2 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -3617,9 +3617,11 @@ static void emitCheckHandlerCall(CodeGenFunction &CGF,
.addAttribute(llvm::Attribute::NoUnwind);
}
B.addUWTableAttr(llvm::UWTableKind::Default);
- // Add more precise attributes to recoverable ubsan handlers for better optimizations.
+ // Add more precise attributes to recoverable ubsan handlers for better
+ // optimizations.
if (CGF.CGM.getCodeGenOpts().OptimizationLevel > 0 && MayReturn) {
- B.addMemoryAttr(llvm::MemoryEffects::argMemOnly(llvm::ModRefInfo::Ref) | llvm::MemoryEffects::inaccessibleMemOnly());
+ B.addMemoryAttr(llvm::MemoryEffects::argMemOnly(llvm::ModRefInfo::Ref) |
+ llvm::MemoryEffects::inaccessibleMemOnly());
// If the handler does not return, we must hit a undefined behavior.
B.addAttribute(llvm::Attribute::WillReturn);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/130990
More information about the cfe-commits
mailing list