llvm/clang/lib/CodeGen/CodeGenAction.cpp

//===--- CodeGenAction.cpp - LLVM Code Generation Frontend Action ---------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "clang/CodeGen/CodeGenAction.h"
#include "BackendConsumer.h"
#include "CGCall.h"
#include "CodeGenModule.h"
#include "CoverageMappingGen.h"
#include "MacroPPCallbacks.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclGroup.h"
#include "clang/Basic/DiagnosticFrontend.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/LangStandard.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/CodeGen/BackendUtil.h"
#include "clang/CodeGen/ModuleBuilder.h"
#include "clang/Driver/DriverDiagnostic.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendActions.h"
#include "clang/Frontend/FrontendDiagnostic.h"
#include "clang/Frontend/MultiplexConsumer.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Serialization/ASTWriter.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/Bitcode/BitcodeReader.h"
#include "llvm/CodeGen/MachineOptimizationRemarkEmitter.h"
#include "llvm/Demangle/Demangle.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/DiagnosticPrinter.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/LLVMRemarkStreamer.h"
#include "llvm/IR/Module.h"
#include "llvm/IRReader/IRReader.h"
#include "llvm/LTO/LTOBackend.h"
#include "llvm/Linker/Linker.h"
#include "llvm/Pass.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/TimeProfiler.h"
#include "llvm/Support/Timer.h"
#include "llvm/Support/ToolOutputFile.h"
#include "llvm/Support/YAMLTraits.h"
#include "llvm/Transforms/IPO/Internalize.h"
#include "llvm/Transforms/Utils/Cloning.h"

#include <optional>
usingnamespaceclang;
usingnamespacellvm;

#define DEBUG_TYPE

namespace clang {
class BackendConsumer;
class ClangDiagnosticHandler final : public DiagnosticHandler {};

static void reportOptRecordError(Error E, DiagnosticsEngine &Diags,
                                 const CodeGenOptions &CodeGenOpts) {}

BackendConsumer::BackendConsumer(
    BackendAction Action, DiagnosticsEngine &Diags,
    IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
    const HeaderSearchOptions &HeaderSearchOpts,
    const PreprocessorOptions &PPOpts, const CodeGenOptions &CodeGenOpts,
    const TargetOptions &TargetOpts, const LangOptions &LangOpts,
    const std::string &InFile, SmallVector<LinkModule, 4> LinkModules,
    std::unique_ptr<raw_pwrite_stream> OS, LLVMContext &C,
    CoverageSourceInfo *CoverageInfo)
    :{}

// This constructor is used in installing an empty BackendConsumer
// to use the clang diagnostic handler for IR input files. It avoids
// initializing the OS field.
BackendConsumer::BackendConsumer(
    BackendAction Action, DiagnosticsEngine &Diags,
    IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
    const HeaderSearchOptions &HeaderSearchOpts,
    const PreprocessorOptions &PPOpts, const CodeGenOptions &CodeGenOpts,
    const TargetOptions &TargetOpts, const LangOptions &LangOpts,
    llvm::Module *Module, SmallVector<LinkModule, 4> LinkModules,
    LLVMContext &C, CoverageSourceInfo *CoverageInfo)
    :{}

llvm::Module* BackendConsumer::getModule() const {}

std::unique_ptr<llvm::Module> BackendConsumer::takeModule() {}

CodeGenerator* BackendConsumer::getCodeGenerator() {}

void BackendConsumer::HandleCXXStaticMemberVarInstantiation(VarDecl *VD) {}

void BackendConsumer::Initialize(ASTContext &Ctx) {}

bool BackendConsumer::HandleTopLevelDecl(DeclGroupRef D) {}

void BackendConsumer::HandleInlineFunctionDefinition(FunctionDecl *D) {}

void BackendConsumer::HandleInterestingDecl(DeclGroupRef D) {}

// Links each entry in LinkModules into our module. Returns true on error.
bool BackendConsumer::LinkInModules(llvm::Module *M) {}

void BackendConsumer::HandleTranslationUnit(ASTContext &C) {}

void BackendConsumer::HandleTagDeclDefinition(TagDecl *D) {}

void BackendConsumer::HandleTagDeclRequiredDefinition(const TagDecl *D) {}

void BackendConsumer::CompleteTentativeDefinition(VarDecl *D) {}

void BackendConsumer::CompleteExternalDeclaration(DeclaratorDecl *D) {}

void BackendConsumer::AssignInheritanceModel(CXXRecordDecl *RD) {}

void BackendConsumer::HandleVTable(CXXRecordDecl *RD) {}

void BackendConsumer::anchor() {}

} // namespace clang

