@@ -232,20 +232,37 @@ void SYCL::fpga::BackendCompiler::ConstructJob(Compilation &C,
232
232
ForeachExt = " aocr" ;
233
233
}
234
234
235
+ StringRef createdReportName;
235
236
for (auto *A : Args) {
236
- // Any input file is assumed to have a dependency file associated
237
- if (A->getOption ().getKind () == Option::InputClass) {
238
- SmallString<128 > FN (A->getSpelling ());
239
- StringRef Ext (llvm::sys::path::extension (FN));
240
- if (!Ext.empty ()) {
241
- types::ID Ty = getToolChain ().LookupTypeForExtension (Ext.drop_front ());
242
- if (Ty == types::TY_INVALID)
243
- continue ;
244
- if (types::isSrcFile (Ty)) {
245
- llvm::sys::path::replace_extension (FN, " d" );
246
- FPGADepFiles.push_back (InputInfo (types::TY_Dependencies,
247
- Args.MakeArgString (FN), Args.MakeArgString (FN)));
248
- }
237
+ // Any input file is assumed to have a dependency file associated and
238
+ // the report folder can also be named based on the first input.
239
+ if (A->getOption ().getKind () != Option::InputClass)
240
+ continue ;
241
+ SmallString<128 > ArgName (A->getSpelling ());
242
+ StringRef Ext (llvm::sys::path::extension (ArgName));
243
+ if (Ext.empty ())
244
+ continue ;
245
+ types::ID Ty = getToolChain ().LookupTypeForExtension (Ext.drop_front ());
246
+ if (Ty == types::TY_INVALID)
247
+ continue ;
248
+ if (types::isSrcFile (Ty) || Ty == types::TY_Object) {
249
+ // Dependency files and the project report are created in CWD, so strip
250
+ // off any directory information if provided with the input file.
251
+ // TODO - Use temporary files for dependency file creation and
252
+ // usage with -fintelfpga.
253
+ ArgName = llvm::sys::path::filename (ArgName);
254
+ if (types::isSrcFile (Ty)) {
255
+ SmallString<128 > DepName (ArgName);
256
+ llvm::sys::path::replace_extension (DepName, " d" );
257
+ FPGADepFiles.push_back (InputInfo (types::TY_Dependencies,
258
+ Args.MakeArgString (DepName),
259
+ Args.MakeArgString (DepName)));
260
+ }
261
+ if (createdReportName.empty ()) {
262
+ // Project report should be saved into CWD, so strip off any
263
+ // directory information if provided with the input file.
264
+ llvm::sys::path::replace_extension (ArgName, " prj" );
265
+ createdReportName = Args.MakeArgString (ArgName);
249
266
}
250
267
}
251
268
}
@@ -270,26 +287,10 @@ void SYCL::fpga::BackendCompiler::ConstructJob(Compilation &C,
270
287
const char * FolderName = Args.MakeArgString (FN);
271
288
ReportOptArg += FolderName;
272
289
} else {
273
- // Output directory is based off of the first object name
274
- for (Arg * Cur : Args) {
275
- if (Cur->getOption ().getKind () != Option::InputClass)
276
- continue ;
277
- SmallString<128 > ArgName = Cur->getSpelling ();
278
- StringRef Ext (llvm::sys::path::extension (ArgName));
279
- if (Ext.empty ())
280
- continue ;
281
- types::ID Ty = getToolChain ().LookupTypeForExtension (Ext.drop_front ());
282
- if (Ty == types::TY_INVALID)
283
- continue ;
284
- if (types::isSrcFile (Ty) || Ty == types::TY_Object) {
285
- // Project report should be saved into CWD, so strip off any
286
- // directory information if provided with the input file.
287
- ArgName = llvm::sys::path::filename (ArgName);
288
- llvm::sys::path::replace_extension (ArgName, " prj" );
289
- ReportOptArg += Args.MakeArgString (ArgName);
290
- break ;
291
- }
292
- }
290
+ // Output directory is based off of the first object name as captured
291
+ // above.
292
+ if (!createdReportName.empty ())
293
+ ReportOptArg += createdReportName;
293
294
}
294
295
if (!ReportOptArg.empty ())
295
296
CmdArgs.push_back (C.getArgs ().MakeArgString (
0 commit comments