<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Mon, Feb 26, 2018 at 4:27 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">Rui Ueyama via Phabricator <<a href="mailto:reviews@reviews.llvm.org" target="_blank">reviews@reviews.llvm.org</a>> writes:<br>
<br>
> Index: lld/include/lld/Common/Strings.h<br>
> ===================================================================<br>
> --- lld/include/lld/Common/Strings.h<br>
> +++ lld/include/lld/Common/Strings.h<br>
> @@ -10,14 +10,71 @@<br>
> #ifndef LLD_STRINGS_H<br>
> #define LLD_STRINGS_H<br>
><br>
> +#include "llvm/ADT/ArrayRef.h"<br>
> #include "llvm/ADT/Optional.h"<br>
> #include "llvm/ADT/StringRef.h"<br>
> +#include "llvm/Support/GlobPattern.h"<br>
> #include <string><br>
> +#include <vector><br>
> +<br>
> +namespace llvm {<br>
> +class GlobPattern;<br>
> +}<br>
<br>
Why do you need both the include and the forward declaration?<br>
<br>
<br>
> namespace lld {<br>
> // Returns a demangled C++ symbol name. If Name is not a mangled<br>
> // name, it returns Optional::None.<br>
> llvm::Optional<std::string> demangleItanium(llvm::StringRef Name);<br>
> +llvm::Optional<std::string> demangleMSVC(llvm::StringRef S);<br>
<br>
Should this be in Common? When would any linker other than COFF need<br>
this?<br></blockquote><div><br></div><div>Technically it is used only by COFF, but since these functions are so small that I think that putting everything in one file doesn't hurt. But don't you like it?</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> +std::vector<uint8_t> parseHex(llvm::StringRef S);<br>
> +bool isValidCIdentifier(llvm::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>
<br>
COFF too, no?<br>
<br>
Cheers,<br>
Rafael<br>
</blockquote></div></div>