From 5713db4c4af8261b5306e1a6eb1a60625d8b4cc7 Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Fri, 21 Sep 2018 09:17:06 +0000 Subject: [CodeGen] Add to emitted DebugLoc information about coverage when it's required Summary: Some lines have a hit counter where they should not have one. Cleanup stuff is located to the last line of the body which is most of the time a '}'. And Exception stuff is added at the beginning of a function and at the end (represented by '{' and '}'). So in such cases, the DebugLoc used in GCOVProfiling.cpp must be marked as not covered. This patch is a followup of https://reviews.llvm.org/D49915. Tests in projects/compiler_rt are fixed by: https://reviews.llvm.org/D49917 Reviewers: marco-c, davidxl Reviewed By: marco-c Subscribers: dblaikie, cfe-commits, sylvestre.ledru Differential Revision: https://reviews.llvm.org/D49916 llvm-svn: 342717 --- clang/lib/CodeGen/CodeGenFunction.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp') diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 77f978f687e..8fa0badc6e2 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -317,7 +317,7 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) { if (OnlySimpleReturnStmts) DI->EmitLocation(Builder, LastStopPoint); else - DI->EmitLocation(Builder, EndLoc); + DI->EmitLocation(Builder, EndLoc, true /* ImplicitCode */); } // Pop any cleanups that might have been associated with the @@ -333,7 +333,7 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) { // the ret after it's been at EndLoc. if (CGDebugInfo *DI = getDebugInfo()) if (OnlySimpleReturnStmts) - DI->EmitLocation(Builder, EndLoc); + DI->EmitLocation(Builder, EndLoc, true /* ImplicitCode */); PopCleanupBlocks(PrologueCleanupDepth); } @@ -1179,7 +1179,7 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, } // Emit a location at the end of the prologue. if (CGDebugInfo *DI = getDebugInfo()) - DI->EmitLocation(Builder, StartLoc); + DI->EmitLocation(Builder, StartLoc, true /* ImplicitCode */); // TODO: Do we need to handle this in two places like we do with // target-features/target-cpu? -- cgit v1.2.3