[PATCH] D131680: [ARM] Simplify the creation of escaped build attribute values
Victor Campos via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 16 03:49:47 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG784da8a722b3: [ARM] Simplify the creation of escaped build attribute values (authored by vhscampos).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131680/new/
https://reviews.llvm.org/D131680
Files:
llvm/include/llvm/Support/ARMBuildAttributes.h
llvm/lib/Support/ARMBuildAttrs.cpp
llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
Index: llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
===================================================================
--- llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
+++ llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
@@ -204,7 +204,7 @@
default:
OS << "\t.eabi_attribute\t" << Attribute << ", \"";
if (Attribute == ARMBuildAttrs::also_compatible_with)
- OS << ARMBuildAttrs::encodeAttrTagValuePair(String);
+ OS.write_escaped(String);
else
OS << String;
OS << "\"";
Index: llvm/lib/Support/ARMBuildAttrs.cpp
===================================================================
--- llvm/lib/Support/ARMBuildAttrs.cpp
+++ llvm/lib/Support/ARMBuildAttrs.cpp
@@ -75,40 +75,4 @@
constexpr TagNameMap ARMAttributeTags{tagData};
const TagNameMap &llvm::ARMBuildAttrs::getARMAttributeTags() {
return ARMAttributeTags;
-}
-
-static std::string getEncodedULEB128AsText(const uint8_t *Value,
- unsigned Size) {
- std::stringstream SS;
- for (unsigned i = 0; i < Size; ++i) {
- SS << "\\" << std::setfill('0') << std::setw(3) << std::oct
- << int(Value[i]);
- }
- return SS.str();
-}
-
-std::string
-llvm::ARMBuildAttrs::encodeAttrTagValuePair(StringRef OriginalString) {
- auto BytesBegin = reinterpret_cast<const uint8_t *>(OriginalString.data());
- auto BytesEnd = BytesBegin + OriginalString.size();
-
- unsigned N = 0;
- const char *Error = nullptr;
- unsigned Tag = decodeULEB128(BytesBegin, &N, BytesEnd, &Error);
- if (Error)
- report_fatal_error("Could not decode Tag value: " + Twine(Error));
-
- std::string EncodedPair = getEncodedULEB128AsText(BytesBegin, N);
- switch (Tag) {
- case ARMBuildAttrs::CPU_raw_name:
- case ARMBuildAttrs::CPU_name:
- case ARMBuildAttrs::compatibility:
- case ARMBuildAttrs::conformance:
- EncodedPair += OriginalString.substr(N);
- break;
- default:
- EncodedPair +=
- getEncodedULEB128AsText(BytesBegin + N, OriginalString.size() - N);
- }
- return EncodedPair;
-}
+}
\ No newline at end of file
Index: llvm/include/llvm/Support/ARMBuildAttributes.h
===================================================================
--- llvm/include/llvm/Support/ARMBuildAttributes.h
+++ llvm/include/llvm/Support/ARMBuildAttributes.h
@@ -263,8 +263,6 @@
PACRETUsed = 1
};
-std::string encodeAttrTagValuePair(StringRef OriginalString);
-
} // namespace ARMBuildAttrs
} // namespace llvm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131680.452940.patch
Type: text/x-patch
Size: 2469 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220816/268010a1/attachment-0001.bin>
More information about the llvm-commits
mailing list