[lld] r265297 - Try to fix the windows build.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 4 07:31:20 PDT 2016


Author: rafael
Date: Mon Apr  4 09:31:20 2016
New Revision: 265297

URL: http://llvm.org/viewvc/llvm-project?rev=265297&view=rev
Log:
Try to fix the windows build.

MSVC doesn't want StringRef in an union.

Modified:
    lld/trunk/ELF/Symbols.h

Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=265297&r1=265296&r2=265297&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Mon Apr  4 09:31:20 2016
@@ -77,7 +77,7 @@ public:
   // Returns the symbol name.
   StringRef getName() const {
     assert(!isLocal());
-    return Name;
+    return StringRef(Name.S, Name.Len);
   }
   uint32_t getNameOffset() const {
     assert(isLocal());
@@ -127,7 +127,8 @@ protected:
   SymbolBody(Kind K, StringRef Name, uint8_t Binding, uint8_t Other,
              uint8_t Type)
       : SymbolKind(K), MustBeInDynSym(false), NeedsCopyOrPltAddr(false),
-        Type(Type), Binding(Binding), Other(Other), Name(Name) {
+        Type(Type), Binding(Binding), Other(Other),
+        Name({Name.data(), Name.size()}) {
     assert(!isLocal());
     IsUsedInRegularObj =
         K != SharedKind && K != LazyKind && K != DefinedBitcodeKind;
@@ -163,8 +164,12 @@ public:
   void setVisibility(uint8_t V) { Other = (Other & ~0x3) | V; }
 
 protected:
+  struct Str {
+    const char *S;
+    size_t Len;
+  };
   union {
-    StringRef Name;
+    Str Name;
     uint32_t NameOffset;
   };
   Symbol *Backref = nullptr;




More information about the llvm-commits mailing list