]> granicus.if.org Git - clang/commitdiff
pchify CXXMemberCallExpr correctly. Before it would serialize
authorChris Lattner <sabre@nondot.org>
Sun, 9 May 2010 05:36:05 +0000 (05:36 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 9 May 2010 05:36:05 +0000 (05:36 +0000)
and deserialize as a CallExpr which is close, but ends up
deserializing with the wrong stmt class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103371 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/ExprCXX.h
include/clang/Frontend/PCHBitCodes.h
lib/Frontend/PCHReaderStmt.cpp
lib/Frontend/PCHWriterStmt.cpp
test/PCH/cxx_exprs.h

index f9ca78ad292d76e0b0c68d5b5e1282c2fd7e0543..c11f55b95bd6cfebfc9a6233b05a82d13ce8cde6 100644 (file)
@@ -88,10 +88,13 @@ public:
 /// the object argument).
 class CXXMemberCallExpr : public CallExpr {
 public:
-  CXXMemberCallExpr(ASTContextC, Expr *fn, Expr **args, unsigned numargs,
+  CXXMemberCallExpr(ASTContext &C, Expr *fn, Expr **args, unsigned numargs,
                     QualType t, SourceLocation rparenloc)
     : CallExpr(C, CXXMemberCallExprClass, fn, args, numargs, t, rparenloc) {}
 
+  CXXMemberCallExpr(ASTContext &C, EmptyShell Empty)
+    : CallExpr(C, CXXMemberCallExprClass, Empty) { }
+
   /// getImplicitObjectArgument - Retrieves the implicit object
   /// argument for the member call. For example, in "x.f(5)", this
   /// operation would return "x".
index 08efcc296f2b80feeb15cec70a01d89a3133bea8..5d9b02788fd138574c5d9eff4ea2d955a516f7ad 100644 (file)
@@ -730,6 +730,8 @@ namespace clang {
 
       /// \brief A CXXOperatorCallExpr record.
       EXPR_CXX_OPERATOR_CALL,
+      /// \brief A CXXMemberCallExpr record.
+      EXPR_CXX_MEMBER_CALL,
       /// \brief A CXXConstructExpr record.
       EXPR_CXX_CONSTRUCT,
       // \brief A CXXStaticCastExpr record.
index ef6b77026d7f79eb65c3ee92935f7ee7922fc1a2..394a894e4e4c2e7882504952c219b35285f1d830 100644 (file)
@@ -1304,6 +1304,10 @@ Stmt *PCHReader::ReadStmt(llvm::BitstreamCursor &Cursor) {
     case pch::EXPR_CXX_OPERATOR_CALL:
       S = new (Context) CXXOperatorCallExpr(*Context, Empty);
       break;
+
+    case pch::EXPR_CXX_MEMBER_CALL:
+      S = new (Context) CXXMemberCallExpr(*Context, Empty);
+      break;
         
     case pch::EXPR_CXX_CONSTRUCT:
       S = new (Context) CXXConstructExpr(Empty, *Context,
index a1993d37f2dceb4c991fcf0406fe2b2e165fb64b..3c2022ea99832c2f37273ddebfcccd6d795d20e4 100644 (file)
@@ -112,6 +112,7 @@ namespace {
 
     // C++ Statements
     void VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E);
+    void VisitCXXMemberCallExpr(CXXMemberCallExpr *E);
     void VisitCXXConstructExpr(CXXConstructExpr *E);
     void VisitCXXNamedCastExpr(CXXNamedCastExpr *E);
     void VisitCXXStaticCastExpr(CXXStaticCastExpr *E);
@@ -848,6 +849,11 @@ void PCHStmtWriter::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
   Code = pch::EXPR_CXX_OPERATOR_CALL;
 }
 
+void PCHStmtWriter::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {
+  VisitCallExpr(E);
+  Code = pch::EXPR_CXX_MEMBER_CALL;
+}
+
 void PCHStmtWriter::VisitCXXConstructExpr(CXXConstructExpr *E) {
   VisitExpr(E);
   Writer.AddDeclRef(E->getConstructor(), Record);
index a871aa201f124d70530f5cf09d743fe37692a6d2..6766842f0a2dc778b1245619495d04890665ee29 100644 (file)
@@ -27,3 +27,8 @@ const bool false_value = false;
 
 // CXXNullPtrLiteralExpr
 typedef __typeof__(nullptr) cxx_null_ptr_result;
+
+void foo(Derived *P) {
+  // CXXMemberCallExpr
+  P->f();
+}
\ No newline at end of file