File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -921,6 +921,9 @@ void HeaderSearch::DiagnoseHeaderShadowing(
921921 It = FromDir;
922922 }
923923 for (; It != search_dir_end (); ++It) {
924+ // Suppress check for system headers, as duplicates are often intentional.
925+ if (It->getDirCharacteristic () != SrcMgr::C_User)
926+ continue ;
924927 SmallString<1024 > TmpPath = It->getName ();
925928 llvm::sys::path::append (TmpPath, Filename);
926929 if (auto File = getFileMgr ().getFileRef (TmpPath, false , false )) {
Original file line number Diff line number Diff line change 1010
1111// SHADOWING: {{.*}} warning: multiple candidates for header 'header.h' found; directory '{{.*}}include1' chosen, ignoring '{{.*}}include2' and others [-Wshadow-header]
1212// SHADOWING: warning: include1/header.h included!
13- // SHADOWING: warning: include2/header.h included!
14- // SHADOWING: warning: system1/stdio.h included!
1513// SHADOWING-NOT: {{.*}} warning: multiple candidates for header 'header.h' found; directory '{{.*}}include2' chosen, ignoring '{{.*}}include1' and others [-Wshadow-header]
14+ // SHADOWING: warning: include2/header.h included!
1615// SHADOWING-NOT: {{.*}} warning: multiple candidates for header 'stdio.h' found; directory '{{.*}}system1' chosen, ignoring '{{.*}}system2' and others [-Wshadow-header]
16+ // SHADOWING: warning: system1/stdio.h included!
1717
1818/// Check that the diagnostic is only performed once in MSVC compatibility mode.
1919// RUN: %clang_cc1 -fms-compatibility -Wshadow-header -Eonly %t/t.c -I %t -I %t/foo -I %t/foo/bar 2>&1 | FileCheck %s --check-prefix=SHADOWING-MS
You can’t perform that action at this time.
0 commit comments