[llvm-bugs] [Bug 39981] New: Regression: TypeLoc.getTypePtr() crashes while parsing a certain piece of C++ code
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Dec 12 13:43:45 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=39981
Bug ID: 39981
Summary: Regression: TypeLoc.getTypePtr() crashes while parsing
a certain piece of C++ code
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: libclang
Assignee: unassignedclangbugs at nondot.org
Reporter: dpldobrev at protonmail.com
CC: klimek at google.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
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>
>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > > & SourceFiles) Line 4199
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
https://github.com/mono/CppSharp/blob/master/src/CppParser/Parser.cpp. 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.
--
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/20181212/80747236/attachment.html>
More information about the llvm-bugs
mailing list