
C
什么你竟然不会敲代码
因故停了,谢谢大家支持。不必私信
展开
-
ASTContext的相关操作
如何获取ASTContext在调用CreateASTConsumer时,ASTContext可以从CompilerInstance里的getASTContext()方法获得。std::unique_ptr<ASTConsumer> MyFrontendAction::CreateASTConsumer(CompilerInstance& CI, StringRef file){ // 获取ASTContext的办法 clang::ASTContext&原创 2022-01-06 20:50:10 · 1151 阅读 · 1 评论 -
使用compile_commands.json构建ClangTool
//生成CompilationDatabase string s; string &ErrorMessage = s; const char *complieJsonPath = ....读入字符串; unique_ptr<JSONCompilationDatabase> jsonDatabasePtr = clang::tooling::JSONCompilationDatabase::loadFromFile(complieJsonPath,...原创 2022-01-06 20:38:14 · 1435 阅读 · 0 评论 -
ClangTool添加参数
void ClangToolHelper::addParameters(ClangTool& tool, const char* extra) { // add header search paths to compiler ArgumentsAdjuster ardj = getInsertArgumentAdjuster(extra); tool.appendArgumentsAdjuster(ardj);}其中vec为一个string的vector for(int i=0原创 2022-01-06 20:35:27 · 697 阅读 · 0 评论 -
FrontendAction自定义返回值
class MyFrontendAction : public ASTFrontendAction{public: MyFrontendAction(ReturnClass* return) { result = return; } void EndSourceFileAction() override; std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance&原创 2022-01-06 20:30:33 · 727 阅读 · 0 评论 -
结构体字节对齐,C语言结构体字节对齐详解
本文转载自http://c.biancheng.net/http://c.biancheng.net/view/243.html问大家一个问题:struct STUDENT{ char a; int b;}data;如上结构体变量 data 占多少字节?char 占 1 字节,int 占 4 字节,所以总共占 5 字节吗?我们写一个程序验证一下:# include <stdio.h>struct STUDENT{ char a; int b.转载 2020-10-10 14:06:57 · 363 阅读 · 0 评论