[llvm] r256011 - Rename variables to reflect linker split (NFC)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 18 11:28:59 PST 2015


Author: tejohnson
Date: Fri Dec 18 13:28:59 2015
New Revision: 256011

URL: http://llvm.org/viewvc/llvm-project?rev=256011&view=rev
Log:
Rename variables to reflect linker split (NFC)

Renamed variables to be more reflective of whether they are
an instance of Linker, IRLinker or ModuleLinker. Also fix a stale
comment.

Modified:
    llvm/trunk/include/llvm/LTO/LTOCodeGenerator.h
    llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
    llvm/trunk/lib/Linker/IRMover.cpp
    llvm/trunk/lib/Linker/LinkModules.cpp

Modified: llvm/trunk/include/llvm/LTO/LTOCodeGenerator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LTO/LTOCodeGenerator.h?rev=256011&r1=256010&r2=256011&view=diff
==============================================================================
--- llvm/trunk/include/llvm/LTO/LTOCodeGenerator.h (original)
+++ llvm/trunk/include/llvm/LTO/LTOCodeGenerator.h Fri Dec 18 13:28:59 2015
@@ -171,7 +171,7 @@ private:
 
   LLVMContext &Context;
   std::unique_ptr<Module> MergedModule;
-  std::unique_ptr<Linker> IRLinker;
+  std::unique_ptr<Linker> TheLinker;
   std::unique_ptr<TargetMachine> TargetMach;
   bool EmitDwarfDebugInfo = false;
   bool ScopeRestrictionsDone = false;

Modified: llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOCodeGenerator.cpp?rev=256011&r1=256010&r2=256011&view=diff
==============================================================================
--- llvm/trunk/lib/LTO/LTOCodeGenerator.cpp (original)
+++ llvm/trunk/lib/LTO/LTOCodeGenerator.cpp Fri Dec 18 13:28:59 2015
@@ -66,7 +66,7 @@ const char* LTOCodeGenerator::getVersion
 
 LTOCodeGenerator::LTOCodeGenerator(LLVMContext &Context)
     : Context(Context), MergedModule(new Module("ld-temp.o", Context)),
