r371241 - [LifetimeAnalysis] don't use raw string literals in macros

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 6 12:44:19 PDT 2019


(The slightly more usual fix is to do `const char kFoo[] = R"cpp(...)cpp";
EXPECT_TRUE(matches(kFoo...)`)

On Fri, Sep 6, 2019 at 3:13 PM Matthias Gehre via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Author: mgehre
> Date: Fri Sep  6 12:15:02 2019
> New Revision: 371241
>
> URL: http://llvm.org/viewvc/llvm-project?rev=371241&view=rev
> Log:
> [LifetimeAnalysis] don't use raw string literals in macros
>
> They broke the AArch64 bots (gcc does not support it)
>
> Modified:
>     cfe/trunk/unittests/Sema/GslOwnerPointerInference.cpp
>
> Modified: cfe/trunk/unittests/Sema/GslOwnerPointerInference.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Sema/GslOwnerPointerInference.cpp?rev=371241&r1=371240&r2=371241&view=diff
>
> ==============================================================================
> --- cfe/trunk/unittests/Sema/GslOwnerPointerInference.cpp (original)
> +++ cfe/trunk/unittests/Sema/GslOwnerPointerInference.cpp Fri Sep  6
> 12:15:02 2019
> @@ -14,48 +14,42 @@ namespace clang {
>  using namespace ast_matchers;
>
>  TEST(OwnerPointer, BothHaveAttributes) {
> -  EXPECT_TRUE(matches(
> -    R"cpp(
> -      template<class T>
> -      class [[gsl::Owner]] C;
> -
> -      template<class T>
> -      class [[gsl::Owner]] C {};
> -
> -      C<int> c;
> -  )cpp",
> -    classTemplateSpecializationDecl(hasName("C"),
> hasAttr(clang::attr::Owner))));
> +  EXPECT_TRUE(matches("template<class T>"
> +                      "class [[gsl::Owner]] C;"
> +
> +                      "template<class T>"
> +                      "class [[gsl::Owner]] C {};"
> +
> +                      "C<int> c;",
> +                      classTemplateSpecializationDecl(
> +                          hasName("C"), hasAttr(clang::attr::Owner))));
>  }
>
>  TEST(OwnerPointer, ForwardDeclOnly) {
> -  EXPECT_TRUE(matches(
> -    R"cpp(
> -      template<class T>
> -      class [[gsl::Owner]] C;
> -
> -      template<class T>
> -      class C {};
> -
> -      C<int> c;
> -  )cpp",
> -    classTemplateSpecializationDecl(hasName("C"),
> hasAttr(clang::attr::Owner))));
> +  EXPECT_TRUE(matches("template<class T>"
> +                      "class [[gsl::Owner]] C;"
> +
> +                      "template<class T>"
> +                      "class C {};"
> +
> +                      "C<int> c;",
> +                      classTemplateSpecializationDecl(
> +                          hasName("C"), hasAttr(clang::attr::Owner))));
>  }
>
>  TEST(OwnerPointer, LateForwardDeclOnly) {
> -  EXPECT_TRUE(matches(
> -    R"cpp(
> -      template<class T>
> -      class C;
> -
> -      template<class T>
> -      class C {};
> -
> -      template<class T>
> -      class [[gsl::Owner]] C;
> -
> -      C<int> c;
> -  )cpp",
> -    classTemplateSpecializationDecl(hasName("C"),
> hasAttr(clang::attr::Owner))));
> +  EXPECT_TRUE(matches("template<class T>"
> +                      "class C;"
> +
> +                      "template<class T>"
> +                      "class C {};"
> +
> +                      "template<class T>"
> +                      "class [[gsl::Owner]] C;"
> +
> +                      "C<int> c;",
> +                      classTemplateSpecializationDecl(
> +                          hasName("C"), hasAttr(clang::attr::Owner))));
>  }
>
>  } // namespace clang
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190906/03f58915/attachment-0001.html>


More information about the cfe-commits mailing list