[cfe-commits] r41401 - in /cfe/trunk: Sema/SemaExprCXX.cpp include/clang/AST/ExprCXX.h

Steve Naroff snaroff at apple.com
Sat Aug 25 07:02:59 PDT 2007


Author: snaroff
Date: Sat Aug 25 09:02:58 2007
New Revision: 41401

URL: http://llvm.org/viewvc/llvm-project?rev=41401&view=rev
Log:
Give CXXBoolLiteralExpr a type (all expressions need a valid type).

This fixes the following:

******************** TEST 'Parser/cxx-bool.cpp' FAILED! ********************
Command:
clang -fsyntax-only Parser/cxx-bool.cpp
Output:
SemaExpr.cpp:731: failed assertion `!t.isNull() && "DefaultFunctionArrayConversion - missing type"'
Output/cxx-bool.cpp.out.script: line 1: 22697 Abort trap              clang -fsyntax-only Parser/cxx-bool.cpp


Modified:
    cfe/trunk/Sema/SemaExprCXX.cpp
    cfe/trunk/include/clang/AST/ExprCXX.h

Modified: cfe/trunk/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaExprCXX.cpp?rev=41401&r1=41400&r2=41401&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/Sema/SemaExprCXX.cpp Sat Aug 25 09:02:58 2007
@@ -13,6 +13,7 @@
 
 #include "Sema.h"
 #include "clang/AST/ExprCXX.h"
+#include "clang/AST/ASTContext.h"
 using namespace clang;
 
 /// ParseCXXCasts - Parse {dynamic,static,reinterpret,const}_cast's.
@@ -40,5 +41,5 @@
 Sema::ParseCXXBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind) {
   assert((Kind != tok::kw_true || Kind != tok::kw_false) &&
          "Unknown C++ Boolean value!");
-  return new CXXBoolLiteralExpr(Kind == tok::kw_true, OpLoc);
+  return new CXXBoolLiteralExpr(Kind == tok::kw_true, Context.BoolTy, OpLoc);
 }

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

==============================================================================
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Sat Aug 25 09:02:58 2007
@@ -78,8 +78,8 @@
     bool Value;
     SourceLocation Loc;
   public:
-    CXXBoolLiteralExpr(bool val, SourceLocation l) : 
-      Expr(CXXBoolLiteralExprClass, QualType()), Value(val), Loc(l) {}
+    CXXBoolLiteralExpr(bool val, QualType Ty, SourceLocation l) : 
+      Expr(CXXBoolLiteralExprClass, Ty), Value(val), Loc(l) {}
     
     bool getValue() const { return Value; }
 





More information about the cfe-commits mailing list