mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Add a failing test for Clang modules support. (#7233)
Rearrange the file_test infrastructure so that we can customize the mapping of file names to command line arguments. Map `module.modulemap` files to corresponding Clang driver flags. In passing, also clean up the interface for specifying custom argument replacements so that we don't build a string map for each file we process, and stop using `SmallVector::insert`. Assisted-by: Gemini via Antigravity
This commit is contained in:
@@ -31,14 +31,25 @@ class FileTestBaseTest : public FileTestBase {
|
||||
llvm::raw_pwrite_stream& error_stream) const
|
||||
-> ErrorOr<RunResult> override;
|
||||
|
||||
auto GetArgReplacements() const -> llvm::StringMap<std::string> override {
|
||||
return {{"replacement", "replaced"}};
|
||||
}
|
||||
|
||||
auto GetDefaultArgs() const -> llvm::SmallVector<std::string> override {
|
||||
return {"default_args", "%s"};
|
||||
}
|
||||
|
||||
auto AddArgsForFilename(llvm::SmallVectorImpl<std::string>& args,
|
||||
llvm::StringRef filename) const -> void override {
|
||||
if (!filename.ends_with(".exclude")) {
|
||||
args.emplace_back(filename);
|
||||
}
|
||||
}
|
||||
|
||||
auto GetArgReplacement(llvm::StringRef key) const
|
||||
-> std::optional<std::string> override {
|
||||
if (key == "replacement") {
|
||||
return "replaced";
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
auto GetDefaultFileRE(llvm::ArrayRef<llvm::StringRef> filenames) const
|
||||
-> std::optional<RE2> override {
|
||||
return std::make_optional<RE2>(
|
||||
|
||||
Reference in New Issue
Block a user