[llvm-branch-commits] [cfe-branch] r105043 - in /cfe/branches/Apple/whitney: lib/Sema/SemaAccess.cpp test/CXX/class.access/class.access.base/p1.cpp test/CXX/class.access/class.access.base/p5.cpp test/CXX/class.access/class.friend/p1.cpp test/CXX/class.access/class.protected/p1.cpp test/CXX/class.access/p4.cpp test/SemaCXX/access-base-class.cpp
Daniel Dunbar
daniel at zuster.org
Fri May 28 16:07:04 PDT 2010
Author: ddunbar
Date: Fri May 28 18:07:04 2010
New Revision: 105043
URL: http://llvm.org/viewvc/llvm-project?rev=105043&view=rev
Log:
Merge r104937:
--
Author: Douglas Gregor <dgregor at apple.com>
Date: Fri May 28 04:34:55 2010 +0000
When we complain about a member being inaccessible due to a constraint
along an access path, add another note pointing at the member we
actually found.
Modified:
cfe/branches/Apple/whitney/lib/Sema/SemaAccess.cpp
cfe/branches/Apple/whitney/test/CXX/class.access/class.access.base/p1.cpp
cfe/branches/Apple/whitney/test/CXX/class.access/class.access.base/p5.cpp
cfe/branches/Apple/whitney/test/CXX/class.access/class.friend/p1.cpp
cfe/branches/Apple/whitney/test/CXX/class.access/class.protected/p1.cpp
cfe/branches/Apple/whitney/test/CXX/class.access/p4.cpp
cfe/branches/Apple/whitney/test/SemaCXX/access-base-class.cpp
Modified: cfe/branches/Apple/whitney/lib/Sema/SemaAccess.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Sema/SemaAccess.cpp?rev=105043&r1=105042&r2=105043&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Sema/SemaAccess.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Sema/SemaAccess.cpp Fri May 28 18:07:04 2010
@@ -870,6 +870,10 @@
<< BS->getSourceRange()
<< (BaseAccess == AS_protected)
<< (BS->getAccessSpecifierAsWritten() == AS_none);
+
+ if (D)
+ S.Diag(D->getLocation(), diag::note_field_decl);
+
return;
}
}
Modified: cfe/branches/Apple/whitney/test/CXX/class.access/class.access.base/p1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/CXX/class.access/class.access.base/p1.cpp?rev=105043&r1=105042&r2=105043&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/CXX/class.access/class.access.base/p1.cpp (original)
+++ cfe/branches/Apple/whitney/test/CXX/class.access/class.access.base/p1.cpp Fri May 28 18:07:04 2010
@@ -54,8 +54,10 @@
// of the base class are accessible as protected members of the
// derived class.
namespace test1 {
- class Base {
- public: int pub; static int spub;
+ class Base { // expected-note 6{{member is declared here}}
+ public:
+ int pub; // expected-note{{member is declared here}}
+ static int spub; // expected-note{{member is declared here}}
protected: int prot; static int sprot; // expected-note 4 {{declared protected here}}
private: int priv; static int spriv; // expected-note 8 {{declared private here}}
};
@@ -102,13 +104,15 @@
// the base class are accessible as private members of the derived
// class.
namespace test2 {
- class Base {
+ class Base { // expected-note 6{{member is declared here}}
public:
- int pub;
- static int spub;
+ int pub; // expected-note{{member is declared here}}
+ static int spub; // expected-note{{member is declared here}}
protected:
- int prot; // expected-note {{declared protected here}}
- static int sprot; // expected-note {{declared protected here}}
+ int prot; // expected-note {{declared protected here}} \
+ // expected-note{{member is declared here}}
+ static int sprot; // expected-note {{declared protected here}} \
+ // expected-note{{member is declared here}}
private:
int priv; // expected-note 4 {{declared private here}}
static int spriv; // expected-note 4 {{declared private here}}
Modified: cfe/branches/Apple/whitney/test/CXX/class.access/class.access.base/p5.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/CXX/class.access/class.access.base/p5.cpp?rev=105043&r1=105042&r2=105043&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/CXX/class.access/class.access.base/p5.cpp (original)
+++ cfe/branches/Apple/whitney/test/CXX/class.access/class.access.base/p5.cpp Fri May 28 18:07:04 2010
@@ -27,7 +27,7 @@
};
struct D {
- public: static int x;
+ public: static int x; // expected-note{{member is declared here}}
static int test() { return x; }
};
struct E : private D { // expected-note{{constrained by private inheritance}}
@@ -45,7 +45,7 @@
namespace test2 {
class A {
- protected: static int x;
+ protected: static int x; // expected-note{{member is declared here}}
};
class B : private A {}; // expected-note {{private inheritance}}
Modified: cfe/branches/Apple/whitney/test/CXX/class.access/class.friend/p1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/CXX/class.access/class.friend/p1.cpp?rev=105043&r1=105042&r2=105043&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/CXX/class.access/class.friend/p1.cpp (original)
+++ cfe/branches/Apple/whitney/test/CXX/class.access/class.friend/p1.cpp Fri May 28 18:07:04 2010
@@ -121,7 +121,7 @@
friend struct ilist_walker_bad;
X *Prev;
protected:
- X *getPrev() { return Prev; }
+ X *getPrev() { return Prev; } // expected-note{{member is declared here}}
};
class ilist_node : private ilist_half_node { // expected-note {{declared private here}} expected-note {{constrained by private inheritance here}}
Modified: cfe/branches/Apple/whitney/test/CXX/class.access/class.protected/p1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/CXX/class.access/class.protected/p1.cpp?rev=105043&r1=105042&r2=105043&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/CXX/class.access/class.protected/p1.cpp (original)
+++ cfe/branches/Apple/whitney/test/CXX/class.access/class.protected/p1.cpp Fri May 28 18:07:04 2010
@@ -2,8 +2,10 @@
namespace test0 {
class A {
- protected: int x; // expected-note 3 {{declared}}
- static int sx; // expected-note 3 {{declared}}
+ protected: int x; // expected-note 3 {{declared}} \
+ // expected-note {{member is declared here}}
+ static int sx; // expected-note 3 {{declared}} \
+ // expected-note {{member is declared here}}
};
class B : public A {
};
@@ -136,8 +138,8 @@
namespace test4 {
class C;
class A {
- protected: int x; // expected-note 2 {{declared}}
- static int sx;
+ protected: int x; // expected-note 3 {{declared}}
+ static int sx; // expected-note 3{{member is declared here}}
static void test(C&);
};
class B : public A {
@@ -174,8 +176,8 @@
namespace test5 {
class D;
class A {
- protected: int x;
- static int sx;
+ protected: int x; // expected-note 3{{member is declared here}}
+ static int sx; // expected-note 3{{member is declared here}}
static void test(D&);
};
class B : public A {
@@ -326,11 +328,12 @@
}
namespace test9 {
- class A {
- protected: int foo(); // expected-note 8 {{declared}}
+ class A { // expected-note {{member is declared here}}
+ protected: int foo(); // expected-note 8 {{declared}} \
+ // expected-note {{member is declared here}}
};
- class B : public A {
+ class B : public A { // expected-note {{member is declared here}}
friend class D;
};
Modified: cfe/branches/Apple/whitney/test/CXX/class.access/p4.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/CXX/class.access/p4.cpp?rev=105043&r1=105042&r2=105043&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/CXX/class.access/p4.cpp (original)
+++ cfe/branches/Apple/whitney/test/CXX/class.access/p4.cpp Fri May 28 18:07:04 2010
@@ -160,7 +160,7 @@
private:
operator Private(); // expected-note 4 {{declared private here}}
public:
- operator Public();
+ operator Public(); // expected-note 2{{member is declared here}}
};
class Derived1 : private Base { // expected-note 2 {{declared private here}} \
@@ -267,7 +267,7 @@
// Don't silently upgrade forbidden-access paths to private.
namespace test9 {
class A {
- public: static int x;
+ public: static int x; // expected-note {{member is declared here}}
};
class B : private A { // expected-note {{constrained by private inheritance here}}
};
Modified: cfe/branches/Apple/whitney/test/SemaCXX/access-base-class.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/SemaCXX/access-base-class.cpp?rev=105043&r1=105042&r2=105043&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/SemaCXX/access-base-class.cpp (original)
+++ cfe/branches/Apple/whitney/test/SemaCXX/access-base-class.cpp Fri May 28 18:07:04 2010
@@ -61,7 +61,7 @@
namespace T6 {
class C;
- class A {};
+ class A {}; // expected-note{{member is declared here}}
class B : private A { // expected-note {{declared private here}} expected-note {{constrained by private inheritance here}}
void f(C* c);
More information about the llvm-branch-commits
mailing list