Код: Выделить всё
#pragma once
#include "Vec3.h"
template struct Array;
struct S1
{
int S1i;
Array S1Grid;
};
struct S2
{
int S2i;
Array S2Grid;
};
struct S3
{
int S3i;
Array S3Grid;
};
Код: Выделить всё
#include
#include
static CXChildVisitResult CursorVisitorTest(CXCursor cursor, CXCursor parent, CXClientData client_data)
{
CXCursorKind Kind = clang_getCursorKind(cursor);
printf("%d %s\n", Kind, clang_getCString(clang_getCursorSpelling(cursor)));
return CXChildVisit_Recurse;
}
void Test()
{
CXIndex index = clang_createIndex(0, 0);
std::string header_path = "Example.h";
CXTranslationUnit TranslationUnit;
static const char* args[] = { "-std=c++17", "-xc++", "-DHEADER_TOOL" };
CXErrorCode error = clang_parseTranslationUnit2(
index,
header_path.c_str(),
args,
3,
nullptr,
0,
CXTranslationUnit_SingleFileParse,
&TranslationUnit
);
if (error == CXError_Success && TranslationUnit != nullptr)
{
CXCursor cursor = clang_getTranslationUnitCursor(TranslationUnit);
clang_visitChildren(cursor, &CursorVisitorTest, nullptr);
clang_disposeTranslationUnit(TranslationUnit);
}
}
Код: Выделить всё
31 Array
27 T
2 S1
6 S1i
2 S2
6 S2i
6 S2Grid
2 S3
6 S3i
6 S3Grid
45 Array
45 Array
Что мы можем сделать, чтобы правильно разобрать вложенный шаблон lib clang без ручного добавления пробела в исходном коде?
Версия Clang, возвращаемая clang_getClangVersion, — это версия clang 9.0.0 (tags/RELEASE_900/final)
Подробнее здесь: https://stackoverflow.com/questions/788 ... eclaration
Мобильная версия