Sounds good to me.

Richard, what do you think?

On Thu, Aug 10, 2017 at 9:38 AM, Bruno Cardoso Lopes
<bruno.card...@gmail.com> wrote:
> Hi Hans, can we please get this merged into 5.0?
>
> Thanks,
>
> On Thu, Aug 10, 2017 at 12:16 PM, Bruno Cardoso Lopes via cfe-commits
> <cfe-commits@lists.llvm.org> wrote:
>> Author: bruno
>> Date: Thu Aug 10 08:16:24 2017
>> New Revision: 310605
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=310605&view=rev
>> Log:
>> [Modules] Prevent #import to reenter header if not building a module.
>>
>> When non-modular headers are imported while not building a module but
>> in -fmodules mode, be conservative and preserve the default #import
>> semantic: do not reenter headers.
>>
>> rdar://problem/33745031
>>
>> Added:
>>     cfe/trunk/test/Modules/Inputs/import-textual/x.h
>>     cfe/trunk/test/Modules/import-textual-nomodules.m
>> Modified:
>>     cfe/trunk/lib/Lex/HeaderSearch.cpp
>>
>> Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=310605&r1=310604&r2=310605&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Lex/HeaderSearch.cpp (original)
>> +++ cfe/trunk/lib/Lex/HeaderSearch.cpp Thu Aug 10 08:16:24 2017
>> @@ -1143,7 +1143,7 @@ bool HeaderSearch::ShouldEnterIncludeFil
>>      // 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 &&
>> +    if (FileInfo.isCompilingModuleHeader && !FileInfo.isModuleHeader &&
>>          FileInfo.getControllingMacro(ExternalLookup))
>>        TryEnterHdr = true;
>>      return TryEnterHdr;
>>
>> Added: cfe/trunk/test/Modules/Inputs/import-textual/x.h
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/import-textual/x.h?rev=310605&view=auto
>> ==============================================================================
>> --- cfe/trunk/test/Modules/Inputs/import-textual/x.h (added)
>> +++ cfe/trunk/test/Modules/Inputs/import-textual/x.h Thu Aug 10 08:16:24 2017
>> @@ -0,0 +1,6 @@
>> +#ifndef RANDOM_DEP
>> +
>> +@interface X
>> +@end
>> +
>> +#endif // RANDOM_DEP
>>
>> Added: cfe/trunk/test/Modules/import-textual-nomodules.m
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/import-textual-nomodules.m?rev=310605&view=auto
>> ==============================================================================
>> --- cfe/trunk/test/Modules/import-textual-nomodules.m (added)
>> +++ cfe/trunk/test/Modules/import-textual-nomodules.m Thu Aug 10 08:16:24 
>> 2017
>> @@ -0,0 +1,8 @@
>> +// RUN: rm -rf %t
>> +// RUN: %clang_cc1 -fsyntax-only -fmodules -fimplicit-module-maps 
>> -I%S/Inputs/import-textual -fmodules-cache-path=%t %s -verify
>> +
>> +// expected-no-diagnostics
>> +
>> +#import "x.h"
>> +#import "x.h"
>> +
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
>
> --
> Bruno Cardoso Lopes
> http://www.brunocardoso.cc
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to