clang  14.0.0git
ObjectFilePCHContainerOperations.cpp
Go to the documentation of this file.
1 //===--- ObjectFilePCHContainerOperations.cpp -----------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 #include "CGDebugInfo.h"
11 #include "CodeGenModule.h"
12 #include "clang/AST/ASTContext.h"
13 #include "clang/AST/DeclObjC.h"
14 #include "clang/AST/Expr.h"
17 #include "clang/Basic/Diagnostic.h"
18 #include "clang/Basic/TargetInfo.h"
21 #include "clang/Lex/HeaderSearch.h"
22 #include "clang/Lex/Preprocessor.h"
23 #include "llvm/ADT/StringRef.h"
24 #include "llvm/Bitstream/BitstreamReader.h"
25 #include "llvm/DebugInfo/DWARF/DWARFContext.h"
26 #include "llvm/IR/Constants.h"
27 #include "llvm/IR/DataLayout.h"
28 #include "llvm/IR/LLVMContext.h"
29 #include "llvm/IR/Module.h"
30 #include "llvm/MC/TargetRegistry.h"
31 #include "llvm/Object/COFF.h"
32 #include "llvm/Object/ObjectFile.h"
33 #include "llvm/Support/Path.h"
34 #include <memory>
35 #include <utility>
36 
37 using namespace clang;
38 
39 #define DEBUG_TYPE "pchcontainer"
40 
41 namespace {
42 class PCHContainerGenerator : public ASTConsumer {
43  DiagnosticsEngine &Diags;
44  const std::string MainFileName;
45  const std::string OutputFileName;
46  ASTContext *Ctx;
47  ModuleMap &MMap;
48  const HeaderSearchOptions &HeaderSearchOpts;
49  const PreprocessorOptions &PreprocessorOpts;
50  CodeGenOptions CodeGenOpts;
51  const TargetOptions TargetOpts;
52  LangOptions LangOpts;
53  std::unique_ptr<llvm::LLVMContext> VMContext;
54  std::unique_ptr<llvm::Module> M;
55  std::unique_ptr<CodeGen::CodeGenModule> Builder;
56  std::unique_ptr<raw_pwrite_stream> OS;
57  std::shared_ptr<PCHBuffer> Buffer;
58 
59  /// Visit every type and emit debug info for it.
60  struct DebugTypeVisitor : public RecursiveASTVisitor<DebugTypeVisitor> {
62  ASTContext &Ctx;
63  DebugTypeVisitor(clang::CodeGen::CGDebugInfo &DI, ASTContext &Ctx)
64  : DI(DI), Ctx(Ctx) {}
65 
66  /// Determine whether this type can be represented in DWARF.
67  static bool CanRepresent(const Type *Ty) {
68  return !Ty->isDependentType() && !Ty->isUndeducedType();
69  }
70 
71  bool VisitImportDecl(ImportDecl *D) {
72  if (!D->getImportedOwningModule())
73  DI.EmitImportDecl(*D);
74  return true;
75  }
76 
77  bool VisitTypeDecl(TypeDecl *D) {
78  // TagDecls may be deferred until after all decls have been merged and we
79  // know the complete type. Pure forward declarations will be skipped, but
80  // they don't need to be emitted into the module anyway.
81  if (auto *TD = dyn_cast<TagDecl>(D))
82  if (!TD->isCompleteDefinition())
83  return true;
84 
85  QualType QualTy = Ctx.getTypeDeclType(D);
86  if (!QualTy.isNull() && CanRepresent(QualTy.getTypePtr()))
87  DI.getOrCreateStandaloneType(QualTy, D->getLocation());
88  return true;
89  }
90 
91  bool VisitObjCInterfaceDecl(ObjCInterfaceDecl *D) {
92  QualType QualTy(D->getTypeForDecl(), 0);
93  if (!QualTy.isNull() && CanRepresent(QualTy.getTypePtr()))
94  DI.getOrCreateStandaloneType(QualTy, D->getLocation());
95  return true;
96  }
97 
98  bool VisitFunctionDecl(FunctionDecl *D) {
99  if (isa<CXXMethodDecl>(D))
100  // This is not yet supported. Constructing the `this' argument
101  // mandates a CodeGenFunction.
102  return true;
103 
104  SmallVector<QualType, 16> ArgTypes;
105  for (auto i : D->parameters())
106  ArgTypes.push_back(i->getType());
107  QualType RetTy = D->getReturnType();
108  QualType FnTy = Ctx.getFunctionType(RetTy, ArgTypes,
110  if (CanRepresent(FnTy.getTypePtr()))
111  DI.EmitFunctionDecl(D, D->getLocation(), FnTy);
112  return true;
113  }
114 
115  bool VisitObjCMethodDecl(ObjCMethodDecl *D) {
116  if (!D->getClassInterface())
117  return true;
118 
119  bool selfIsPseudoStrong, selfIsConsumed;
120  SmallVector<QualType, 16> ArgTypes;
121  ArgTypes.push_back(D->getSelfType(Ctx, D->getClassInterface(),
122  selfIsPseudoStrong, selfIsConsumed));
123  ArgTypes.push_back(Ctx.getObjCSelType());
124  for (auto i : D->parameters())
125  ArgTypes.push_back(i->getType());
126  QualType RetTy = D->getReturnType();
127  QualType FnTy = Ctx.getFunctionType(RetTy, ArgTypes,
129  if (CanRepresent(FnTy.getTypePtr()))
130  DI.EmitFunctionDecl(D, D->getLocation(), FnTy);
131  return true;
132  }
133  };
134 
135 public:
136  PCHContainerGenerator(CompilerInstance &CI, const std::string &MainFileName,
137  const std::string &OutputFileName,
138  std::unique_ptr<raw_pwrite_stream> OS,
139  std::shared_ptr<PCHBuffer> Buffer)
140  : Diags(CI.getDiagnostics()), MainFileName(MainFileName),
141  OutputFileName(OutputFileName), Ctx(nullptr),
143  HeaderSearchOpts(CI.getHeaderSearchOpts()),
144  PreprocessorOpts(CI.getPreprocessorOpts()),
145  TargetOpts(CI.getTargetOpts()), LangOpts(CI.getLangOpts()),
146  OS(std::move(OS)), Buffer(std::move(Buffer)) {
147  // The debug info output isn't affected by CodeModel and
148  // ThreadModel, but the backend expects them to be nonempty.
149  CodeGenOpts.CodeModel = "default";
150  LangOpts.setThreadModel(LangOptions::ThreadModelKind::Single);
151  CodeGenOpts.DebugTypeExtRefs = true;
152  // When building a module MainFileName is the name of the modulemap file.
153  CodeGenOpts.MainFileName =
154  LangOpts.CurrentModule.empty() ? MainFileName : LangOpts.CurrentModule;
155  CodeGenOpts.setDebugInfo(codegenoptions::FullDebugInfo);
156  CodeGenOpts.setDebuggerTuning(CI.getCodeGenOpts().getDebuggerTuning());
157  CodeGenOpts.DebugPrefixMap =
159  }
160 
161  ~PCHContainerGenerator() override = default;
162 
163  void Initialize(ASTContext &Context) override {
164  assert(!Ctx && "initialized multiple times");
165 
166  Ctx = &Context;
167  VMContext.reset(new llvm::LLVMContext());
168  M.reset(new llvm::Module(MainFileName, *VMContext));
169  M->setDataLayout(Ctx->getTargetInfo().getDataLayoutString());
170  Builder.reset(new CodeGen::CodeGenModule(
171  *Ctx, HeaderSearchOpts, PreprocessorOpts, CodeGenOpts, *M, Diags));
172 
173  // Prepare CGDebugInfo to emit debug info for a clang module.
174  auto *DI = Builder->getModuleDebugInfo();
175  StringRef ModuleName = llvm::sys::path::filename(MainFileName);
176  DI->setPCHDescriptor(
177  {ModuleName, "", OutputFileName, ASTFileSignature::createDISentinel()});
178  DI->setModuleMap(MMap);
179  }
180 
181  bool HandleTopLevelDecl(DeclGroupRef D) override {
182  if (Diags.hasErrorOccurred())
183  return true;
184 
185  // Collect debug info for all decls in this group.
186  for (auto *I : D)
187  if (!I->isFromASTFile()) {
188  DebugTypeVisitor DTV(*Builder->getModuleDebugInfo(), *Ctx);
189  DTV.TraverseDecl(I);
190  }
191  return true;
192  }
193 
194  void HandleTopLevelDeclInObjCContainer(DeclGroupRef D) override {
195  HandleTopLevelDecl(D);
196  }
197 
198  void HandleTagDeclDefinition(TagDecl *D) override {
199  if (Diags.hasErrorOccurred())
200  return;
201 
202  if (D->isFromASTFile())
203  return;
204 
205  // Anonymous tag decls are deferred until we are building their declcontext.
206  if (D->getName().empty())
207  return;
208 
209  // Defer tag decls until their declcontext is complete.
210  auto *DeclCtx = D->getDeclContext();
211  while (DeclCtx) {
212  if (auto *D = dyn_cast<TagDecl>(DeclCtx))
213  if (!D->isCompleteDefinition())
214  return;
215  DeclCtx = DeclCtx->getParent();
216  }
217 
218  DebugTypeVisitor DTV(*Builder->getModuleDebugInfo(), *Ctx);
219  DTV.TraverseDecl(D);
220  Builder->UpdateCompletedType(D);
221  }
222 
223  void HandleTagDeclRequiredDefinition(const TagDecl *D) override {
224  if (Diags.hasErrorOccurred())
225  return;
226 
227  if (const RecordDecl *RD = dyn_cast<RecordDecl>(D))
228  Builder->getModuleDebugInfo()->completeRequiredType(RD);
229  }
230 
231  void HandleImplicitImportDecl(ImportDecl *D) override {
232  if (!D->getImportedOwningModule())
233  Builder->getModuleDebugInfo()->EmitImportDecl(*D);
234  }
235 
236  /// Emit a container holding the serialized AST.
237  void HandleTranslationUnit(ASTContext &Ctx) override {
238  assert(M && VMContext && Builder);
239  // Delete these on function exit.
240  std::unique_ptr<llvm::LLVMContext> VMContext = std::move(this->VMContext);
241  std::unique_ptr<llvm::Module> M = std::move(this->M);
242  std::unique_ptr<CodeGen::CodeGenModule> Builder = std::move(this->Builder);
243 
244  if (Diags.hasErrorOccurred())
245  return;
246 
247  M->setTargetTriple(Ctx.getTargetInfo().getTriple().getTriple());
248  M->setDataLayout(Ctx.getTargetInfo().getDataLayoutString());
249 
250  // PCH files don't have a signature field in the control block,
251  // but LLVM detects DWO CUs by looking for a non-zero DWO id.
252  // We use the lower 64 bits for debug info.
253 
254  uint64_t Signature =
255  Buffer->Signature ? Buffer->Signature.truncatedValue() : ~1ULL;
256 
257  Builder->getModuleDebugInfo()->setDwoId(Signature);
258 
259  // Finalize the Builder.
260  if (Builder)
261  Builder->Release();
262 
263  // Ensure the target exists.
265  auto Triple = Ctx.getTargetInfo().getTriple();
266  if (!llvm::TargetRegistry::lookupTarget(Triple.getTriple(), Error))
267  llvm::report_fatal_error(llvm::Twine(Error));
268 
269  // Emit the serialized Clang AST into its own section.
270  assert(Buffer->IsComplete && "serialization did not complete");
271  auto &SerializedAST = Buffer->Data;
272  auto Size = SerializedAST.size();
273 
274  if (Triple.isOSBinFormatWasm()) {
275  // Emit __clangast in custom section instead of named data segment
276  // to find it while iterating sections.
277  // This could be avoided if all data segements (the wasm sense) were
278  // represented as their own sections (in the llvm sense).
279  // TODO: https://github.com/WebAssembly/tool-conventions/issues/138
280  llvm::NamedMDNode *MD =
281  M->getOrInsertNamedMetadata("wasm.custom_sections");
282  llvm::Metadata *Ops[2] = {
283  llvm::MDString::get(*VMContext, "__clangast"),
284  llvm::MDString::get(*VMContext,
285  StringRef(SerializedAST.data(), Size))};
286  auto *NameAndContent = llvm::MDTuple::get(*VMContext, Ops);
287  MD->addOperand(NameAndContent);
288  } else {
289  auto Int8Ty = llvm::Type::getInt8Ty(*VMContext);
290  auto *Ty = llvm::ArrayType::get(Int8Ty, Size);
291  auto *Data = llvm::ConstantDataArray::getString(
292  *VMContext, StringRef(SerializedAST.data(), Size),
293  /*AddNull=*/false);
294  auto *ASTSym = new llvm::GlobalVariable(
295  *M, Ty, /*constant*/ true, llvm::GlobalVariable::InternalLinkage,
296  Data, "__clang_ast");
297  // The on-disk hashtable needs to be aligned.
298  ASTSym->setAlignment(llvm::Align(8));
299 
300  // Mach-O also needs a segment name.
301  if (Triple.isOSBinFormatMachO())
302  ASTSym->setSection("__CLANG,__clangast");
303  // COFF has an eight character length limit.
304  else if (Triple.isOSBinFormatCOFF())
305  ASTSym->setSection("clangast");
306  else
307  ASTSym->setSection("__clangast");
308  }
309 
310  LLVM_DEBUG({
311  // Print the IR for the PCH container to the debug output.
312  llvm::SmallString<0> Buffer;
314  Diags, HeaderSearchOpts, CodeGenOpts, TargetOpts, LangOpts,
315  Ctx.getTargetInfo().getDataLayoutString(), M.get(),
317  std::make_unique<llvm::raw_svector_ostream>(Buffer));
318  llvm::dbgs() << Buffer;
319  });
320 
321  // Use the LLVM backend to emit the pch container.
322  clang::EmitBackendOutput(Diags, HeaderSearchOpts, CodeGenOpts, TargetOpts,
323  LangOpts,
324  Ctx.getTargetInfo().getDataLayoutString(), M.get(),
325  BackendAction::Backend_EmitObj, std::move(OS));
326 
327  // Free the memory for the temporary buffer.
329  SerializedAST = std::move(Empty);
330  }
331 };
332 
333 } // anonymous namespace
334 
335 std::unique_ptr<ASTConsumer>
336 ObjectFilePCHContainerWriter::CreatePCHContainerGenerator(
337  CompilerInstance &CI, const std::string &MainFileName,
338  const std::string &OutputFileName,
339  std::unique_ptr<llvm::raw_pwrite_stream> OS,
340  std::shared_ptr<PCHBuffer> Buffer) const {
341  return std::make_unique<PCHContainerGenerator>(
342  CI, MainFileName, OutputFileName, std::move(OS), Buffer);
343 }
344 
345 StringRef
346 ObjectFilePCHContainerReader::ExtractPCH(llvm::MemoryBufferRef Buffer) const {
347  StringRef PCH;
348  auto OFOrErr = llvm::object::ObjectFile::createObjectFile(Buffer);
349  if (OFOrErr) {
350  auto &OF = OFOrErr.get();
351  bool IsCOFF = isa<llvm::object::COFFObjectFile>(*OF);
352  // Find the clang AST section in the container.
353  for (auto &Section : OF->sections()) {
354  StringRef Name;
355  if (Expected<StringRef> NameOrErr = Section.getName())
356  Name = *NameOrErr;
357  else
358  consumeError(NameOrErr.takeError());
359 
360  if ((!IsCOFF && Name == "__clangast") || (IsCOFF && Name == "clangast")) {
361  if (Expected<StringRef> E = Section.getContents())
362  return *E;
363  else {
364  handleAllErrors(E.takeError(), [&](const llvm::ErrorInfoBase &EIB) {
365  EIB.log(llvm::errs());
366  });
367  return "";
368  }
369  }
370  }
371  }
372  handleAllErrors(OFOrErr.takeError(), [&](const llvm::ErrorInfoBase &EIB) {
373  if (EIB.convertToErrorCode() ==
374  llvm::object::object_error::invalid_file_type)
375  // As a fallback, treat the buffer as a raw AST.
376  PCH = Buffer.getBuffer();
377  else
378  EIB.log(llvm::errs());
379  });
380  return PCH;
381 }
clang::InternalLinkage
@ InternalLinkage
Internal linkage, which indicates that the entity can be referred to from within the translation unit...
Definition: Linkage.h:31
clang::ObjCInterfaceDecl
Represents an ObjC class declaration.
Definition: DeclObjC.h:1151
clang::TargetInfo::getDataLayoutString
const char * getDataLayoutString() const
Definition: TargetInfo.h:1137
clang::LangOptions::CurrentModule
std::string CurrentModule
The name of the current module, of which the main source file is a part.
Definition: LangOptions.h:343
clang::ASTContext::getTypeDeclType
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
Definition: ASTContext.h:1538
clang::CompilerInvocationValueBase::getCodeGenOpts
CodeGenOptions & getCodeGenOpts()
Definition: CompilerInvocation.h:159
clang::CodeGen::CGDebugInfo::getOrCreateStandaloneType
llvm::DIType * getOrCreateStandaloneType(QualType Ty, SourceLocation Loc)
Emit standalone debug info for a type.
Definition: CGDebugInfo.cpp:2307
clang::FunctionDecl::getReturnType
QualType getReturnType() const
Definition: Decl.h:2537
Error
llvm::Error Error
Definition: ByteCodeEmitter.cpp:20
clang::Decl::getImportedOwningModule
Module * getImportedOwningModule() const
Get the imported owning module, if this decl is from an imported (non-local) module.
Definition: DeclBase.h:743
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::PreprocessorOptions
PreprocessorOptions - This class is used for passing the various options used in preprocessor initial...
Definition: PreprocessorOptions.h:64
clang::ObjCMethodDecl::getSelfType
QualType getSelfType(ASTContext &Context, const ObjCInterfaceDecl *OID, bool &selfIsPseudoStrong, bool &selfIsConsumed) const
Definition: DeclObjC.cpp:1098
llvm::SmallVector
Definition: LLVM.h:38
TargetInfo.h
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:673
clang::CompilerInstance::getLangOpts
LangOptions & getLangOpts()
Definition: CompilerInstance.h:301
clang::DiagnosticsEngine
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:191
clang::ObjCMethodDecl::getClassInterface
ObjCInterfaceDecl * getClassInterface()
Definition: DeclObjC.cpp:1164
clang::ASTContext::getFunctionType
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
Definition: ASTContext.h:1522
clang::CodeGenOptions::CodeModel
std::string CodeModel
The code model to use (-mcmodel).
Definition: CodeGenOptions.h:142
clang::Backend_EmitLL
@ Backend_EmitLL
Emit human-readable LLVM assembly.
Definition: BackendUtil.h:33
llvm::Expected
Definition: LLVM.h:41
clang::CompilerInstance::getCodeGenOpts
CodeGenOptions & getCodeGenOpts()
Definition: CompilerInstance.h:256
CGDebugInfo.h
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1490
Preprocessor.h
DeclObjC.h
CodeGenOptions.h
BackendUtil.h
clang::ImportDecl
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Definition: Decl.h:4447
clang::CodeGenOptions::DebugPrefixMap
std::map< std::string, std::string > DebugPrefixMap
Definition: CodeGenOptions.h:178
clang::DiagnosticsEngine::hasErrorOccurred
bool hasErrorOccurred() const
Definition: Diagnostic.h:836
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:212
Diagnostic.h
clang::RecursiveASTVisitor
A class that does preorder or postorder depth-first traversal on the entire Clang AST and visits each...
Definition: RecursiveASTVisitor.h:164
clang::ASTConsumer
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs.
Definition: ASTConsumer.h:33
clang::CodeGen::CGDebugInfo
This class gathers all debug information during compilation and is responsible for emitting to llvm g...
Definition: CGDebugInfo.h:56
Expr.h
llvm::SmallString< 0 >
ASTContext.h
clang::ObjCMethodDecl::getReturnType
QualType getReturnType() const
Definition: DeclObjC.h:332
clang::TagDecl
Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:3328
clang::TypeDecl
Represents a declaration of a type.
Definition: Decl.h:3138
clang::CompilerInstance::getPreprocessor
Preprocessor & getPreprocessor() const
Return the current preprocessor.
Definition: CompilerInstance.h:444
CodeGenModule.h
clang::TagDecl::isCompleteDefinition
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
Definition: Decl.h:3433
clang::CompilerInstance
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
Definition: CompilerInstance.h:74
clang::CodeGenOptions
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
Definition: CodeGenOptions.h:49
clang::ModuleMap
Definition: ModuleMap.h:75
clang::CompilerInstance::getPreprocessorOpts
PreprocessorOptions & getPreprocessorOpts()
Definition: CompilerInstance.h:308
clang::DisableValidationForModuleKind::PCH
@ PCH
Disable validation for a precompiled header and the modules it depends on.
clang::TargetInfo::getTriple
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
Definition: TargetInfo.h:1130
clang::CompilerInstance::getTargetOpts
TargetOptions & getTargetOpts()
Definition: CompilerInstance.h:322
clang::CodeGen::CGDebugInfo::EmitFunctionDecl
void EmitFunctionDecl(GlobalDecl GD, SourceLocation Loc, QualType FnType, llvm::Function *Fn=nullptr)
Emit debug info for a function declaration.
Definition: CGDebugInfo.cpp:4078
clang::Type::isDependentType
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Definition: Type.h:2174
clang::codegenoptions::FullDebugInfo
@ FullDebugInfo
Generate complete debug info.
Definition: DebugInfoOptions.h:50
clang::Decl::isFromASTFile
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
Definition: DeclBase.h:716
clang::DeclContext::getParent
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Definition: DeclBase.h:1860
clang::CodeGen::CodeGenModule
This class organizes the cross-function state that is used while generating LLVM code.
Definition: CodeGenModule.h:284
clang::QualType::isNull
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Definition: Type.h:738
clang::CompilerInstance::getInvocation
CompilerInvocation & getInvocation()
Definition: CompilerInstance.h:231
HeaderSearch.h
clang::DeclGroupRef
Definition: DeclGroup.h:51
clang::ASTFileSignature::createDISentinel
static ASTFileSignature createDISentinel()
Definition: Module.h:78
clang::LangOptions::ThreadModelKind::Single
@ Single
Single Threaded Environment.
clang::EmitBackendOutput
void EmitBackendOutput(DiagnosticsEngine &Diags, const HeaderSearchOptions &, const CodeGenOptions &CGOpts, const TargetOptions &TOpts, const LangOptions &LOpts, StringRef TDesc, llvm::Module *M, BackendAction Action, std::unique_ptr< raw_pwrite_stream > OS)
clang::ASTContext::getObjCSelType
QualType getObjCSelType() const
Retrieve the type that corresponds to the predefined Objective-C 'SEL' type.
Definition: ASTContext.h:2003
clang::ASTContext::getTargetInfo
const TargetInfo & getTargetInfo() const
Definition: ASTContext.h:747
clang::LangOptions
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:58
clang::CodeGen::CGDebugInfo::EmitImportDecl
void EmitImportDecl(const ImportDecl &ID)
Emit an @import declaration.
Definition: CGDebugInfo.cpp:5267
clang::ObjCMethodDecl
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:139
clang::FunctionProtoType::ExtProtoInfo
Extra information about a function prototype.
Definition: Type.h:3968
clang
Definition: CalledOnceCheck.h:17
RecursiveASTVisitor.h
CompilerInstance.h
clang::QualType::getTypePtr
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Definition: Type.h:6424
clang::ObjCMethodDecl::parameters
ArrayRef< ParmVarDecl * > parameters() const
Definition: DeclObjC.h:376
clang::Backend_EmitObj
@ Backend_EmitObj
Emit native object files.
Definition: BackendUtil.h:36
clang::TargetOptions
Options for controlling the target.
Definition: TargetOptions.h:26
clang::CompilerInstance::getDiagnostics
DiagnosticsEngine & getDiagnostics() const
Get the current diagnostics engine.
Definition: CompilerInstance.h:336
clang::ObjCInterfaceDecl::getTypeForDecl
const Type * getTypeForDecl() const
Definition: DeclObjC.h:1898
clang::Preprocessor::getHeaderSearchInfo
HeaderSearch & getHeaderSearchInfo() const
Definition: Preprocessor.h:965
clang::FunctionDecl::parameters
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:2483
clang::Decl::getLocation
SourceLocation getLocation() const
Definition: DeclBase.h:430
clang::FunctionDecl
Represents a function declaration or definition.
Definition: Decl.h:1856
clang::RecordDecl
Represents a struct/union/class.
Definition: Decl.h:3859
clang::HeaderSearch::getModuleMap
ModuleMap & getModuleMap()
Retrieve the module map.
Definition: HeaderSearch.h:740
clang::CompilerInstance::getHeaderSearchOpts
HeaderSearchOptions & getHeaderSearchOpts()
Definition: CompilerInstance.h:291
ObjectFilePCHContainerOperations.h
clang::CodeGenOptions::MainFileName
std::string MainFileName
The user provided name for the "main file", if non-empty.
Definition: CodeGenOptions.h:216
clang::HeaderSearchOptions
HeaderSearchOptions - Helper class for storing options related to the initialization of the HeaderSea...
Definition: HeaderSearchOptions.h:68
clang::Type::isUndeducedType
bool isUndeducedType() const
Determine whether this type is an undeduced type, meaning that it somehow involves a C++11 'auto' typ...
Definition: Type.h:7077
clang::Decl::getDeclContext
DeclContext * getDeclContext()
Definition: DeclBase.h:439
clang::NamedDecl::getName
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
Definition: Decl.h:276