A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://clang.llvm.org/doxygen/ObjectFilePCHContainerWriter_8cpp_source.html below:

clang: lib/CodeGen/ObjectFilePCHContainerWriter.cpp Source File

23#include "llvm/ADT/StringRef.h" 24#include "llvm/IR/Constants.h" 25#include "llvm/IR/DataLayout.h" 26#include "llvm/IR/LLVMContext.h" 27#include "llvm/IR/Module.h" 28#include "llvm/MC/TargetRegistry.h" 29#include "llvm/Object/COFF.h" 30#include "llvm/Support/Path.h" 34using namespace clang

;

36#define DEBUG_TYPE "pchcontainer" 42 const

std::string MainFileName;

43 const

std::string OutputFileName;

52

std::unique_ptr<llvm::LLVMContext> VMContext;

53

std::unique_ptr<llvm::Module> M;

54

std::unique_ptr<CodeGen::CodeGenModule> Builder;

55

std::unique_ptr<raw_pwrite_stream> OS;

56

std::shared_ptr<PCHBuffer> Buffer;

66 static bool

CanRepresent(

const Type

*Ty) {

80 if

(

auto

*TD = dyn_cast<TagDecl>(

D

))

81 if

(!TD->isCompleteDefinition())

94 QualType

QualTy(

D

->getTypeForDecl(), 0);

102 if

(isa<CXXDeductionGuideDecl>(

D

))

105 if

(isa<CXXMethodDecl>(

D

))

111 for

(

auto

*i :

D

->parameters())

112

ArgTypes.push_back(i->getType());

122 if

(!

D

->getClassInterface())

125 bool

selfIsPseudoStrong, selfIsConsumed;

127

ArgTypes.push_back(

D

->getSelfType(Ctx,

D

->getClassInterface(),

128

selfIsPseudoStrong, selfIsConsumed));

130 for

(

auto

*i :

D

->parameters())

131

ArgTypes.push_back(i->getType());

142

PCHContainerGenerator(

CompilerInstance

&CI,

const

std::string &MainFileName,

143 const

std::string &OutputFileName,

144

std::unique_ptr<raw_pwrite_stream> OS,

145

std::shared_ptr<PCHBuffer> Buffer)

146

: CI(CI), Diags(CI.

getDiagnostics

()), MainFileName(MainFileName),

147

OutputFileName(OutputFileName), Ctx(

nullptr

),

153

OS(std::move(OS)), Buffer(std::move(Buffer)) {

157

LangOpts.setThreadModel(LangOptions::ThreadModelKind::Single);

158

CodeGenOpts.DebugTypeExtRefs =

true

;

162

CodeGenOpts.setDebugInfo(llvm::codegenoptions::FullDebugInfo);

163

CodeGenOpts.setDebuggerTuning(CI.

getCodeGenOpts

().getDebuggerTuning());

169

CodeGenOpts.DebugStrictDwarf = CI.

getCodeGenOpts

().DebugStrictDwarf;

172

~PCHContainerGenerator()

override

=

default

;

175

assert(!Ctx &&

"initialized multiple times"

);

178

VMContext.reset(

new

llvm::LLVMContext());

179

M.reset(

new

llvm::Module(MainFileName, *VMContext));

182

*Ctx, FS, HeaderSearchOpts, PreprocessorOpts, CodeGenOpts, *M, Diags));

185 auto

*DI = Builder->getModuleDebugInfo();

186

StringRef ModuleName = llvm::sys::path::filename(MainFileName);

187

