aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2008-10-29 18:00:54 +0000
committerDouglas Gregor <dgregor@apple.com>2008-10-29 18:00:54 +0000
commitf7c2aa0b049272d8f318988c1965760dcb852578 (patch)
tree0461640bb54451e76e163c36bf6542df84c9e09c
parent6fc17ff5bf73c4d190517ebc5773f2ae557598ab (diff)
Make the non-reference check in Expr work always
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58388 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/AST/Expr.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h
index d6aa5bfc54..ad8aab7c2a 100644
--- a/include/clang/AST/Expr.h
+++ b/include/clang/AST/Expr.h
@@ -38,7 +38,10 @@ namespace clang {
class Expr : public Stmt {
QualType TR;
protected:
- Expr(StmtClass SC, QualType T) : Stmt(SC), TR(T) {
+ Expr(StmtClass SC, QualType T) : Stmt(SC) { setType(T); }
+public:
+ QualType getType() const { return TR; }
+ void setType(QualType t) {
// In C++, the type of an expression is always adjusted so that it
// will not have reference type an expression will never have
// reference type (C++ [expr]p6). Use
@@ -46,12 +49,11 @@ protected:
// type. Additionally, inspect Expr::isLvalue to determine whether
// an expression that is adjusted in this manner should be
// considered an lvalue.
- assert((T.isNull() || !T->isReferenceType()) &&
+ assert((TR.isNull() || !TR->isReferenceType()) &&
"Expressions can't have reference type");
+
+ TR = t;
}
-public:
- QualType getType() const { return TR; }
- void setType(QualType t) { TR = t; }
/// SourceLocation tokens are not useful in isolation - they are low level
/// value objects created/interpreted by SourceManager. We assume AST