[PATCH] D102207: [Debug-Info] make createAndAddDIE have dwarf::Tag type parameter - NFC
ChenZheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 10 18:42:28 PDT 2021
shchenz created this revision.
shchenz added reviewers: dblaikie, probinson, aprantl, jsji, PowerPC.
shchenz added a project: debug-info.
Herald added subscribers: dexonsmith, hiraditya.
shchenz requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This is a suggestion from @dblaikie in the code review of D100630 <https://reviews.llvm.org/D100630>.
Change the Tag parameter type to `dwarf::Tag` for function `createAndAddDIE`
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D102207
Files:
llvm/include/llvm/IR/DebugInfoMetadata.h
llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
Index: llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
+++ llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
@@ -254,7 +254,7 @@
/// Create a DIE with the given Tag, add the DIE to its parent, and
/// call insertDIE if MD is not null.
- DIE &createAndAddDIE(unsigned Tag, DIE &Parent, const DINode *N = nullptr);
+ DIE &createAndAddDIE(dwarf::Tag Tag, DIE &Parent, const DINode *N = nullptr);
bool useSegmentedStringOffsetsTable() const {
return DD->useSegmentedStringOffsetsTable();
Index: llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -385,8 +385,8 @@
Entry);
}
-DIE &DwarfUnit::createAndAddDIE(unsigned Tag, DIE &Parent, const DINode *N) {
- DIE &Die = Parent.addChild(DIE::get(DIEValueAllocator, (dwarf::Tag)Tag));
+DIE &DwarfUnit::createAndAddDIE(dwarf::Tag Tag, DIE &Parent, const DINode *N) {
+ DIE &Die = Parent.addChild(DIE::get(DIEValueAllocator, Tag));
if (N)
insertDIE(N, &Die);
return Die;
Index: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -273,6 +273,8 @@
return "<unnamed-tag>";
case dwarf::DW_TAG_namespace:
return "`anonymous namespace'";
+ default:
+ return StringRef();
}
return StringRef();
@@ -1487,6 +1489,9 @@
case dwarf::DW_TAG_class_type:
case dwarf::DW_TAG_union_type:
return false;
+ default:
+ // do nothing.
+ ;
}
}
}
@@ -2032,8 +2037,12 @@
static TypeRecordKind getRecordKind(const DICompositeType *Ty) {
switch (Ty->getTag()) {
- case dwarf::DW_TAG_class_type: return TypeRecordKind::Class;
- case dwarf::DW_TAG_structure_type: return TypeRecordKind::Struct;
+ case dwarf::DW_TAG_class_type:
+ return TypeRecordKind::Class;
+ case dwarf::DW_TAG_structure_type:
+ return TypeRecordKind::Struct;
+ default:
+ llvm_unreachable("unexpected tag");
}
llvm_unreachable("unexpected tag");
}
Index: llvm/include/llvm/IR/DebugInfoMetadata.h
===================================================================
--- llvm/include/llvm/IR/DebugInfoMetadata.h
+++ llvm/include/llvm/IR/DebugInfoMetadata.h
@@ -153,7 +153,7 @@
void setTag(unsigned Tag) { SubclassData16 = Tag; }
public:
- unsigned getTag() const { return SubclassData16; }
+ dwarf::Tag getTag() const { return (dwarf::Tag)SubclassData16; }
/// Debug info flags.
///
@@ -262,7 +262,7 @@
/// Return a (temporary) clone of this.
TempGenericDINode clone() const { return cloneImpl(); }
- unsigned getTag() const { return SubclassData16; }
+ dwarf::Tag getTag() const { return (dwarf::Tag)SubclassData16; }
StringRef getHeader() const { return getStringOperand(0); }
MDString *getRawHeader() const { return getOperandAs<MDString>(0); }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102207.344266.patch
Type: text/x-patch
Size: 3141 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210511/c3f5aa06/attachment.bin>
More information about the llvm-commits
mailing list