Skip to content

Commit a251525

Browse files
committed
Formatting
1 parent b2475e2 commit a251525

File tree

15 files changed

+69
-45
lines changed

15 files changed

+69
-45
lines changed

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5292,8 +5292,9 @@ void CGDebugInfo::EmitLabel(const LabelDecl *D, CGBuilderTy &Builder) {
52925292
StringRef Name = D->getName();
52935293

52945294
// Create the descriptor for the label.
5295-
auto *L =
5296-
DBuilder.createLabel(Scope, Name, Unit, Line, Column, /*IsArtificial=*/false, /*CoroSuspendIdx=*/std::nullopt, CGM.getLangOpts().Optimize);
5295+
auto *L = DBuilder.createLabel(
5296+
Scope, Name, Unit, Line, Column, /*IsArtificial=*/false,
5297+
/*CoroSuspendIdx=*/std::nullopt, CGM.getLangOpts().Optimize);
52975298

52985299
// Insert an llvm.dbg.label into the current block.
52995300
DBuilder.insertLabel(L,

llvm/include/llvm/IR/DIBuilder.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,8 @@ namespace llvm {
901901
/// \c Scope must be a \a DILocalScope, and thus its scope chain eventually
902902
/// leads to a \a DISubprogram.
903903
LLVM_ABI DILabel *createLabel(DIScope *Scope, StringRef Name, DIFile *File,
904-
unsigned LineNo, unsigned Column, bool IsArtificial,
904+
unsigned LineNo, unsigned Column,
905+
bool IsArtificial,
905906
std::optional<unsigned> CoroSuspendIdx,
906907
bool AlwaysPreserve = false);
907908

llvm/include/llvm/IR/DebugInfoMetadata.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4115,18 +4115,18 @@ class DILabel : public DINode {
41154115

41164116
static DILabel *getImpl(LLVMContext &Context, DIScope *Scope, StringRef Name,
41174117
DIFile *File, unsigned Line, unsigned Column,
4118-
bool IsArtificial, std::optional<unsigned> CoroSuspendIdx,
4118+
bool IsArtificial,
4119+
std::optional<unsigned> CoroSuspendIdx,
41194120
StorageType Storage, bool ShouldCreate = true) {
41204121
return getImpl(Context, Scope, getCanonicalMDString(Context, Name), File,
41214122
Line, Column, IsArtificial, CoroSuspendIdx, Storage,
41224123
ShouldCreate);
41234124
}
4124-
LLVM_ABI static DILabel *getImpl(LLVMContext &Context, Metadata *Scope,
4125-
MDString *Name, Metadata *File,
4126-
unsigned Line, unsigned Column,
4127-
bool IsArtificial, std::optional<unsigned> CoroSuspendIdx,
4128-
StorageType Storage,
4129-
bool ShouldCreate = true);
4125+
LLVM_ABI static DILabel *
4126+
getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name, Metadata *File,
4127+
unsigned Line, unsigned Column, bool IsArtificial,
4128+
std::optional<unsigned> CoroSuspendIdx, StorageType Storage,
4129+
bool ShouldCreate = true);
41304130

41314131
TempDILabel cloneImpl() const {
41324132
return getTemporary(getContext(), getScope(), getName(), getFile(),

llvm/lib/AsmParser/LLParser.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6129,10 +6129,13 @@ bool LLParser::parseDILabel(MDNode *&Result, bool IsDistinct) {
61296129
PARSE_MD_FIELDS();
61306130
#undef VISIT_MD_FIELDS
61316131

6132-
std::optional<unsigned> CoroSuspendIdx = coroSuspendIdx.Seen ? std::optional<unsigned>(coroSuspendIdx.Val) : std::nullopt;
6132+
std::optional<unsigned> CoroSuspendIdx =
6133+
coroSuspendIdx.Seen ? std::optional<unsigned>(coroSuspendIdx.Val)
6134+
: std::nullopt;
61336135

61346136
Result = GET_OR_DISTINCT(DILabel,
6135-
(Context, scope.Val, name.Val, file.Val, line.Val, column.Val, isArtificial.Val, CoroSuspendIdx));
6137+
(Context, scope.Val, name.Val, file.Val, line.Val,
6138+
column.Val, isArtificial.Val, CoroSuspendIdx));
61366139
return false;
61376140
}
61386141

llvm/lib/Bitcode/Reader/MetadataLoader.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2260,9 +2260,10 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
22602260
}
22612261

22622262
MetadataList.assignValue(
2263-
GET_OR_DISTINCT(DILabel, (Context, getMDOrNull(Record[1]),
2264-
getMDString(Record[2]),
2265-
getMDOrNull(Record[3]), Line, Column, IsArtificial, CoroSuspendIdx)),
2263+
GET_OR_DISTINCT(DILabel,
2264+
(Context, getMDOrNull(Record[1]),
2265+
getMDString(Record[2]), getMDOrNull(Record[3]), Line,
2266+
Column, IsArtificial, CoroSuspendIdx)),
22662267
NextMetadataNo);
22672268
NextMetadataNo++;
22682269
break;

llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2351,7 +2351,8 @@ void ModuleBitcodeWriter::writeDILabel(
23512351
Record.push_back(VE.getMetadataOrNullID(N->getFile()));
23522352
Record.push_back(N->getLine());
23532353
Record.push_back(N->getColumn());
2354-
Record.push_back(N->getCoroSuspendIdx().value_or(std::numeric_limits<uint64_t>::max()));
2354+
Record.push_back(
2355+
N->getCoroSuspendIdx().value_or(std::numeric_limits<uint64_t>::max()));
23552356

23562357
Stream.EmitRecord(bitc::METADATA_LABEL, Record, Abbrev);
23572358
Record.clear();

llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,8 @@ void DwarfUnit::addBlock(DIE &Die, dwarf::Attribute Attribute,
442442
addBlock(Die, Attribute, Block->BestForm(), Block);
443443
}
444444

445-
void DwarfUnit::addSourceLine(DIE &Die, unsigned Line, unsigned Column, const DIFile *File) {
445+
void DwarfUnit::addSourceLine(DIE &Die, unsigned Line, unsigned Column,
446+
const DIFile *File) {
446447
if (Line == 0)
447448
return;
448449

llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,8 @@ class DwarfUnit : public DIEUnit {
216216
DIEBlock *Block);
217217

218218
/// Add location information to specified debug information entry.
219-
void addSourceLine(DIE &Die, unsigned Line, unsigned Column, const DIFile *File);
219+
void addSourceLine(DIE &Die, unsigned Line, unsigned Column,
220+
const DIFile *File);
220221
void addSourceLine(DIE &Die, const DILocalVariable *V);
221222
void addSourceLine(DIE &Die, const DIGlobalVariable *G);
222223
void addSourceLine(DIE &Die, const DISubprogram *SP);

llvm/lib/IR/AsmWriter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2614,7 +2614,8 @@ static void writeDILabel(raw_ostream &Out, const DILabel *N,
26142614
Printer.printInt("column", N->getColumn());
26152615
Printer.printBool("isArtificial", N->isArtificial(), false);
26162616
if (N->getCoroSuspendIdx())
2617-
Printer.printInt("coroSuspendIdx", *N->getCoroSuspendIdx(), /* ShouldSkipZero */ false);
2617+
Printer.printInt("coroSuspendIdx", *N->getCoroSuspendIdx(),
2618+
/* ShouldSkipZero */ false);
26182619
Out << ")";
26192620
}
26202621

llvm/lib/IR/DIBuilder.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -946,11 +946,13 @@ DILocalVariable *DIBuilder::createParameterVariable(
946946
}
947947

948948
DILabel *DIBuilder::createLabel(DIScope *Context, StringRef Name, DIFile *File,
949-
unsigned LineNo, unsigned Column, bool IsArtificial,
950-
std::optional<unsigned> CoroSuspendIdx,
951-
bool AlwaysPreserve) {
949+
unsigned LineNo, unsigned Column,
950+
bool IsArtificial,
951+
std::optional<unsigned> CoroSuspendIdx,
952+
bool AlwaysPreserve) {
952953
auto *Scope = cast<DILocalScope>(Context);
953-
auto *Node = DILabel::get(VMContext, Scope, Name, File, LineNo, Column, IsArtificial, CoroSuspendIdx);
954+
auto *Node = DILabel::get(VMContext, Scope, Name, File, LineNo, Column,
955+
IsArtificial, CoroSuspendIdx);
954956

955957
if (AlwaysPreserve) {
956958
/// The optimizer may remove labels. If there is an interest

llvm/lib/IR/DebugInfoMetadata.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,7 +1616,8 @@ std::optional<uint64_t> DIVariable::getSizeInBits() const {
16161616
}
16171617

16181618
DILabel::DILabel(LLVMContext &C, StorageType Storage, unsigned Line,
1619-
unsigned Column, bool IsArtificial, std::optional<unsigned> CoroSuspendIdx,
1619+
unsigned Column, bool IsArtificial,
1620+
std::optional<unsigned> CoroSuspendIdx,
16201621
ArrayRef<Metadata *> Ops)
16211622
: DINode(C, DILabelKind, Storage, dwarf::DW_TAG_label, Ops) {
16221623
this->SubclassData32 = Line;
@@ -1626,12 +1627,13 @@ DILabel::DILabel(LLVMContext &C, StorageType Storage, unsigned Line,
16261627
}
16271628
DILabel *DILabel::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
16281629
Metadata *File, unsigned Line, unsigned Column,
1629-
bool IsArtificial, std::optional<unsigned> CoroSuspendIdx,
1630+
bool IsArtificial,
1631+
std::optional<unsigned> CoroSuspendIdx,
16301632
StorageType Storage, bool ShouldCreate) {
16311633
assert(Scope && "Expected scope");
16321634
assert(isCanonical(Name) && "Expected canonical MDString");
1633-
DEFINE_GETIMPL_LOOKUP(DILabel, (Scope, Name, File, Line, Column, IsArtificial,
1634-
CoroSuspendIdx));
1635+
DEFINE_GETIMPL_LOOKUP(
1636+
DILabel, (Scope, Name, File, Line, Column, IsArtificial, CoroSuspendIdx));
16351637
Metadata *Ops[] = {Scope, Name, File};
16361638
DEFINE_GETIMPL_STORE(DILabel, (Line, Column, IsArtificial, CoroSuspendIdx),
16371639
Ops);

llvm/lib/IR/LLVMContextImpl.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,11 +1333,16 @@ template <> struct MDNodeKeyImpl<DILabel> {
13331333
bool IsArtificial;
13341334
std::optional<unsigned> CoroSuspendIdx;
13351335

1336-
MDNodeKeyImpl(Metadata *Scope, MDString *Name, Metadata *File, unsigned Line, unsigned Column, bool IsArtificial, std::optional<unsigned> CoroSuspendIdx)
1337-
: Scope(Scope), Name(Name), File(File), Line(Line), Column(Column), IsArtificial(IsArtificial), CoroSuspendIdx(CoroSuspendIdx) {}
1336+
MDNodeKeyImpl(Metadata *Scope, MDString *Name, Metadata *File, unsigned Line,
1337+
unsigned Column, bool IsArtificial,
1338+
std::optional<unsigned> CoroSuspendIdx)
1339+
: Scope(Scope), Name(Name), File(File), Line(Line), Column(Column),
1340+
IsArtificial(IsArtificial), CoroSuspendIdx(CoroSuspendIdx) {}
13381341
MDNodeKeyImpl(const DILabel *N)
13391342
: Scope(N->getRawScope()), Name(N->getRawName()), File(N->getRawFile()),
1340-
Line(N->getLine()), Column(N->getColumn()), IsArtificial(N->isArtificial()), CoroSuspendIdx(N->getCoroSuspendIdx()) {}
1343+
Line(N->getLine()), Column(N->getColumn()),
1344+
IsArtificial(N->isArtificial()),
1345+
CoroSuspendIdx(N->getCoroSuspendIdx()) {}
13411346

13421347
bool isKeyOf(const DILabel *RHS) const {
13431348
return Scope == RHS->getRawScope() && Name == RHS->getRawName() &&
@@ -1347,7 +1352,10 @@ template <> struct MDNodeKeyImpl<DILabel> {
13471352
}
13481353

13491354
/// Using name and line to get hash value. It should already be mostly unique.
1350-
unsigned getHashValue() const { return hash_combine(Scope, Name, Line, Column, IsArtificial, CoroSuspendIdx); }
1355+
unsigned getHashValue() const {
1356+
return hash_combine(Scope, Name, Line, Column, IsArtificial,
1357+
CoroSuspendIdx);
1358+
}
13511359
};
13521360

13531361
template <> struct MDNodeKeyImpl<DIExpression> {

llvm/lib/Transforms/Coroutines/CoroSplit.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,12 +1579,13 @@ struct SwitchCoroutineSplitter {
15791579
if (DebugLoc SuspendLoc = S->getDebugLoc()) {
15801580
std::string LabelName =
15811581
("__coro_resume_" + Twine(SuspendIndex)).str();
1582-
DILocation& DILoc = *SuspendLoc.get();
1583-
DILabel *ResumeLabel = DBuilder.createLabel(
1584-
DIS, LabelName, DILoc.getFile(), SuspendLoc.getLine(), SuspendLoc.getCol(),
1585-
/*IsArtificial=*/true,
1586-
/*CoroSuspendIdx=*/SuspendIndex,
1587-
/*AlwaysPreserve=*/false);
1582+
DILocation &DILoc = *SuspendLoc.get();
1583+
DILabel *ResumeLabel =
1584+
DBuilder.createLabel(DIS, LabelName, DILoc.getFile(),
1585+
SuspendLoc.getLine(), SuspendLoc.getCol(),
1586+
/*IsArtificial=*/true,
1587+
/*CoroSuspendIdx=*/SuspendIndex,
1588+
/*AlwaysPreserve=*/false);
15881589
DBuilder.insertLabel(ResumeLabel, &DILoc, ResumeBB->begin());
15891590
}
15901591
}

llvm/lib/Transforms/Utils/CodeExtractor.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,11 +1347,10 @@ static void fixupDebugInfoPostExtraction(Function &OldFunc, Function &NewFunc,
13471347
if (!NewLabel) {
13481348
DILocalScope *NewScope = DILocalScope::cloneScopeForSubprogram(
13491349
*OldLabel->getScope(), *NewSP, Ctx, Cache);
1350-
NewLabel = DILabel::get(Ctx, NewScope, OldLabel->getName(),
1351-
OldLabel->getFile(), OldLabel->getLine(),
1352-
OldLabel->getColumn(),
1353-
OldLabel->isArtificial(),
1354-
OldLabel->getCoroSuspendIdx());
1350+
NewLabel =
1351+
DILabel::get(Ctx, NewScope, OldLabel->getName(), OldLabel->getFile(),
1352+
OldLabel->getLine(), OldLabel->getColumn(),
1353+
OldLabel->isArtificial(), OldLabel->getCoroSuspendIdx());
13551354
}
13561355
LabelRecord->setLabel(cast<DILabel>(NewLabel));
13571356
};

llvm/unittests/IR/IRBuilderTest.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -920,9 +920,11 @@ TEST_F(IRBuilderTest, DIBuilder) {
920920
// --------------------------
921921
DILocation *LabelLoc = DILocation::get(Ctx, 1, 0, BarScope);
922922
DILabel *AlwaysPreserveLabel = DIB.createLabel(
923-
BarScope, "meles_meles", File, 1, /*Column*/ 0, /*IsArtificial*/ false, /*CoroSuspendIdx*/ std::nullopt, /*AlwaysPreserve*/ true);
924-
DILabel *Label =
925-
DIB.createLabel(BarScope, "badger", File, 1, /*Column*/ 0, /*IsArtificial*/ false, /*CoroSuspendIdx*/ std::nullopt, /*AlwaysPreserve*/ false);
923+
BarScope, "meles_meles", File, 1, /*Column*/ 0, /*IsArtificial*/ false,
924+
/*CoroSuspendIdx*/ std::nullopt, /*AlwaysPreserve*/ true);
925+
DILabel *Label = DIB.createLabel(
926+
BarScope, "badger", File, 1, /*Column*/ 0, /*IsArtificial*/ false,
927+
/*CoroSuspendIdx*/ std::nullopt, /*AlwaysPreserve*/ false);
926928

927929
{ /* dbg.label | DbgLabelRecord */
928930
// Insert before I and check order.

0 commit comments

Comments
 (0)