On Tue, Feb 23, 2016 at 11:12 AM, Aaron Ballman <aa...@aaronballman.com> wrote: > On Tue, Feb 23, 2016 at 2:03 PM, Hans Wennborg <h...@chromium.org> wrote: >> Hi Aaron, >> >> I'll let it sit in the tree for a bit, and will then merge it later today. > > Sounds great, thank you!
r261684. >> Many thanks, >> Hans >> >> On Tue, Feb 23, 2016 at 11:01 AM, Aaron Ballman <aa...@aaronballman.com> >> wrote: >>> Hans, this should be safe to merge into 3.8 (as Richard had mentioned >>> in the review thread). Can you do the merge magic on my behalf? >>> >>> Thanks! >>> >>> ~Aaron >>> >>> On Tue, Feb 23, 2016 at 1:55 PM, Aaron Ballman via cfe-commits >>> <cfe-commits@lists.llvm.org> wrote: >>>> Author: aaronballman >>>> Date: Tue Feb 23 12:55:15 2016 >>>> New Revision: 261669 >>>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=261669&view=rev >>>> Log: >>>> Amends r252104 to evaluate the controlling expression in an unevaluated >>>> context. This eliminates false-positive diagnostics about null pointer >>>> dereferences (etc) in the controlling expression. >>>> >>>> Modified: >>>> cfe/trunk/lib/Sema/SemaExpr.cpp >>>> cfe/trunk/test/Sema/generic-selection.c >>>> >>>> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp >>>> URL: >>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=261669&r1=261668&r2=261669&view=diff >>>> ============================================================================== >>>> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original) >>>> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Feb 23 12:55:15 2016 >>>> @@ -1373,10 +1373,13 @@ Sema::CreateGenericSelectionExpr(SourceL >>>> >>>> // Decay and strip qualifiers for the controlling expression type, and >>>> handle >>>> // placeholder type replacement. See committee discussion from WG14 >>>> DR423. >>>> - ExprResult R = DefaultFunctionArrayLvalueConversion(ControllingExpr); >>>> - if (R.isInvalid()) >>>> - return ExprError(); >>>> - ControllingExpr = R.get(); >>>> + { >>>> + EnterExpressionEvaluationContext Unevaluated(*this, >>>> Sema::Unevaluated); >>>> + ExprResult R = DefaultFunctionArrayLvalueConversion(ControllingExpr); >>>> + if (R.isInvalid()) >>>> + return ExprError(); >>>> + ControllingExpr = R.get(); >>>> + } >>>> >>>> // The controlling expression is an unevaluated operand, so side >>>> effects are >>>> // likely unintended. >>>> >>>> Modified: cfe/trunk/test/Sema/generic-selection.c >>>> URL: >>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/generic-selection.c?rev=261669&r1=261668&r2=261669&view=diff >>>> ============================================================================== >>>> --- cfe/trunk/test/Sema/generic-selection.c (original) >>>> +++ cfe/trunk/test/Sema/generic-selection.c Tue Feb 23 12:55:15 2016 >>>> @@ -31,4 +31,8 @@ void foo(int n) { >>>> >>>> const int i = 12; >>>> int a9[_Generic(i, int: 1, default: 2) == 1 ? 1 : -1]; >>>> + >>>> + // This is expected to not trigger any diagnostics because the >>>> controlling >>>> + // expression is not evaluated. >>>> + (void)_Generic(*(int *)0, int: 1); >>>> } >>>> >>>> >>>> _______________________________________________ >>>> cfe-commits mailing list >>>> cfe-commits@lists.llvm.org >>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits