r302312 - Permit keywords in module names in #pragma clang module *.

Vassil Vassilev via cfe-commits cfe-commits at lists.llvm.org
Mon May 8 13:47:17 PDT 2017


Thanks!
On 06/05/17 00:34, Richard Smith via cfe-commits wrote:
> Author: rsmith
> Date: Fri May  5 17:34:07 2017
> New Revision: 302312
>
> URL: http://llvm.org/viewvc/llvm-project?rev=302312&view=rev
> Log:
> Permit keywords in module names in #pragma clang module *.
>
> This is necessary to be able to build a libc++ module from preprocessed source
> (due to the submodule std.new).
>
> Modified:
>      cfe/trunk/lib/Lex/Pragma.cpp
>      cfe/trunk/test/Preprocessor/pragma_module.c
>
> Modified: cfe/trunk/lib/Lex/Pragma.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Pragma.cpp?rev=302312&r1=302311&r2=302312&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Lex/Pragma.cpp (original)
> +++ cfe/trunk/lib/Lex/Pragma.cpp Fri May  5 17:34:07 2017
> @@ -1307,7 +1307,7 @@ static bool LexModuleName(
>           &ModuleName) {
>     while (true) {
>       PP.LexUnexpandedToken(Tok);
> -    if (Tok.isNot(tok::identifier)) {
> +    if (Tok.isAnnotation() || !Tok.getIdentifierInfo()) {
>         PP.Diag(Tok.getLocation(), diag::err_pp_expected_module_name)
>           << ModuleName.empty();
>         return true;
>
> Modified: cfe/trunk/test/Preprocessor/pragma_module.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/pragma_module.c?rev=302312&r1=302311&r2=302312&view=diff
> ==============================================================================
> --- cfe/trunk/test/Preprocessor/pragma_module.c (original)
> +++ cfe/trunk/test/Preprocessor/pragma_module.c Fri May  5 17:34:07 2017
> @@ -1,13 +1,14 @@
>   // RUN: rm -rf %t
>   // RUN: mkdir %t
> -// RUN: echo 'module foo { module a {} module b {} } module bar {}' > %t/module.map
> -// RUN: %clang -cc1 -E -fmodules %s -verify -fmodule-name=foo -fmodule-map-file=%t/module.map
> -// RUN: %clang -cc1 -E -fmodules %s -verify -fmodule-name=foo -fmodule-map-file=%t/module.map -fmodules-local-submodule-visibility -DLOCAL_VIS
> +// RUN: echo 'module foo { module a {} module b {} } module bar {} module if {}' > %t/module.map
> +// RUN: %clang -cc1 -fmodules -fmodule-name=if -x c %t/module.map -emit-module -o %t/if.pcm
> +// RUN: %clang -cc1 -E -fmodules %s -fmodule-file=%t/if.pcm -verify -fmodule-name=foo -fmodule-map-file=%t/module.map
> +// RUN: %clang -cc1 -E -fmodules %s -fmodule-file=%t/if.pcm -verify -fmodule-name=foo -fmodule-map-file=%t/module.map -fmodules-local-submodule-visibility -DLOCAL_VIS
>   
>   // Just checking the syntax here; the semantics are tested elsewhere.
>   #pragma clang module import // expected-error {{expected module name}}
>   #pragma clang module import ! // expected-error {{expected module name}}
> -#pragma clang module import if // expected-error {{expected module name}}
> +#pragma clang module import if // ok
>   #pragma clang module import foo ? bar // expected-warning {{extra tokens at end of #pragma}}
>   #pragma clang module import foo. // expected-error {{expected identifier after '.' in module name}}
>   #pragma clang module import foo.bar.baz.quux // expected-error {{no submodule named 'bar' in module 'foo'}}
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list