From 168c190c581d21d50edefeedebe38400a12845e1 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Wed, 7 Nov 2012 05:19:04 +0000 Subject: Add comment describing what's going on here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167525 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 5 ++++- tools/llvm-cov/llvm-cov.cpp | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index e8c807ac5f..367b523079 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -307,8 +307,11 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(CompileUnit *SPCU, assert(SPDie && "Unable to find subprogram DIE!"); DISubprogram SP(SPNode); - // Pick up abstract subprogram DIE. + // If we're updating an abstract DIE, then we will be adding the children and + // object pointer later on. But what we don't want to do is process the + // concrete DIE twice. if (DIE *AbsSPDIE = AbstractSPDies.lookup(SPNode)) { + // Pick up abstract subprogram DIE. SPDie = new DIE(dwarf::DW_TAG_subprogram); SPCU->addDIEEntry(SPDie, dwarf::DW_AT_abstract_origin, dwarf::DW_FORM_ref4, AbsSPDIE); diff --git a/tools/llvm-cov/llvm-cov.cpp b/tools/llvm-cov/llvm-cov.cpp index 7b21c5bae2..ce5ff9c450 100644 --- a/tools/llvm-cov/llvm-cov.cpp +++ b/tools/llvm-cov/llvm-cov.cpp @@ -16,11 +16,15 @@ #include "llvm/Support/GCOV.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MemoryObject.h" +#include "llvm/Support/Path.h" #include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/Signals.h" #include "llvm/Support/system_error.h" using namespace llvm; +static cl::opt +InputFilename(cl::Positional, cl::desc("source filename"), cl::init("")); + static cl::opt DumpGCOV("dump", cl::init(false), cl::desc("dump gcov file")); @@ -40,6 +44,23 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv, "llvm cov\n"); + if (InputFilename.empty()) { + // FIXME: Error out here. + } + + sys::Path SrcFile(InputFilename); + + sys::Path GCNOFile(SrcFile); + GCNOFile.eraseSuffix(); + GCNOFile.appendSuffix(".gcno"); + + sys::Path GCDAFile(SrcFile); + GCDAFile.eraseSuffix(); + GCDAFile.appendSuffix(".gcda"); + + sys::Path OutputFile(SrcFile); + OutputFile.appendSuffix(".gcov"); + GCOVFile GF; if (InputGCNO.empty()) errs() << " " << argv[0] << ": No gcov input file!\n"; -- cgit v1.2.3