Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

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 5d4ccd3 commit be624c6
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 @@ -531,6 +531,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 be624c6

Please sign in to comment.