[all-commits] [llvm/llvm-project] 0a088e: Improve diagnostics for missing import / #include ...

Richard Smith via All-commits all-commits at lists.llvm.org
Tue Apr 28 18:41:43 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 0a088ead85fae11bb41d8a93ebe213db5554f087
      https://github.com/llvm/llvm-project/commit/0a088ead85fae11bb41d8a93ebe213db5554f087
  Author: Richard Smith <richard at metafoo.co.uk>
  Date:   2020-04-28 (Tue, 28 Apr 2020)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/include/clang/Lex/HeaderSearch.h
    M clang/include/clang/Lex/ModuleMap.h
    M clang/include/clang/Lex/Preprocessor.h
    M clang/lib/Lex/HeaderSearch.cpp
    M clang/lib/Lex/ModuleMap.cpp
    M clang/lib/Lex/PPDirectives.cpp
    M clang/lib/Sema/SemaLookup.cpp
    M clang/lib/Serialization/ASTWriter.cpp
    M clang/test/CXX/basic/basic.scope/basic.scope.namespace/p2.cpp
    M clang/test/CXX/module/module.unit/p8.cpp
    M clang/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.import/p1.cpp
    M clang/test/Modules/auto-module-import.m
    M clang/test/Modules/cxx-templates.cpp
    M clang/test/Modules/decldef.m
    M clang/test/Modules/decldef.mm
    M clang/test/Modules/diagnose-missing-import.m
    M clang/test/Modules/interface-diagnose-missing-import.m
    M clang/test/Modules/ms-enums.cpp
    M clang/test/Modules/no-module-map.cpp
    M clang/test/Modules/normal-module-map.cpp
    M clang/test/Modules/stddef.c
    M clang/test/Modules/subframeworks.m
    M clang/test/Modules/submodule-visibility-cycles.cpp
    M clang/test/Modules/submodule-visibility.cpp
    M clang/test/Modules/submodules-merge-defs.cpp
    M clang/test/Modules/submodules.cpp
    M clang/test/Modules/suggest-include.cpp
    M clang/test/Modules/tag-injection.c
    M clang/test/Modules/tag-injection.cpp
    M clang/test/Modules/template-default-args.cpp
    M clang/test/Modules/undefined-type-fixit1.cpp
    M clang/test/Modules/visibility-in-instantiation.cpp
    M clang/test/SemaCXX/compare-modules-cxx2a.cpp
    M clang/test/SemaCXX/modules-ts.cppm
    M clang/tools/libclang/Indexing.cpp

  Log Message:
  -----------
  Improve diagnostics for missing import / #include of module.

Fix a few bugs where we would fail to properly determine header to
module correspondence when determining whether to suggest a #include or
import, and suggest a #include more often in language modes where there
is no import syntax. Generally, if the target is in a header with
include guards or #pragma once, we should suggest either #including or
importing that header, and not importing a module that happens to
textually include it.

In passing, improve the notes we attach to the corresponding
diagnostics: calling an entity that we couldn't see "previous" is
confusing.




More information about the All-commits mailing list