[cfe-commits] r39580 - in /cfe/cfe/trunk: Sema/SemaStmt.cpp clang.xcodeproj/project.pbxproj

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


Author: snaroff
Date: Wed Jul 11 11:45:51 2007
New Revision: 39580

URL: http://llvm.org/viewvc/llvm-project?rev=39580&view=rev
Log:
Bug #:
Submitted by:
Reviewed by:
Apply UsualUnaryConversion() to statement conditions that expect scalars.
UsualUnaryConversion() converts function/arrays to pointers.

This fixes the following...

int func() {
  int A[10];
  while (A) {
  }
  if (A) ;
  for (; A; ) ;
}

Modified:
    cfe/cfe/trunk/Sema/SemaStmt.cpp
    cfe/cfe/trunk/clang.xcodeproj/project.pbxproj

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

==============================================================================
--- cfe/cfe/trunk/Sema/SemaStmt.cpp (original)
+++ cfe/cfe/trunk/Sema/SemaStmt.cpp Wed Jul 11 11:45:51 2007
@@ -96,7 +96,7 @@
   Expr *condExpr = (Expr *)CondVal;
   assert(condExpr && "ParseIfStmt(): missing expression");
   
-  QualType condType = condExpr->getType();
+  QualType condType = UsualUnaryConversion(condExpr->getType());
   assert(!condType.isNull() && "ParseIfStmt(): missing expression type");
   
   if (!condType->isScalarType()) // C99 6.8.4.1p1
@@ -116,7 +116,7 @@
   Expr *condExpr = (Expr *)Cond;
   assert(condExpr && "ParseWhileStmt(): missing expression");
   
-  QualType condType = condExpr->getType();
+  QualType condType = UsualUnaryConversion(condExpr->getType());
   assert(!condType.isNull() && "ParseWhileStmt(): missing expression type");
   
   if (!condType->isScalarType()) // C99 6.8.5p2
@@ -132,7 +132,7 @@
   Expr *condExpr = (Expr *)Cond;
   assert(condExpr && "ParseDoStmt(): missing expression");
   
-  QualType condType = condExpr->getType();
+  QualType condType = UsualUnaryConversion(condExpr->getType());
   assert(!condType.isNull() && "ParseDoStmt(): missing expression type");
   
   if (!condType->isScalarType()) // C99 6.8.5p2
@@ -153,7 +153,7 @@
   }
   if (Second) {
     Expr *testExpr = (Expr *)Second;
-    QualType testType = testExpr->getType();
+    QualType testType = UsualUnaryConversion(testExpr->getType());
     assert(!testType.isNull() && "ParseForStmt(): missing test expression type");
     
     if (!testType->isScalarType()) // C99 6.8.5p2

Modified: cfe/cfe/trunk/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=39580&r1=39579&r2=39580&view=diff

==============================================================================
--- cfe/cfe/trunk/clang.xcodeproj/project.pbxproj (original)
+++ cfe/cfe/trunk/clang.xcodeproj/project.pbxproj Wed Jul 11 11:45:51 2007
@@ -106,6 +106,23 @@
 		DED7D9E50A5257F6003AD0FB /* ScratchBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DED7D9E40A5257F6003AD0FB /* ScratchBuffer.cpp */; };
 /* End PBXBuildFile section */
 
+/* Begin PBXBuildStyle section */
+		8424C78B0C133C77008BC1FE /* Development */ = {
+			isa = PBXBuildStyle;
+			buildSettings = {
+				COPY_PHASE_STRIP = NO;
+			};
+			name = Development;
+		};
+		8424C78C0C133C77008BC1FE /* Deployment */ = {
+			isa = PBXBuildStyle;
+			buildSettings = {
+				COPY_PHASE_STRIP = YES;
+			};
+			name = Deployment;
+		};
+/* End PBXBuildStyle section */
+
 /* Begin PBXCopyFilesBuildPhase section */
 		8DD76F690486A84900D96B5E /* CopyFiles */ = {
 			isa = PBXCopyFilesBuildPhase;
@@ -547,6 +564,12 @@
 		08FB7793FE84155DC02AAC07 /* Project object */ = {
 			isa = PBXProject;
 			buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */;
+			buildSettings = {
+			};
+			buildStyles = (
+				8424C78B0C133C77008BC1FE /* Development */,
+				8424C78C0C133C77008BC1FE /* Deployment */,
+			);
 			hasScannedForEncodings = 1;
 			mainGroup = 08FB7794FE84155DC02AAC07 /* clang */;
 			projectDirPath = "";





More information about the cfe-commits mailing list