[llvm-bugs] [Bug 31414] New: tools/clang/lib/Format/Format.cpp:1548: suspicious code ?

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Dec 17 02:57:27 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=31414

            Bug ID: 31414
           Summary: tools/clang/lib/Format/Format.cpp:1548: suspicious
                    code ?
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: dcb314 at hotmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

llvm/tools/clang/lib/Format/Format.cpp:1548:23: warning: en
um constant in boolean context [-Wint-in-bool-context]

Source code is

  bool Matched = Tok.is(tok::hash) && !Lex.LexFromRawLexer(Tok) &&
                 Tok.is(tok::raw_identifier) &&
                 Tok.getRawIdentifier() == Name && !Lex.LexFromRawLexer(Tok) &&
                 tok::raw_identifier;

The final expression looks odd to me. Maybe better code

  bool Matched = Tok.is(tok::hash) && !Lex.LexFromRawLexer(Tok) &&
                 Tok.is(tok::raw_identifier) &&
                 Tok.getRawIdentifier() == Name && !Lex.LexFromRawLexer(Tok) &&
                 Tok.is(tok::raw_identifier);

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20161217/0486ce36/attachment.html>


More information about the llvm-bugs mailing list