summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/APValue.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2011-11-12 22:28:03 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2011-11-12 22:28:03 +0000
commitce40ad677e2db60b5879d9024195ed3fee5bdb4e (patch)
treebfe2279d66f6da8e10c82be30d86df40b84a0f61 /clang/lib/AST/APValue.cpp
parentf9d0f4744ec60c3db69c8552c2655d3f2ce839c7 (diff)
downloadbcm5719-llvm-ce40ad677e2db60b5879d9024195ed3fee5bdb4e.tar.gz
bcm5719-llvm-ce40ad677e2db60b5879d9024195ed3fee5bdb4e.zip
Represent an APValue based on a Decl as that Decl, rather than a DeclRefExpr
or MemberExpr which refers to it. As a side-effect, MemberExprs which refer to static member functions and static data members are now emitted as constant expressions. llvm-svn: 144468
Diffstat (limited to 'clang/lib/AST/APValue.cpp')
-rw-r--r--clang/lib/AST/APValue.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/clang/lib/AST/APValue.cpp b/clang/lib/AST/APValue.cpp
index e64bf7cbce3..146ebad0553 100644
--- a/clang/lib/AST/APValue.cpp
+++ b/clang/lib/AST/APValue.cpp
@@ -21,7 +21,7 @@ using namespace clang;
namespace {
struct LVBase {
- const Expr *Base;
+ APValue::LValueBase Base;
CharUnits Offset;
unsigned PathLength;
};
@@ -75,11 +75,6 @@ APValue::UnionData::~UnionData () {
delete Value;
}
-APValue::APValue(const Expr* B) : Kind(Uninitialized) {
- MakeLValue();
- setLValue(B, CharUnits::Zero(), ArrayRef<LValuePathEntry>());
-}
-
const APValue &APValue::operator=(const APValue &RHS) {
if (this == &RHS)
return *this;
@@ -297,7 +292,7 @@ const DiagnosticBuilder &clang::operator<<(const DiagnosticBuilder &DB,
return DB << Out.str();
}
-const Expr* APValue::getLValueBase() const {
+const APValue::LValueBase APValue::getLValueBase() const {
assert(isLValue() && "Invalid accessor");
return ((const LV*)(const void*)Data)->Base;
}
@@ -318,7 +313,7 @@ ArrayRef<APValue::LValuePathEntry> APValue::getLValuePath() const {
return ArrayRef<LValuePathEntry>(LVal.getPath(), LVal.PathLength);
}
-void APValue::setLValue(const Expr *B, const CharUnits &O, NoLValuePath) {
+void APValue::setLValue(LValueBase B, const CharUnits &O, NoLValuePath) {
assert(isLValue() && "Invalid accessor");
LV &LVal = *((LV*)(char*)Data);
LVal.freePath();
@@ -327,7 +322,7 @@ void APValue::setLValue(const Expr *B, const CharUnits &O, NoLValuePath) {
LVal.PathLength = (unsigned)-1;
}
-void APValue::setLValue(const Expr *B, const CharUnits &O,
+void APValue::setLValue(LValueBase B, const CharUnits &O,
ArrayRef<LValuePathEntry> Path) {
assert(isLValue() && "Invalid accessor");
LV &LVal = *((LV*)(char*)Data);
OpenPOWER on IntegriCloud