Created
November 14, 2018 07:08
-
-
Save dalehamel/2cbe83e142cf45cfc4cb5511264ba309 to your computer and use it in GitHub Desktop.
Debug patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
src/clang_parser.cpp | 14 ++++++++++++++ | |
1 file changed, 14 insertions(+) | |
diff --git a/src/clang_parser.cpp b/src/clang_parser.cpp | |
index 6adb5f0..5b47555 100644 | |
--- a/src/clang_parser.cpp | |
+++ b/src/clang_parser.cpp | |
@@ -221,10 +221,23 @@ void ClangParser::parse(ast::Program *program, StructMap &structs) | |
if (clang_getCursorKind(parent) != CXCursor_StructDecl && | |
clang_getCursorKind(parent) != CXCursor_UnionDecl) | |
+ { | |
+ auto struct_name = get_clang_string(clang_getCursorSpelling(parent)); | |
+ auto ptype = clang_getCanonicalType(clang_getCursorType(parent)); | |
+ auto ptypestr = get_clang_string(clang_getTypeSpelling(ptype)); | |
+ auto ptypesize = clang_Type_getSizeOf(ptype); | |
+ | |
+ if (struct_name == "") | |
+ struct_name = ptypestr; | |
+ remove_struct_prefix(struct_name); | |
+ | |
+ std::cout << "Skipping: " << struct_name << std::endl; | |
return CXChildVisit_Recurse; | |
+ } | |
if (clang_getCursorKind(c) == CXCursor_FieldDecl) | |
{ | |
+ auto pname = get_clang_string(clang_getCursorSpelling(parent)); | |
auto struct_name = get_clang_string(clang_getCursorSpelling(parent)); | |
auto ident = get_clang_string(clang_getCursorSpelling(c)); | |
auto offset = clang_Cursor_getOffsetOfField(c) / 8; | |
@@ -238,6 +251,7 @@ void ClangParser::parse(ast::Program *program, StructMap &structs) | |
struct_name = ptypestr; | |
remove_struct_prefix(struct_name); | |
+ std::cout << "Parsed: " << struct_name << " parent: " << pname << " ident: " << ident <<std::endl; | |
structs[struct_name].fields[ident].offset = offset; | |
structs[struct_name].fields[ident].type = get_sized_type(type); | |
structs[struct_name].size = ptypesize; | |
-- | |
2.7.0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment