[cfe-commits] r94730 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/CXX/class.access/p4.cpp
John McCall
rjmccall at apple.com
Wed Jan 27 17:54:34 PST 2010
Author: rjmccall
Date: Wed Jan 27 19:54:34 2010
New Revision: 94730
URL: http://llvm.org/viewvc/llvm-project?rev=94730&view=rev
Log:
Access control for overloaded call operators. Not for surrogates yet,
mostly because we're going to want a better diagnostic for conversions.
Also this API needs to go back to sanity.
Modified:
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/test/CXX/class.access/p4.cpp
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=94730&r1=94729&r2=94730&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Wed Jan 27 19:54:34 2010
@@ -6231,6 +6231,8 @@
= cast<CXXConversionDecl>(
Best->Conversions[0].UserDefined.ConversionFunction);
+ // FIXME: access control
+
// We selected one of the surrogate functions that converts the
// object parameter to a function pointer. Perform the conversion
// on the object argument, then let ActOnCallExpr finish the job.
@@ -6244,6 +6246,9 @@
CommaLocs, RParenLoc).release();
}
+ if (getLangOptions().AccessControl)
+ CheckAccess(R, Best->Function, Best->getAccess());
+
// We found an overloaded operator(). Build a CXXOperatorCallExpr
// that calls this method, using Object for the implicit object
// parameter and passing along the remaining arguments.
Modified: cfe/trunk/test/CXX/class.access/p4.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class.access/p4.cpp?rev=94730&r1=94729&r2=94730&view=diff
==============================================================================
--- cfe/trunk/test/CXX/class.access/p4.cpp (original)
+++ cfe/trunk/test/CXX/class.access/p4.cpp Wed Jan 27 19:54:34 2010
@@ -38,12 +38,15 @@
public:
void operator+(Public&);
void operator[](Public&);
+ void operator()(Public&);
protected:
void operator+(Protected&); // expected-note {{declared protected here}}
void operator[](Protected&); // expected-note {{declared protected here}}
+ void operator()(Protected&); // expected-note {{declared protected here}}
private:
void operator+(Private&); // expected-note {{declared private here}}
void operator[](Private&); // expected-note {{declared private here}}
+ void operator()(Private&); // expected-note {{declared private here}}
void operator-(); // expected-note {{declared private here}}
};
void operator+(const A &, Public&);
@@ -58,6 +61,9 @@
a[pub];
a[prot]; // expected-error {{access to protected member}}
a[priv]; // expected-error {{access to private member}}
+ a(pub);
+ a(prot); // expected-error {{access to protected member}}
+ a(priv); // expected-error {{access to private member}}
-a; // expected-error {{access to private member}}
const A &ca = a;
More information about the cfe-commits
mailing list