[lld] r365730 - [Coding style change][lld] Rename variables for non-ELF ports

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 10 22:40:31 PDT 2019


Modified: lld/trunk/wasm/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Symbols.h?rev=365730&r1=365729&r2=365730&view=diff
==============================================================================
--- lld/trunk/wasm/Symbols.h (original)
+++ lld/trunk/wasm/Symbols.h Wed Jul 10 22:40:30 2019
@@ -20,10 +20,10 @@ namespace wasm {
 // Shared string constants
 
 // The default module name to use for symbol imports.
-extern const char *DefaultModule;
+extern const char *defaultModule;
 
 // The name under which to import or export the wasm table.
-extern const char *FunctionTableName;
+extern const char *functionTableName;
 
 using llvm::wasm::WasmSymbolType;
 
@@ -54,16 +54,16 @@ public:
     LazyKind,
   };
 
-  Kind kind() const { return SymbolKind; }
+  Kind kind() const { return symbolKind; }
 
   bool isDefined() const { return !isLazy() && !isUndefined(); }
 
   bool isUndefined() const {
-    return SymbolKind == UndefinedFunctionKind ||
-           SymbolKind == UndefinedDataKind || SymbolKind == UndefinedGlobalKind;
+    return symbolKind == UndefinedFunctionKind ||
+           symbolKind == UndefinedDataKind || symbolKind == UndefinedGlobalKind;
   }
 
-  bool isLazy() const { return SymbolKind == LazyKind; }
+  bool isLazy() const { return symbolKind == LazyKind; }
 
   bool isLocal() const;
   bool isWeak() const;
@@ -80,12 +80,12 @@ public:
   }
 
   // Returns the symbol name.
-  StringRef getName() const { return Name; }
+  StringRef getName() const { return name; }
 
   // Returns the file from which this symbol was created.
-  InputFile *getFile() const { return File; }
+  InputFile *getFile() const { return file; }
 
-  uint32_t getFlags() const { return Flags; }
+  uint32_t getFlags() const { return flags; }
 
   InputChunk *getChunk() const;
 
@@ -97,120 +97,120 @@ public:
   // final image.
   void markLive();
 
-  void setHidden(bool IsHidden);
+  void setHidden(bool isHidden);
 
   // Get/set the index in the output symbol table.  This is only used for
   // relocatable output.
   uint32_t getOutputSymbolIndex() const;
-  void setOutputSymbolIndex(uint32_t Index);
+  void setOutputSymbolIndex(uint32_t index);
 
   WasmSymbolType getWasmType() const;
   bool isExported() const;
 
   const WasmSignature* getSignature() const;
 
-  bool isInGOT() const { return GOTIndex != INVALID_INDEX; }
+  bool isInGOT() const { return gotIndex != INVALID_INDEX; }
 
   uint32_t getGOTIndex() const {
-    assert(GOTIndex != INVALID_INDEX);
-    return GOTIndex;
+    assert(gotIndex != INVALID_INDEX);
+    return gotIndex;
   }
 
-  void setGOTIndex(uint32_t Index);
-  bool hasGOTIndex() const { return GOTIndex != INVALID_INDEX; }
+  void setGOTIndex(uint32_t index);
+  bool hasGOTIndex() const { return gotIndex != INVALID_INDEX; }
 
 protected:
-  Symbol(StringRef Name, Kind K, uint32_t Flags, InputFile *F)
-      : Name(Name), File(F), Flags(Flags), SymbolKind(K),
-        Referenced(!Config->GcSections), IsUsedInRegularObj(false),
-        ForceExport(false), CanInline(false), Traced(false) {}
-
-  StringRef Name;
-  InputFile *File;
-  uint32_t Flags;
-  uint32_t OutputSymbolIndex = INVALID_INDEX;
-  uint32_t GOTIndex = INVALID_INDEX;
-  Kind SymbolKind;
+  Symbol(StringRef name, Kind k, uint32_t flags, InputFile *f)
+      : name(name), file(f), flags(flags), symbolKind(k),
+        referenced(!config->gcSections), isUsedInRegularObj(false),
+        forceExport(false), canInline(false), traced(false) {}
+
+  StringRef name;
+  InputFile *file;
+  uint32_t flags;
+  uint32_t outputSymbolIndex = INVALID_INDEX;
+  uint32_t gotIndex = INVALID_INDEX;
+  Kind symbolKind;
 
 public:
-  bool Referenced : 1;
+  bool referenced : 1;
 
   // True if the symbol was used for linking and thus need to be added to the
   // output file's symbol table. This is true for all symbols except for
   // unreferenced DSO symbols, lazy (archive) symbols, and bitcode symbols that
   // are unreferenced except by other bitcode objects.
-  bool IsUsedInRegularObj : 1;
+  bool isUsedInRegularObj : 1;
 
   // True if ths symbol is explicity marked for export (i.e. via the -e/--export
   // command line flag)
-  bool ForceExport : 1;
+  bool forceExport : 1;
 
   // False if LTO shouldn't inline whatever this symbol points to. If a symbol
   // is overwritten after LTO, LTO shouldn't inline the symbol because it
   // doesn't know the final contents of the symbol.
-  bool CanInline : 1;
+  bool canInline : 1;
 
   // True if this symbol is specified by --trace-symbol option.