-      IRLinker(new Linker(*MergedModule)) {
+      TheLinker(new Linker(*MergedModule)) {
   initializeLTOPasses();
 }
 
@@ -106,7 +106,7 @@ bool LTOCodeGenerator::addModule(LTOModu
   assert(&Mod->getModule().getContext() == &Context &&
          "Expected module in same context");
 
-  bool ret = IRLinker->linkInModule(Mod->takeModule());
+  bool ret = TheLinker->linkInModule(Mod->takeModule());
 
   const std::vector<const char *> &undefs = Mod->getAsmUndefinedRefs();
   for (int i = 0, e = undefs.size(); i != e; ++i)
@@ -122,7 +122,7 @@ void LTOCodeGenerator::setModule(std::un
   AsmUndefinedRefs.clear();
 
   MergedModule = Mod->takeModule();
-  IRLinker = make_unique<Linker>(*MergedModule);
+  TheLinker = make_unique<Linker>(*MergedModule);
 
   const std::vector<const char*> &Undefs = Mod->getAsmUndefinedRefs();
   for (int I = 0, E = Undefs.size(); I != E; ++I)

Modified: llvm/trunk/lib/Linker/IRMover.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/IRMover.cpp?rev=256011&r1=256010&r2=256011&view=diff
==============================================================================
--- llvm/trunk/lib/Linker/IRMover.cpp (original)
+++ llvm/trunk/lib/Linker/IRMover.cpp Fri Dec 18 13:28:59 2015
@@ -335,7 +335,7 @@ LinkDiagnosticInfo::LinkDiagnosticInfo(D
 void LinkDiagnosticInfo::print(DiagnosticPrinter &DP) const { DP << Msg; }
 
 //===----------------------------------------------------------------------===//
-// ModuleLinker implementation.
+// IRLinker implementation.
 //===----------------------------------------------------------------------===//
 
 namespace {
@@ -345,10 +345,10 @@ class IRLinker;
 /// speeds up linking for modules with many/ lazily linked functions of which
 /// few get used.
 class GlobalValueMaterializer final : public ValueMaterializer {
-  IRLinker *ModLinker;
+  IRLinker *TheIRLinker;
 
 public:
-  GlobalValueMaterializer(IRLinker *ModLinker) : ModLinker(ModLinker) {}
+  GlobalValueMaterializer(IRLinker *TheIRLinker) : TheIRLinker(TheIRLinker) {}
   Value *materializeDeclFor(Value *V) override;
   void materializeInitFor(GlobalValue *New, GlobalValue *Old) override;
   Metadata *mapTemporaryMetadata(Metadata *MD) override;
@@ -358,10 +358,10 @@ public:
 };
 
 class LocalValueMaterializer final : public ValueMaterializer {
-  IRLinker *ModLinker;
+  IRLinker *TheIRLinker;
 
 public:
-  LocalValueMaterializer(IRLinker *ModLinker) : ModLinker(ModLinker) {}
+  LocalValueMaterializer(IRLinker *TheIRLinker) : TheIRLinker(TheIRLinker) {}
   Value *materializeDeclFor(Value *V) override;
   void materializeInitFor(GlobalValue *New, GlobalValue *Old) override;
   Metadata *mapTemporaryMetadata(Metadata *MD) override;
@@ -567,47 +567,47 @@ static void forceRenaming(GlobalValue *G
 }
 
 Value *GlobalValueMaterializer::materializeDeclFor(Value *V) {
-  return ModLinker->materializeDeclFor(V, false);
+  return TheIRLinker->materializeDeclFor(V, false);
 }
 
 void GlobalValueMaterializer::materializeInitFor(GlobalValue *New,
                                                  GlobalValue *Old) {
-  ModLinker->materializeInitFor(New, Old, false);
+  TheIRLinker->materializeInitFor(New, Old, false);
 }
 
 Metadata *GlobalValueMaterializer::mapTemporaryMetadata(Metadata *MD) {
-  return ModLinker->mapTemporaryMetadata(MD);
+  return TheIRLinker->mapTemporaryMetadata(MD);
 }
 
 void GlobalValueMaterializer::replaceTemporaryMetadata(const Metadata *OrigMD,
                                                        Metadata *NewMD) {
-  ModLinker->replaceTemporaryMetadata(OrigMD, NewMD);
+  TheIRLinker->replaceTemporaryMetadata(OrigMD, NewMD);
 }
 
 bool GlobalValueMaterializer::isMetadataNeeded(Metadata *MD) {
-  return ModLinker->isMetadataNeeded(MD);
+  return TheIRLinker->isMetadataNeeded(MD);
 }
 
 Value *LocalValueMaterializer::materializeDeclFor(Value *V) {
-  return ModLinker->materializeDeclFor(V, true);
+  return TheIRLinker->materializeDeclFor(V, true);
 }
 
 void LocalValueMaterializer::materializeInitFor(GlobalValue *New,
                                                 GlobalValue *Old) {
-  ModLinker->materializeInitFor(New, Old, true);
+  TheIRLinker->materializeInitFor(New, Old, true);
 }
 
 Metadata *LocalValueMaterializer::mapTemporaryMetadata(Metadata *MD) {
-  return ModLinker->mapTemporaryMetadata(MD);
+  return TheIRLinker->mapTemporaryMetadata(MD);
 }
 
 void LocalValueMaterializer::replaceTemporaryMetadata(const Metadata *OrigMD,
                                                       Metadata *NewMD) {
-  ModLinker->replaceTemporaryMetadata(OrigMD, NewMD);
+  TheIRLinker->replaceTemporaryMetadata(OrigMD, NewMD);
 }
 
 bool LocalValueMaterializer::isMetadataNeeded(Metadata *MD) {
-  return ModLinker->isMetadataNeeded(MD);
+  return TheIRLinker->isMetadataNeeded(MD);
 }
 
 Value *IRLinker::materializeDeclFor(Value *V, bool ForAlias) {
@@ -1650,9 +1650,9 @@ bool IRMover::move(
     std::function<void(GlobalValue &, ValueAdder Add)> AddLazyFor,
     DenseMap<unsigned, MDNode *> *ValIDToTempMDMap,
     bool IsMetadataLinkingPostpass) {
-  IRLinker TheLinker(Composite, IdentifiedStructTypes, Src, ValuesToLink,
-                     AddLazyFor, ValIDToTempMDMap, IsMetadataLinkingPostpass);
-  bool RetCode = TheLinker.run();
+  IRLinker TheIRLinker(Composite, IdentifiedStructTypes, Src, ValuesToLink,
+                       AddLazyFor, ValIDToTempMDMap, IsMetadataLinkingPostpass);
+  bool RetCode = TheIRLinker.run();
   Composite.dropTriviallyDeadConstantArrays();
   return RetCode;
 }

Modified: llvm/trunk/lib/Linker/LinkModules.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=256011&r1=256010&r2=256011&view=diff
==============================================================================
--- llvm/trunk/lib/Linker/LinkModules.cpp (original)
+++ llvm/trunk/lib/Linker/LinkModules.cpp Fri Dec 18 13:28:59 2015
@@ -803,14 +803,14 @@ bool Linker::linkInModule(std::unique_pt
                           const FunctionInfoIndex *Index,
                           DenseSet<const GlobalValue *> *FunctionsToImport,
                           DenseMap<unsigned, MDNode *> *ValIDToTempMDMap) {
-  ModuleLinker TheLinker(Mover, *Src, Flags, Index, FunctionsToImport,
+  ModuleLinker ModLinker(Mover, *Src, Flags, Index, FunctionsToImport,
                          ValIDToTempMDMap);
-  return TheLinker.run();
+  return ModLinker.run();
 }
 
 bool Linker::linkInModuleForCAPI(Module &Src) {
-  ModuleLinker TheLinker(Mover, Src, 0, nullptr, nullptr);
-  return TheLinker.run();
+  ModuleLinker ModLinker(Mover, Src, 0, nullptr, nullptr);
+  return ModLinker.run();
 }
 
 bool Linker::linkInMetadata(Module &Src,




More information about the llvm-commits mailing list