//===- Config.h -------------------------------------------------*- C++ -*-===//
//
//                             The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLD_WASM_CONFIG_H
#define LLD_WASM_CONFIG_H

#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/BinaryFormat/Wasm.h"

#include "Symbols.h"

using llvm::wasm::WasmGlobal;

namespace lld {
namespace wasm {

struct Configuration {
  bool AllowUndefined;
  bool Demangle;
  bool EmitRelocs;
  bool ImportMemory;
  bool Relocatable;
  bool StripAll;
  bool StripDebug;
  uint32_t GlobalBase;
  uint32_t InitialMemory;
  uint32_t MaxMemory;
  uint32_t ZStackSize;
  llvm::StringRef Entry;
  llvm::StringRef OutputFile;
  llvm::StringRef Sysroot;

  llvm::StringSet<> AllowUndefinedSymbols;
  std::vector<llvm::StringRef> SearchPaths;
  std::vector<std::pair<Symbol *, WasmGlobal>> SyntheticGlobals;
};

// The only instance of Configuration struct.
extern Configuration *Config;

} // namespace wasm
} // namespace lld

#endif

//===- Config.h -------------------------------------------------*- C++ -*-===//
//
//                             The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLD_WASM_CONFIG_H
#define LLD_WASM_CONFIG_H

#include "llvm/ADT/StringRef.h"
#include "llvm/BinaryFormat/Wasm.h"

#include "Symbols.h"

using llvm::wasm::WasmGlobal;

#include <set>

namespace lld {
namespace wasm {

struct Configuration {
  bool AllowUndefined;
  bool Demangle;
  bool EmitRelocs;
  bool ImportMemory;
  bool Relocatable;
  bool StripAll;
  bool StripDebug;
  uint32_t GlobalBase;
  uint32_t InitialMemory;
  uint32_t MaxMemory;
  uint32_t ZStackSize;
  llvm::StringRef Entry;
  llvm::StringRef OutputFile;
  llvm::StringRef Sysroot;

  std::set<llvm::StringRef> AllowUndefinedSymbols;
  std::vector<llvm::StringRef> SearchPaths;
  std::vector<std::pair<Symbol *, WasmGlobal>> SyntheticGlobals;
};

// The only instance of Configuration struct.
extern Configuration *Config;

} // namespace wasm
} // namespace lld

#endif

--- 
+++ 
@@ -11,13 +11,12 @@
 #define LLD_WASM_CONFIG_H
 
 #include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSet.h"
 #include "llvm/BinaryFormat/Wasm.h"
 
 #include "Symbols.h"
 
 using llvm::wasm::WasmGlobal;
-
-#include <set>
 
 namespace lld {
 namespace wasm {
@@ -38,7 +37,7 @@
   llvm::StringRef OutputFile;
   llvm::StringRef Sysroot;
 
-  std::set<llvm::StringRef> AllowUndefinedSymbols;
+  llvm::StringSet<> AllowUndefinedSymbols;
   std::vector<llvm::StringRef> SearchPaths;
   std::vector<std::pair<Symbol *, WasmGlobal>> SyntheticGlobals;
 };
Use llvm::StringSet instead of std::set.

std::set is pretty slow. We generally prefer llvm::StringSet if we don't
need an sorted set.

Differential Revision: https://reviews.llvm.org/D40579

git-svn-id: f6089bf0e6284f307027cef4f64114ee9ebb0424@319371 91177308-0d34-0410-b5e6-96231b3b80d8
