[PECOFF] Simplify COFFBSSAtom.
authorRui Ueyama <ruiu@google.com>
Fri, 2 Aug 2013 05:04:06 +0000 (05:04 +0000)
committerRui Ueyama <ruiu@google.com>
Fri, 2 Aug 2013 05:04:06 +0000 (05:04 +0000)
A instance of the class always represents a BSS atom, so we don't need
to look at the symbol or the section to retrieve its attributes.

llvm-svn: 187643

lld/lib/ReaderWriter/PECOFF/Atoms.h
lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp

index 56869a3..badcff2 100644 (file)
@@ -235,11 +235,13 @@ private:
 class COFFBSSAtom : public COFFDefinedFileAtom {
 public:
   COFFBSSAtom(const File &file, StringRef name, const coff_symbol *symbol,
-              const coff_section *section, uint32_t size,
-              StringRef sectionName, uint64_t ordinal)
-      : COFFDefinedFileAtom(file, name, symbol, section, sectionName, ordinal),
+              uint32_t size, uint64_t ordinal)
+      : COFFDefinedFileAtom(file, name, symbol, nullptr, "", ordinal),
         _size(size) {}
 
+  virtual ContentPermissions permissions() const { return permRW_; }
+  virtual ContentType contentType() const { return typeZeroFill; }
+  virtual Merge merge() const { return mergeNo; }
   virtual uint64_t size() const { return _size; }
   virtual ArrayRef<uint8_t> rawContent() const { return _contents; }
 
index b1bb59f..10949c8 100644 (file)
@@ -220,8 +220,7 @@ private:
             ? section->SizeOfRawData - sym->Value
             : si[1]->Value - sym->Value;
         auto *atom = new (_alloc) COFFBSSAtom(
-            *this, _symbolName[sym], sym, section, size, sectionName,
-            ++ordinal);
+            *this, _symbolName[sym], sym, size, ++ordinal);
         atoms.push_back(atom);
         _symbolAtom[sym] = atom;
       }