-
-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NullReferenceException - parent is null #106
Comments
Clang doesn't provide support by default for MSVC header files, so you will have to setup this yourselve. There is a helper method CppAst.NET/src/CppAst/CppParserOptions.cs Lines 170 to 214 in 2eaee79
|
No, it's not a msvc-relative problem. At cppast 0.8.0-alpha001/clang 12 everything works fine without options manipulations. It seems, problem is in struct parsing (_Mbstatet {...} in this case), old version gets SemanticParent of kind CXCursorKind.CXCursor_UnexposedDecl = CXCursor_FirstDecl and container for structure set as _rootContainerContext. |
I haven't been able to reproduce it in Debug with latest repository. Though, I found a problem in debug that should be fixed via c2cbfe5. 0.8.0 is extremely old and lots of things have changed regarding template parameter/argument parsing. I personally don't use/care about C++ parsing so you will have to investigate this further within the existing codebase. |
Hi,
I tried to parse C++ code, but always exception raised.
Excluded almost everything, I found file it causes - std string from msvc.
You can reproduce the error using following code
string file = "C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\VC\\Tools\\MSVC\\14.40.33807\\include\\string";
CppCompilation compilation = CppParser.ParseFiles(new List<string>() { file }, null);
Stack trace
at CppAst.CppModelBuilder.GetOrCreateDeclarationContainer(CXCursor cursor, Void* data) in D:\Projects.....\CppAst.NET\src\CppAst\CppModelBuilder.cs:line 142
Parsing at:
{Line 625, Column 9 in C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt.h to Line 629, Column 2 in C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt.h}
The text was updated successfully, but these errors were encountered: