[PATCH] D53736: [BTF] Add BTF DebugInfo
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 17 12:04:36 PST 2018
MaskRay requested changes to this revision.
MaskRay added inline comments.
This revision now requires changes to proceed.
================
Comment at: lib/CodeGen/AsmPrinter/BTFDebug.cpp:142
+ DINodeArray Elements = ETy->getElements();
+ for (const auto Element : Elements) {
+ auto *Enum = dyn_cast_or_null<DIEnumerator>(Element);
----------------
`const DINode *`
================
Comment at: lib/CodeGen/AsmPrinter/BTFDebug.cpp:144
+ auto *Enum = dyn_cast_or_null<DIEnumerator>(Element);
+ assert(Enum && "Invalid null DIEnumerator");
+
----------------
`cast` if you don't think it can be null. `LLVM_ENABLE_ASSERTIONS` builds have `assert()` in `cast()`
================
Comment at: lib/CodeGen/AsmPrinter/BTFDebug.cpp:195
+ auto *DDTy = dyn_cast<DIDerivedType>(BaseType);
+ assert(DDTy);
+ BaseType = DDTy->getBaseType().resolve();
----------------
`cast`
================
Comment at: lib/CodeGen/AsmPrinter/BTFDebug.cpp:490
+ const DIBasicType *BaseTy = dyn_cast<DIBasicType>(ResolvedTy);
+ assert(BaseTy && "Incorrect bitfield member basetype");
+ auto TypeEntry = llvm::make_unique<BTFTypeInt>(
----------------
`dyn_cast + assert` can just be replaced by `cast`
================
Comment at: lib/CodeGen/AsmPrinter/BTFDebug.h:171
+ /// in the table.
+ uint32_t addString(std::string S);
+};
----------------
`StringRef`
================
Comment at: lib/CodeGen/AsmPrinter/BTFDebug.h:199
+ std::map<const DIType *, uint32_t> DIToIdMap;
+ std::map<const DIType *, uint32_t> BitFieldTypeMap;
+ std::map<uint32_t, std::vector<BTFFuncInfo>> FuncInfoTable;
----------------
Must these maps be ordered?
================
Comment at: lib/CodeGen/AsmPrinter/BTFDebug.h:202
+ std::map<uint32_t, std::vector<BTFLineInfo>> LineInfoTable;
+ std::map<std::string, std::vector<std::string>> FileContent;
+
----------------
Consider `StringMap`
Repository:
rL LLVM
https://reviews.llvm.org/D53736
More information about the llvm-commits
mailing list