On Mon, Mar 23, 2015 at 12:39 PM, David Blaikie <[email protected]> wrote:
> Author: dblaikie > Date: Mon Mar 23 14:39:19 2015 > New Revision: 232999 > > URL: http://llvm.org/viewvc/llvm-project?rev=232999&view=rev > Log: > Refactor: Simplify boolean expresssions in lib/Lex > > Simplify boolean expressions using `true` and `false` with `clang-tidy` > > Patch by Richard Thomson. > > Differential Revision: http://reviews.llvm.org/D8531 > > Modified: > cfe/trunk/lib/Lex/LiteralSupport.cpp > > Modified: cfe/trunk/lib/Lex/LiteralSupport.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/LiteralSupport.cpp?rev=232999&r1=232998&r2=232999&view=diff > > ============================================================================== > --- cfe/trunk/lib/Lex/LiteralSupport.cpp (original) > +++ cfe/trunk/lib/Lex/LiteralSupport.cpp Mon Mar 23 14:39:19 2015 > @@ -144,7 +144,7 @@ static unsigned ProcessCharEscape(const > int CharVal = llvm::hexDigitValue(ThisTokBuf[0]); > if (CharVal == -1) break; > // About to shift out a digit? > - Overflow |= (ResultChar & 0xF0000000) ? true : false; > + Overflow |= ResultChar & 0xF0000000; > Is this actually simpler? This line now reads like it's conditionally setting bits 28-31 of Overflow, whereas previously it was clear that Overflow is a bool without needing any additional context. I think if (ResultChar & 0xF0000000) Overflow = true; is better than either the old or new code. ResultChar <<= 4; > ResultChar |= CharVal; > } > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
