diff --git a/clang/test/Modules/Inputs/gnumode-non-benign/module.h b/clang/test/Modules/Inputs/gnumode-non-benign/module.h new file mode 100644 index 000000000000..efde0ad70c55 --- /dev/null +++ b/clang/test/Modules/Inputs/gnumode-non-benign/module.h @@ -0,0 +1,5 @@ +// Check for GNUMode = 1 by looking for the "linux" define which only exists +// for GNUMode = 1. +#ifdef linux + #error "Submodule has GNUMode=1" +#endif diff --git a/clang/test/Modules/Inputs/gnumode-non-benign/module.modulemap b/clang/test/Modules/Inputs/gnumode-non-benign/module.modulemap new file mode 100644 index 000000000000..702ef596eb06 --- /dev/null +++ b/clang/test/Modules/Inputs/gnumode-non-benign/module.modulemap @@ -0,0 +1 @@ +module "module.h" { header "module.h"} diff --git a/clang/test/Modules/gnumode-non-benign.cpp b/clang/test/Modules/gnumode-non-benign.cpp new file mode 100644 index 000000000000..9255dfe24b11 --- /dev/null +++ b/clang/test/Modules/gnumode-non-benign.cpp @@ -0,0 +1,11 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/gnumode-non-benign -verify %s + +// expected-no-diagnostics + +// This test ensures that submodules have the same GNUMode language option +// setting as the main clang invocation. +// Note that we set GNUMode = 0 with -std=c++11 for this file. + +// This module fails to compile with GNUMode = 1. +#include "module.h"