[PATCH] D27326: Make a DWARF generator so we can unit test DWARF APIs with gtest.

Greg Clayton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 5 16:02:24 PST 2016


clayborg marked 10 inline comments as done.
clayborg added a comment.

Marked things as done and commented where things weren't changed.



================
Comment at: lib/CodeGen/AsmPrinter/DIE.cpp:593
+void DIEInlineString::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {
+  if (Form == dwarf::DW_FORM_string) {
+    for (char ch : S)
----------------
If we use an assert and they aren't enabled, we want to crash, so I used llvm_unreachable below.


================
Comment at: lib/CodeGen/DwarfGenerator.cpp:123
+  return Expected<std::unique_ptr<dwarfgen::Generator>>(std::move(GenUP));
+}
+
----------------
Can't inline the destructor as the headers must be included so that the std::unique_ptr member variables and properly destruct themselves.


================
Comment at: lib/CodeGen/DwarfGenerator.h:170
+  std::unique_ptr<MCContext> MC;
+  MCAsmBackend *MAB; // Owned by MCStreamer
+  std::unique_ptr<MCInstrInfo> MII;
----------------
aprantl wrote:
> can this be a nullptr? Should it be a reference?
It is returned as a pointer from the place we get it from (TheTarget->createMCAsmBackend(...)) so this should stay a pointer.


================
Comment at: unittests/DebugInfo/DWARF/CMakeLists.txt:4-9
+  CodeGen
+  Core
+  MC
+  MIRParser
+  Support
+  Target
----------------
This is only for this unit test executable, not for libDebugInfoDWARF.


https://reviews.llvm.org/D27326





More information about the llvm-commits mailing list