[cfe-commits] r58388 - /cfe/trunk/include/clang/AST/Expr.h

Douglas Gregor doug.gregor at gmail.com
Wed Oct 29 11:00:54 PDT 2008


Author: dgregor
Date: Wed Oct 29 13:00:54 2008
New Revision: 58388

URL: http://llvm.org/viewvc/llvm-project?rev=58388&view=rev
Log:
Make the non-reference check in Expr work always

Modified:
    cfe/trunk/include/clang/AST/Expr.h

Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=58388&r1=58387&r2=58388&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Wed Oct 29 13:00:54 2008
@@ -38,7 +38,10 @@
 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 @@
     // 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





More information about the cfe-commits mailing list