r184319 - [Windows] Fix __declspec(property) when the getter returns a ref
Reid Kleckner
reid at kleckner.net
Wed Jun 19 09:37:24 PDT 2013
Author: rnk
Date: Wed Jun 19 11:37:23 2013
New Revision: 184319
URL: http://llvm.org/viewvc/llvm-project?rev=184319&view=rev
Log:
[Windows] Fix __declspec(property) when the getter returns a ref
This fixes an issue when parsing atlbase.h.
Patch by Will Wilson!
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=184319&r1=184318&r2=184319&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Jun 19 11:37:23 2013
@@ -2003,7 +2003,8 @@ ExprResult Sema::ActOnIdExpression(Scope
MightBeImplicitMember = true;
else
MightBeImplicitMember = isa<FieldDecl>(R.getFoundDecl()) ||
- isa<IndirectFieldDecl>(R.getFoundDecl());
+ isa<IndirectFieldDecl>(R.getFoundDecl()) ||
+ isa<MSPropertyDecl>(R.getFoundDecl());
if (MightBeImplicitMember)
return BuildPossibleImplicitMemberExpr(SS, TemplateKWLoc,
Modified: cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp?rev=184319&r1=184318&r2=184319&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp (original)
+++ cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp Wed Jun 19 11:37:23 2013
@@ -344,3 +344,20 @@ union u {
int *i1;
int &i2; // expected-warning {{union member 'i2' has reference type 'int &', which is a Microsoft extension}}
};
+
+// Property getter using reference.
+struct SP11 {
+ __declspec(property(get=GetV)) int V;
+ int _v;
+ int& GetV() { return _v; }
+ void UseV();
+ void TakePtr(int *) {}
+ void TakeRef(int &) {}
+ void TakeVal(int) {}
+};
+
+void SP11::UseV() {
+ TakePtr(&V);
+ TakeRef(V);
+ TakeVal(V);
+}
More information about the cfe-commits
mailing list