https://bugs.llvm.org/show_bug.cgi?id=33382

            Bug ID: 33382
           Summary: Completions without non-const member functions for
                    const object
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: libclang
          Assignee: unassignedclangb...@nondot.org
          Reporter: nikolai.kos...@qt.io
                CC: kli...@google.com, llvm-bugs@lists.llvm.org

Consider this:

$ cat -n $FILE                                        
     1  struct Foo {
     2  public:
     3      int public_field;
     4      void public_function();
     5  
     6  private:
     7      int private_field;
     8      void private_function();
     9  };
    10  
    11  void g(Foo &foo)
    12  {
    13      foo. // Complete
    14  }
$ ./c-index-test -code-completion-at=$FILE:13:9 $FILE 
StructDecl:{TypedText Foo}{Text ::} (75)
CXXMethod:{ResultType Foo &}{TypedText operator=}{LeftParen (}{Placeholder
const Foo &}{RightParen )} (34)
FieldDecl:{ResultType int}{TypedText private_field} (35) (inaccessible)
CXXMethod:{ResultType void}{TypedText private_function}{LeftParen (}{RightParen
)} (34) (inaccessible)
FieldDecl:{ResultType int}{TypedText public_field} (35)
CXXMethod:{ResultType void}{TypedText public_function}{LeftParen (}{RightParen
)} (34)
CXXDestructor:{ResultType void}{TypedText ~Foo}{LeftParen (}{RightParen )} (34)
Completion contexts:
Dot member access
Container Kind: StructDecl
Container is complete
Container USR: c:@S@Foo
$

This yields items for the private field and private function and denotes them
as inacessible, which is fine.

Now declare "foo" as const& and try again:

$ ./c-index-test -code-completion-at=$FILE:13:9 $FILE 
StructDecl:{TypedText Foo}{Text ::} (75)
FieldDecl:{ResultType int}{TypedText private_field} (35) (inaccessible)
FieldDecl:{ResultType int}{TypedText public_field} (35)
Completion contexts:
Dot member access
Container Kind: StructDecl
Container is complete
Container USR: c:@S@Foo
$

Ops, no items for the member functions at all. I would have expected items for
both functions, both marked as inaccessible/notAvailable.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to