[lld] r357185 - Make TargetInfo const. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 28 10:05:10 PDT 2019


Author: ruiu
Date: Thu Mar 28 10:05:09 2019
New Revision: 357185

URL: http://llvm.org/viewvc/llvm-project?rev=357185&view=rev
Log:
Make TargetInfo const. NFC.

We do not mutate a TargetInfo instance after creating it. This change
makes it explicit.

Modified:
    lld/trunk/ELF/Target.cpp
    lld/trunk/ELF/Target.h

Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=357185&r1=357184&r2=357185&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Thu Mar 28 10:05:09 2019
@@ -37,7 +37,7 @@ using namespace llvm::ELF;
 using namespace lld;
 using namespace lld::elf;
 
-TargetInfo *elf::Target;
+const TargetInfo *elf::Target;
 
 std::string lld::toString(RelType Type) {
   StringRef S = getELFRelocationTypeName(elf::Config->EMachine, Type);
@@ -175,7 +175,7 @@ void TargetInfo::relaxTlsLdToLe(uint8_t
   llvm_unreachable("Should not have claimed to be relaxable");
 }
 
-uint64_t TargetInfo::getImageBase() {
+uint64_t TargetInfo::getImageBase() const {
   // Use -image-base if set. Fall back to the target default if not.
   if (Config->ImageBase)
     return *Config->ImageBase;

Modified: lld/trunk/ELF/Target.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.h?rev=357185&r1=357184&r2=357185&view=diff
==============================================================================
--- lld/trunk/ELF/Target.h (original)
+++ lld/trunk/ELF/Target.h Thu Mar 28 10:05:09 2019
@@ -84,7 +84,7 @@ public:
   unsigned PageSize = 4096;
   unsigned DefaultMaxPageSize = 4096;
 
-  uint64_t getImageBase();
+  uint64_t getImageBase() const;
 
   // Offset of _GLOBAL_OFFSET_TABLE_ from base of .got or .got.plt section.
   uint64_t GotBaseSymOff = 0;
@@ -183,7 +183,7 @@ bool isPPC64SmallCodeModelTocReloc(RelTy
 uint64_t getPPC64TocBase();
 uint64_t getAArch64Page(uint64_t Expr);
 
-extern TargetInfo *Target;
+extern const TargetInfo *Target;
 TargetInfo *getTarget();
 
 template <class ELFT> bool isMipsPIC(const Defined *Sym);




More information about the llvm-commits mailing list