[clang] [Clang] Prevent null pointer dereference in target attribute mangling (PR #94228)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 3 07:26:40 PDT 2024
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 bba5ee47e63298d61f6ea441a140144ce370ba92 5459e49d79f0916b198446fe9a0c06e7f24f7f7d -- clang/lib/CodeGen/CodeGenModule.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 7541817e41..b6c3ad06c6 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -1853,21 +1853,26 @@ static std::string getMangledNameImpl(CodeGenModule &CGM, GlobalDecl GD,
break;
case MultiVersionKind::Target: {
auto *Attr = FD->getAttr<TargetAttr>();
- assert(Attr && "Expected TargetAttr to be present for attribute mangling");
+ assert(Attr &&
+ "Expected TargetAttr to be present for attribute mangling");
const ABIInfo &Info = CGM.getTargetCodeGenInfo().getABIInfo();
Info.appendAttributeMangling(Attr, Out);
break;
}
case MultiVersionKind::TargetVersion: {
auto *Attr = FD->getAttr<TargetVersionAttr>();
- assert(Attr && "Expected TargetVersionAttr to be present for attribute mangling");
+ assert(
+ Attr &&
+ "Expected TargetVersionAttr to be present for attribute mangling");
const ABIInfo &Info = CGM.getTargetCodeGenInfo().getABIInfo();
Info.appendAttributeMangling(Attr, Out);
break;
}
case MultiVersionKind::TargetClones: {
auto *Attr = FD->getAttr<TargetClonesAttr>();
- assert(Attr && "Expected TargetClonesAttr to be present for attribute mangling");
+ assert(
+ Attr &&
+ "Expected TargetClonesAttr to be present for attribute mangling");
unsigned Index = GD.getMultiVersionIndex();
const ABIInfo &Info = CGM.getTargetCodeGenInfo().getABIInfo();
Info.appendAttributeMangling(Attr, Index, Out);
``````````
</details>
https://github.com/llvm/llvm-project/pull/94228
More information about the cfe-commits
mailing list