[PATCH] D128704: [clang-extdef-mapping] Directly process .ast files

Tobias Hieta via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 28 03:56:11 PDT 2022


thieta added inline comments.


================
Comment at: clang/tools/clang-extdef-mapping/ClangExtDefMapGen.cpp:122
+
+  CompilerInstance CI;
+
----------------
Not sure if I can just create a compilerinstance here and if I should feed it anymore data then I already do.


================
Comment at: clang/tools/clang-extdef-mapping/ClangExtDefMapGen.cpp:135
+
+  FileManager fm(CI.getFileSystemOpts());
+  SmallString<128> absPath(astPath);
----------------
For some reason CI.getFileManager() often returns no filemanager - but sometimes it works? I just ended up creating my own to make the path absolute.


================
Comment at: clang/tools/clang-extdef-mapping/ClangExtDefMapGen.cpp:136
+  FileManager fm(CI.getFileSystemOpts());
+  SmallString<128> absPath(astPath);
+  fm.makeAbsolutePath(absPath);
----------------
Pretty sure 128 is wrong here - but I searched the codebase and that seems to be the most common size used? I couldn't find anything using PATH_MAX or something like that.


================
Comment at: clang/tools/clang-extdef-mapping/ClangExtDefMapGen.cpp:141
+      std::make_unique<MapExtDefNamesConsumer>(unit->getASTContext(), absPath);
+  consumer->HandleTranslationUnit(unit->getASTContext());
+}
----------------
I tried to figure out how to "run" the consumer on a already loaded ASTUnit - but I didn't find anything in the api for that and this way works since it's more or less what will happen when the consumer is executed anyway.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128704/new/

https://reviews.llvm.org/D128704



More information about the cfe-commits mailing list