r241668 - Revert "parser: wordsmith diagnostic message" and "parser: diagnose empty attribute blocks"

Aaron Ballman aaron at aaronballman.com
Wed Jul 8 05:18:17 PDT 2015


On Wed, Jul 8, 2015 at 1:55 AM, David Majnemer <david.majnemer at gmail.com> wrote:
> Author: majnemer
> Date: Wed Jul  8 00:55:00 2015
> New Revision: 241668
>
> URL: http://llvm.org/viewvc/llvm-project?rev=241668&view=rev
> Log:
> Revert "parser: wordsmith diagnostic message" and "parser: diagnose empty attribute blocks"
>
> This reverts commit r239846 and r239879.  They caused clang's
> -fms-extensions behavior to incorrectly parse lambdas and includes a
> testcase to ensure we don't regress again.
>
> This issue was found in PR24027.

I'm not certain this is the correct fix for the PR as the original
code is benignly broken too. To the best of my knowledge, a Microsoft
attribute cannot appear in that position, so why is this method being
called in the first place?

~Aaron

>
> Modified:
>     cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
>     cfe/trunk/lib/Parse/ParseDeclCXX.cpp
>     cfe/trunk/test/Parser/MicrosoftExtensions.c
>     cfe/trunk/test/Parser/MicrosoftExtensions.cpp
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=241668&r1=241667&r2=241668&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Wed Jul  8 00:55:00 2015
> @@ -1004,10 +1004,6 @@ def err_pragma_invalid_keyword : Error<
>  def warn_pragma_unroll_cuda_value_in_parens : Warning<
>    "argument to '#pragma unroll' should not be in parentheses in CUDA C/C++">,
>    InGroup<CudaCompat>;
> -
> -def err_empty_attribute_block : Error<
> -  "Microsoft attribute block cannot be empty">;
> -
>  } // end of Parse Issue category.
>
>  let CategoryName = "Modules Issue" in {
>
> Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=241668&r1=241667&r2=241668&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
> +++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Wed Jul  8 00:55:00 2015
> @@ -3814,7 +3814,7 @@ SourceLocation Parser::SkipCXX11Attribut
>    return EndLoc;
>  }
>
> -/// Parse one or more Microsoft-style attributes [Attr]
> +/// ParseMicrosoftAttributes - Parse Microsoft attributes [Attr]
>  ///
>  /// [MS] ms-attribute:
>  ///             '[' token-seq ']'
> @@ -3830,8 +3830,6 @@ void Parser::ParseMicrosoftAttributes(Pa
>      // FIXME: If this is actually a C++11 attribute, parse it as one.
>      BalancedDelimiterTracker T(*this, tok::l_square);
>      T.consumeOpen();
> -    if (Tok.is(tok::r_square))
> -      Diag(T.getOpenLocation(), diag::err_empty_attribute_block);
>      SkipUntil(tok::r_square, StopAtSemi | StopBeforeMatch);
>      T.consumeClose();
>      if (endLoc)
>
> Modified: cfe/trunk/test/Parser/MicrosoftExtensions.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/MicrosoftExtensions.c?rev=241668&r1=241667&r2=241668&view=diff
> ==============================================================================
> --- cfe/trunk/test/Parser/MicrosoftExtensions.c (original)
> +++ cfe/trunk/test/Parser/MicrosoftExtensions.c Wed Jul  8 00:55:00 2015
> @@ -55,8 +55,6 @@ int foo1([SA_Post(attr=1)] void *param);
>  [unbalanced(attribute) /* expected-note {{to match this '['}} */
>  void f(void); /* expected-error {{expected ']'}} */
>
> -[] __interface I {}; /* expected-error {{Microsoft attribute block cannot be empty}} */
> -
>  void ms_intrinsics(int a) {
>    __noop();
>    __assume(a);
>
> Modified: cfe/trunk/test/Parser/MicrosoftExtensions.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/MicrosoftExtensions.cpp?rev=241668&r1=241667&r2=241668&view=diff
> ==============================================================================
> --- cfe/trunk/test/Parser/MicrosoftExtensions.cpp (original)
> +++ cfe/trunk/test/Parser/MicrosoftExtensions.cpp Wed Jul  8 00:55:00 2015
> @@ -400,3 +400,10 @@ static_assert(__alignof(struct align_bef
>  static_assert(__alignof(struct align_before_key2) == 16, "");
>  static_assert(__alignof(struct align_before_key3) == 16, "");
>  }
> +
> +namespace PR24027 {
> +struct S {
> +  template <typename T>
> +  S(T);
> +} f([] {});
> +}
>
>
> _______________________________________________
> 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