diff options
author | Nandor Licker <n@ndor.email> | 2019-08-30 21:17:03 +0000 |
---|---|---|
committer | Nandor Licker <n@ndor.email> | 2019-08-30 21:17:03 +0000 |
commit | 6fd9c5d50bbe0fe4b516dd2bdf6604cb44c67455 (patch) | |
tree | 8d6b426ae33b34888ef773266d4ee84cad113c46 /lib/AST/ASTContext.cpp | |
parent | 4bcc62559f5944d2b4295015b998030c10c839f0 (diff) | |
download | clang-6fd9c5d50bbe0fe4b516dd2bdf6604cb44c67455.tar.gz |
[Clang Interpreter] Initial patch for the constexpr interpreter
Summary:
This patch introduces the skeleton of the constexpr interpreter,
capable of evaluating a simple constexpr functions consisting of
if statements. The interpreter is described in more detail in the
RFC. Further patches will add more features.
Reviewers: Bigcheese, jfb, rsmith
Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64146
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370531 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r-- | lib/AST/ASTContext.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 063c202cb6..dd88c91966 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -12,6 +12,7 @@ #include "clang/AST/ASTContext.h" #include "CXXABI.h" +#include "Interp/Context.h" #include "clang/AST/APValue.h" #include "clang/AST/ASTMutationListener.h" #include "clang/AST/ASTTypeTraits.h" @@ -783,6 +784,13 @@ CXXABI *ASTContext::createCXXABI(const TargetInfo &T) { llvm_unreachable("Invalid CXXABI type!"); } +interp::Context &ASTContext::getInterpContext() { + if (!InterpContext) { + InterpContext.reset(new interp::Context(*this)); + } + return *InterpContext.get(); +} + static const LangASMap *getAddressSpaceMap(const TargetInfo &T, const LangOptions &LOpts) { if (LOpts.FakeAddressSpaceMap) { |