|
21 | 21 | #include "TargetInfo.h" |
22 | 22 | #include "clang/AST/ASTContext.h" |
23 | 23 | #include "clang/AST/Attr.h" |
| 24 | +#include "clang/AST/Attrs.inc" |
24 | 25 | #include "clang/AST/DeclCXX.h" |
25 | 26 | #include "clang/AST/DeclFriend.h" |
26 | 27 | #include "clang/AST/DeclObjC.h" |
@@ -109,6 +110,20 @@ static bool IsArtificial(VarDecl const *VD) { |
109 | 110 | cast<Decl>(VD->getDeclContext())->isImplicit()); |
110 | 111 | } |
111 | 112 |
|
| 113 | +static bool usesDebugTransparent(const Decl *D, const CodeGenModule &CGM) { |
| 114 | + if (!D) |
| 115 | + return false; |
| 116 | + |
| 117 | + if (auto *attr = D->getAttr<DebugTransparentAttr>()) { |
| 118 | + if (CGM.getCodeGenOpts().DwarfVersion == 0) |
| 119 | + CGM.getDiags().Report(attr->getLocation(), |
| 120 | + diag::warn_debug_transparent_ignored); |
| 121 | + return true; |
| 122 | + } |
| 123 | + |
| 124 | + return false; |
| 125 | +} |
| 126 | + |
112 | 127 | CGDebugInfo::CGDebugInfo(CodeGenModule &CGM) |
113 | 128 | : CGM(CGM), DebugKind(CGM.getCodeGenOpts().getDebugInfo()), |
114 | 129 | DebugTypeExtRefs(CGM.getCodeGenOpts().DebugTypeExtRefs), |
@@ -4480,6 +4495,8 @@ void CGDebugInfo::emitFunctionStart(GlobalDecl GD, SourceLocation Loc, |
4480 | 4495 | SPFlags |= llvm::DISubprogram::SPFlagLocalToUnit; |
4481 | 4496 | if (CGM.getLangOpts().Optimize) |
4482 | 4497 | SPFlags |= llvm::DISubprogram::SPFlagOptimized; |
| 4498 | + if (usesDebugTransparent(D, CGM)) |
| 4499 | + SPFlags |= llvm::DISubprogram::SPFlagIsDebugTransparent; |
4483 | 4500 |
|
4484 | 4501 | llvm::DINode::DIFlags FlagsForDef = Flags | getCallSiteRelatedAttrs(); |
4485 | 4502 | llvm::DISubprogram::DISPFlags SPFlagsForDef = |
|
0 commit comments