r215048 - Update the context location of the condition of a conditional operator to the

Richard Trieu rtrieu at google.com
Fri Aug 8 16:05:02 PDT 2014


This didn't affect any existing tests or diagnostics.  r215251 has the
first diagnostic that is impacted with this change.  The difference is that:

#define foo(x) ((x) ? *x : 0)
int x = 5;
int y = foo(&x);

Without this change, this would cause a conversion warning, with a the
diagnostic pointing to both 'x' and 'y' in the last line.  With this
change, no diagnostic would be emitted since the context is inside the
macro.

On Wed, Aug 6, 2014 at 10:25 PM, David Blaikie <dblaikie at gmail.com> wrote:

> Test coverage?
> On Aug 6, 2014 7:26 PM, "Richard Trieu" <rtrieu at google.com> wrote:
>
>> Author: rtrieu
>> Date: Wed Aug  6 21:09:05 2014
>> New Revision: 215048
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=215048&view=rev
>> Log:
>> Update the context location of the condition of a conditional operator to
>> the
>> question mark instead of the context of the conditional operator.  The
>> condition does not need the context of the conditional operator at all.
>>
>> Modified:
>>     cfe/trunk/lib/Sema/SemaChecking.cpp
>>
>> Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=215048&r1=215047&r2=215048&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaChecking.cpp Wed Aug  6 21:09:05 2014
>> @@ -6193,7 +6193,7 @@ void CheckConditionalOperand(Sema &S, Ex
>>
>>  void CheckConditionalOperator(Sema &S, ConditionalOperator *E,
>>                                SourceLocation CC, QualType T) {
>> -  AnalyzeImplicitConversions(S, E->getCond(), CC);
>> +  AnalyzeImplicitConversions(S, E->getCond(), E->getQuestionLoc());
>>
>>    bool Suspicious = false;
>>    CheckConditionalOperand(S, E->getTrueExpr(), T, CC, Suspicious);
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140808/9c331707/attachment.html>


More information about the cfe-commits mailing list