[PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2020-05-11 Thread Joxean Koret via Phabricator via cfe-commits
joxeankoret added a comment.

Any news? It's amazing that such a basic feature (getting an operator kind) 
with working patches (since 2015) is not yet available in 2020. If there is any 
work that needs to be done, I propose myself to do it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D10833/new/

https://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2020-02-02 Thread Caleb Helbling via Phabricator via cfe-commits
calebh added a comment.

What about unary operations? I don't see those supported in the current version 
of libclang Python either.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D10833/new/

https://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2019-12-02 Thread Jan Korous via Phabricator via cfe-commits
jkorous added a comment.

Hi @arthurp, I can review the libclang part of the patch.

Could you please remove the changes that are just code formatting? You can land 
those as a separate NFC commit.




Comment at: clang/tools/libclang/CIndex.cpp:259
+
+  std::pair Begin = SM.getDecomposedLoc(
+  SM.getFileLoc(RegionOfInterest.getBegin())),

This seems like just a clang-format change. Maybe we could separate these as a 
NFC commit?



Comment at: clang/tools/libclang/CIndex.cpp:436
 
-  bool OnlyLocalDecls
-= !AU->isMainFileAST() && AU->getOnlyLocalDecls(); 
-  
+  bool OnlyLocalDecls = !AU->isMainFileAST() && AU->getOnlyLocalDecls();
+

This seems like just a clang-format change. Maybe we could separate these as a 
NFC commit?



Comment at: clang/tools/libclang/CIndex.cpp:1369
 
-bool 
-CursorVisitor::VisitNestedNameSpecifierLoc(NestedNameSpecifierLoc Qualifier) {
+bool CursorVisitor::VisitNestedNameSpecifierLoc(
+NestedNameSpecifierLoc Qualifier) {

This seems like just a clang-format change. Maybe we could separate these as a 
NFC commit?

Could you please leave out all such changes from this patch? It would be easier 
to review. (It seems to me a bunch of changes below are of this nature.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D10833/new/

https://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2019-11-16 Thread Arthur Peters via Phabricator via cfe-commits
arthurp commandeered this revision.
arthurp added a reviewer: RedX2501.
arthurp added a comment.

I have been using this revision locally for 9 months in a system that uses 
libclang to parse C code and extract information. I'm commandeering this issue 
since the original author (@RedX2501) has not posted on this issue since 2016 
and I'm willing to make an attempt to get this merged. I have updated the 
revision to apply clearly on LLVM master 
(f897d087d09dbbccec3417f812109ed534b94248 
) and I 
have updated and run all the tests.

I am happy to make other changes if needed to make this revision mergeable. 
Just tell me what's needed.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D10833/new/

https://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2019-11-11 Thread Tanner Gooding via Phabricator via cfe-commits
tannergooding added a comment.

Would it be beneficial for this to be just called `getOpcode`? If it was, it 
could also be applied to `UnaryOperator::getOpcode`.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D10833/new/

https://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2019-04-28 Thread Ian Sunamura via Phabricator via cfe-commits
kent08ian added a comment.

In D10833#1366117 , @schroedersi wrote:

> Ping. It would indeed be very helpful to have information about the kind of 
> an operator :-)


Any updates on this?


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D10833/new/

https://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2019-04-12 Thread Ian Sunamura via Phabricator via cfe-commits
kent08ian added a comment.

In D10833#1405416 , @wipascal wrote:

> In D10833#1394154 , @dyhe83 wrote:
>
> > In D10833#970906 , @milianw wrote:
> >
> > > still looks good to me. can someone else please review and commit this?
> >
> >
> > ping
>
>
> please


any updates on this?


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D10833/new/

https://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2019-02-21 Thread Pascal Wiesmann via Phabricator via cfe-commits
wipascal added a comment.

In D10833#1394154 , @dyhe83 wrote:

> In D10833#970906 , @milianw wrote:
>
> > still looks good to me. can someone else please review and commit this?
>
>
> ping


please


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D10833/new/

https://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2019-02-11 Thread dyhe83 via Phabricator via cfe-commits
dyhe83 added a comment.

In D10833#970906 , @milianw wrote:

> still looks good to me. can someone else please review and commit this?


ping


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D10833/new/

https://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2019-01-22 Thread Simon Schroeder via Phabricator via cfe-commits
schroedersi added a comment.

Ping. It would indeed be very helpful to have information about the kind of an 
operator :-)


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D10833/new/

https://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2018-11-12 Thread Nemanja Boric via Phabricator via cfe-commits
Burgos added a comment.

Another ping :-). This looks like a very useful addition (and I need it myself 
so I'll end up applying this patchset manually) and I would like to find it 
merged. It doesn't look it brings any kind of negative value to the C API.


Repository:
  rC Clang

https://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2018-09-26 Thread Ian Sunamura via Phabricator via cfe-commits
kent08ian added a comment.
Herald added a subscriber: dexonsmith.

In https://reviews.llvm.org/D10833#1109371, @kent08ian wrote:

> In https://reviews.llvm.org/D10833#970906, @milianw wrote:
>
> > still looks good to me. can someone else please review and commit this?
>
>
> Ping


Any updates on this? :)


Repository:
  rC Clang

https://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2018-05-23 Thread Ian Sunamura via Phabricator via cfe-commits
kent08ian added a comment.

In https://reviews.llvm.org/D10833#970906, @milianw wrote:

> still looks good to me. can someone else please review and commit this?


Ping


Repository:
  rC Clang

https://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2018-05-15 Thread Ian Sunamura via Phabricator via cfe-commits
kent08ian added a comment.

In https://reviews.llvm.org/D10833#970906, @milianw wrote:

> still looks good to me. can someone else please review and commit this?


Ping


Repository:
  rC Clang

https://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2018-05-14 Thread Ian Sunamura via Phabricator via cfe-commits
kent08ian added a comment.

In https://reviews.llvm.org/D10833#970906, @milianw wrote:

> still looks good to me. can someone else please review and commit this?


Any updates on this? This feature will be very helpful. :)


Repository:
  rC Clang

https://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2018-01-09 Thread Milian Wolff via Phabricator via cfe-commits
milianw added a comment.

still looks good to me. can someone else please review and commit this?


Repository:
  rC Clang

https://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2016-10-18 Thread guibufolo+l...@gmail.com via cfe-commits
RedX2501 added a comment.

Has this been merged yet?


https://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2016-04-28 Thread guibufolo+l...@gmail.com via cfe-commits
RedX2501 added a comment.

Ping


http://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2016-04-18 Thread guibufolo+l...@gmail.com via cfe-commits
RedX2501 added a comment.

Ping


http://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2016-04-10 Thread guibufolo+l...@gmail.com via cfe-commits
RedX2501 added a comment.

Ping


http://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2016-01-13 Thread Argyrios Kyrtzidis via cfe-commits
akyrtzi added a comment.

Tests need to be updated, for example:

clang/test/Index/remap-load.c:7:11: error: expected string not found in input
// CHECK: remap-load.c:2:10: BinaryOperator= Extent=[2:10 - 2:23]

  ^

:334:1: note: scanning from here
// CHECK: remap-load.c:2:10: BinaryOperator=+ Extent=[2:10 - 2:23]
^
:334:11: note: possible intended match here
// CHECK: remap-load.c:2:10: BinaryOperator=+ Extent=[2:10 - 2:23]

  ^

the failing tests are:

Failing Tests (9):

  Clang :: Index/blocks.c
  Clang :: Index/c-index-api-loadTU-test.m
  Clang :: Index/nested-binaryoperators.cpp
  Clang :: Index/preamble.c
  Clang :: Index/print-type.c
  Clang :: Index/print-type.cpp
  Clang :: Index/recursive-cxx-member-calls.cpp
  Clang :: Index/remap-load.c
  Clang :: Index/usrs.m


http://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2016-01-09 Thread guibufolo+l...@gmail.com via cfe-commits
RedX2501 added a comment.

Ping


http://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-12-27 Thread guibufolo+l...@gmail.com via cfe-commits
RedX2501 added a comment.

Ping


http://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-12-20 Thread guibufolo+l...@gmail.com via cfe-commits
RedX2501 added a comment.

Ping


http://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-12-09 Thread Argyrios Kyrtzidis via cfe-commits
The patch causes tests to fail, please look into it.

> On Dec 8, 2015, at 10:20 PM, guibufolo+l...@gmail.com wrote:
> 
> RedX2501 updated this revision to Diff 42267.
> RedX2501 added a comment.
> 
> Added explicit integer assignment to enum to emphasize api contract behaviour.
> 
> 
> http://reviews.llvm.org/D10833
> 
> Files:
>  bindings/python/clang/cindex.py
>  bindings/python/tests/cindex/test_cursor.py
>  include/clang-c/Index.h
>  include/clang/AST/OperationKinds.h
>  test/Index/binop.cpp
>  tools/c-index-test/c-index-test.c
>  tools/libclang/CIndex.cpp
> 
> 

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-12-09 Thread Argyrios Kyrtzidis via cfe-commits
akyrtzi added a comment.

The patch causes tests to fail, please look into it.


http://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-12-09 Thread Argyrios Kyrtzidis via cfe-commits
akyrtzi added a comment.

Also you need to add the functions in libclang.exports.


http://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-12-09 Thread guibufolo+l...@gmail.com via cfe-commits
RedX2501 added a comment.

In http://reviews.llvm.org/D10833#306281, @akyrtzi wrote:

> The patch causes tests to fail, please look into it.


Where can i see the test reports? I'm having trouble running the test on my 
side on windows (VS2013).


http://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-12-09 Thread guibufolo+l...@gmail.com via cfe-commits
RedX2501 updated this revision to Diff 42386.
RedX2501 added a comment.

Added functions to libclang.exports.


http://reviews.llvm.org/D10833

Files:
  bindings/python/clang/cindex.py
  bindings/python/tests/cindex/test_cursor.py
  include/clang-c/Index.h
  include/clang/AST/OperationKinds.h
  test/Index/binop.cpp
  tools/c-index-test/c-index-test.c
  tools/libclang/CIndex.cpp
  tools/libclang/libclang.exports

Index: tools/libclang/libclang.exports
===
--- tools/libclang/libclang.exports
+++ tools/libclang/libclang.exports
@@ -14,6 +14,8 @@
 clang_Cursor_getTemplateArgumentValue
 clang_Cursor_getTemplateArgumentUnsignedValue
 clang_Cursor_getBriefCommentText
+clang_Cursor_getBinaryOpcode
+clang_Cursor_getBinaryOpcodeStr
 clang_Cursor_getCommentRange
 clang_Cursor_getCXXManglings
 clang_Cursor_getMangling
Index: tools/libclang/CIndex.cpp
===
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -3799,6 +3799,11 @@
   return cxstring::createDup(OS.str());
 }
 
+if (C.kind == CXCursor_BinaryOperator ||
+C.kind == CXCursor_CompoundAssignOperator) {
+  return clang_Cursor_getBinaryOpcodeStr(clang_Cursor_getBinaryOpcode(C));
+}
+
 const Decl *D = getDeclFromExpr(getCursorExpr(C));
 if (D)
   return getDeclSpelling(D);
@@ -6892,6 +6897,29 @@
   return 0;
 }
 
+enum CX_BinaryOperatorKind clang_Cursor_getBinaryOpcode(CXCursor C) {
+	if (C.kind != CXCursor_BinaryOperator &&
+		C.kind != CXCursor_CompoundAssignOperator) {
+		return CX_BO_Invalid;
+	}
+
+	const Expr *D = getCursorExpr(C);
+	if (const BinaryOperator *BinOp = dyn_cast(D)) {
+		return static_cast(BinOp->getOpcode() + 1);
+	}
+
+	return CX_BO_Invalid;
+}
+
+CXString clang_Cursor_getBinaryOpcodeStr(enum CX_BinaryOperatorKind Op) {
+	if (Op > CX_BO_LAST) {
+		return cxstring::createEmpty();
+	}
+
+	return cxstring::createDup(
+			BinaryOperator::getOpcodeStr(static_cast(Op - 1)));
+}
+
 CXSourceRange clang_Cursor_getCommentRange(CXCursor C) {
   if (!clang_isDeclaration(C.kind))
 return clang_getNullRange();
Index: tools/c-index-test/c-index-test.c
===
--- tools/c-index-test/c-index-test.c
+++ tools/c-index-test/c-index-test.c
@@ -1451,6 +1451,20 @@
   return CXChildVisit_Recurse;
 }
 
+static enum CXChildVisitResult PrintBinOps(CXCursor C, CXCursor p,
+   CXClientData d){
+  enum CXCursorKind ck = clang_getCursorKind(C);
+  if (ck != CXCursor_BinaryOperator && ck != CXCursor_CompoundAssignOperator)
+return CXChildVisit_Recurse;
+
+  PrintCursor(C, NULL);
+  enum CX_BinaryOperatorKind bok = clang_Cursor_getBinaryOpcode(C);
+  CXString opstr = clang_Cursor_getBinaryOpcodeStr(bok);
+  printf(" BinOp=%s %d\n", clang_getCString(opstr), bok);
+
+  return CXChildVisit_Recurse;
+}
+
 /**/
 /* Mangling testing.  */
 /**/
@@ -4114,6 +4128,7 @@
 "   c-index-test -test-print-type {}*\n"
 "   c-index-test -test-print-type-size {}*\n"
 "   c-index-test -test-print-bitwidth {}*\n"
+"   c-index-test -test-print-binops {}*\n"
 "   c-index-test -print-usr [ {}]*\n"
 "   c-index-test -print-usr-file \n"
 "   c-index-test -write-pch  \n");
@@ -4210,6 +4225,9 @@
   else if (argc > 2 && strcmp(argv[1], "-test-print-bitwidth") == 0)
 return perform_test_load_source(argc - 2, argv + 2, "all",
 PrintBitWidth, 0);
+  else if (argc > 2 && strcmp(argv[1], "-test-print-binops") == 0)
+return perform_test_load_source(argc - 2, argv + 2, "all",
+PrintBinOps, 0);
   else if (argc > 2 && strcmp(argv[1], "-test-print-mangle") == 0)
 return perform_test_load_tu(argv[2], "all", NULL, PrintMangledName, NULL);
   else if (argc > 2 && strcmp(argv[1], "-test-print-manglings") == 0)
Index: test/Index/binop.cpp
===
--- /dev/null
+++ test/Index/binop.cpp
@@ -0,0 +1,90 @@
+// RUN: c-index-test -test-print-binops %s | FileCheck %s
+
+struct C {
+  int m;
+};
+
+void func(void){
+	int a, b;
+  int C::* p = ::m;
+
+	C c;
+	c.*p;
+
+	C* pc;
+	pc->*p;
+
+	a * b;
+	a / b;
+	a % b;
+	a + b;
+	a - b;
+
+	a << b;
+	a >> b;
+
+	a < b;
+	a > b;
+
+	a <= b;
+	a >= b;
+	a == b;
+	a != b;
+	
+	a & b;
+	a ^ b;
+	a | b;
+
+	a && b;
+	a || b;
+
+	a = b;
+
+	a *= b;
+	a /= b;
+	a %= b;
+	a += b;
+	a -= b;
+	
+	a <<= b;
+	a >>= b;
+
+	a &= b;
+	a ^= b;
+	a |= b;
+	a , b;
+
+}
+
+// CHECK: BinaryOperator=.* BinOp=.* 1
+// CHECK: BinaryOperator=->* BinOp=->* 2
+// CHECK: BinaryOperator=* BinOp=* 3
+// CHECK: BinaryOperator=/ 

Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-12-08 Thread Argyrios Kyrtzidis via cfe-commits
For CX_BinaryOperatorKind please change the enumerators to have an explicit 
integer assignment; this is to emphasize that they are API contract and should 
not change with subsequent changes (someone may inadvertently add a new 
enumerator in the middle which will implicitly change all the subsequent 
enumerators).

Otherwise LGTM.

> On Dec 6, 2015, at 11:45 PM, guibufolo+l...@gmail.com wrote:
> 
> RedX2501 added a comment.
> 
> Ping
> 
> 
> http://reviews.llvm.org/D10833
> 
> 
> 

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-12-08 Thread Argyrios Kyrtzidis via cfe-commits
akyrtzi added a subscriber: akyrtzi.
akyrtzi added a comment.

For CX_BinaryOperatorKind please change the enumerators to have an explicit 
integer assignment; this is to emphasize that they are API contract and should 
not change with subsequent changes (someone may inadvertently add a new 
enumerator in the middle which will implicitly change all the subsequent 
enumerators).

Otherwise LGTM.


http://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-12-08 Thread guibufolo+l...@gmail.com via cfe-commits
RedX2501 updated this revision to Diff 42267.
RedX2501 added a comment.

Added explicit integer assignment to enum to emphasize api contract behaviour.


http://reviews.llvm.org/D10833

Files:
  bindings/python/clang/cindex.py
  bindings/python/tests/cindex/test_cursor.py
  include/clang-c/Index.h
  include/clang/AST/OperationKinds.h
  test/Index/binop.cpp
  tools/c-index-test/c-index-test.c
  tools/libclang/CIndex.cpp

Index: tools/libclang/CIndex.cpp
===
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -3799,6 +3799,11 @@
   return cxstring::createDup(OS.str());
 }
 
+if (C.kind == CXCursor_BinaryOperator ||
+C.kind == CXCursor_CompoundAssignOperator) {
+  return clang_Cursor_getBinaryOpcodeStr(clang_Cursor_getBinaryOpcode(C));
+}
+
 const Decl *D = getDeclFromExpr(getCursorExpr(C));
 if (D)
   return getDeclSpelling(D);
@@ -6892,6 +6897,29 @@
   return 0;
 }
 
+enum CX_BinaryOperatorKind clang_Cursor_getBinaryOpcode(CXCursor C) {
+	if (C.kind != CXCursor_BinaryOperator &&
+		C.kind != CXCursor_CompoundAssignOperator) {
+		return CX_BO_Invalid;
+	}
+
+	const Expr *D = getCursorExpr(C);
+	if (const BinaryOperator *BinOp = dyn_cast(D)) {
+		return static_cast(BinOp->getOpcode() + 1);
+	}
+
+	return CX_BO_Invalid;
+}
+
+CXString clang_Cursor_getBinaryOpcodeStr(enum CX_BinaryOperatorKind Op) {
+	if (Op > CX_BO_LAST) {
+		return cxstring::createEmpty();
+	}
+
+	return cxstring::createDup(
+			BinaryOperator::getOpcodeStr(static_cast(Op - 1)));
+}
+
 CXSourceRange clang_Cursor_getCommentRange(CXCursor C) {
   if (!clang_isDeclaration(C.kind))
 return clang_getNullRange();
Index: tools/c-index-test/c-index-test.c
===
--- tools/c-index-test/c-index-test.c
+++ tools/c-index-test/c-index-test.c
@@ -1451,6 +1451,20 @@
   return CXChildVisit_Recurse;
 }
 
+static enum CXChildVisitResult PrintBinOps(CXCursor C, CXCursor p,
+   CXClientData d){
+  enum CXCursorKind ck = clang_getCursorKind(C);
+  if (ck != CXCursor_BinaryOperator && ck != CXCursor_CompoundAssignOperator)
+return CXChildVisit_Recurse;
+
+  PrintCursor(C, NULL);
+  enum CX_BinaryOperatorKind bok = clang_Cursor_getBinaryOpcode(C);
+  CXString opstr = clang_Cursor_getBinaryOpcodeStr(bok);
+  printf(" BinOp=%s %d\n", clang_getCString(opstr), bok);
+
+  return CXChildVisit_Recurse;
+}
+
 /**/
 /* Mangling testing.  */
 /**/
@@ -4114,6 +4128,7 @@
 "   c-index-test -test-print-type {}*\n"
 "   c-index-test -test-print-type-size {}*\n"
 "   c-index-test -test-print-bitwidth {}*\n"
+"   c-index-test -test-print-binops {}*\n"
 "   c-index-test -print-usr [ {}]*\n"
 "   c-index-test -print-usr-file \n"
 "   c-index-test -write-pch  \n");
@@ -4210,6 +4225,9 @@
   else if (argc > 2 && strcmp(argv[1], "-test-print-bitwidth") == 0)
 return perform_test_load_source(argc - 2, argv + 2, "all",
 PrintBitWidth, 0);
+  else if (argc > 2 && strcmp(argv[1], "-test-print-binops") == 0)
+return perform_test_load_source(argc - 2, argv + 2, "all",
+PrintBinOps, 0);
   else if (argc > 2 && strcmp(argv[1], "-test-print-mangle") == 0)
 return perform_test_load_tu(argv[2], "all", NULL, PrintMangledName, NULL);
   else if (argc > 2 && strcmp(argv[1], "-test-print-manglings") == 0)
Index: test/Index/binop.cpp
===
--- /dev/null
+++ test/Index/binop.cpp
@@ -0,0 +1,90 @@
+// RUN: c-index-test -test-print-binops %s | FileCheck %s
+
+struct C {
+  int m;
+};
+
+void func(void){
+	int a, b;
+  int C::* p = ::m;
+
+	C c;
+	c.*p;
+
+	C* pc;
+	pc->*p;
+
+	a * b;
+	a / b;
+	a % b;
+	a + b;
+	a - b;
+
+	a << b;
+	a >> b;
+
+	a < b;
+	a > b;
+
+	a <= b;
+	a >= b;
+	a == b;
+	a != b;
+	
+	a & b;
+	a ^ b;
+	a | b;
+
+	a && b;
+	a || b;
+
+	a = b;
+
+	a *= b;
+	a /= b;
+	a %= b;
+	a += b;
+	a -= b;
+	
+	a <<= b;
+	a >>= b;
+
+	a &= b;
+	a ^= b;
+	a |= b;
+	a , b;
+
+}
+
+// CHECK: BinaryOperator=.* BinOp=.* 1
+// CHECK: BinaryOperator=->* BinOp=->* 2
+// CHECK: BinaryOperator=* BinOp=* 3
+// CHECK: BinaryOperator=/ BinOp=/ 4
+// CHECK: BinaryOperator=% BinOp=% 5
+// CHECK: BinaryOperator=+ BinOp=+ 6
+// CHECK: BinaryOperator=- BinOp=- 7
+// CHECK: BinaryOperator=<< BinOp=<< 8
+// CHECK: BinaryOperator=>> BinOp=>> 9
+// CHECK: BinaryOperator=< BinOp=< 10
+// CHECK: BinaryOperator=> BinOp=> 11
+// CHECK: BinaryOperator=<= BinOp=<= 12
+// CHECK: BinaryOperator=>= BinOp=>= 13
+// CHECK: BinaryOperator=== BinOp=== 14
+// CHECK: BinaryOperator=!= BinOp=!= 15
+// CHECK: 

Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-12-06 Thread guibufolo+l...@gmail.com via cfe-commits
RedX2501 added a comment.

Ping


http://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-11-29 Thread guibufolo+l...@gmail.com via cfe-commits
RedX2501 added a comment.

Ping


http://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-11-24 Thread Kevin Funk via cfe-commits
kfunk accepted this revision.
kfunk added a comment.

Looks good to me now. I'd also appreciate another +1 from somone else, though.


http://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-11-22 Thread Milian Wolff via cfe-commits
milianw accepted this revision.
milianw added a comment.
This revision is now accepted and ready to land.

From my POV this is still fine. Manuel, Sergey - could you have a look at this 
please and push it upstream if you agree with me?

Thanks


http://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-11-20 Thread guibufolo+l...@gmail.com via cfe-commits
RedX2501 added a comment.

Ping


http://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-11-04 Thread Kevin Funk via cfe-commits
kfunk added inline comments.


Comment at: bindings/python/clang/cindex.py:1589
@@ +1588,3 @@
+def is_assignment(self):
+return BinaryOperator.Assign.value <= self.value < 
BinaryOperator.Comma.value
+

TIL chaining comparisons in Python is OK... :)

I first though this expression gives the wrong result and you need `min <= val 
and val < max`. But indeed your expression does exactly this...


Comment at: bindings/python/tests/cindex/test_cursor.py:333
@@ +332,3 @@
+# not exposed yet
+# ".*" : BinaryOperator.PtrMemD,
+"->*" : BinaryOperator.PtrMemI,

What about this? How is it not exposed? 

This works in the C++ test apparently(?)


Comment at: tools/libclang/CIndex.cpp:6749
@@ -6743,1 +6748,3 @@
 
+enum CX_BinaryOperatorKind clang_Cursor_getBinaryOpCode(CXCursor C) {
+   if (C.kind != CXCursor_BinaryOperator &&

I'd rename to `getBinaryOpcode` (note the casing, more consistent).

Same below, rename to `getBinaryOpcodeString` (casing + full words)


Comment at: tools/libclang/CIndex.cpp:6763
@@ +6762,3 @@
+
+CXString clang_Cursor_getBinaryOpCodeStr(CXCursor C) {
+   if (C.kind != CXCursor_BinaryOperator &&

I think this should have a `enum CX_BinaryOperatorKind` as parameter instead.

There's `BinaryOperator::getOpcode(Opcode)` you can use.


http://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-11-04 Thread guibufolo+l...@gmail.com via cfe-commits
RedX2501 marked 2 inline comments as done.


Comment at: bindings/python/tests/cindex/test_cursor.py:333
@@ +332,3 @@
+# not exposed yet
+# ".*" : BinaryOperator.PtrMemD,
+"->*" : BinaryOperator.PtrMemI,

kfunk wrote:
> What about this? How is it not exposed? 
> 
> This works in the C++ test apparently(?)
Yeah, I was surprised too. I have no idea why one is exposed and the other 
not...

But i don't feel like investigating it as I don't need it and this operator is 
not used often.


http://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-11-04 Thread guibufolo+l...@gmail.com via cfe-commits
RedX2501 updated this revision to Diff 39176.
RedX2501 added a comment.

Changed points raised during review.


http://reviews.llvm.org/D10833

Files:
  bindings/python/clang/cindex.py
  bindings/python/tests/cindex/test_cursor.py
  include/clang-c/Index.h
  include/clang/AST/OperationKinds.h
  test/Index/binop.cpp
  tools/c-index-test/c-index-test.c
  tools/libclang/CIndex.cpp

Index: tools/libclang/CIndex.cpp
===
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -3725,6 +3725,11 @@
   return cxstring::createDup(OS.str());
 }
 
+if (C.kind == CXCursor_BinaryOperator ||
+C.kind == CXCursor_CompoundAssignOperator) {
+  return clang_Cursor_getBinaryOpcodeStr(clang_Cursor_getBinaryOpcode(C));
+}
+
 const Decl *D = getDeclFromExpr(getCursorExpr(C));
 if (D)
   return getDeclSpelling(D);
@@ -6741,6 +6746,29 @@
   return 0;
 }
 
+enum CX_BinaryOperatorKind clang_Cursor_getBinaryOpcode(CXCursor C) {
+	if (C.kind != CXCursor_BinaryOperator &&
+		C.kind != CXCursor_CompoundAssignOperator) {
+		return CX_BO_Invalid;
+	}
+
+	const Expr *D = getCursorExpr(C);
+	if (const BinaryOperator *BinOp = dyn_cast(D)) {
+		return static_cast(BinOp->getOpcode() + 1);
+	}
+
+	return CX_BO_Invalid;
+}
+
+CXString clang_Cursor_getBinaryOpcodeStr(enum CX_BinaryOperatorKind Op) {
+	if (Op > CX_BO_LAST) {
+		return cxstring::createEmpty();
+	}
+
+	return cxstring::createDup(
+			BinaryOperator::getOpcodeStr(static_cast(Op - 1)));
+}
+
 CXSourceRange clang_Cursor_getCommentRange(CXCursor C) {
   if (!clang_isDeclaration(C.kind))
 return clang_getNullRange();
Index: tools/c-index-test/c-index-test.c
===
--- tools/c-index-test/c-index-test.c
+++ tools/c-index-test/c-index-test.c
@@ -1425,6 +1425,21 @@
   return CXChildVisit_Recurse;
 }
 
+static enum CXChildVisitResult PrintBinOps(CXCursor C, CXCursor p,
+   CXClientData d){
+  enum CXCursorKind ck = clang_getCursorKind(C);
+  if (ck != CXCursor_BinaryOperator && ck != CXCursor_CompoundAssignOperator)
+return CXChildVisit_Recurse;
+
+  PrintCursor(C, NULL);
+  enum CX_BinaryOperatorKind bok = clang_Cursor_getBinaryOpcode(C);
+  CXString opstr = clang_Cursor_getBinaryOpcodeStr(bok);
+  printf(" BinOp=%s %d\n", clang_getCString(opstr), bok);
+
+  return CXChildVisit_Recurse;
+}
+
+
 /**/
 /* Mangling testing.  */
 /**/
@@ -4068,6 +4083,7 @@
 "   c-index-test -test-print-type {}*\n"
 "   c-index-test -test-print-type-size {}*\n"
 "   c-index-test -test-print-bitwidth {}*\n"
+"   c-index-test -test-print-binops {}*\n"
 "   c-index-test -print-usr [ {}]*\n"
 "   c-index-test -print-usr-file \n"
 "   c-index-test -write-pch  \n");
@@ -4161,6 +4177,9 @@
   else if (argc > 2 && strcmp(argv[1], "-test-print-bitwidth") == 0)
 return perform_test_load_source(argc - 2, argv + 2, "all",
 PrintBitWidth, 0);
+  else if (argc > 2 && strcmp(argv[1], "-test-print-binops") == 0)
+return perform_test_load_source(argc - 2, argv + 2, "all",
+PrintBinOps, 0);
   else if (argc > 2 && strcmp(argv[1], "-test-print-mangle") == 0)
 return perform_test_load_tu(argv[2], "all", NULL, PrintMangledName, NULL);
   else if (argc > 1 && strcmp(argv[1], "-print-usr") == 0) {
Index: test/Index/binop.cpp
===
--- /dev/null
+++ test/Index/binop.cpp
@@ -0,0 +1,90 @@
+// RUN: c-index-test -test-print-binops %s | FileCheck %s
+
+struct C {
+  int m;
+};
+
+void func(void){
+	int a, b;
+  int C::* p = ::m;
+
+	C c;
+	c.*p;
+
+	C* pc;
+	pc->*p;
+
+	a * b;
+	a / b;
+	a % b;
+	a + b;
+	a - b;
+
+	a << b;
+	a >> b;
+
+	a < b;
+	a > b;
+
+	a <= b;
+	a >= b;
+	a == b;
+	a != b;
+	
+	a & b;
+	a ^ b;
+	a | b;
+
+	a && b;
+	a || b;
+
+	a = b;
+
+	a *= b;
+	a /= b;
+	a %= b;
+	a += b;
+	a -= b;
+	
+	a <<= b;
+	a >>= b;
+
+	a &= b;
+	a ^= b;
+	a |= b;
+	a , b;
+
+}
+
+// CHECK: BinaryOperator=.* BinOp=.* 1
+// CHECK: BinaryOperator=->* BinOp=->* 2
+// CHECK: BinaryOperator=* BinOp=* 3
+// CHECK: BinaryOperator=/ BinOp=/ 4
+// CHECK: BinaryOperator=% BinOp=% 5
+// CHECK: BinaryOperator=+ BinOp=+ 6
+// CHECK: BinaryOperator=- BinOp=- 7
+// CHECK: BinaryOperator=<< BinOp=<< 8
+// CHECK: BinaryOperator=>> BinOp=>> 9
+// CHECK: BinaryOperator=< BinOp=< 10
+// CHECK: BinaryOperator=> BinOp=> 11
+// CHECK: BinaryOperator=<= BinOp=<= 12
+// CHECK: BinaryOperator=>= BinOp=>= 13
+// CHECK: BinaryOperator=== BinOp=== 14
+// CHECK: BinaryOperator=!= BinOp=!= 15
+// CHECK: BinaryOperator=& BinOp=& 16
+// CHECK: 

Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-11-03 Thread guibufolo+l...@gmail.com via cfe-commits
RedX2501 updated this revision to Diff 39158.
RedX2501 added a comment.

Added module tests to libclang and python.


http://reviews.llvm.org/D10833

Files:
  bindings/python/clang/cindex.py
  bindings/python/tests/cindex/test_cursor.py
  include/clang-c/Index.h
  include/clang/AST/OperationKinds.h
  test/Index/binop.cpp
  tools/c-index-test/c-index-test.c
  tools/libclang/CIndex.cpp

Index: tools/libclang/CIndex.cpp
===
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -3725,6 +3725,11 @@
   return cxstring::createDup(OS.str());
 }
 
+if (C.kind == CXCursor_BinaryOperator ||
+C.kind == CXCursor_CompoundAssignOperator) {
+  return clang_Cursor_getBinaryOpCodeStr(C);
+}
+
 const Decl *D = getDeclFromExpr(getCursorExpr(C));
 if (D)
   return getDeclSpelling(D);
@@ -6741,6 +6746,34 @@
   return 0;
 }
 
+enum CX_BinaryOperatorKind clang_Cursor_getBinaryOpCode(CXCursor C) {
+	if (C.kind != CXCursor_BinaryOperator &&
+		C.kind != CXCursor_CompoundAssignOperator) {
+		return CX_BO_Invalid;
+	}
+
+	const Expr *D = getCursorExpr(C);
+	if (const BinaryOperator *BinOp = dyn_cast(D)) {
+		return static_cast(BinOp->getOpcode() + 1);
+	}
+
+	return CX_BO_Invalid;
+}
+
+CXString clang_Cursor_getBinaryOpCodeStr(CXCursor C) {
+	if (C.kind != CXCursor_BinaryOperator &&
+		C.kind != CXCursor_CompoundAssignOperator) {
+		return cxstring::createEmpty();
+	}
+
+	const Expr *D = getCursorExpr(C);
+	if (const BinaryOperator *BinOp = dyn_cast(D)) {
+		return cxstring::createDup(BinOp->getOpcodeStr());
+	}
+
+	return cxstring::createEmpty();
+}
+
 CXSourceRange clang_Cursor_getCommentRange(CXCursor C) {
   if (!clang_isDeclaration(C.kind))
 return clang_getNullRange();
Index: tools/c-index-test/c-index-test.c
===
--- tools/c-index-test/c-index-test.c
+++ tools/c-index-test/c-index-test.c
@@ -1425,6 +1425,21 @@
   return CXChildVisit_Recurse;
 }
 
+static enum CXChildVisitResult PrintBinOps(CXCursor C, CXCursor p,
+   CXClientData d){
+  enum CXCursorKind ck = clang_getCursorKind(C);
+  if (ck != CXCursor_BinaryOperator && ck != CXCursor_CompoundAssignOperator)
+return CXChildVisit_Recurse;
+
+  PrintCursor(C, NULL);
+  CXString opstr = clang_Cursor_getBinaryOpCodeStr(C);
+  enum CX_BinaryOperatorKind bok = clang_Cursor_getBinaryOpCode(C);
+  printf(" BinOp=%s %d\n", clang_getCString(opstr), bok);
+
+  return CXChildVisit_Recurse;
+}
+
+
 /**/
 /* Mangling testing.  */
 /**/
@@ -4068,6 +4083,7 @@
 "   c-index-test -test-print-type {}*\n"
 "   c-index-test -test-print-type-size {}*\n"
 "   c-index-test -test-print-bitwidth {}*\n"
+"   c-index-test -test-print-binops {}*\n"
 "   c-index-test -print-usr [ {}]*\n"
 "   c-index-test -print-usr-file \n"
 "   c-index-test -write-pch  \n");
@@ -4161,6 +4177,9 @@
   else if (argc > 2 && strcmp(argv[1], "-test-print-bitwidth") == 0)
 return perform_test_load_source(argc - 2, argv + 2, "all",
 PrintBitWidth, 0);
+  else if (argc > 2 && strcmp(argv[1], "-test-print-binops") == 0)
+return perform_test_load_source(argc - 2, argv + 2, "all",
+PrintBinOps, 0);
   else if (argc > 2 && strcmp(argv[1], "-test-print-mangle") == 0)
 return perform_test_load_tu(argv[2], "all", NULL, PrintMangledName, NULL);
   else if (argc > 1 && strcmp(argv[1], "-print-usr") == 0) {
Index: test/Index/binop.cpp
===
--- /dev/null
+++ test/Index/binop.cpp
@@ -0,0 +1,90 @@
+// RUN: c-index-test -test-print-binops %s | FileCheck %s
+
+struct C {
+  int m;
+};
+
+void func(void){
+	int a, b;
+  int C::* p = ::m;
+
+	C c;
+	c.*p;
+
+	C* pc;
+	pc->*p;
+
+	a * b;
+	a / b;
+	a % b;
+	a + b;
+	a - b;
+
+	a << b;
+	a >> b;
+
+	a < b;
+	a > b;
+
+	a <= b;
+	a >= b;
+	a == b;
+	a != b;
+	
+	a & b;
+	a ^ b;
+	a | b;
+
+	a && b;
+	a || b;
+
+	a = b;
+
+	a *= b;
+	a /= b;
+	a %= b;
+	a += b;
+	a -= b;
+	
+	a <<= b;
+	a >>= b;
+
+	a &= b;
+	a ^= b;
+	a |= b;
+	a , b;
+
+}
+
+// CHECK: BinaryOperator=.* BinOp=.* 1
+// CHECK: BinaryOperator=->* BinOp=->* 2
+// CHECK: BinaryOperator=* BinOp=* 3
+// CHECK: BinaryOperator=/ BinOp=/ 4
+// CHECK: BinaryOperator=% BinOp=% 5
+// CHECK: BinaryOperator=+ BinOp=+ 6
+// CHECK: BinaryOperator=- BinOp=- 7
+// CHECK: BinaryOperator=<< BinOp=<< 8
+// CHECK: BinaryOperator=>> BinOp=>> 9
+// CHECK: BinaryOperator=< BinOp=< 10
+// CHECK: BinaryOperator=> BinOp=> 11
+// CHECK: BinaryOperator=<= BinOp=<= 12
+// CHECK: BinaryOperator=>= BinOp=>= 13
+// CHECK: BinaryOperator=== 

Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-10-13 Thread Manuel Klimek via cfe-commits
klimek added a reviewer: milianw.
klimek added a comment.

+milian - can you take a look at this patch (or do you know somebody who might 
be in a good position to review)


http://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-10-13 Thread Milian Wolff via cfe-commits
milianw added a comment.

This looks good to me, but it's missing a unit test. Take a look at 
http://reviews.llvm.org/D13388 for how to do that in principle.


http://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-09-22 Thread guibufolo+l...@gmail.com via cfe-commits
RedX2501 added a comment.

Ping


http://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-09-03 Thread guibufolo+l...@gmail.com via cfe-commits
RedX2501 added a comment.

Ping


http://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-08-24 Thread guibufolo+l...@gmail.com via cfe-commits
RedX2501 added a comment.

Ping


http://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-08-10 Thread guibufolo+l...@gmail.com via cfe-commits
RedX2501 added a reviewer: doug.gregor.
RedX2501 added a comment.

The code owners file says you are the owner of all parts that do not belong to 
somebody else. So i hope it is ok if i attach you as reviewer to this.


http://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-08-10 Thread guibufolo+l...@gmail.com via cfe-commits
RedX2501 added a comment.

Ping


http://reviews.llvm.org/D10833



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits