[all-commits] [llvm/llvm-project] 4d0cfa: [clang] Don't create import decls without -fmodules

kadir çetinkaya via All-commits all-commits at lists.llvm.org
Fri Jun 16 00:27:01 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4d0cfa6d09e2a84cceb669949d72df58c031a8c5
      https://github.com/llvm/llvm-project/commit/4d0cfa6d09e2a84cceb669949d72df58c031a8c5
  Author: Kadir Cetinkaya <kadircet at google.com>
  Date:   2023-06-16 (Fri, 16 Jun 2023)

  Changed paths:
    M clang/lib/Sema/SemaModule.cpp
    A clang/test/Modules/Inputs/modulemaps-nomodules/header.h
    A clang/test/Modules/Inputs/modulemaps-nomodules/module.modulemap
    M clang/test/Modules/getSourceDescriptor-crash.cpp
    A clang/test/Modules/modulemaps-nomodules.cpp
    A clang/test/PCH/Inputs/modulemaps-nomodules/header.h
    A clang/test/PCH/Inputs/modulemaps-nomodules/module.modulemap
    A clang/test/PCH/modulemaps-nomodules.cpp

  Log Message:
  -----------
  [clang] Don't create import decls without -fmodules

When modules are disabled, there's no loaded module for these import
decls to point at. This results in crashes when there are modulemap
files but no -fmodules flag (this configuration is used for layering
check violations).

This patch makes sure import declarations are introduced only when
modules are enabled, which makes this case similar to textual headers
(no import decls are created for #include of textual headers from a
modulemap).

Differential Revision: https://reviews.llvm.org/D152274




More information about the All-commits mailing list