[LLVMbugs] [Bug 22811] New: libclang code completion crash (libclang 3.5 & 3.6)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Mar 5 11:34:22 PST 2015


            Bug ID: 22811
           Summary: libclang code completion crash (libclang 3.5 & 3.6)
           Product: new-bugs
           Version: 3.5
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: dinosaurdynasty at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 13989
  --> http://llvm.org/bugs/attachment.cgi?id=13989&action=edit
Crashes libclang

The following program causes libclang to print "libclang: crash detected in
code completion" and return null for the last call:

const char program[] =
"void f(bool b);\n"
"void f(bool b) __attribute__((enable_if(b, "")));\n"
"int main() {\n"
"    bool var = true;\n"
"    f(var);\n" /* code complete inside f() */

#include <clang-c/Index.h>
#include <assert.h>

int main(int argc, char **argv)
    CXUnsavedFile file = {"test.cpp", program, sizeof program};

    CXIndex idx = clang_createIndex(1, 0);
    char* args[] = {};
    CXTranslationUnit u = clang_parseTranslationUnit(idx, "test.cpp", args,
sizeof args, &file, 1, CXTranslationUnit_PrecompiledPreamble);
    clang_reparseTranslationUnit(u, 0, 0, 0);
    CXCodeCompleteResults* res = clang_codeCompleteAt(u, "test.cpp", 5, 6, 0,
0, 0);

This happens with both libclang 3.5 (1:3.5-4ubuntu2 (Ubuntu 14.10 Utopic)) and
libclang 3.6 (1:3.6~+rc2-2ubuntu1~xedgers14.10.1 (Ubuntu 14.10 Utopic,
https://launchpad.net/~xorg-edgers/+archive/ubuntu/ppa)). I assume it happens
with other versions as well. It notably does not crash for 3.4
(1:3.4.2-10ubuntu1 on Utopic).

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/20150305/736ab201/attachment.html>

More information about the llvm-bugs mailing list