Skip to content

Commit c1794ed

Browse files
committed
[Driver] Address review comments, improved var names and arg checks
Signed-off-by: Michael D Toguchi <michael.d.toguchi@intel.com>
1 parent 1e3124c commit c1794ed

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -271,19 +271,20 @@ void SYCL::fpga::BackendCompiler::ConstructJob(Compilation &C,
271271
} else {
272272
// Output directory is based off of the first object name
273273
for (Arg * Cur : Args) {
274-
SmallString<128> AN = Cur->getSpelling();
275-
StringRef Ext(llvm::sys::path::extension(AN));
276-
if (!Ext.empty()) {
277-
types::ID Ty = getToolChain().LookupTypeForExtension(Ext.drop_front());
278-
if (Ty == types::TY_INVALID)
279-
continue;
280-
if (types::isSrcFile(Ty) || Ty == types::TY_Object) {
281-
// Output is based on the filename only so strip off any directory
282-
// information if provided with the source/object file.
283-
AN = llvm::sys::path::filename(AN);
284-
if (!AN.empty()) {
285-
llvm::sys::path::replace_extension(AN, "prj");
286-
ReportOptArg += Args.MakeArgString(AN);
274+
if (Cur->getOption().getKind() == Option::InputClass) {
275+
SmallString<128> ArgName = Cur->getSpelling();
276+
StringRef Ext(llvm::sys::path::extension(ArgName));
277+
if (!Ext.empty()) {
278+
types::ID Ty =
279+
getToolChain().LookupTypeForExtension(Ext.drop_front());
280+
if (Ty == types::TY_INVALID)
281+
continue;
282+
if (types::isSrcFile(Ty) || Ty == types::TY_Object) {
283+
// Project report should be saved into CWD, so strip off any
284+
// directory information if provided with the input file.
285+
ArgName = llvm::sys::path::filename(ArgName);
286+
llvm::sys::path::replace_extension(ArgName, "prj");
287+
ReportOptArg += Args.MakeArgString(ArgName);
287288
break;
288289
}
289290
}

0 commit comments

Comments
 (0)