DI->setPCHDescriptor(

189

DI->setModuleMap(MMap);

198 if

(!I->isFromASTFile()) {

199

DebugTypeVisitor DTV(*Builder->getModuleDebugInfo(), *Ctx);

217 if

(

D

->getName().empty())

223 if

(

auto

*

D

= dyn_cast<TagDecl>(DeclCtx))

224 if

(!

D

->isCompleteDefinition())

229

DebugTypeVisitor DTV(*Builder->getModuleDebugInfo(), *Ctx);

230

DTV.TraverseDecl(

D

);

231

Builder->UpdateCompletedType(

D

);

238 if

(

const RecordDecl

*RD = dyn_cast<RecordDecl>(

D

))

239

Builder->getModuleDebugInfo()->completeRequiredType(RD);

244

Builder->getModuleDebugInfo()->EmitImportDecl(*

D

);

249

assert(M && VMContext && Builder);

251

std::unique_ptr<llvm::LLVMContext> VMContext = std::move(this->VMContext);

252

std::unique_ptr<llvm::Module> M = std::move(this->M);

253

std::unique_ptr<CodeGen::CodeGenModule> Builder = std::move(this->Builder);

266

Buffer->Signature ? Buffer->Signature.truncatedValue() : ~1ULL;

268

Builder->getModuleDebugInfo()->setDwoId(Signature);

277 if

(!llvm::TargetRegistry::lookupTarget(Triple.getTriple(), Error))

278

llvm::report_fatal_error(llvm::Twine(Error));

281

assert(Buffer->IsComplete &&

"serialization did not complete"

);

282 auto

&SerializedAST = Buffer->Data;

283 auto

Size = SerializedAST.size();

285 if

(Triple.isOSBinFormatWasm()) {

291

llvm::NamedMDNode *MD =

292

M->getOrInsertNamedMetadata(

"wasm.custom_sections"

);

293

llvm::Metadata *Ops[2] = {

294

llvm::MDString::get(*VMContext,

"__clangast"

),

295

llvm::MDString::get(*VMContext,

296

StringRef(SerializedAST.data(), Size))};

297 auto

*NameAndContent = llvm::MDTuple::get(*VMContext, Ops);

298

MD->addOperand(NameAndContent);

300 auto

Int8Ty = llvm::Type::getInt8Ty(*VMContext);

301 auto

*Ty = llvm::ArrayType::get(Int8Ty, Size);

302 auto

*

Data

= llvm::ConstantDataArray::getString(

303

*VMContext, StringRef(SerializedAST.data(), Size),

305 auto

*ASTSym =

new

llvm::GlobalVariable(

306

*M, Ty,

true

, llvm::GlobalVariable::InternalLinkage,

307 Data

,

"__clang_ast"

);

309

ASTSym->setAlignment(llvm::Align(8));

312 if

(Triple.isOSBinFormatMachO())

313

ASTSym->setSection(

"__CLANG,__clangast"

);

315 else if

(Triple.isOSBinFormatCOFF())

316

ASTSym->setSection(

"clangast"

);

318

ASTSym->setSection(

"__clangast"

);

326

BackendAction::Backend_EmitLL, FS,

327

std::make_unique<llvm::raw_svector_ostream>(Buffer));

328

llvm::dbgs() << Buffer;

334

BackendAction::Backend_EmitObj, FS, std::move(OS));

338

SerializedAST = std::move(

Empty

);

344

std::unique_ptr<ASTConsumer>

345

ObjectFilePCHContainerWriter::CreatePCHContainerGenerator(

347 const

std::string &OutputFileName,

348

std::unique_ptr<llvm::raw_pwrite_stream> OS,

349

std::shared_ptr<PCHBuffer> Buffer)

const

{

350 return

std::make_unique<PCHContainerGenerator>(

351

CI, MainFileName, OutputFileName, std::move(OS), Buffer);

Defines the clang::ASTContext interface.

Defines the Diagnostic-related interfaces.

Defines the clang::Preprocessor interface.

ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs.

virtual void HandleTagDeclDefinition(TagDecl *D)

HandleTagDeclDefinition - This callback is invoked each time a TagDecl (e.g.

virtual void HandleTranslationUnit(ASTContext &Ctx)

HandleTranslationUnit - This method is called when the ASTs for entire translation unit have been par...

virtual void HandleTagDeclRequiredDefinition(const TagDecl *D)

This callback is invoked the first time each TagDecl is required to be complete.

virtual void HandleTopLevelDeclInObjCContainer(DeclGroupRef D)

Handle the specified top-level declaration that occurred inside and ObjC container.

virtual bool HandleTopLevelDecl(DeclGroupRef D)

HandleTopLevelDecl - Handle the specified top-level declaration.

virtual void Initialize(ASTContext &Context)

Initialize - This is called to initialize the consumer, providing the ASTContext.

virtual void HandleImplicitImportDecl(ImportDecl *D)

Handle an ImportDecl that was implicitly created due to an inclusion directive.

Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...

QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const

Return the unique reference to the type for the specified type declaration.

QualType getObjCSelType() const

Retrieve the type that corresponds to the predefined Objective-C 'SEL' type.

QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const

Return a normal function type with a typed argument list.

const TargetInfo & getTargetInfo() const

CodeGenOptions - Track various options which control how the code is optimized and passed to the back...

llvm::SmallVector< std::pair< std::string, std::string >, 0 > DebugPrefixMap

std::string CodeModel

The code model to use (-mcmodel).

std::string DebugCompilationDir

The string to embed in debug information as the current working directory.

std::string MainFileName

The user provided name for the "main file", if non-empty.

This class gathers all debug information during compilation and is responsible for emitting to llvm g...

llvm::DIType * getOrCreateStandaloneType(QualType Ty, SourceLocation Loc)

Emit standalone debug info for a type.

void EmitFunctionDecl(GlobalDecl GD, SourceLocation Loc, QualType FnType, llvm::Function *Fn=nullptr)

Emit debug info for a function declaration.

void EmitImportDecl(const ImportDecl &ID)

Emit an @import declaration.

This class organizes the cross-function state that is used while generating LLVM code.

CompilerInstance - Helper class for managing a single instance of the Clang compiler.

DiagnosticsEngine & getDiagnostics() const

Get the current diagnostics engine.

Preprocessor & getPreprocessor() const

Return the current preprocessor.

TargetOptions & getTargetOpts()

HeaderSearchOptions & getHeaderSearchOpts()

CompilerInvocation & getInvocation()

PreprocessorOptions & getPreprocessorOpts()

llvm::vfs::FileSystem & getVirtualFileSystem() const

LangOptions & getLangOpts()

CodeGenOptions & getCodeGenOpts()

CodeGenOptions & getCodeGenOpts()

DeclContext * getParent()

getParent - Returns the containing DeclContext.

Module * getImportedOwningModule() const

Get the imported owning module, if this decl is from an imported (non-local) module.

bool isFromASTFile() const

Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...

SourceLocation getLocation() const

DeclContext * getDeclContext()

Concrete class used by the front-end to report problems and issues.

bool hasErrorOccurred() const

Represents a function declaration or definition.

Describes a module import declaration, which makes the contents of the named module visible in the cu...

Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...

std::string CurrentModule

The name of the current module, of which the main source file is a part.

Represents an ObjC class declaration.

ObjCMethodDecl - Represents an instance or class method declaration.

PreprocessorOptions - This class is used for passing the various options used in preprocessor initial...

HeaderSearch & getHeaderSearchInfo() const

A (possibly-)qualified type.

bool isNull() const

Return true if this QualType doesn't point to a type yet.

const Type * getTypePtr() const

Retrieves a pointer to the underlying (unqualified) type.

Represents a struct/union/class.

A class that does preorder or postorder depth-first traversal on the entire Clang AST and visits each...

Represents the declaration of a struct/union/class/enum.

const llvm::Triple & getTriple() const

Returns the target triple of the primary target.

const char * getDataLayoutString() const

Options for controlling the target.

Represents a declaration of a type.

The base class of the type hierarchy.

bool isDependentType() const

Whether this type is a dependent type, meaning that its definition somehow depends on a template para...

bool isUndeducedType() const

Determine whether this type is an undeduced type, meaning that it somehow involves a C++11 'auto' typ...

Defines the clang::TargetInfo interface.

The JSON file list parser is used to communicate input to InstallAPI.

void emitBackendOutput(CompilerInstance &CI, CodeGenOptions &CGOpts, StringRef TDesc, llvm::Module *M, BackendAction Action, llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > VFS, std::unique_ptr< raw_pwrite_stream > OS, BackendConsumer *BC=nullptr)

static ASTFileSignature createDISentinel()

Extra information about a function prototype.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4