<div dir="ltr">Hey Rafael,<div><br></div><div>Im using Alpine linux to build the sources (source are hosted on network shared drive - case-insensitive)</div><div>In my stdc++ (string) there is include to strings.h,</div><div>then i get some funky errors (Note that /usr/include/c++/6.3.0/string includes COFF/strings.h, instead of libc++ strings.h):</div><div><br></div><div><div>Chunks.cpp.o -c ../tools/lld/COFF/Chunks.cpp</div><div> In file included from /usr/include/c++/6.3.0/bits/char_traits.h:41:0,</div><div>                  from /usr/include/c++/6.3.0/string:40,</div><div>                  from ../tools/lld/COFF/strings.h:15,</div><div>                  from /usr/include/string.h:57,</div><div>                  from /usr/include/fortify/wchar.h:24,</div><div>                  from /usr/include/c++/6.3.0/cwchar:44,</div><div>                  from /usr/include/c++/6.3.0/bits/postypes.h:40,</div><div>                  from /usr/include/c++/6.3.0/iosfwd:40,</div><div>                  from /usr/include/c++/6.3.0/ios:38,</div><div>                  from /usr/include/c++/6.3.0/ostream:38,</div><div>                  from /usr/include/c++/6.3.0/iterator:64,</div><div>                  from ../include/llvm/ADT/iterator_range.h:22,</div><div>                  from ../include/llvm/ADT/SmallVector.h:17,</div><div>                  from ../include/llvm/ADT/STLExtras.h:21,</div><div>                  from ../include/llvm/ADT/StringRef.h:13,</div><div>                  from ../tools/lld/COFF/Config.h:13,</div><div>                  from ../tools/lld/COFF/Chunks.h:13,</div><div>                  from ../tools/lld/COFF/Chunks.cpp:10:</div><div> /usr/include/c++/6.3.0/cwchar:64:11: error: '::mbstate_t' has not been declared</div><div>    using ::mbstate_t;</div><div>            ^~~~~~~~~</div><div> /usr/include/c++/6.3.0/cwchar:139:11: error: '::wint_t' has not been declared</div><div>    using ::wint_t;</div><div>            ^~~~~~</div><div> /usr/include/c++/6.3.0/cwchar:141:11: error: '::btowc' has not been declared</div><div>    using ::btowc;</div><div>            ^~~~~</div><div> /usr/include/c++/6.3.0/cwchar:142:11: error: '::fgetwc' has not been</div></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Feb 26, 2018 at 7:52 PM Rafael Avila de Espindola <<a href="mailto:rafael.espindola@gmail.com">rafael.espindola@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">What strings.h is it conflicting with?<br>
<br>
We normally build lld on Windows and OS X which have case insensitive file<br>
systems.<br>
<br>
Cheers,<br>
Rafael<br>
<br>
Hagai Cohen via Phabricator via llvm-commits<br>
<<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> writes:<br>
<br>
> DxCx created this revision.<br>
> Herald added subscribers: llvm-commits, arichardson, javed.absar, mgorny, emaste.<br>
><br>
> Hey,<br>
><br>
> I'm trying to compile lld which it's sources are on shared storage network,<br>
> unfortunately this shared resource is case-insensitive,<br>
> Then in code, there is #include <strings.h> which actually resolves into local Strings.h file.<br>
><br>
> So, this patch, will rename Strings.h to ELF/COFFString.h so the tree will be compatible with case-insensitive file system. after that resolving works just fine and lld is compiled and usable.<br>
><br>
><br>
> Repository:<br>
>   rLLD LLVM Linker<br>
><br>
> <a href="https://reviews.llvm.org/D43730" rel="noreferrer" target="_blank">https://reviews.llvm.org/D43730</a><br>
><br>
> Files:<br>
>   COFF/CMakeLists.txt<br>
>   COFF/COFFStrings.cpp<br>
>   COFF/COFFStrings.h<br>
>   COFF/Strings.cpp<br>
>   COFF/Strings.h<br>
>   COFF/Symbols.cpp<br>
>   ELF/AArch64ErrataFix.cpp<br>
>   ELF/CMakeLists.txt<br>
>   ELF/Driver.cpp<br>
>   ELF/ELFStrings.cpp<br>
>   ELF/ELFStrings.h<br>
>   ELF/EhFrame.cpp<br>
>   ELF/LinkerScript.cpp<br>
>   ELF/LinkerScript.h<br>
>   ELF/MapFile.cpp<br>
>   ELF/MarkLive.cpp<br>
>   ELF/OutputSections.cpp<br>
>   ELF/Relocations.cpp<br>
>   ELF/Strings.cpp<br>
>   ELF/Strings.h<br>
>   ELF/SymbolTable.h<br>
>   ELF/Symbols.h<br>
>   ELF/SyntheticSections.cpp<br>
>   ELF/Writer.cpp<br>
><br>
> Index: ELF/Writer.cpp<br>
> ===================================================================<br>
> --- ELF/Writer.cpp<br>
> +++ ELF/Writer.cpp<br>
> @@ -15,7 +15,7 @@<br>
>  #include "MapFile.h"<br>
>  #include "OutputSections.h"<br>
>  #include "Relocations.h"<br>
> -#include "Strings.h"<br>
> +#include "ELFStrings.h"<br>
>  #include "SymbolTable.h"<br>
>  #include "Symbols.h"<br>
>  #include "SyntheticSections.h"<br>
> Index: ELF/SyntheticSections.cpp<br>
> ===================================================================<br>
> --- ELF/SyntheticSections.cpp<br>
> +++ ELF/SyntheticSections.cpp<br>
> @@ -20,7 +20,7 @@<br>
>  #include "InputFiles.h"<br>
>  #include "LinkerScript.h"<br>
>  #include "OutputSections.h"<br>
> -#include "Strings.h"<br>
> +#include "ELFStrings.h"<br>
>  #include "SymbolTable.h"<br>
>  #include "Symbols.h"<br>
>  #include "Target.h"<br>
> Index: ELF/Symbols.h<br>
> ===================================================================<br>
> --- ELF/Symbols.h<br>
> +++ ELF/Symbols.h<br>
> @@ -16,7 +16,7 @@<br>
>  #define LLD_ELF_SYMBOLS_H<br>
><br>
>  #include "InputSection.h"<br>
> -#include "Strings.h"<br>
> +#include "ELFStrings.h"<br>
>  #include "lld/Common/LLVM.h"<br>
>  #include "llvm/Object/Archive.h"<br>
>  #include "llvm/Object/ELF.h"<br>
> Index: ELF/SymbolTable.h<br>
> ===================================================================<br>
> --- ELF/SymbolTable.h<br>
> +++ ELF/SymbolTable.h<br>
> @@ -12,7 +12,7 @@<br>
><br>
>  #include "InputFiles.h"<br>
>  #include "LTO.h"<br>
> -#include "Strings.h"<br>
> +#include "ELFStrings.h"<br>
>  #include "llvm/ADT/CachedHashString.h"<br>
>  #include "llvm/ADT/DenseMap.h"<br>
><br>
> Index: ELF/Strings.h<br>
> ===================================================================<br>
> --- ELF/Strings.h<br>
> +++ /dev/null<br>
> @@ -1,75 +0,0 @@<br>
> -//===- Strings.h ------------------------------------------------*- C++ -*-===//<br>
> -//<br>
> -//                             The LLVM Linker<br>
> -//<br>
> -// This file is distributed under the University of Illinois Open Source<br>
> -// License. See LICENSE.TXT for details.<br>
> -//<br>
> -//===----------------------------------------------------------------------===//<br>
> -<br>
> -#ifndef LLD_ELF_STRINGS_H<br>
> -#define LLD_ELF_STRINGS_H<br>
> -<br>
> -#include "lld/Common/LLVM.h"<br>
> -#include "llvm/ADT/ArrayRef.h"<br>
> -#include "llvm/ADT/BitVector.h"<br>
> -#include "llvm/ADT/Optional.h"<br>
> -#include "llvm/ADT/StringRef.h"<br>
> -#include "llvm/Support/GlobPattern.h"<br>
> -#include <vector><br>
> -<br>
> -namespace lld {<br>
> -namespace elf {<br>
> -<br>
> -std::vector<uint8_t> parseHex(StringRef S);<br>
> -bool isValidCIdentifier(StringRef S);<br>
> -<br>
> -// This is a lazy version of StringRef. String size is computed lazily<br>
> -// when it is needed. It is more efficient than StringRef to instantiate<br>
> -// if you have a string whose size is unknown.<br>
> -//<br>
> -// ELF string tables contain a lot of null-terminated strings.<br>
> -// Most of them are not necessary for the linker because they are names<br>
> -// of local symbols and the linker doesn't use local symbol names for<br>
> -// name resolution. So, we use this class to represents strings read<br>
> -// from string tables.<br>
> -class StringRefZ {<br>
> -public:<br>
> -  StringRefZ() : Start(nullptr), Size(0) {}<br>
> -  StringRefZ(const char *S, size_t Size) : Start(S), Size(Size) {}<br>
> -<br>
> -  /*implicit*/ StringRefZ(const char *S) : Start(S), Size(-1) {}<br>
> -<br>
> -  /*implicit*/ StringRefZ(llvm::StringRef S)<br>
> -      : Start(S.data()), Size(S.size()) {}<br>
> -<br>
> -  operator llvm::StringRef() const {<br>
> -    if (Size == (size_t)-1)<br>
> -      Size = strlen(Start);<br>
> -    return {Start, Size};<br>
> -  }<br>
> -<br>
> -private:<br>
> -  const char *Start;<br>
> -  mutable size_t Size;<br>
> -};<br>
> -<br>
> -// This class represents multiple glob patterns.<br>
> -class StringMatcher {<br>
> -public:<br>
> -  StringMatcher() = default;<br>
> -  explicit StringMatcher(ArrayRef<StringRef> Pat);<br>
> -<br>
> -  bool match(StringRef S) const;<br>
> -<br>
> -private:<br>
> -  std::vector<llvm::GlobPattern> Patterns;<br>
> -};<br>
> -<br>
> -inline ArrayRef<uint8_t> toArrayRef(StringRef S) {<br>
> -  return {(const uint8_t *)S.data(), S.size()};<br>
> -}<br>
> -} // namespace elf<br>
> -} // namespace lld<br>
> -<br>
> -#endif<br>
> Index: ELF/Strings.cpp<br>
> ===================================================================<br>
> --- ELF/Strings.cpp<br>
> +++ /dev/null<br>
> @@ -1,60 +0,0 @@<br>
> -//===- Strings.cpp -------------------------------------------------------===//<br>
> -//<br>
> -//                             The LLVM Linker<br>
> -//<br>
> -// This file is distributed under the University of Illinois Open Source<br>
> -// License. See LICENSE.TXT for details.<br>
> -//<br>
> -//===----------------------------------------------------------------------===//<br>
> -<br>
> -#include "Strings.h"<br>
> -#include "Config.h"<br>
> -#include "lld/Common/ErrorHandler.h"<br>
> -#include "llvm/ADT/Twine.h"<br>
> -#include "llvm/Demangle/Demangle.h"<br>
> -#include <algorithm><br>
> -#include <cstring><br>
> -<br>
> -using namespace llvm;<br>
> -using namespace lld;<br>
> -using namespace lld::elf;<br>
> -<br>
> -StringMatcher::StringMatcher(ArrayRef<StringRef> Pat) {<br>
> -  for (StringRef S : Pat) {<br>
> -    Expected<GlobPattern> Pat = GlobPattern::create(S);<br>
> -    if (!Pat)<br>
> -      error(toString(Pat.takeError()));<br>
> -    else<br>
> -      Patterns.push_back(*Pat);<br>
> -  }<br>
> -}<br>
> -<br>
> -bool StringMatcher::match(StringRef S) const {<br>
> -  for (const GlobPattern &Pat : Patterns)<br>
> -    if (Pat.match(S))<br>
> -      return true;<br>
> -  return false;<br>
> -}<br>
> -<br>
> -// Converts a hex string (e.g. "deadbeef") to a vector.<br>
> -std::vector<uint8_t> elf::parseHex(StringRef S) {<br>
> -  std::vector<uint8_t> Hex;<br>
> -  while (!S.empty()) {<br>
> -    StringRef B = S.substr(0, 2);<br>
> -    S = S.substr(2);<br>
> -    uint8_t H;<br>
> -    if (!to_integer(B, H, 16)) {<br>
> -      error("not a hexadecimal value: " + B);<br>
> -      return {};<br>
> -    }<br>
> -    Hex.push_back(H);<br>
> -  }<br>
> -  return Hex;<br>
> -}<br>
> -<br>
> -// Returns true if S is valid as a C language identifier.<br>
> -bool elf::isValidCIdentifier(StringRef S) {<br>
> -  return !S.empty() && (isAlpha(S[0]) || S[0] == '_') &&<br>
> -         std::all_of(S.begin() + 1, S.end(),<br>
> -                     [](char C) { return C == '_' || isAlnum(C); });<br>
> -}<br>
> Index: ELF/Relocations.cpp<br>
> ===================================================================<br>
> --- ELF/Relocations.cpp<br>
> +++ ELF/Relocations.cpp<br>
> @@ -45,7 +45,7 @@<br>
>  #include "Config.h"<br>
>  #include "LinkerScript.h"<br>
>  #include "OutputSections.h"<br>
> -#include "Strings.h"<br>
> +#include "ELFStrings.h"<br>
>  #include "SymbolTable.h"<br>
>  #include "Symbols.h"<br>
>  #include "SyntheticSections.h"<br>
> Index: ELF/OutputSections.cpp<br>
> ===================================================================<br>
> --- ELF/OutputSections.cpp<br>
> +++ ELF/OutputSections.cpp<br>
> @@ -10,7 +10,7 @@<br>
>  #include "OutputSections.h"<br>
>  #include "Config.h"<br>
>  #include "LinkerScript.h"<br>
> -#include "Strings.h"<br>
> +#include "ELFStrings.h"<br>
>  #include "SymbolTable.h"<br>
>  #include "SyntheticSections.h"<br>
>  #include "Target.h"<br>
> Index: ELF/MarkLive.cpp<br>
> ===================================================================<br>
> --- ELF/MarkLive.cpp<br>
> +++ ELF/MarkLive.cpp<br>
> @@ -24,7 +24,7 @@<br>
>  #include "InputSection.h"<br>
>  #include "LinkerScript.h"<br>
>  #include "OutputSections.h"<br>
> -#include "Strings.h"<br>
> +#include "ELFStrings.h"<br>
>  #include "SymbolTable.h"<br>
>  #include "Symbols.h"<br>
>  #include "Target.h"<br>
> Index: ELF/MapFile.cpp<br>
> ===================================================================<br>
> --- ELF/MapFile.cpp<br>
> +++ ELF/MapFile.cpp<br>
> @@ -23,7 +23,7 @@<br>
>  #include "InputFiles.h"<br>
>  #include "LinkerScript.h"<br>
>  #include "OutputSections.h"<br>
> -#include "Strings.h"<br>
> +#include "ELFStrings.h"<br>
>  #include "SymbolTable.h"<br>
>  #include "Symbols.h"<br>
>  #include "SyntheticSections.h"<br>
> Index: ELF/LinkerScript.h<br>
> ===================================================================<br>
> --- ELF/LinkerScript.h<br>
> +++ ELF/LinkerScript.h<br>
> @@ -11,7 +11,7 @@<br>
>  #define LLD_ELF_LINKER_SCRIPT_H<br>
><br>
>  #include "Config.h"<br>
> -#include "Strings.h"<br>
> +#include "ELFStrings.h"<br>
>  #include "Writer.h"<br>
>  #include "lld/Common/LLVM.h"<br>
>  #include "llvm/ADT/ArrayRef.h"<br>
> Index: ELF/LinkerScript.cpp<br>
> ===================================================================<br>
> --- ELF/LinkerScript.cpp<br>
> +++ ELF/LinkerScript.cpp<br>
> @@ -15,7 +15,7 @@<br>
>  #include "Config.h"<br>
>  #include "InputSection.h"<br>
>  #include "OutputSections.h"<br>
> -#include "Strings.h"<br>
> +#include "ELFStrings.h"<br>
>  #include "SymbolTable.h"<br>
>  #include "Symbols.h"<br>
>  #include "SyntheticSections.h"<br>
> Index: ELF/EhFrame.cpp<br>
> ===================================================================<br>
> --- ELF/EhFrame.cpp<br>
> +++ ELF/EhFrame.cpp<br>
> @@ -20,7 +20,7 @@<br>
>  #include "Config.h"<br>
>  #include "InputSection.h"<br>
>  #include "Relocations.h"<br>
> -#include "Strings.h"<br>
> +#include "ELFStrings.h"<br>
>  #include "lld/Common/ErrorHandler.h"<br>
>  #include "llvm/BinaryFormat/Dwarf.h"<br>
>  #include "llvm/Object/ELF.h"<br>
> Index: ELF/ELFStrings.h<br>
> ===================================================================<br>
> --- /dev/null<br>
> +++ ELF/ELFStrings.h<br>
> @@ -0,0 +1,75 @@<br>
> +//===- ELFStrings.h ---------------------------------------------*- C++ -*-===//<br>
> +//<br>
> +//                             The LLVM Linker<br>
> +//<br>
> +// This file is distributed under the University of Illinois Open Source<br>
> +// License. See LICENSE.TXT for details.<br>
> +//<br>
> +//===----------------------------------------------------------------------===//<br>
> +<br>
> +#ifndef LLD_ELF_STRINGS_H<br>
> +#define LLD_ELF_STRINGS_H<br>
> +<br>
> +#include "lld/Common/LLVM.h"<br>
> +#include "llvm/ADT/ArrayRef.h"<br>
> +#include "llvm/ADT/BitVector.h"<br>
> +#include "llvm/ADT/Optional.h"<br>
> +#include "llvm/ADT/StringRef.h"<br>
> +#include "llvm/Support/GlobPattern.h"<br>
> +#include <vector><br>
> +<br>
> +namespace lld {<br>
> +namespace elf {<br>
> +<br>
> +std::vector<uint8_t> parseHex(StringRef S);<br>
> +bool isValidCIdentifier(StringRef S);<br>
> +<br>
> +// This is a lazy version of StringRef. String size is computed lazily<br>
> +// when it is needed. It is more efficient than StringRef to instantiate<br>
> +// if you have a string whose size is unknown.<br>
> +//<br>
> +// ELF string tables contain a lot of null-terminated strings.<br>
> +// Most of them are not necessary for the linker because they are names<br>
> +// of local symbols and the linker doesn't use local symbol names for<br>
> +// name resolution. So, we use this class to represents strings read<br>
> +// from string tables.<br>
> +class StringRefZ {<br>
> +public:<br>
> +  StringRefZ() : Start(nullptr), Size(0) {}<br>
> +  StringRefZ(const char *S, size_t Size) : Start(S), Size(Size) {}<br>
> +<br>
> +  /*implicit*/ StringRefZ(const char *S) : Start(S), Size(-1) {}<br>
> +<br>
> +  /*implicit*/ StringRefZ(llvm::StringRef S)<br>
> +      : Start(S.data()), Size(S.size()) {}<br>
> +<br>
> +  operator llvm::StringRef() const {<br>
> +    if (Size == (size_t)-1)<br>
> +      Size = strlen(Start);<br>
> +    return {Start, Size};<br>
> +  }<br>
> +<br>
> +private:<br>
> +  const char *Start;<br>
> +  mutable size_t Size;<br>
> +};<br>
> +<br>
> +// This class represents multiple glob patterns.<br>
> +class StringMatcher {<br>
> +public:<br>
> +  StringMatcher() = default;<br>
> +  explicit StringMatcher(ArrayRef<StringRef> Pat);<br>
> +<br>
> +  bool match(StringRef S) const;<br>
> +<br>
> +private:<br>
> +  std::vector<llvm::GlobPattern> Patterns;<br>
> +};<br>
> +<br>
> +inline ArrayRef<uint8_t> toArrayRef(StringRef S) {<br>
> +  return {(const uint8_t *)S.data(), S.size()};<br>
> +}<br>
> +} // namespace elf<br>
> +} // namespace lld<br>
> +<br>
> +#endif<br>
> Index: ELF/ELFStrings.cpp<br>
> ===================================================================<br>
> --- /dev/null<br>
> +++ ELF/ELFStrings.cpp<br>
> @@ -0,0 +1,60 @@<br>
> +//===- Strings.cpp -------------------------------------------------------===//<br>
> +//<br>
> +//                             The LLVM Linker<br>
> +//<br>
> +// This file is distributed under the University of Illinois Open Source<br>
> +// License. See LICENSE.TXT for details.<br>
> +//<br>
> +//===----------------------------------------------------------------------===//<br>
> +<br>
> +#include "ELFStrings.h"<br>
> +#include "Config.h"<br>
> +#include "lld/Common/ErrorHandler.h"<br>
> +#include "llvm/ADT/Twine.h"<br>
> +#include "llvm/Demangle/Demangle.h"<br>
> +#include <algorithm><br>
> +#include <cstring><br>
> +<br>
> +using namespace llvm;<br>
> +using namespace lld;<br>
> +using namespace lld::elf;<br>
> +<br>
> +StringMatcher::StringMatcher(ArrayRef<StringRef> Pat) {<br>
> +  for (StringRef S : Pat) {<br>
> +    Expected<GlobPattern> Pat = GlobPattern::create(S);<br>
> +    if (!Pat)<br>
> +      error(toString(Pat.takeError()));<br>
> +    else<br>
> +      Patterns.push_back(*Pat);<br>
> +  }<br>
> +}<br>
> +<br>
> +bool StringMatcher::match(StringRef S) const {<br>
> +  for (const GlobPattern &Pat : Patterns)<br>
> +    if (Pat.match(S))<br>
> +      return true;<br>
> +  return false;<br>
> +}<br>
> +<br>
> +// Converts a hex string (e.g. "deadbeef") to a vector.<br>
> +std::vector<uint8_t> elf::parseHex(StringRef S) {<br>
> +  std::vector<uint8_t> Hex;<br>
> +  while (!S.empty()) {<br>
> +    StringRef B = S.substr(0, 2);<br>
> +    S = S.substr(2);<br>
> +    uint8_t H;<br>
> +    if (!to_integer(B, H, 16)) {<br>
> +      error("not a hexadecimal value: " + B);<br>
> +      return {};<br>
> +    }<br>
> +    Hex.push_back(H);<br>
> +  }<br>
> +  return Hex;<br>
> +}<br>
> +<br>
> +// Returns true if S is valid as a C language identifier.<br>
> +bool elf::isValidCIdentifier(StringRef S) {<br>
> +  return !S.empty() && (isAlpha(S[0]) || S[0] == '_') &&<br>
> +         std::all_of(S.begin() + 1, S.end(),<br>
> +                     [](char C) { return C == '_' || isAlnum(C); });<br>
> +}<br>
> Index: ELF/Driver.cpp<br>
> ===================================================================<br>
> --- ELF/Driver.cpp<br>
> +++ ELF/Driver.cpp<br>
> @@ -33,7 +33,7 @@<br>
>  #include "MarkLive.h"<br>
>  #include "OutputSections.h"<br>
>  #include "ScriptParser.h"<br>
> -#include "Strings.h"<br>
> +#include "ELFStrings.h"<br>
>  #include "SymbolTable.h"<br>
>  #include "Symbols.h"<br>
>  #include "SyntheticSections.h"<br>
> Index: ELF/CMakeLists.txt<br>
> ===================================================================<br>
> --- ELF/CMakeLists.txt<br>
> +++ ELF/CMakeLists.txt<br>
> @@ -35,7 +35,7 @@<br>
>    Relocations.cpp<br>
>    ScriptLexer.cpp<br>
>    ScriptParser.cpp<br>
> -  Strings.cpp<br>
> +  ELFStrings.cpp<br>
>    SymbolTable.cpp<br>
>    Symbols.cpp<br>
>    SyntheticSections.cpp<br>
> Index: ELF/AArch64ErrataFix.cpp<br>
> ===================================================================<br>
> --- ELF/AArch64ErrataFix.cpp<br>
> +++ ELF/AArch64ErrataFix.cpp<br>
> @@ -34,7 +34,7 @@<br>
>  #include "LinkerScript.h"<br>
>  #include "OutputSections.h"<br>
>  #include "Relocations.h"<br>
> -#include "Strings.h"<br>
> +#include "ELFStrings.h"<br>
>  #include "Symbols.h"<br>
>  #include "SyntheticSections.h"<br>
>  #include "Target.h"<br>
> Index: COFF/Symbols.cpp<br>
> ===================================================================<br>
> --- COFF/Symbols.cpp<br>
> +++ COFF/Symbols.cpp<br>
> @@ -9,7 +9,7 @@<br>
><br>
>  #include "Symbols.h"<br>
>  #include "InputFiles.h"<br>
> -#include "Strings.h"<br>
> +#include "COFFStrings.h"<br>
>  #include "lld/Common/ErrorHandler.h"<br>
>  #include "lld/Common/Memory.h"<br>
>  #include "llvm/ADT/STLExtras.h"<br>
> Index: COFF/Strings.h<br>
> ===================================================================<br>
> --- COFF/Strings.h<br>
> +++ /dev/null<br>
> @@ -1,23 +0,0 @@<br>
> -//===- Strings.h ------------------------------------------------*- C++ -*-===//<br>
> -//<br>
> -//                             The LLVM Linker<br>
> -//<br>
> -// This file is distributed under the University of Illinois Open Source<br>
> -// License. See LICENSE.TXT for details.<br>
> -//<br>
> -//===----------------------------------------------------------------------===//<br>
> -<br>
> -#ifndef LLD_COFF_STRINGS_H<br>
> -#define LLD_COFF_STRINGS_H<br>
> -<br>
> -#include "llvm/ADT/Optional.h"<br>
> -#include "llvm/ADT/StringRef.h"<br>
> -#include <string><br>
> -<br>
> -namespace lld {<br>
> -namespace coff {<br>
> -llvm::Optional<std::string> demangleMSVC(llvm::StringRef S);<br>
> -}<br>
> -}<br>
> -<br>
> -#endif<br>
> Index: COFF/Strings.cpp<br>
> ===================================================================<br>
> --- COFF/Strings.cpp<br>
> +++ /dev/null<br>
> @@ -1,35 +0,0 @@<br>
> -//===- Strings.cpp -------------------------------------------------------===//<br>
> -//<br>
> -//                             The LLVM Linker<br>
> -//<br>
> -// This file is distributed under the University of Illinois Open Source<br>
> -// License. See LICENSE.TXT for details.<br>
> -//<br>
> -//===----------------------------------------------------------------------===//<br>
> -<br>
> -#include "Strings.h"<br>
> -#include <mutex><br>
> -<br>
> -#if defined(_MSC_VER)<br>
> -#include <Windows.h><br>
> -#include <DbgHelp.h><br>
> -#pragma comment(lib, "dbghelp.lib")<br>
> -#endif<br>
> -<br>
> -using namespace lld;<br>
> -using namespace lld::coff;<br>
> -using namespace llvm;<br>
> -<br>
> -Optional<std::string> coff::demangleMSVC(StringRef S) {<br>
> -#if defined(_MSC_VER)<br>
> -  // UnDecorateSymbolName is not thread-safe, so we need a mutex.<br>
> -  static std::mutex Mu;<br>
> -  std::lock_guard<std::mutex> Lock(Mu);<br>
> -<br>
> -  char Buf[4096];<br>
> -  if (S.startswith("?"))<br>
> -    if (size_t Len = UnDecorateSymbolName(S.str().c_str(), Buf, sizeof(Buf), 0))<br>
> -      return std::string(Buf, Len);<br>
> -#endif<br>
> -  return None;<br>
> -}<br>
> Index: COFF/COFFStrings.h<br>
> ===================================================================<br>
> --- /dev/null<br>
> +++ COFF/COFFStrings.h<br>
> @@ -0,0 +1,23 @@<br>
> +//===- COFFStrings.h --------------------------------------------*- C++ -*-===//<br>
> +//<br>
> +//                             The LLVM Linker<br>
> +//<br>
> +// This file is distributed under the University of Illinois Open Source<br>
> +// License. See LICENSE.TXT for details.<br>
> +//<br>
> +//===----------------------------------------------------------------------===//<br>
> +<br>
> +#ifndef LLD_COFF_STRINGS_H<br>
> +#define LLD_COFF_STRINGS_H<br>
> +<br>
> +#include "llvm/ADT/Optional.h"<br>
> +#include "llvm/ADT/StringRef.h"<br>
> +#include <string><br>
> +<br>
> +namespace lld {<br>
> +namespace coff {<br>
> +llvm::Optional<std::string> demangleMSVC(llvm::StringRef S);<br>
> +}<br>
> +}<br>
> +<br>
> +#endif<br>
> Index: COFF/COFFStrings.cpp<br>
> ===================================================================<br>
> --- /dev/null<br>
> +++ COFF/COFFStrings.cpp<br>
> @@ -0,0 +1,35 @@<br>
> +//===- Strings.cpp -------------------------------------------------------===//<br>
> +//<br>
> +//                             The LLVM Linker<br>
> +//<br>
> +// This file is distributed under the University of Illinois Open Source<br>
> +// License. See LICENSE.TXT for details.<br>
> +//<br>
> +//===----------------------------------------------------------------------===//<br>
> +<br>
> +#include "COFFStrings.h"<br>
> +#include <mutex><br>
> +<br>
> +#if defined(_MSC_VER)<br>
> +#include <Windows.h><br>
> +#include <DbgHelp.h><br>
> +#pragma comment(lib, "dbghelp.lib")<br>
> +#endif<br>
> +<br>
> +using namespace lld;<br>
> +using namespace lld::coff;<br>
> +using namespace llvm;<br>
> +<br>
> +Optional<std::string> coff::demangleMSVC(StringRef S) {<br>
> +#if defined(_MSC_VER)<br>
> +  // UnDecorateSymbolName is not thread-safe, so we need a mutex.<br>
> +  static std::mutex Mu;<br>
> +  std::lock_guard<std::mutex> Lock(Mu);<br>
> +<br>
> +  char Buf[4096];<br>
> +  if (S.startswith("?"))<br>
> +    if (size_t Len = UnDecorateSymbolName(S.str().c_str(), Buf, sizeof(Buf), 0))<br>
> +      return std::string(Buf, Len);<br>
> +#endif<br>
> +  return None;<br>
> +}<br>
> Index: COFF/CMakeLists.txt<br>
> ===================================================================<br>
> --- COFF/CMakeLists.txt<br>
> +++ COFF/CMakeLists.txt<br>
> @@ -18,7 +18,7 @@<br>
>    MarkLive.cpp<br>
>    MinGW.cpp<br>
>    PDB.cpp<br>
> -  Strings.cpp<br>
> +  COFFStrings.cpp<br>
>    SymbolTable.cpp<br>
>    Symbols.cpp<br>
>    Writer.cpp<br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>