[llvm-bugs] [Bug 26390] New: Can't match parenExpr() in a unaryOperator()

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 29 21:33:50 PST 2016


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

            Bug ID: 26390
           Summary: Can't match parenExpr() in a unaryOperator()
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: libclang
          Assignee: unassignedclangbugs at nondot.org
          Reporter: legalize at xmission.com
                CC: klimek at google.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

clanger> cat /tmp/a.cpp
int negation(int a, int b) {
  if (!(a < b))
    return 0;
  if (!(a <= b))
    return 1;
  if (!(a == b))
    return 2;
  if (!(a >= b))
    return 3;
  if (!(a > b))
    return 4;
  return 5;
}
~/dev/build
clanger> bin/clang-query /tmp/a.cpp -- -std=c++11
clang-query> match parenExpr()

Match #1:

/tmp/a.cpp:2:8: note: "root" binds here
  if (!(a < b))
       ^~~~~~~

Match #2:

/tmp/a.cpp:4:8: note: "root" binds here
  if (!(a <= b))
       ^~~~~~~~

Match #3:

/tmp/a.cpp:6:8: note: "root" binds here
  if (!(a == b))
       ^~~~~~~~

Match #4:

/tmp/a.cpp:8:8: note: "root" binds here
  if (!(a >= b))
       ^~~~~~~~

Match #5:

/tmp/a.cpp:10:8: note: "root" binds here
  if (!(a > b))
       ^~~~~~~
5 matches.
clang-query> match unaryOperator()

Match #1:

/tmp/a.cpp:2:7: note: "root" binds here
  if (!(a < b))
      ^~~~~~~~

Match #2:

/tmp/a.cpp:4:7: note: "root" binds here
  if (!(a <= b))
      ^~~~~~~~~

Match #3:

/tmp/a.cpp:6:7: note: "root" binds here
  if (!(a == b))
      ^~~~~~~~~

Match #4:

/tmp/a.cpp:8:7: note: "root" binds here
  if (!(a >= b))
      ^~~~~~~~~

Match #5:

/tmp/a.cpp:10:7: note: "root" binds here
  if (!(a > b))
      ^~~~~~~~
5 matches.
clang-query> match unaryOperator(parenExpr())
0 matches.
clang-query> match unaryOperator(has(parenExpr()))
0 matches.
clang-query> ^D

-- 
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/20160130/68eb3fbf/attachment.html>


More information about the llvm-bugs mailing list