forked from OSchip/llvm-project
Make -Wnullability-completeness work with -Wsystem-headers.
rdar://problem/21134250 llvm-svn: 240187
This commit is contained in:
parent
9960a8638d
commit
227fe4bc03
|
@ -2791,9 +2791,12 @@ static FileID getNullabilityCompletenessCheckFileID(Sema &S,
|
|||
// We don't want to perform completeness checks on the main file or in
|
||||
// system headers.
|
||||
const SrcMgr::FileInfo &fileInfo = sloc.getFile();
|
||||
if (fileInfo.getIncludeLoc().isInvalid() ||
|
||||
fileInfo.getFileCharacteristic() != SrcMgr::C_User)
|
||||
if (fileInfo.getIncludeLoc().isInvalid())
|
||||
return FileID();
|
||||
if (fileInfo.getFileCharacteristic() != SrcMgr::C_User &&
|
||||
S.Diags.getSuppressSystemWarnings()) {
|
||||
return FileID();
|
||||
}
|
||||
|
||||
return file;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
// Simply marking this as "#pragma clang system_header" didn't tickle the bug, rdar://problem/21134250.
|
||||
|
||||
void system1(int *ptr);
|
||||
#if WARN_IN_SYSTEM_HEADERS
|
||||
// expected-warning@-2{{pointer is missing a nullability type specifier}}
|
||||
#endif
|
||||
|
||||
void system2(int * __nonnull);
|
|
@ -1,4 +1,5 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -fblocks -I %S/Inputs %s -verify
|
||||
// RUN: %clang_cc1 -fsyntax-only -fblocks -I %S/Inputs -isystem %S/Inputs/nullability-consistency-system %s -verify
|
||||
// RUN: %clang_cc1 -fsyntax-only -fblocks -I %S/Inputs -isystem %S/Inputs/nullability-consistency-system %s -Wsystem-headers -DWARN_IN_SYSTEM_HEADERS -verify
|
||||
|
||||
#include "nullability-consistency-1.h"
|
||||
#include "nullability-consistency-3.h"
|
||||
|
@ -8,6 +9,7 @@
|
|||
#include "nullability-consistency-6.h"
|
||||
#include "nullability-consistency-7.h"
|
||||
#include "nullability-consistency-8.h"
|
||||
#include "nullability-consistency-system.h"
|
||||
|
||||
void h1(int *ptr) { } // don't warn
|
||||
|
||||
|
|
Loading…
Reference in New Issue