[lld] r276315 - Fix MSVC 2015 compilation failure around range-for without curly braces

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 21 11:39:29 PDT 2016


Author: rnk
Date: Thu Jul 21 13:39:28 2016
New Revision: 276315

URL: http://llvm.org/viewvc/llvm-project?rev=276315&view=rev
Log:
Fix MSVC 2015 compilation failure around range-for without curly braces

It doesn't appear to like this pattern:
  for (auto X : Xs)
    if (...) { ... }
    else ...;

We have heard anecdotes that range based for loops are implemented as a
token rewrite in MSVC's lexer, and that the most challenging part of the
rewrite is finding the end of the for loop. That makes sense, given that
it's a lexer.

Modified:
    lld/trunk/ELF/LinkerScript.cpp

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=276315&r1=276314&r2=276315&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Thu Jul 21 13:39:28 2016
@@ -266,12 +266,13 @@ LinkerScript<ELFT>::createSections(Outpu
 
   // Add all other input sections, which are not listed in script.
   for (ObjectFile &F : Symtab<ELFT>::X->getObjectFiles())
-    for (InputSectionBase<ELFT> *S : F->getSections())
+    for (InputSectionBase<ELFT> *S : F->getSections()) {
       if (!isDiscarded(S)) {
         if (!S->OutSec)
           AddInputSec(S, getOutputSectionName(S));
       } else
         reportDiscarded(S, F);
+    }
 
   return Result;
 }




More information about the llvm-commits mailing list