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 origin/main HEAD --extensions c,cpp,h --
clang/test/CodeGen/btf-module-flag.c clang/test/Driver/gbtf.c
llvm/lib/Target/BPF/BPFBTFDebug.cpp llvm/lib/Target/BPF/BPFBTFDebug.h
clang/lib/CodeGen/CodeGenModule.cpp clang/lib/Driver/ToolChains/Clang.cpp
llvm/include/llvm/IR/Module.h llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/IR/Module.cpp llvm/lib/Target/BPF/BPFAsmPrinter.cpp
llvm/lib/Target/BPF/BPFAsmPrinter.h llvm/include/llvm/CodeGen/BTFDebug.h
llvm/lib/CodeGen/AsmPrinter/BTFDebug.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/include/llvm/CodeGen/BTFDebug.h
b/llvm/include/llvm/CodeGen/BTFDebug.h
index 925af5d2f..f588b5b78 100644
--- a/llvm/include/llvm/CodeGen/BTFDebug.h
+++ b/llvm/include/llvm/CodeGen/BTFDebug.h
@@ -97,7 +97,9 @@ class BTFTypeInt : public BTFTypeBase {
public:
BTFTypeInt(uint32_t Encoding, uint32_t SizeInBits, uint32_t OffsetInBits,
StringRef TypeName);
- uint32_t getSize() override { return BTFTypeBase::getSize() +
sizeof(uint32_t); }
+ uint32_t getSize() override {
+ return BTFTypeBase::getSize() + sizeof(uint32_t);
+ }
void completeType(BTFDebug &BDebug) override;
void emitType(MCStreamer &OS) override;
};
@@ -122,7 +124,9 @@ class BTFTypeArray : public BTFTypeBase {
public:
BTFTypeArray(uint32_t ElemTypeId, uint32_t NumElems);
- uint32_t getSize() override { return BTFTypeBase::getSize() +
BTF::BTFArraySize; }
+ uint32_t getSize() override {
+ return BTFTypeBase::getSize() + BTF::BTFArraySize;
+ }
void completeType(BTFDebug &BDebug) override;
void emitType(MCStreamer &OS) override;
};
diff --git a/llvm/include/llvm/IR/Module.h b/llvm/include/llvm/IR/Module.h
index dfaf80c95..270463da2 100644
--- a/llvm/include/llvm/IR/Module.h
+++ b/llvm/include/llvm/IR/Module.h
@@ -911,9 +911,9 @@ public:
/// Returns true if BTF debug info emission is requested via module flags.
bool getBTFFlag() const;
-/// @}
-/// @name Utility functions for querying and setting PIC level
-/// @{
+ /// @}
+ /// @name Utility functions for querying and setting PIC level
+ /// @{
/// Returns the PIC level (small or large model)
PICLevel::Level getPICLevel() const;
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index b6d1136e5..d040ad4c8 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -36,8 +36,8 @@
#include "llvm/BinaryFormat/COFF.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/BinaryFormat/ELF.h"
-#include "llvm/CodeGen/BasicBlockSectionsProfileReader.h"
#include "llvm/CodeGen/BTFDebug.h"
+#include "llvm/CodeGen/BasicBlockSectionsProfileReader.h"
#include "llvm/CodeGen/GCMetadata.h"
#include "llvm/CodeGen/GCMetadataPrinter.h"
#include "llvm/CodeGen/LazyMachineBlockFrequencyInfo.h"
@@ -650,8 +650,8 @@ bool AsmPrinter::doInitialization(Module &M) {
// DWARF — both consume the same IR debug metadata independently.
// Only for ELF targets (BTF uses ELF sections). BPF target handles
// BTF emission through its own AsmPrinter with BPFBTFDebug.
- if (M.getBTFFlag() && Target.isOSBinFormatELF() &&
- !Target.isBPF() && hasDebugInfo())
+ if (M.getBTFFlag() && Target.isOSBinFormatELF() && !Target.isBPF() &&
+ hasDebugInfo())
Handlers.push_back(std::make_unique<BTFDebug>(this));
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/BTFDebug.cpp
b/llvm/lib/CodeGen/AsmPrinter/BTFDebug.cpp
index 2a6879384..a1c9066aa 100644
--- a/llvm/lib/CodeGen/AsmPrinter/BTFDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/BTFDebug.cpp
@@ -113,7 +113,8 @@ void BTFTypeDerived::completeType(BTFDebug &BDebug) {
return;
// The base type for PTR/CONST/VOLATILE could be void.
- const DIType *ResolvedType =
BTFDebug::tryRemoveAtomicType(DTy->getBaseType());
+ const DIType *ResolvedType =
+ BTFDebug::tryRemoveAtomicType(DTy->getBaseType());
if (!ResolvedType) {
assert((Kind == BTF::BTF_KIND_PTR || Kind == BTF::BTF_KIND_CONST ||
Kind == BTF::BTF_KIND_VOLATILE) &&
@@ -189,7 +190,8 @@ void BTFTypeInt::emitType(MCStreamer &OS) {
}
BTFTypeEnum::BTFTypeEnum(const DICompositeType *ETy, uint32_t VLen,
- bool IsSigned) : ETy(ETy) {
+ bool IsSigned)
+ : ETy(ETy) {
Kind = BTF::BTF_KIND_ENUM;
BTFType.Info = IsSigned << 31 | Kind << 24 | VLen;
BTFType.Size = roundupToBytes(ETy->getSizeInBits());
@@ -228,7 +230,8 @@ void BTFTypeEnum::emitType(MCStreamer &OS) {
}
BTFTypeEnum64::BTFTypeEnum64(const DICompositeType *ETy, uint32_t VLen,
- bool IsSigned) : ETy(ETy) {
+ bool IsSigned)
+ : ETy(ETy) {
Kind = BTF::BTF_KIND_ENUM64;
BTFType.Info = IsSigned << 31 | Kind << 24 | VLen;
BTFType.Size = roundupToBytes(ETy->getSizeInBits());
@@ -417,7 +420,7 @@ void BTFTypeFuncProto::emitType(MCStreamer &OS) {
}
BTFTypeFunc::BTFTypeFunc(StringRef FuncName, uint32_t ProtoTypeId,
- uint32_t Scope)
+ uint32_t Scope)
: Name(FuncName) {
Kind = BTF::BTF_KIND_FUNC;
BTFType.Info = (Kind << 24) | Scope;
@@ -529,7 +532,8 @@ void BTFTypeTypeTag::completeType(BTFDebug &BDebug) {
IsCompleted = true;
BTFType.NameOff = BDebug.addString(Tag);
if (DTy) {
- const DIType *ResolvedType =
BTFDebug::tryRemoveAtomicType(DTy->getBaseType());
+ const DIType *ResolvedType =
+ BTFDebug::tryRemoveAtomicType(DTy->getBaseType());
if (!ResolvedType)
BTFType.Type = 0;
else
@@ -620,10 +624,9 @@ void BTFDebug::visitSubroutineType(
}
void BTFDebug::processDeclAnnotations(DINodeArray Annotations,
- uint32_t BaseTypeId,
- int ComponentIdx) {
+ uint32_t BaseTypeId, int ComponentIdx) {
if (!Annotations)
- return;
+ return;
for (const Metadata *Annotation : Annotations->operands()) {
const MDNode *MD = cast<MDNode>(Annotation);
@@ -765,8 +768,7 @@ void BTFDebug::visitArrayType(const DICompositeType *CTy,
uint32_t &TypeId) {
int64_t Count = CI->getSExtValue();
auto TypeEntry =
- std::make_unique<BTFTypeArray>(ElemTypeId,
- Count >= 0 ? Count : 0);
+ std::make_unique<BTFTypeArray>(ElemTypeId, Count >= 0 ? Count : 0);
if (I == 0)
ElemTypeId = addType(std::move(TypeEntry), CTy);
else
@@ -780,8 +782,8 @@ void BTFDebug::visitArrayType(const DICompositeType *CTy,
uint32_t &TypeId) {
// The IR does not have a type for array index while BTF wants one.
// So create an array index type if there is none.
if (!ArrayIndexTypeId) {
- auto TypeEntry = std::make_unique<BTFTypeInt>(dwarf::DW_ATE_unsigned, 32,
- 0, "__ARRAY_SIZE_TYPE__");
+ auto TypeEntry = std::make_unique<BTFTypeInt>(dwarf::DW_ATE_unsigned, 32,
0,
+ "__ARRAY_SIZE_TYPE__");
ArrayIndexTypeId = addType(std::move(TypeEntry));
}
}
@@ -1062,8 +1064,7 @@ void BTFDebug::emitBTFSection() {
void BTFDebug::emitBTFExtSection() {
// Do not emit section if empty FuncInfoTable and LineInfoTable
// and FieldRelocTable.
- if (!FuncInfoTable.size() && !LineInfoTable.size() &&
- !FieldRelocTable.size())
+ if (!FuncInfoTable.size() && !LineInfoTable.size() &&
!FieldRelocTable.size())
return;
MCContext &Ctx = OS.getContext();
diff --git a/llvm/lib/Target/BPF/BPFAsmPrinter.cpp
b/llvm/lib/Target/BPF/BPFAsmPrinter.cpp
index b67db52ab..417e2e5f1 100644
--- a/llvm/lib/Target/BPF/BPFAsmPrinter.cpp
+++ b/llvm/lib/Target/BPF/BPFAsmPrinter.cpp
@@ -13,9 +13,9 @@
#include "BPFAsmPrinter.h"
#include "BPF.h"
+#include "BPFBTFDebug.h"
#include "BPFInstrInfo.h"
#include "BPFMCInstLower.h"
-#include "BPFBTFDebug.h"
#include "MCTargetDesc/BPFInstPrinter.h"
#include "TargetInfo/BPFTargetInfo.h"
#include "llvm/BinaryFormat/ELF.h"
diff --git a/llvm/lib/Target/BPF/BPFAsmPrinter.h
b/llvm/lib/Target/BPF/BPFAsmPrinter.h
index 2a61ac6ea..cc7b7136b 100644
--- a/llvm/lib/Target/BPF/BPFAsmPrinter.h
+++ b/llvm/lib/Target/BPF/BPFAsmPrinter.h
@@ -9,8 +9,8 @@
#ifndef LLVM_LIB_TARGET_BPF_BPFASMPRINTER_H
#define LLVM_LIB_TARGET_BPF_BPFASMPRINTER_H
-#include "BPFTargetMachine.h"
#include "BPFBTFDebug.h"
+#include "BPFTargetMachine.h"
#include "llvm/CodeGen/AsmPrinter.h"
namespace llvm {
diff --git a/llvm/lib/Target/BPF/BPFBTFDebug.cpp
b/llvm/lib/Target/BPF/BPFBTFDebug.cpp
index 626c7756b..bb5cb4c85 100644
--- a/llvm/lib/Target/BPF/BPFBTFDebug.cpp
+++ b/llvm/lib/Target/BPF/BPFBTFDebug.cpp
@@ -163,8 +163,8 @@ void BPFBTFDebug::processGlobals() {
}
void BPFBTFDebug::generatePatchImmReloc(const MCSymbol *ORSym, uint32_t RootId,
- const GlobalVariable *GVar,
- bool IsAma) {
+ const GlobalVariable *GVar,
+ bool IsAma) {
BTFFieldReloc FieldReloc;
FieldReloc.Label = ORSym;
FieldReloc.TypeID = RootId;
@@ -175,10 +175,10 @@ void BPFBTFDebug::generatePatchImmReloc(const MCSymbol
*ORSym, uint32_t RootId,
size_t FirstColon = AccessPattern.find_first_of(':');
size_t SecondColon = AccessPattern.find_first_of(':', FirstColon + 1);
StringRef IndexPattern = AccessPattern.substr(FirstDollar + 1);
- StringRef RelocKindStr = AccessPattern.substr(FirstColon + 1,
- SecondColon - FirstColon);
- StringRef PatchImmStr = AccessPattern.substr(SecondColon + 1,
- FirstDollar - SecondColon);
+ StringRef RelocKindStr =
+ AccessPattern.substr(FirstColon + 1, SecondColon - FirstColon);
+ StringRef PatchImmStr =
+ AccessPattern.substr(SecondColon + 1, FirstDollar - SecondColon);
FieldReloc.OffsetNameOff = addString(IndexPattern);
FieldReloc.RelocKind = std::stoull(std::string(RelocKindStr));
@@ -254,7 +254,8 @@ bool BPFBTFDebug::InstLower(const MachineInstr *MI, MCInst
&OutMI) {
auto Imm = IMGIt->second;
auto Reloc = Imm.second;
if (Reloc == BTF::ENUM_VALUE_EXISTENCE || Reloc == BTF::ENUM_VALUE ||
- Reloc == BTF::BTF_TYPE_ID_LOCAL || Reloc ==
BTF::BTF_TYPE_ID_REMOTE)
+ Reloc == BTF::BTF_TYPE_ID_LOCAL ||
+ Reloc == BTF::BTF_TYPE_ID_REMOTE)
OutMI.setOpcode(BPF::LD_imm64);
else
OutMI.setOpcode(BPF::MOV_ri);
@@ -277,21 +278,16 @@ bool BPFBTFDebug::InstLower(const MachineInstr *MI,
MCInst &OutMI) {
uint32_t Imm = IMGIt->second.first;
OutMI.setOpcode(MI->getOperand(2).getImm());
if (MI->getOpcode() == BPF::CORE_ST) {
- OutMI.addOperand(
- MCOperand::createReg(MI->getOperand(0).getReg()));
+ OutMI.addOperand(MCOperand::createReg(MI->getOperand(0).getReg()));
OutMI.addOperand(MCOperand::createImm(Imm));
- OutMI.addOperand(
- MCOperand::createReg(MI->getOperand(1).getReg()));
+ OutMI.addOperand(MCOperand::createReg(MI->getOperand(1).getReg()));
} else if (MI->getOpcode() == BPF::CORE_SHIFT) {
- OutMI.addOperand(
- MCOperand::createReg(MI->getOperand(0).getReg()));
+ OutMI.addOperand(MCOperand::createReg(MI->getOperand(0).getReg()));
OutMI.addOperand(MCOperand::createImm(Imm));
} else {
- OutMI.addOperand(
- MCOperand::createReg(MI->getOperand(0).getReg()));
+ OutMI.addOperand(MCOperand::createReg(MI->getOperand(0).getReg()));
OutMI.addOperand(MCOperand::createImm(Imm));
- OutMI.addOperand(
- MCOperand::createReg(MI->getOperand(1).getReg()));
+ OutMI.addOperand(MCOperand::createReg(MI->getOperand(1).getReg()));
}
return true;
}
diff --git a/llvm/lib/Target/BPF/BPFBTFDebug.h
b/llvm/lib/Target/BPF/BPFBTFDebug.h
index 996b6a2de..9ca877248 100644
--- a/llvm/lib/Target/BPF/BPFBTFDebug.h
+++ b/llvm/lib/Target/BPF/BPFBTFDebug.h
@@ -1,4 +1,5 @@
-//===- BPFBTFDebug.h - BPF-specific BTF Debug Info ---------------*- C++
-*-===//
+//===- BPFBTFDebug.h - BPF-specific BTF Debug Info ---------------*- C++
+//-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
``````````
</details>
https://github.com/llvm/llvm-project/pull/183929
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits