Skip to content

Commit

Permalink
Add support for subdirectories in input names
Browse files Browse the repository at this point in the history
Comgr's amd_comgr_set_data_name() currently has no stated
restrictions on provided names. However, previously names
with a "/" would generate a file-not-found error when set
as an output file name for clang-driver commands due to
missing subdirectories.

In this patch we update Comgr to generate these
subdirectories before executing clang-driver commands.

Change-Id: I39414ad8c336f196f94974dd13c025e4e7963e64
  • Loading branch information
lamb-j committed Nov 15, 2022
1 parent 2575f62 commit 8cdb30e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/comgr/src/comgr-compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,14 @@ static bool executeAssembler(AssemblerInvocation &Opts,
static SmallString<128> getFilePath(DataObject *Object, StringRef Dir) {
SmallString<128> Path(Dir);
path::append(Path, Object->Name);

// Create directories specified in the File Path so that the in-process driver
// can successfully execute clang commands that use this file path as an
// output argument
if (fs::create_directories(path::parent_path(Path))) {
return SmallString<128>();
}

return Path;
}

Expand Down

0 comments on commit 8cdb30e

Please sign in to comment.