<html>
<head>
<base href="https://bugs.llvm.org/">
</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: TypeLoc.getTypePtr() crashes while parsing a certain piece of C++ code"
href="https://bugs.llvm.org/show_bug.cgi?id=39981">39981</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Regression: TypeLoc.getTypePtr() crashes while parsing a certain piece of C++ code
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</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>dpldobrev@protonmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>klimek@google.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>I use the Clang API to parse C++ headers. The following piece is successfully
parsed with LLVM revision 339502 and Clang revision 339494:
template<class T> using InvokeGenSeq = typename T;
template<int N> struct GenSeq;
template<int N> using makeIndexSequence = InvokeGenSeq<GenSeq<N>>;
template<int N>
struct GenSeq : makeIndexSequence<N/2>{};
Parsing the same piece crashes with LLVM revision 348759 and Clang revision
348755 crashes with:
[Inline Frame] CppSharp.CppParser.dll!clang::QualType::getCommonPtr() Line 660
at c:\users\dimitar
dobrev\projects\cppsharp\deps\llvm\tools\clang\include\clang\ast\type.h(660)
[Inline Frame] CppSharp.CppParser.dll!clang::QualType::getTypePtr() Line 6059
at c:\users\dimitar
dobrev\projects\cppsharp\deps\llvm\tools\clang\include\clang\ast\type.h(6059)
[Inline Frame] CppSharp.CppParser.dll!clang::TypeLoc::getTypePtr() Line 136
at c:\users\dimitar
dobrev\projects\cppsharp\deps\llvm\tools\clang\include\clang\ast\typeloc.h(136)
[Inline Frame]
CppSharp.CppParser.dll!clang::QualifiedTypeLoc::getUnqualifiedLoc() Line 277
at c:\users\dimitar
dobrev\projects\cppsharp\deps\llvm\tools\clang\include\clang\ast\typeloc.h(277)
CppSharp.CppParser.dll!clang::TypeLoc::getUnqualifiedLoc() Line 322
at c:\users\dimitar
dobrev\projects\cppsharp\deps\llvm\tools\clang\include\clang\ast\typeloc.h(322)
CppSharp.CppParser.dll!CppSharp::CppParser::Parser::WalkType(clang::QualType
QualType, const clang::TypeLoc * TL, bool DesugarType) Line 2514
at c:\users\dimitar
dobrev\projects\cppsharp\src\cppparser\parser.cpp(2514)
[Inline Frame]
CppSharp.CppParser.dll!CppSharp::CppParser::Parser::GetQualifiedType(const
clang::QualType &) Line 574
at c:\users\dimitar
dobrev\projects\cppsharp\src\cppparser\parser.cpp(574)
CppSharp.CppParser.dll!CppSharp::CppParser::Parser::WalkTemplateArgument(const
clang::TemplateArgument & TA, clang::TemplateArgumentLoc * ArgLoc) Line 1474
at c:\users\dimitar
dobrev\projects\cppsharp\src\cppparser\parser.cpp(1474)
CppSharp.CppParser.dll!CppSharp::CppParser::Parser::WalkTemplateArgumentList<clang::TemplateSpecializationTypeLoc>(const
clang::TemplateArgumentList * TAL, clang::TemplateSpecializationTypeLoc * TSTL)
Line 1420
at c:\users\dimitar
dobrev\projects\cppsharp\src\cppparser\parser.cpp(1420)
CppSharp.CppParser.dll!CppSharp::CppParser::Parser::WalkType(clang::QualType
QualType, const clang::TypeLoc * TL, bool DesugarType) Line 2780
at c:\users\dimitar
dobrev\projects\cppsharp\src\cppparser\parser.cpp(2780)
CppSharp.CppParser.dll!CppSharp::CppParser::Parser::GetQualifiedType(const
clang::QualType & qual, const clang::TypeLoc * TL) Line 574
at c:\users\dimitar
dobrev\projects\cppsharp\src\cppparser\parser.cpp(574)
CppSharp.CppParser.dll!CppSharp::CppParser::Parser::WalkType(clang::QualType
QualType, const clang::TypeLoc * TL, bool DesugarType) Line 2504
at c:\users\dimitar
dobrev\projects\cppsharp\src\cppparser\parser.cpp(2504)
CppSharp.CppParser.dll!CppSharp::CppParser::Parser::WalkRecordCXX(const
clang::CXXRecordDecl * Record, CppSharp::CppParser::AST::Class * RC) Line 1103
at c:\users\dimitar
dobrev\projects\cppsharp\src\cppparser\parser.cpp(1103)
CppSharp.CppParser.dll!CppSharp::CppParser::Parser::WalkRecordCXX(const
clang::CXXRecordDecl * Record) Line 825
at c:\users\dimitar
dobrev\projects\cppsharp\src\cppparser\parser.cpp(825)
CppSharp.CppParser.dll!CppSharp::CppParser::Parser::WalkDeclaration(const
clang::Decl * D) Line 3771
at c:\users\dimitar
dobrev\projects\cppsharp\src\cppparser\parser.cpp(3771)
[Inline Frame]
CppSharp.CppParser.dll!CppSharp::CppParser::Parser::EnsureCompleteRecord(const
clang::RecordDecl *) Line 742
at c:\users\dimitar
dobrev\projects\cppsharp\src\cppparser\parser.cpp(742)
CppSharp.CppParser.dll!CppSharp::CppParser::Parser::GetRecord(const
clang::RecordDecl * Record, bool & Process) Line 779
at c:\users\dimitar
dobrev\projects\cppsharp\src\cppparser\parser.cpp(779)
CppSharp.CppParser.dll!CppSharp::CppParser::Parser::WalkClassTemplate(const
clang::ClassTemplateDecl * TD) Line 1322
at c:\users\dimitar
dobrev\projects\cppsharp\src\cppparser\parser.cpp(1322)
CppSharp.CppParser.dll!CppSharp::CppParser::Parser::WalkDeclaration(const
clang::Decl * D) Line 3779
at c:\users\dimitar
dobrev\projects\cppsharp\src\cppparser\parser.cpp(3779)
[Inline Frame]
CppSharp.CppParser.dll!CppSharp::CppParser::Parser::WalkDeclarationDef(clang::Decl
*) Line 3738
at c:\users\dimitar
dobrev\projects\cppsharp\src\cppparser\parser.cpp(3738)
[Inline Frame]
CppSharp.CppParser.dll!CppSharp::CppParser::Parser::WalkAST(clang::TranslationUnitDecl
*) Line 3321
at c:\users\dimitar
dobrev\projects\cppsharp\src\cppparser\parser.cpp(3321)
CppSharp.CppParser.dll!SemaConsumer::HandleTranslationUnit(clang::ASTContext &
Ctx) Line 4162
at c:\users\dimitar
dobrev\projects\cppsharp\src\cppparser\parser.cpp(4162)
CppSharp.CppParser.dll!clang::ParseAST(clang::Sema & S, bool PrintStats, bool
SkipFunctionBodies) Line 177
at c:\users\dimitar
dobrev\projects\cppsharp\deps\llvm\tools\clang\lib\parse\parseast.cpp(177)
CppSharp.CppParser.dll!CppSharp::CppParser::Parser::ParseHeader(const
std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char>
<span class="quote">>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > > & SourceFiles) Line 4199</span >
at c:\users\dimitar
dobrev\projects\cppsharp\src\cppparser\parser.cpp(4199)
[Managed to Native Transition]
CppSharp.Parser.CLI.dll!CppSharp::Parser::ClangParser::ParseHeader(CppSharp::Parser::CppParserOptions^
Opts) Line 771
at c:\users\dimitar
dobrev\projects\cppsharp\src\cppparser\bindings\cli\cppparser.cpp(771)
CppSharp.Parser.dll!CppSharp.ClangParser.ParseSourceFiles(System.Collections.Generic.IEnumerable<string>
files, CppSharp.Parser.ParserOptions options) Line 56
at C:\Users\Dimitar Dobrev\Projects\CppSharp\src\Parser\Parser.cs(56)
CppSharp.Generator.dll!CppSharp.Driver.ParseCode() Line 135
at C:\Users\Dimitar
Dobrev\Projects\CppSharp\src\Generator\Driver.cs(135)
CppSharp.Generator.dll!CppSharp.ConsoleDriver.Run(CppSharp.ILibrary library)
Line 427
at C:\Users\Dimitar
Dobrev\Projects\CppSharp\src\Generator\Driver.cs(427)
Common.Gen.exe!CppSharp.Tests.CommonTestsGenerator.Main(string[] args) Line 85
at C:\Users\Dimitar Dobrev\Projects\CppSharp\tests\Common\Common.cs(85)
My code is at
<a href="https://github.com/mono/CppSharp/blob/master/src/CppParser/Parser.cpp">https://github.com/mono/CppSharp/blob/master/src/CppParser/Parser.cpp</a>. Please
help because we need the new Clang in order to parse MinGW 7.3 64-bit headers
so we cannot simply revert. I need either a fix, a workaround or a safe
revision to use.</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>