Index: lib/Lex/PPDirectives.cpp =================================================================== --- lib/Lex/PPDirectives.cpp +++ lib/Lex/PPDirectives.cpp @@ -1887,8 +1887,8 @@ // Check for likely typos due to leading or trailing non-isAlphanumeric // characters + StringRef OriginalFilename = Filename; if (!File) { - StringRef OriginalFilename = Filename; while (!isAlphanumeric(Filename.front())) { Filename = Filename.drop_front(); } @@ -1915,7 +1915,7 @@ // If the file is still not found, just go with the vanilla diagnostic if (!File) - Diag(FilenameTok, diag::err_pp_file_not_found) << Filename + Diag(FilenameTok, diag::err_pp_file_not_found) << OriginalFilename << FilenameRange; } } Index: test/Preprocessor/include-leading-nonalpha-no-suggest.c =================================================================== --- /dev/null +++ test/Preprocessor/include-leading-nonalpha-no-suggest.c @@ -0,0 +1,3 @@ +// RUN: %clang_cc1 %s -verify + +#include "/non_existing_file_to_include.h" // expected-error {{'/non_existing_file_to_include.h' file not found}} Index: test/Preprocessor/include-leading-nonalpha-suggest.c =================================================================== --- /dev/null +++ test/Preprocessor/include-leading-nonalpha-suggest.c @@ -0,0 +1,3 @@ +// RUN: %clang_cc1 %s -verify + +#include "/empty_file_to_include.h" // expected-error {{'/empty_file_to_include.h' file not found, did you mean 'empty_file_to_include.h'?}}