Make it compile with MSVC 2013.
authorRui Ueyama <ruiu@google.com>
Tue, 17 Mar 2015 01:10:12 +0000 (01:10 +0000)
committerRui Ueyama <ruiu@google.com>
Tue, 17 Mar 2015 01:10:12 +0000 (01:10 +0000)
MSVC 2013 cannot compile this code because of C1001 "internal error".
Stop using initializer list without type name.

llvm-svn: 232448

lld/lib/ReaderWriter/ELF/DefaultLayout.h

index 13d2f5c..e457821 100644 (file)
@@ -435,11 +435,12 @@ DefaultLayout<ELFT>::getOutputSectionName(StringRef archivePath,
                                           StringRef memberPath,
                                           StringRef inputSectionName) const {
   StringRef outputSectionName;
-  if (_linkerScriptSema.hasLayoutCommands() &&
-      !(outputSectionName = _linkerScriptSema.getOutputSection(
-           {archivePath, memberPath, inputSectionName})).empty())
-    return outputSectionName;
-
+  if (_linkerScriptSema.hasLayoutCommands()) {
+    script::Sema::SectionKey key = {archivePath, memberPath, inputSectionName};
+    outputSectionName = _linkerScriptSema.getOutputSection(key);
+    if (!outputSectionName.empty())
+      return outputSectionName;
+  }
   return llvm::StringSwitch<StringRef>(inputSectionName)
       .StartsWith(".text", ".text")
       .StartsWith(".ctors", ".ctors")