r291644 - [Modules] Support #import when entering files with modules
Bruno Cardoso Lopes via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 10 18:14:52 PST 2017
Author: bruno
Date: Tue Jan 10 20:14:51 2017
New Revision: 291644
URL: http://llvm.org/viewvc/llvm-project?rev=291644&view=rev
Log:
[Modules] Support #import when entering files with modules
Textual headers and builtins that are #import'd from different
modules should get re-entered when these modules are independent
from each other.
Differential Revision: https://reviews.llvm.org/D26267
rdar://problem/25881934
Added:
cfe/trunk/test/Modules/Inputs/import-textual/
cfe/trunk/test/Modules/Inputs/import-textual/M/
cfe/trunk/test/Modules/Inputs/import-textual/M/A/
cfe/trunk/test/Modules/Inputs/import-textual/M/A/A.h
cfe/trunk/test/Modules/Inputs/import-textual/M/B/
cfe/trunk/test/Modules/Inputs/import-textual/M/B/B.h
cfe/trunk/test/Modules/Inputs/import-textual/M/module.modulemap
cfe/trunk/test/Modules/Inputs/import-textual/M/someheader.h
cfe/trunk/test/Modules/Inputs/import-textual/M2/
cfe/trunk/test/Modules/Inputs/import-textual/M2/A/
cfe/trunk/test/Modules/Inputs/import-textual/M2/A/A.h
cfe/trunk/test/Modules/Inputs/import-textual/M2/B/
cfe/trunk/test/Modules/Inputs/import-textual/M2/B/B.h
cfe/trunk/test/Modules/Inputs/import-textual/M2/module.modulemap
cfe/trunk/test/Modules/Inputs/import-textual/M2/someheader.h
cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/cstddef
cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/type_traits
cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/sys/
cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/sys/_types/
cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/sys/_types/_ptrdiff_t.h
cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/sys/_types/_types.h
cfe/trunk/test/Modules/builtin-import.mm
cfe/trunk/test/Modules/import-textual-noguard.mm
cfe/trunk/test/Modules/import-textual.mm
Modified:
cfe/trunk/include/clang/Lex/HeaderSearch.h
cfe/trunk/include/clang/Lex/ModuleMap.h
cfe/trunk/lib/Lex/HeaderSearch.cpp
cfe/trunk/lib/Lex/ModuleMap.cpp
cfe/trunk/lib/Lex/PPDirectives.cpp
cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/math.h
cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/module.modulemap
cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/stddef.h
cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/module.modulemap
cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stddef.h
Modified: cfe/trunk/include/clang/Lex/HeaderSearch.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderSearch.h?rev=291644&r1=291643&r2=291644&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/HeaderSearch.h (original)
+++ cfe/trunk/include/clang/Lex/HeaderSearch.h Tue Jan 10 20:14:51 2017
@@ -406,7 +406,8 @@ public:
/// \return false if \#including the file will have no effect or true
/// if we should include it.
bool ShouldEnterIncludeFile(Preprocessor &PP, const FileEntry *File,
- bool isImport, Module *CorrespondingModule);
+ bool isImport, bool ModulesEnabled,
+ Module *CorrespondingModule);
/// \brief Return whether the specified file is a normal header,
/// a system header, or a C++ friendly system header.
Modified: cfe/trunk/include/clang/Lex/ModuleMap.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/ModuleMap.h?rev=291644&r1=291643&r2=291644&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/ModuleMap.h (original)
+++ cfe/trunk/include/clang/Lex/ModuleMap.h Tue Jan 10 20:14:51 2017
@@ -316,6 +316,14 @@ public:
BuiltinIncludeDir = Dir;
}
+ /// \brief Get the directory that contains Clang-supplied include files.
+ const DirectoryEntry *getBuiltinDir() const {
+ return BuiltinIncludeDir;
+ }
+
+ /// \brief Is this a compiler builtin header?
+ static bool isBuiltinHeader(StringRef FileName);
+
/// \brief Add a module map callback.
void addModuleMapCallbacks(std::unique_ptr<ModuleMapCallbacks> Callback) {
Callbacks.push_back(std::move(Callback));
Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=291644&r1=291643&r2=291644&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/HeaderSearch.cpp (original)
+++ cfe/trunk/lib/Lex/HeaderSearch.cpp Tue Jan 10 20:14:51 2017
@@ -1092,13 +1092,51 @@ void HeaderSearch::MarkFileModuleHeader(
}
bool HeaderSearch::ShouldEnterIncludeFile(Preprocessor &PP,
- const FileEntry *File,
- bool isImport, Module *M) {
+ const FileEntry *File, bool isImport,
+ bool ModulesEnabled, Module *M) {
++NumIncluded; // Count # of attempted #includes.
// Get information about this file.
HeaderFileInfo &FileInfo = getFileInfo(File);
+ // FIXME: this is a workaround for the lack of proper modules-aware support
+ // for #import / #pragma once
+ auto TryEnterImported = [&](void) -> bool {
+ if (!ModulesEnabled)
+ return false;
+ // Modules with builtins are special; multiple modules use builtins as
+ // modular headers, example:
+ //
+ // module stddef { header "stddef.h" export * }
+ //
+ // After module map parsing, this expands to:
+ //
+ // module stddef {
+ // header "/path_to_builtin_dirs/stddef.h"
+ // textual "stddef.h"
+ // }
+ //
+ // It's common that libc++ and system modules will both define such
+ // submodules. Make sure cached results for a builtin header won't
+ // prevent other builtin modules to potentially enter the builtin header.
+ // Note that builtins are header guarded and the decision to actually
+ // enter them is postponed to the controlling macros logic below.
+ bool TryEnterHdr = false;
+ if (FileInfo.isCompilingModuleHeader && FileInfo.isModuleHeader)
+ TryEnterHdr = File->getDir() == ModMap.getBuiltinDir() &&
+ ModuleMap::isBuiltinHeader(
+ llvm::sys::path::filename(File->getName()));
+
+ // Textual headers can be #imported from different modules. Since ObjC
+ // headers find in the wild might rely only on #import and do not contain
+ // controlling macros, be conservative and only try to enter textual headers
+ // if such macro is present.
+ if (!FileInfo.isModuleHeader &&
+ FileInfo.getControllingMacro(ExternalLookup))
+ TryEnterHdr = true;
+ return TryEnterHdr;
+ };
+
// If this is a #import directive, check that we have not already imported
// this header.
if (isImport) {
@@ -1106,11 +1144,12 @@ bool HeaderSearch::ShouldEnterIncludeFil
FileInfo.isImport = true;
// Has this already been #import'ed or #include'd?
- if (FileInfo.NumIncludes) return false;
+ if (FileInfo.NumIncludes && !TryEnterImported())
+ return false;
} else {
// Otherwise, if this is a #include of a file that was previously #import'd
// or if this is the second #include of a #pragma once file, ignore it.
- if (FileInfo.isImport)
+ if (FileInfo.isImport && !TryEnterImported())
return false;
}
Modified: cfe/trunk/lib/Lex/ModuleMap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=291644&r1=291643&r2=291644&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/ModuleMap.cpp (original)
+++ cfe/trunk/lib/Lex/ModuleMap.cpp Tue Jan 10 20:14:51 2017
@@ -144,7 +144,7 @@ static StringRef sanitizeFilenameAsIdent
/// \brief Determine whether the given file name is the name of a builtin
/// header, supplied by Clang to replace, override, or augment existing system
/// headers.
-static bool isBuiltinHeader(StringRef FileName) {
+bool ModuleMap::isBuiltinHeader(StringRef FileName) {
return llvm::StringSwitch<bool>(FileName)
.Case("float.h", true)
.Case("iso646.h", true)
@@ -165,7 +165,7 @@ ModuleMap::findKnownHeader(const FileEnt
HeadersMap::iterator Known = Headers.find(File);
if (HeaderInfo.getHeaderSearchOpts().ImplicitModuleMaps &&
Known == Headers.end() && File->getDir() == BuiltinIncludeDir &&
- isBuiltinHeader(llvm::sys::path::filename(File->getName()))) {
+ ModuleMap::isBuiltinHeader(llvm::sys::path::filename(File->getName()))) {
HeaderInfo.loadTopLevelSystemModules();
return Headers.find(File);
}
@@ -1879,7 +1879,7 @@ void ModuleMapParser::parseHeaderDecl(MM
// supplied by Clang. Find that builtin header.
if (ActiveModule->IsSystem && LeadingToken != MMToken::UmbrellaKeyword &&
BuiltinIncludeDir && BuiltinIncludeDir != Directory &&
- isBuiltinHeader(Header.FileName)) {
+ ModuleMap::isBuiltinHeader(Header.FileName)) {
SmallString<128> BuiltinPathName(BuiltinIncludeDir->getName());
llvm::sys::path::append(BuiltinPathName, Header.FileName);
BuiltinFile = SourceMgr.getFileManager().getFile(BuiltinPathName);
Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=291644&r1=291643&r2=291644&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Tue Jan 10 20:14:51 2017
@@ -1999,6 +1999,7 @@ void Preprocessor::HandleIncludeDirectiv
bool SkipHeader = false;
if (ShouldEnter &&
!HeaderInfo.ShouldEnterIncludeFile(*this, File, isImport,
+ getLangOpts().Modules,
SuggestedModule.getModule())) {
ShouldEnter = false;
SkipHeader = true;
Added: cfe/trunk/test/Modules/Inputs/import-textual/M/A/A.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/import-textual/M/A/A.h?rev=291644&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/import-textual/M/A/A.h (added)
+++ cfe/trunk/test/Modules/Inputs/import-textual/M/A/A.h Tue Jan 10 20:14:51 2017
@@ -0,0 +1,4 @@
+
+#import "someheader.h"
+
+typedef myint aint;
Added: cfe/trunk/test/Modules/Inputs/import-textual/M/B/B.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/import-textual/M/B/B.h?rev=291644&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/import-textual/M/B/B.h (added)
+++ cfe/trunk/test/Modules/Inputs/import-textual/M/B/B.h Tue Jan 10 20:14:51 2017
@@ -0,0 +1,4 @@
+
+#import "someheader.h"
+
+typedef myint bint;
Added: cfe/trunk/test/Modules/Inputs/import-textual/M/module.modulemap
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/import-textual/M/module.modulemap?rev=291644&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/import-textual/M/module.modulemap (added)
+++ cfe/trunk/test/Modules/Inputs/import-textual/M/module.modulemap Tue Jan 10 20:14:51 2017
@@ -0,0 +1,17 @@
+
+module M {
+
+ module A {
+ header "A/A.h"
+ textual header "someheader.h"
+ export *
+ }
+
+ module B {
+ header "B/B.h"
+ textual header "someheader.h"
+ export *
+ }
+
+ export *
+}
Added: cfe/trunk/test/Modules/Inputs/import-textual/M/someheader.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/import-textual/M/someheader.h?rev=291644&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/import-textual/M/someheader.h (added)
+++ cfe/trunk/test/Modules/Inputs/import-textual/M/someheader.h Tue Jan 10 20:14:51 2017
@@ -0,0 +1,6 @@
+#ifndef C_GUARD
+#define C_GUARD
+
+typedef int myint;
+
+#endif
Added: cfe/trunk/test/Modules/Inputs/import-textual/M2/A/A.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/import-textual/M2/A/A.h?rev=291644&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/import-textual/M2/A/A.h (added)
+++ cfe/trunk/test/Modules/Inputs/import-textual/M2/A/A.h Tue Jan 10 20:14:51 2017
@@ -0,0 +1,4 @@
+
+#import "someheader.h"
+
+typedef myint aint;
Added: cfe/trunk/test/Modules/Inputs/import-textual/M2/B/B.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/import-textual/M2/B/B.h?rev=291644&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/import-textual/M2/B/B.h (added)
+++ cfe/trunk/test/Modules/Inputs/import-textual/M2/B/B.h Tue Jan 10 20:14:51 2017
@@ -0,0 +1,4 @@
+
+#import "someheader.h"
+
+typedef myint bint;
Added: cfe/trunk/test/Modules/Inputs/import-textual/M2/module.modulemap
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/import-textual/M2/module.modulemap?rev=291644&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/import-textual/M2/module.modulemap (added)
+++ cfe/trunk/test/Modules/Inputs/import-textual/M2/module.modulemap Tue Jan 10 20:14:51 2017
@@ -0,0 +1,17 @@
+
+module M {
+
+ module A {
+ header "A/A.h"
+ textual header "someheader.h"
+ export *
+ }
+
+ module B {
+ header "B/B.h"
+ textual header "someheader.h"
+ export *
+ }
+
+ export *
+}
Added: cfe/trunk/test/Modules/Inputs/import-textual/M2/someheader.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/import-textual/M2/someheader.h?rev=291644&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/import-textual/M2/someheader.h (added)
+++ cfe/trunk/test/Modules/Inputs/import-textual/M2/someheader.h Tue Jan 10 20:14:51 2017
@@ -0,0 +1 @@
+typedef int myint;
Added: cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/cstddef
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c%2B%2B/v1/cstddef?rev=291644&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/cstddef (added)
+++ cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/cstddef Tue Jan 10 20:14:51 2017
@@ -0,0 +1,9 @@
+#ifndef _LIBCPP_CSTDDEF
+#define _LIBCPP_CSTDDEF
+
+#include <stddef.h>
+#include <type_traits>
+
+typedef ptrdiff_t my_ptrdiff_t;
+
+#endif
Modified: cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/math.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c%2B%2B/v1/math.h?rev=291644&r1=291643&r2=291644&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/math.h (original)
+++ cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/math.h Tue Jan 10 20:14:51 2017
@@ -4,4 +4,6 @@
#include_next <math.h>
template<typename T> T abs(T t) { return (t < 0) ? -t : t; }
+#include <type_traits>
+
#endif
Modified: cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/module.modulemap
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c%2B%2B/v1/module.modulemap?rev=291644&r1=291643&r2=291644&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/module.modulemap (original)
+++ cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/module.modulemap Tue Jan 10 20:14:51 2017
@@ -6,5 +6,7 @@ module "libc++" {
// FIXME: remove "textual" from stdint module below once the issue
// between umbrella headers and builtins is resolved.
module stdint { textual header "stdint.h" export * }
+ module type_traits { header "type_traits" export * }
+ module cstddef { header "cstddef" export * }
module __config { header "__config" export * }
}
Modified: cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/stddef.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c%2B%2B/v1/stddef.h?rev=291644&r1=291643&r2=291644&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/stddef.h (original)
+++ cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/stddef.h Tue Jan 10 20:14:51 2017
@@ -2,5 +2,6 @@
#define LIBCXX_STDDEF_H
#include <__config>
+#include_next <stddef.h>
#endif
Added: cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/type_traits
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c%2B%2B/v1/type_traits?rev=291644&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/type_traits (added)
+++ cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/type_traits Tue Jan 10 20:14:51 2017
@@ -0,0 +1,6 @@
+#ifndef _LIBCPP_TYPE_TRAITS
+#define _LIBCPP_TYPE_TRAITS
+
+#include <cstddef>
+
+#endif
Modified: cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/module.modulemap
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/module.modulemap?rev=291644&r1=291643&r2=291644&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/module.modulemap (original)
+++ cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/module.modulemap Tue Jan 10 20:14:51 2017
@@ -5,4 +5,12 @@ module libc [no_undeclared_includes] {
module stdint { header "stdint.h" export * }
module stdio { header "stdio.h" export * }
module util { header "util.h" export * }
+ module POSIX {
+ module sys {
+ module types {
+ umbrella header "sys/_types/_types.h"
+ export *
+ }
+ }
+ }
}
Modified: cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stddef.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stddef.h?rev=291644&r1=291643&r2=291644&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stddef.h (original)
+++ cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stddef.h Tue Jan 10 20:14:51 2017
@@ -1 +1,6 @@
-// stddef.h
+#ifndef __STDDEF_H__
+#define __STDDEF_H__
+
+#include "sys/_types/_ptrdiff_t.h"
+
+#endif
Added: cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/sys/_types/_ptrdiff_t.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/sys/_types/_ptrdiff_t.h?rev=291644&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/sys/_types/_ptrdiff_t.h (added)
+++ cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/sys/_types/_ptrdiff_t.h Tue Jan 10 20:14:51 2017
@@ -0,0 +1,4 @@
+#ifndef _PTRDIFF_T
+#define _PTRDIFF_T
+typedef int * ptrdiff_t;
+#endif /* _PTRDIFF_T */
Added: cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/sys/_types/_types.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/sys/_types/_types.h?rev=291644&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/sys/_types/_types.h (added)
+++ cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/sys/_types/_types.h Tue Jan 10 20:14:51 2017
@@ -0,0 +1,6 @@
+#ifndef _SYS_TYPES_UMBRELLA
+#define _SYS_TYPES_UMBRELLA
+
+#include "_ptrdiff_t.h"
+
+#endif
Added: cfe/trunk/test/Modules/builtin-import.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/builtin-import.mm?rev=291644&view=auto
==============================================================================
--- cfe/trunk/test/Modules/builtin-import.mm (added)
+++ cfe/trunk/test/Modules/builtin-import.mm Tue Jan 10 20:14:51 2017
@@ -0,0 +1,12 @@
+// REQUIRES: system-darwin
+
+// RUN: rm -rf %t
+// RUN: %clang -cc1 -fsyntax-only -nostdinc++ -isysroot %S/Inputs/libc-libcxx/sysroot -isystem %S/Inputs/libc-libcxx/sysroot/usr/include/c++/v1 -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x objective-c++ -fmodules-local-submodule-visibility %s
+
+#include <stdio.h>
+#include <stddef.h>
+#include <cstddef>
+
+typedef ptrdiff_t try1_ptrdiff_t;
+typedef my_ptrdiff_t try2_ptrdiff_t;
+
Added: cfe/trunk/test/Modules/import-textual-noguard.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/import-textual-noguard.mm?rev=291644&view=auto
==============================================================================
--- cfe/trunk/test/Modules/import-textual-noguard.mm (added)
+++ cfe/trunk/test/Modules/import-textual-noguard.mm Tue Jan 10 20:14:51 2017
@@ -0,0 +1,8 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -fmodules -fimplicit-module-maps -I%S/Inputs/import-textual/M2 -fmodules-cache-path=%t -x objective-c++ -fmodules-local-submodule-visibility %s -verify
+
+#include "A/A.h" // expected-error {{could not build module 'M'}}
+#include "B/B.h"
+
+typedef aint xxx;
+typedef bint yyy;
Added: cfe/trunk/test/Modules/import-textual.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/import-textual.mm?rev=291644&view=auto
==============================================================================
--- cfe/trunk/test/Modules/import-textual.mm (added)
+++ cfe/trunk/test/Modules/import-textual.mm Tue Jan 10 20:14:51 2017
@@ -0,0 +1,10 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -fmodules -fimplicit-module-maps -I%S/Inputs/import-textual/M -fmodules-cache-path=%t -x objective-c++ -fmodules-local-submodule-visibility %s -verify
+
+// expected-no-diagnostics
+
+#include "A/A.h"
+#include "B/B.h"
+
+typedef aint xxx;
+typedef bint yyy;
More information about the cfe-commits
mailing list