#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/Basic/DiagnosticOptions.h"
#include "clang/Basic/SourceManager.h"
#include "clang/CrossTU/CrossTranslationUnit.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendActions.h"
#include "clang/Frontend/TextDiagnosticPrinter.h"
#include "clang/Tooling/CommonOptionsParser.h"
#include "clang/Tooling/Tooling.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/TargetSelect.h"
#include <optional>
#include <sstream>
#include <string>
usingnamespacellvm;
usingnamespaceclang;
usingnamespaceclang::cross_tu;
usingnamespaceclang::tooling;
static cl::OptionCategory
ClangExtDefMapGenCategory("clang-extdefmapgen options");
class MapExtDefNamesConsumer : public ASTConsumer { … };
void MapExtDefNamesConsumer::handleDecl(const Decl *D) { … }
void MapExtDefNamesConsumer::addIfInMain(const DeclaratorDecl *DD,
SourceLocation defStart) { … }
class MapExtDefNamesAction : public ASTFrontendAction { … };
static cl::extrahelp CommonHelp(CommonOptionsParser::HelpMessage);
static IntrusiveRefCntPtr<DiagnosticsEngine> Diags;
IntrusiveRefCntPtr<DiagnosticsEngine> GetDiagnosticsEngine() { … }
static CompilerInstance *CI = …;
static bool HandleAST(StringRef AstPath) { … }
static int HandleFiles(ArrayRef<std::string> SourceFiles,
CompilationDatabase &compilations) { … }
int main(int argc, const char **argv) { … }