Thanks for the advice.<div><br></div><div>Dillon has explained property is a widely used feature.</div><div><br></div><div>This patch is far from complete, and I've brought it up here to discuss the best way to implement the property feature. After we get a solution, I will make sure the patch conform to LLVM & Clang coding standards :-)</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Dec 7, 2012 at 6:16 AM, Nikola Smiljanic <span dir="ltr"><<a href="mailto:popizdeh@gmail.com" target="_blank">popizdeh@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Clang has a policy of only supporting compatibility features that are<br>
widely used. Is there a large codebase that depends on this, and has<br>
this been discussed?<br>
<br>
As for the patch itself, the test should be a part of it, I can't<br>
comment the implementation. Have a look at the existing test, it<br>
should have something like this at he top<br>
<br>
// RUN: %clang_cc1 -fsyntax-only -verify %s -ms-compatibility<br>
// expected-no-diagnostics<br>
<div><div class="h5"><br>
<br>
On Fri, Dec 7, 2012 at 4:52 AM, <a href="mailto:endlessroad1991@gmail.com">endlessroad1991@gmail.com</a><br>
<<a href="mailto:endlessroad1991@gmail.com">endlessroad1991@gmail.com</a>> wrote:<br>
> Hey guys, I've worked out a preliminary patch to support MSVC<br>
> __declspec(property), based on 3.2RC2.<br>
> Patch and a simple test cpp file attached. Please compile the test case with<br>
> -fms-extensions.<br>
><br>
> Current status:<br>
> - Support getter/setter<br>
> - Support template (see attached test file)<br>
> - No support for +=, -=, etc<br>
> - No support for implicit type conversion for arguments of getter/setter<br>
> functions<br>
><br>
> Brief introduction on implementation:<br>
> 1. Let Parser parse property declaration.<br>
> 2. Add a "PropertyAttr" class to store getter/putter function names.<br>
> 3. Notice that there can be "[]" after property declaration, and number of<br>
> "[]" indicates number of args for getter/setter function(see attached test<br>
> file). Add a field to QualType to store number of "[]". I know it's<br>
> horrible, but for a working prototype, that's enough.<br>
> 4. Add a "MSPropertyExpr". When we encounter property usage in Parser, we<br>
> don't know whether it's get or set. So we have to add an action AFTER Sema,<br>
> or do it in CodeGen. Either way, while parsing, all we know is arguments for<br>
> getter/setter.<br>
> 5. In CodeGen, deal with "MSPropertyExpr". If it's "scalar" in CodeGen, it's<br>
> a get, replace it with a CallExpr to getter. If it's "LValue" on the left<br>
> side of an assignment, replace the whole assignment with a CallExpr to<br>
> setter.<br>
><br>
> I know the timing is really bad..<br>
> But, any comments?<br>
><br>
> --<br>
> Best Regards, Tong Shen (沈彤)<br>
><br>
</div></div>> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Best Regards, Tong Shen (沈彤)<br>
</div>