[lld] b204d7c - [ELF] Reorder InputFile members. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 29 16:10:56 PST 2022


Author: Fangrui Song
Date: 2022-01-29T16:10:52-08:00
New Revision: b204d7c4596daccdeacb4cedc88d61cb52fbcc62

URL: https://github.com/llvm/llvm-project/commit/b204d7c4596daccdeacb4cedc88d61cb52fbcc62
DIFF: https://github.com/llvm/llvm-project/commit/b204d7c4596daccdeacb4cedc88d61cb52fbcc62.diff

LOG: [ELF] Reorder InputFile members. NFC

`symbols` is used frequently. Moving it before others can decrease offsets.

Added: 
    

Modified: 
    lld/ELF/InputFiles.h

Removed: 
    


################################################################################
diff  --git a/lld/ELF/InputFiles.h b/lld/ELF/InputFiles.h
index 6febea3f437d4..44442ffe76ed6 100644
--- a/lld/ELF/InputFiles.h
+++ b/lld/ELF/InputFiles.h
@@ -55,11 +55,8 @@ void parseFile(InputFile *file);
 
 // The root class of input files.
 class InputFile {
-private:
-  // Cache for getNameForScript().
-  mutable SmallString<0> nameForScriptCache;
-
 protected:
+  SmallVector<Symbol *, 0> symbols;
   SmallVector<InputSectionBase *, 0> sections;
 
 public:
@@ -103,15 +100,6 @@ class InputFile {
   // definition.
   bool shouldExtractForCommon(StringRef name);
 
-  // If not empty, this stores the name of the archive containing this file.
-  // We use this string for creating error messages.
-  SmallString<0> archiveName;
-
-  // Cache for toString(). Only toString() should use this member.
-  mutable SmallString<0> toStringCache;
-
-  SmallVector<Symbol *, 0> symbols;
-
   // .got2 in the current file. This is used by PPC32 -fPIC/-fPIE to compute
   // offsets in PLT call stubs.
   InputSection *ppc32Got2 = nullptr;
@@ -162,6 +150,17 @@ class InputFile {
 
 protected:
   InputFile(Kind k, MemoryBufferRef m);
+
+public:
+  // If not empty, this stores the name of the archive containing this file.
+  // We use this string for creating error messages.
+  SmallString<0> archiveName;
+  // Cache for toString(). Only toString() should use this member.
+  mutable SmallString<0> toStringCache;
+
+private:
+  // Cache for getNameForScript().
+  mutable SmallString<0> nameForScriptCache;
 };
 
 class ELFFileBase : public InputFile {


        


More information about the llvm-commits mailing list