some update.
This commit is contained in:
@@ -1,10 +1,17 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <AST/ParsedAST.h>
|
||||
#include <Feature/SemanticTokens.h>
|
||||
|
||||
namespace {
|
||||
|
||||
using namespace clang;
|
||||
|
||||
template <typename T>
|
||||
auto f() {
|
||||
using type = typename T::type;
|
||||
return T::value;
|
||||
}
|
||||
|
||||
TEST(test, test) {
|
||||
std::vector<const char*> compileArgs = {
|
||||
"clang++",
|
||||
@@ -14,19 +21,23 @@ TEST(test, test) {
|
||||
};
|
||||
|
||||
const char* code = R"(
|
||||
int x [[maybe_unused]] = 0;
|
||||
template<typename T>
|
||||
struct X {
|
||||
using type = T;
|
||||
static constexpr bool value = true;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
auto f() {
|
||||
using type = typename X<T>::type::type;
|
||||
return T::value;
|
||||
}
|
||||
)";
|
||||
|
||||
auto AST = clice::ParsedAST::build("main.cpp", code, compileArgs);
|
||||
auto fileID = AST->getFileID("main.cpp");
|
||||
auto tokens = AST->spelledTokens(fileID);
|
||||
|
||||
// ClassVisitor visitor(&AST->context);
|
||||
// visitor.TraverseDecl(AST->context.getTranslationUnitDecl());
|
||||
|
||||
for(auto& token: tokens) {
|
||||
llvm::outs() << clang::tok::getTokenName(token.kind()) << ": " << token.text(AST->sourceManager) << "\n";
|
||||
}
|
||||
AST->context.getTranslationUnitDecl()->dump();
|
||||
auto semanticTokens = clice::feature::semanticTokens(*AST, "main.cpp");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user