llvm-project/clang/test
Sean Callanan 7d982509b8 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

llvm-svn: 290367
2016-12-22 20:03:14 +00:00
..
ARCMT [test/objcmt] Add a follow-up test case for r275600. 2016-07-15 20:40:24 +00:00
ASTMerge Fixed layout of test/ASTMerge. 2016-11-16 18:21:00 +00:00
Analysis [analyzer] Update GTestChecker to tighten API detection 2016-12-22 17:52:57 +00:00
CXX [c++1z] When initializing a const-qualified class type, don't forget to add on 2016-12-21 01:31:56 +00:00
CodeCompletion Fix heuristics skipping invalid ctor-initializers with C++11 2016-11-03 07:36:17 +00:00
CodeGen Add the alloc_size attribute to clang, attempt 2. 2016-12-22 02:50:20 +00:00
CodeGenCUDA [CUDA] Improve target attribute checking for function templates. 2016-12-07 19:27:16 +00:00
CodeGenCXX Add the alloc_size attribute to clang, attempt 2. 2016-12-22 02:50:20 +00:00
CodeGenCoroutines [coroutines] Add allocation and deallocation substatements. 2016-10-27 16:28:31 +00:00
CodeGenObjC Add a lit test for PR31374 2016-12-19 02:55:53 +00:00
CodeGenObjCXX Remove custom handling of array copies in lambda by-value array capture and 2016-12-14 00:03:17 +00:00
CodeGenOpenCL Add the alloc_size attribute to clang, attempt 2. 2016-12-22 02:50:20 +00:00
Coverage Make output of -ast-print a valid C++ code. 2016-11-10 08:49:37 +00:00
CoverageMapping [Coverage] Support for C++17 if initializers 2016-10-14 23:38:16 +00:00
Driver [analyzer] Add checker modeling gtest APIs. 2016-12-19 22:50:31 +00:00
FixIt Make some diagnostic tests C++11 clean. 2016-12-21 18:33:17 +00:00
Format Make clang-format remove duplicate headers when sorting #includes. 2016-08-10 09:32:23 +00:00
Frontend [Frontend] Fix an issue where a quoted search path is incorrectly 2016-12-02 09:51:51 +00:00
Headers Revert "[Headers] Add #include_next for tgmath.h on Darwin" 2016-12-12 23:06:58 +00:00
Import Testbed and skeleton of a new expression parser 2016-12-22 20:03:14 +00:00
Index Fix for clang_Cursor_getSpellingNameRange() 2016-12-20 09:56:56 +00:00
Integration
Layout
Lexer Add __cpp_structured_bindings feature test macro for structured bindings, per 2016-12-19 04:21:36 +00:00
Misc Store decls in prototypes on the declarator instead of in the AST 2016-12-09 17:14:05 +00:00
Modules [CrashReproducer] Add support for merging -ivfsoverlay 2016-12-22 07:06:03 +00:00
OpenMP [OPENMP] Fix for PR31417: assert failure when compiling trivial openmp 2016-12-22 19:44:05 +00:00
PCH [c++1z] P0195R2: Support pack-expansion of using-declarations. 2016-12-20 21:35:28 +00:00
Parser Make some diagnostic tests C++11 clean. 2016-12-21 18:33:17 +00:00
Preprocessor ARM: define a macro for the FPv5 FPU in ARM mode. 2016-12-21 20:49:43 +00:00
Profile Add test for D21736. 2016-11-22 20:03:40 +00:00
Rewriter Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
Sema Make alloc_size only applicable to Functions. 2016-12-22 18:48:34 +00:00
SemaCUDA [CUDA] Ignore implicit target attributes during function template instantiation. 2016-12-08 19:38:13 +00:00
SemaCXX Sema: print qualified name for overload candidates 2016-12-22 04:26:57 +00:00
SemaObjC Fix printf specifier handling: invalid specifier should not be marked as "consuming data arguments" 2016-12-15 18:54:00 +00:00
SemaObjCXX Add fix-it notes to the nullability consistency warning. 2016-12-19 20:58:20 +00:00
SemaOpenCL Revert "[OpenCL] Enabling the usage of CLK_NULL_QUEUE as compare operand." 2016-12-20 10:05:04 +00:00
SemaTemplate Perform type-checking for a converted constant expression in a template 2016-12-21 21:42:57 +00:00
TableGen
Tooling
Unit [test] Extend llvm_shlib_dir fix to unittests 2016-12-15 20:31:08 +00:00
VFS Don't diagnose non-modular includes when we are not compiling a module. 2016-08-26 17:16:46 +00:00
.clang-format
CMakeLists.txt Testbed and skeleton of a new expression parser 2016-12-22 20:03:14 +00:00
TestRunner.sh
cxx-sections.data
lit.cfg [test] Correctly include build llvm_shlib_dir in stand-alone builds 2016-11-15 12:54:10 +00:00
lit.site.cfg.in XFAIL Driver/darwin-stdlib.cpp if CLANG_DEFAULT_CXX_STDLIB is set 2016-09-29 07:43:08 +00:00
make_test_dirs.pl