diff options
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.h')
-rw-r--r-- | lib/CodeGen/CGDebugInfo.h | 64 |
1 files changed, 53 insertions, 11 deletions
diff --git a/lib/CodeGen/CGDebugInfo.h b/lib/CodeGen/CGDebugInfo.h index e632806138f06..031e40b9dde95 100644 --- a/lib/CodeGen/CGDebugInfo.h +++ b/lib/CodeGen/CGDebugInfo.h @@ -20,8 +20,8 @@ #include "clang/AST/ExternalASTSource.h" #include "clang/AST/Type.h" #include "clang/AST/TypeOrdering.h" +#include "clang/Basic/CodeGenOptions.h" #include "clang/Basic/SourceLocation.h" -#include "clang/Frontend/CodeGenOptions.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/Optional.h" @@ -76,6 +76,9 @@ class CGDebugInfo { llvm::DIType *OCLQueueDITy = nullptr; llvm::DIType *OCLNDRangeDITy = nullptr; llvm::DIType *OCLReserveIDDITy = nullptr; +#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ + llvm::DIType *Id##Ty = nullptr; +#include "clang/Basic/OpenCLExtensionTypes.def" /// Cache of previously constructed Types. llvm::DenseMap<const void *, llvm::TrackingMDRef> TypeCache; @@ -248,6 +251,11 @@ class CGDebugInfo { llvm::DINodeArray CollectFunctionTemplateParams(const FunctionDecl *FD, llvm::DIFile *Unit); + /// A helper function to collect debug info for function template + /// parameters. + llvm::DINodeArray CollectVarTemplateParams(const VarDecl *VD, + llvm::DIFile *Unit); + /// A helper function to collect debug info for template /// parameters. llvm::DINodeArray @@ -311,12 +319,31 @@ class CGDebugInfo { void AppendAddressSpaceXDeref(unsigned AddressSpace, SmallVectorImpl<int64_t> &Expr) const; + /// A helper function to collect debug info for the default elements of a + /// block. + /// + /// \returns The next available field offset after the default elements. + uint64_t collectDefaultElementTypesForBlockPointer( + const BlockPointerType *Ty, llvm::DIFile *Unit, + llvm::DIDerivedType *DescTy, unsigned LineNo, + SmallVectorImpl<llvm::Metadata *> &EltTys); + + /// A helper function to collect debug info for the default fields of a + /// block. + void collectDefaultFieldsForBlockLiteralDeclare( + const CGBlockInfo &Block, const ASTContext &Context, SourceLocation Loc, + const llvm::StructLayout &BlockLayout, llvm::DIFile *Unit, + SmallVectorImpl<llvm::Metadata *> &Fields); + public: CGDebugInfo(CodeGenModule &CGM); ~CGDebugInfo(); void finalize(); + /// Remap a given path with the current debug prefix map + std::string remapDIPath(StringRef) const; + /// Register VLA size expression debug node with the qualified type. void registerVLASizeExpression(QualType Ty, llvm::Metadata *SizeExpr) { SizeExprCache[Ty] = SizeExpr; @@ -475,9 +502,16 @@ private: llvm::Optional<unsigned> ArgNo, CGBuilderTy &Builder); + struct BlockByRefType { + /// The wrapper struct used inside the __block_literal struct. + llvm::DIType *BlockByRefWrapper; + /// The type as it appears in the source code. + llvm::DIType *WrappedType; + }; + /// Build up structure info for the byref. See \a BuildByRefType. - llvm::DIType *EmitTypeForVarWithBlocksAttr(const VarDecl *VD, - uint64_t *OffSet); + BlockByRefType EmitTypeForVarWithBlocksAttr(const VarDecl *VD, + uint64_t *OffSet); /// Get context info for the DeclContext of \p Decl. llvm::DIScope *getDeclContextDescriptor(const Decl *D); @@ -497,9 +531,6 @@ private: /// Create new compile unit. void CreateCompileUnit(); - /// Remap a given path with the current debug prefix map - std::string remapDIPath(StringRef) const; - /// Compute the file checksum debug info for input file ID. Optional<llvm::DIFile::ChecksumKind> computeChecksum(FileID FID, SmallString<32> &Checksum) const; @@ -507,11 +538,15 @@ private: /// Get the source of the given file ID. Optional<StringRef> getSource(const SourceManager &SM, FileID FID); - /// Get the file debug info descriptor for the input location. + /// Convenience function to get the file debug info descriptor for the input + /// location. llvm::DIFile *getOrCreateFile(SourceLocation Loc); - /// Get the file info for main compile unit. - llvm::DIFile *getOrCreateMainFile(); + /// Create a file debug info descriptor for a source file. + llvm::DIFile * + createFile(StringRef FileName, + Optional<llvm::DIFile::ChecksumInfo<StringRef>> CSInfo, + Optional<StringRef> Source); /// Get the type from the cache or create a new type if necessary. llvm::DIType *getOrCreateType(QualType Ty, llvm::DIFile *Fg); @@ -580,6 +615,11 @@ private: unsigned LineNo, StringRef LinkageName, llvm::GlobalVariable *Var, llvm::DIScope *DContext); + + /// Return flags which enable debug info emission for call sites, provided + /// that it is supported and enabled. + llvm::DINode::DIFlags getCallSiteRelatedAttrs() const; + /// Get the printing policy for producing names for debug info. PrintingPolicy getPrintingPolicy() const; @@ -622,7 +662,9 @@ private: /// Collect various properties of a VarDecl. void collectVarDeclProps(const VarDecl *VD, llvm::DIFile *&Unit, unsigned &LineNo, QualType &T, StringRef &Name, - StringRef &LinkageName, llvm::DIScope *&VDContext); + StringRef &LinkageName, + llvm::MDTuple *&TemplateParameters, + llvm::DIScope *&VDContext); /// Allocate a copy of \p A using the DebugInfoNames allocator /// and return a reference to it. If multiple arguments are given the strings @@ -702,7 +744,7 @@ public: /// function \p InlinedFn. The current debug location becomes the inlined call /// site of the inlined function. ApplyInlineDebugLocation(CodeGenFunction &CGF, GlobalDecl InlinedFn); - /// Restore everything back to the orginial state. + /// Restore everything back to the original state. ~ApplyInlineDebugLocation(); }; |