[PATCH] D35386: Speed up gdb index creation

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 13 16:34:25 PDT 2017


ruiu accepted this revision.
ruiu added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: ELF/GdbIndex.cpp:56-64
+    if (LLDDWARFSection *M = StringSwitch<LLDDWARFSection *>(Sec->Name)
+                                 .Case(".debug_info", &InfoSection)
+                                 .Case(".debug_ranges", &RangeSection)
+                                 .Case(".debug_line", &LineSection)
+                                 .Default(nullptr)) {
+      M->Data = toStringRef(Sec->Data);
+      M->Sec = Sec;
----------------
This may look a bit dumb, but I think I prefer this style over StringSwitch:

  if (Sec->Name == ".debug_info") {
    InfoSection->Data = toStringRef(Sec->Data);
    InfoSection->Sec = Sec;
  } else if (Sec->Name == ".debug_ranges") {
    RangeSection->Data = toStringRef(Sec->Data);
    RangeSection->Sec = Sec;
  } else if ...



================
Comment at: ELF/InputFiles.cpp:60
 template <class ELFT> void elf::ObjectFile<ELFT>::initializeDwarfLine() {
-  std::unique_ptr<object::ObjectFile> Obj =
-      check(object::ObjectFile::createObjectFile(this->MB), toString(this));
-
-  ObjectInfo ObjInfo;
-  DWARFContextInMemory Dwarf(*Obj, &ObjInfo);
+  LLDDwarfObj<ELFT> DO(this);
+  DWARFContext Dwarf(DO);
----------------
DO sounds like a verb. How about DOjb or just Obj?


https://reviews.llvm.org/D35386





More information about the llvm-commits mailing list