[cfe-commits] [Patch] Warn about |= in conditionals

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Jan 19 17:40:15 PST 2011


On Jan 19, 2011, at 8:54 AM, Douglas Gregor wrote:

> 
> On Jan 19, 2011, at 7:53 AM, Hans Wennborg wrote:
> 
>> Hi,
>> 
>> The attached patch adds a warning for using |= without parentheses in
>> conditionals, as in:
>> 
>> if (a |= b) {}
>> 
>> and suggests replacing it with != or adding parentheses.
>> 
>> This is for http://llvm.org/bugs/show_bug.cgi?id=9001
> 
> Looks great, thanks! I've committed it as r123836; please go ahead and close the bug.

Nice, you just found a bug in ShrinkWrapping.cpp:

  CSRegSet prevAnticIn = AnticIn[MBB];
  AnticIn[MBB] = CSRUsed[MBB] | AnticOut[MBB];
  if (prevAnticIn |= AnticIn[MBB])
    changed = true;
  return changed;

Thanks!






More information about the cfe-commits mailing list