[cfe-commits] r141600 - in /cfe/trunk: lib/Sema/SemaAccess.cpp test/Index/complete-qualified.cpp
Douglas Gregor
dgregor at apple.com
Mon Oct 10 16:44:35 PDT 2011
Author: dgregor
Date: Mon Oct 10 18:44:35 2011
New Revision: 141600
URL: http://llvm.org/viewvc/llvm-project?rev=141600&view=rev
Log:
Don't crash in Sema::IsSimplyAccessible if the declaration is not a C++ class member. Fixes PR11108.
Added:
cfe/trunk/test/Index/complete-qualified.cpp (with props)
Modified:
cfe/trunk/lib/Sema/SemaAccess.cpp
Modified: cfe/trunk/lib/Sema/SemaAccess.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaAccess.cpp?rev=141600&r1=141599&r2=141600&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaAccess.cpp (original)
+++ cfe/trunk/lib/Sema/SemaAccess.cpp Mon Oct 10 18:44:35 2011
@@ -1652,7 +1652,7 @@
/// \param Class the class/context from which to start the search
/// \return true if the Decl is accessible from the Class, false otherwise.
bool Sema::IsSimplyAccessible(NamedDecl *Decl, CXXRecordDecl *Class) {
- if (!Class)
+ if (!Class || !Decl->isCXXClassMember())
return true;
QualType qType = Class->getTypeForDecl()->getCanonicalTypeInternal();
Added: cfe/trunk/test/Index/complete-qualified.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-qualified.cpp?rev=141600&view=auto
==============================================================================
--- cfe/trunk/test/Index/complete-qualified.cpp (added)
+++ cfe/trunk/test/Index/complete-qualified.cpp Mon Oct 10 18:44:35 2011
@@ -0,0 +1,20 @@
+template <typename X, typename Y>
+class C
+{
+};
+
+class Foo
+{
+public:
+ C<Foo, class Bar> c;
+};
+
+void foo()
+{
+ Foo::
+
+// RUN: c-index-test -code-completion-at=%s:14:8 %s -o - | FileCheck -check-prefix=CC1 %s
+// CHECK-CC1: FieldDecl:{ResultType C<Foo, class Bar>}{TypedText c} (35)
+// CHECK-CC1: ClassDecl:{TypedText Foo} (35)
+// CHECK-CC1: CXXMethod:{ResultType Foo &}{TypedText operator=}{LeftParen (}{Placeholder const Foo &}{RightParen )} (35)
+// CHECK-CC1: CXXDestructor:{ResultType void}{TypedText ~Foo}{LeftParen (}{RightParen )} (35)
Propchange: cfe/trunk/test/Index/complete-qualified.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/Index/complete-qualified.cpp
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cfe/trunk/test/Index/complete-qualified.cpp
------------------------------------------------------------------------------
svn:mime-type = text/plain
More information about the cfe-commits
mailing list