Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:56

0001 //===- InstallAPI/Frontend.h -----------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 ///
0009 /// Top level wrappers for InstallAPI frontend operations.
0010 ///
0011 //===----------------------------------------------------------------------===//
0012 
0013 #ifndef LLVM_CLANG_INSTALLAPI_FRONTEND_H
0014 #define LLVM_CLANG_INSTALLAPI_FRONTEND_H
0015 
0016 #include "clang/AST/ASTConsumer.h"
0017 #include "clang/Frontend/CompilerInstance.h"
0018 #include "clang/Frontend/FrontendActions.h"
0019 #include "clang/InstallAPI/Context.h"
0020 #include "clang/InstallAPI/DylibVerifier.h"
0021 #include "clang/InstallAPI/Visitor.h"
0022 #include "llvm/ADT/Twine.h"
0023 #include "llvm/Support/MemoryBuffer.h"
0024 
0025 namespace clang {
0026 namespace installapi {
0027 
0028 /// Create a buffer that contains all headers to scan
0029 /// for global symbols with.
0030 std::unique_ptr<llvm::MemoryBuffer> createInputBuffer(InstallAPIContext &Ctx);
0031 
0032 class InstallAPIAction : public ASTFrontendAction {
0033 public:
0034   explicit InstallAPIAction(InstallAPIContext &Ctx) : Ctx(Ctx) {}
0035 
0036   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
0037                                                  StringRef InFile) override {
0038     Ctx.Diags->getClient()->BeginSourceFile(CI.getLangOpts());
0039     Ctx.Verifier->setSourceManager(CI.getSourceManagerPtr());
0040     return std::make_unique<InstallAPIVisitor>(
0041         CI.getASTContext(), Ctx, CI.getSourceManager(), CI.getPreprocessor());
0042   }
0043 
0044 private:
0045   InstallAPIContext &Ctx;
0046 };
0047 } // namespace installapi
0048 } // namespace clang
0049 
0050 #endif // LLVM_CLANG_INSTALLAPI_FRONTEND_H