llvm::StringMap<unsigned, llvm::BumpPtrAllocator> Index(SearchDirs.size());
// Iterate over all filename keys and associate them with the index i.
- unsigned i = 0;
- for (; i != SearchDirs.size(); ++i) {
+ for (unsigned i = 0; i != SearchDirs.size(); ++i) {
auto &Dir = SearchDirs[i];
// We're concerned with only the initial contiguous run of header
// maps within SearchDirs, which can be 99% of SearchDirs when
// SearchDirs.size() is ~10000.
- if (!Dir.isHeaderMap())
+ if (!Dir.isHeaderMap()) {
+ SearchDirHeaderMapIndex = std::move(Index);
+ FirstNonHeaderMapSearchDirIdx = i;
break;
+ }
// Give earlier keys precedence over identical later keys.
auto Callback = [&](StringRef Filename) {
};
Dir.getHeaderMap()->forEachKey(Callback);
}
-
- SearchDirHeaderMapIndex = std::move(Index);
- FirstNonHeaderMapSearchDirIdx = i;
}
//===----------------------------------------------------------------------===//
llvm::StringRef File, llvm::StringRef WorkingDir, llvm::StringRef MainFile,
bool *IsSystem) {
using namespace llvm::sys;
-
+
llvm::SmallString<32> FilePath = File;
// remove_dots switches to backslashes on windows as a side-effect!
// We always want to suggest forward slashes for includes.
--- /dev/null
+// RUN: rm -rf %t && mkdir %t
+// RUN: %hmaptool write %S/Inputs/header-search-crash/foo.hmap.json %t/foo.hmap
+// RUN: %clang -cc1 -E %s -I %t/foo.hmap -verify
+
+#include "MissingHeader.h" // expected-error {{'MissingHeader.h' file not found}}