-  bool Traced : 1;
+  bool traced : 1;
 };
 
 class FunctionSymbol : public Symbol {
 public:
-  static bool classof(const Symbol *S) {
-    return S->kind() == DefinedFunctionKind ||
-           S->kind() == UndefinedFunctionKind;
+  static bool classof(const Symbol *s) {
+    return s->kind() == DefinedFunctionKind ||
+           s->kind() == UndefinedFunctionKind;
   }
 
   // Get/set the table index
-  void setTableIndex(uint32_t Index);
+  void setTableIndex(uint32_t index);
   uint32_t getTableIndex() const;
   bool hasTableIndex() const;
 
   // Get/set the function index
   uint32_t getFunctionIndex() const;
-  void setFunctionIndex(uint32_t Index);
+  void setFunctionIndex(uint32_t index);
   bool hasFunctionIndex() const;
 
-  const WasmSignature *Signature;
+  const WasmSignature *signature;
 
 protected:
-  FunctionSymbol(StringRef Name, Kind K, uint32_t Flags, InputFile *F,
-                 const WasmSignature *Sig)
-      : Symbol(Name, K, Flags, F), Signature(Sig) {}
+  FunctionSymbol(StringRef name, Kind k, uint32_t flags, InputFile *f,
+                 const WasmSignature *sig)
+      : Symbol(name, k, flags, f), signature(sig) {}
 
-  uint32_t TableIndex = INVALID_INDEX;
-  uint32_t FunctionIndex = INVALID_INDEX;
+  uint32_t tableIndex = INVALID_INDEX;
+  uint32_t functionIndex = INVALID_INDEX;
 };
 
 class DefinedFunction : public FunctionSymbol {
 public:
-  DefinedFunction(StringRef Name, uint32_t Flags, InputFile *F,
-                  InputFunction *Function);
+  DefinedFunction(StringRef name, uint32_t flags, InputFile *f,
+                  InputFunction *function);
 
-  static bool classof(const Symbol *S) {
-    return S->kind() == DefinedFunctionKind;
+  static bool classof(const Symbol *s) {
+    return s->kind() == DefinedFunctionKind;
   }
 
-  InputFunction *Function;
+  InputFunction *function;
 };
 
 class UndefinedFunction : public FunctionSymbol {
 public:
-  UndefinedFunction(StringRef Name, StringRef ImportName,
-                    StringRef ImportModule, uint32_t Flags,
-                    InputFile *File = nullptr,
-                    const WasmSignature *Type = nullptr,
-                    bool IsCalledDirectly = true)
-      : FunctionSymbol(Name, UndefinedFunctionKind, Flags, File, Type),
-        ImportName(ImportName), ImportModule(ImportModule), IsCalledDirectly(IsCalledDirectly) {}
-
-  static bool classof(const Symbol *S) {
-    return S->kind() == UndefinedFunctionKind;
+  UndefinedFunction(StringRef name, StringRef importName,
+                    StringRef importModule, uint32_t flags,
+                    InputFile *file = nullptr,
+                    const WasmSignature *type = nullptr,
+                    bool isCalledDirectly = true)
+      : FunctionSymbol(name, UndefinedFunctionKind, flags, file, type),
+        importName(importName), importModule(importModule), isCalledDirectly(isCalledDirectly) {}
+
+  static bool classof(const Symbol *s) {
+    return s->kind() == UndefinedFunctionKind;
   }
 
-  StringRef ImportName;
-  StringRef ImportModule;
-  bool IsCalledDirectly;
+  StringRef importName;
+  StringRef importModule;
+  bool isCalledDirectly;
 };
 
 // Section symbols for output sections are different from those for input
@@ -218,128 +218,128 @@ public:
 // rather than an InputSection.
 class OutputSectionSymbol : public Symbol {
 public:
-  OutputSectionSymbol(const OutputSection *S)
+  OutputSectionSymbol(const OutputSection *s)
       : Symbol("", OutputSectionKind, llvm::wasm::WASM_SYMBOL_BINDING_LOCAL,
                nullptr),
-        Section(S) {}
+        section(s) {}
 
-  static bool classof(const Symbol *S) {
-    return S->kind() == OutputSectionKind;
+  static bool classof(const Symbol *s) {
+    return s->kind() == OutputSectionKind;
   }
 
-  const OutputSection *Section;
+  const OutputSection *section;
 };
 
 class SectionSymbol : public Symbol {
 public:
-  SectionSymbol(uint32_t Flags, const InputSection *S, InputFile *F = nullptr)
-      : Symbol("", SectionKind, Flags, F), Section(S) {}
+  SectionSymbol(uint32_t flags, const InputSection *s, InputFile *f = nullptr)
+      : Symbol("", SectionKind, flags, f), section(s) {}
 
-  static bool classof(const Symbol *S) { return S->kind() == SectionKind; }
+  static bool classof(const Symbol *s) { return s->kind() == SectionKind; }
 
   const OutputSectionSymbol *getOutputSectionSymbol() const;
 
-  const InputSection *Section;
+  const InputSection *section;
 };
 
 class DataSymbol : public Symbol {
 public:
-  static bool classof(const Symbol *S) {
-    return S->kind() == DefinedDataKind || S->kind() == UndefinedDataKind;
+  static bool classof(const Symbol *s) {
+    return s->kind() == DefinedDataKind || s->kind() == UndefinedDataKind;
   }
 
 protected:
-  DataSymbol(StringRef Name, Kind K, uint32_t Flags, InputFile *F)
-      : Symbol(Name, K, Flags, F) {}
+  DataSymbol(StringRef name, Kind k, uint32_t flags, InputFile *f)
+      : Symbol(name, k, flags, f) {}
 };
 
 class DefinedData : public DataSymbol {
 public:
   // Constructor for regular data symbols originating from input files.
-  DefinedData(StringRef Name, uint32_t Flags, InputFile *F,
-              InputSegment *Segment, uint32_t Offset, uint32_t Size)
-      : DataSymbol(Name, DefinedDataKind, Flags, F), Segment(Segment),
-        Offset(Offset), Size(Size) {}
+  DefinedData(StringRef name, uint32_t flags, InputFile *f,
+              InputSegment *segment, uint32_t offset, uint32_t size)
+      : DataSymbol(name, DefinedDataKind, flags, f), segment(segment),
+        offset(offset), size(size) {}
 
   // Constructor for linker synthetic data symbols.
-  DefinedData(StringRef Name, uint32_t Flags)
-      : DataSymbol(Name, DefinedDataKind, Flags, nullptr) {}
+  DefinedData(StringRef name, uint32_t flags)
+      : DataSymbol(name, DefinedDataKind, flags, nullptr) {}
 
-  static bool classof(const Symbol *S) { return S->kind() == DefinedDataKind; }
+  static bool classof(const Symbol *s) { return s->kind() == DefinedDataKind; }
 
   // Returns the output virtual address of a defined data symbol.
   uint32_t getVirtualAddress() const;
-  void setVirtualAddress(uint32_t VA);
+  void setVirtualAddress(uint32_t va);
 
   // Returns the offset of a defined data symbol within its OutputSegment.
   uint32_t getOutputSegmentOffset() const;
   uint32_t getOutputSegmentIndex() const;
-  uint32_t getSize() const { return Size; }
+  uint32_t getSize() const { return size; }
 
-  InputSegment *Segment = nullptr;
+  InputSegment *segment = nullptr;
 
 protected:
-  uint32_t Offset = 0;
-  uint32_t Size = 0;
+  uint32_t offset = 0;
+  uint32_t size = 0;
 };
 
 class UndefinedData : public DataSymbol {
 public:
-  UndefinedData(StringRef Name, uint32_t Flags, InputFile *File = nullptr)
-      : DataSymbol(Name, UndefinedDataKind, Flags, File) {}
-  static bool classof(const Symbol *S) {
-    return S->kind() == UndefinedDataKind;
+  UndefinedData(StringRef name, uint32_t flags, InputFile *file = nullptr)
+      : DataSymbol(name, UndefinedDataKind, flags, file) {}
+  static bool classof(const Symbol *s) {
+    return s->kind() == UndefinedDataKind;
   }
 };
 
 class GlobalSymbol : public Symbol {
 public:
-  static bool classof(const Symbol *S) {
-    return S->kind() == DefinedGlobalKind || S->kind() == UndefinedGlobalKind;
+  static bool classof(const Symbol *s) {
+    return s->kind() == DefinedGlobalKind || s->kind() == UndefinedGlobalKind;
   }
 
-  const WasmGlobalType *getGlobalType() const { return GlobalType; }
+  const WasmGlobalType *getGlobalType() const { return globalType; }
 
   // Get/set the global index
   uint32_t getGlobalIndex() const;
-  void setGlobalIndex(uint32_t Index);
+  void setGlobalIndex(uint32_t index);
   bool hasGlobalIndex() const;
 
 protected:
-  GlobalSymbol(StringRef Name, Kind K, uint32_t Flags, InputFile *F,
-               const WasmGlobalType *GlobalType)
-      : Symbol(Name, K, Flags, F), GlobalType(GlobalType) {}
+  GlobalSymbol(StringRef name, Kind k, uint32_t flags, InputFile *f,
+               const WasmGlobalType *globalType)
+      : Symbol(name, k, flags, f), globalType(globalType) {}
 
-  const WasmGlobalType *GlobalType;
-  uint32_t GlobalIndex = INVALID_INDEX;
+  const WasmGlobalType *globalType;
+  uint32_t globalIndex = INVALID_INDEX;
 };
 
 class DefinedGlobal : public GlobalSymbol {
 public:
-  DefinedGlobal(StringRef Name, uint32_t Flags, InputFile *File,
-                InputGlobal *Global);
+  DefinedGlobal(StringRef name, uint32_t flags, InputFile *file,
+                InputGlobal *global);
 
-  static bool classof(const Symbol *S) {
-    return S->kind() == DefinedGlobalKind;
+  static bool classof(const Symbol *s) {
+    return s->kind() == DefinedGlobalKind;
   }
 
-  InputGlobal *Global;
+  InputGlobal *global;
 };
 
 class UndefinedGlobal : public GlobalSymbol {
 public:
-  UndefinedGlobal(StringRef Name, StringRef ImportName, StringRef ImportModule,
-                  uint32_t Flags, InputFile *File = nullptr,
-                  const WasmGlobalType *Type = nullptr)
-      : GlobalSymbol(Name, UndefinedGlobalKind, Flags, File, Type),
-        ImportName(ImportName), ImportModule(ImportModule) {}
+  UndefinedGlobal(StringRef name, StringRef importName, StringRef importModule,
+                  uint32_t flags, InputFile *file = nullptr,
+                  const WasmGlobalType *type = nullptr)
+      : GlobalSymbol(name, UndefinedGlobalKind, flags, file, type),
+        importName(importName), importModule(importModule) {}
 
-  static bool classof(const Symbol *S) {
-    return S->kind() == UndefinedGlobalKind;
+  static bool classof(const Symbol *s) {
+    return s->kind() == UndefinedGlobalKind;
   }
 
-  StringRef ImportName;
-  StringRef ImportModule;
+  StringRef importName;
+  StringRef importModule;
 };
 
 // Wasm events are features that suspend the current execution and transfer the
@@ -356,34 +356,34 @@ public:
 // are used, and has name '__cpp_exception' for linking.
 class EventSymbol : public Symbol {
 public:
-  static bool classof(const Symbol *S) { return S->kind() == DefinedEventKind; }
+  static bool classof(const Symbol *s) { return s->kind() == DefinedEventKind; }
 
-  const WasmEventType *getEventType() const { return EventType; }
+  const WasmEventType *getEventType() const { return eventType; }
 
   // Get/set the event index
   uint32_t getEventIndex() const;
-  void setEventIndex(uint32_t Index);
+  void setEventIndex(uint32_t index);
   bool hasEventIndex() const;
 
-  const WasmSignature *Signature;
+  const WasmSignature *signature;
 
 protected:
-  EventSymbol(StringRef Name, Kind K, uint32_t Flags, InputFile *F,
-              const WasmEventType *EventType, const WasmSignature *Sig)
-      : Symbol(Name, K, Flags, F), Signature(Sig), EventType(EventType) {}
+  EventSymbol(StringRef name, Kind k, uint32_t flags, InputFile *f,
+              const WasmEventType *eventType, const WasmSignature *sig)
+      : Symbol(name, k, flags, f), signature(sig), eventType(eventType) {}
 
-  const WasmEventType *EventType;
-  uint32_t EventIndex = INVALID_INDEX;
+  const WasmEventType *eventType;
+  uint32_t eventIndex = INVALID_INDEX;
 };
 
 class DefinedEvent : public EventSymbol {
 public:
-  DefinedEvent(StringRef Name, uint32_t Flags, InputFile *File,
-               InputEvent *Event);
+  DefinedEvent(StringRef name, uint32_t flags, InputFile *file,
+               InputEvent *event);
 
-  static bool classof(const Symbol *S) { return S->kind() == DefinedEventKind; }
+  static bool classof(const Symbol *s) { return s->kind() == DefinedEventKind; }
 
-  InputEvent *Event;
+  InputEvent *event;
 };
 
 // LazySymbol represents a symbol that is not yet in the link, but we know where
@@ -397,11 +397,11 @@ public:
 // symbols into consideration.
 class LazySymbol : public Symbol {
 public:
-  LazySymbol(StringRef Name, uint32_t Flags, InputFile *File,
-             const llvm::object::Archive::Symbol &Sym)
-      : Symbol(Name, LazyKind, Flags, File), ArchiveSymbol(Sym) {}
+  LazySymbol(StringRef name, uint32_t flags, InputFile *file,
+             const llvm::object::Archive::Symbol &sym)
+      : Symbol(name, LazyKind, flags, file), archiveSymbol(sym) {}
 
-  static bool classof(const Symbol *S) { return S->kind() == LazyKind; }
+  static bool classof(const Symbol *s) { return s->kind() == LazyKind; }
   void fetch();
 
   // Lazy symbols can have a signature because they can replace an
@@ -409,71 +409,71 @@ public:
   // signture.
   // TODO(sbc): This repetition of the signature field is inelegant.  Revisit
   // the use of class hierarchy to represent symbol taxonomy.
-  const WasmSignature *Signature = nullptr;
+  const WasmSignature *signature = nullptr;
 
 private:
-  llvm::object::Archive::Symbol ArchiveSymbol;
+  llvm::object::Archive::Symbol archiveSymbol;
 };
 
 // linker-generated symbols
 struct WasmSym {
   // __global_base
   // Symbol marking the start of the global section.
-  static DefinedData *GlobalBase;
+  static DefinedData *globalBase;
 
   // __stack_pointer
   // Global that holds the address of the top of the explicit value stack in
   // linear memory.
-  static GlobalSymbol *StackPointer;
+  static GlobalSymbol *stackPointer;
 
   // __data_end
   // Symbol marking the end of the data and bss.
-  static DefinedData *DataEnd;
+  static DefinedData *dataEnd;
 
   // __heap_base
   // Symbol marking the end of the data, bss and explicit stack.  Any linear
   // memory following this address is not used by the linked code and can
   // therefore be used as a backing store for brk()/malloc() implementations.
-  static DefinedData *HeapBase;
+  static DefinedData *heapBase;
 
   // __wasm_call_ctors
   // Function that directly calls all ctors in priority order.
-  static DefinedFunction *CallCtors;
+  static DefinedFunction *callCtors;
 
   // __wasm_init_memory
   // Function that initializes passive data segments post-instantiation.
-  static DefinedFunction *InitMemory;
+  static DefinedFunction *initMemory;
 
   // __wasm_apply_relocs
   // Function that applies relocations to data segment post-instantiation.
-  static DefinedFunction *ApplyRelocs;
+  static DefinedFunction *applyRelocs;
 
   // __dso_handle
   // Symbol used in calls to __cxa_atexit to determine current DLL
-  static DefinedData *DsoHandle;
+  static DefinedData *dsoHandle;
 
   // __table_base
   // Used in PIC code for offset of indirect function table
-  static UndefinedGlobal *TableBase;
+  static UndefinedGlobal *tableBase;
 
   // __memory_base
   // Used in PIC code for offset of global data
-  static UndefinedGlobal *MemoryBase;
+  static UndefinedGlobal *memoryBase;
 };
 
 // A buffer class that is large enough to hold any Symbol-derived
 // object. We allocate memory using this class and instantiate a symbol
 // using the placement new.
 union SymbolUnion {
-  alignas(DefinedFunction) char A[sizeof(DefinedFunction)];
-  alignas(DefinedData) char B[sizeof(DefinedData)];
-  alignas(DefinedGlobal) char C[sizeof(DefinedGlobal)];
-  alignas(DefinedEvent) char D[sizeof(DefinedEvent)];
-  alignas(LazySymbol) char E[sizeof(LazySymbol)];
-  alignas(UndefinedFunction) char F[sizeof(UndefinedFunction)];
-  alignas(UndefinedData) char G[sizeof(UndefinedData)];
-  alignas(UndefinedGlobal) char H[sizeof(UndefinedGlobal)];
-  alignas(SectionSymbol) char I[sizeof(SectionSymbol)];
+  alignas(DefinedFunction) char a[sizeof(DefinedFunction)];
+  alignas(DefinedData) char b[sizeof(DefinedData)];
+  alignas(DefinedGlobal) char c[sizeof(DefinedGlobal)];
+  alignas(DefinedEvent) char d[sizeof(DefinedEvent)];
+  alignas(LazySymbol) char e[sizeof(LazySymbol)];
+  alignas(UndefinedFunction) char f[sizeof(UndefinedFunction)];
+  alignas(UndefinedData) char g[sizeof(UndefinedData)];
+  alignas(UndefinedGlobal) char h[sizeof(UndefinedGlobal)];
+  alignas(SectionSymbol) char i[sizeof(SectionSymbol)];
 };
 
 // It is important to keep the size of SymbolUnion small for performance and
@@ -481,11 +481,11 @@ union SymbolUnion {
 // UndefinedFunction on a 64-bit system.
 static_assert(sizeof(SymbolUnion) <= 96, "SymbolUnion too large");
 
-void printTraceSymbol(Symbol *Sym);
-void printTraceSymbolUndefined(StringRef Name, const InputFile* File);
+void printTraceSymbol(Symbol *sym);
+void printTraceSymbolUndefined(StringRef name, const InputFile* file);
 
 template <typename T, typename... ArgT>
-T *replaceSymbol(Symbol *S, ArgT &&... Arg) {
+T *replaceSymbol(Symbol *s, ArgT &&... arg) {
   static_assert(std::is_trivially_destructible<T>(),
                 "Symbol types must be trivially destructible");
   static_assert(sizeof(T) <= sizeof(SymbolUnion), "SymbolUnion too small");
@@ -494,28 +494,28 @@ T *replaceSymbol(Symbol *S, ArgT &&... A
   assert(static_cast<Symbol *>(static_cast<T *>(nullptr)) == nullptr &&
          "Not a Symbol");
 
-  Symbol SymCopy = *S;
+  Symbol symCopy = *s;
 
-  T *S2 = new (S) T(std::forward<ArgT>(Arg)...);
-  S2->IsUsedInRegularObj = SymCopy.IsUsedInRegularObj;
-  S2->ForceExport = SymCopy.ForceExport;
-  S2->CanInline = SymCopy.CanInline;
-  S2->Traced = SymCopy.Traced;
+  T *s2 = new (s) T(std::forward<ArgT>(arg)...);
+  s2->isUsedInRegularObj = symCopy.isUsedInRegularObj;
+  s2->forceExport = symCopy.forceExport;
+  s2->canInline = symCopy.canInline;
+  s2->traced = symCopy.traced;
 
   // Print out a log message if --trace-symbol was specified.
   // This is for debugging.
-  if (S2->Traced)
-    printTraceSymbol(S2);
+  if (s2->traced)
+    printTraceSymbol(s2);
 
-  return S2;
+  return s2;
 }
 
 } // namespace wasm
 
 // Returns a symbol name for an error message.
-std::string toString(const wasm::Symbol &Sym);
-std::string toString(wasm::Symbol::Kind Kind);
-std::string maybeDemangleSymbol(StringRef Name);
+std::string toString(const wasm::Symbol &sym);
+std::string toString(wasm::Symbol::Kind kind);
+std::string maybeDemangleSymbol(StringRef name);
 
 } // namespace lld
 

Modified: lld/trunk/wasm/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/SyntheticSections.cpp?rev=365730&r1=365729&r2=365730&view=diff
==============================================================================
--- lld/trunk/wasm/SyntheticSections.cpp (original)
+++ lld/trunk/wasm/SyntheticSections.cpp Wed Jul 10 22:40:30 2019
@@ -25,7 +25,7 @@ using namespace llvm::wasm;
 using namespace lld;
 using namespace lld::wasm;
 
-OutStruct lld::wasm::Out;
+OutStruct lld::wasm::out;
 
 namespace {
 
@@ -36,512 +36,512 @@ namespace {
 // of the parent section.
 class SubSection {
 public:
-  explicit SubSection(uint32_t Type) : Type(Type) {}
+  explicit SubSection(uint32_t type) : type(type) {}
 
-  void writeTo(raw_ostream &To) {
-    OS.flush();
-    writeUleb128(To, Type, "subsection type");
-    writeUleb128(To, Body.size(), "subsection size");
-    To.write(Body.data(), Body.size());
+  void writeTo(raw_ostream &to) {
+    os.flush();
+    writeUleb128(to, type, "subsection type");
+    writeUleb128(to, body.size(), "subsection size");
+    to.write(body.data(), body.size());
   }
 
 private:
-  uint32_t Type;
-  std::string Body;
+  uint32_t type;
+  std::string body;
 
 public:
-  raw_string_ostream OS{Body};
+  raw_string_ostream os{body};
 };
 
 } // namespace
 
 void DylinkSection::writeBody() {
-  raw_ostream &OS = BodyOutputStream;
+  raw_ostream &os = bodyOutputStream;
 
-  writeUleb128(OS, MemSize, "MemSize");
-  writeUleb128(OS, MemAlign, "MemAlign");
-  writeUleb128(OS, Out.ElemSec->numEntries(), "TableSize");
-  writeUleb128(OS, 0, "TableAlign");
-  writeUleb128(OS, Symtab->SharedFiles.size(), "Needed");
-  for (auto *SO : Symtab->SharedFiles)
-    writeStr(OS, llvm::sys::path::filename(SO->getName()), "so name");
-}
-
-uint32_t TypeSection::registerType(const WasmSignature &Sig) {
-  auto Pair = TypeIndices.insert(std::make_pair(Sig, Types.size()));
-  if (Pair.second) {
-    LLVM_DEBUG(llvm::dbgs() << "type " << toString(Sig) << "\n");
-    Types.push_back(&Sig);
-  }
-  return Pair.first->second;
-}
-
-uint32_t TypeSection::lookupType(const WasmSignature &Sig) {
-  auto It = TypeIndices.find(Sig);
-  if (It == TypeIndices.end()) {
-    error("type not found: " + toString(Sig));
+  writeUleb128(os, memSize, "MemSize");
+  writeUleb128(os, memAlign, "MemAlign");
+  writeUleb128(os, out.elemSec->numEntries(), "TableSize");
+  writeUleb128(os, 0, "TableAlign");
+  writeUleb128(os, symtab->sharedFiles.size(), "Needed");
+  for (auto *so : symtab->sharedFiles)
+    writeStr(os, llvm::sys::path::filename(so->getName()), "so name");
+}
+
+uint32_t TypeSection::registerType(const WasmSignature &sig) {
+  auto pair = typeIndices.insert(std::make_pair(sig, types.size()));
+  if (pair.second) {
+    LLVM_DEBUG(llvm::dbgs() << "type " << toString(sig) << "\n");
+    types.push_back(&sig);
+  }
+  return pair.first->second;
+}
+
+uint32_t TypeSection::lookupType(const WasmSignature &sig) {
+  auto it = typeIndices.find(sig);
+  if (it == typeIndices.end()) {
+    error("type not found: " + toString(sig));
     return 0;
   }
-  return It->second;
+  return it->second;
 }
 
 void TypeSection::writeBody() {
-  writeUleb128(BodyOutputStream, Types.size(), "type count");
-  for (const WasmSignature *Sig : Types)
-    writeSig(BodyOutputStream, *Sig);
+  writeUleb128(bodyOutputStream, types.size(), "type count");
+  for (const WasmSignature *sig : types)
+    writeSig(bodyOutputStream, *sig);
 }
 
 uint32_t ImportSection::getNumImports() const {
-  assert(IsSealed);
-  uint32_t NumImports = ImportedSymbols.size() + GOTSymbols.size();
-  if (Config->ImportMemory)
-    ++NumImports;
-  if (Config->ImportTable)
-    ++NumImports;
-  return NumImports;
+  assert(isSealed);
+  uint32_t numImports = importedSymbols.size() + gotSymbols.size();
+  if (config->importMemory)
+    ++numImports;
+  if (config->importTable)
+    ++numImports;
+  return numImports;
 }
 
-void ImportSection::addGOTEntry(Symbol *Sym) {
-  assert(!IsSealed);
-  if (Sym->hasGOTIndex())
+void ImportSection::addGOTEntry(Symbol *sym) {
+  assert(!isSealed);
+  if (sym->hasGOTIndex())
     return;
-  Sym->setGOTIndex(NumImportedGlobals++);
-  GOTSymbols.push_back(Sym);
+  sym->setGOTIndex(numImportedGlobals++);
+  gotSymbols.push_back(sym);
 }
 
-void ImportSection::addImport(Symbol *Sym) {
-  assert(!IsSealed);
-  ImportedSymbols.emplace_back(Sym);
-  if (auto *F = dyn_cast<FunctionSymbol>(Sym))
-    F->setFunctionIndex(NumImportedFunctions++);
-  else if (auto *G = dyn_cast<GlobalSymbol>(Sym))
-    G->setGlobalIndex(NumImportedGlobals++);
+void ImportSection::addImport(Symbol *sym) {
+  assert(!isSealed);
+  importedSymbols.emplace_back(sym);
+  if (auto *f = dyn_cast<FunctionSymbol>(sym))
+    f->setFunctionIndex(numImportedFunctions++);
+  else if (auto *g = dyn_cast<GlobalSymbol>(sym))
+    g->setGlobalIndex(numImportedGlobals++);
   else
-    cast<EventSymbol>(Sym)->setEventIndex(NumImportedEvents++);
+    cast<EventSymbol>(sym)->setEventIndex(numImportedEvents++);
 }
 
 void ImportSection::writeBody() {
-  raw_ostream &OS = BodyOutputStream;
+  raw_ostream &os = bodyOutputStream;
 
-  writeUleb128(OS, getNumImports(), "import count");
+  writeUleb128(os, getNumImports(), "import count");
 
-  if (Config->ImportMemory) {
-    WasmImport Import;
-    Import.Module = DefaultModule;
-    Import.Field = "memory";
-    Import.Kind = WASM_EXTERNAL_MEMORY;
-    Import.Memory.Flags = 0;
-    Import.Memory.Initial = Out.MemorySec->NumMemoryPages;
-    if (Out.MemorySec->MaxMemoryPages != 0 || Config->SharedMemory) {
-      Import.Memory.Flags |= WASM_LIMITS_FLAG_HAS_MAX;
-      Import.Memory.Maximum = Out.MemorySec->MaxMemoryPages;
+  if (config->importMemory) {
+    WasmImport import;
+    import.Module = defaultModule;
+    import.Field = "memory";
+    import.Kind = WASM_EXTERNAL_MEMORY;
+    import.Memory.Flags = 0;
+    import.Memory.Initial = out.memorySec->numMemoryPages;
+    if (out.memorySec->maxMemoryPages != 0 || config->sharedMemory) {
+      import.Memory.Flags |= WASM_LIMITS_FLAG_HAS_MAX;
+      import.Memory.Maximum = out.memorySec->maxMemoryPages;
     }
-    if (Config->SharedMemory)
-      Import.Memory.Flags |= WASM_LIMITS_FLAG_IS_SHARED;
-    writeImport(OS, Import);
-  }
-
-  if (Config->ImportTable) {
-    uint32_t TableSize = Out.ElemSec->ElemOffset + Out.ElemSec->numEntries();
-    WasmImport Import;
-    Import.Module = DefaultModule;
-    Import.Field = FunctionTableName;
-    Import.Kind = WASM_EXTERNAL_TABLE;
-    Import.Table.ElemType = WASM_TYPE_FUNCREF;
-    Import.Table.Limits = {0, TableSize, 0};
-    writeImport(OS, Import);
-  }
-
-  for (const Symbol *Sym : ImportedSymbols) {
-    WasmImport Import;
-    if (auto *F = dyn_cast<UndefinedFunction>(Sym)) {
-      Import.Field = F->ImportName;
-      Import.Module = F->ImportModule;
-    } else if (auto *G = dyn_cast<UndefinedGlobal>(Sym)) {
-      Import.Field = G->ImportName;
-      Import.Module = G->ImportModule;
+    if (config->sharedMemory)
+      import.Memory.Flags |= WASM_LIMITS_FLAG_IS_SHARED;
+    writeImport(os, import);
+  }
+
+  if (config->importTable) {
+    uint32_t tableSize = out.elemSec->elemOffset + out.elemSec->numEntries();
+    WasmImport import;
+    import.Module = defaultModule;
+    import.Field = functionTableName;
+    import.Kind = WASM_EXTERNAL_TABLE;
+    import.Table.ElemType = WASM_TYPE_FUNCREF;
+    import.Table.Limits = {0, tableSize, 0};
+    writeImport(os, import);
+  }
+
+  for (const Symbol *sym : importedSymbols) {
+    WasmImport import;
+    if (auto *f = dyn_cast<UndefinedFunction>(sym)) {
+      import.Field = f->importName;
+      import.Module = f->importModule;
+    } else if (auto *g = dyn_cast<UndefinedGlobal>(sym)) {
+      import.Field = g->importName;
+      import.Module = g->importModule;
     } else {
-      Import.Field = Sym->getName();
-      Import.Module = DefaultModule;
+      import.Field = sym->getName();
+      import.Module = defaultModule;
     }
 
-    if (auto *FunctionSym = dyn_cast<FunctionSymbol>(Sym)) {
-      Import.Kind = WASM_EXTERNAL_FUNCTION;
-      Import.SigIndex = Out.TypeSec->lookupType(*FunctionSym->Signature);
-    } else if (auto *GlobalSym = dyn_cast<GlobalSymbol>(Sym)) {
-      Import.Kind = WASM_EXTERNAL_GLOBAL;
-      Import.Global = *GlobalSym->getGlobalType();
+    if (auto *functionSym = dyn_cast<FunctionSymbol>(sym)) {
+      import.Kind = WASM_EXTERNAL_FUNCTION;
+      import.SigIndex = out.typeSec->lookupType(*functionSym->signature);
+    } else if (auto *globalSym = dyn_cast<GlobalSymbol>(sym)) {
+      import.Kind = WASM_EXTERNAL_GLOBAL;
+      import.Global = *globalSym->getGlobalType();
     } else {
-      auto *EventSym = cast<EventSymbol>(Sym);
-      Import.Kind = WASM_EXTERNAL_EVENT;
-      Import.Event.Attribute = EventSym->getEventType()->Attribute;
-      Import.Event.SigIndex = Out.TypeSec->lookupType(*EventSym->Signature);
+      auto *eventSym = cast<EventSymbol>(sym);
+      import.Kind = WASM_EXTERNAL_EVENT;
+      import.Event.Attribute = eventSym->getEventType()->Attribute;
+      import.Event.SigIndex = out.typeSec->lookupType(*eventSym->signature);
     }
-    writeImport(OS, Import);
+    writeImport(os, import);
   }
 
-  for (const Symbol *Sym : GOTSymbols) {
-    WasmImport Import;
-    Import.Kind = WASM_EXTERNAL_GLOBAL;
-    Import.Global = {WASM_TYPE_I32, true};
-    if (isa<DataSymbol>(Sym))
-      Import.Module = "GOT.mem";
+  for (const Symbol *sym : gotSymbols) {
+    WasmImport import;
+    import.Kind = WASM_EXTERNAL_GLOBAL;
+    import.Global = {WASM_TYPE_I32, true};
+    if (isa<DataSymbol>(sym))
+      import.Module = "GOT.mem";
     else
-      Import.Module = "GOT.func";
-    Import.Field = Sym->getName();
-    writeImport(OS, Import);
+      import.Module = "GOT.func";
+    import.Field = sym->getName();
+    writeImport(os, import);
   }
 }
 
 void FunctionSection::writeBody() {
-  raw_ostream &OS = BodyOutputStream;
+  raw_ostream &os = bodyOutputStream;
 
-  writeUleb128(OS, InputFunctions.size(), "function count");
-  for (const InputFunction *Func : InputFunctions)
-    writeUleb128(OS, Out.TypeSec->lookupType(Func->Signature), "sig index");
+  writeUleb128(os, inputFunctions.size(), "function count");
+  for (const InputFunction *func : inputFunctions)
+    writeUleb128(os, out.typeSec->lookupType(func->signature), "sig index");
 }
 
-void FunctionSection::addFunction(InputFunction *Func) {
-  if (!Func->Live)
+void FunctionSection::addFunction(InputFunction *func) {
+  if (!func->live)
     return;
-  uint32_t FunctionIndex =
-      Out.ImportSec->getNumImportedFunctions() + InputFunctions.size();
-  InputFunctions.emplace_back(Func);
-  Func->setFunctionIndex(FunctionIndex);
+  uint32_t functionIndex =
+      out.importSec->getNumImportedFunctions() + inputFunctions.size();
+  inputFunctions.emplace_back(func);
+  func->setFunctionIndex(functionIndex);
 }
 
 void TableSection::writeBody() {
-  uint32_t TableSize = Out.ElemSec->ElemOffset + Out.ElemSec->numEntries();
+  uint32_t tableSize = out.elemSec->elemOffset + out.elemSec->numEntries();
 
-  raw_ostream &OS = BodyOutputStream;
-  writeUleb128(OS, 1, "table count");
-  WasmLimits Limits = {WASM_LIMITS_FLAG_HAS_MAX, TableSize, TableSize};
-  writeTableType(OS, WasmTable{WASM_TYPE_FUNCREF, Limits});
+  raw_ostream &os = bodyOutputStream;
+  writeUleb128(os, 1, "table count");
+  WasmLimits limits = {WASM_LIMITS_FLAG_HAS_MAX, tableSize, tableSize};
+  writeTableType(os, WasmTable{WASM_TYPE_FUNCREF, limits});
 }
 
 void MemorySection::writeBody() {
-  raw_ostream &OS = BodyOutputStream;
+  raw_ostream &os = bodyOutputStream;
 
-  bool HasMax = MaxMemoryPages != 0 || Config->SharedMemory;
-  writeUleb128(OS, 1, "memory count");
-  unsigned Flags = 0;
-  if (HasMax)
-    Flags |= WASM_LIMITS_FLAG_HAS_MAX;
-  if (Config->SharedMemory)
-    Flags |= WASM_LIMITS_FLAG_IS_SHARED;
-  writeUleb128(OS, Flags, "memory limits flags");
-  writeUleb128(OS, NumMemoryPages, "initial pages");
-  if (HasMax)
-    writeUleb128(OS, MaxMemoryPages, "max pages");
+  bool hasMax = maxMemoryPages != 0 || config->sharedMemory;
+  writeUleb128(os, 1, "memory count");
+  unsigned flags = 0;
+  if (hasMax)
+    flags |= WASM_LIMITS_FLAG_HAS_MAX;
+  if (config->sharedMemory)
+    flags |= WASM_LIMITS_FLAG_IS_SHARED;
+  writeUleb128(os, flags, "memory limits flags");
+  writeUleb128(os, numMemoryPages, "initial pages");
+  if (hasMax)
+    writeUleb128(os, maxMemoryPages, "max pages");
 }
 
 void GlobalSection::writeBody() {
-  raw_ostream &OS = BodyOutputStream;
+  raw_ostream &os = bodyOutputStream;
 
-  writeUleb128(OS, numGlobals(), "global count");
-  for (const InputGlobal *G : InputGlobals)
-    writeGlobal(OS, G->Global);
-  for (const DefinedData *Sym : DefinedFakeGlobals) {
-    WasmGlobal Global;
-    Global.Type = {WASM_TYPE_I32, false};
-    Global.InitExpr.Opcode = WASM_OPCODE_I32_CONST;
-    Global.InitExpr.Value.Int32 = Sym->getVirtualAddress();
-    writeGlobal(OS, Global);
+  writeUleb128(os, numGlobals(), "global count");
+  for (const InputGlobal *g : inputGlobals)
+    writeGlobal(os, g->global);
+  for (const DefinedData *sym : definedFakeGlobals) {
+    WasmGlobal global;
+    global.Type = {WASM_TYPE_I32, false};
+    global.InitExpr.Opcode = WASM_OPCODE_I32_CONST;
+    global.InitExpr.Value.Int32 = sym->getVirtualAddress();
+    writeGlobal(os, global);
   }
 }
 
-void GlobalSection::addGlobal(InputGlobal *Global) {
-  if (!Global->Live)
+void GlobalSection::addGlobal(InputGlobal *global) {
+  if (!global->live)
     return;
-  uint32_t GlobalIndex =
-      Out.ImportSec->getNumImportedGlobals() + InputGlobals.size();
-  LLVM_DEBUG(dbgs() << "addGlobal: " << GlobalIndex << "\n");
-  Global->setGlobalIndex(GlobalIndex);
-  Out.GlobalSec->InputGlobals.push_back(Global);
+  uint32_t globalIndex =
+      out.importSec->getNumImportedGlobals() + inputGlobals.size();
+  LLVM_DEBUG(dbgs() << "addGlobal: " << globalIndex << "\n");
+  global->setGlobalIndex(globalIndex);
+  out.globalSec->inputGlobals.push_back(global);
 }
 
 void EventSection::writeBody() {
-  raw_ostream &OS = BodyOutputStream;
+  raw_ostream &os = bodyOutputStream;
 
-  writeUleb128(OS, InputEvents.size(), "event count");
-  for (InputEvent *E : InputEvents) {
-    E->Event.Type.SigIndex = Out.TypeSec->lookupType(E->Signature);
-    writeEvent(OS, E->Event);
+  writeUleb128(os, inputEvents.size(), "event count");
+  for (InputEvent *e : inputEvents) {
+    e->event.Type.SigIndex = out.typeSec->lookupType(e->signature);
+    writeEvent(os, e->event);
   }
 }
 
-void EventSection::addEvent(InputEvent *Event) {
-  if (!Event->Live)
+void EventSection::addEvent(InputEvent *event) {
+  if (!event->live)
     return;
-  uint32_t EventIndex =
-      Out.ImportSec->getNumImportedEvents() + InputEvents.size();
-  LLVM_DEBUG(dbgs() << "addEvent: " << EventIndex << "\n");
-  Event->setEventIndex(EventIndex);
-  InputEvents.push_back(Event);
+  uint32_t eventIndex =
+      out.importSec->getNumImportedEvents() + inputEvents.size();
+  LLVM_DEBUG(dbgs() << "addEvent: " << eventIndex << "\n");
+  event->setEventIndex(eventIndex);
+  inputEvents.push_back(event);
 }
 
 void ExportSection::writeBody() {
-  raw_ostream &OS = BodyOutputStream;
+  raw_ostream &os = bodyOutputStream;
 
-  writeUleb128(OS, Exports.size(), "export count");
-  for (const WasmExport &Export : Exports)
-    writeExport(OS, Export);
+  writeUleb128(os, exports.size(), "export count");
+  for (const WasmExport &export_ : exports)
+    writeExport(os, export_);
 }
 
-void ElemSection::addEntry(FunctionSymbol *Sym) {
-  if (Sym->hasTableIndex())
+void ElemSection::addEntry(FunctionSymbol *sym) {
+  if (sym->hasTableIndex())
     return;
-  Sym->setTableIndex(ElemOffset + IndirectFunctions.size());
-  IndirectFunctions.emplace_back(Sym);
+  sym->setTableIndex(elemOffset + indirectFunctions.size());
+  indirectFunctions.emplace_back(sym);
 }
 
 void ElemSection::writeBody() {
-  raw_ostream &OS = BodyOutputStream;
+  raw_ostream &os = bodyOutputStream;
 
-  writeUleb128(OS, 1, "segment count");
-  writeUleb128(OS, 0, "table index");
-  WasmInitExpr InitExpr;
-  if (Config->Pic) {
-    InitExpr.Opcode = WASM_OPCODE_GLOBAL_GET;
-    InitExpr.Value.Global = WasmSym::TableBase->getGlobalIndex();
+  writeUleb128(os, 1, "segment count");
+  writeUleb128(os, 0, "table index");
+  WasmInitExpr initExpr;
+  if (config->isPic) {
+    initExpr.Opcode = WASM_OPCODE_GLOBAL_GET;
+    initExpr.Value.Global = WasmSym::tableBase->getGlobalIndex();
   } else {
-    InitExpr.Opcode = WASM_OPCODE_I32_CONST;
-    InitExpr.Value.Int32 = ElemOffset;
+    initExpr.Opcode = WASM_OPCODE_I32_CONST;
+    initExpr.Value.Int32 = elemOffset;
   }
-  writeInitExpr(OS, InitExpr);
-  writeUleb128(OS, IndirectFunctions.size(), "elem count");
+  writeInitExpr(os, initExpr);
+  writeUleb128(os, indirectFunctions.size(), "elem count");
 
-  uint32_t TableIndex = ElemOffset;
-  for (const FunctionSymbol *Sym : IndirectFunctions) {
-    assert(Sym->getTableIndex() == TableIndex);
-    writeUleb128(OS, Sym->getFunctionIndex(), "function index");
-    ++TableIndex;
+  uint32_t tableIndex = elemOffset;
+  for (const FunctionSymbol *sym : indirectFunctions) {
+    assert(sym->getTableIndex() == tableIndex);
+    writeUleb128(os, sym->getFunctionIndex(), "function index");
+    ++tableIndex;
   }
 }
 
 void DataCountSection::writeBody() {
-  writeUleb128(BodyOutputStream, NumSegments, "data count");
+  writeUleb128(bodyOutputStream, numSegments, "data count");
 }
 
 bool DataCountSection::isNeeded() const {
-  return NumSegments && Config->PassiveSegments;
+  return numSegments && config->passiveSegments;
 }
 
-static uint32_t getWasmFlags(const Symbol *Sym) {
-  uint32_t Flags = 0;
-  if (Sym->isLocal())
-    Flags |= WASM_SYMBOL_BINDING_LOCAL;
-  if (Sym->isWeak())
-    Flags |= WASM_SYMBOL_BINDING_WEAK;
-  if (Sym->isHidden())
-    Flags |= WASM_SYMBOL_VISIBILITY_HIDDEN;
-  if (Sym->isUndefined())
-    Flags |= WASM_SYMBOL_UNDEFINED;
-  if (auto *F = dyn_cast<UndefinedFunction>(Sym)) {
-    if (F->getName() != F->ImportName)
-      Flags |= WASM_SYMBOL_EXPLICIT_NAME;
-  } else if (auto *G = dyn_cast<UndefinedGlobal>(Sym)) {
-    if (G->getName() != G->ImportName)
-      Flags |= WASM_SYMBOL_EXPLICIT_NAME;
+static uint32_t getWasmFlags(const Symbol *sym) {
+  uint32_t flags = 0;
+  if (sym->isLocal())
+    flags |= WASM_SYMBOL_BINDING_LOCAL;
+  if (sym->isWeak())
+    flags |= WASM_SYMBOL_BINDING_WEAK;
+  if (sym->isHidden())
+    flags |= WASM_SYMBOL_VISIBILITY_HIDDEN;
+  if (sym->isUndefined())
+    flags |= WASM_SYMBOL_UNDEFINED;
+  if (auto *f = dyn_cast<UndefinedFunction>(sym)) {
+    if (f->getName() != f->importName)
+      flags |= WASM_SYMBOL_EXPLICIT_NAME;
+  } else if (auto *g = dyn_cast<UndefinedGlobal>(sym)) {
+    if (g->getName() != g->importName)
+      flags |= WASM_SYMBOL_EXPLICIT_NAME;
   }
-  return Flags;
+  return flags;
 }
 
 void LinkingSection::writeBody() {
-  raw_ostream &OS = BodyOutputStream;
+  raw_ostream &os = bodyOutputStream;
 
-  writeUleb128(OS, WasmMetadataVersion, "Version");
+  writeUleb128(os, WasmMetadataVersion, "Version");
 
-  if (!SymtabEntries.empty()) {
-    SubSection Sub(WASM_SYMBOL_TABLE);
-    writeUleb128(Sub.OS, SymtabEntries.size(), "num symbols");
-
-    for (const Symbol *Sym : SymtabEntries) {
-      assert(Sym->isDefined() || Sym->isUndefined());
-      WasmSymbolType Kind = Sym->getWasmType();
-      uint32_t Flags = getWasmFlags(Sym);
-
-      writeU8(Sub.OS, Kind, "sym kind");
-      writeUleb128(Sub.OS, Flags, "sym flags");
-
-      if (auto *F = dyn_cast<FunctionSymbol>(Sym)) {
-        writeUleb128(Sub.OS, F->getFunctionIndex(), "index");
-        if (Sym->isDefined() || (Flags & WASM_SYMBOL_EXPLICIT_NAME) != 0)
-          writeStr(Sub.OS, Sym->getName(), "sym name");
-      } else if (auto *G = dyn_cast<GlobalSymbol>(Sym)) {
-        writeUleb128(Sub.OS, G->getGlobalIndex(), "index");
-        if (Sym->isDefined() || (Flags & WASM_SYMBOL_EXPLICIT_NAME) != 0)
-          writeStr(Sub.OS, Sym->getName(), "sym name");
-      } else if (auto *E = dyn_cast<EventSymbol>(Sym)) {
-        writeUleb128(Sub.OS, E->getEventIndex(), "index");
-        if (Sym->isDefined() || (Flags & WASM_SYMBOL_EXPLICIT_NAME) != 0)
-          writeStr(Sub.OS, Sym->getName(), "sym name");
-      } else if (isa<DataSymbol>(Sym)) {
-        writeStr(Sub.OS, Sym->getName(), "sym name");
-        if (auto *DataSym = dyn_cast<DefinedData>(Sym)) {
-          writeUleb128(Sub.OS, DataSym->getOutputSegmentIndex(), "index");
-          writeUleb128(Sub.OS, DataSym->getOutputSegmentOffset(),
+  if (!symtabEntries.empty()) {
+    SubSection sub(WASM_SYMBOL_TABLE);
+    writeUleb128(sub.os, symtabEntries.size(), "num symbols");
+
+    for (const Symbol *sym : symtabEntries) {
+      assert(sym->isDefined() || sym->isUndefined());
+      WasmSymbolType kind = sym->getWasmType();
+      uint32_t flags = getWasmFlags(sym);
+
+      writeU8(sub.os, kind, "sym kind");
+      writeUleb128(sub.os, flags, "sym flags");
+
+      if (auto *f = dyn_cast<FunctionSymbol>(sym)) {
+        writeUleb128(sub.os, f->getFunctionIndex(), "index");
+        if (sym->isDefined() || (flags & WASM_SYMBOL_EXPLICIT_NAME) != 0)
+          writeStr(sub.os, sym->getName(), "sym name");
+      } else if (auto *g = dyn_cast<GlobalSymbol>(sym)) {
+        writeUleb128(sub.os, g->getGlobalIndex(), "index");
+        if (sym->isDefined() || (flags & WASM_SYMBOL_EXPLICIT_NAME) != 0)
+          writeStr(sub.os, sym->getName(), "sym name");
+      } else if (auto *e = dyn_cast<EventSymbol>(sym)) {
+        writeUleb128(sub.os, e->getEventIndex(), "index");
+        if (sym->isDefined() || (flags & WASM_SYMBOL_EXPLICIT_NAME) != 0)
+          writeStr(sub.os, sym->getName(), "sym name");
+      } else if (isa<DataSymbol>(sym)) {
+        writeStr(sub.os, sym->getName(), "sym name");
+        if (auto *dataSym = dyn_cast<DefinedData>(sym)) {
+          writeUleb128(sub.os, dataSym->getOutputSegmentIndex(), "index");
+          writeUleb128(sub.os, dataSym->getOutputSegmentOffset(),
                        "data offset");
-          writeUleb128(Sub.OS, DataSym->getSize(), "data size");
+          writeUleb128(sub.os, dataSym->getSize(), "data size");
         }
       } else {
-        auto *S = cast<OutputSectionSymbol>(Sym);
-        writeUleb128(Sub.OS, S->Section->SectionIndex, "sym section index");
+        auto *s = cast<OutputSectionSymbol>(sym);
+        writeUleb128(sub.os, s->section->sectionIndex, "sym section index");
       }
     }
 
-    Sub.writeTo(OS);
+    sub.writeTo(os);
   }
 
-  if (DataSegments.size()) {
-    SubSection Sub(WASM_SEGMENT_INFO);
-    writeUleb128(Sub.OS, DataSegments.size(), "num data segments");
-    for (const OutputSegment *S : DataSegments) {
-      writeStr(Sub.OS, S->Name, "segment name");
-      writeUleb128(Sub.OS, S->Alignment, "alignment");
-      writeUleb128(Sub.OS, 0, "flags");
+  if (dataSegments.size()) {
+    SubSection sub(WASM_SEGMENT_INFO);
+    writeUleb128(sub.os, dataSegments.size(), "num data segments");
+    for (const OutputSegment *s : dataSegments) {
+      writeStr(sub.os, s->name, "segment name");
+      writeUleb128(sub.os, s->alignment, "alignment");
+      writeUleb128(sub.os, 0, "flags");
     }
-    Sub.writeTo(OS);
+    sub.writeTo(os);
   }
 
-  if (!InitFunctions.empty()) {
-    SubSection Sub(WASM_INIT_FUNCS);
-    writeUleb128(Sub.OS, InitFunctions.size(), "num init functions");
-    for (const WasmInitEntry &F : InitFunctions) {
-      writeUleb128(Sub.OS, F.Priority, "priority");
-      writeUleb128(Sub.OS, F.Sym->getOutputSymbolIndex(), "function index");
+  if (!initFunctions.empty()) {
+    SubSection sub(WASM_INIT_FUNCS);
+    writeUleb128(sub.os, initFunctions.size(), "num init functions");
+    for (const WasmInitEntry &f : initFunctions) {
+      writeUleb128(sub.os, f.priority, "priority");
+      writeUleb128(sub.os, f.sym->getOutputSymbolIndex(), "function index");
     }
-    Sub.writeTo(OS);
+    sub.writeTo(os);
   }
 
   struct ComdatEntry {
-    unsigned Kind;
-    uint32_t Index;
+    unsigned kind;
+    uint32_t index;
   };
-  std::map<StringRef, std::vector<ComdatEntry>> Comdats;
+  std::map<StringRef, std::vector<ComdatEntry>> comdats;
 
-  for (const InputFunction *F : Out.FunctionSec->InputFunctions) {
-    StringRef Comdat = F->getComdatName();
-    if (!Comdat.empty())
-      Comdats[Comdat].emplace_back(
-          ComdatEntry{WASM_COMDAT_FUNCTION, F->getFunctionIndex()});
-  }
-  for (uint32_t I = 0; I < DataSegments.size(); ++I) {
-    const auto &InputSegments = DataSegments[I]->InputSegments;
-    if (InputSegments.empty())
+  for (const InputFunction *f : out.functionSec->inputFunctions) {
+    StringRef comdat = f->getComdatName();
+    if (!comdat.empty())
+      comdats[comdat].emplace_back(
+          ComdatEntry{WASM_COMDAT_FUNCTION, f->getFunctionIndex()});
+  }
+  for (uint32_t i = 0; i < dataSegments.size(); ++i) {
+    const auto &inputSegments = dataSegments[i]->inputSegments;
+    if (inputSegments.empty())
       continue;
-    StringRef Comdat = InputSegments[0]->getComdatName();
+    StringRef comdat = inputSegments[0]->getComdatName();
 #ifndef NDEBUG
-    for (const InputSegment *IS : InputSegments)
-      assert(IS->getComdatName() == Comdat);
+    for (const InputSegment *isec : inputSegments)
+      assert(isec->getComdatName() == comdat);
 #endif
-    if (!Comdat.empty())
-      Comdats[Comdat].emplace_back(ComdatEntry{WASM_COMDAT_DATA, I});
+    if (!comdat.empty())
+      comdats[comdat].emplace_back(ComdatEntry{WASM_COMDAT_DATA, i});
   }
 
-  if (!Comdats.empty()) {
-    SubSection Sub(WASM_COMDAT_INFO);
-    writeUleb128(Sub.OS, Comdats.size(), "num comdats");
-    for (const auto &C : Comdats) {
-      writeStr(Sub.OS, C.first, "comdat name");
-      writeUleb128(Sub.OS, 0, "comdat flags"); // flags for future use
-      writeUleb128(Sub.OS, C.second.size(), "num entries");
-      for (const ComdatEntry &Entry : C.second) {
-        writeU8(Sub.OS, Entry.Kind, "entry kind");
-        writeUleb128(Sub.OS, Entry.Index, "entry index");
+  if (!comdats.empty()) {
+    SubSection sub(WASM_COMDAT_INFO);
+    writeUleb128(sub.os, comdats.size(), "num comdats");
+    for (const auto &c : comdats) {
+      writeStr(sub.os, c.first, "comdat name");
+      writeUleb128(sub.os, 0, "comdat flags"); // flags for future use
+      writeUleb128(sub.os, c.second.size(), "num entries");
+      for (const ComdatEntry &entry : c.second) {
+        writeU8(sub.os, entry.kind, "entry kind");
+        writeUleb128(sub.os, entry.index, "entry index");
       }
     }
-    Sub.writeTo(OS);
+    sub.writeTo(os);
   }
 }
 
-void LinkingSection::addToSymtab(Symbol *Sym) {
-  Sym->setOutputSymbolIndex(SymtabEntries.size());
-  SymtabEntries.emplace_back(Sym);
+void LinkingSection::addToSymtab(Symbol *sym) {
+  sym->setOutputSymbolIndex(symtabEntries.size());
+  symtabEntries.emplace_back(sym);
 }
 
 unsigned NameSection::numNames() const {
-  unsigned NumNames = Out.ImportSec->getNumImportedFunctions();
-  for (const InputFunction *F : Out.FunctionSec->InputFunctions)
-    if (!F->getName().empty() || !F->getDebugName().empty())
-      ++NumNames;
+  unsigned numNames = out.importSec->getNumImportedFunctions();
+  for (const InputFunction *f : out.functionSec->inputFunctions)
+    if (!f->getName().empty() || !f->getDebugName().empty())
+      ++numNames;
 
-  return NumNames;
+  return numNames;
 }
 
 // Create the custom "name" section containing debug symbol names.
 void NameSection::writeBody() {
-  SubSection Sub(WASM_NAMES_FUNCTION);
-  writeUleb128(Sub.OS, numNames(), "name count");
+  SubSection sub(WASM_NAMES_FUNCTION);
+  writeUleb128(sub.os, numNames(), "name count");
 
   // Names must appear in function index order.  As it happens ImportedSymbols
   // and InputFunctions are numbered in order with imported functions coming
   // first.
-  for (const Symbol *S : Out.ImportSec->ImportedSymbols) {
-    if (auto *F = dyn_cast<FunctionSymbol>(S)) {
-      writeUleb128(Sub.OS, F->getFunctionIndex(), "func index");
-      writeStr(Sub.OS, toString(*S), "symbol name");
+  for (const Symbol *s : out.importSec->importedSymbols) {
+    if (auto *f = dyn_cast<FunctionSymbol>(s)) {
+      writeUleb128(sub.os, f->getFunctionIndex(), "func index");
+      writeStr(sub.os, toString(*s), "symbol name");
     }
   }
-  for (const InputFunction *F : Out.FunctionSec->InputFunctions) {
-    if (!F->getName().empty()) {
-      writeUleb128(Sub.OS, F->getFunctionIndex(), "func index");
-      if (!F->getDebugName().empty()) {
-        writeStr(Sub.OS, F->getDebugName(), "symbol name");
+  for (const InputFunction *f : out.functionSec->inputFunctions) {
+    if (!f->getName().empty()) {
+      writeUleb128(sub.os, f->getFunctionIndex(), "func index");
+      if (!f->getDebugName().empty()) {
+        writeStr(sub.os, f->getDebugName(), "symbol name");
       } else {
-        writeStr(Sub.OS, maybeDemangleSymbol(F->getName()), "symbol name");
+        writeStr(sub.os, maybeDemangleSymbol(f->getName()), "symbol name");
       }
     }
   }
 
-  Sub.writeTo(BodyOutputStream);
+  sub.writeTo(bodyOutputStream);
 }
 
-void ProducersSection::addInfo(const WasmProducerInfo &Info) {
-  for (auto &Producers :
-       {std::make_pair(&Info.Languages, &Languages),
-        std::make_pair(&Info.Tools, &Tools), std::make_pair(&Info.SDKs, &SDKs)})
-    for (auto &Producer : *Producers.first)
-      if (Producers.second->end() ==
-          llvm::find_if(*Producers.second,
-                        [&](std::pair<std::string, std::string> Seen) {
-                          return Seen.first == Producer.first;
+void ProducersSection::addInfo(const WasmProducerInfo &info) {
+  for (auto &producers :
+       {std::make_pair(&info.Languages, &languages),
+        std::make_pair(&info.Tools, &tools), std::make_pair(&info.SDKs, &sDKs)})
+    for (auto &producer : *producers.first)
+      if (producers.second->end() ==
+          llvm::find_if(*producers.second,
+                        [&](std::pair<std::string, std::string> seen) {
+                          return seen.first == producer.first;
                         }))
-        Producers.second->push_back(Producer);
+        producers.second->push_back(producer);
 }
 
 void ProducersSection::writeBody() {
-  auto &OS = BodyOutputStream;
-  writeUleb128(OS, fieldCount(), "field count");
-  for (auto &Field :
-       {std::make_pair("language", Languages),
-        std::make_pair("processed-by", Tools), std::make_pair("sdk", SDKs)}) {
-    if (Field.second.empty())
+  auto &os = bodyOutputStream;
+  writeUleb128(os, fieldCount(), "field count");
+  for (auto &field :
+       {std::make_pair("language", languages),
+        std::make_pair("processed-by", tools), std::make_pair("sdk", sDKs)}) {
+    if (field.second.empty())
       continue;
-    writeStr(OS, Field.first, "field name");
-    writeUleb128(OS, Field.second.size(), "number of entries");
-    for (auto &Entry : Field.second) {
-      writeStr(OS, Entry.first, "producer name");
-      writeStr(OS, Entry.second, "producer version");
+    writeStr(os, field.first, "field name");
+    writeUleb128(os, field.second.size(), "number of entries");
+    for (auto &entry : field.second) {
+      writeStr(os, entry.first, "producer name");
+      writeStr(os, entry.second, "producer version");
     }
   }
 }
 
 void TargetFeaturesSection::writeBody() {
-  SmallVector<std::string, 8> Emitted(Features.begin(), Features.end());
-  llvm::sort(Emitted);
-  auto &OS = BodyOutputStream;
-  writeUleb128(OS, Emitted.size(), "feature count");
-  for (auto &Feature : Emitted) {
-    writeU8(OS, WASM_FEATURE_PREFIX_USED, "feature used prefix");
-    writeStr(OS, Feature, "feature name");
+  SmallVector<std::string, 8> emitted(features.begin(), features.end());
+  llvm::sort(emitted);
+  auto &os = bodyOutputStream;
+  writeUleb128(os, emitted.size(), "feature count");
+  for (auto &feature : emitted) {
+    writeU8(os, WASM_FEATURE_PREFIX_USED, "feature used prefix");
+    writeStr(os, feature, "feature name");
   }
 }
 
 void RelocSection::writeBody() {
-  uint32_t Count = Sec->getNumRelocations();
-  assert(Sec->SectionIndex != UINT32_MAX);
-  writeUleb128(BodyOutputStream, Sec->SectionIndex, "reloc section");
-  writeUleb128(BodyOutputStream, Count, "reloc count");
-  Sec->writeRelocations(BodyOutputStream);
+  uint32_t count = sec->getNumRelocations();
+  assert(sec->sectionIndex != UINT32_MAX);
+  writeUleb128(bodyOutputStream, sec->sectionIndex, "reloc section");
+  writeUleb128(bodyOutputStream, count, "reloc count");
+  sec->writeRelocations(bodyOutputStream);
 }

Modified: lld/trunk/wasm/SyntheticSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/SyntheticSections.h?rev=365730&r1=365729&r2=365730&view=diff
==============================================================================
--- lld/trunk/wasm/SyntheticSections.h (original)
+++ lld/trunk/wasm/SyntheticSections.h Wed Jul 10 22:40:30 2019
@@ -29,41 +29,41 @@ namespace wasm {
 // An init entry to be written to either the synthetic init func or the
 // linking metadata.
 struct WasmInitEntry {
-  const FunctionSymbol *Sym;
-  uint32_t Priority;
+  const FunctionSymbol *sym;
+  uint32_t priority;
 };
 
 class SyntheticSection : public OutputSection {
 public:
-  SyntheticSection(uint32_t Type, std::string Name = "")
-      : OutputSection(Type, Name), BodyOutputStream(Body) {
-    if (!Name.empty())
-      writeStr(BodyOutputStream, Name, "section name");
+  SyntheticSection(uint32_t type, std::string name = "")
+      : OutputSection(type, name), bodyOutputStream(body) {
+    if (!name.empty())
+      writeStr(bodyOutputStream, name, "section name");
   }
 
-  void writeTo(uint8_t *Buf) override {
-    assert(Offset);
+  void writeTo(uint8_t *buf) override {
+    assert(offset);
     log("writing " + toString(*this));
-    memcpy(Buf + Offset, Header.data(), Header.size());
-    memcpy(Buf + Offset + Header.size(), Body.data(), Body.size());
+    memcpy(buf + offset, header.data(), header.size());
+    memcpy(buf + offset + header.size(), body.data(), body.size());
   }
 
-  size_t getSize() const override { return Header.size() + Body.size(); }
+  size_t getSize() const override { return header.size() + body.size(); }
 
   virtual void writeBody() {}
 
   void finalizeContents() override {
     writeBody();
-    BodyOutputStream.flush();
-    createHeader(Body.size());
+    bodyOutputStream.flush();
+    createHeader(body.size());
   }
 
-  raw_ostream &getStream() { return BodyOutputStream; }
+  raw_ostream &getStream() { return bodyOutputStream; }
 
-  std::string Body;
+  std::string body;
 
 protected:
-  llvm::raw_string_ostream BodyOutputStream;
+  llvm::raw_string_ostream bodyOutputStream;
 };
 
 // Create the custom "dylink" section containing information for the dynamic
@@ -73,25 +73,25 @@ protected:
 class DylinkSection : public SyntheticSection {
 public:
   DylinkSection() : SyntheticSection(llvm::wasm::WASM_SEC_CUSTOM, "dylink") {}
-  bool isNeeded() const override { return Config->Pic; }
+  bool isNeeded() const override { return config->isPic; }
   void writeBody() override;
 
-  uint32_t MemAlign = 0;
-  uint32_t MemSize = 0;
+  uint32_t memAlign = 0;
+  uint32_t memSize = 0;
 };
 
 class TypeSection : public SyntheticSection {
 public:
   TypeSection() : SyntheticSection(llvm::wasm::WASM_SEC_TYPE) {}
 
-  bool isNeeded() const override { return Types.size() > 0; };
+  bool isNeeded() const override { return types.size() > 0; };
   void writeBody() override;
-  uint32_t registerType(const WasmSignature &Sig);
-  uint32_t lookupType(const WasmSignature &Sig);
+  uint32_t registerType(const WasmSignature &sig);
+  uint32_t lookupType(const WasmSignature &sig);
 
 protected:
-  std::vector<const WasmSignature *> Types;
-  llvm::DenseMap<WasmSignature, int32_t> TypeIndices;
+  std::vector<const WasmSignature *> types;
+  llvm::DenseMap<WasmSignature, int32_t> typeIndices;
 };
 
 class ImportSection : public SyntheticSection {
@@ -99,42 +99,42 @@ public:
   ImportSection() : SyntheticSection(llvm::wasm::WASM_SEC_IMPORT) {}
   bool isNeeded() const override { return getNumImports() > 0; }
   void writeBody() override;
-  void addImport(Symbol *Sym);
-  void addGOTEntry(Symbol *Sym);
-  void seal() { IsSealed = true; }
+  void addImport(Symbol *sym);
+  void addGOTEntry(Symbol *sym);
+  void seal() { isSealed = true; }
   uint32_t getNumImports() const;
   uint32_t getNumImportedGlobals() const {
-    assert(IsSealed);
-    return NumImportedGlobals;
+    assert(isSealed);
+    return numImportedGlobals;
   }
   uint32_t getNumImportedFunctions() const {
-    assert(IsSealed);
-    return NumImportedFunctions;
+    assert(isSealed);
+    return numImportedFunctions;
   }
   uint32_t getNumImportedEvents() const {
-    assert(IsSealed);
-    return NumImportedEvents;
+    assert(isSealed);
+    return numImportedEvents;
   }
 
-  std::vector<const Symbol *> ImportedSymbols;
+  std::vector<const Symbol *> importedSymbols;
 
 protected:
-  bool IsSealed = false;
-  unsigned NumImportedGlobals = 0;
-  unsigned NumImportedFunctions = 0;
-  unsigned NumImportedEvents = 0;
-  std::vector<const Symbol *> GOTSymbols;
+  bool isSealed = false;
+  unsigned numImportedGlobals = 0;
+  unsigned numImportedFunctions = 0;
+  unsigned numImportedEvents = 0;
+  std::vector<const Symbol *> gotSymbols;
 };
 
 class FunctionSection : public SyntheticSection {
 public:
   FunctionSection() : SyntheticSection(llvm::wasm::WASM_SEC_FUNCTION) {}
 
-  bool isNeeded() const override { return InputFunctions.size() > 0; };
+  bool isNeeded() const override { return inputFunctions.size() > 0; };
   void writeBody() override;
-  void addFunction(InputFunction *Func);
+  void addFunction(InputFunction *func);
 
-  std::vector<InputFunction *> InputFunctions;
+  std::vector<InputFunction *> inputFunctions;
 
 protected:
 };
@@ -143,11 +143,11 @@ class MemorySection : public SyntheticSe
 public:
   MemorySection() : SyntheticSection(llvm::wasm::WASM_SEC_MEMORY) {}
 
-  bool isNeeded() const override { return !Config->ImportMemory; }
+  bool isNeeded() const override { return !config->importMemory; }
   void writeBody() override;
 
-  uint32_t NumMemoryPages = 0;
-  uint32_t MaxMemoryPages = 0;
+  uint32_t numMemoryPages = 0;
+  uint32_t maxMemoryPages = 0;
 };
 
 class TableSection : public SyntheticSection {
@@ -163,7 +163,7 @@ public:
     //     no address-taken function will fail at validation time since it is
     //     a validation error to include a call_indirect instruction if there
     //     is not table.
-    return !Config->ImportTable;
+    return !config->importTable;
   }
 
   void writeBody() override;
@@ -173,14 +173,14 @@ class GlobalSection : public SyntheticSe
 public:
   GlobalSection() : SyntheticSection(llvm::wasm::WASM_SEC_GLOBAL) {}
   uint32_t numGlobals() const {
-    return InputGlobals.size() + DefinedFakeGlobals.size();
+    return inputGlobals.size() + definedFakeGlobals.size();
   }
   bool isNeeded() const override { return numGlobals() > 0; }
   void writeBody() override;
-  void addGlobal(InputGlobal *Global);
+  void addGlobal(InputGlobal *global);
 
-  std::vector<const DefinedData *> DefinedFakeGlobals;
-  std::vector<InputGlobal *> InputGlobals;
+  std::vector<const DefinedData *> definedFakeGlobals;
+  std::vector<InputGlobal *> inputGlobals;
 };
 
 // The event section contains a list of declared wasm events associated with the
@@ -197,66 +197,66 @@ class EventSection : public SyntheticSec
 public:
   EventSection() : SyntheticSection(llvm::wasm::WASM_SEC_EVENT) {}
   void writeBody() override;
-  bool isNeeded() const override { return InputEvents.size() > 0; }
-  void addEvent(InputEvent *Event);
+  bool isNeeded() const override { return inputEvents.size() > 0; }
+  void addEvent(InputEvent *event);
 
-  std::vector<InputEvent *> InputEvents;
+  std::vector<InputEvent *> inputEvents;
 };
 
 class ExportSection : public SyntheticSection {
 public:
   ExportSection() : SyntheticSection(llvm::wasm::WASM_SEC_EXPORT) {}
-  bool isNeeded() const override { return Exports.size() > 0; }
+  bool isNeeded() const override { return exports.size() > 0; }
   void writeBody() override;
 
-  std::vector<llvm::wasm::WasmExport> Exports;
+  std::vector<llvm::wasm::WasmExport> exports;
 };
 
 class ElemSection : public SyntheticSection {
 public:
-  ElemSection(uint32_t Offset)
-      : SyntheticSection(llvm::wasm::WASM_SEC_ELEM), ElemOffset(Offset) {}
-  bool isNeeded() const override { return IndirectFunctions.size() > 0; };
-  void writeBody() override;
-  void addEntry(FunctionSymbol *Sym);
-  uint32_t numEntries() const { return IndirectFunctions.size(); }
-  uint32_t ElemOffset;
+  ElemSection(uint32_t offset)
+      : SyntheticSection(llvm::wasm::WASM_SEC_ELEM), elemOffset(offset) {}
+  bool isNeeded() const override { return indirectFunctions.size() > 0; };
+  void writeBody() override;
+  void addEntry(FunctionSymbol *sym);
+  uint32_t numEntries() const { return indirectFunctions.size(); }
+  uint32_t elemOffset;
 
 protected:
-  std::vector<const FunctionSymbol *> IndirectFunctions;
+  std::vector<const FunctionSymbol *> indirectFunctions;
 };
 
 class DataCountSection : public SyntheticSection {
 public:
-  DataCountSection(uint32_t NumSegments)
+  DataCountSection(uint32_t numSegments)
       : SyntheticSection(llvm::wasm::WASM_SEC_DATACOUNT),
-        NumSegments(NumSegments) {}
+        numSegments(numSegments) {}
   bool isNeeded() const override;
   void writeBody() override;
 
 protected:
-  uint32_t NumSegments;
+  uint32_t numSegments;
 };
 
 // Create the custom "linking" section containing linker metadata.
 // This is only created when relocatable output is requested.
 class LinkingSection : public SyntheticSection {
 public:
-  LinkingSection(const std::vector<WasmInitEntry> &InitFunctions,
-                 const std::vector<OutputSegment *> &DataSegments)
+  LinkingSection(const std::vector<WasmInitEntry> &initFunctions,
+                 const std::vector<OutputSegment *> &dataSegments)
       : SyntheticSection(llvm::wasm::WASM_SEC_CUSTOM, "linking"),
-        InitFunctions(InitFunctions), DataSegments(DataSegments) {}
+        initFunctions(initFunctions), dataSegments(dataSegments) {}
   bool isNeeded() const override {
-    return Config->Relocatable || Config->EmitRelocs;
+    return config->relocatable || config->emitRelocs;
   }
   void writeBody() override;
-  void addToSymtab(Symbol *Sym);
+  void addToSymtab(Symbol *sym);
 
 protected:
-  std::vector<const Symbol *> SymtabEntries;
-  llvm::StringMap<uint32_t> SectionSymbolIndices;
-  const std::vector<WasmInitEntry> &InitFunctions;
-  const std::vector<OutputSegment *> &DataSegments;
+  std::vector<const Symbol *> symtabEntries;
+  llvm::StringMap<uint32_t> sectionSymbolIndices;
+  const std::vector<WasmInitEntry> &initFunctions;
+  const std::vector<OutputSegment *> &dataSegments;
 };
 
 // Create the custom "name" section containing debug symbol names.
@@ -264,7 +264,7 @@ class NameSection : public SyntheticSect
 public:
   NameSection() : SyntheticSection(llvm::wasm::WASM_SEC_CUSTOM, "name") {}
   bool isNeeded() const override {
-    return !Config->StripDebug && !Config->StripAll && numNames() > 0;
+    return !config->stripDebug && !config->stripAll && numNames() > 0;
   }
   void writeBody() override;
   unsigned numNames() const;
@@ -275,18 +275,18 @@ public:
   ProducersSection()
       : SyntheticSection(llvm::wasm::WASM_SEC_CUSTOM, "producers") {}
   bool isNeeded() const override {
-    return !Config->StripAll && fieldCount() > 0;
+    return !config->stripAll && fieldCount() > 0;
   }
   void writeBody() override;
-  void addInfo(const llvm::wasm::WasmProducerInfo &Info);
+  void addInfo(const llvm::wasm::WasmProducerInfo &info);
 
 protected:
   int fieldCount() const {
-    return int(!Languages.empty()) + int(!Tools.empty()) + int(!SDKs.empty());
+    return int(!languages.empty()) + int(!tools.empty()) + int(!sDKs.empty());
   }
-  SmallVector<std::pair<std::string, std::string>, 8> Languages;
-  SmallVector<std::pair<std::string, std::string>, 8> Tools;
-  SmallVector<std::pair<std::string, std::string>, 8> SDKs;
+  SmallVector<std::pair<std::string, std::string>, 8> languages;
+  SmallVector<std::pair<std::string, std::string>, 8> tools;
+  SmallVector<std::pair<std::string, std::string>, 8> sDKs;
 };
 
 class TargetFeaturesSection : public SyntheticSection {
@@ -294,44 +294,44 @@ public:
   TargetFeaturesSection()
       : SyntheticSection(llvm::wasm::WASM_SEC_CUSTOM, "target_features") {}
   bool isNeeded() const override {
-    return !Config->StripAll && Features.size() > 0;
+    return !config->stripAll && features.size() > 0;
   }
   void writeBody() override;
 
-  llvm::SmallSet<std::string, 8> Features;
+  llvm::SmallSet<std::string, 8> features;
 };
 
 class RelocSection : public SyntheticSection {
 public:
-  RelocSection(StringRef Name, OutputSection *Sec)
-      : SyntheticSection(llvm::wasm::WASM_SEC_CUSTOM, Name), Sec(Sec) {}
+  RelocSection(StringRef name, OutputSection *sec)
+      : SyntheticSection(llvm::wasm::WASM_SEC_CUSTOM, name), sec(sec) {}
   void writeBody() override;
-  bool isNeeded() const override { return Sec->getNumRelocations() > 0; };
+  bool isNeeded() const override { return sec->getNumRelocations() > 0; };
 
 protected:
-  OutputSection *Sec;
+  OutputSection *sec;
 };
 
 // Linker generated output sections
 struct OutStruct {
-  DylinkSection *DylinkSec;
-  TypeSection *TypeSec;
-  FunctionSection *FunctionSec;
-  ImportSection *ImportSec;
-  TableSection *TableSec;
-  MemorySection *MemorySec;
-  GlobalSection *GlobalSec;
-  EventSection *EventSec;
-  ExportSection *ExportSec;
-  ElemSection *ElemSec;
-  DataCountSection *DataCountSec;
-  LinkingSection *LinkingSec;
-  NameSection *NameSec;
-  ProducersSection *ProducersSec;
-  TargetFeaturesSection *TargetFeaturesSec;
+  DylinkSection *dylinkSec;
+  TypeSection *typeSec;
+  FunctionSection *functionSec;
+  ImportSection *importSec;
+  TableSection *tableSec;
+  MemorySection *memorySec;
+  GlobalSection *globalSec;
+  EventSection *eventSec;
+  ExportSection *exportSec;
+  ElemSection *elemSec;
+  DataCountSection *dataCountSec;
+  LinkingSection *linkingSec;
+  NameSection *nameSec;
+  ProducersSection *producersSec;
+  TargetFeaturesSection *targetFeaturesSec;
 };
 
-extern OutStruct Out;
+extern OutStruct out;
 
 } // namespace wasm
 } // namespace lld

Modified: lld/trunk/wasm/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Writer.cpp?rev=365730&r1=365729&r2=365730&view=diff
==============================================================================
--- lld/trunk/wasm/Writer.cpp (original)
+++ lld/trunk/wasm/Writer.cpp Wed Jul 10 22:40:30 2019
@@ -42,7 +42,7 @@ using namespace llvm::wasm;
 using namespace lld;
 using namespace lld::wasm;
 
-static constexpr int StackAlignment = 16;
+static constexpr int stackAlignment = 16;
 
 namespace {
 
@@ -71,7 +71,7 @@ private:
   void layoutMemory();
   void createHeader();
 
-  void addSection(OutputSection *Sec);
+  void addSection(OutputSection *sec);
 
   void addSections();
 
@@ -85,56 +85,56 @@ private:
   void writeHeader();
   void writeSections();
 
-  uint64_t FileSize = 0;
-  uint32_t TableBase = 0;
+  uint64_t fileSize = 0;
+  uint32_t tableBase = 0;
 
-  std::vector<WasmInitEntry> InitFunctions;
-  llvm::StringMap<std::vector<InputSection *>> CustomSectionMapping;
+  std::vector<WasmInitEntry> initFunctions;
+  llvm::StringMap<std::vector<InputSection *>> customSectionMapping;
 
   // Elements that are used to construct the final output
-  std::string Header;
-  std::vector<OutputSection *> OutputSections;
+  std::string header;
+  std::vector<OutputSection *> outputSections;
 
-  std::unique_ptr<FileOutputBuffer> Buffer;
+  std::unique_ptr<FileOutputBuffer> buffer;
 
-  std::vector<OutputSegment *> Segments;
-  llvm::SmallDenseMap<StringRef, OutputSegment *> SegmentMap;
+  std::vector<OutputSegment *> segments;
+  llvm::SmallDenseMap<StringRef, OutputSegment *> segmentMap;
 };
 
 } // anonymous namespace
 
 void Writer::calculateCustomSections() {
   log("calculateCustomSections");
-  bool StripDebug = Config->StripDebug || Config->StripAll;
-  for (ObjFile *File : Symtab->ObjectFiles) {
-    for (InputSection *Section : File->CustomSections) {
-      StringRef Name = Section->getName();
+  bool stripDebug = config->stripDebug || config->stripAll;
+  for (ObjFile *file : symtab->objectFiles) {
+    for (InputSection *section : file->customSections) {
+      StringRef name = section->getName();
       // These custom sections are known the linker and synthesized rather than
       // blindly copied
-      if (Name == "linking" || Name == "name" || Name == "producers" ||
-          Name == "target_features" || Name.startswith("reloc."))
+      if (name == "linking" || name == "name" || name == "producers" ||
+          name == "target_features" || name.startswith("reloc."))
         continue;
       // .. or it is a debug section
-      if (StripDebug && Name.startswith(".debug_"))
+      if (stripDebug && name.startswith(".debug_"))
         continue;
-      CustomSectionMapping[Name].push_back(Section);
+      customSectionMapping[name].push_back(section);
     }
   }
 }
 
 void Writer::createCustomSections() {
   log("createCustomSections");
-  for (auto &Pair : CustomSectionMapping) {
-    StringRef Name = Pair.first();
-    LLVM_DEBUG(dbgs() << "createCustomSection: " << Name << "\n");
-
-    OutputSection *Sec = make<CustomSection>(Name, Pair.second);
-    if (Config->Relocatable || Config->EmitRelocs) {
-      auto *Sym = make<OutputSectionSymbol>(Sec);
-      Out.LinkingSec->addToSymtab(Sym);
-      Sec->SectionSym = Sym;
+  for (auto &pair : customSectionMapping) {
+    StringRef name = pair.first();
+    LLVM_DEBUG(dbgs() << "createCustomSection: " << name << "\n");
+
+    OutputSection *sec = make<CustomSection>(name, pair.second);
+    if (config->relocatable || config->emitRelocs) {
+      auto *sym = make<OutputSectionSymbol>(sec);
+      out.linkingSec->addToSymtab(sym);
+      sec->sectionSym = sym;
     }
-    addSection(Sec);
+    addSection(sec);
   }
 }
 
@@ -143,47 +143,47 @@ void Writer::createCustomSections() {
 void Writer::createRelocSections() {
   log("createRelocSections");
   // Don't use iterator here since we are adding to OutputSection
-  size_t OrigSize = OutputSections.size();
-  for (size_t I = 0; I < OrigSize; I++) {
-    LLVM_DEBUG(dbgs() << "check section " << I << "\n");
-    OutputSection *Sec = OutputSections[I];
+  size_t origSize = outputSections.size();
+  for (size_t i = 0; i < origSize; i++) {
+    LLVM_DEBUG(dbgs() << "check section " << i << "\n");
+    OutputSection *sec = outputSections[i];
 
     // Count the number of needed sections.
-    uint32_t Count = Sec->getNumRelocations();
-    if (!Count)
+    uint32_t count = sec->getNumRelocations();
+    if (!count)
       continue;
 
-    StringRef Name;
-    if (Sec->Type == WASM_SEC_DATA)
-      Name = "reloc.DATA";
-    else if (Sec->Type == WASM_SEC_CODE)
-      Name = "reloc.CODE";
-    else if (Sec->Type == WASM_SEC_CUSTOM)
-      Name = Saver.save("reloc." + Sec->Name);
+    StringRef name;
+    if (sec->type == WASM_SEC_DATA)
+      name = "reloc.DATA";
+    else if (sec->type == WASM_SEC_CODE)
+      name = "reloc.CODE";
+    else if (sec->type == WASM_SEC_CUSTOM)
+      name = saver.save("reloc." + sec->name);
     else
       llvm_unreachable(
           "relocations only supported for code, data, or custom sections");
 
-    addSection(make<RelocSection>(Name, Sec));
+    addSection(make<RelocSection>(name, sec));
   }
 }
 
 void Writer::populateProducers() {
-  for (ObjFile *File : Symtab->ObjectFiles) {
-    const WasmProducerInfo &Info = File->getWasmObj()->getProducerInfo();
-    Out.ProducersSec->addInfo(Info);
+  for (ObjFile *file : symtab->objectFiles) {
+    const WasmProducerInfo &info = file->getWasmObj()->getProducerInfo();
+    out.producersSec->addInfo(info);
   }
 }
 
 void Writer::writeHeader() {
-  memcpy(Buffer->getBufferStart(), Header.data(), Header.size());
+  memcpy(buffer->getBufferStart(), header.data(), header.size());
 }
 
 void Writer::writeSections() {
-  uint8_t *Buf = Buffer->getBufferStart();
-  parallelForEach(OutputSections, [Buf](OutputSection *S) {
-    assert(S->isNeeded());
-    S->writeTo(Buf);
+  uint8_t *buf = buffer->getBufferStart();
+  parallelForEach(outputSections, [buf](OutputSection *s) {
+    assert(s->isNeeded());
+    s->writeTo(buf);
   });
 }
 
@@ -201,100 +201,100 @@ void Writer::writeSections() {
 // rather than overwriting global data, but also increases code size since all
 // static data loads and stores requires larger offsets.
 void Writer::layoutMemory() {
-  uint32_t MemoryPtr = 0;
+  uint32_t memoryPtr = 0;
 
-  auto PlaceStack = [&]() {
-    if (Config->Relocatable || Config->Shared)
+  auto placeStack = [&]() {
+    if (config->relocatable || config->shared)
       return;
-    MemoryPtr = alignTo(MemoryPtr, StackAlignment);
-    if (Config->ZStackSize != alignTo(Config->ZStackSize, StackAlignment))
-      error("stack size must be " + Twine(StackAlignment) + "-byte aligned");
-    log("mem: stack size  = " + Twine(Config->ZStackSize));
-    log("mem: stack base  = " + Twine(MemoryPtr));
-    MemoryPtr += Config->ZStackSize;
-    auto *SP = cast<DefinedGlobal>(WasmSym::StackPointer);
-    SP->Global->Global.InitExpr.Value.Int32 = MemoryPtr;
-    log("mem: stack top   = " + Twine(MemoryPtr));
+    memoryPtr = alignTo(memoryPtr, stackAlignment);
+    if (config->zStackSize != alignTo(config->zStackSize, stackAlignment))
+      error("stack size must be " + Twine(stackAlignment) + "-byte aligned");
+    log("mem: stack size  = " + Twine(config->zStackSize));
+    log("mem: stack base  = " + Twine(memoryPtr));
+    memoryPtr += config->zStackSize;
+    auto *sp = cast<DefinedGlobal>(WasmSym::stackPointer);
+    sp->global->global.InitExpr.Value.Int32 = memoryPtr;
+    log("mem: stack top   = " + Twine(memoryPtr));
   };
 
-  if (Config->StackFirst) {
-    PlaceStack();
+  if (config->stackFirst) {
+    placeStack();
   } else {
-    MemoryPtr = Config->GlobalBase;
-    log("mem: global base = " + Twine(Config->GlobalBase));
+    memoryPtr = config->globalBase;
+    log("mem: global base = " + Twine(config->globalBase));
   }
 
-  if (WasmSym::GlobalBase)
-    WasmSym::GlobalBase->setVirtualAddress(Config->GlobalBase);
+  if (WasmSym::globalBase)
+    WasmSym::globalBase->setVirtualAddress(config->globalBase);
 
-  uint32_t DataStart = MemoryPtr;
+  uint32_t dataStart = memoryPtr;
 
   // Arbitrarily set __dso_handle handle to point to the start of the data
   // segments.
-  if (WasmSym::DsoHandle)
-    WasmSym::DsoHandle->setVirtualAddress(DataStart);
+  if (WasmSym::dsoHandle)
+    WasmSym::dsoHandle->setVirtualAddress(dataStart);
 
-  Out.DylinkSec->MemAlign = 0;
-  for (OutputSegment *Seg : Segments) {
-    Out.DylinkSec->MemAlign = std::max(Out.DylinkSec->MemAlign, Seg->Alignment);
-    MemoryPtr = alignTo(MemoryPtr, 1ULL << Seg->Alignment);
-    Seg->StartVA = MemoryPtr;
-    log(formatv("mem: {0,-15} offset={1,-8} size={2,-8} align={3}", Seg->Name,
-                MemoryPtr, Seg->Size, Seg->Alignment));
-    MemoryPtr += Seg->Size;
+  out.dylinkSec->memAlign = 0;
+  for (OutputSegment *seg : segments) {
+    out.dylinkSec->memAlign = std::max(out.dylinkSec->memAlign, seg->alignment);
+    memoryPtr = alignTo(memoryPtr, 1ULL << seg->alignment);
+    seg->startVA = memoryPtr;
+    log(formatv("mem: {0,-15} offset={1,-8} size={2,-8} align={3}", seg->name,
+                memoryPtr, seg->size, seg->alignment));
+    memoryPtr += seg->size;
   }
 
   // TODO: Add .bss space here.
-  if (WasmSym::DataEnd)
-    WasmSym::DataEnd->setVirtualAddress(MemoryPtr);
+  if (WasmSym::dataEnd)
+    WasmSym::dataEnd->setVirtualAddress(memoryPtr);
 
-  log("mem: static data = " + Twine(MemoryPtr - DataStart));
+  log("mem: static data = " + Twine(memoryPtr - dataStart));
 
-  if (Config->Shared) {
-    Out.DylinkSec->MemSize = MemoryPtr;
+  if (config->shared) {
+    out.dylinkSec->memSize = memoryPtr;
     return;
   }
 
-  if (!Config->StackFirst)
-    PlaceStack();
+  if (!config->stackFirst)
+    placeStack();
 
   // Set `__heap_base` to directly follow the end of the stack or global data.
   // The fact that this comes last means that a malloc/brk implementation
   // can grow the heap at runtime.
-  log("mem: heap base   = " + Twine(MemoryPtr));
-  if (WasmSym::HeapBase)
-    WasmSym::HeapBase->setVirtualAddress(MemoryPtr);
+  log("mem: heap base   = " + Twine(memoryPtr));
+  if (WasmSym::heapBase)
+    WasmSym::heapBase->setVirtualAddress(memoryPtr);
 
-  if (Config->InitialMemory != 0) {
-    if (Config->InitialMemory != alignTo(Config->InitialMemory, WasmPageSize))
+  if (config->initialMemory != 0) {
+    if (config->initialMemory != alignTo(config->initialMemory, WasmPageSize))
       error("initial memory must be " + Twine(WasmPageSize) + "-byte aligned");
-    if (MemoryPtr > Config->InitialMemory)
-      error("initial memory too small, " + Twine(MemoryPtr) + " bytes needed");
+    if (memoryPtr > config->initialMemory)
+      error("initial memory too small, " + Twine(memoryPtr) + " bytes needed");
     else
-      MemoryPtr = Config->InitialMemory;
+      memoryPtr = config->initialMemory;
   }
-  Out.DylinkSec->MemSize = MemoryPtr;
-  Out.MemorySec->NumMemoryPages =
-      alignTo(MemoryPtr, WasmPageSize) / WasmPageSize;
-  log("mem: total pages = " + Twine(Out.MemorySec->NumMemoryPages));
+  out.dylinkSec->memSize = memoryPtr;
+  out.memorySec->numMemoryPages =
+      alignTo(memoryPtr, WasmPageSize) / WasmPageSize;
+  log("mem: total pages = " + Twine(out.memorySec->numMemoryPages));
 
   // Check max if explicitly supplied or required by shared memory
-  if (Config->MaxMemory != 0 || Config->SharedMemory) {
-    if (Config->MaxMemory != alignTo(Config->MaxMemory, WasmPageSize))
+  if (config->maxMemory != 0 || config->sharedMemory) {
+    if (config->maxMemory != alignTo(config->maxMemory, WasmPageSize))
       error("maximum memory must be " + Twine(WasmPageSize) + "-byte aligned");
-    if (MemoryPtr > Config->MaxMemory)
-      error("maximum memory too small, " + Twine(MemoryPtr) + " bytes needed");
-    Out.MemorySec->MaxMemoryPages = Config->MaxMemory / WasmPageSize;
-    log("mem: max pages   = " + Twine(Out.MemorySec->MaxMemoryPages));
+    if (memoryPtr > config->maxMemory)
+      error("maximum memory too small, " + Twine(memoryPtr) + " bytes needed");
+    out.memorySec->maxMemoryPages = config->maxMemory / WasmPageSize;
+    log("mem: max pages   = " + Twine(out.memorySec->maxMemoryPages));
   }
 }
 
-void Writer::addSection(OutputSection *Sec) {
-  if (!Sec->isNeeded())
+void Writer::addSection(OutputSection *sec) {
+  if (!sec->isNeeded())
     return;
-  log("addSection: " + toString(*Sec));
-  Sec->SectionIndex = OutputSections.size();
-  OutputSections.push_back(Sec);
+  log("addSection: " + toString(*sec));
+  sec->sectionIndex = outputSections.size();
+  outputSections.push_back(sec);
 }
 
 // If a section name is valid as a C identifier (which is rare because of
@@ -302,227 +302,227 @@ void Writer::addSection(OutputSection *S
 // __stop_<secname> symbols. They are at beginning and end of the section,
 // respectively. This is not requested by the ELF standard, but GNU ld and
 // gold provide the feature, and used by many programs.
-static void addStartStopSymbols(const OutputSegment *Seg) {
-  StringRef Name = Seg->Name;
-  if (!isValidCIdentifier(Name))
+static void addStartStopSymbols(const OutputSegment *seg) {
+  StringRef name = seg->name;
+  if (!isValidCIdentifier(name))
     return;
-  LLVM_DEBUG(dbgs() << "addStartStopSymbols: " << Name << "\n");
-  uint32_t Start = Seg->StartVA;
-  uint32_t Stop = Start + Seg->Size;
-  Symtab->addOptionalDataSymbol(Saver.save("__start_" + Name), Start);
-  Symtab->addOptionalDataSymbol(Saver.save("__stop_" + Name), Stop);
+  LLVM_DEBUG(dbgs() << "addStartStopSymbols: " << name << "\n");
+  uint32_t start = seg->startVA;
+  uint32_t stop = start + seg->size;
+  symtab->addOptionalDataSymbol(saver.save("__start_" + name), start);
+  symtab->addOptionalDataSymbol(saver.save("__stop_" + name), stop);
 }
 
 void Writer::addSections() {
-  addSection(Out.DylinkSec);
-  addSection(Out.TypeSec);
-  addSection(Out.ImportSec);
-  addSection(Out.FunctionSec);
-  addSection(Out.TableSec);
-  addSection(Out.MemorySec);
-  addSection(Out.GlobalSec);
-  addSection(Out.EventSec);
-  addSection(Out.ExportSec);
-  addSection(Out.ElemSec);
-  addSection(Out.DataCountSec);
+  addSection(out.dylinkSec);
+  addSection(out.typeSec);
+  addSection(out.importSec);
+  addSection(out.functionSec);
+  addSection(out.tableSec);
+  addSection(out.memorySec);
+  addSection(out.globalSec);
+  addSection(out.eventSec);
+  addSection(out.exportSec);
+  addSection(out.elemSec);
+  addSection(out.dataCountSec);
 
-  addSection(make<CodeSection>(Out.FunctionSec->InputFunctions));
-  addSection(make<DataSection>(Segments));
+  addSection(make<CodeSection>(out.functionSec->inputFunctions));
+  addSection(make<DataSection>(segments));
 
   createCustomSections();
 
-  addSection(Out.LinkingSec);
-  if (Config->EmitRelocs || Config->Relocatable) {
+  addSection(out.linkingSec);
+  if (config->emitRelocs || config->relocatable) {
     createRelocSections();
   }
 
-  addSection(Out.NameSec);
-  addSection(Out.ProducersSec);
-  addSection(Out.TargetFeaturesSec);
+  addSection(out.nameSec);
+  addSection(out.producersSec);
+  addSection(out.targetFeaturesSec);
 }
 
 void Writer::finalizeSections() {
-  for (OutputSection *S : OutputSections) {
-    S->setOffset(FileSize);
-    S->finalizeContents();
-    FileSize += S->getSize();
+  for (OutputSection *s : outputSections) {
+    s->setOffset(fileSize);
+    s->finalizeContents();
+    fileSize += s->getSize();
   }
 }
 
 void Writer::populateTargetFeatures() {
-  StringMap<std::string> Used;
-  StringMap<std::string> Required;
-  StringMap<std::string> Disallowed;
+  StringMap<std::string> used;
+  StringMap<std::string> required;
+  StringMap<std::string> disallowed;
 
   // Only infer used features if user did not specify features
-  bool InferFeatures = !Config->Features.hasValue();
+  bool inferFeatures = !config->features.hasValue();
 
-  if (!InferFeatures) {
-    for (auto &Feature : Config->Features.getValue())
-      Out.TargetFeaturesSec->Features.insert(Feature);
+  if (!inferFeatures) {
+    for (auto &feature : config->features.getValue())
+      out.targetFeaturesSec->features.insert(feature);
     // No need to read or check features
-    if (!Config->CheckFeatures)
+    if (!config->checkFeatures)
       return;
   }
 
   // Find the sets of used, required, and disallowed features
-  for (ObjFile *File : Symtab->ObjectFiles) {
-    StringRef FileName(File->getName());
-    for (auto &Feature : File->getWasmObj()->getTargetFeatures()) {
-      switch (Feature.Prefix) {
+  for (ObjFile *file : symtab->objectFiles) {
+    StringRef fileName(file->getName());
+    for (auto &feature : file->getWasmObj()->getTargetFeatures()) {
+      switch (feature.Prefix) {
       case WASM_FEATURE_PREFIX_USED:
-        Used.insert({Feature.Name, FileName});
+        used.insert({feature.Name, fileName});
         break;
       case WASM_FEATURE_PREFIX_REQUIRED:
-        Used.insert({Feature.Name, FileName});
-        Required.insert({Feature.Name, FileName});
+        used.insert({feature.Name, fileName});
+        required.insert({feature.Name, fileName});
         break;
       case WASM_FEATURE_PREFIX_DISALLOWED:
-        Disallowed.insert({Feature.Name, FileName});
+        disallowed.insert({feature.Name, fileName});
         break;
       default:
         error("Unrecognized feature policy prefix " +
-              std::to_string(Feature.Prefix));
+              std::to_string(feature.Prefix));
       }
     }
   }
 
-  if (InferFeatures)
-    Out.TargetFeaturesSec->Features.insert(Used.keys().begin(),
-                                           Used.keys().end());
-
-  if (Out.TargetFeaturesSec->Features.count("atomics") &&
-      !Config->SharedMemory) {
-    if (InferFeatures)
-      error(Twine("'atomics' feature is used by ") + Used["atomics"] +
+  if (inferFeatures)
+    out.targetFeaturesSec->features.insert(used.keys().begin(),
+                                           used.keys().end());
+
+  if (out.targetFeaturesSec->features.count("atomics") &&
+      !config->sharedMemory) {
+    if (inferFeatures)
+      error(Twine("'atomics' feature is used by ") + used["atomics"] +
             ", so --shared-memory must be used");
     else
       error("'atomics' feature is used, so --shared-memory must be used");
   }
 
-  if (!Config->CheckFeatures)
+  if (!config->checkFeatures)
     return;
 
-  if (Disallowed.count("atomics") && Config->SharedMemory)
-    error("'atomics' feature is disallowed by " + Disallowed["atomics"] +
+  if (disallowed.count("atomics") && config->sharedMemory)
+    error("'atomics' feature is disallowed by " + disallowed["atomics"] +
           ", so --shared-memory must not be used");
 
-  if (!Used.count("bulk-memory") && Config->PassiveSegments)
+  if (!used.count("bulk-memory") && config->passiveSegments)
     error("'bulk-memory' feature must be used in order to emit passive "
           "segments");
 
   // Validate that used features are allowed in output
-  if (!InferFeatures) {
-    for (auto &Feature : Used.keys()) {
-      if (!Out.TargetFeaturesSec->Features.count(Feature))
-        error(Twine("Target feature '") + Feature + "' used by " +
-              Used[Feature] + " is not allowed.");
+  if (!inferFeatures) {
+    for (auto &feature : used.keys()) {
+      if (!out.targetFeaturesSec->features.count(feature))
+        error(Twine("Target feature '") + feature + "' used by " +
+              used[feature] + " is not allowed.");
     }
   }
 
   // Validate the required and disallowed constraints for each file
-  for (ObjFile *File : Symtab->ObjectFiles) {
-    StringRef FileName(File->getName());
-    SmallSet<std::string, 8> ObjectFeatures;
-    for (auto &Feature : File->getWasmObj()->getTargetFeatures()) {
-      if (Feature.Prefix == WASM_FEATURE_PREFIX_DISALLOWED)
+  for (ObjFile *file : symtab->objectFiles) {
+    StringRef fileName(file->getName());
+    SmallSet<std::string, 8> objectFeatures;
+    for (auto &feature : file->getWasmObj()->getTargetFeatures()) {
+      if (feature.Prefix == WASM_FEATURE_PREFIX_DISALLOWED)
         continue;
-      ObjectFeatures.insert(Feature.Name);
-      if (Disallowed.count(Feature.Name))
-        error(Twine("Target feature '") + Feature.Name + "' used in " +
-              FileName + " is disallowed by " + Disallowed[Feature.Name] +
+      objectFeatures.insert(feature.Name);
+      if (disallowed.count(feature.Name))
+        error(Twine("Target feature '") + feature.Name + "' used in " +
+              fileName + " is disallowed by " + disallowed[feature.Name] +
               ". Use --no-check-features to suppress.");
     }
-    for (auto &Feature : Required.keys()) {
-      if (!ObjectFeatures.count(Feature))
-        error(Twine("Missing target feature '") + Feature + "' in " + FileName +
-              ", required by " + Required[Feature] +
+    for (auto &feature : required.keys()) {
+      if (!objectFeatures.count(feature))
+        error(Twine("Missing target feature '") + feature + "' in " + fileName +
+              ", required by " + required[feature] +
               ". Use --no-check-features to suppress.");
     }
   }
 }
 
 void Writer::calculateImports() {
-  for (Symbol *Sym : Symtab->getSymbols()) {
-    if (!Sym->isUndefined())
+  for (Symbol *sym : symtab->getSymbols()) {
+    if (!sym->isUndefined())
       continue;
-    if (Sym->isWeak() && !Config->Relocatable)
+    if (sym->isWeak() && !config->relocatable)
       continue;
-    if (!Sym->isLive())
+    if (!sym->isLive())
       continue;
-    if (!Sym->IsUsedInRegularObj)
+    if (!sym->isUsedInRegularObj)
       continue;
     // We don't generate imports for data symbols. They however can be imported
     // as GOT entries.
-    if (isa<DataSymbol>(Sym))
+    if (isa<DataSymbol>(sym))
       continue;
 
-    LLVM_DEBUG(dbgs() << "import: " << Sym->getName() << "\n");
-    Out.ImportSec->addImport(Sym);
+    LLVM_DEBUG(dbgs() << "import: " << sym->getName() << "\n");
+    out.importSec->addImport(sym);
   }
 }
 
 void Writer::calculateExports() {
-  if (Config->Relocatable)
+  if (config->relocatable)
     return;
 
-  if (!Config->Relocatable && !Config->ImportMemory)
-    Out.ExportSec->Exports.push_back(
+  if (!config->relocatable && !config->importMemory)
+    out.exportSec->exports.push_back(
         WasmExport{"memory", WASM_EXTERNAL_MEMORY, 0});
 
-  if (!Config->Relocatable && Config->ExportTable)
-    Out.ExportSec->Exports.push_back(
-        WasmExport{FunctionTableName, WASM_EXTERNAL_TABLE, 0});
+  if (!config->relocatable && config->exportTable)
+    out.exportSec->exports.push_back(
+        WasmExport{functionTableName, WASM_EXTERNAL_TABLE, 0});
 
-  unsigned FakeGlobalIndex = Out.ImportSec->getNumImportedGlobals() +
-                             Out.GlobalSec->InputGlobals.size();
+  unsigned fakeGlobalIndex = out.importSec->getNumImportedGlobals() +
+                             out.globalSec->inputGlobals.size();
 
-  for (Symbol *Sym : Symtab->getSymbols()) {
-    if (!Sym->isExported())
+  for (Symbol *sym : symtab->getSymbols()) {
+    if (!sym->isExported())
       continue;
-    if (!Sym->isLive())
+    if (!sym->isLive())
       continue;
 
-    StringRef Name = Sym->getName();
-    WasmExport Export;
-    if (auto *F = dyn_cast<DefinedFunction>(Sym)) {
-      Export = {Name, WASM_EXTERNAL_FUNCTION, F->getFunctionIndex()};
-    } else if (auto *G = dyn_cast<DefinedGlobal>(Sym)) {
+    StringRef name = sym->getName();
+    WasmExport export_;
+    if (auto *f = dyn_cast<DefinedFunction>(sym)) {
+      export_ = {name, WASM_EXTERNAL_FUNCTION, f->getFunctionIndex()};
+    } else if (auto *g = dyn_cast<DefinedGlobal>(sym)) {
       // TODO(sbc): Remove this check once to mutable global proposal is
       // implement in all major browsers.
       // See: https://github.com/WebAssembly/mutable-global
-      if (G->getGlobalType()->Mutable) {
+      if (g->getGlobalType()->Mutable) {
         // Only the __stack_pointer should ever be create as mutable.
-        assert(G == WasmSym::StackPointer);
+        assert(g == WasmSym::stackPointer);
         continue;
       }
-      Export = {Name, WASM_EXTERNAL_GLOBAL, G->getGlobalIndex()};
-    } else if (auto *E = dyn_cast<DefinedEvent>(Sym)) {
-      Export = {Name, WASM_EXTERNAL_EVENT, E->getEventIndex()};
+      export_ = {name, WASM_EXTERNAL_GLOBAL, g->getGlobalIndex()};
+    } else if (auto *e = dyn_cast<DefinedEvent>(sym)) {
+      export_ = {name, WASM_EXTERNAL_EVENT, e->getEventIndex()};
     } else {
-      auto *D = cast<DefinedData>(Sym);
-      Out.GlobalSec->DefinedFakeGlobals.emplace_back(D);
-      Export = {Name, WASM_EXTERNAL_GLOBAL, FakeGlobalIndex++};
+      auto *d = cast<DefinedData>(sym);
+      out.globalSec->definedFakeGlobals.emplace_back(d);
+      export_ = {name, WASM_EXTERNAL_GLOBAL, fakeGlobalIndex++};
     }
 
-    LLVM_DEBUG(dbgs() << "Export: " << Name << "\n");
-    Out.ExportSec->Exports.push_back(Export);
+    LLVM_DEBUG(dbgs() << "Export: " << name << "\n");
+    out.exportSec->exports.push_back(export_);
   }
 }
 
 void Writer::populateSymtab() {
-  if (!Config->Relocatable && !Config->EmitRelocs)
+  if (!config->relocatable && !config->emitRelocs)
     return;
 
-  for (Symbol *Sym : Symtab->getSymbols())
-    if (Sym->IsUsedInRegularObj && Sym->isLive())
-      Out.LinkingSec->addToSymtab(Sym);
-
-  for (ObjFile *File : Symtab->ObjectFiles) {
-    LLVM_DEBUG(dbgs() << "Local symtab entries: " << File->getName() << "\n");
-    for (Symbol *Sym : File->getSymbols())
-      if (Sym->isLocal() && !isa<SectionSymbol>(Sym) && Sym->isLive())
-        Out.LinkingSec->addToSymtab(Sym);
+  for (Symbol *sym : symtab->getSymbols())
+    if (sym->isUsedInRegularObj && sym->isLive())
+      out.linkingSec->addToSymtab(sym);
+
+  for (ObjFile *file : symtab->objectFiles) {
+    LLVM_DEBUG(dbgs() << "Local symtab entries: " << file->getName() << "\n");
+    for (Symbol *sym : file->getSymbols())
+      if (sym->isLocal() && !isa<SectionSymbol>(sym) && sym->isLive())
+        out.linkingSec->addToSymtab(sym);
   }
 }
 
@@ -534,152 +534,152 @@ void Writer::calculateTypes() {
   // 4. The signatures of all imported events
   // 5. The signatures of all defined events
 
-  for (ObjFile *File : Symtab->ObjectFiles) {
-    ArrayRef<WasmSignature> Types = File->getWasmObj()->types();
-    for (uint32_t I = 0; I < Types.size(); I++)
-      if (File->TypeIsUsed[I])
-        File->TypeMap[I] = Out.TypeSec->registerType(Types[I]);
+  for (ObjFile *file : symtab->objectFiles) {
+    ArrayRef<WasmSignature> types = file->getWasmObj()->types();
+    for (uint32_t i = 0; i < types.size(); i++)
+      if (file->typeIsUsed[i])
+        file->typeMap[i] = out.typeSec->registerType(types[i]);
   }
 
-  for (const Symbol *Sym : Out.ImportSec->ImportedSymbols) {
-    if (auto *F = dyn_cast<FunctionSymbol>(Sym))
-      Out.TypeSec->registerType(*F->Signature);
-    else if (auto *E = dyn_cast<EventSymbol>(Sym))
-      Out.TypeSec->registerType(*E->Signature);
+  for (const Symbol *sym : out.importSec->importedSymbols) {
+    if (auto *f = dyn_cast<FunctionSymbol>(sym))
+      out.typeSec->registerType(*f->signature);
+    else if (auto *e = dyn_cast<EventSymbol>(sym))
+      out.typeSec->registerType(*e->signature);
   }
 
-  for (const InputFunction *F : Out.FunctionSec->InputFunctions)
-    Out.TypeSec->registerType(F->Signature);
+  for (const InputFunction *f : out.functionSec->inputFunctions)
+    out.typeSec->registerType(f->signature);
 
-  for (const InputEvent *E : Out.EventSec->InputEvents)
-    Out.TypeSec->registerType(E->Signature);
+  for (const InputEvent *e : out.eventSec->inputEvents)
+    out.typeSec->registerType(e->signature);
 }
 
 static void scanRelocations() {
-  for (ObjFile *File : Symtab->ObjectFiles) {
-    LLVM_DEBUG(dbgs() << "scanRelocations: " << File->getName() << "\n");
-    for (InputChunk *Chunk : File->Functions)
-      scanRelocations(Chunk);
-    for (InputChunk *Chunk : File->Segments)
-      scanRelocations(Chunk);
-    for (auto &P : File->CustomSections)
-      scanRelocations(P);
+  for (ObjFile *file : symtab->objectFiles) {
+    LLVM_DEBUG(dbgs() << "scanRelocations: " << file->getName() << "\n");
+    for (InputChunk *chunk : file->functions)
+      scanRelocations(chunk);
+    for (InputChunk *chunk : file->segments)
+      scanRelocations(chunk);
+    for (auto &p : file->customSections)
+      scanRelocations(p);
   }
 }
 
 void Writer::assignIndexes() {
   // Seal the import section, since other index spaces such as function and
   // global are effected by the number of imports.
-  Out.ImportSec->seal();
+  out.importSec->seal();
 
-  for (InputFunction *Func : Symtab->SyntheticFunctions)
-    Out.FunctionSec->addFunction(Func);
+  for (InputFunction *func : symtab->syntheticFunctions)
+    out.functionSec->addFunction(func);
 
-  for (ObjFile *File : Symtab->ObjectFiles) {
-    LLVM_DEBUG(dbgs() << "Functions: " << File->getName() << "\n");
-    for (InputFunction *Func : File->Functions)
-      Out.FunctionSec->addFunction(Func);
+  for (ObjFile *file : symtab->objectFiles) {
+    LLVM_DEBUG(dbgs() << "Functions: " << file->getName() << "\n");
+    for (InputFunction *func : file->functions)
+      out.functionSec->addFunction(func);
   }
 
-  for (InputGlobal *Global : Symtab->SyntheticGlobals)
-    Out.GlobalSec->addGlobal(Global);
+  for (InputGlobal *global : symtab->syntheticGlobals)
+    out.globalSec->addGlobal(global);
 
-  for (ObjFile *File : Symtab->ObjectFiles) {
-    LLVM_DEBUG(dbgs() << "Globals: " << File->getName() << "\n");
-    for (InputGlobal *Global : File->Globals)
-      Out.GlobalSec->addGlobal(Global);
+  for (ObjFile *file : symtab->objectFiles) {
+    LLVM_DEBUG(dbgs() << "Globals: " << file->getName() << "\n");
+    for (InputGlobal *global : file->globals)
+      out.globalSec->addGlobal(global);
   }
 
-  for (ObjFile *File : Symtab->ObjectFiles) {
-    LLVM_DEBUG(dbgs() << "Events: " << File->getName() << "\n");
-    for (InputEvent *Event : File->Events)
-      Out.EventSec->addEvent(Event);
+  for (ObjFile *file : symtab->objectFiles) {
+    LLVM_DEBUG(dbgs() << "Events: " << file->getName() << "\n");
+    for (InputEvent *event : file->events)
+      out.eventSec->addEvent(event);
   }
 }
 
-static StringRef getOutputDataSegmentName(StringRef Name) {
+static StringRef getOutputDataSegmentName(StringRef name) {
   // With PIC code we currently only support a single data segment since
   // we only have a single __memory_base to use as our base address.
-  if (Config->Pic)
+  if (config->isPic)
     return ".data";
-  if (!Config->MergeDataSegments)
-    return Name;
-  if (Name.startswith(".text."))
+  if (!config->mergeDataSegments)
+    return name;
+  if (name.startswith(".text."))
     return ".text";
-  if (Name.startswith(".data."))
+  if (name.startswith(".data."))
     return ".data";
-  if (Name.startswith(".bss."))
+  if (name.startswith(".bss."))
     return ".bss";
-  if (Name.startswith(".rodata."))
+  if (name.startswith(".rodata."))
     return ".rodata";
-  return Name;
+  return name;
 }
 
 void Writer::createOutputSegments() {
-  for (ObjFile *File : Symtab->ObjectFiles) {
-    for (InputSegment *Segment : File->Segments) {
-      if (!Segment->Live)
+  for (ObjFile *file : symtab->objectFiles) {
+    for (InputSegment *segment : file->segments) {
+      if (!segment->live)
         continue;
-      StringRef Name = getOutputDataSegmentName(Segment->getName());
-      OutputSegment *&S = SegmentMap[Name];
-      if (S == nullptr) {
-        LLVM_DEBUG(dbgs() << "new segment: " << Name << "\n");
-        S = make<OutputSegment>(Name, Segments.size());
-        if (Config->PassiveSegments)
-          S->InitFlags = WASM_SEGMENT_IS_PASSIVE;
-        Segments.push_back(S);
+      StringRef name = getOutputDataSegmentName(segment->getName());
+      OutputSegment *&s = segmentMap[name];
+      if (s == nullptr) {
+        LLVM_DEBUG(dbgs() << "new segment: " << name << "\n");
+        s = make<OutputSegment>(name, segments.size());
+        if (config->passiveSegments)
+          s->initFlags = WASM_SEGMENT_IS_PASSIVE;
+        segments.push_back(s);
       }
-      S->addInputSegment(Segment);
-      LLVM_DEBUG(dbgs() << "added data: " << Name << ": " << S->Size << "\n");
+      s->addInputSegment(segment);
+      LLVM_DEBUG(dbgs() << "added data: " << name << ": " << s->size << "\n");
     }
   }
 }
 
-static void createFunction(DefinedFunction *Func, StringRef BodyContent) {
-  std::string FunctionBody;
+static void createFunction(DefinedFunction *func, StringRef bodyContent) {
+  std::string functionBody;
   {
-    raw_string_ostream OS(FunctionBody);
-    writeUleb128(OS, BodyContent.size(), "function size");
-    OS << BodyContent;
+    raw_string_ostream os(functionBody);
+    writeUleb128(os, bodyContent.size(), "function size");
+    os << bodyContent;
   }
-  ArrayRef<uint8_t> Body = arrayRefFromStringRef(Saver.save(FunctionBody));
-  cast<SyntheticFunction>(Func->Function)->setBody(Body);
+  ArrayRef<uint8_t> body = arrayRefFromStringRef(saver.save(functionBody));
+  cast<SyntheticFunction>(func->function)->setBody(body);
 }
 
 void Writer::createInitMemoryFunction() {
   LLVM_DEBUG(dbgs() << "createInitMemoryFunction\n");
-  std::string BodyContent;
+  std::string bodyContent;
   {
-    raw_string_ostream OS(BodyContent);
-    writeUleb128(OS, 0, "num locals");
+    raw_string_ostream os(bodyContent);
+    writeUleb128(os, 0, "num locals");
 
     // initialize passive data segments
-    for (const OutputSegment *S : Segments) {
-      if (S->InitFlags & WASM_SEGMENT_IS_PASSIVE) {
+    for (const OutputSegment *s : segments) {
+      if (s->initFlags & WASM_SEGMENT_IS_PASSIVE) {
         // destination address
-        writeU8(OS, WASM_OPCODE_I32_CONST, "i32.const");
-        writeUleb128(OS, S->StartVA, "destination address");
+        writeU8(os, WASM_OPCODE_I32_CONST, "i32.const");
+        writeUleb128(os, s->startVA, "destination address");
         // source segment offset
-        writeU8(OS, WASM_OPCODE_I32_CONST, "i32.const");
-        writeUleb128(OS, 0, "segment offset");
+        writeU8(os, WASM_OPCODE_I32_CONST, "i32.const");
+        writeUleb128(os, 0, "segment offset");
         // memory region size
-        writeU8(OS, WASM_OPCODE_I32_CONST, "i32.const");
-        writeUleb128(OS, S->Size, "memory region size");
+        writeU8(os, WASM_OPCODE_I32_CONST, "i32.const");
+        writeUleb128(os, s->size, "memory region size");
         // memory.init instruction
-        writeU8(OS, WASM_OPCODE_MISC_PREFIX, "bulk-memory prefix");
-        writeUleb128(OS, WASM_OPCODE_MEMORY_INIT, "MEMORY.INIT");
-        writeUleb128(OS, S->Index, "segment index immediate");
-        writeU8(OS, 0, "memory index immediate");
+        writeU8(os, WASM_OPCODE_MISC_PREFIX, "bulk-memory prefix");
+        writeUleb128(os, WASM_OPCODE_MEMORY_INIT, "MEMORY.INIT");
+        writeUleb128(os, s->index, "segment index immediate");
+        writeU8(os, 0, "memory index immediate");
         // data.drop instruction
-        writeU8(OS, WASM_OPCODE_MISC_PREFIX, "bulk-memory prefix");
-        writeUleb128(OS, WASM_OPCODE_DATA_DROP, "DATA.DROP");
-        writeUleb128(OS, S->Index, "segment index immediate");
+        writeU8(os, WASM_OPCODE_MISC_PREFIX, "bulk-memory prefix");
+        writeUleb128(os, WASM_OPCODE_DATA_DROP, "DATA.DROP");
+        writeUleb128(os, s->index, "segment index immediate");
       }
     }
-    writeU8(OS, WASM_OPCODE_END, "END");
+    writeU8(os, WASM_OPCODE_END, "END");
   }
 
-  createFunction(WasmSym::InitMemory, BodyContent);
+  createFunction(WasmSym::initMemory, bodyContent);
 }
 
 // For -shared (PIC) output, we create create a synthetic function which will
@@ -689,109 +689,109 @@ void Writer::createInitMemoryFunction()
 void Writer::createApplyRelocationsFunction() {
   LLVM_DEBUG(dbgs() << "createApplyRelocationsFunction\n");
   // First write the body's contents to a string.
-  std::string BodyContent;
+  std::string bodyContent;
   {
-    raw_string_ostream OS(BodyContent);
-    writeUleb128(OS, 0, "num locals");
-    for (const OutputSegment *Seg : Segments)
-      for (const InputSegment *InSeg : Seg->InputSegments)
-        InSeg->generateRelocationCode(OS);
-    writeU8(OS, WASM_OPCODE_END, "END");
+    raw_string_ostream os(bodyContent);
+    writeUleb128(os, 0, "num locals");
+    for (const OutputSegment *seg : segments)
+      for (const InputSegment *inSeg : seg->inputSegments)
+        inSeg->generateRelocationCode(os);
+    writeU8(os, WASM_OPCODE_END, "END");
   }
 
-  createFunction(WasmSym::ApplyRelocs, BodyContent);
+  createFunction(WasmSym::applyRelocs, bodyContent);
 }
 
 // Create synthetic "__wasm_call_ctors" function based on ctor functions
 // in input object.
 void Writer::createCallCtorsFunction() {
-  if (!WasmSym::CallCtors->isLive())
+  if (!WasmSym::callCtors->isLive())
     return;
 
   // First write the body's contents to a string.
-  std::string BodyContent;
+  std::string bodyContent;
   {
-    raw_string_ostream OS(BodyContent);
-    writeUleb128(OS, 0, "num locals");
+    raw_string_ostream os(bodyContent);
+    writeUleb128(os, 0, "num locals");
 
-    if (Config->PassiveSegments) {
-      writeU8(OS, WASM_OPCODE_CALL, "CALL");
-      writeUleb128(OS, WasmSym::InitMemory->getFunctionIndex(),
+    if (config->passiveSegments) {
+      writeU8(os, WASM_OPCODE_CALL, "CALL");
+      writeUleb128(os, WasmSym::initMemory->getFunctionIndex(),
                    "function index");
     }
 
-    if (Config->Pic) {
-      writeU8(OS, WASM_OPCODE_CALL, "CALL");
-      writeUleb128(OS, WasmSym::ApplyRelocs->getFunctionIndex(),
+    if (config->isPic) {
+      writeU8(os, WASM_OPCODE_CALL, "CALL");
+      writeUleb128(os, WasmSym::applyRelocs->getFunctionIndex(),
                    "function index");
     }
 
     // Call constructors
-    for (const WasmInitEntry &F : InitFunctions) {
-      writeU8(OS, WASM_OPCODE_CALL, "CALL");
-      writeUleb128(OS, F.Sym->getFunctionIndex(), "function index");
+    for (const WasmInitEntry &f : initFunctions) {
+      writeU8(os, WASM_OPCODE_CALL, "CALL");
+      writeUleb128(os, f.sym->getFunctionIndex(), "function index");
     }
-    writeU8(OS, WASM_OPCODE_END, "END");
+    writeU8(os, WASM_OPCODE_END, "END");
   }
 
-  createFunction(WasmSym::CallCtors, BodyContent);
+  createFunction(WasmSym::callCtors, bodyContent);
 }
 
 // Populate InitFunctions vector with init functions from all input objects.
 // This is then used either when creating the output linking section or to
 // synthesize the "__wasm_call_ctors" function.
 void Writer::calculateInitFunctions() {
-  if (!Config->Relocatable && !WasmSym::CallCtors->isLive())
+  if (!config->relocatable && !WasmSym::callCtors->isLive())
     return;
 
-  for (ObjFile *File : Symtab->ObjectFiles) {
-    const WasmLinkingData &L = File->getWasmObj()->linkingData();
-    for (const WasmInitFunc &F : L.InitFunctions) {
-      FunctionSymbol *Sym = File->getFunctionSymbol(F.Symbol);
+  for (ObjFile *file : symtab->objectFiles) {
+    const WasmLinkingData &l = file->getWasmObj()->linkingData();
+    for (const WasmInitFunc &f : l.InitFunctions) {
+      FunctionSymbol *sym = file->getFunctionSymbol(f.Symbol);
       // comdat exclusions can cause init functions be discarded.
-      if (Sym->isDiscarded())
+      if (sym->isDiscarded())
         continue;
-      assert(Sym->isLive());
-      if (*Sym->Signature != WasmSignature{{}, {}})
-        error("invalid signature for init func: " + toString(*Sym));
-      InitFunctions.emplace_back(WasmInitEntry{Sym, F.Priority});
+      assert(sym->isLive());
+      if (*sym->signature != WasmSignature{{}, {}})
+        error("invalid signature for init func: " + toString(*sym));
+      initFunctions.emplace_back(WasmInitEntry{sym, f.Priority});
     }
   }
 
   // Sort in order of priority (lowest first) so that they are called
   // in the correct order.
-  llvm::stable_sort(InitFunctions,
-                    [](const WasmInitEntry &L, const WasmInitEntry &R) {
-                      return L.Priority < R.Priority;
+  llvm::stable_sort(initFunctions,
+                    [](const WasmInitEntry &l, const WasmInitEntry &r) {
+                      return l.priority < r.priority;
                     });
 }
 
 void Writer::createSyntheticSections() {
-  Out.DylinkSec = make<DylinkSection>();
-  Out.TypeSec = make<TypeSection>();
-  Out.ImportSec = make<ImportSection>();
-  Out.FunctionSec = make<FunctionSection>();
-  Out.TableSec = make<TableSection>();
-  Out.MemorySec = make<MemorySection>();
-  Out.GlobalSec = make<GlobalSection>();
-  Out.EventSec = make<EventSection>();
-  Out.ExportSec = make<ExportSection>();
-  Out.ElemSec = make<ElemSection>(TableBase);
-  Out.DataCountSec = make<DataCountSection>(Segments.size());
-  Out.LinkingSec = make<LinkingSection>(InitFunctions, Segments);
-  Out.NameSec = make<NameSection>();
-  Out.ProducersSec = make<ProducersSection>();
-  Out.TargetFeaturesSec = make<TargetFeaturesSection>();
+  out.dylinkSec = make<DylinkSection>();
+  out.typeSec = make<TypeSection>();
+  out.importSec = make<ImportSection>();
+  out.functionSec = make<FunctionSection>();
+  out.tableSec = make<TableSection>();
+  out.memorySec = make<MemorySection>();
+  out.globalSec = make<GlobalSection>();
+  out.eventSec = make<EventSection>();
+  out.exportSec = make<ExportSection>();
+  out.elemSec = make<ElemSection>(tableBase);
+  out.dataCountSec = make<DataCountSection>(segments.size());
+  out.linkingSec = make<LinkingSection>(initFunctions, segments);
+  out.nameSec = make<NameSection>();
+  out.producersSec = make<ProducersSection>();
+  out.targetFeaturesSec = make<TargetFeaturesSection>();
 }
 
 void Writer::run() {
-  if (Config->Relocatable || Config->Pic)
-    Config->GlobalBase = 0;
+  if (config->relocatable || config->isPic)
+    config->globalBase = 0;
 
   // For PIC code the table base is assigned dynamically by the loader.
   // For non-PIC, we start at 1 so that accessing table index 0 always traps.
-  if (!Config->Pic)
-    TableBase = 1;
+  if (!config->isPic)
+    tableBase = 1;
 
   log("-- createOutputSegments");
   createOutputSegments();
@@ -806,11 +806,11 @@ void Writer::run() {
   log("-- layoutMemory");
   layoutMemory();
 
-  if (!Config->Relocatable) {
+  if (!config->relocatable) {
     // Create linker synthesized __start_SECNAME/__stop_SECNAME symbols
     // This has to be done after memory layout is performed.
-    for (const OutputSegment *Seg : Segments)
-      addStartStopSymbols(Seg);
+    for (const OutputSegment *seg : segments)
+      addStartStopSymbols(seg);
   }
 
   log("-- scanRelocations");
@@ -820,11 +820,11 @@ void Writer::run() {
   log("-- calculateInitFunctions");
   calculateInitFunctions();
 
-  if (!Config->Relocatable) {
+  if (!config->relocatable) {
     // Create linker synthesized functions
-    if (Config->PassiveSegments)
+    if (config->passiveSegments)
       createInitMemoryFunction();
-    if (Config->Pic)
+    if (config->isPic)
       createApplyRelocationsFunction();
     createCallCtorsFunction();
   }
@@ -840,16 +840,16 @@ void Writer::run() {
   log("-- addSections");
   addSections();
 
-  if (errorHandler().Verbose) {
-    log("Defined Functions: " + Twine(Out.FunctionSec->InputFunctions.size()));
-    log("Defined Globals  : " + Twine(Out.GlobalSec->InputGlobals.size()));
-    log("Defined Events   : " + Twine(Out.EventSec->InputEvents.size()));
+  if (errorHandler().verbose) {
+    log("Defined Functions: " + Twine(out.functionSec->inputFunctions.size()));
+    log("Defined Globals  : " + Twine(out.globalSec->inputGlobals.size()));
+    log("Defined Events   : " + Twine(out.eventSec->inputEvents.size()));
     log("Function Imports : " +
-        Twine(Out.ImportSec->getNumImportedFunctions()));
-    log("Global Imports   : " + Twine(Out.ImportSec->getNumImportedGlobals()));
-    log("Event Imports    : " + Twine(Out.ImportSec->getNumImportedEvents()));
-    for (ObjFile *File : Symtab->ObjectFiles)
-      File->dumpInfo();
+        Twine(out.importSec->getNumImportedFunctions()));
+    log("Global Imports   : " + Twine(out.importSec->getNumImportedGlobals()));
+    log("Event Imports    : " + Twine(out.importSec->getNumImportedEvents()));
+    for (ObjFile *file : symtab->objectFiles)
+      file->dumpInfo();
   }
 
   createHeader();
@@ -868,31 +868,31 @@ void Writer::run() {
   if (errorCount())
     return;
 
-  if (Error E = Buffer->commit())
-    fatal("failed to write the output file: " + toString(std::move(E)));
+  if (Error e = buffer->commit())
+    fatal("failed to write the output file: " + toString(std::move(e)));
 }
 
 // Open a result file.
 void Writer::openFile() {
-  log("writing: " + Config->OutputFile);
+  log("writing: " + config->outputFile);
 
-  Expected<std::unique_ptr<FileOutputBuffer>> BufferOrErr =
-      FileOutputBuffer::create(Config->OutputFile, FileSize,
+  Expected<std::unique_ptr<FileOutputBuffer>> bufferOrErr =
+      FileOutputBuffer::create(config->outputFile, fileSize,
                                FileOutputBuffer::F_executable);
 
-  if (!BufferOrErr)
-    error("failed to open " + Config->OutputFile + ": " +
-          toString(BufferOrErr.takeError()));
+  if (!bufferOrErr)
+    error("failed to open " + config->outputFile + ": " +
+          toString(bufferOrErr.takeError()));
   else
-    Buffer = std::move(*BufferOrErr);
+    buffer = std::move(*bufferOrErr);
 }
 
 void Writer::createHeader() {
-  raw_string_ostream OS(Header);
-  writeBytes(OS, WasmMagic, sizeof(WasmMagic), "wasm magic");
-  writeU32(OS, WasmVersion, "wasm version");
-  OS.flush();
-  FileSize += Header.size();
+  raw_string_ostream os(header);
+  writeBytes(os, WasmMagic, sizeof(WasmMagic), "wasm magic");
+  writeU32(os, WasmVersion, "wasm version");
+  os.flush();
+  fileSize += header.size();
 }
 
 void lld::wasm::writeResult() { Writer().run(); }

Modified: lld/trunk/wasm/WriterUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/WriterUtils.cpp?rev=365730&r1=365729&r2=365730&view=diff
==============================================================================
--- lld/trunk/wasm/WriterUtils.cpp (original)
+++ lld/trunk/wasm/WriterUtils.cpp Wed Jul 10 22:40:30 2019
@@ -19,159 +19,159 @@ using namespace llvm::wasm;
 
 namespace lld {
 
-void wasm::debugWrite(uint64_t Offset, const Twine &Msg) {
-  LLVM_DEBUG(dbgs() << format("  | %08lld: ", Offset) << Msg << "\n");
+void wasm::debugWrite(uint64_t offset, const Twine &msg) {
+  LLVM_DEBUG(dbgs() << format("  | %08lld: ", offset) << msg << "\n");
 }
 
-void wasm::writeUleb128(raw_ostream &OS, uint32_t Number, const Twine &Msg) {
-  debugWrite(OS.tell(), Msg + "[" + utohexstr(Number) + "]");
-  encodeULEB128(Number, OS);
+void wasm::writeUleb128(raw_ostream &os, uint32_t number, const Twine &msg) {
+  debugWrite(os.tell(), msg + "[" + utohexstr(number) + "]");
+  encodeULEB128(number, os);
 }
 
-void wasm::writeSleb128(raw_ostream &OS, int32_t Number, const Twine &Msg) {
-  debugWrite(OS.tell(), Msg + "[" + utohexstr(Number) + "]");
-  encodeSLEB128(Number, OS);
+void wasm::writeSleb128(raw_ostream &os, int32_t number, const Twine &msg) {
+  debugWrite(os.tell(), msg + "[" + utohexstr(number) + "]");
+  encodeSLEB128(number, os);
 }
 
-void wasm::writeBytes(raw_ostream &OS, const char *Bytes, size_t Count,
-                      const Twine &Msg) {
-  debugWrite(OS.tell(), Msg + " [data[" + Twine(Count) + "]]");
-  OS.write(Bytes, Count);
+void wasm::writeBytes(raw_ostream &os, const char *bytes, size_t count,
+                      const Twine &msg) {
+  debugWrite(os.tell(), msg + " [data[" + Twine(count) + "]]");
+  os.write(bytes, count);
 }
 
-void wasm::writeStr(raw_ostream &OS, StringRef String, const Twine &Msg) {
-  debugWrite(OS.tell(),
-             Msg + " [str[" + Twine(String.size()) + "]: " + String + "]");
-  encodeULEB128(String.size(), OS);
-  OS.write(String.data(), String.size());
+void wasm::writeStr(raw_ostream &os, StringRef string, const Twine &msg) {
+  debugWrite(os.tell(),
+             msg + " [str[" + Twine(string.size()) + "]: " + string + "]");
+  encodeULEB128(string.size(), os);
+  os.write(string.data(), string.size());
 }
 
-void wasm::writeU8(raw_ostream &OS, uint8_t Byte, const Twine &Msg) {
-  debugWrite(OS.tell(), Msg + " [0x" + utohexstr(Byte) + "]");
-  OS << Byte;
+void wasm::writeU8(raw_ostream &os, uint8_t byte, const Twine &msg) {
+  debugWrite(os.tell(), msg + " [0x" + utohexstr(byte) + "]");
+  os << byte;
 }
 
-void wasm::writeU32(raw_ostream &OS, uint32_t Number, const Twine &Msg) {
-  debugWrite(OS.tell(), Msg + "[0x" + utohexstr(Number) + "]");
-  support::endian::write(OS, Number, support::little);
+void wasm::writeU32(raw_ostream &os, uint32_t number, const Twine &msg) {
+  debugWrite(os.tell(), msg + "[0x" + utohexstr(number) + "]");
+  support::endian::write(os, number, support::little);
 }
 
-void wasm::writeValueType(raw_ostream &OS, ValType Type, const Twine &Msg) {
-  writeU8(OS, static_cast<uint8_t>(Type),
-          Msg + "[type: " + toString(Type) + "]");
+void wasm::writeValueType(raw_ostream &os, ValType type, const Twine &msg) {
+  writeU8(os, static_cast<uint8_t>(type),
+          msg + "[type: " + toString(type) + "]");
 }
 
-void wasm::writeSig(raw_ostream &OS, const WasmSignature &Sig) {
-  writeU8(OS, WASM_TYPE_FUNC, "signature type");
-  writeUleb128(OS, Sig.Params.size(), "param Count");
-  for (ValType ParamType : Sig.Params) {
-    writeValueType(OS, ParamType, "param type");
+void wasm::writeSig(raw_ostream &os, const WasmSignature &sig) {
+  writeU8(os, WASM_TYPE_FUNC, "signature type");
+  writeUleb128(os, sig.Params.size(), "param Count");
+  for (ValType paramType : sig.Params) {
+    writeValueType(os, paramType, "param type");
   }
-  writeUleb128(OS, Sig.Returns.size(), "result Count");
-  if (Sig.Returns.size()) {
-    writeValueType(OS, Sig.Returns[0], "result type");
+  writeUleb128(os, sig.Returns.size(), "result Count");
+  if (sig.Returns.size()) {
+    writeValueType(os, sig.Returns[0], "result type");
   }
 }
 
-void wasm::writeInitExpr(raw_ostream &OS, const WasmInitExpr &InitExpr) {
-  writeU8(OS, InitExpr.Opcode, "opcode");
-  switch (InitExpr.Opcode) {
+void wasm::writeInitExpr(raw_ostream &os, const WasmInitExpr &initExpr) {
+  writeU8(os, initExpr.Opcode, "opcode");
+  switch (initExpr.Opcode) {
   case WASM_OPCODE_I32_CONST:
-    writeSleb128(OS, InitExpr.Value.Int32, "literal (i32)");
+    writeSleb128(os, initExpr.Value.Int32, "literal (i32)");
     break;
   case WASM_OPCODE_I64_CONST:
-    writeSleb128(OS, InitExpr.Value.Int64, "literal (i64)");
+    writeSleb128(os, initExpr.Value.Int64, "literal (i64)");
     break;
   case WASM_OPCODE_GLOBAL_GET:
-    writeUleb128(OS, InitExpr.Value.Global, "literal (global index)");
+    writeUleb128(os, initExpr.Value.Global, "literal (global index)");
     break;
   default:
-    fatal("unknown opcode in init expr: " + Twine(InitExpr.Opcode));
+    fatal("unknown opcode in init expr: " + Twine(initExpr.Opcode));
   }
-  writeU8(OS, WASM_OPCODE_END, "opcode:end");
+  writeU8(os, WASM_OPCODE_END, "opcode:end");
 }
 
-void wasm::writeLimits(raw_ostream &OS, const WasmLimits &Limits) {
-  writeU8(OS, Limits.Flags, "limits flags");
-  writeUleb128(OS, Limits.Initial, "limits initial");
-  if (Limits.Flags & WASM_LIMITS_FLAG_HAS_MAX)
-    writeUleb128(OS, Limits.Maximum, "limits max");
+void wasm::writeLimits(raw_ostream &os, const WasmLimits &limits) {
+  writeU8(os, limits.Flags, "limits flags");
+  writeUleb128(os, limits.Initial, "limits initial");
+  if (limits.Flags & WASM_LIMITS_FLAG_HAS_MAX)
+    writeUleb128(os, limits.Maximum, "limits max");
 }
 
-void wasm::writeGlobalType(raw_ostream &OS, const WasmGlobalType &Type) {
+void wasm::writeGlobalType(raw_ostream &os, const WasmGlobalType &type) {
   // TODO: Update WasmGlobalType to use ValType and remove this cast.
-  writeValueType(OS, ValType(Type.Type), "global type");
-  writeU8(OS, Type.Mutable, "global mutable");
+  writeValueType(os, ValType(type.Type), "global type");
+  writeU8(os, type.Mutable, "global mutable");
 }
 
-void wasm::writeGlobal(raw_ostream &OS, const WasmGlobal &Global) {
-  writeGlobalType(OS, Global.Type);
-  writeInitExpr(OS, Global.InitExpr);
+void wasm::writeGlobal(raw_ostream &os, const WasmGlobal &global) {
+  writeGlobalType(os, global.Type);
+  writeInitExpr(os, global.InitExpr);
 }
 
-void wasm::writeEventType(raw_ostream &OS, const WasmEventType &Type) {
-  writeUleb128(OS, Type.Attribute, "event attribute");
-  writeUleb128(OS, Type.SigIndex, "sig index");
+void wasm::writeEventType(raw_ostream &os, const WasmEventType &type) {
+  writeUleb128(os, type.Attribute, "event attribute");
+  writeUleb128(os, type.SigIndex, "sig index");
 }
 
-void wasm::writeEvent(raw_ostream &OS, const WasmEvent &Event) {
-  writeEventType(OS, Event.Type);
+void wasm::writeEvent(raw_ostream &os, const WasmEvent &event) {
+  writeEventType(os, event.Type);
 }
 
-void wasm::writeTableType(raw_ostream &OS, const llvm::wasm::WasmTable &Type) {
-  writeU8(OS, WASM_TYPE_FUNCREF, "table type");
-  writeLimits(OS, Type.Limits);
+void wasm::writeTableType(raw_ostream &os, const llvm::wasm::WasmTable &type) {
+  writeU8(os, WASM_TYPE_FUNCREF, "table type");
+  writeLimits(os, type.Limits);
 }
 
-void wasm::writeImport(raw_ostream &OS, const WasmImport &Import) {
-  writeStr(OS, Import.Module, "import module name");
-  writeStr(OS, Import.Field, "import field name");
-  writeU8(OS, Import.Kind, "import kind");
-  switch (Import.Kind) {
+void wasm::writeImport(raw_ostream &os, const WasmImport &import) {
+  writeStr(os, import.Module, "import module name");
+  writeStr(os, import.Field, "import field name");
+  writeU8(os, import.Kind, "import kind");
+  switch (import.Kind) {
   case WASM_EXTERNAL_FUNCTION:
-    writeUleb128(OS, Import.SigIndex, "import sig index");
+    writeUleb128(os, import.SigIndex, "import sig index");
     break;
   case WASM_EXTERNAL_GLOBAL:
-    writeGlobalType(OS, Import.Global);
+    writeGlobalType(os, import.Global);
     break;
   case WASM_EXTERNAL_EVENT:
-    writeEventType(OS, Import.Event);
+    writeEventType(os, import.Event);
     break;
   case WASM_EXTERNAL_MEMORY:
-    writeLimits(OS, Import.Memory);
+    writeLimits(os, import.Memory);
     break;
   case WASM_EXTERNAL_TABLE:
-    writeTableType(OS, Import.Table);
+    writeTableType(os, import.Table);
     break;
   default:
-    fatal("unsupported import type: " + Twine(Import.Kind));
+    fatal("unsupported import type: " + Twine(import.Kind));
   }
 }
 
-void wasm::writeExport(raw_ostream &OS, const WasmExport &Export) {
-  writeStr(OS, Export.Name, "export name");
-  writeU8(OS, Export.Kind, "export kind");
-  switch (Export.Kind) {
+void wasm::writeExport(raw_ostream &os, const WasmExport &export_) {
+  writeStr(os, export_.Name, "export name");
+  writeU8(os, export_.Kind, "export kind");
+  switch (export_.Kind) {
   case WASM_EXTERNAL_FUNCTION:
-    writeUleb128(OS, Export.Index, "function index");
+    writeUleb128(os, export_.Index, "function index");
     break;
   case WASM_EXTERNAL_GLOBAL:
-    writeUleb128(OS, Export.Index, "global index");
+    writeUleb128(os, export_.Index, "global index");
     break;
   case WASM_EXTERNAL_MEMORY:
-    writeUleb128(OS, Export.Index, "memory index");
+    writeUleb128(os, export_.Index, "memory index");
     break;
   case WASM_EXTERNAL_TABLE:
-    writeUleb128(OS, Export.Index, "table index");
+    writeUleb128(os, export_.Index, "table index");
     break;
   default:
-    fatal("unsupported export type: " + Twine(Export.Kind));
+    fatal("unsupported export type: " + Twine(export_.Kind));
   }
 }
 } // namespace lld
 
-std::string lld::toString(ValType Type) {
-  switch (Type) {
+std::string lld::toString(ValType type) {
+  switch (type) {
   case ValType::I32:
     return "i32";
   case ValType::I64:
@@ -188,28 +188,28 @@ std::string lld::toString(ValType Type)
   llvm_unreachable("Invalid wasm::ValType");
 }
 
-std::string lld::toString(const WasmSignature &Sig) {
-  SmallString<128> S("(");
-  for (ValType Type : Sig.Params) {
-    if (S.size() != 1)
-      S += ", ";
-    S += toString(Type);
-  }
-  S += ") -> ";
-  if (Sig.Returns.empty())
-    S += "void";
+std::string lld::toString(const WasmSignature &sig) {
+  SmallString<128> s("(");
+  for (ValType type : sig.Params) {
+    if (s.size() != 1)
+      s += ", ";
+    s += toString(type);
+  }
+  s += ") -> ";
+  if (sig.Returns.empty())
+    s += "void";
   else
-    S += toString(Sig.Returns[0]);
-  return S.str();
+    s += toString(sig.Returns[0]);
+  return s.str();
 }
 
-std::string lld::toString(const WasmGlobalType &Type) {
-  return (Type.Mutable ? "var " : "const ") +
-         toString(static_cast<ValType>(Type.Type));
+std::string lld::toString(const WasmGlobalType &type) {
+  return (type.Mutable ? "var " : "const ") +
+         toString(static_cast<ValType>(type.Type));
 }
 
-std::string lld::toString(const WasmEventType &Type) {
-  if (Type.Attribute == WASM_EVENT_ATTRIBUTE_EXCEPTION)
+std::string lld::toString(const WasmEventType &type) {
+  if (type.Attribute == WASM_EVENT_ATTRIBUTE_EXCEPTION)
     return "exception";
   return "unknown";
 }

Modified: lld/trunk/wasm/WriterUtils.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/WriterUtils.h?rev=365730&r1=365729&r2=365730&view=diff
==============================================================================
--- lld/trunk/wasm/WriterUtils.h (original)
+++ lld/trunk/wasm/WriterUtils.h Wed Jul 10 22:40:30 2019
@@ -16,50 +16,50 @@
 namespace lld {
 namespace wasm {
 
-void debugWrite(uint64_t Offset, const Twine &Msg);
+void debugWrite(uint64_t offset, const Twine &msg);
 
-void writeUleb128(raw_ostream &OS, uint32_t Number, const Twine &Msg);
+void writeUleb128(raw_ostream &os, uint32_t number, const Twine &msg);
 
-void writeSleb128(raw_ostream &OS, int32_t Number, const Twine &Msg);
+void writeSleb128(raw_ostream &os, int32_t number, const Twine &msg);
 
-void writeBytes(raw_ostream &OS, const char *Bytes, size_t count,
-                const Twine &Msg);
+void writeBytes(raw_ostream &os, const char *bytes, size_t count,
+                const Twine &msg);
 
-void writeStr(raw_ostream &OS, StringRef String, const Twine &Msg);
+void writeStr(raw_ostream &os, StringRef string, const Twine &msg);
 
-void writeU8(raw_ostream &OS, uint8_t byte, const Twine &Msg);
+void writeU8(raw_ostream &os, uint8_t byte, const Twine &msg);
 
-void writeU32(raw_ostream &OS, uint32_t Number, const Twine &Msg);
+void writeU32(raw_ostream &os, uint32_t number, const Twine &msg);
 
-void writeValueType(raw_ostream &OS, llvm::wasm::ValType Type,
-                    const Twine &Msg);
+void writeValueType(raw_ostream &os, llvm::wasm::ValType type,
+                    const Twine &msg);
 
-void writeSig(raw_ostream &OS, const llvm::wasm::WasmSignature &Sig);
+void writeSig(raw_ostream &os, const llvm::wasm::WasmSignature &sig);
 
-void writeInitExpr(raw_ostream &OS, const llvm::wasm::WasmInitExpr &InitExpr);
+void writeInitExpr(raw_ostream &os, const llvm::wasm::WasmInitExpr &initExpr);
 
-void writeLimits(raw_ostream &OS, const llvm::wasm::WasmLimits &Limits);
+void writeLimits(raw_ostream &os, const llvm::wasm::WasmLimits &limits);
 
-void writeGlobalType(raw_ostream &OS, const llvm::wasm::WasmGlobalType &Type);
+void writeGlobalType(raw_ostream &os, const llvm::wasm::WasmGlobalType &type);
 
-void writeGlobal(raw_ostream &OS, const llvm::wasm::WasmGlobal &Global);
+void writeGlobal(raw_ostream &os, const llvm::wasm::WasmGlobal &global);
 
-void writeEventType(raw_ostream &OS, const llvm::wasm::WasmEventType &Type);
+void writeEventType(raw_ostream &os, const llvm::wasm::WasmEventType &type);
 
-void writeEvent(raw_ostream &OS, const llvm::wasm::WasmEvent &Event);
+void writeEvent(raw_ostream &os, const llvm::wasm::WasmEvent &event);
 
-void writeTableType(raw_ostream &OS, const llvm::wasm::WasmTable &Type);
+void writeTableType(raw_ostream &os, const llvm::wasm::WasmTable &type);
 
-void writeImport(raw_ostream &OS, const llvm::wasm::WasmImport &Import);
+void writeImport(raw_ostream &os, const llvm::wasm::WasmImport &import);
 
-void writeExport(raw_ostream &OS, const llvm::wasm::WasmExport &Export);
+void writeExport(raw_ostream &os, const llvm::wasm::WasmExport &export_);
 
 } // namespace wasm
 
-std::string toString(llvm::wasm::ValType Type);
-std::string toString(const llvm::wasm::WasmSignature &Sig);
-std::string toString(const llvm::wasm::WasmGlobalType &Type);
-std::string toString(const llvm::wasm::WasmEventType &Type);
+std::string toString(llvm::wasm::ValType type);
+std::string toString(const llvm::wasm::WasmSignature &sig);
+std::string toString(const llvm::wasm::WasmGlobalType &type);
+std::string toString(const llvm::wasm::WasmEventType &type);
 
 } // namespace lld
 




More information about the llvm-commits mailing list