diff options
author | Puyan Lotfi <puyan@puyan.org> | 2019-10-02 22:50:07 +0000 |
---|---|---|
committer | Puyan Lotfi <puyan@puyan.org> | 2019-10-02 22:50:07 +0000 |
commit | 2b8b74a6ff09a52dcd751e5429f4be32899ae3a3 (patch) | |
tree | 992233c4a6a6d5cd6e6a96aa771282b7da4e4b67 /lib/Frontend/CompilerInvocation.cpp | |
parent | 6aa1f42be9f8fc0a416590815e92e42cdad60fa3 (diff) | |
download | clang-2b8b74a6ff09a52dcd751e5429f4be32899ae3a3.tar.gz |
[clang][ifs] Clang Interface Stubs ToolChain plumbing.
This patch enables end to end support for generating ELF interface stubs
directly from clang. Now the following:
clang -emit-interface-stubs -o libfoo.so a.cpp b.cpp c.cpp
will product an ELF binary with visible symbols populated. Visibility attributes
and -fvisibility can be used to control what gets populated.
* Adding ToolChain support for clang Driver IFS Merge Phase
* Implementing a default InterfaceStubs Merge clang Tool, used by ToolChain
* Adds support for the clang Driver to involve llvm-ifs on ifs files.
* Adds -emit-merged-ifs flag, to tell llvm-ifs to emit a merged ifs text file
instead of the final object format (normally ELF)
Differential Revision: https://reviews.llvm.org/D63978
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373538 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | lib/Frontend/CompilerInvocation.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 61a2c07890..6fc8afcf3c 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -1734,24 +1734,25 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args, StringRef ArgStr = Args.hasArg(OPT_iterface_stub_version_EQ) ? Args.getLastArgValue(OPT_iterface_stub_version_EQ) - : ""; - llvm::Optional<frontend::ActionKind> ProgramAction = - llvm::StringSwitch<llvm::Optional<frontend::ActionKind>>(ArgStr) - .Case("experimental-ifs-v1", frontend::GenerateInterfaceIfsExpV1) - .Default(llvm::None); - if (!ProgramAction) { + : "experimental-ifs-v1"; + if (ArgStr == "experimental-yaml-elf-v1" || + ArgStr == "experimental-tapi-elf-v1") { std::string ErrorMessage = "Invalid interface stub format: " + ArgStr.str() + - ((ArgStr == "experimental-yaml-elf-v1" || - ArgStr == "experimental-tapi-elf-v1") - ? " is deprecated." - : "."); + " is deprecated."; + Diags.Report(diag::err_drv_invalid_value) + << "Must specify a valid interface stub format type, ie: " + "-interface-stub-version=experimental-ifs-v1" + << ErrorMessage; + } else if (ArgStr != "experimental-ifs-v1") { + std::string ErrorMessage = + "Invalid interface stub format: " + ArgStr.str() + "."; Diags.Report(diag::err_drv_invalid_value) << "Must specify a valid interface stub format type, ie: " "-interface-stub-version=experimental-ifs-v1" << ErrorMessage; } else { - Opts.ProgramAction = *ProgramAction; + Opts.ProgramAction = frontend::GenerateInterfaceIfsExpV1; } break; } |