diff options
-rw-r--r-- | lib/AST/StmtPrinter.cpp | 2 | ||||
-rw-r--r-- | test/CXX/ast-print.cpp | 21 |
2 files changed, 23 insertions, 0 deletions
diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp index 3a9f236f31..93d10f7aaf 100644 --- a/lib/AST/StmtPrinter.cpp +++ b/lib/AST/StmtPrinter.cpp @@ -1130,6 +1130,8 @@ void StmtPrinter::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *Node) { 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 << '('; diff --git a/test/CXX/ast-print.cpp b/test/CXX/ast-print.cpp new file mode 100644 index 0000000000..fb8588d4b1 --- /dev/null +++ b/test/CXX/ast-print.cpp @@ -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()); +} + |