Skip to content
Snippets Groups Projects
Commit a63eed0f authored by Rui Ueyama's avatar Rui Ueyama
Browse files

Do not parse the same /export string more than once.

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

llvm-svn: 321513
parent e90ac016
No related branches found
No related tags found
No related merge requests found
...@@ -245,6 +245,13 @@ void LinkerDriver::parseDirectives(StringRef S) { ...@@ -245,6 +245,13 @@ void LinkerDriver::parseDirectives(StringRef S) {
Config->Entry = addUndefined(mangle(Arg->getValue())); Config->Entry = addUndefined(mangle(Arg->getValue()));
break; break;
case OPT_export: { case OPT_export: {
// If a common header file contains dllexported function
// declarations, many object files may end up with having the
// same /EXPORT options. In order to save cost of parsing them,
// we dedup them first.
if (!DirectivesExports.insert(Arg->getValue()).second)
break;
Export E = parseExport(Arg->getValue()); Export E = parseExport(Arg->getValue());
if (Config->Machine == I386 && Config->MinGW) { if (Config->Machine == I386 && Config->MinGW) {
if (!isDecorated(E.Name)) if (!isDecorated(E.Name))
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "lld/Common/Reproduce.h" #include "lld/Common/Reproduce.h"
#include "llvm/ADT/Optional.h" #include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/Object/Archive.h" #include "llvm/Object/Archive.h"
#include "llvm/Object/COFF.h" #include "llvm/Object/COFF.h"
#include "llvm/Option/Arg.h" #include "llvm/Option/Arg.h"
...@@ -127,6 +128,8 @@ private: ...@@ -127,6 +128,8 @@ private:
std::list<std::function<void()>> TaskQueue; std::list<std::function<void()>> TaskQueue;
std::vector<StringRef> FilePaths; std::vector<StringRef> FilePaths;
std::vector<MemoryBufferRef> Resources; std::vector<MemoryBufferRef> Resources;
llvm::StringSet<> DirectivesExports;
}; };
// Functions below this line are defined in DriverUtils.cpp. // Functions below this line are defined in DriverUtils.cpp.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment