[cfe-commits] r121992 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/Analysis/constant-folding.c test/Analysis/idempotent-operations.c
John McCall
rjmccall at apple.com
Thu Dec 16 11:28:59 PST 2010
Author: rjmccall
Date: Thu Dec 16 13:28:59 2010
New Revision: 121992
URL: http://llvm.org/viewvc/llvm-project?rev=121992&view=rev
Log:
Do lvalue-to-rvalue conversions on the LHS of a shift operator.
Fixes rdar://problem/8776586.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/Analysis/constant-folding.c
cfe/trunk/test/Analysis/idempotent-operations.c
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=121992&r1=121991&r2=121992&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Dec 16 13:28:59 2010
@@ -6246,15 +6246,15 @@
// Shifts don't perform usual arithmetic conversions, they just do integer
// promotions on each operand. C99 6.5.7p3
- QualType LHSTy = Context.isPromotableBitField(lex);
- if (LHSTy.isNull()) {
- LHSTy = lex->getType();
- if (LHSTy->isPromotableIntegerType())
- LHSTy = Context.getPromotedIntegerType(LHSTy);
- }
- if (!isCompAssign)
- ImpCastExprToType(lex, LHSTy, CK_IntegralCast);
+ // For the LHS, do usual unary conversions, but then reset them away
+ // if this is a compound assignment.
+ Expr *old_lex = lex;
+ UsualUnaryConversions(lex);
+ QualType LHSTy = lex->getType();
+ if (isCompAssign) lex = old_lex;
+
+ // The RHS is simpler.
UsualUnaryConversions(rex);
// Sanity-check shift operands
Modified: cfe/trunk/test/Analysis/constant-folding.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/constant-folding.c?rev=121992&r1=121991&r2=121992&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/constant-folding.c (original)
+++ cfe/trunk/test/Analysis/constant-folding.c Thu Dec 16 13:28:59 2010
@@ -1,5 +1,4 @@
// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-experimental-checks -verify %s
-// XFAIL: *
// Trigger a warning if the analyzer reaches this point in the control flow.
#define WARN ((void)*(char*)0)
Modified: cfe/trunk/test/Analysis/idempotent-operations.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/idempotent-operations.c?rev=121992&r1=121991&r2=121992&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/idempotent-operations.c (original)
+++ cfe/trunk/test/Analysis/idempotent-operations.c Thu Dec 16 13:28:59 2010
@@ -1,5 +1,4 @@
// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-opt-analyze-nested-blocks -analyzer-check-objc-mem -analyzer-check-idempotent-operations -verify %s
-// XFAIL: *
// Basic tests
More information about the cfe-commits
mailing list