-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Factor out fuzzing disablement in the driver (#5048)
We end up needing to do this in any driver subcommand that reaches into external code that may not be fully fuzz-clean. No need to grow multiple different diagnostics for each, we can use a common diagnostic.
- Loading branch information
Showing
8 changed files
with
44 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM | ||
// Exceptions. See /LICENSE for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
#include "toolchain/driver/driver_subcommand.h" | ||
|
||
#include "llvm/TargetParser/Host.h" | ||
#include "llvm/TargetParser/Triple.h" | ||
#include "toolchain/driver/lld_runner.h" | ||
|
||
namespace Carbon { | ||
|
||
auto DriverSubcommand::DisableFuzzingExternalLibraries(DriverEnv& driver_env, | ||
llvm::StringRef name) | ||
-> bool { | ||
// Only need to do anything when fuzzing. | ||
if (!driver_env.fuzzing) { | ||
return true; | ||
} | ||
|
||
CARBON_DIAGNOSTIC( | ||
ToolFuzzingDisallowed, Error, | ||
"preventing fuzzing of `{0}` subcommand due to external library", | ||
std::string); | ||
driver_env.emitter.Emit(ToolFuzzingDisallowed, name.str()); | ||
return false; | ||
} | ||
|
||
} // namespace Carbon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters