llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Braden Helmer (bradenhelmer) <details> <summary>Changes</summary> Implements -Wmissing-include-dirs #<!-- -->92015 This is my first contribution and would love some feedback. Thanks --- Full diff: https://github.com/llvm/llvm-project/pull/94827.diff 3 Files Affected: - (modified) clang/include/clang/Basic/DiagnosticDriverKinds.td (+3) - (modified) clang/include/clang/Basic/DiagnosticGroups.td (+1-1) - (modified) clang/lib/Driver/Driver.cpp (+6) ``````````diff diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td index 773b234cd68fe..b7d50e22cc0d0 100644 --- a/clang/include/clang/Basic/DiagnosticDriverKinds.td +++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td @@ -809,4 +809,7 @@ def warn_android_unversioned_fallback : Warning< def err_drv_triple_version_invalid : Error< "version '%0' in target triple '%1' is invalid">; + +def warn_missing_include_dirs : Warning < + "the included directory %0 is missing">, InGroup<MissingIncludeDirs>; } diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td index 7d5ba7869ec34..9b37d4bd3205b 100644 --- a/clang/include/clang/Basic/DiagnosticGroups.td +++ b/clang/include/clang/Basic/DiagnosticGroups.td @@ -506,7 +506,7 @@ def MaxUnsignedZero : DiagGroup<"max-unsigned-zero">; def MissingBraces : DiagGroup<"missing-braces">; def MissingDeclarations: DiagGroup<"missing-declarations">; def : DiagGroup<"missing-format-attribute">; -def : DiagGroup<"missing-include-dirs">; +def MissingIncludeDirs : DiagGroup<"missing-include-dirs">; def MissingNoreturn : DiagGroup<"missing-noreturn">; def MultiChar : DiagGroup<"multichar">; def : DiagGroup<"nested-externs">; diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index f5ea73a04ae5c..5bc737a43338e 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -1271,6 +1271,12 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) { if (VFS->setCurrentWorkingDirectory(WD->getValue())) Diag(diag::err_drv_unable_to_set_working_directory) << WD->getValue(); + // Check for missing include directories + for (auto IncludeDir : Args.getAllArgValues(options::OPT_I_Group)) { + if (!llvm::sys::fs::is_directory(IncludeDir)) + Diag(diag::warn_missing_include_dirs) << IncludeDir; + } + // FIXME: This stuff needs to go into the Compilation, not the driver. bool CCCPrintPhases; `````````` </details> https://github.com/llvm/llvm-project/pull/94827 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits