mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +01:00
Allow repeated includes, particularly for min_prelude (#5741)
Make min_prelude parts include what they use, and remove the inclusions which were for indirect uses from the main min_prelude files.
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include "common/error.h"
|
||||
#include "common/find.h"
|
||||
#include "common/raw_string_ostream.h"
|
||||
#include "common/set.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/Support/JSON.h"
|
||||
#include "testing/base/file_helpers.h"
|
||||
@@ -835,8 +836,14 @@ auto ProcessTestFile(llvm::StringRef test_name, bool running_autoupdate)
|
||||
}
|
||||
|
||||
// Process includes. This can add entries to `include_files`.
|
||||
Set<std::string> processed_includes;
|
||||
for (size_t i = 0; i < include_files.size(); ++i) {
|
||||
const auto& filename = include_files[i];
|
||||
if (!processed_includes.Insert(filename).is_inserted()) {
|
||||
// Ignore repeated includes, mainly so that included files can include the
|
||||
// same file (i.e., repeated indirectly).
|
||||
continue;
|
||||
}
|
||||
CARBON_ASSIGN_OR_RETURN(std::string content, ReadFile(filename));
|
||||
// Note autoupdate never touches included files.
|
||||
CARBON_RETURN_IF_ERROR(ProcessFileContent(
|
||||
|
||||
Reference in New Issue
Block a user