
`HeaderSearch` currently assumes `LookupFileCache` is eventually populated in `LookupFile`. However, that's not always the case with `-fms-compatibility` and its early returns. This patch adds a defensive check that the iterator pulled out of the cache is actually valid before using it. (This bug was introduced in D119721. Before that, the cache was initialized to `0` - essentially the `search_dir_begin()` iterator.) Reviewed By: dexonsmith, erichkeane Differential Revision: https://reviews.llvm.org/D122237
23 lines
549 B
C
23 lines
549 B
C
// RUN: rm -rf %t
|
|
// RUN: split-file %s %t
|
|
|
|
// RUN: %clang_cc1 -Eonly -fms-compatibility %t/test.c -I %t/include -verify
|
|
|
|
//--- test.c
|
|
#include "x/header.h"
|
|
#include "z/header.h"
|
|
|
|
// expected-warning-re@include/y/header.h:1 {{#include resolved using non-portable Microsoft search rules as: {{.*}}x/culprit.h}}
|
|
// expected-error@include/z/header.h:1 {{'culprit.h' file not found}}
|
|
|
|
//--- include/x/header.h
|
|
#include "y/header.h"
|
|
|
|
//--- include/y/header.h
|
|
#include "culprit.h"
|
|
|
|
//--- include/x/culprit.h
|
|
|
|
//--- include/z/header.h
|
|
#include "culprit.h"
|