<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 --- - [REGRESSION] against 3.6: parse + reparse cause crash"
   href="https://llvm.org/bugs/show_bug.cgi?id=25363">25363</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[REGRESSION] against 3.6: parse + reparse cause crash
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.7
          </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>dushistov@gmail.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>Created <span class=""><a href="attachment.cgi?id=15197" name="attach_15197" title="test to reproduce problem">attachment 15197</a> <a href="attachment.cgi?id=15197&action=edit" title="test to reproduce problem">[details]</a></span>
test to reproduce problem

The simple code like this:

 CXIndex  index = clang_createIndex(0, 1);
    CXTranslationUnit out_TU;

    auto error = clang_parseTranslationUnit2(index, argv[1],
                                             compile_args, sizeof(compile_args)
/ sizeof(compile_args[0]), nullptr, 0,
                                            
CXTranslationUnit_PrecompiledPreamble |
CXTranslationUnit_CacheCompletionResults
                                             |
CXTranslationUnit_SkipFunctionBodies
                                             , &out_TU);
    if (error == CXError_Crashed)
        printf("crashed..!\n");
    else
        printf("res: %d\n", int(error));

    clang_reparseTranslationUnit(out_TU, 0, nullptr,
clang_defaultReparseOptions(out_TU));

works fine with clang 3.6, but failed with 3.7, with such message:
clang::CXXConstructorDecl* clang::CXXConstructorDecl::getTargetConstructor()
const: Assertion `isDelegatingConstructor() && "Not a delegating constructor!"'
failed.

The git bisect show that commit that cause problem is:

Author: Richard Smith <<a href="mailto:richard-llvm@metafoo.co.uk">richard-llvm@metafoo.co.uk</a>>
Date:   Tue Mar 24 06:36:48 2015 +0000

    [modules] Deserialize CXXCtorInitializer list for a constructor lazily.

    Previously we'd deserialize the list of mem-initializers for a constructor
when
    we deserialized the declaration of the constructor. That could trigger a
    significant amount of unnecessary work (pulling in all base classes
    recursively, for a start) and was causing problems for the modules buildbot
due
    to cyclic deserializations. We now deserialize these on demand.

    This creates a certain amount of duplication with the handling of
    CXXBaseSpecifiers; I'll look into reducing that next.


    git-svn-id: <a href="https://llvm.org/svn/llvm-project/cfe/trunk@233052">https://llvm.org/svn/llvm-project/cfe/trunk@233052</a>
91177308-0d34-0410-b5e6-96231b3b80d8

To reproduce problem you need test_complete_at.cpp (see attachment),
and as input rtags/src/Source.cpp:

git clone <a href="https://github.com/Andersbakken/rtags.git">https://github.com/Andersbakken/rtags.git</a> 
git checkout c85d54789ceb44da701051de467208897ff750a4

I tried create preprocessed sources, but for some reason with preprocessed
sources bug not reproduced, command line to reproduce bug:

$./bin/test_complete_at /home/evgeniy/projects/study_ide/rtags/src/Source.cpp

Side note: if I comment CXTranslationUnit_SkipFunctionBodies in 
test_complete_at.cpp test start work without errors.</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>