aboutsummaryrefslogtreecommitdiff
path: root/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
commit1bf9a9e6a5bdc0de7939908855dcddf46b661800 (patch)
tree81774dcc4e8eec6cbd2a95cf48e9236a1771bd30 /lib/AST/APValue.cpp
parent8213ecaa7ce2048f1e10b02f730aefb7fdda57fe (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144468 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/APValue.cpp')
-rw-r--r--lib/AST/APValue.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/AST/APValue.cpp b/lib/AST/APValue.cpp
index e64bf7cbce..146ebad055 100644
--- a/lib/AST/APValue.cpp
+++ b/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);