Added coverage check for extensionless headers, and exclude hidden dot directoryies.

llvm-svn: 254785
This commit is contained in:
John Thompson 2015-12-04 22:42:18 +00:00
parent 9e48cda9bc
commit b3eef01eda
5 changed files with 13 additions and 2 deletions

View File

@ -370,12 +370,18 @@ bool CoverageChecker::collectFileSystemHeaders(StringRef IncludePath) {
I.increment(EC)) {
if (EC)
return false;
std::string file(I->path());
//std::string file(I->path());
StringRef file(I->path());
I->status(Status);
sys::fs::file_type type = Status.type();
// If the file is a directory, ignore the name (but still recurses).
if (type == sys::fs::file_type::directory_file)
continue;
// Assume directories or files starting with '.' are private and not to
// be considered.
if (file.startswith(".") || (file.find("\\.") != StringRef::npos)
|| (file.find("/.") != StringRef::npos))
continue;
// If the file does not have a common header extension, ignore it.
if (!ModularizeUtilities::isHeader(file))
continue;

View File

@ -468,7 +468,7 @@ std::string ModularizeUtilities::getCanonicalPath(StringRef FilePath) {
bool ModularizeUtilities::isHeader(StringRef FileName) {
StringRef Extension = llvm::sys::path::extension(FileName);
if (Extension.size() == 0)
return false;
return true;
if (Extension.equals_lower(".h"))
return true;
if (Extension.equals_lower(".inc"))

View File

@ -0,0 +1,3 @@
#error DontFindMe.h shouldn't be found.

View File

@ -0,0 +1 @@
#define MACRO_3B 1

View File

@ -1,4 +1,5 @@
# RUN: not modularize %S/Inputs/CoverageProblems/module.modulemap 2>&1 | FileCheck %s
# CHECK: warning: {{.*}}{{[/\\]}}Inputs/CoverageProblems/module.modulemap does not account for file: {{.*}}{{[/\\]}}Inputs/CoverageProblems/Level3A.h
# CHECK-NEXT: warning: {{.*}}{{[/\\]}}Inputs/CoverageProblems/module.modulemap does not account for file: {{.*}}{{[/\\]}}Inputs/CoverageProblems/Level3B
# CHECK-NEXT: warning: {{.*}}{{[/\\]}}Inputs/CoverageProblems/module.modulemap does not account for file: {{.*}}{{[/\\]}}Inputs/CoverageProblems/Sub/Level3B.h