[cfe-commits] r39528 - in /cfe/cfe/trunk: AST/StmtPrinter.cpp Parse/ParseStmt.cpp Sema/SemaExpr.cpp Sema/SemaStmt.cpp

Steve Naroff snaroff at apple.com
Wed Jul 11 09:45:18 PDT 2007


Author: snaroff
Date: Wed Jul 11 11:45:18 2007
New Revision: 39528

URL: http://llvm.org/viewvc/llvm-project?rev=39528&view=rev
Log:
Bug #:
Submitted by:
Reviewed by:
- ParseForStatement(): Put back a test/assignment. My removal of
ParseExprStmt() was a bit over zealous:-(thanks to Chris for pointing it out)
- Add assert to VisitDeclStmt().
- Removed an out-of-date FIXME
- Added some curlies for a couple multi-line calls to Diag().

Modified:
    cfe/cfe/trunk/AST/StmtPrinter.cpp
    cfe/cfe/trunk/Parse/ParseStmt.cpp
    cfe/cfe/trunk/Sema/SemaExpr.cpp
    cfe/cfe/trunk/Sema/SemaStmt.cpp

Modified: cfe/cfe/trunk/AST/StmtPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/StmtPrinter.cpp?rev=39528&r1=39527&r2=39528&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/StmtPrinter.cpp (original)
+++ cfe/cfe/trunk/AST/StmtPrinter.cpp Wed Jul 11 11:45:18 2007
@@ -118,7 +118,8 @@
   } else if (TypedefDecl *localType = dyn_cast<TypedefDecl>(Node->getDecl())) {
     Indent() << "typedef " << localType->getUnderlyingType().getAsString();
     OS << " " << localType->getName() << ";\n";
-  }
+  } else 
+    assert(0 && "Unexpected decl (expecting BlockVarDecl or TypedefDecl");
 }
 
 void StmtPrinter::VisitCompoundStmt(CompoundStmt *Node) {

Modified: cfe/cfe/trunk/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/ParseStmt.cpp?rev=39528&r1=39527&r2=39528&view=diff

==============================================================================
--- cfe/cfe/trunk/Parse/ParseStmt.cpp (original)
+++ cfe/cfe/trunk/Parse/ParseStmt.cpp Wed Jul 11 11:45:18 2007
@@ -590,6 +590,9 @@
   } else {
     Value = ParseExpression();
 
+    if (!Value.isInvalid)
+      FirstPart = Value.Val;
+      
     if (Tok.getKind() == tok::semi) {
       ConsumeToken();
     } else {

Modified: cfe/cfe/trunk/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/SemaExpr.cpp?rev=39528&r1=39527&r2=39528&view=diff

==============================================================================
--- cfe/cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/cfe/trunk/Sema/SemaExpr.cpp Wed Jul 11 11:45:18 2007
@@ -876,7 +876,6 @@
   QualType resType = UsualAssignmentConversions(lhsType, rhsType, result);
 
   // decode the result (notice that extensions still return a type).
-  // FIXME: make sure the text of the message is consistent with function calls.
   switch (result) {
   case Compatible:
     break;
@@ -888,10 +887,11 @@
     break;
   case PointerFromInt:
     // check for null pointer constant (C99 6.3.2.3p3)
-    if (compoundType.isNull() && !rex->isNullPointerConstant())
+    if (compoundType.isNull() && !rex->isNullPointerConstant()) {
       Diag(loc, diag::ext_typecheck_assign_pointer_int,
            lhsType.getAsString(), rhsType.getAsString(),
            lex->getSourceRange(), rex->getSourceRange());
+    }
     break;
   case IntFromPointer: 
     Diag(loc, diag::ext_typecheck_assign_pointer_int, 

Modified: cfe/cfe/trunk/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/SemaStmt.cpp?rev=39528&r1=39527&r2=39528&view=diff

==============================================================================
--- cfe/cfe/trunk/Sema/SemaStmt.cpp (original)
+++ cfe/cfe/trunk/Sema/SemaStmt.cpp Wed Jul 11 11:45:18 2007
@@ -250,10 +250,11 @@
     break;
   case PointerFromInt:
     // check for null pointer constant (C99 6.3.2.3p3)
-    if (!((Expr *)RetValExp)->isNullPointerConstant())
+    if (!((Expr *)RetValExp)->isNullPointerConstant()) {
       Diag(ReturnLoc, diag::ext_typecheck_return_pointer_int,
            lhsType.getAsString(), rhsType.getAsString(),
            ((Expr *)RetValExp)->getSourceRange());
+    }
     break;
   case IntFromPointer:
     Diag(ReturnLoc, diag::ext_typecheck_return_pointer_int,





More information about the cfe-commits mailing list