Skip to content

FunctionDecl::getFunctionTypeLoc: ignore function type attributes #118420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

v01dXYZ
Copy link
Contributor

@v01dXYZ v01dXYZ commented Dec 3, 2024

Related to #118290.

Copy link

github-actions bot commented Dec 3, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@v01dXYZ v01dXYZ force-pushed the clang-func-decl-get-func-type-loc-when-func-attributes branch from c7e93d1 to b6f0130 Compare December 3, 2024 04:20

TypeLoc TL = TSI->getTypeLoc().IgnoreParens();

// ignore function type attributes
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there other sugars we need to ignore? e.g., a ParenType via:

void (foo)(int f) {}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know. But to implement it in its updated form, I mimicked getAsAdjusted. So currently, it supports ParenType and AttributedType. I think I should add MacroQualifiedType for example.


// ignore function type attributes
while (auto ATL = TL.getAs<AttributedTypeLoc>())
TL = ATL.getModifiedLoc();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't THINK we want this? We want to keep around the 'type' as modified by the attributed type (so if it is no_return, we want to make sure we have a noreturn function type for example). So I would think we would want the Equivalent type here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad I've made this error. I'll start by adding your example as a test.

Copy link
Collaborator

@erichkeane erichkeane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also needs tests here, plus perhaps a release note if this is something externally visible.

@v01dXYZ
Copy link
Contributor Author

v01dXYZ commented Dec 12, 2024

I've got to squash and reword the commits. Also, I'll add a line to the release stating now FunctionDecl getFunctionTypeLoc/getReturrnLoc now supports AnnotatedTypes.

@v01dXYZ v01dXYZ marked this pull request as ready for review December 16, 2024 14:26
@llvmbot llvmbot added clang Clang issues not falling into any other category clang-tools-extra clangd clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Dec 16, 2024
@llvmbot
Copy link
Member

llvmbot commented Dec 16, 2024

@llvm/pr-subscribers-clang

Author: Robert Dazi (v01dXYZ)

Changes

Related to #118290.


Full diff: https://github.com/llvm/llvm-project/pull/118420.diff

3 Files Affected:

  • (modified) clang-tools-extra/clangd/unittests/InlayHintTests.cpp (+8-6)
  • (modified) clang/lib/AST/Decl.cpp (+19-2)
  • (modified) clang/unittests/AST/AttrTest.cpp (+78)
diff --git a/clang-tools-extra/clangd/unittests/InlayHintTests.cpp b/clang-tools-extra/clangd/unittests/InlayHintTests.cpp
index 77d78b8777fe30..030e4995777060 100644
--- a/clang-tools-extra/clangd/unittests/InlayHintTests.cpp
+++ b/clang-tools-extra/clangd/unittests/InlayHintTests.cpp
@@ -1577,19 +1577,21 @@ TEST(TypeHints, Aliased) {
 }
 
 TEST(TypeHints, CallingConvention) {
-  // Check that we don't crash for lambdas without a FunctionTypeLoc
+  // Check that we don't crash for lambdas with an annotation
   // https://github.com/clangd/clangd/issues/2223
-  std::string Code = R"cpp(
+  Annotations Source(R"cpp(
     void test() {
-      []() __cdecl {};
+      []($lambda[[)]]__cdecl {};
     }
-  )cpp";
-  TestTU TU = TestTU::withCode(Code);
+  )cpp");
+  TestTU TU = TestTU::withCode(Source.code());
   TU.ExtraArgs.push_back("--target=x86_64-w64-mingw32");
   TU.PredefineMacros = true; // for the __cdecl
   auto AST = TU.build();
 
-  EXPECT_THAT(hintsOfKind(AST, InlayHintKind::Type), IsEmpty());
+  EXPECT_THAT(
+      hintsOfKind(AST, InlayHintKind::Type),
+      ElementsAre(HintMatcher(ExpectedHint{"-> void", "lambda"}, Source)));
 }
 
 TEST(TypeHints, Decltype) {
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 741e908cf9bc56..dcc2240c599b9c 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -3876,8 +3876,25 @@ bool FunctionDecl::doesDeclarationForceExternallyVisibleDefinition() const {
 
 FunctionTypeLoc FunctionDecl::getFunctionTypeLoc() const {
   const TypeSourceInfo *TSI = getTypeSourceInfo();
-  return TSI ? TSI->getTypeLoc().IgnoreParens().getAs<FunctionTypeLoc>()
-             : FunctionTypeLoc();
+
+  if (!TSI)
+    return FunctionTypeLoc();
+
+  TypeLoc TL = TSI->getTypeLoc();
+  FunctionTypeLoc FTL;
+
+  while (!(FTL = TL.getAs<FunctionTypeLoc>())) {
+    if (const auto PTL = TL.getAs<ParenTypeLoc>())
+      TL = PTL.getInnerLoc();
+    else if (const auto ATL = TL.getAs<AttributedTypeLoc>())
+      TL = ATL.getEquivalentTypeLoc();
+    else if (const auto MQTL = TL.getAs<MacroQualifiedTypeLoc>())
+      TL = MQTL.getInnerLoc();
+    else
+      break;
+  }
+
+  return FTL;
 }
 
 SourceRange FunctionDecl::getReturnTypeSourceRange() const {
diff --git a/clang/unittests/AST/AttrTest.cpp b/clang/unittests/AST/AttrTest.cpp
index 46c3f5729021ec..3be362895b77e8 100644
--- a/clang/unittests/AST/AttrTest.cpp
+++ b/clang/unittests/AST/AttrTest.cpp
@@ -86,6 +86,23 @@ TEST(Attr, AnnotateType) {
     struct S { int mem; };
     int [[clang::annotate_type("int")]]
     S::* [[clang::annotate_type("ptr_to_mem")]] ptr_to_member = &S::mem;
+
+    // Function Type Attributes
+    __attribute__((noreturn)) int f_noreturn();
+    __attribute__((preserve_most)) int f_cc_preserve_most();
+
+    #define PRESERVE_MOST __attribute__((preserve_most))
+    PRESERVE_MOST int f_macro_attribue();
+
+    int (__attribute__((preserve_most)) f_paren_attribute)();
+
+    int (
+      PRESERVE_MOST
+      (
+        __attribute__((warn_unused_result))
+        (f_w_paren_and_attr)
+      )
+    ) ();
   )cpp");
 
   {
@@ -153,6 +170,67 @@ TEST(Attr, AnnotateType) {
     EXPECT_EQ(IntTL.getType(), AST->getASTContext().IntTy);
   }
 
+  {
+    const FunctionDecl *Func = getFunctionNode(AST.get(), "f_noreturn");
+    const FunctionTypeLoc FTL = Func->getFunctionTypeLoc();
+    const FunctionType *FT = FTL.getTypePtr();
+
+    EXPECT_TRUE(FT->getNoReturnAttr());
+  }
+
+  {
+    const FunctionDecl *Func = getFunctionNode(AST.get(), "f_cc_preserve_most");
+    const FunctionTypeLoc FTL = Func->getFunctionTypeLoc();
+    const FunctionType *FT = FTL.getTypePtr();
+
+    EXPECT_TRUE(FT->getCallConv() == CC_PreserveMost);
+  }
+
+  {
+    for (auto should_have_func_type_loc : {
+             "f_macro_attribue",
+             "f_paren_attribute",
+             "f_w_paren_and_attr",
+         }) {
+      llvm::errs() << "O: " << should_have_func_type_loc << "\n";
+      const FunctionDecl *Func =
+          getFunctionNode(AST.get(), should_have_func_type_loc);
+
+      EXPECT_TRUE(Func->getFunctionTypeLoc());
+    }
+  }
+
+  // The following test verifies getFunctionTypeLoc returns a type
+  // which takes into account the attribute (instead of only the nake
+  // type).
+  //
+  // This is hard to do with C/C++ because it seems using a function
+  // type attribute with a C/C++ function declaration only results
+  // with either:
+  //
+  // 1. It does NOT produce any AttributedType (for example it only
+  //   sets one flag of the FunctionType's ExtInfo, e.g. NoReturn).
+  // 2. It produces an AttributedType with modified type and
+  //   equivalent type that are equal (for example, that's what
+  //   happens with Calling Convention attributes).
+  //
+  // Fortunately, ObjC has one specific function type attribute that
+  // creates an AttributedType with different modified type and
+  // equivalent type.
+  auto AST_ObjC = buildASTFromCodeWithArgs(
+      R"objc(
+    __attribute__((ns_returns_retained)) id f();
+  )objc",
+      {"-fobjc-arc", "-fsyntax-only", "-fobjc-runtime=macosx-10.7"},
+      "input.mm");
+  {
+    const FunctionDecl *f = getFunctionNode(AST_ObjC.get(), "f");
+    const FunctionTypeLoc FTL = f->getFunctionTypeLoc();
+
+    const FunctionType *FT = FTL.getTypePtr();
+    EXPECT_TRUE(FT->getExtInfo().getProducesResult());
+  }
+
   // Test type annotation on an `__auto_type` type in C mode.
   AST = buildASTFromCodeWithArgs(R"c(
     __auto_type [[clang::annotate_type("auto")]] auto_var = 1;

@llvmbot
Copy link
Member

llvmbot commented Dec 16, 2024

@llvm/pr-subscribers-clang-tools-extra

Author: Robert Dazi (v01dXYZ)

Changes

Related to #118290.


Full diff: https://github.com/llvm/llvm-project/pull/118420.diff

3 Files Affected:

  • (modified) clang-tools-extra/clangd/unittests/InlayHintTests.cpp (+8-6)
  • (modified) clang/lib/AST/Decl.cpp (+19-2)
  • (modified) clang/unittests/AST/AttrTest.cpp (+78)
diff --git a/clang-tools-extra/clangd/unittests/InlayHintTests.cpp b/clang-tools-extra/clangd/unittests/InlayHintTests.cpp
index 77d78b8777fe30..030e4995777060 100644
--- a/clang-tools-extra/clangd/unittests/InlayHintTests.cpp
+++ b/clang-tools-extra/clangd/unittests/InlayHintTests.cpp
@@ -1577,19 +1577,21 @@ TEST(TypeHints, Aliased) {
 }
 
 TEST(TypeHints, CallingConvention) {
-  // Check that we don't crash for lambdas without a FunctionTypeLoc
+  // Check that we don't crash for lambdas with an annotation
   // https://github.com/clangd/clangd/issues/2223
-  std::string Code = R"cpp(
+  Annotations Source(R"cpp(
     void test() {
-      []() __cdecl {};
+      []($lambda[[)]]__cdecl {};
     }
-  )cpp";
-  TestTU TU = TestTU::withCode(Code);
+  )cpp");
+  TestTU TU = TestTU::withCode(Source.code());
   TU.ExtraArgs.push_back("--target=x86_64-w64-mingw32");
   TU.PredefineMacros = true; // for the __cdecl
   auto AST = TU.build();
 
-  EXPECT_THAT(hintsOfKind(AST, InlayHintKind::Type), IsEmpty());
+  EXPECT_THAT(
+      hintsOfKind(AST, InlayHintKind::Type),
+      ElementsAre(HintMatcher(ExpectedHint{"-> void", "lambda"}, Source)));
 }
 
 TEST(TypeHints, Decltype) {
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 741e908cf9bc56..dcc2240c599b9c 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -3876,8 +3876,25 @@ bool FunctionDecl::doesDeclarationForceExternallyVisibleDefinition() const {
 
 FunctionTypeLoc FunctionDecl::getFunctionTypeLoc() const {
   const TypeSourceInfo *TSI = getTypeSourceInfo();
-  return TSI ? TSI->getTypeLoc().IgnoreParens().getAs<FunctionTypeLoc>()
-             : FunctionTypeLoc();
+
+  if (!TSI)
+    return FunctionTypeLoc();
+
+  TypeLoc TL = TSI->getTypeLoc();
+  FunctionTypeLoc FTL;
+
+  while (!(FTL = TL.getAs<FunctionTypeLoc>())) {
+    if (const auto PTL = TL.getAs<ParenTypeLoc>())
+      TL = PTL.getInnerLoc();
+    else if (const auto ATL = TL.getAs<AttributedTypeLoc>())
+      TL = ATL.getEquivalentTypeLoc();
+    else if (const auto MQTL = TL.getAs<MacroQualifiedTypeLoc>())
+      TL = MQTL.getInnerLoc();
+    else
+      break;
+  }
+
+  return FTL;
 }
 
 SourceRange FunctionDecl::getReturnTypeSourceRange() const {
diff --git a/clang/unittests/AST/AttrTest.cpp b/clang/unittests/AST/AttrTest.cpp
index 46c3f5729021ec..3be362895b77e8 100644
--- a/clang/unittests/AST/AttrTest.cpp
+++ b/clang/unittests/AST/AttrTest.cpp
@@ -86,6 +86,23 @@ TEST(Attr, AnnotateType) {
     struct S { int mem; };
     int [[clang::annotate_type("int")]]
     S::* [[clang::annotate_type("ptr_to_mem")]] ptr_to_member = &S::mem;
+
+    // Function Type Attributes
+    __attribute__((noreturn)) int f_noreturn();
+    __attribute__((preserve_most)) int f_cc_preserve_most();
+
+    #define PRESERVE_MOST __attribute__((preserve_most))
+    PRESERVE_MOST int f_macro_attribue();
+
+    int (__attribute__((preserve_most)) f_paren_attribute)();
+
+    int (
+      PRESERVE_MOST
+      (
+        __attribute__((warn_unused_result))
+        (f_w_paren_and_attr)
+      )
+    ) ();
   )cpp");
 
   {
@@ -153,6 +170,67 @@ TEST(Attr, AnnotateType) {
     EXPECT_EQ(IntTL.getType(), AST->getASTContext().IntTy);
   }
 
+  {
+    const FunctionDecl *Func = getFunctionNode(AST.get(), "f_noreturn");
+    const FunctionTypeLoc FTL = Func->getFunctionTypeLoc();
+    const FunctionType *FT = FTL.getTypePtr();
+
+    EXPECT_TRUE(FT->getNoReturnAttr());
+  }
+
+  {
+    const FunctionDecl *Func = getFunctionNode(AST.get(), "f_cc_preserve_most");
+    const FunctionTypeLoc FTL = Func->getFunctionTypeLoc();
+    const FunctionType *FT = FTL.getTypePtr();
+
+    EXPECT_TRUE(FT->getCallConv() == CC_PreserveMost);
+  }
+
+  {
+    for (auto should_have_func_type_loc : {
+             "f_macro_attribue",
+             "f_paren_attribute",
+             "f_w_paren_and_attr",
+         }) {
+      llvm::errs() << "O: " << should_have_func_type_loc << "\n";
+      const FunctionDecl *Func =
+          getFunctionNode(AST.get(), should_have_func_type_loc);
+
+      EXPECT_TRUE(Func->getFunctionTypeLoc());
+    }
+  }
+
+  // The following test verifies getFunctionTypeLoc returns a type
+  // which takes into account the attribute (instead of only the nake
+  // type).
+  //
+  // This is hard to do with C/C++ because it seems using a function
+  // type attribute with a C/C++ function declaration only results
+  // with either:
+  //
+  // 1. It does NOT produce any AttributedType (for example it only
+  //   sets one flag of the FunctionType's ExtInfo, e.g. NoReturn).
+  // 2. It produces an AttributedType with modified type and
+  //   equivalent type that are equal (for example, that's what
+  //   happens with Calling Convention attributes).
+  //
+  // Fortunately, ObjC has one specific function type attribute that
+  // creates an AttributedType with different modified type and
+  // equivalent type.
+  auto AST_ObjC = buildASTFromCodeWithArgs(
+      R"objc(
+    __attribute__((ns_returns_retained)) id f();
+  )objc",
+      {"-fobjc-arc", "-fsyntax-only", "-fobjc-runtime=macosx-10.7"},
+      "input.mm");
+  {
+    const FunctionDecl *f = getFunctionNode(AST_ObjC.get(), "f");
+    const FunctionTypeLoc FTL = f->getFunctionTypeLoc();
+
+    const FunctionType *FT = FTL.getTypePtr();
+    EXPECT_TRUE(FT->getExtInfo().getProducesResult());
+  }
+
   // Test type annotation on an `__auto_type` type in C mode.
   AST = buildASTFromCodeWithArgs(R"c(
     __auto_type [[clang::annotate_type("auto")]] auto_var = 1;

@llvmbot
Copy link
Member

llvmbot commented Dec 16, 2024

@llvm/pr-subscribers-clangd

Author: Robert Dazi (v01dXYZ)

Changes

Related to #118290.


Full diff: https://github.com/llvm/llvm-project/pull/118420.diff

3 Files Affected:

  • (modified) clang-tools-extra/clangd/unittests/InlayHintTests.cpp (+8-6)
  • (modified) clang/lib/AST/Decl.cpp (+19-2)
  • (modified) clang/unittests/AST/AttrTest.cpp (+78)
diff --git a/clang-tools-extra/clangd/unittests/InlayHintTests.cpp b/clang-tools-extra/clangd/unittests/InlayHintTests.cpp
index 77d78b8777fe30..030e4995777060 100644
--- a/clang-tools-extra/clangd/unittests/InlayHintTests.cpp
+++ b/clang-tools-extra/clangd/unittests/InlayHintTests.cpp
@@ -1577,19 +1577,21 @@ TEST(TypeHints, Aliased) {
 }
 
 TEST(TypeHints, CallingConvention) {
-  // Check that we don't crash for lambdas without a FunctionTypeLoc
+  // Check that we don't crash for lambdas with an annotation
   // https://github.com/clangd/clangd/issues/2223
-  std::string Code = R"cpp(
+  Annotations Source(R"cpp(
     void test() {
-      []() __cdecl {};
+      []($lambda[[)]]__cdecl {};
     }
-  )cpp";
-  TestTU TU = TestTU::withCode(Code);
+  )cpp");
+  TestTU TU = TestTU::withCode(Source.code());
   TU.ExtraArgs.push_back("--target=x86_64-w64-mingw32");
   TU.PredefineMacros = true; // for the __cdecl
   auto AST = TU.build();
 
-  EXPECT_THAT(hintsOfKind(AST, InlayHintKind::Type), IsEmpty());
+  EXPECT_THAT(
+      hintsOfKind(AST, InlayHintKind::Type),
+      ElementsAre(HintMatcher(ExpectedHint{"-> void", "lambda"}, Source)));
 }
 
 TEST(TypeHints, Decltype) {
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 741e908cf9bc56..dcc2240c599b9c 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -3876,8 +3876,25 @@ bool FunctionDecl::doesDeclarationForceExternallyVisibleDefinition() const {
 
 FunctionTypeLoc FunctionDecl::getFunctionTypeLoc() const {
   const TypeSourceInfo *TSI = getTypeSourceInfo();
-  return TSI ? TSI->getTypeLoc().IgnoreParens().getAs<FunctionTypeLoc>()
-             : FunctionTypeLoc();
+
+  if (!TSI)
+    return FunctionTypeLoc();
+
+  TypeLoc TL = TSI->getTypeLoc();
+  FunctionTypeLoc FTL;
+
+  while (!(FTL = TL.getAs<FunctionTypeLoc>())) {
+    if (const auto PTL = TL.getAs<ParenTypeLoc>())
+      TL = PTL.getInnerLoc();
+    else if (const auto ATL = TL.getAs<AttributedTypeLoc>())
+      TL = ATL.getEquivalentTypeLoc();
+    else if (const auto MQTL = TL.getAs<MacroQualifiedTypeLoc>())
+      TL = MQTL.getInnerLoc();
+    else
+      break;
+  }
+
+  return FTL;
 }
 
 SourceRange FunctionDecl::getReturnTypeSourceRange() const {
diff --git a/clang/unittests/AST/AttrTest.cpp b/clang/unittests/AST/AttrTest.cpp
index 46c3f5729021ec..3be362895b77e8 100644
--- a/clang/unittests/AST/AttrTest.cpp
+++ b/clang/unittests/AST/AttrTest.cpp
@@ -86,6 +86,23 @@ TEST(Attr, AnnotateType) {
     struct S { int mem; };
     int [[clang::annotate_type("int")]]
     S::* [[clang::annotate_type("ptr_to_mem")]] ptr_to_member = &S::mem;
+
+    // Function Type Attributes
+    __attribute__((noreturn)) int f_noreturn();
+    __attribute__((preserve_most)) int f_cc_preserve_most();
+
+    #define PRESERVE_MOST __attribute__((preserve_most))
+    PRESERVE_MOST int f_macro_attribue();
+
+    int (__attribute__((preserve_most)) f_paren_attribute)();
+
+    int (
+      PRESERVE_MOST
+      (
+        __attribute__((warn_unused_result))
+        (f_w_paren_and_attr)
+      )
+    ) ();
   )cpp");
 
   {
@@ -153,6 +170,67 @@ TEST(Attr, AnnotateType) {
     EXPECT_EQ(IntTL.getType(), AST->getASTContext().IntTy);
   }
 
+  {
+    const FunctionDecl *Func = getFunctionNode(AST.get(), "f_noreturn");
+    const FunctionTypeLoc FTL = Func->getFunctionTypeLoc();
+    const FunctionType *FT = FTL.getTypePtr();
+
+    EXPECT_TRUE(FT->getNoReturnAttr());
+  }
+
+  {
+    const FunctionDecl *Func = getFunctionNode(AST.get(), "f_cc_preserve_most");
+    const FunctionTypeLoc FTL = Func->getFunctionTypeLoc();
+    const FunctionType *FT = FTL.getTypePtr();
+
+    EXPECT_TRUE(FT->getCallConv() == CC_PreserveMost);
+  }
+
+  {
+    for (auto should_have_func_type_loc : {
+             "f_macro_attribue",
+             "f_paren_attribute",
+             "f_w_paren_and_attr",
+         }) {
+      llvm::errs() << "O: " << should_have_func_type_loc << "\n";
+      const FunctionDecl *Func =
+          getFunctionNode(AST.get(), should_have_func_type_loc);
+
+      EXPECT_TRUE(Func->getFunctionTypeLoc());
+    }
+  }
+
+  // The following test verifies getFunctionTypeLoc returns a type
+  // which takes into account the attribute (instead of only the nake
+  // type).
+  //
+  // This is hard to do with C/C++ because it seems using a function
+  // type attribute with a C/C++ function declaration only results
+  // with either:
+  //
+  // 1. It does NOT produce any AttributedType (for example it only
+  //   sets one flag of the FunctionType's ExtInfo, e.g. NoReturn).
+  // 2. It produces an AttributedType with modified type and
+  //   equivalent type that are equal (for example, that's what
+  //   happens with Calling Convention attributes).
+  //
+  // Fortunately, ObjC has one specific function type attribute that
+  // creates an AttributedType with different modified type and
+  // equivalent type.
+  auto AST_ObjC = buildASTFromCodeWithArgs(
+      R"objc(
+    __attribute__((ns_returns_retained)) id f();
+  )objc",
+      {"-fobjc-arc", "-fsyntax-only", "-fobjc-runtime=macosx-10.7"},
+      "input.mm");
+  {
+    const FunctionDecl *f = getFunctionNode(AST_ObjC.get(), "f");
+    const FunctionTypeLoc FTL = f->getFunctionTypeLoc();
+
+    const FunctionType *FT = FTL.getTypePtr();
+    EXPECT_TRUE(FT->getExtInfo().getProducesResult());
+  }
+
   // Test type annotation on an `__auto_type` type in C mode.
   AST = buildASTFromCodeWithArgs(R"c(
     __auto_type [[clang::annotate_type("auto")]] auto_var = 1;

@HighCommander4
Copy link
Collaborator

Clangd changes LGTM

@v01dXYZ
Copy link
Contributor Author

v01dXYZ commented Dec 16, 2024

Reminder to myself: the documentation comment for getFunctionTypeLoc maybe needs to be modified to indicate support for annotated function.

The comment doesn't seem to need any modifications (actually this patch makes the function behaves closer to the comment).

@resistor resistor merged commit 19c708c into llvm:main Apr 19, 2025
11 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 19, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-win-fast running on as-builder-3 while building clang-tools-extra,clang at step 8 "test-build-unified-tree-check-clang-unit".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/2/builds/22043

Here is the relevant piece of the build log for the reference
Step 8 (test-build-unified-tree-check-clang-unit) failure: test (failure)
******************** TEST 'Clang-Unit :: AST/./ASTTests.exe/54/115' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:C:\buildbot\as-builder-3\llvm-clang-x86_64-win-fast\build\tools\clang\unittests\AST\.\ASTTests.exe-Clang-Unit-9516-54-115.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=115 GTEST_SHARD_INDEX=54 C:\buildbot\as-builder-3\llvm-clang-x86_64-win-fast\build\tools\clang\unittests\AST\.\ASTTests.exe
--

Script:
--
C:\buildbot\as-builder-3\llvm-clang-x86_64-win-fast\build\tools\clang\unittests\AST\.\ASTTests.exe --gtest_filter=Attr.AnnotateType
--
input.cc:16:20: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   16 |     __attribute__((preserve_most)) int f_cc_preserve_most();
      |                    ^
input.cc:19:5: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   19 |     PRESERVE_MOST int f_macro_attribue();
      |     ^
input.cc:18:42: note: expanded from macro 'PRESERVE_MOST'
   18 |     #define PRESERVE_MOST __attribute__((preserve_most))
      |                                          ^
input.cc:21:25: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   21 |     int (__attribute__((preserve_most)) f_paren_attribute)();
      |                         ^
input.cc:24:7: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   24 |       PRESERVE_MOST
      |       ^
input.cc:18:42: note: expanded from macro 'PRESERVE_MOST'
   18 |     #define PRESERVE_MOST __attribute__((preserve_most))
      |                                          ^
C:\buildbot\as-builder-3\llvm-clang-x86_64-win-fast\llvm-project\clang\unittests\AST\AttrTest.cpp(186): error: Value of: FT->getCallConv() == CC_PreserveMost
  Actual: false
Expected: true

O: f_macro_attribue
O: f_paren_attribute
O: f_w_paren_and_attr

C:\buildbot\as-builder-3\llvm-clang-x86_64-win-fast\llvm-project\clang\unittests\AST\AttrTest.cpp:186
Value of: FT->getCallConv() == CC_PreserveMost
  Actual: false
Expected: true



********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 19, 2025

LLVM Buildbot has detected a new failure on builder clang-armv8-quick running on linaro-clang-armv8-quick while building clang-tools-extra,clang at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/154/builds/15066

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'Clang-Unit :: AST/./ASTTests/54/231' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/tools/clang/unittests/AST/./ASTTests-Clang-Unit-3042996-54-231.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=231 GTEST_SHARD_INDEX=54 /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/tools/clang/unittests/AST/./ASTTests
--

Script:
--
/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/tools/clang/unittests/AST/./ASTTests --gtest_filter=Attr.AnnotateType
--
input.cc:16:20: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   16 |     __attribute__((preserve_most)) int f_cc_preserve_most();
      |                    ^
input.cc:19:5: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   19 |     PRESERVE_MOST int f_macro_attribue();
      |     ^
input.cc:18:42: note: expanded from macro 'PRESERVE_MOST'
   18 |     #define PRESERVE_MOST __attribute__((preserve_most))
      |                                          ^
input.cc:21:25: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   21 |     int (__attribute__((preserve_most)) f_paren_attribute)();
      |                         ^
input.cc:24:7: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   24 |       PRESERVE_MOST
      |       ^
input.cc:18:42: note: expanded from macro 'PRESERVE_MOST'
   18 |     #define PRESERVE_MOST __attribute__((preserve_most))
      |                                          ^
../llvm/clang/unittests/AST/AttrTest.cpp:186: Failure
Value of: FT->getCallConv() == CC_PreserveMost
  Actual: false
Expected: true

O: f_macro_attribue
O: f_paren_attribute
O: f_w_paren_and_attr

../llvm/clang/unittests/AST/AttrTest.cpp:186
Value of: FT->getCallConv() == CC_PreserveMost
  Actual: false
Expected: true



********************


resistor added a commit that referenced this pull request Apr 19, 2025
…utes (#118420)"

This reverts commit 19c708c because it caused test failures on non-x86 targets.
@resistor
Copy link
Collaborator

Reverted as the test fails on non-x86 targets. Will fix and re-PR.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 19, 2025

LLVM Buildbot has detected a new failure on builder clang-ppc64le-linux-test-suite running on ppc64le-clang-test-suite while building clang-tools-extra,clang at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/95/builds/12222

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'Clang-Unit :: AST/./ASTTests/54/1844' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/tools/clang/unittests/AST/./ASTTests-Clang-Unit-3583131-54-1844.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=1844 GTEST_SHARD_INDEX=54 /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/tools/clang/unittests/AST/./ASTTests
--

Script:
--
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/tools/clang/unittests/AST/./ASTTests --gtest_filter=Attr.AnnotateType
--
input.cc:16:20: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   16 |     __attribute__((preserve_most)) int f_cc_preserve_most();
      |                    ^
input.cc:19:5: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   19 |     PRESERVE_MOST int f_macro_attribue();
      |     ^
input.cc:18:42: note: expanded from macro 'PRESERVE_MOST'
   18 |     #define PRESERVE_MOST __attribute__((preserve_most))
      |                                          ^
input.cc:21:25: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   21 |     int (__attribute__((preserve_most)) f_paren_attribute)();
      |                         ^
input.cc:24:7: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   24 |       PRESERVE_MOST
      |       ^
input.cc:18:42: note: expanded from macro 'PRESERVE_MOST'
   18 |     #define PRESERVE_MOST __attribute__((preserve_most))
      |                                          ^
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/clang/unittests/AST/AttrTest.cpp:186: Failure
Value of: FT->getCallConv() == CC_PreserveMost
  Actual: false
Expected: true

O: f_macro_attribue
O: f_paren_attribute
O: f_w_paren_and_attr

/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/clang/unittests/AST/AttrTest.cpp:186
Value of: FT->getCallConv() == CC_PreserveMost
  Actual: false
Expected: true



********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 19, 2025

LLVM Buildbot has detected a new failure on builder ppc64le-lld-multistage-test running on ppc64le-lld-multistage-test while building clang-tools-extra,clang at step 7 "test-build-stage1-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/168/builds/11058

Here is the relevant piece of the build log for the reference
Step 7 (test-build-stage1-unified-tree-check-all) failure: test (failure)
******************** TEST 'Clang-Unit :: AST/./ASTTests/54/1844' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage1/tools/clang/unittests/AST/./ASTTests-Clang-Unit-2338714-54-1844.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=1844 GTEST_SHARD_INDEX=54 /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage1/tools/clang/unittests/AST/./ASTTests
--

Script:
--
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage1/tools/clang/unittests/AST/./ASTTests --gtest_filter=Attr.AnnotateType
--
input.cc:16:20: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   16 |     __attribute__((preserve_most)) int f_cc_preserve_most();
      |                    ^
input.cc:19:5: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   19 |     PRESERVE_MOST int f_macro_attribue();
      |     ^
input.cc:18:42: note: expanded from macro 'PRESERVE_MOST'
   18 |     #define PRESERVE_MOST __attribute__((preserve_most))
      |                                          ^
input.cc:21:25: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   21 |     int (__attribute__((preserve_most)) f_paren_attribute)();
      |                         ^
input.cc:24:7: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   24 |       PRESERVE_MOST
      |       ^
input.cc:18:42: note: expanded from macro 'PRESERVE_MOST'
   18 |     #define PRESERVE_MOST __attribute__((preserve_most))
      |                                          ^
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/unittests/AST/AttrTest.cpp:186: Failure
Value of: FT->getCallConv() == CC_PreserveMost
  Actual: false
Expected: true

O: f_macro_attribue
O: f_paren_attribute
O: f_w_paren_and_attr

/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/unittests/AST/AttrTest.cpp:186
Value of: FT->getCallConv() == CC_PreserveMost
  Actual: false
Expected: true



********************

Step 13 (test-build-stage2-unified-tree-check-all) failure: test (failure)
******************** TEST 'Clang-Unit :: AST/./ASTTests/54/1844' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage2/tools/clang/unittests/AST/./ASTTests-Clang-Unit-1682478-54-1844.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=1844 GTEST_SHARD_INDEX=54 /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage2/tools/clang/unittests/AST/./ASTTests
--

Script:
--
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage2/tools/clang/unittests/AST/./ASTTests --gtest_filter=Attr.AnnotateType
--
input.cc:16:20: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   16 |     __attribute__((preserve_most)) int f_cc_preserve_most();
      |                    ^
input.cc:19:5: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   19 |     PRESERVE_MOST int f_macro_attribue();
      |     ^
input.cc:18:42: note: expanded from macro 'PRESERVE_MOST'
   18 |     #define PRESERVE_MOST __attribute__((preserve_most))
      |                                          ^
input.cc:21:25: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   21 |     int (__attribute__((preserve_most)) f_paren_attribute)();
      |                         ^
input.cc:24:7: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   24 |       PRESERVE_MOST
      |       ^
input.cc:18:42: note: expanded from macro 'PRESERVE_MOST'
   18 |     #define PRESERVE_MOST __attribute__((preserve_most))
      |                                          ^
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/unittests/AST/AttrTest.cpp:186: Failure
Value of: FT->getCallConv() == CC_PreserveMost
  Actual: false
Expected: true

O: f_macro_attribue
O: f_paren_attribute
O: f_w_paren_and_attr

/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/unittests/AST/AttrTest.cpp:186
Value of: FT->getCallConv() == CC_PreserveMost
  Actual: false
Expected: true



********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 19, 2025

LLVM Buildbot has detected a new failure on builder clang-ppc64le-linux-multistage running on ppc64le-clang-multistage-test while building clang-tools-extra,clang at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/76/builds/8880

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'Clang-Unit :: AST/./ASTTests/54/1844' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/tools/clang/unittests/AST/./ASTTests-Clang-Unit-3566841-54-1844.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=1844 GTEST_SHARD_INDEX=54 /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/tools/clang/unittests/AST/./ASTTests
--

Script:
--
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/tools/clang/unittests/AST/./ASTTests --gtest_filter=Attr.AnnotateType
--
input.cc:16:20: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   16 |     __attribute__((preserve_most)) int f_cc_preserve_most();
      |                    ^
input.cc:19:5: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   19 |     PRESERVE_MOST int f_macro_attribue();
      |     ^
input.cc:18:42: note: expanded from macro 'PRESERVE_MOST'
   18 |     #define PRESERVE_MOST __attribute__((preserve_most))
      |                                          ^
input.cc:21:25: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   21 |     int (__attribute__((preserve_most)) f_paren_attribute)();
      |                         ^
input.cc:24:7: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   24 |       PRESERVE_MOST
      |       ^
input.cc:18:42: note: expanded from macro 'PRESERVE_MOST'
   18 |     #define PRESERVE_MOST __attribute__((preserve_most))
      |                                          ^
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang/unittests/AST/AttrTest.cpp:186: Failure
Value of: FT->getCallConv() == CC_PreserveMost
  Actual: false
Expected: true

O: f_macro_attribue
O: f_paren_attribute
O: f_w_paren_and_attr

/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang/unittests/AST/AttrTest.cpp:186
Value of: FT->getCallConv() == CC_PreserveMost
  Actual: false
Expected: true



********************

Step 11 (ninja check 2) failure: stage 2 checked (failure)
******************** TEST 'Clang-Unit :: AST/./ASTTests/54/1844' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/tools/clang/unittests/AST/./ASTTests-Clang-Unit-626075-54-1844.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=1844 GTEST_SHARD_INDEX=54 /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/tools/clang/unittests/AST/./ASTTests
--

Script:
--
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/tools/clang/unittests/AST/./ASTTests --gtest_filter=Attr.AnnotateType
--
input.cc:16:20: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   16 |     __attribute__((preserve_most)) int f_cc_preserve_most();
      |                    ^
input.cc:19:5: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   19 |     PRESERVE_MOST int f_macro_attribue();
      |     ^
input.cc:18:42: note: expanded from macro 'PRESERVE_MOST'
   18 |     #define PRESERVE_MOST __attribute__((preserve_most))
      |                                          ^
input.cc:21:25: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   21 |     int (__attribute__((preserve_most)) f_paren_attribute)();
      |                         ^
input.cc:24:7: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   24 |       PRESERVE_MOST
      |       ^
input.cc:18:42: note: expanded from macro 'PRESERVE_MOST'
   18 |     #define PRESERVE_MOST __attribute__((preserve_most))
      |                                          ^
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang/unittests/AST/AttrTest.cpp:186: Failure
Value of: FT->getCallConv() == CC_PreserveMost
  Actual: false
Expected: true

O: f_macro_attribue
O: f_paren_attribute
O: f_w_paren_and_attr

/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang/unittests/AST/AttrTest.cpp:186
Value of: FT->getCallConv() == CC_PreserveMost
  Actual: false
Expected: true



********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 19, 2025

LLVM Buildbot has detected a new failure on builder clang-ppc64le-rhel running on ppc64le-clang-rhel-test while building clang-tools-extra,clang at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/145/builds/6465

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'Clang-Unit :: AST/./ASTTests/54/231' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/tools/clang/unittests/AST/./ASTTests-Clang-Unit-1752074-54-231.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=231 GTEST_SHARD_INDEX=54 /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/tools/clang/unittests/AST/./ASTTests
--

Script:
--
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/tools/clang/unittests/AST/./ASTTests --gtest_filter=Attr.AnnotateType
--
input.cc:16:20: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   16 |     __attribute__((preserve_most)) int f_cc_preserve_most();
      |                    ^
input.cc:19:5: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   19 |     PRESERVE_MOST int f_macro_attribue();
      |     ^
input.cc:18:42: note: expanded from macro 'PRESERVE_MOST'
   18 |     #define PRESERVE_MOST __attribute__((preserve_most))
      |                                          ^
input.cc:21:25: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   21 |     int (__attribute__((preserve_most)) f_paren_attribute)();
      |                         ^
input.cc:24:7: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   24 |       PRESERVE_MOST
      |       ^
input.cc:18:42: note: expanded from macro 'PRESERVE_MOST'
   18 |     #define PRESERVE_MOST __attribute__((preserve_most))
      |                                          ^
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/clang/unittests/AST/AttrTest.cpp:186: Failure
Value of: FT->getCallConv() == CC_PreserveMost
  Actual: false
Expected: true

O: f_macro_attribue
O: f_paren_attribute
O: f_w_paren_and_attr

/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/clang/unittests/AST/AttrTest.cpp:186
Value of: FT->getCallConv() == CC_PreserveMost
  Actual: false
Expected: true



********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 19, 2025

LLVM Buildbot has detected a new failure on builder clang-armv7-global-isel running on linaro-clang-armv7-global-isel while building clang-tools-extra,clang at step 7 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/39/builds/5722

Here is the relevant piece of the build log for the reference
Step 7 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'Clang-Unit :: AST/./ASTTests/9/15' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/tools/clang/unittests/AST/./ASTTests-Clang-Unit-2672158-9-15.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=15 GTEST_SHARD_INDEX=9 /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/tools/clang/unittests/AST/./ASTTests
--

Script:
--
/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/tools/clang/unittests/AST/./ASTTests --gtest_filter=Attr.AnnotateType
--
input.cc:16:20: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   16 |     __attribute__((preserve_most)) int f_cc_preserve_most();
      |                    ^
input.cc:19:5: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   19 |     PRESERVE_MOST int f_macro_attribue();
      |     ^
input.cc:18:42: note: expanded from macro 'PRESERVE_MOST'
   18 |     #define PRESERVE_MOST __attribute__((preserve_most))
      |                                          ^
input.cc:21:25: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   21 |     int (__attribute__((preserve_most)) f_paren_attribute)();
      |                         ^
input.cc:24:7: warning: 'preserve_most' calling convention is not supported for this target [-Wignored-attributes]
   24 |       PRESERVE_MOST
      |       ^
input.cc:18:42: note: expanded from macro 'PRESERVE_MOST'
   18 |     #define PRESERVE_MOST __attribute__((preserve_most))
      |                                          ^
../llvm/clang/unittests/AST/AttrTest.cpp:186: Failure
Value of: FT->getCallConv() == CC_PreserveMost
  Actual: false
Expected: true

O: f_macro_attribue
O: f_paren_attribute
O: f_w_paren_and_attr

../llvm/clang/unittests/AST/AttrTest.cpp:186
Value of: FT->getCallConv() == CC_PreserveMost
  Actual: false
Expected: true



********************


resistor added a commit that referenced this pull request Apr 21, 2025
…pe attributes (#118420)" (#136484)

Avoid using PreservesMost in the testcase as it is not supported on all
targets.

Original PR #118290.

Co-authored-by: Robert Dazi <[email protected]>
Co-authored-by: v01dxyz <[email protected]>
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…utes (llvm#118420)"

This reverts commit 19c708c because it caused test failures on non-x86 targets.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…pe attributes (llvm#118420)" (llvm#136484)

Avoid using PreservesMost in the testcase as it is not supported on all
targets.

Original PR llvm#118290.

Co-authored-by: Robert Dazi <[email protected]>
Co-authored-by: v01dxyz <[email protected]>
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…utes (llvm#118420)"

This reverts commit 19c708c because it caused test failures on non-x86 targets.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…pe attributes (llvm#118420)" (llvm#136484)

Avoid using PreservesMost in the testcase as it is not supported on all
targets.

Original PR llvm#118290.

Co-authored-by: Robert Dazi <[email protected]>
Co-authored-by: v01dxyz <[email protected]>
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…utes (llvm#118420)"

This reverts commit 19c708c because it caused test failures on non-x86 targets.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…pe attributes (llvm#118420)" (llvm#136484)

Avoid using PreservesMost in the testcase as it is not supported on all
targets.

Original PR llvm#118290.

Co-authored-by: Robert Dazi <[email protected]>
Co-authored-by: v01dxyz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category clang-tools-extra clangd
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants