r220177 - [modules] Add support for #include_next.
Aaron Ballman
aaron at aaronballman.com
Mon Oct 20 08:26:06 PDT 2014
On Sun, Oct 19, 2014 at 8:15 PM, Richard Smith
<richard-llvm at metafoo.co.uk> wrote:
> Author: rsmith
> Date: Sun Oct 19 19:15:49 2014
> New Revision: 220177
>
> URL: http://llvm.org/viewvc/llvm-project?rev=220177&view=rev
> Log:
> [modules] Add support for #include_next.
>
> #include_next interacts poorly with modules: it depends on where in the list of
> include paths the current file was found. Files covered by module maps are not
> found in include search paths when building the module (and are not found in
> include search paths when @importing the module either), so this isn't really
> meaningful. Instead, we fake up the result that #include_next *should* have
> given: find the first path that would have resulted in the given file being
> picked, and search from there onwards.
>
> Added:
> cfe/trunk/test/Modules/Inputs/include_next/
> cfe/trunk/test/Modules/Inputs/include_next/x/
> cfe/trunk/test/Modules/Inputs/include_next/x/a.h
> cfe/trunk/test/Modules/Inputs/include_next/x/module.modulemap
> cfe/trunk/test/Modules/Inputs/include_next/x/subdir/
> cfe/trunk/test/Modules/Inputs/include_next/x/subdir/b.h
> cfe/trunk/test/Modules/Inputs/include_next/y/
> cfe/trunk/test/Modules/Inputs/include_next/y/a.h
> cfe/trunk/test/Modules/Inputs/include_next/y/b.h
> cfe/trunk/test/Modules/Inputs/include_next/y/module.modulemap
> cfe/trunk/test/Modules/include_next.c
> Modified:
> cfe/trunk/docs/Modules.rst
> cfe/trunk/include/clang/Lex/Preprocessor.h
> cfe/trunk/lib/Frontend/VerifyDiagnosticConsumer.cpp
> cfe/trunk/lib/Lex/ModuleMap.cpp
> cfe/trunk/lib/Lex/PPDirectives.cpp
> cfe/trunk/lib/Lex/PPMacroExpansion.cpp
> cfe/trunk/lib/Lex/Pragma.cpp
> cfe/trunk/test/Modules/cstd.m
This commit is causing test failures for me locally. My output (Win 7,
MSVC x86 debug build of clang) is:
>lit E:\llvm\llvm\tools\clang\test\Modules\cstd.m
-- Testing: 1 tests, 1 threads --
FAIL: Clang :: Modules/cstd.m (1 of 1)
******************** TEST 'Clang :: Modules/cstd.m' FAILED ********************
Script:
--
rm -rf E:\llvm\2013\tools\clang\test\Modules\Output\cstd.m.tmp
E:/llvm/2013/Debug/bin/clang.EXE -fsyntax-only -isystem
E:\llvm\llvm\tools\clang\test\Modules/Inputs/System/usr/include
-ffreestanding -fmodules
-fmodules-cache-path=E:\llvm\2013\tools\clang\test\Modules\Output\cstd.m.tmp
-D__need_wint_t -Werror=implicit-function-declaration
E:\llvm\llvm\tools\clang\test\Modules\cstd.m
--
Exit Code: 1
Command Output (stdout):
--
Command 0: "rm" "-rf" "E:\llvm\2013\tools\clang\test\Modules\Output\cstd.m.tmp"
Command 0 Result: 0
Command 0 Output:
Command 0 Stderr:
Command 1: "E:/llvm/2013/Debug/bin/clang.EXE" "-fsyntax-only"
"-isystem" "E:\llvm\llvm\tools\clang\test\Modules/Inputs/System/usr/include"
"-ffreestanding" "-fmodules"
"-fmodules-cache-path=E:\llvm\2013\tools\clang\test\Modules\Output\cstd.m.tmp"
"-D__need_wint_t" "-Werror=implicit-function-declaration"
"E:\llvm\llvm\tools\clang\test\Modules\cstd.m"
Command 1 Result: 1
Command 1 Output:
Command 1 Stderr:
While building module 'uses_other_constants' imported from
E:\llvm\llvm\tools\clang\test\Modules\cstd.m:4:
While building module 'cstd' imported from
E:\llvm\llvm\tools\clang\test\Modules/Inputs/System/usr/include\uses_other_constants.h:2:
In file included from <module-includes>:5:
E:\llvm\2013\Debug\bin\..\lib\clang\3.6.0\include\stdint.h:109:9:
error: unknown type name '__UINT64_TYPE__'
typedef __UINT64_TYPE__ uint64_t;
^
E:\llvm\2013\Debug\bin\..\lib\clang\3.6.0\include\stdint.h:183:9:
error: unknown type name '__UINT32_TYPE__'
typedef __UINT32_TYPE__ uint32_t;
^
E:\llvm\2013\Debug\bin\..\lib\clang\3.6.0\include\stdint.h:218:9:
error: unknown type name '__UINT16_TYPE__'
typedef __UINT16_TYPE__ uint16_t;
^
E:\llvm\2013\Debug\bin\..\lib\clang\3.6.0\include\stdint.h:237:9:
error: unknown type name '__UINT8_TYPE__'
typedef __UINT8_TYPE__ uint8_t;
^
E:\llvm\2013\Debug\bin\..\lib\clang\3.6.0\include\stdint.h:270:37:
error: typedef redefinition with different types ('uint32_t' (aka
'int') vs 'unsigned int')
typedef __uintn_t(__INTPTR_WIDTH__) uintptr_t;
^
D:\Program Files (x86)\Microsoft Visual Studio
12.0\VC\include\vadefs.h:50:29: note: previous definition is here
typedef _W64 unsigned int uintptr_t;
^
While building module 'uses_other_constants' imported from
E:\llvm\llvm\tools\clang\test\Modules\cstd.m:4:
In file included from <module-includes>:1:
E:\llvm\llvm\tools\clang\test\Modules/Inputs/System/usr/include\uses_other_constants.h:2:10:
fatal error: could not build module 'cstd'
#include <float.h>
~~~~~~~~^
E:\llvm\llvm\tools\clang\test\Modules\cstd.m:4:9: fatal error: could
not build module 'uses_other_constants'
@import uses_other_constants;
~~~~~~~^~~~~~~~~~~~~~~~~~~~
7 errors generated.
--
********************
Testing Time: 0.36s
********************
Failing Tests (1):
Clang :: Modules/cstd.m
Unexpected Failures: 1
llvm-lit.py: LitConfig.py:94: note: Unable to find 'bash.exe'.
llvm-lit.py: LitConfig.py:94: note: Unable to find 'bash.exe'.
llvm-lit.py: lit.cfg:200: note: using clang: 'E:/llvm/2013/Debug/bin/clang.EXE'
>
~Aaron
>
> Modified: cfe/trunk/docs/Modules.rst
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/Modules.rst?rev=220177&r1=220176&r2=220177&view=diff
> ==============================================================================
> --- cfe/trunk/docs/Modules.rst (original)
> +++ cfe/trunk/docs/Modules.rst Sun Oct 19 19:15:49 2014
> @@ -136,6 +136,19 @@ will be automatically mapped to an impor
>
> The automatic mapping of ``#include`` to ``import`` also solves an implementation problem: importing a module with a definition of some entity (say, a ``struct Point``) and then parsing a header containing another definition of ``struct Point`` would cause a redefinition error, even if it is the same ``struct Point``. By mapping ``#include`` to ``import``, the compiler can guarantee that it always sees just the already-parsed definition from the module.
>
> +While building a module, ``#include_next`` is also supported, with one caveat.
> +The usual behavior of ``#include_next`` is to search for the specified filename
> +in the list of include paths, starting from the path *after* the one
> +in which the current file was found.
> +Because files listed in module maps are not found through include paths, a
> +different strategy is used for ``#include_next`` directives in such files: the
> +list of include paths is searched for the specified header name, to find the
> +first include path that would refer to the current file. ``#include_next`` is
> +interpreted as if the current file had been found in that path.
> +If this search finds a file named by a module map, the ``#include_next``
> +directive is translated into an import, just like for a ``#include``
> +directive.``
> +
> Module maps
> -----------
> The crucial link between modules and headers is described by a *module map*, which describes how a collection of existing headers maps on to the (logical) structure of a module. For example, one could imagine a module ``std`` covering the C standard library. Each of the C standard library headers (``<stdio.h>``, ``<stdlib.h>``, ``<math.h>``, etc.) would contribute to the ``std`` module, by placing their respective APIs into the corresponding submodule (``std.io``, ``std.lib``, ``std.math``, etc.). Having a list of the headers that are part of the ``std`` module allows the compiler to build the ``std`` module as a standalone entity, and having the mapping from header names to (sub)modules allows the automatic translation of ``#include`` directives to module imports.
>
> Modified: cfe/trunk/include/clang/Lex/Preprocessor.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Preprocessor.h?rev=220177&r1=220176&r2=220177&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Lex/Preprocessor.h (original)
> +++ cfe/trunk/include/clang/Lex/Preprocessor.h Sun Oct 19 19:15:49 2014
> @@ -567,6 +567,9 @@ public:
> /// expansions going on at the time.
> PreprocessorLexer *getCurrentFileLexer() const;
>
> + /// \brief Return the submodule owning the file being lexed.
> + Module *getCurrentSubmodule() const { return CurSubmodule; }
> +
> /// \brief Returns the FileID for the preprocessor predefines.
> FileID getPredefinesFileID() const { return PredefinesFileID; }
>
> @@ -1320,6 +1323,7 @@ public:
> /// reference is for system \#include's or not (i.e. using <> instead of "").
> const FileEntry *LookupFile(SourceLocation FilenameLoc, StringRef Filename,
> bool isAngled, const DirectoryLookup *FromDir,
> + const FileEntry *FromFile,
> const DirectoryLookup *&CurDir,
> SmallVectorImpl<char> *SearchPath,
> SmallVectorImpl<char> *RelativePath,
> @@ -1534,6 +1538,7 @@ private:
> void HandleIncludeDirective(SourceLocation HashLoc,
> Token &Tok,
> const DirectoryLookup *LookupFrom = nullptr,
> + const FileEntry *LookupFromFile = nullptr,
> bool isImport = false);
> void HandleIncludeNextDirective(SourceLocation HashLoc, Token &Tok);
> void HandleIncludeMacrosDirective(SourceLocation HashLoc, Token &Tok);
>
> Modified: cfe/trunk/lib/Frontend/VerifyDiagnosticConsumer.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/VerifyDiagnosticConsumer.cpp?rev=220177&r1=220176&r2=220177&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Frontend/VerifyDiagnosticConsumer.cpp (original)
> +++ cfe/trunk/lib/Frontend/VerifyDiagnosticConsumer.cpp Sun Oct 19 19:15:49 2014
> @@ -402,8 +402,9 @@ static bool ParseDirective(StringRef S,
>
> // Lookup file via Preprocessor, like a #include.
> const DirectoryLookup *CurDir;
> - const FileEntry *FE = PP->LookupFile(Pos, Filename, false, nullptr,
> - CurDir, nullptr, nullptr, nullptr);
> + const FileEntry *FE =
> + PP->LookupFile(Pos, Filename, false, nullptr, nullptr, CurDir,
> + nullptr, nullptr, nullptr);
> if (!FE) {
> Diags.Report(Pos.getLocWithOffset(PH.C-PH.Begin),
> diag::err_verify_missing_file) << Filename << KindStr;
>
> Modified: cfe/trunk/lib/Lex/ModuleMap.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=220177&r1=220176&r2=220177&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Lex/ModuleMap.cpp (original)
> +++ cfe/trunk/lib/Lex/ModuleMap.cpp Sun Oct 19 19:15:49 2014
> @@ -1749,12 +1749,14 @@ void ModuleMapParser::parseHeaderDecl(MM
> Role = ModuleMap::PrivateHeader;
> else
> assert(LeadingToken == MMToken::HeaderKeyword);
> -
> - Map.addHeader(ActiveModule, File, Role);
> -
> - // If there is a builtin counterpart to this file, add it now.
> +
> + // If there is a builtin counterpart to this file, add it now, before
> + // the "real" header, so we build the built-in one first when building
> + // the module.
> if (BuiltinFile)
> Map.addHeader(ActiveModule, BuiltinFile, Role);
> +
> + Map.addHeader(ActiveModule, File, Role);
> }
> } else if (LeadingToken != MMToken::ExcludeKeyword) {
> // Ignore excluded header files. They're optional anyway.
>
> Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=220177&r1=220176&r2=220177&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
> +++ cfe/trunk/lib/Lex/PPDirectives.cpp Sun Oct 19 19:15:49 2014
> @@ -534,6 +534,7 @@ const FileEntry *Preprocessor::LookupFil
> StringRef Filename,
> bool isAngled,
> const DirectoryLookup *FromDir,
> + const FileEntry *FromFile,
> const DirectoryLookup *&CurDir,
> SmallVectorImpl<char> *SearchPath,
> SmallVectorImpl<char> *RelativePath,
> @@ -543,7 +544,7 @@ const FileEntry *Preprocessor::LookupFil
> // stack, record the parent #includes.
> SmallVector<std::pair<const FileEntry *, const DirectoryEntry *>, 16>
> Includers;
> - if (!FromDir) {
> + if (!FromDir && !FromFile) {
> FileID FID = getCurrentFileLexer()->getFileID();
> const FileEntry *FileEnt = SourceMgr.getFileEntryForID(FID);
>
> @@ -575,8 +576,30 @@ const FileEntry *Preprocessor::LookupFil
> }
> }
>
> - // Do a standard file entry lookup.
> CurDir = CurDirLookup;
> +
> + if (FromFile) {
> + // We're supposed to start looking from after a particular file. Search
> + // the include path until we find that file or run out of files.
> + const DirectoryLookup *TmpCurDir = CurDir;
> + const DirectoryLookup *TmpFromDir = nullptr;
> + while (const FileEntry *FE = HeaderInfo.LookupFile(
> + Filename, FilenameLoc, isAngled, TmpFromDir, TmpCurDir,
> + Includers, SearchPath, RelativePath, SuggestedModule,
> + SkipCache)) {
> + // Keep looking as if this file did a #include_next.
> + TmpFromDir = TmpCurDir;
> + ++TmpFromDir;
> + if (FE == FromFile) {
> + // Found it.
> + FromDir = TmpFromDir;
> + CurDir = TmpCurDir;
> + break;
> + }
> + }
> + }
> +
> + // Do a standard file entry lookup.
> const FileEntry *FE = HeaderInfo.LookupFile(
> Filename, FilenameLoc, isAngled, FromDir, CurDir, Includers, SearchPath,
> RelativePath, SuggestedModule, SkipCache);
> @@ -1353,6 +1376,7 @@ static void EnterAnnotationToken(Preproc
> void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc,
> Token &IncludeTok,
> const DirectoryLookup *LookupFrom,
> + const FileEntry *LookupFromFile,
> bool isImport) {
>
> Token FilenameTok;
> @@ -1450,8 +1474,8 @@ void Preprocessor::HandleIncludeDirectiv
> }
> const FileEntry *File = LookupFile(
> FilenameLoc, LangOpts.MSVCCompat ? NormalizedPath.c_str() : Filename,
> - isAngled, LookupFrom, CurDir, Callbacks ? &SearchPath : nullptr,
> - Callbacks ? &RelativePath : nullptr,
> + isAngled, LookupFrom, LookupFromFile, CurDir,
> + Callbacks ? &SearchPath : nullptr, Callbacks ? &RelativePath : nullptr,
> HeaderInfo.getHeaderSearchOpts().ModuleMaps ? &SuggestedModule : nullptr);
>
> if (Callbacks) {
> @@ -1465,14 +1489,13 @@ void Preprocessor::HandleIncludeDirectiv
> HeaderInfo.AddSearchPath(DL, isAngled);
>
> // Try the lookup again, skipping the cache.
> - File = LookupFile(FilenameLoc,
> - LangOpts.MSVCCompat ? NormalizedPath.c_str()
> - : Filename,
> - isAngled, LookupFrom, CurDir, nullptr, nullptr,
> - HeaderInfo.getHeaderSearchOpts().ModuleMaps
> - ? &SuggestedModule
> - : nullptr,
> - /*SkipCache*/ true);
> + File = LookupFile(
> + FilenameLoc,
> + LangOpts.MSVCCompat ? NormalizedPath.c_str() : Filename, isAngled,
> + LookupFrom, LookupFromFile, CurDir, nullptr, nullptr,
> + HeaderInfo.getHeaderSearchOpts().ModuleMaps ? &SuggestedModule
> + : nullptr,
> + /*SkipCache*/ true);
> }
> }
> }
> @@ -1494,8 +1517,10 @@ void Preprocessor::HandleIncludeDirectiv
> // provide the user with a possible fixit.
> if (isAngled) {
> File = LookupFile(
> - FilenameLoc, LangOpts.MSVCCompat ? NormalizedPath.c_str() : Filename,
> - false, LookupFrom, CurDir, Callbacks ? &SearchPath : nullptr,
> + FilenameLoc,
> + LangOpts.MSVCCompat ? NormalizedPath.c_str() : Filename, false,
> + LookupFrom, LookupFromFile, CurDir,
> + Callbacks ? &SearchPath : nullptr,
> Callbacks ? &RelativePath : nullptr,
> HeaderInfo.getHeaderSearchOpts().ModuleMaps ? &SuggestedModule
> : nullptr);
> @@ -1692,9 +1717,16 @@ void Preprocessor::HandleIncludeNextDire
> // the current found directory. If we can't do this, issue a
> // diagnostic.
> const DirectoryLookup *Lookup = CurDirLookup;
> + const FileEntry *LookupFromFile = nullptr;
> if (isInPrimaryFile()) {
> Lookup = nullptr;
> Diag(IncludeNextTok, diag::pp_include_next_in_primary);
> + } else if (CurSubmodule) {
> + // Start looking up in the directory *after* the one in which the current
> + // file would be found, if any.
> + assert(CurPPLexer && "#include_next directive in macro?");
> + LookupFromFile = CurPPLexer->getFileEntry();
> + Lookup = nullptr;
> } else if (!Lookup) {
> Diag(IncludeNextTok, diag::pp_include_next_absolute_path);
> } else {
> @@ -1702,7 +1734,8 @@ void Preprocessor::HandleIncludeNextDire
> ++Lookup;
> }
>
> - return HandleIncludeDirective(HashLoc, IncludeNextTok, Lookup);
> + return HandleIncludeDirective(HashLoc, IncludeNextTok, Lookup,
> + LookupFromFile);
> }
>
> /// HandleMicrosoftImportDirective - Implements \#import for Microsoft Mode
> @@ -1728,7 +1761,7 @@ void Preprocessor::HandleImportDirective
> return HandleMicrosoftImportDirective(ImportTok);
> Diag(ImportTok, diag::ext_pp_import_directive);
> }
> - return HandleIncludeDirective(HashLoc, ImportTok, nullptr, true);
> + return HandleIncludeDirective(HashLoc, ImportTok, nullptr, nullptr, true);
> }
>
> /// HandleIncludeMacrosDirective - The -imacros command line option turns into a
> @@ -1749,7 +1782,7 @@ void Preprocessor::HandleIncludeMacrosDi
>
> // Treat this as a normal #include for checking purposes. If this is
> // successful, it will push a new lexer onto the include stack.
> - HandleIncludeDirective(HashLoc, IncludeMacrosTok, nullptr, false);
> + HandleIncludeDirective(HashLoc, IncludeMacrosTok);
>
> Token TmpTok;
> do {
>
> Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=220177&r1=220176&r2=220177&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original)
> +++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Sun Oct 19 19:15:49 2014
> @@ -1053,7 +1053,8 @@ static bool HasExtension(const Preproces
> /// Returns true if successful.
> static bool EvaluateHasIncludeCommon(Token &Tok,
> IdentifierInfo *II, Preprocessor &PP,
> - const DirectoryLookup *LookupFrom) {
> + const DirectoryLookup *LookupFrom,
> + const FileEntry *LookupFromFile) {
> // Save the location of the current token. If a '(' is later found, use
> // that location. If not, use the end of this location instead.
> SourceLocation LParenLoc = Tok.getLocation();
> @@ -1148,8 +1149,8 @@ static bool EvaluateHasIncludeCommon(Tok
> // Search include directories.
> const DirectoryLookup *CurDir;
> const FileEntry *File =
> - PP.LookupFile(FilenameLoc, Filename, isAngled, LookupFrom, CurDir,
> - nullptr, nullptr, nullptr);
> + PP.LookupFile(FilenameLoc, Filename, isAngled, LookupFrom, LookupFromFile,
> + CurDir, nullptr, nullptr, nullptr);
>
> // Get the result value. A result of true means the file exists.
> return File != nullptr;
> @@ -1159,7 +1160,7 @@ static bool EvaluateHasIncludeCommon(Tok
> /// Returns true if successful.
> static bool EvaluateHasInclude(Token &Tok, IdentifierInfo *II,
> Preprocessor &PP) {
> - return EvaluateHasIncludeCommon(Tok, II, PP, nullptr);
> + return EvaluateHasIncludeCommon(Tok, II, PP, nullptr, nullptr);
> }
>
> /// EvaluateHasIncludeNext - Process '__has_include_next("path")' expression.
> @@ -1169,10 +1170,19 @@ static bool EvaluateHasIncludeNext(Token
> // __has_include_next is like __has_include, except that we start
> // searching after the current found directory. If we can't do this,
> // issue a diagnostic.
> + // FIXME: Factor out duplication wiht
> + // Preprocessor::HandleIncludeNextDirective.
> const DirectoryLookup *Lookup = PP.GetCurDirLookup();
> + const FileEntry *LookupFromFile = nullptr;
> if (PP.isInPrimaryFile()) {
> Lookup = nullptr;
> PP.Diag(Tok, diag::pp_include_next_in_primary);
> + } else if (PP.getCurrentSubmodule()) {
> + // Start looking up in the directory *after* the one in which the current
> + // file would be found, if any.
> + assert(PP.getCurrentLexer() && "#include_next directive in macro?");
> + LookupFromFile = PP.getCurrentLexer()->getFileEntry();
> + Lookup = nullptr;
> } else if (!Lookup) {
> PP.Diag(Tok, diag::pp_include_next_absolute_path);
> } else {
> @@ -1180,7 +1190,7 @@ static bool EvaluateHasIncludeNext(Token
> ++Lookup;
> }
>
> - return EvaluateHasIncludeCommon(Tok, II, PP, Lookup);
> + return EvaluateHasIncludeCommon(Tok, II, PP, Lookup, LookupFromFile);
> }
>
> /// \brief Process __building_module(identifier) expression.
>
> Modified: cfe/trunk/lib/Lex/Pragma.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Pragma.cpp?rev=220177&r1=220176&r2=220177&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Lex/Pragma.cpp (original)
> +++ cfe/trunk/lib/Lex/Pragma.cpp Sun Oct 19 19:15:49 2014
> @@ -472,9 +472,9 @@ void Preprocessor::HandlePragmaDependenc
>
> // Search include directories for this file.
> const DirectoryLookup *CurDir;
> - const FileEntry *File = LookupFile(FilenameTok.getLocation(), Filename,
> - isAngled, nullptr, CurDir, nullptr,
> - nullptr, nullptr);
> + const FileEntry *File =
> + LookupFile(FilenameTok.getLocation(), Filename, isAngled, nullptr,
> + nullptr, CurDir, nullptr, nullptr, nullptr);
> if (!File) {
> if (!SuppressIncludeNotFoundError)
> Diag(FilenameTok, diag::err_pp_file_not_found) << Filename;
>
> Added: cfe/trunk/test/Modules/Inputs/include_next/x/a.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/include_next/x/a.h?rev=220177&view=auto
> ==============================================================================
> --- cfe/trunk/test/Modules/Inputs/include_next/x/a.h (added)
> +++ cfe/trunk/test/Modules/Inputs/include_next/x/a.h Sun Oct 19 19:15:49 2014
> @@ -0,0 +1,2 @@
> +#include_next "a.h"
> +enum { ax = 1 };
>
> Added: cfe/trunk/test/Modules/Inputs/include_next/x/module.modulemap
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/include_next/x/module.modulemap?rev=220177&view=auto
> ==============================================================================
> --- cfe/trunk/test/Modules/Inputs/include_next/x/module.modulemap (added)
> +++ cfe/trunk/test/Modules/Inputs/include_next/x/module.modulemap Sun Oct 19 19:15:49 2014
> @@ -0,0 +1,2 @@
> +module xa { header "a.h" export * }
> +module xb { header "subdir/b.h" export * }
>
> Added: cfe/trunk/test/Modules/Inputs/include_next/x/subdir/b.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/include_next/x/subdir/b.h?rev=220177&view=auto
> ==============================================================================
> --- cfe/trunk/test/Modules/Inputs/include_next/x/subdir/b.h (added)
> +++ cfe/trunk/test/Modules/Inputs/include_next/x/subdir/b.h Sun Oct 19 19:15:49 2014
> @@ -0,0 +1,2 @@
> +#include_next <b.h>
> +enum { bx = 3 };
>
> Added: cfe/trunk/test/Modules/Inputs/include_next/y/a.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/include_next/y/a.h?rev=220177&view=auto
> ==============================================================================
> --- cfe/trunk/test/Modules/Inputs/include_next/y/a.h (added)
> +++ cfe/trunk/test/Modules/Inputs/include_next/y/a.h Sun Oct 19 19:15:49 2014
> @@ -0,0 +1 @@
> +enum { ay = 2 };
>
> Added: cfe/trunk/test/Modules/Inputs/include_next/y/b.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/include_next/y/b.h?rev=220177&view=auto
> ==============================================================================
> --- cfe/trunk/test/Modules/Inputs/include_next/y/b.h (added)
> +++ cfe/trunk/test/Modules/Inputs/include_next/y/b.h Sun Oct 19 19:15:49 2014
> @@ -0,0 +1 @@
> +enum { by = 4 };
>
> Added: cfe/trunk/test/Modules/Inputs/include_next/y/module.modulemap
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/include_next/y/module.modulemap?rev=220177&view=auto
> ==============================================================================
> --- cfe/trunk/test/Modules/Inputs/include_next/y/module.modulemap (added)
> +++ cfe/trunk/test/Modules/Inputs/include_next/y/module.modulemap Sun Oct 19 19:15:49 2014
> @@ -0,0 +1,2 @@
> +module ya { header "a.h" export * }
> +module yb { header "b.h" export * }
>
> Modified: cfe/trunk/test/Modules/cstd.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/cstd.m?rev=220177&r1=220176&r2=220177&view=diff
> ==============================================================================
> --- cfe/trunk/test/Modules/cstd.m (original)
> +++ cfe/trunk/test/Modules/cstd.m Sun Oct 19 19:15:49 2014
> @@ -1,5 +1,5 @@
> // RUN: rm -rf %t
> -// RUN: %clang -fsyntax-only -isystem %S/Inputs/System/usr/include -fmodules -fmodules-cache-path=%t -D__need_wint_t -Werror=implicit-function-declaration %s
> +// RUN: %clang -fsyntax-only -isystem %S/Inputs/System/usr/include -ffreestanding -fmodules -fmodules-cache-path=%t -D__need_wint_t -Werror=implicit-function-declaration %s
>
> @import uses_other_constants;
> const double other_value = DBL_MAX;
>
> Added: cfe/trunk/test/Modules/include_next.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/include_next.c?rev=220177&view=auto
> ==============================================================================
> --- cfe/trunk/test/Modules/include_next.c (added)
> +++ cfe/trunk/test/Modules/include_next.c Sun Oct 19 19:15:49 2014
> @@ -0,0 +1,11 @@
> +// RUN: rm -rf %t
> +// RUN: %clang_cc1 -I%S/Inputs/include_next/x -I%S/Inputs/include_next/y -verify %s
> +// RUN: %clang_cc1 -I%S/Inputs/include_next/x -I%S/Inputs/include_next/y -verify %s -fmodules -fmodules-cache-path=%t
> +
> +// expected-no-diagnostics
> +#include "a.h"
> +#include "subdir/b.h"
> +_Static_assert(ax == 1, "");
> +_Static_assert(ay == 2, "");
> +_Static_assert(bx == 3, "");
> +_Static_assert(by == 4, "");
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list