]> granicus.if.org Git - clang/commit
[clang-ifs] Clang Interface Stubs, first version (second landing attempt).
authorPuyan Lotfi <puyan@puyan.org>
Thu, 20 Jun 2019 16:59:48 +0000 (16:59 +0000)
committerPuyan Lotfi <puyan@puyan.org>
Thu, 20 Jun 2019 16:59:48 +0000 (16:59 +0000)
commit1e4dbd072b1775348fe61267b99461b8c332f032
tree0101b1fda40595c1178ca6b56de99bab97a5d13b
parent4aaedf6e2061969109d0cbf1acaa288b7c1b3beb
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@363948 91177308-0d34-0410-b5e6-96231b3b80d8
23 files changed:
include/clang/Basic/DiagnosticFrontendKinds.td
include/clang/Driver/Options.td
include/clang/Driver/Types.def
include/clang/Frontend/FrontendActions.h
include/clang/Frontend/FrontendOptions.h
lib/Driver/Driver.cpp
lib/Driver/ToolChains/Clang.cpp
lib/Frontend/CMakeLists.txt
lib/Frontend/CompilerInvocation.cpp
lib/Frontend/InterfaceStubFunctionsConsumer.cpp [new file with mode: 0644]
lib/FrontendTool/ExecuteCompilerInvocation.cpp
test/InterfaceStubs/bad-format.cpp [new file with mode: 0644]
test/InterfaceStubs/class-template-specialization.cpp [new file with mode: 0644]
test/InterfaceStubs/externstatic.c [new file with mode: 0644]
test/InterfaceStubs/function-template-specialization.cpp [new file with mode: 0644]
test/InterfaceStubs/hidden-class-inheritance.cpp [new file with mode: 0644]
test/InterfaceStubs/inline.c [new file with mode: 0644]
test/InterfaceStubs/inline.h [new file with mode: 0644]
test/InterfaceStubs/object.cpp [new file with mode: 0644]
test/InterfaceStubs/template-namespace-function.cpp [new file with mode: 0644]
test/InterfaceStubs/virtual.cpp [new file with mode: 0644]
test/InterfaceStubs/visibility.cpp [new file with mode: 0644]
test/InterfaceStubs/weak.cpp [new file with mode: 0644]