summaryrefslogtreecommitdiff
path: root/tools/clang-import-test/CMakeLists.txt
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2016-12-22 20:03:14 +0000
committerSean Callanan <scallanan@apple.com>2016-12-22 20:03:14 +0000
commit7488de2e0d02f754961a8c540c57b5898551853a (patch)
tree7c322154fd00eb1e8a84d42ac432f6485631c131 /tools/clang-import-test/CMakeLists.txt
parenta9408833699a0e2cfc7c7349e53e743deaf1cd77 (diff)
Testbed and skeleton of a new expression parser
Recommitted after formal approval. LLVM's JIT is now the foundation of dynamic-compilation features for many languages. Clang also has low-level support for dynamic compilation (ASTImporter and ExternalASTSource, notably). How the compiler is set up for dynamic parsing is generally left up to individual clients, for example LLDB's C/C++/Objective-C expression parser and the ROOT project. Although this arrangement offers external clients the flexibility to implement dynamic features as they see fit, the lack of an in-tree client means that subtle bugs can be introduced that cause regressions in the external clients but aren't caught by tests (or users) until much later. LLDB for example regularly encounters complicated ODR violation scenarios where it is not immediately clear who is at fault. Other external clients (notably, Cling) rely on similar functionality, and another goal is to break this functionality up into composable parts so that any client can be built easily on top of Clang without requiring extensive additional code. I propose that the parts required to build a simple expression parser be added to Clang. Initially, I aim to have the following features: A piece that looks up external declarations from a variety of sources (e.g., from previous dynamic compilations, from modules, or from DWARF) and uses clear conflict resolution rules to reconcile differences, with easily understood errors. This functionality will be supported by in-tree tests. A piece that works hand in hand with the LLVM JIT to resolve the locations of external declarations so that e.g. variables can be redeclared and (for high-performance applications like DTrace) external variables can be accessed directly from the registers where they reside. This commit adds a tester that parses a sequence of source files and then uses them as source data for an expression. External references are resolved using an ExternalASTSource that responds to name queries using an ASTImporter. This is the setup that LLDB uses, and the motivating reason for MinimalImport in ASTImporter. When complete, this tester will implement the first of the above goals. Differential Revision: https://reviews.llvm.org/D27180 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290367 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/clang-import-test/CMakeLists.txt')
-rw-r--r--tools/clang-import-test/CMakeLists.txt27
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/clang-import-test/CMakeLists.txt b/tools/clang-import-test/CMakeLists.txt
new file mode 100644
index 0000000000..bd4919694a
--- /dev/null
+++ b/tools/clang-import-test/CMakeLists.txt
@@ -0,0 +1,27 @@
+set(LLVM_LINK_COMPONENTS
+ core
+ support
+)
+
+if(NOT CLANG_BUILT_STANDALONE)
+ set(tablegen_deps intrinsics_gen)
+endif()
+
+add_clang_tool(clang-import-test
+ clang-import-test.cpp
+ DEPENDS
+ ${tablegen_deps}
+ )
+
+set(CLANG_IMPORT_TEST_LIB_DEPS
+ clangAST
+ clangBasic
+ clangCodeGen
+ clangFrontend
+ clangLex
+ clangParse
+ )
+
+target_link_libraries(clang-import-test
+ ${CLANG_IMPORT_TEST_LIB_DEPS}
+ )