aboutsummaryrefslogtreecommitdiff
path: root/include/clang/AST/APValue.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/AST/APValue.h')
-rw-r--r--include/clang/AST/APValue.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/include/clang/AST/APValue.h b/include/clang/AST/APValue.h
index b7e588fba4..1b6e90cf4a 100644
--- a/include/clang/AST/APValue.h
+++ b/include/clang/AST/APValue.h
@@ -135,9 +135,7 @@ public:
APValue(const APFloat &R, const APFloat &I) : Kind(Uninitialized) {
MakeComplexFloat(); setComplexFloat(R, I);
}
- APValue(const APValue &RHS) : Kind(Uninitialized) {
- *this = RHS;
- }
+ APValue(const APValue &RHS);
APValue(LValueBase B, const CharUnits &O, NoLValuePath N, unsigned CallIndex)
: Kind(Uninitialized) {
MakeLValue(); setLValue(B, O, N, CallIndex);
@@ -170,6 +168,9 @@ public:
MakeUninit();
}
+ /// \brief Swaps the contents of this and the given APValue.
+ void swap(APValue &RHS);
+
ValueKind getKind() const { return Kind; }
bool isUninit() const { return Kind == Uninitialized; }
bool isInt() const { return Kind == Int; }
@@ -382,7 +383,11 @@ public:
((AddrLabelDiffData*)(char*)Data)->RHSExpr = RHSExpr;
}
- const APValue &operator=(const APValue &RHS);
+ /// Assign by swapping from a copy of the RHS.
+ APValue &operator=(APValue RHS) {
+ swap(RHS);
+ return *this;
+ }
private:
void DestroyDataAndMakeUninit();