[clang] [clang-cl] Fix value of __FUNCTION__ in MSVC mode. (PR #84014)

via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 14 06:18:50 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 93e423f19fc5317ee208f77d8f36e677db124cc8 4b42f76d5c1e5439311cc8153ef9530be2625840 -- clang/include/clang/AST/Expr.h clang/lib/AST/DeclPrinter.cpp clang/lib/AST/Expr.cpp clang/lib/AST/TypePrinter.cpp clang/lib/Sema/SemaExpr.cpp clang/test/Analysis/eval-predefined-exprs.cpp clang/test/SemaCXX/source_location.cpp clang/unittests/AST/DeclPrinterTest.cpp clang/unittests/AST/TypePrinterTest.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/unittests/AST/DeclPrinterTest.cpp b/clang/unittests/AST/DeclPrinterTest.cpp
index 06829313b5..e024c41e03 100644
--- a/clang/unittests/AST/DeclPrinterTest.cpp
+++ b/clang/unittests/AST/DeclPrinterTest.cpp
@@ -359,18 +359,18 @@ TEST(DeclPrinter, TestCXXRecordDecl11) {
 }
 
 TEST(DeclPrinter, TestCXXRecordDecl12) {
-  ASSERT_TRUE(PrintedDeclCXX98Matches(
-      "struct S { int x; };"
-      "namespace NS { class C {};}"
-      "void foo() {using namespace NS; C c;}",
-      "foo",
-      "void foo() {\nusing namespace NS;\nclass "
-      "NS::C c;\n}\n",
-      [](PrintingPolicy &Policy) {
-        Policy.SuppressTagKeyword = false;
-        Policy.SuppressScope = true;
-        Policy.TerseOutput = false;
-      }));
+  ASSERT_TRUE(
+      PrintedDeclCXX98Matches("struct S { int x; };"
+                              "namespace NS { class C {};}"
+                              "void foo() {using namespace NS; C c;}",
+                              "foo",
+                              "void foo() {\nusing namespace NS;\nclass "
+                              "NS::C c;\n}\n",
+                              [](PrintingPolicy &Policy) {
+                                Policy.SuppressTagKeyword = false;
+                                Policy.SuppressScope = true;
+                                Policy.TerseOutput = false;
+                              }));
 }
 
 TEST(DeclPrinter, TestCXXRecordDecl13) {
@@ -378,9 +378,7 @@ TEST(DeclPrinter, TestCXXRecordDecl13) {
       "struct S { int x; };"
       "S s1;"
       "S foo() {return s1;}",
-      "foo",
-      "struct S foo() {\nreturn s1;\n}\n",
-      [](PrintingPolicy &Policy) {
+      "foo", "struct S foo() {\nreturn s1;\n}\n", [](PrintingPolicy &Policy) {
         Policy.SuppressTagKeyword = false;
         Policy.SuppressScope = true;
         Policy.TerseOutput = false;
@@ -391,8 +389,7 @@ TEST(DeclPrinter, TestCXXRecordDecl14) {
   ASSERT_TRUE(PrintedDeclCXX98Matches(
       "struct S { int x; };"
       "S foo(S s1) {return s1;}",
-      "foo",
-      "struct S foo(struct S s1) {\nreturn s1;\n}\n",
+      "foo", "struct S foo(struct S s1) {\nreturn s1;\n}\n",
       [](PrintingPolicy &Policy) {
         Policy.SuppressTagKeyword = false;
         Policy.SuppressScope = true;
diff --git a/clang/unittests/AST/TypePrinterTest.cpp b/clang/unittests/AST/TypePrinterTest.cpp
index 2cdab5d1d3..494085a2eb 100644
--- a/clang/unittests/AST/TypePrinterTest.cpp
+++ b/clang/unittests/AST/TypePrinterTest.cpp
@@ -156,21 +156,19 @@ TEST(TypePrinter, TemplateIdWithNTTP) {
 }
 
 TEST(TypePrinter, TemplateArgumentsSubstitution) {
-     constexpr char Code[] = R"cpp(
+  constexpr char Code[] = R"cpp(
        template <typename Y> class X {};
        typedef X<int> A;
        int foo() {
           return sizeof(A);
        }
   )cpp";
-  auto Matcher = typedefNameDecl(hasName("A"),
-                                 hasType(qualType().bind("id")));
-  ASSERT_TRUE(PrintedTypeMatches(
-      Code, {}, Matcher, "X<int>",
-     [](PrintingPolicy &Policy) {
-       Policy.SuppressTagKeyword = false;
-       Policy.SuppressScope = true;
-     }));
+  auto Matcher = typedefNameDecl(hasName("A"), hasType(qualType().bind("id")));
+  ASSERT_TRUE(PrintedTypeMatches(Code, {}, Matcher, "X<int>",
+                                 [](PrintingPolicy &Policy) {
+                                   Policy.SuppressTagKeyword = false;
+                                   Policy.SuppressScope = true;
+                                 }));
 }
 
 TEST(TypePrinter, TemplateArgumentsSubstitution_Expressions) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/84014


More information about the cfe-commits mailing list