Remove bogus std::error_code returns form SectionRef.
[oota-llvm.git] / tools / llvm-readobj / COFFDumper.cpp
index 8e7fcc06c1b4f39f5095c3ccd68d7ff7d74eff46..6d04c0e989c95635b725959a77cedd650dbaa705 100644 (file)
@@ -56,6 +56,7 @@ public:
   void printDynamicSymbols() override;
   void printUnwindInfo() override;
   void printCOFFImports() override;
+  void printCOFFDirectives() override;
 
 private:
   void printSymbol(const SymbolRef &Sym);
@@ -628,8 +629,7 @@ void COFFDumper::printSections() {
     if (opts::SectionSymbols) {
       ListScope D(W, "Symbols");
       for (const SymbolRef &Symbol : Obj->symbols()) {
-        bool Contained = false;
-        if (Sec.containsSymbol(Symbol, Contained) || !Contained)
+        if (!Sec.containsSymbol(Symbol))
           continue;
 
         printSymbol(Symbol);
@@ -932,3 +932,21 @@ void COFFDumper::printCOFFImports() {
     printImportedSymbols(I->imported_symbol_begin(), I->imported_symbol_end());
   }
 }
+
+void COFFDumper::printCOFFDirectives() {
+  for (const SectionRef &Section : Obj->sections()) {
+    StringRef Contents;
+    StringRef Name;
+
+    if (error(Section.getName(Name)))
+      continue;
+    if (Name != ".drectve")
+      continue;
+
+    if (error(Section.getContents(Contents)))
+      return;
+
+    W.printString("Directive(s)", Contents);
+  }
+}
+