diff options
author | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2017-05-23 23:53:17 +0000 |
---|---|---|
committer | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2017-05-23 23:53:17 +0000 |
commit | ed367df541e9827f07e6c6fdef6b61ef3b491d4b (patch) | |
tree | 62c90bd6f479105478f7bb8eecfdcba2b4177937 /test/Modules | |
parent | 9b792b1316cc1cd30915605974aa50e537b1f1d0 (diff) |
[Modules] Fix overly conservative assertion for import diagnostic
We currenltly assert when want to diagnose a missing import and the decl
in question is already visible. It turns out that the decl in question
might be visible because another decl from the same module actually made
the module visible in a previous error diagnostic.
Remove the assertion and avoid re-exporting the module if it's already
visible.
rdar://problem/27975402
Differential Revision: https://reviews.llvm.org/D32828
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303705 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Modules')
-rw-r--r-- | test/Modules/Inputs/diagnose-missing-import/a.h | 8 | ||||
-rw-r--r-- | test/Modules/Inputs/diagnose-missing-import/module.modulemap | 3 | ||||
-rw-r--r-- | test/Modules/diagnose-missing-import.m | 14 |
3 files changed, 25 insertions, 0 deletions
diff --git a/test/Modules/Inputs/diagnose-missing-import/a.h b/test/Modules/Inputs/diagnose-missing-import/a.h new file mode 100644 index 0000000000..2121e968b3 --- /dev/null +++ b/test/Modules/Inputs/diagnose-missing-import/a.h @@ -0,0 +1,8 @@ +#ifndef A_h +#define A_h + +@class NSString; +static NSString * const xyzRiskyCloseOpenParam = @"riskyCloseParam"; +static inline void XYZLogEvent(NSString* eventName, NSString* params); + +#endif diff --git a/test/Modules/Inputs/diagnose-missing-import/module.modulemap b/test/Modules/Inputs/diagnose-missing-import/module.modulemap new file mode 100644 index 0000000000..690501e1ed --- /dev/null +++ b/test/Modules/Inputs/diagnose-missing-import/module.modulemap @@ -0,0 +1,3 @@ +module NCI { + explicit module A { header "a.h" } +} diff --git a/test/Modules/diagnose-missing-import.m b/test/Modules/diagnose-missing-import.m new file mode 100644 index 0000000000..e0c0457e63 --- /dev/null +++ b/test/Modules/diagnose-missing-import.m @@ -0,0 +1,14 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/diagnose-missing-import \ +// RUN: -Werror=implicit-function-declaration -fsyntax-only \ +// RUN: -fimplicit-module-maps -verify %s +@import NCI; + +void foo() { + XYZLogEvent(xyzRiskyCloseOpenParam, xyzRiskyCloseOpenParam); // expected-error {{implicit declaration of function 'XYZLogEvent'}} expected-error {{declaration of 'XYZLogEvent' must be imported}} expected-error {{declaration of 'xyzRiskyCloseOpenParam' must be imported from module 'NCI.A'}} expected-error {{declaration of 'xyzRiskyCloseOpenParam' must be imported from module 'NCI.A'}} +} + +// expected-note@Inputs/diagnose-missing-import/a.h:5 {{previous declaration is here}} +// expected-note@Inputs/diagnose-missing-import/a.h:5 {{previous declaration is here}} +// expected-note@Inputs/diagnose-missing-import/a.h:6 {{previous declaration is here}} + |