ckandeler updated this revision to Diff 385453. ckandeler added a comment. Addressed formatting comments.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D112996/new/ https://reviews.llvm.org/D112996 Files: clang/lib/Sema/SemaCodeComplete.cpp Index: clang/lib/Sema/SemaCodeComplete.cpp =================================================================== --- clang/lib/Sema/SemaCodeComplete.cpp +++ clang/lib/Sema/SemaCodeComplete.cpp @@ -9613,6 +9613,10 @@ } } + const StringRef &Dirname = llvm::sys::path::filename(Dir); + const bool isQt = Dirname.startswith("Qt") || Dirname == "ActiveQt"; + const bool ExtensionlessHeaders = + IsSystem || isQt || Dir.endswith(".framework/Headers"); std::error_code EC; unsigned Count = 0; for (auto It = FS.dir_begin(Dir, EC); @@ -9639,18 +9643,19 @@ AddCompletion(Filename, /*IsDirectory=*/true); break; - case llvm::sys::fs::file_type::regular_file: - // Only files that really look like headers. (Except in system dirs). - if (!IsSystem) { - // Header extensions from Types.def, which we can't depend on here. - if (!(Filename.endswith_insensitive(".h") || - Filename.endswith_insensitive(".hh") || - Filename.endswith_insensitive(".hpp") || - Filename.endswith_insensitive(".inc"))) - break; - } + case llvm::sys::fs::file_type::regular_file: { + // Only files that really look like headers. (Except in special dirs). + // Header extensions from Types.def, which we can't depend on here. + const bool IsHeader = Filename.endswith_insensitive(".h") || + Filename.endswith_insensitive(".hh") || + Filename.endswith_insensitive(".hpp") || + Filename.endswith_insensitive(".inc") || + (ExtensionlessHeaders && !Filename.contains('.')); + if (!IsHeader) + break; AddCompletion(Filename, /*IsDirectory=*/false); break; + } default: break; }
Index: clang/lib/Sema/SemaCodeComplete.cpp =================================================================== --- clang/lib/Sema/SemaCodeComplete.cpp +++ clang/lib/Sema/SemaCodeComplete.cpp @@ -9613,6 +9613,10 @@ } } + const StringRef &Dirname = llvm::sys::path::filename(Dir); + const bool isQt = Dirname.startswith("Qt") || Dirname == "ActiveQt"; + const bool ExtensionlessHeaders = + IsSystem || isQt || Dir.endswith(".framework/Headers"); std::error_code EC; unsigned Count = 0; for (auto It = FS.dir_begin(Dir, EC); @@ -9639,18 +9643,19 @@ AddCompletion(Filename, /*IsDirectory=*/true); break; - case llvm::sys::fs::file_type::regular_file: - // Only files that really look like headers. (Except in system dirs). - if (!IsSystem) { - // Header extensions from Types.def, which we can't depend on here. - if (!(Filename.endswith_insensitive(".h") || - Filename.endswith_insensitive(".hh") || - Filename.endswith_insensitive(".hpp") || - Filename.endswith_insensitive(".inc"))) - break; - } + case llvm::sys::fs::file_type::regular_file: { + // Only files that really look like headers. (Except in special dirs). + // Header extensions from Types.def, which we can't depend on here. + const bool IsHeader = Filename.endswith_insensitive(".h") || + Filename.endswith_insensitive(".hh") || + Filename.endswith_insensitive(".hpp") || + Filename.endswith_insensitive(".inc") || + (ExtensionlessHeaders && !Filename.contains('.')); + if (!IsHeader) + break; AddCompletion(Filename, /*IsDirectory=*/false); break; + } default: break; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits