diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2011-05-13 03:29:01 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2011-05-13 03:29:01 +0000 |
commit | 8cad3046be06ea73ff8892d947697a21d7a440d3 (patch) | |
tree | 8d25db178ef793091b7e0713454caed619d16f96 /lib/AST/APValue.cpp | |
parent | 7999991060b136db49eb9d6b34595383de56278c (diff) |
Refactoring of constant expression evaluator
This introduces a generic base class for the expression evaluator
classes, which handles a few common expression types which were
previously handled separately in each class. Also, the expression
evaluator now uses ConstStmtVisitor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131281 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/APValue.cpp')
-rw-r--r-- | lib/AST/APValue.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/AST/APValue.cpp b/lib/AST/APValue.cpp index 731d5e0466..ebe99b12cd 100644 --- a/lib/AST/APValue.cpp +++ b/lib/AST/APValue.cpp @@ -18,12 +18,12 @@ using namespace clang; namespace { struct LV { - Expr* Base; + const Expr* Base; CharUnits Offset; }; } -APValue::APValue(Expr* B) : Kind(Uninitialized) { +APValue::APValue(const Expr* B) : Kind(Uninitialized) { MakeLValue(); setLValue(B, CharUnits::Zero()); } @@ -118,7 +118,7 @@ void APValue::print(llvm::raw_ostream &OS) const { } } -Expr* APValue::getLValueBase() const { +const Expr* APValue::getLValueBase() const { assert(isLValue() && "Invalid accessor"); return ((const LV*)(const void*)Data)->Base; } @@ -128,7 +128,7 @@ CharUnits APValue::getLValueOffset() const { return ((const LV*)(const void*)Data)->Offset; } -void APValue::setLValue(Expr *B, const CharUnits &O) { +void APValue::setLValue(const Expr *B, const CharUnits &O) { assert(isLValue() && "Invalid accessor"); ((LV*)(char*)Data)->Base = B; ((LV*)(char*)Data)->Offset = O; |