<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - clang_codeCompleteGetContexts suggests CXCompletionContext_DotMemberAccess for "Foo::""
   href="https://llvm.org/bugs/show_bug.cgi?id=26254">26254</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang_codeCompleteGetContexts suggests CXCompletionContext_DotMemberAccess for "Foo::"
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.8
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>libclang
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>nikolai.kosjar@theqtcompany.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>klimek@google.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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;
  }</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>