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

            Bug ID: 26254
           Summary: clang_codeCompleteGetContexts suggests
                    CXCompletionContext_DotMemberAccess for "Foo::"
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: libclang
          Assignee: unassignedclangb...@nondot.org
          Reporter: nikolai.kos...@theqtcompany.com
                CC: kli...@google.com, llvm-bugs@lists.llvm.org
    Classification: Unclassified

Ubuntu clang version 3.8.0-svn257311-1~exp1 (trunk) (based on LLVM 3.8.0)

For a *.cpp file with the contents

  1 void f()
  2 {
  3     Foo::
  4 }

...and a completion right after the second colon (line 3, column 10), libclang
will suggest CXCompletionContext_DotMemberAccess. Foo is unknown, but still
this shouldn't suggest CXCompletionContext_DotMemberAccess?

Tested with the following code:

  #include <clang-c/Index.h>

  #undef NDEBUG
  #include <cassert>

  #include <cstdlib>
  #include <cstdio>

  int main(int argc, char *argv[])
  {
      if (argc != 4) {
          fprintf(stderr, "Usage: $0 <file> <line> <column>\n");
          return 0;
      }

      const char *filePath = argv[1];
      const unsigned line = unsigned(atoi(argv[2]));
      const unsigned column = unsigned(atoi(argv[3]));

      // Parse
      CXIndex index = clang_createIndex(0, /*displayDiagnostics*/ 1); // ...to
compare
      CXTranslationUnit tu = clang_parseTranslationUnit(index, argv[1], 0, 0,
NULL, 0, 0);

      // Complete
      CXCodeCompleteResults *completeResults = clang_codeCompleteAt(tu,
filePath, line, column, NULL, 0, 0);

      // Test
      const unsigned long long contexts =
clang_codeCompleteGetContexts(completeResults);
      const bool wasDotMemberCompletion = contexts &
CXCompletionContext_DotMemberAccess;
      assert(!wasDotMemberCompletion);

      return 0;
  }

-- 
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