Skip to content

Commit

Permalink
[Extractor] Add quiet option to offload extractor (#15386)
Browse files Browse the repository at this point in the history
Add a "q" flag for clang-offload-extract that supresses printing. For
use in cmake or script files that don't want to display the generated
files.
  • Loading branch information
RossBrunton authored Sep 16, 2024
1 parent db75b03 commit fb94e86
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions clang/tools/clang-offload-extract/ClangOffloadExtract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ to the stem:
)"),
cl::cat(ClangOffloadExtractCategory));

static cl::opt<bool>
Quiet("q", cl::init(false),
cl::desc(R"(Do not print the names of generated files)"),
cl::cat(ClangOffloadExtractCategory));

// Create an alias for the deprecated option, so legacy use still works
static cl::alias FileNameStemAlias(
"output", cl::desc("Deprecated option, replaced by option '--stem'"),
Expand Down Expand Up @@ -262,8 +267,10 @@ linked fat binary, and store them in separate files.
OffloadName.erase(0, OffloadPrefix.length());

// Tell user that we are saving an image.
outs() << "Section '" + OffloadName + "': Image " << ImgCnt++
<< "'-> File '" + FileName + "'\n";
if (!Quiet) {
outs() << "Section '" + OffloadName + "': Image " << ImgCnt++
<< "'-> File '" + FileName + "'\n";
}

// Write image data to the output
std::error_code EC;
Expand Down

0 comments on commit fb94e86

Please sign in to comment.