The issue was introduced in D135801. When there are only header maps in the SearchDirs, the out of bounds value is assigned to FirstNonHeaderMapSearchDirIdx. Test Plan: check-clang Differential Revision: https://reviews.llvm.org/D146156