[llvm] [lld] [clang] [SHT_LLVM_BB_ADDR_MAP] Allow basic-block-sections and labels be used … (PR #74128)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 1 11:02:56 PST 2023
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 ca2d79f9cad48b7165bf81a7cc24b67f277915f1 3f82059172f7e9020ff14e41063208c6d67b7cce -- clang/test/Driver/basic-block-address-map.c clang/lib/CodeGen/BackendUtil.cpp clang/lib/Driver/ToolChains/Clang.cpp lld/ELF/Config.h lld/ELF/Driver.cpp lld/ELF/LTO.cpp llvm/include/llvm/CodeGen/CommandFlags.h llvm/include/llvm/Object/ELFTypes.h llvm/include/llvm/ObjectYAML/ELFYAML.h llvm/include/llvm/Target/TargetOptions.h llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/lib/CodeGen/BasicBlockSections.cpp llvm/lib/CodeGen/CommandFlags.cpp llvm/lib/CodeGen/MachineFunction.cpp llvm/lib/CodeGen/TargetPassConfig.cpp llvm/lib/Object/ELF.cpp llvm/lib/ObjectYAML/ELFEmitter.cpp llvm/lib/ObjectYAML/ELFYAML.cpp llvm/tools/llvm-objdump/llvm-objdump.cpp llvm/tools/llvm-readobj/ELFDumper.cpp llvm/tools/obj2yaml/elf2yaml.cpp llvm/unittests/Object/ELFObjectFileTest.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index fdd8f0c33b..0ea770f843 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -410,7 +410,7 @@ static bool ShouldEnableAutolink(const ArgList &Args, const ToolChain &TC,
}
static bool mustUseNonLeafFramePointerForTarget(const llvm::Triple &Triple) {
- switch (Triple.getArch()){
+ switch (Triple.getArch()) {
default:
return false;
case llvm::Triple::arm:
@@ -532,7 +532,7 @@ getFramePointerKind(const ArgList &Args, const llvm::Triple &Triple) {
Args.hasFlag(options::OPT_momit_leaf_frame_pointer,
options::OPT_mno_omit_leaf_frame_pointer,
Triple.isAArch64() || Triple.isPS() || Triple.isVE() ||
- (Triple.isAndroid() && Triple.isRISCV64()));
+ (Triple.isAndroid() && Triple.isRISCV64()));
if (NoOmitFP || mustUseNonLeafFramePointerForTarget(Triple) ||
(!OmitFP && useFramePointerForTargetByDefault(Args, Triple))) {
if (OmitLeafFP)
diff --git a/llvm/include/llvm/Object/ELFTypes.h b/llvm/include/llvm/Object/ELFTypes.h
index dda58f17b6..72be62755c 100644
--- a/llvm/include/llvm/Object/ELFTypes.h
+++ b/llvm/include/llvm/Object/ELFTypes.h
@@ -875,9 +875,11 @@ struct BBAddrMap {
std::vector<BBRangeEntry> BBRanges;
// Returns the function address associated with this BBAddrMap, which is
- // stored as the `BaseAddress` of its first BBRangeEntry. Returns 0 if BBRanges is empty.
+ // stored as the `BaseAddress` of its first BBRangeEntry. Returns 0 if
+ // BBRanges is empty.
uint64_t getFunctionAddress() const {
- if (BBRanges.empty()) return 0;
+ if (BBRanges.empty())
+ return 0;
return BBRanges.front().BaseAddress;
}
diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp
index 8268a33867..f6dc1f919f 100644
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -7461,7 +7461,8 @@ template <class ELFT> void LLVMELFDumper<ELFT>::printBBAddrMaps() {
uint64_t FunctionAddress = AM.getFunctionAddress();
W.printHex("At", FunctionAddress);
SmallVector<uint32_t> FuncSymIndex =
- this->getSymbolIndexesForFunctionAddress(FunctionAddress, FunctionSec);
+ this->getSymbolIndexesForFunctionAddress(FunctionAddress,
+ FunctionSec);
std::string FuncName = "<?>";
if (FuncSymIndex.empty())
this->reportUniqueWarning(
diff --git a/llvm/unittests/Object/ELFObjectFileTest.cpp b/llvm/unittests/Object/ELFObjectFileTest.cpp
index 157c69edec..51b6c6194c 100644
--- a/llvm/unittests/Object/ELFObjectFileTest.cpp
+++ b/llvm/unittests/Object/ELFObjectFileTest.cpp
@@ -617,7 +617,6 @@ Sections:
)";
DoCheck(OverLimitNumBBRanges,
"ULEB128 value at offset 0xa exceeds UINT32_MAX (0x100000000)");
-
}
// Test for the ELFObjectFile::readBBAddrMap API.
@@ -687,10 +686,15 @@ Sections:
Metadata: 0x18
)");
- BBAddrMap E1 = {{{0x11111, {{1, 0x0, 0x1, {false, true, false, false, false}}}}}};
- BBAddrMap E2 = {{{0x22222, {{2, 0x0, 0x2, {false, false, true, false, false}}}}, {0xFFFFF, {{15, 0xF0, 0xF1, {true, true, true, true, true}}}}}};
- BBAddrMap E3 = {{{0x33333, {{0, 0x0, 0x3, {false, true, true, false, false}}}}}};
- BBAddrMap E4 = {{{0x44444, {{0, 0x0, 0x4, {false, false, false, true, true}}}}}};
+ BBAddrMap E1 = {
+ {{0x11111, {{1, 0x0, 0x1, {false, true, false, false, false}}}}}};
+ BBAddrMap E2 = {
+ {{0x22222, {{2, 0x0, 0x2, {false, false, true, false, false}}}},
+ {0xFFFFF, {{15, 0xF0, 0xF1, {true, true, true, true, true}}}}}};
+ BBAddrMap E3 = {
+ {{0x33333, {{0, 0x0, 0x3, {false, true, true, false, false}}}}}};
+ BBAddrMap E4 = {
+ {{0x44444, {{0, 0x0, 0x4, {false, false, false, true, true}}}}}};
std::vector<BBAddrMap> Section0BBAddrMaps = {E4};
std::vector<BBAddrMap> Section1BBAddrMaps = {E3};
``````````
</details>
https://github.com/llvm/llvm-project/pull/74128
More information about the cfe-commits
mailing list