[clang] [ObjC]: Make type encoding safe in symbol names (PR #77797)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 11 09:05:55 PST 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 6a075a9d5dda8f6ce37b176c6d4a7f87a770ec31 5511454cae83ed61062c49a19c56edaf6b9ee1dd -- clang/lib/CodeGen/CGObjCGNU.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp
index 6e76765cea..9cc7f32815 100644
--- a/clang/lib/CodeGen/CGObjCGNU.cpp
+++ b/clang/lib/CodeGen/CGObjCGNU.cpp
@@ -1438,18 +1438,17 @@ class CGObjCGNUstep2 : public CGObjCGNUstep {
// character that is not a valid type encoding character (and, being
// non-printable, never will be!)
if (CGM.getTriple().isOSBinFormatELF())
- std::replace(MangledTypes.begin(), MangledTypes.end(),
- '@', '\1');
+ std::replace(MangledTypes.begin(), MangledTypes.end(), '@', '\1');
// = in dll exported names causes lld to fail when linking on Windows.
if (CGM.getTriple().isOSWindows())
- std::replace(MangledTypes.begin(), MangledTypes.end(),
- '=', '\2');
+ std::replace(MangledTypes.begin(), MangledTypes.end(), '=', '\2');
return MangledTypes;
}
llvm::Constant *GetTypeString(llvm::StringRef TypeEncoding) {
if (TypeEncoding.empty())
return NULLPtr;
- std::string MangledTypes = GetSymbolNameForTypeEncoding(std::string(TypeEncoding));
+ std::string MangledTypes =
+ GetSymbolNameForTypeEncoding(std::string(TypeEncoding));
std::string TypesVarName = ".objc_sel_types_" + MangledTypes;
auto *TypesGlobal = TheModule.getGlobalVariable(TypesVarName);
if (!TypesGlobal) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/77797
More information about the cfe-commits
mailing list