forked from OSchip/llvm-project
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; ) ; } llvm-svn: 39580
This commit is contained in:
parent
cbf4709c03
commit
c27f89ebb3
|
@ -96,7 +96,7 @@ Sema::ParseIfStmt(SourceLocation IfLoc, ExprTy *CondVal,
|
|||
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 @@ Sema::ParseWhileStmt(SourceLocation WhileLoc, ExprTy *Cond, StmtTy *Body) {
|
|||
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 @@ Sema::ParseDoStmt(SourceLocation DoLoc, StmtTy *Body,
|
|||
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 @@ Sema::ParseForStmt(SourceLocation ForLoc, SourceLocation LParenLoc,
|
|||
}
|
||||
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
|
||||
|
|
|
@ -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 = "";
|
||||
|
|
Loading…
Reference in New Issue