@@ -35,7 +35,7 @@ def merge_raw_profiles(host_llvm_profdata, profile_data_dir, preserve_profiles):
35
35
return profdata_path
36
36
37
37
def prepare_html_report (host_llvm_cov , profile , report_dir , binaries ,
38
- restricted_dirs ):
38
+ restricted_dirs , compilation_dir ):
39
39
print (':: Preparing html report for {0}...' .format (binaries ), end = '' )
40
40
sys .stdout .flush ()
41
41
objects = []
@@ -48,6 +48,8 @@ def prepare_html_report(host_llvm_cov, profile, report_dir, binaries,
48
48
'-instr-profile' , profile , '-o' , report_dir ,
49
49
'-show-line-counts-or-regions' , '-Xdemangler' , 'c++filt' ,
50
50
'-Xdemangler' , '-n' ] + restricted_dirs
51
+ if compilation_dir :
52
+ invocation += ['-compilation-dir=' + compilation_dir ]
51
53
subprocess .check_call (invocation )
52
54
with open (os .path .join (report_dir , 'summary.txt' ), 'wb' ) as Summary :
53
55
subprocess .check_call ([host_llvm_cov , 'report' ] + objects +
@@ -56,16 +58,16 @@ def prepare_html_report(host_llvm_cov, profile, report_dir, binaries,
56
58
print ('Done!' )
57
59
58
60
def prepare_html_reports (host_llvm_cov , profdata_path , report_dir , binaries ,
59
- unified_report , restricted_dirs ):
61
+ unified_report , restricted_dirs , compilation_dir ):
60
62
if unified_report :
61
63
prepare_html_report (host_llvm_cov , profdata_path , report_dir , binaries ,
62
- restricted_dirs )
64
+ restricted_dirs , compilation_dir )
63
65
else :
64
66
for binary in binaries :
65
67
binary_report_dir = os .path .join (report_dir ,
66
68
os .path .basename (binary ))
67
69
prepare_html_report (host_llvm_cov , profdata_path , binary_report_dir ,
68
- [binary ], restricted_dirs )
70
+ [binary ], restricted_dirs , compilation_dir )
69
71
70
72
if __name__ == '__main__' :
71
73
parser = argparse .ArgumentParser (description = __doc__ )
@@ -90,6 +92,8 @@ def prepare_html_reports(host_llvm_cov, profdata_path, report_dir, binaries,
90
92
default = [],
91
93
help = 'Restrict the reporting to the given source paths'
92
94
' (must be specified after all other positional arguments)' )
95
+ parser .add_argument ('-C' , '--compilation-dir' , type = str , default = "" ,
96
+ help = 'The compilation directory of the binary' )
93
97
args = parser .parse_args ()
94
98
95
99
if args .use_existing_profdata and args .only_merge :
@@ -109,4 +113,5 @@ def prepare_html_reports(host_llvm_cov, profdata_path, report_dir, binaries,
109
113
110
114
if not args .only_merge :
111
115
prepare_html_reports (args .host_llvm_cov , profdata_path , args .report_dir ,
112
- args .binaries , args .unified_report , args .restrict )
116
+ args .binaries , args .unified_report , args .restrict ,
117
+ args .compilation_dir )
0 commit comments