mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-05-14 01:46:41 +00:00

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
9 lines
549 B
C++
9 lines
549 B
C++
// Make sure we treat includes that are part of modulemaps the same as textual
|
|
// headers when modules are not enabled (e.g do't generate import decls, but
|
|
// still perform layering checks).
|
|
// No need to pass -fno-modules explicitly, absence implies negation for cc1.
|
|
// RUN: %clang_cc1 -I %S/Inputs/modulemaps-nomodules -fmodule-map-file=%S/Inputs/modulemaps-nomodules/module.modulemap %s -verify -ast-dump | FileCheck %s
|
|
|
|
#include "header.h" // expected-error{{use of private header from outside its module: 'header.h'}}
|
|
// CHECK-NOT: ImportDecl
|