[lld] dd71510 - [ELF] Simplify parseArmCMSEImportLib. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 25 15:46:57 PDT 2024


Author: Fangrui Song
Date: 2024-03-25T15:46:52-07:00
New Revision: dd7151094f94bc45668cf8629f02fe6f1975d5c9

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

LOG: [ELF] Simplify parseArmCMSEImportLib. NFC

Added: 
    

Modified: 
    lld/ELF/Config.h
    lld/ELF/InputFiles.cpp
    lld/ELF/InputFiles.h

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Config.h b/lld/ELF/Config.h
index bb3608da80b21f..27274d69b7f1f7 100644
--- a/lld/ELF/Config.h
+++ b/lld/ELF/Config.h
@@ -138,7 +138,7 @@ class LinkerDriver {
 
   std::unique_ptr<BitcodeCompiler> lto;
   std::vector<InputFile *> files;
-  std::optional<InputFile *> armCmseImpLib;
+  InputFile *armCmseImpLib = nullptr;
 
 public:
   SmallVector<std::pair<StringRef, unsigned>, 0> archiveFiles;

diff  --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index 4c614c865d24a9..1104433a5047f1 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -330,11 +330,11 @@ extern template void ObjFile<ELF32BE>::importCmseSymbols();
 extern template void ObjFile<ELF64LE>::importCmseSymbols();
 extern template void ObjFile<ELF64BE>::importCmseSymbols();
 
-template <class ELFT> static void doParseArmCMSEImportLib(InputFile *file) {
-  cast<ObjFile<ELFT>>(file)->importCmseSymbols();
+template <class ELFT> static void doParseArmCMSEImportLib(InputFile &file) {
+  cast<ObjFile<ELFT>>(file).importCmseSymbols();
 }
 
-void elf::parseArmCMSEImportLib(InputFile *file) {
+void elf::parseArmCMSEImportLib(InputFile &file) {
   invokeELFT(doParseArmCMSEImportLib, file);
 }
 

diff  --git a/lld/ELF/InputFiles.h b/lld/ELF/InputFiles.h
index 3beb5a3cb9a894..7d5dd34282758b 100644
--- a/lld/ELF/InputFiles.h
+++ b/lld/ELF/InputFiles.h
@@ -49,7 +49,7 @@ std::optional<MemoryBufferRef> readFile(StringRef path);
 template <class ELFT> void doParseFile(InputFile *file);
 void parseFile(InputFile *file);
 
-void parseArmCMSEImportLib(InputFile *file);
+void parseArmCMSEImportLib(InputFile &file);
 
 // The root class of input files.
 class InputFile {


        


More information about the llvm-commits mailing list