[lld] [lld][ELF] Handle archive special casing in Input Sections (PR #119293)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 16 22:10:00 PST 2024


================
@@ -406,12 +406,25 @@ static inline StringRef getFilename(const InputFile *file) {
   return file ? file->getNameForScript() : StringRef();
 }
 
+static inline StringRef getArchiveName(const InputFile *file) {
+  return file ? static_cast<StringRef>(file->archiveName) : StringRef();
----------------
MaskRay wrote:

`StringRef(file->archiveName)`

https://en.cppreference.com/w/cpp/language/static_cast you were using the unnecessarily complex "If target-type is a reference type, the effect is the same as performing the declaration and initialization target-type temp(expression ); "

https://github.com/llvm/llvm-project/pull/119293


More information about the llvm-commits mailing list