зеркало из https://github.com/microsoft/clang-1.git
Preserve the full name of the file, so that '-c -o foo.pic.o' produces
foo.pic.gcno instead of foo.gcno. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130899 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
c159870001
Коммит
3dc0541853
|
@ -140,9 +140,9 @@ def femit_coverage_notes : Flag<"-femit-coverage-notes">,
|
|||
HelpText<"Emit a gcov coverage notes file when compiling.">;
|
||||
def femit_coverage_data: Flag<"-femit-coverage-data">,
|
||||
HelpText<"Instrument the program to emit gcov coverage data when run.">;
|
||||
def coverage_dir : Separate<"-coverage-dir">,
|
||||
HelpText<"Emit coverage data to this directory.">;
|
||||
def coverage_dir_EQ : Joined<"-coverage-dir=">, Alias<coverage_dir>;
|
||||
def coverage_file : Separate<"-coverage-file">,
|
||||
HelpText<"Emit coverage data to this filename. The extension will be replaced.">;
|
||||
def coverage_file_EQ : Joined<"-coverage-file=">, Alias<coverage_file>;
|
||||
def relaxed_aliasing : Flag<"-relaxed-aliasing">,
|
||||
HelpText<"Turn off Type Based Alias Analysis">;
|
||||
def masm_verbose : Flag<"-masm-verbose">,
|
||||
|
|
|
@ -95,8 +95,9 @@ public:
|
|||
/// The code model to use (-mcmodel).
|
||||
std::string CodeModel;
|
||||
|
||||
/// The directory in which to place coverage data files.
|
||||
std::string CoverageDir;
|
||||
/// The filename with path we use for coverage files. The extension will be
|
||||
/// replaced.
|
||||
std::string CoverageFile;
|
||||
|
||||
/// Enable additional debugging information.
|
||||
std::string DebugPass;
|
||||
|
|
|
@ -134,7 +134,7 @@ void CodeGenModule::Release() {
|
|||
EmitDeclMetadata();
|
||||
|
||||
if (getCodeGenOpts().EmitGcovArcs || getCodeGenOpts().EmitGcovNotes)
|
||||
EmitCoverageDir();
|
||||
EmitCoverageFile();
|
||||
}
|
||||
|
||||
void CodeGenModule::UpdateCompletedType(const TagDecl *TD) {
|
||||
|
@ -2219,16 +2219,16 @@ void CodeGenFunction::EmitDeclMetadata() {
|
|||
}
|
||||
}
|
||||
|
||||
void CodeGenModule::EmitCoverageDir() {
|
||||
if (!getCodeGenOpts().CoverageDir.empty()) {
|
||||
void CodeGenModule::EmitCoverageFile() {
|
||||
if (!getCodeGenOpts().CoverageFile.empty()) {
|
||||
if (llvm::NamedMDNode *CUNode = TheModule.getNamedMetadata("llvm.dbg.cu")) {
|
||||
llvm::NamedMDNode *GCov = TheModule.getOrInsertNamedMetadata("llvm.gcov");
|
||||
llvm::LLVMContext &Ctx = TheModule.getContext();
|
||||
llvm::MDString *CoverageDir =
|
||||
llvm::MDString::get(Ctx, getCodeGenOpts().CoverageDir);
|
||||
llvm::MDString *CoverageFile =
|
||||
llvm::MDString::get(Ctx, getCodeGenOpts().CoverageFile);
|
||||
for (int i = 0, e = CUNode->getNumOperands(); i != e; ++i) {
|
||||
llvm::MDNode *CU = CUNode->getOperand(i);
|
||||
llvm::Value *node[] = { CoverageDir, CU };
|
||||
llvm::Value *node[] = { CoverageFile, CU };
|
||||
llvm::MDNode *N = llvm::MDNode::get(Ctx, node);
|
||||
GCov->addOperand(N);
|
||||
}
|
||||
|
|
|
@ -735,9 +735,9 @@ private:
|
|||
|
||||
void EmitDeclMetadata();
|
||||
|
||||
/// EmitCoverageDir - Emit the llvm.gcov metadata used to tell LLVM where
|
||||
/// EmitCoverageFile - Emit the llvm.gcov metadata used to tell LLVM where
|
||||
/// to emit the .gcno and .gcda files in a way that persists in .bc files.
|
||||
void EmitCoverageDir();
|
||||
void EmitCoverageFile();
|
||||
|
||||
/// MayDeferGeneration - Determine if the given decl can be emitted
|
||||
/// lazily; this is only relevant for definitions. The given decl
|
||||
|
|
|
@ -1306,12 +1306,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
if (C.getArgs().hasArg(options::OPT_c) ||
|
||||
C.getArgs().hasArg(options::OPT_S)) {
|
||||
if (Output.isFilename()) {
|
||||
llvm::StringRef CoverageDir =
|
||||
llvm::sys::path::parent_path(Output.getFilename());
|
||||
if (!CoverageDir.empty()) {
|
||||
CmdArgs.push_back("-coverage-dir");
|
||||
CmdArgs.push_back(Args.MakeArgString(CoverageDir));
|
||||
}
|
||||
CmdArgs.push_back("-coverage-file");
|
||||
CmdArgs.push_back(Args.MakeArgString(Output.getFilename()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -974,7 +974,7 @@ static void ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
|
|||
Opts.InstrumentForProfiling = Args.hasArg(OPT_pg);
|
||||
Opts.EmitGcovArcs = Args.hasArg(OPT_femit_coverage_data);
|
||||
Opts.EmitGcovNotes = Args.hasArg(OPT_femit_coverage_notes);
|
||||
Opts.CoverageDir = Args.getLastArgValue(OPT_coverage_dir);
|
||||
Opts.CoverageFile = Args.getLastArgValue(OPT_coverage_file);
|
||||
|
||||
if (Arg *A = Args.getLastArg(OPT_fobjc_dispatch_method_EQ)) {
|
||||
llvm::StringRef Name = A->getValue(Args);
|
||||
|
|
Загрузка…
Ссылка в новой задаче