aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorPuyan Lotfi <puyan@puyan.org>2019-06-20 16:59:48 +0000
committerPuyan Lotfi <puyan@puyan.org>2019-06-20 16:59:48 +0000
commit68f29dac4be8a9fc31533263c308252934d50a05 (patch)
treeec96c2ca6d78582212f9b046a3ee8de038a3519f /clang/lib/Frontend/CompilerInvocation.cpp
parentaa10f050447d2ed90ba8180b744e890d58237e93 (diff)
downloadllvm-68f29dac4be8a9fc31533263c308252934d50a05.zip
llvm-68f29dac4be8a9fc31533263c308252934d50a05.tar.gz
llvm-68f29dac4be8a9fc31533263c308252934d50a05.tar.bz2
[clang-ifs] Clang Interface Stubs, first version (second landing attempt).
This change reverts r363649; effectively re-landing r363626. At this point clang::Index::CodegenNameGeneratorImpl has been refactored into clang::AST::ASTNameGenerator. This makes it so that the previous circular link dependency no longer exists, fixing the previous share lib (-DBUILD_SHARED_LIBS=ON) build issue which was the reason for r363649. Clang interface stubs (previously referred to as clang-ifsos) is a new frontend action in clang that allows the generation of stub files that contain mangled name info that can be used to produce a stub library. These stub libraries can be useful for breaking up build dependencies and controlling access to a library's internal symbols. Generation of these stubs can be invoked by: clang -fvisibility=<visibility> -emit-interface-stubs \ -interface-stub-version=<interface format> Notice that -fvisibility (along with use of visibility attributes) can be used to control what symbols get generated. Currently the interface format is experimental but there are a wide range of possibilities here. Currently clang-ifs produces .ifs files that can be thought of as analogous to object (.o) files, but just for the mangled symbol info. In a subsequent patch I intend to add support for merging the .ifs files into one .ifs/.ifso file that can be the input to something like llvm-elfabi to produce something like a .so file or .dll (but without any of the code, just symbols). Differential Revision: https://reviews.llvm.org/D60974 llvm-svn: 363948
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index d36af28..b90950f 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1681,6 +1681,25 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
Opts.ProgramAction = frontend::GenerateHeaderModule; break;
case OPT_emit_pch:
Opts.ProgramAction = frontend::GeneratePCH; break;
+ case OPT_emit_iterface_stubs: {
+ llvm::Optional<frontend::ActionKind> ProgramAction =
+ llvm::StringSwitch<llvm::Optional<frontend::ActionKind>>(
+ Args.hasArg(OPT_iterface_stub_version_EQ)
+ ? Args.getLastArgValue(OPT_iterface_stub_version_EQ)
+ : "")
+ .Case("experimental-yaml-elf-v1",
+ frontend::GenerateInterfaceYAMLExpV1)
+ .Case("experimental-tapi-elf-v1",
+ frontend::GenerateInterfaceTBEExpV1)
+ .Default(llvm::None);
+ if (!ProgramAction)
+ Diags.Report(diag::err_drv_invalid_value)
+ << "Must specify a valid interface stub format type using "
+ << "-interface-stub-version=<experimental-tapi-elf-v1 | "
+ "experimental-yaml-elf-v1>";
+ Opts.ProgramAction = *ProgramAction;
+ break;
+ }
case OPT_init_only:
Opts.ProgramAction = frontend::InitOnly; break;
case OPT_fsyntax_only:
@@ -3119,6 +3138,8 @@ static bool isStrictlyPreprocessorAction(frontend::ActionKind Action) {
case frontend::GenerateModuleInterface:
case frontend::GenerateHeaderModule:
case frontend::GeneratePCH:
+ case frontend::GenerateInterfaceYAMLExpV1:
+ case frontend::GenerateInterfaceTBEExpV1:
case frontend::ParseSyntaxOnly:
case frontend::ModuleFileInfo:
case frontend::VerifyPCH: