[cfe-commits] r165832 - in /cfe/trunk: lib/AST/StmtPrinter.cpp test/CXX/ast-print.cpp
Eli Friedman
eli.friedman at gmail.com
Fri Oct 12 15:45:14 PDT 2012
Author: efriedma
Date: Fri Oct 12 17:45:14 2012
New Revision: 165832
URL: http://llvm.org/viewvc/llvm-project?rev=165832&view=rev
Log:
Fix -ast-print for uses of operator->.
Patch by Grzegorz Jablonski.
Added:
cfe/trunk/test/CXX/ast-print.cpp
Modified:
cfe/trunk/lib/AST/StmtPrinter.cpp
Modified: cfe/trunk/lib/AST/StmtPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=165832&r1=165831&r2=165832&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtPrinter.cpp (original)
+++ cfe/trunk/lib/AST/StmtPrinter.cpp Fri Oct 12 17:45:14 2012
@@ -1130,6 +1130,8 @@
PrintExpr(Node->getArg(0));
OS << ' ' << OpStrings[Kind];
}
+ } else if (Kind == OO_Arrow) {
+ PrintExpr(Node->getArg(0));
} else if (Kind == OO_Call) {
PrintExpr(Node->getArg(0));
OS << '(';
Added: cfe/trunk/test/CXX/ast-print.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/ast-print.cpp?rev=165832&view=auto
==============================================================================
--- cfe/trunk/test/CXX/ast-print.cpp (added)
+++ cfe/trunk/test/CXX/ast-print.cpp Fri Oct 12 17:45:14 2012
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -ast-print %s | FileCheck %s
+
+// CHECK: r;
+// CHECK-NEXT: (r->method());
+struct MyClass
+{
+ void method() {}
+};
+
+struct Reference
+{
+ MyClass* object;
+ MyClass* operator ->() { return object; }
+};
+
+int main()
+{
+ Reference r;
+ (r->method());
+}
+
More information about the cfe-commits
mailing list