llvm-project/clang/unittests
Vassil Vassilev 44a4000181 [clang-repl] Land initial infrastructure for incremental parsing
In http://lists.llvm.org/pipermail/llvm-dev/2020-July/143257.html we have
mentioned our plans to make some of the incremental compilation facilities
available in llvm mainline.

This patch proposes a minimal version of a repl, clang-repl, which enables
interpreter-like interaction for C++. For instance:

./bin/clang-repl
clang-repl> int i = 42;
clang-repl> extern "C" int printf(const char*,...);
clang-repl> auto r1 = printf("i=%d\n", i);
i=42
clang-repl> quit

The patch allows very limited functionality, for example, it crashes on invalid
C++. The design of the proposed patch follows closely the design of cling. The
idea is to gather feedback and gradually evolve both clang-repl and cling to
what the community agrees upon.

The IncrementalParser class is responsible for driving the clang parser and
codegen and allows the compiler infrastructure to process more than one input.
Every input adds to the “ever-growing” translation unit. That model is enabled
by an IncrementalAction which prevents teardown when HandleTranslationUnit.

The IncrementalExecutor class hides some of the underlying implementation
details of the concrete JIT infrastructure. It exposes the minimal set of
functionality required by our incremental compiler/interpreter.

The Transaction class keeps track of the AST and the LLVM IR for each
incremental input. That tracking information will be later used to implement
error recovery.

The Interpreter class orchestrates the IncrementalParser and the
IncrementalExecutor to model interpreter-like behavior. It provides the public
API which can be used (in future) when using the interpreter library.

Differential revision: https://reviews.llvm.org/D96033
2021-05-13 04:23:24 +00:00
..
AST [clang/Basic] Make TargetInfo.h not use DataLayout again 2021-04-27 22:26:10 -04:00
ASTMatchers Make `hasTypeLoc` matcher support more node types. 2021-05-08 00:35:22 +01:00
Analysis [analyzer] Introduce MacroExpansionContext to libAnalysis 2021-02-22 11:11:57 +01:00
Basic [clang][cli] Generate and round-trip language options 2021-02-09 10:18:55 +01:00
CodeGen [clang-repl] Land initial infrastructure for incremental parsing 2021-05-13 04:23:24 +00:00
CrossTU [analyzer][CTU] API for CTU macro expansions 2021-02-22 11:12:22 +01:00
DirectoryWatcher [DirectoryWatcher] Increase timeout to make test less flaky 2021-03-05 17:49:14 -08:00
Driver [clang] accept -fsanitize-ignorelist= in addition to -fsanitize-blacklist= 2021-05-04 10:24:00 -04:00
Format [clang-format] Fix C# nullable-related errors 2021-05-06 12:11:15 +02:00
Frontend [clang] Implement CompilerInvocation copy assignment 2021-04-19 11:12:22 +02:00
Index [index] Improve macro indexing support 2021-04-06 09:12:14 -07:00
Interpreter [clang-repl] Land initial infrastructure for incremental parsing 2021-05-13 04:23:24 +00:00
Introspection [AST] Fix DeclarationNameInfo introspection 2021-04-26 18:49:13 +01:00
Lex [clang] Make sure argument expansion locations are correct in presence of predefined buffer 2020-04-22 21:01:52 +02:00
Rename [clang-rename] Handle designated initializers. 2021-04-12 13:15:14 -07:00
Rewrite [Rewrite][NFC] Add FIXMEs and tests for RemoveLineIfEmpty bug 2019-08-15 21:17:48 +00:00
Sema [clang][CodeComplete] Fix crash on ParenListExprs 2021-02-08 13:16:49 +01:00
Serialization Revert "[modules] Do not cache invalid state for modules that we attempted to load." 2020-03-10 10:59:26 -07:00
StaticAnalyzer [analyzer] Don't include private gtest headers 2021-03-22 13:31:38 +01:00
Tooling Add type information to integral template argument if required. 2021-05-12 19:00:08 +00:00
libclang [libclang] Add CXRewriter to libclang API 2020-09-04 14:17:03 -07:00
CMakeLists.txt [clang-repl] Land initial infrastructure for incremental parsing 2021-05-13 04:23:24 +00:00