bool ClangDiagnosticHandler::handleDiagnostics(const DiagnosticInfo &DI) {}

/// ConvertBackendLocation - Convert a location in a temporary llvm::SourceMgr
/// buffer to be a valid FullSourceLoc.
static FullSourceLoc ConvertBackendLocation(const llvm::SMDiagnostic &D,
                                            SourceManager &CSM) {}

#define ComputeDiagID

#define ComputeDiagRemarkID(Severity, GroupName, DiagID)

void BackendConsumer::SrcMgrDiagHandler(const llvm::DiagnosticInfoSrcMgr &DI) {}

bool
BackendConsumer::InlineAsmDiagHandler(const llvm::DiagnosticInfoInlineAsm &D) {}

bool
BackendConsumer::StackSizeDiagHandler(const llvm::DiagnosticInfoStackSize &D) {}

bool BackendConsumer::ResourceLimitDiagHandler(
    const llvm::DiagnosticInfoResourceLimit &D) {}

const FullSourceLoc BackendConsumer::getBestLocationFromDebugLoc(
    const llvm::DiagnosticInfoWithLocationBase &D, bool &BadDebugInfo,
    StringRef &Filename, unsigned &Line, unsigned &Column) const {}

std::optional<FullSourceLoc>
BackendConsumer::getFunctionSourceLocation(const Function &F) const {}

void BackendConsumer::UnsupportedDiagHandler(
    const llvm::DiagnosticInfoUnsupported &D) {}

void BackendConsumer::EmitOptimizationMessage(
    const llvm::DiagnosticInfoOptimizationBase &D, unsigned DiagID) {}

void BackendConsumer::OptimizationRemarkHandler(
    const llvm::DiagnosticInfoOptimizationBase &D) {}

void BackendConsumer::OptimizationRemarkHandler(
    const llvm::OptimizationRemarkAnalysisFPCommute &D) {}

void BackendConsumer::OptimizationRemarkHandler(
    const llvm::OptimizationRemarkAnalysisAliasing &D) {}

void BackendConsumer::OptimizationFailureHandler(
    const llvm::DiagnosticInfoOptimizationFailure &D) {}

void BackendConsumer::DontCallDiagHandler(const DiagnosticInfoDontCall &D) {}

void BackendConsumer::MisExpectDiagHandler(
    const llvm::DiagnosticInfoMisExpect &D) {}

/// This function is invoked when the backend needs
/// to report something to the user.
void BackendConsumer::DiagnosticHandlerImpl(const DiagnosticInfo &DI) {}
#undef ComputeDiagID

CodeGenAction::CodeGenAction(unsigned _Act, LLVMContext *_VMContext)
    :{}

CodeGenAction::~CodeGenAction() {}

bool CodeGenAction::loadLinkModules(CompilerInstance &CI) {}

bool CodeGenAction::hasIRSupport() const {}

void CodeGenAction::EndSourceFileAction() {}

std::unique_ptr<llvm::Module> CodeGenAction::takeModule() {}

llvm::LLVMContext *CodeGenAction::takeLLVMContext() {}

CodeGenerator *CodeGenAction::getCodeGenerator() const {}

bool CodeGenAction::BeginSourceFileAction(CompilerInstance &CI) {}

static std::unique_ptr<raw_pwrite_stream>
GetOutputStream(CompilerInstance &CI, StringRef InFile, BackendAction Action) {}

std::unique_ptr<ASTConsumer>
CodeGenAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {}

std::unique_ptr<llvm::Module>
CodeGenAction::loadModule(MemoryBufferRef MBRef) {}

void CodeGenAction::ExecuteAction() {}

//

void EmitAssemblyAction::anchor() {}
EmitAssemblyAction::EmitAssemblyAction(llvm::LLVMContext *_VMContext)
  :{}

void EmitBCAction::anchor() {}
EmitBCAction::EmitBCAction(llvm::LLVMContext *_VMContext)
  :{}

void EmitLLVMAction::anchor() {}
EmitLLVMAction::EmitLLVMAction(llvm::LLVMContext *_VMContext)
  :{}

void EmitLLVMOnlyAction::anchor() {}
EmitLLVMOnlyAction::EmitLLVMOnlyAction(llvm::LLVMContext *_VMContext)
  :{}

void EmitCodeGenOnlyAction::anchor() {}
EmitCodeGenOnlyAction::EmitCodeGenOnlyAction(llvm::LLVMContext *_VMContext)
  :{}

void EmitObjAction::anchor() {}
EmitObjAction::EmitObjAction(llvm::LLVMContext *_VMContext)
  :{}