[cfe-dev] [RFC] Preliminary patch to support MSVC __declspec(property)

João Matos ripzonetriton at gmail.com
Wed Dec 26 14:41:24 PST 2012


One more thing I found out while reviewing:

+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -2544,6 +2544,9 @@ Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS,
     case Decl::CXXConstructor:
       valueKind = VK_RValue;
       break;
+
+    case Decl::MSProperty:
+      valueKind = VK_LValue;
     }

This is missing a break.

I added the missing serialization and deserialization code:

+void ASTStmtWriter::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) {
+  VisitExpr(E);
+  Writer.AddSourceRange(E->getSourceRange(), Record);
+  Writer.AddSourceLocation(E->getMemberLoc(), Record);
+  Writer.AddStmt(E->getBaseExpr());
+  Writer.AddDeclRef(E->getMSPropertyDecl(), Record);
+  Record.push_back(E->isArrow());
+  Code = serialization::EXPR_CXX_MS_PROPERTY_REF_EXPR;
+}
+

+void ASTStmtReader::VisitMSPropertyRefExpr(MSPropertyRefExpr *E) {
+  VisitExpr(E);
+  E->setSourceRange(ReadSourceRange(Record, Idx));
+  E->MemberLoc = ReadSourceLocation(Record, Idx);
+  E->BaseExpr = Reader.ReadSubExpr();
+  E->Decl = ReadDeclAs<MSPropertyDecl>(Record, Idx);
+  E->IsArrow = Record[Idx++];
+}
+

       S = new (Context) CXXUuidofExpr(Empty, true);
       break;
+    case EXPR_CXX_MS_PROPERTY_REF_EXPR:
+      S = new (Context) MSPropertyRefExpr(Empty);
+      break;

+++ b/include/clang/AST/ExprCXX.h

+class MSPropertyRefExpr : public Expr {
(...)
+
+  friend class ASTStmtReader;
+
+public:
(...)
+
+  MSPropertyRefExpr(EmptyShell Empty) : Expr(MSPropertyRefExprClass,
Empty) {}


-- 
João Matos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121226/50627af1/attachment.html>


More information about the cfe-dev mailing list