[llvm-bugs] [Bug 28734] New: Namespace affects completion priority of enum types/values

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 27 01:00:44 PDT 2016


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

            Bug ID: 28734
           Summary: Namespace affects completion priority of enum
                    types/values
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          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
    Classification: Unclassified

$ cat -n c2.cpp
     1  enum EnumTypeA { EnumAValue1 };
     2  enum EnumTypeB { EnumBValue1 };
     3
     4  void foo(EnumTypeA et);
     5
     6  void c2()
     7  {
     8      foo( // Complete here
     9  }
    10

$ /usr/lib/llvm-3.8/bin/c-index-test -code-completion-at=c2.cpp:8:9 c2.cpp |
grep Enum
 EnumConstantDecl:{ResultType EnumTypeA}{TypedText EnumAValue1} (16)
 EnumConstantDecl:{ResultType EnumTypeB}{TypedText EnumBValue1} (65)
 EnumDecl:{TypedText EnumTypeA} (12)
 EnumDecl:{TypedText EnumTypeB} (50)
 FunctionDecl:{ResultType void}{TypedText foo}{LeftParen (}{Placeholder
EnumTypeA et}{RightParen )} (50)
 OverloadCandidate:{ResultType void}{Text foo}{LeftParen (}{CurrentParameter
EnumTypeA et}{RightParen )} (1)
 Enum tag

==> Looks fine, EnumTypeA/EnumAValue1 has higher priority (12 and 16) than
EnumTypeB/EnumBValue1 (50 and 65)

Now the same with a name space:

$ cat -n c3.cpp
     1  namespace N {
     2      enum EnumTypeA { EnumAValue1 };
     3      enum EnumTypeB { EnumBValue1 };
     4  }
     5
     6  void foo(N::EnumTypeA);
     7
     8  void c3()
     9  {
    10      foo(N:: // Complete here
    11  }

$ /usr/lib/llvm-3.8/bin/c-index-test -code-completion-at=c3.cpp:10:12 c3.cpp |
grep Enum
 EnumConstantDecl:{ResultType N::EnumTypeA}{TypedText EnumAValue1} (65)
 EnumConstantDecl:{ResultType N::EnumTypeB}{TypedText EnumBValue1} (65)
 EnumDecl:{TypedText EnumTypeA} (50)
 EnumDecl:{TypedText EnumTypeB} (50)

==> Ops, EnumTypeA and EnumTypeB have same priority, as EnumAValue1 and
EnumBValue1
==> The priorities should be like for the example above.

-- 
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/20160727/0690b4ec/attachment.html>


More information about the llvm-bugs mailing list