[llvm-bugs] [Bug 33382] New: Completions without non-const member functions for const object

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 9 00:49:55 PDT 2017


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: unassignedclangbugs at nondot.org
          Reporter: nikolai.kosjar at qt.io
                CC: klimek at google.com, llvm-bugs at 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 at 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 at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170609/f82554e3/attachment.html>


More information about the llvm-bugs mailing list