diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-02-15 02:18:13 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-02-15 02:18:13 +0000 |
commit | 83587db1bda97f45d2b5a4189e584e2a18be511a (patch) | |
tree | ce60b67476bb535994126ecd8ff1ba2a85f00000 /include/clang/AST/APValue.h | |
parent | 1d6cc6a44182ef03a373ecd61505042eca3af906 (diff) | |
download | clang-83587db1bda97f45d2b5a4189e584e2a18be511a.tar.gz clang-83587db1bda97f45d2b5a4189e584e2a18be511a.tar.bz2 clang-83587db1bda97f45d2b5a4189e584e2a18be511a.tar.xz |
Implement DR1454. This allows all intermediate results in constant expressions
to be core constant expressions (including pointers and references to
temporaries), and makes constexpr calculations Turing-complete. A Turing machine
simulator is included as a testcase.
This opens up the possibilty of removing CCValue entirely, and removing some
copies from the constant evaluator in the process, but that cleanup is not part
of this change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150557 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/AST/APValue.h')
-rw-r--r-- | include/clang/AST/APValue.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/include/clang/AST/APValue.h b/include/clang/AST/APValue.h index f361f0f5c8..f687fb7beb 100644 --- a/include/clang/AST/APValue.h +++ b/include/clang/AST/APValue.h @@ -138,14 +138,14 @@ public: APValue(const APValue &RHS) : Kind(Uninitialized) { *this = RHS; } - APValue(LValueBase B, const CharUnits &O, NoLValuePath N) + APValue(LValueBase B, const CharUnits &O, NoLValuePath N, unsigned CallIndex) : Kind(Uninitialized) { - MakeLValue(); setLValue(B, O, N); + MakeLValue(); setLValue(B, O, N, CallIndex); } APValue(LValueBase B, const CharUnits &O, ArrayRef<LValuePathEntry> Path, - bool OnePastTheEnd) + bool OnePastTheEnd, unsigned CallIndex) : Kind(Uninitialized) { - MakeLValue(); setLValue(B, O, Path, OnePastTheEnd); + MakeLValue(); setLValue(B, O, Path, OnePastTheEnd, CallIndex); } APValue(UninitArray, unsigned InitElts, unsigned Size) : Kind(Uninitialized) { MakeArray(InitElts, Size); @@ -246,6 +246,7 @@ public: bool isLValueOnePastTheEnd() const; bool hasLValuePath() const; ArrayRef<LValuePathEntry> getLValuePath() const; + unsigned getLValueCallIndex() const; APValue &getVectorElt(unsigned I) { assert(isVector() && "Invalid accessor"); @@ -365,9 +366,11 @@ public: ((ComplexAPFloat*)(char*)Data)->Real = R; ((ComplexAPFloat*)(char*)Data)->Imag = I; } - void setLValue(LValueBase B, const CharUnits &O, NoLValuePath); + void setLValue(LValueBase B, const CharUnits &O, NoLValuePath, + unsigned CallIndex); void setLValue(LValueBase B, const CharUnits &O, - ArrayRef<LValuePathEntry> Path, bool OnePastTheEnd); + ArrayRef<LValuePathEntry> Path, bool OnePastTheEnd, + unsigned CallIndex); void setUnion(const FieldDecl *Field, const APValue &Value) { assert(isUnion() && "Invalid accessor"); ((UnionData*)(char*)Data)->Field = Field; |