diff options
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/BackendUtil.cpp | 8 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 34 |
2 files changed, 38 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index 468c930..aefc262 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -713,14 +713,16 @@ static void addSanitizers(const Triple &TargetTriple, ThinOrFullLTOPhase) { if (CodeGenOpts.hasSanitizeCoverage()) { auto SancovOpts = getSancovOptsFromCGOpts(CodeGenOpts); - MPM.addPass(SanitizerCoveragePass( - SancovOpts, CodeGenOpts.SanitizeCoverageAllowlistFiles, - CodeGenOpts.SanitizeCoverageIgnorelistFiles)); + MPM.addPass( + SanitizerCoveragePass(SancovOpts, PB.getVirtualFileSystemPtr(), + CodeGenOpts.SanitizeCoverageAllowlistFiles, + CodeGenOpts.SanitizeCoverageIgnorelistFiles)); } if (CodeGenOpts.hasSanitizeBinaryMetadata()) { MPM.addPass(SanitizerBinaryMetadataPass( getSanitizerBinaryMetadataOptions(CodeGenOpts), + PB.getVirtualFileSystemPtr(), CodeGenOpts.SanitizeMetadataIgnorelistFiles)); } diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 12e2813ef..6af8066 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -110,6 +110,33 @@ static bool IsArtificial(VarDecl const *VD) { cast<Decl>(VD->getDeclContext())->isImplicit()); } +/// Returns \c true if the specified variable \c VD is an explicit parameter of +/// a synthesized Objective-C property accessor. E.g., a synthesized property +/// setter method will have a single explicit parameter which is the property to +/// set. +static bool IsObjCSynthesizedPropertyExplicitParameter(VarDecl const *VD) { + assert(VD); + + if (!llvm::isa<ParmVarDecl>(VD)) + return false; + + // Not a property method. + const auto *Method = + llvm::dyn_cast_or_null<ObjCMethodDecl>(VD->getDeclContext()); + if (!Method) + return false; + + // Not a synthesized property accessor. + if (!Method->isImplicit() || !Method->isPropertyAccessor()) + return false; + + // Not an explicit parameter. + if (VD->isImplicit()) + return false; + + return true; +} + CGDebugInfo::CGDebugInfo(CodeGenModule &CGM) : CGM(CGM), DebugKind(CGM.getCodeGenOpts().getDebugInfo()), DebugTypeExtRefs(CGM.getCodeGenOpts().DebugTypeExtRefs), @@ -5158,7 +5185,12 @@ llvm::DILocalVariable *CGDebugInfo::EmitDeclare(const VarDecl *VD, } SmallVector<uint64_t, 13> Expr; llvm::DINode::DIFlags Flags = llvm::DINode::FlagZero; - if (VarIsArtificial) + + // While synthesized Objective-C property setters are "artificial" (i.e., they + // are not spelled out in source), we want to pretend they are just like a + // regular non-compiler generated method. Hence, don't mark explicitly passed + // parameters of such methods as artificial. + if (VarIsArtificial && !IsObjCSynthesizedPropertyExplicitParameter(VD)) Flags |= llvm::DINode::FlagArtificial; auto Align = getDeclAlignIfRequired(VD, CGM.getContext()); |
