r211746 - Make -Wincomplete-umbrella go through the VFS

Ben Langmuir blangmuir at apple.com
Mon Jun 30 09:19:01 PDT 2014


> On Jun 30, 2014, at 1:51 AM, Renato Golin <renato.golin at linaro.org> wrote:
> 
> Hi Ben,
> 
> New warning:
> 
> clang/lib/Lex/PPLexerChange.cpp: In member function ‘bool
> clang::Preprocessor::HandleEndOfFile(clang::Token&, bool)’:
> clang/lib/Lex/PPLexerChange.cpp:456:11: warning: typedef
> ‘recursive_directory_iterator’ locally defined but not used
> [-Wunused-local-typedefs]
>           recursive_directory_iterator;

Thanks, removed in r212047.
Ben

> 
> cheers,
> --renato
> 
> On 26 June 2014 00:53, Ben Langmuir <blangmuir at apple.com> wrote:
>> Author: benlangmuir
>> Date: Wed Jun 25 18:53:43 2014
>> New Revision: 211746
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=211746&view=rev
>> Log:
>> Make -Wincomplete-umbrella go through the VFS
>> 
>> By using vfs::recursive_directory_iterator, this warning will now fire
>> when some or all of a module's headers are from VFS mappings.
>> 
>> Added:
>>    cfe/trunk/test/VFS/Inputs/Incomplete.h
>>    cfe/trunk/test/VFS/Inputs/IncompleteVFS.h
>>    cfe/trunk/test/VFS/Inputs/incomplete-umbrella.modulemap
>>    cfe/trunk/test/VFS/incomplete-umbrella.m
>> Modified:
>>    cfe/trunk/include/clang/Basic/VirtualFileSystem.h
>>    cfe/trunk/lib/Lex/PPLexerChange.cpp
>>    cfe/trunk/test/VFS/Inputs/vfsoverlay.yaml
>> 
>> Modified: cfe/trunk/include/clang/Basic/VirtualFileSystem.h
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/VirtualFileSystem.h?rev=211746&r1=211745&r2=211746&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/Basic/VirtualFileSystem.h (original)
>> +++ cfe/trunk/include/clang/Basic/VirtualFileSystem.h Wed Jun 25 18:53:43 2014
>> @@ -200,7 +200,7 @@ public:
>>                                    bool IsVolatile = false);
>> 
>>   /// \brief Get a directory_iterator for \p Dir.
>> -  /// \note The 'end' iterator is directory_iterator()
>> +  /// \note The 'end' iterator is directory_iterator().
>>   virtual directory_iterator dir_begin(const Twine &Dir,
>>                                        std::error_code &EC) = 0;
>> };
>> 
>> Modified: cfe/trunk/lib/Lex/PPLexerChange.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPLexerChange.cpp?rev=211746&r1=211745&r2=211746&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Lex/PPLexerChange.cpp (original)
>> +++ cfe/trunk/lib/Lex/PPLexerChange.cpp Wed Jun 25 18:53:43 2014
>> @@ -455,19 +455,21 @@ bool Preprocessor::HandleEndOfFile(Token
>>         typedef llvm::sys::fs::recursive_directory_iterator
>>           recursive_directory_iterator;
>>         const DirectoryEntry *Dir = Mod->getUmbrellaDir();
>> +        vfs::FileSystem &FS = *FileMgr.getVirtualFileSystem();
>>         std::error_code EC;
>> -        for (recursive_directory_iterator Entry(Dir->getName(), EC), End;
>> +        for (vfs::recursive_directory_iterator Entry(FS, Dir->getName(), EC), End;
>>              Entry != End && !EC; Entry.increment(EC)) {
>>           using llvm::StringSwitch;
>> 
>>           // Check whether this entry has an extension typically associated with
>>           // headers.
>> -          if (!StringSwitch<bool>(llvm::sys::path::extension(Entry->path()))
>> +          if (!StringSwitch<bool>(llvm::sys::path::extension(Entry->getName()))
>>                  .Cases(".h", ".H", ".hh", ".hpp", true)
>>                  .Default(false))
>>             continue;
>> 
>> -          if (const FileEntry *Header = getFileManager().getFile(Entry->path()))
>> +          if (const FileEntry *Header =
>> +                  getFileManager().getFile(Entry->getName()))
>>             if (!getSourceManager().hasFileInfo(Header)) {
>>               if (!ModMap.isHeaderInUnavailableModule(Header)) {
>>                 // Find the relative path that would access this header.
>> 
>> Added: cfe/trunk/test/VFS/Inputs/Incomplete.h
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/VFS/Inputs/Incomplete.h?rev=211746&view=auto
>> ==============================================================================
>> --- cfe/trunk/test/VFS/Inputs/Incomplete.h (added)
>> +++ cfe/trunk/test/VFS/Inputs/Incomplete.h Wed Jun 25 18:53:43 2014
>> @@ -0,0 +1 @@
>> +// does not include IncompleteVFS.h or IncompleteReal.h
>> 
>> Added: cfe/trunk/test/VFS/Inputs/IncompleteVFS.h
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/VFS/Inputs/IncompleteVFS.h?rev=211746&view=auto
>> ==============================================================================
>> --- cfe/trunk/test/VFS/Inputs/IncompleteVFS.h (added)
>> +++ cfe/trunk/test/VFS/Inputs/IncompleteVFS.h Wed Jun 25 18:53:43 2014
>> @@ -0,0 +1 @@
>> +// IncompleteVFS.h
>> 
>> Added: cfe/trunk/test/VFS/Inputs/incomplete-umbrella.modulemap
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/VFS/Inputs/incomplete-umbrella.modulemap?rev=211746&view=auto
>> ==============================================================================
>> --- cfe/trunk/test/VFS/Inputs/incomplete-umbrella.modulemap (added)
>> +++ cfe/trunk/test/VFS/Inputs/incomplete-umbrella.modulemap Wed Jun 25 18:53:43 2014
>> @@ -0,0 +1,5 @@
>> +framework module Incomplete {
>> +  umbrella header "Incomplete.h"
>> +  export *
>> +  module * { export * }
>> +}
>> 
>> Modified: cfe/trunk/test/VFS/Inputs/vfsoverlay.yaml
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/VFS/Inputs/vfsoverlay.yaml?rev=211746&r1=211745&r2=211746&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/VFS/Inputs/vfsoverlay.yaml (original)
>> +++ cfe/trunk/test/VFS/Inputs/vfsoverlay.yaml Wed Jun 25 18:53:43 2014
>> @@ -29,6 +29,23 @@
>>         },
>>         { 'name': 'Foo.framework/Headers/Foo.h', 'type': 'file',
>>           'external-contents': 'INPUT_DIR/Foo.h'
>> +        },
>> +        { 'name': 'Incomplete.framework', 'type': 'directory',
>> +          'contents': [
>> +            { 'name': 'Headers', 'type': 'directory',
>> +              'contents': [
>> +                { 'name': 'Incomplete.h', 'type': 'file',
>> +                  'external-contents': 'INPUT_DIR/Incomplete.h'
>> +                },
>> +                { 'name': 'IncompleteVFS.h', 'type': 'file',
>> +                  'external-contents': 'INPUT_DIR/IncompleteVFS.h'
>> +                }
>> +              ]
>> +            },
>> +            { 'name': 'Modules/module.modulemap', 'type': 'file',
>> +              'external-contents': 'INPUT_DIR/incomplete-umbrella.modulemap'
>> +            }
>> +          ]
>>         }
>>       ]
>>     }
>> 
>> Added: cfe/trunk/test/VFS/incomplete-umbrella.m
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/VFS/incomplete-umbrella.m?rev=211746&view=auto
>> ==============================================================================
>> --- cfe/trunk/test/VFS/incomplete-umbrella.m (added)
>> +++ cfe/trunk/test/VFS/incomplete-umbrella.m Wed Jun 25 18:53:43 2014
>> @@ -0,0 +1,12 @@
>> +// RUN: rm -rf %t
>> +// RUN: mkdir -p %t/Incomplete.framework/Headers
>> +// RUN: echo '// IncompleteReal.h' > %t/Incomplete.framework/Headers/IncompleteReal.h
>> +// RUN: sed -e "s:INPUT_DIR:%S/Inputs:g" -e "s:OUT_DIR:%t:g" %S/Inputs/vfsoverlay.yaml > %t.yaml
>> +// RUN: not %clang_cc1 -Werror -fmodules -fmodules-cache-path=%t \
>> +// RUN:     -ivfsoverlay %t.yaml -F %t -fsyntax-only %s 2>&1 | FileCheck %s
>> +// REQUIRES: shell
>> +
>> + at import Incomplete;
>> +// CHECK: umbrella header for module 'Incomplete' {{.*}}IncompleteVFS.h
>> +// CHECK: umbrella header for module 'Incomplete' {{.*}}IncompleteReal.h
>> +// CHECK: could not build module 'Incomplete'
>> 
>> 
>> _______________________________________________
>> 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