Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -387,6 +387,16 @@ if (llvm::sys::fs::exists(P)) { FoundPCH = UsePCH; FoundPTH = !UsePCH; + } else { + for (const Arg *A : Args.filtered(options::OPT_I_Group)) { + SmallString<128> Path(A->getValue()); + llvm::sys::path::append(Path, P); + if (llvm::sys::fs::exists(Path)) { + P = Path; + FoundPCH = UsePCH; + FoundPTH = !UsePCH; + } + } } } Index: test/PCH/additional-include.h =================================================================== --- /dev/null +++ test/PCH/additional-include.h @@ -0,0 +1,2 @@ + +extern int i; Index: test/PCH/additional-include.cpp =================================================================== --- /dev/null +++ test/PCH/additional-include.cpp @@ -0,0 +1,9 @@ +// RUN: mkdir -p %t.h.gch +// RUN: %clang -x c++-header %S/additional-include.h -o %t.h.gch/additional-include.h.gch +// RUN: %clang -x c++ -include additional-include.h -I %t.h.gch -fsyntax-only %s -Xclang -print-stats 2> %t.log +// RUN: FileCheck %s < %t.log + +int foo() { + // CHECK: .h.gch{{[/\\]}}additional-include.h.gch + return i; +}