[CodeComplete] Cleanup access checking in code completion

Summary: Also fixes a crash (see the added 'accessibility-crash.cpp' test).

Reviewers: ioeric, kadircet

Reviewed By: kadircet

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D55124

llvm-svn: 348135
diff --git a/clang/test/CodeCompletion/accessibility-crash.cpp b/clang/test/CodeCompletion/accessibility-crash.cpp
new file mode 100644
index 0000000..b54f7ce
--- /dev/null
+++ b/clang/test/CodeCompletion/accessibility-crash.cpp
@@ -0,0 +1,23 @@
+class X {
+public:
+ int pub;
+protected:
+ int prot;
+private:
+ int priv;
+};
+
+class Y : public X {
+  int test() {
+    []() {
+
+      // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:13:1 %s -o - \
+      // RUN: | FileCheck %s
+      // CHECK: priv (InBase,Inaccessible)
+      // CHECK: prot (InBase)
+      // CHECK: pub (InBase)
+    };
+  }
+};
+
+