From 421380a108167a27db2a93e8e6ae40cb44a9c3fd Mon Sep 17 00:00:00 2001 From: Volodymyr Sapsai Date: Tue, 5 Feb 2019 22:34:55 +0000 Subject: [Preprocessor] Add a note with framework location for "file not found" error. When a framework with the same name is available at multiple framework search paths, we use the first matching location. If a framework at this location doesn't have all the headers, it can be confusing for developers because they see only an error `'Foo/Foo.h' file not found`, can find the complete framework with required header, and don't know the incomplete framework was used instead. Add a note explaining a framework without required header was found. Also mention framework directory path to make it easier to find the incomplete framework. rdar://problem/39246514 Reviewers: arphaman, erik.pilkington, jkorous Reviewed By: jkorous Subscribers: jkorous, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D56561 llvm-svn: 353231 --- .../Preprocessor/include-header-missing-in-framework.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 clang/test/Preprocessor/include-header-missing-in-framework.c (limited to 'clang/test/Preprocessor/include-header-missing-in-framework.c') diff --git a/clang/test/Preprocessor/include-header-missing-in-framework.c b/clang/test/Preprocessor/include-header-missing-in-framework.c new file mode 100644 index 00000000000..cb09326a428 --- /dev/null +++ b/clang/test/Preprocessor/include-header-missing-in-framework.c @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -fsyntax-only -F %S/Inputs -verify %s +// RUN: %clang_cc1 -fsyntax-only -F %S/Inputs -DTYPO_CORRECTION -verify %s + +// After finding a requested framework, we don't look for the same framework in +// a different location even if requested header is not found in the framework. +// It can be confusing when there is a framework with required header later in +// header search paths. Mention in diagnostics where the header lookup stopped. + +#ifndef TYPO_CORRECTION +#include +// expected-error@-1 {{'TestFramework/NotExistingHeader.h' file not found}} +// expected-note@-2 {{did not find header 'NotExistingHeader.h' in framework 'TestFramework' (loaded from}} + +#else +// Don't emit extra note for unsuccessfully typo-corrected include. +#include <#TestFramework/NotExistingHeader.h> +// expected-error@-1 {{'#TestFramework/NotExistingHeader.h' file not found}} +#endif // TYPO_CORRECTION -- cgit v1.2.3