Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[NFC][Clang] Adopt simplified getTrailingObjects in ASTConcept #139974

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

Merged
merged 1 commit into from
May 15, 2025

Conversation

jurahul
Copy link
Contributor

@jurahul jurahul commented May 14, 2025

Use non-templated form of getTrailingObjects when using a single trailing type in TrailingObjects.

Use non-templated form of `getTrailingObjects` when using a single
trailing type in `TrailingObjects`.
@jurahul jurahul marked this pull request as ready for review May 15, 2025 00:50
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels May 15, 2025
@jurahul jurahul requested a review from usx95 May 15, 2025 00:51
@llvmbot
Copy link
Member

llvmbot commented May 15, 2025

@llvm/pr-subscribers-clang

Author: Rahul Joshi (jurahul)

Changes

Use non-templated form of getTrailingObjects when using a single trailing type in TrailingObjects.


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

2 Files Affected:

  • (modified) clang/include/clang/AST/ASTConcept.h (+2-2)
  • (modified) clang/lib/AST/ASTConcept.cpp (+4-6)
diff --git a/clang/include/clang/AST/ASTConcept.h b/clang/include/clang/AST/ASTConcept.h
index 078e1e848f393..c8f6330a73bb1 100644
--- a/clang/include/clang/AST/ASTConcept.h
+++ b/clang/include/clang/AST/ASTConcept.h
@@ -93,11 +93,11 @@ struct ASTConstraintSatisfaction final :
   bool ContainsErrors : 1;
 
   const UnsatisfiedConstraintRecord *begin() const {
-    return getTrailingObjects<UnsatisfiedConstraintRecord>();
+    return getTrailingObjects();
   }
 
   const UnsatisfiedConstraintRecord *end() const {
-    return getTrailingObjects<UnsatisfiedConstraintRecord>() + NumRecords;
+    return getTrailingObjects() + NumRecords;
   }
 
   ASTConstraintSatisfaction(const ASTContext &C,
diff --git a/clang/lib/AST/ASTConcept.cpp b/clang/lib/AST/ASTConcept.cpp
index f7ee0fb3ee92d..c9adccdbc77ef 100644
--- a/clang/lib/AST/ASTConcept.cpp
+++ b/clang/lib/AST/ASTConcept.cpp
@@ -40,9 +40,8 @@ ASTConstraintSatisfaction::ASTConstraintSatisfaction(
       IsSatisfied{Satisfaction.IsSatisfied}, ContainsErrors{
                                                  Satisfaction.ContainsErrors} {
   for (unsigned I = 0; I < NumRecords; ++I)
-    CreateUnsatisfiedConstraintRecord(
-        C, Satisfaction.Details[I],
-        getTrailingObjects<UnsatisfiedConstraintRecord>() + I);
+    CreateUnsatisfiedConstraintRecord(C, Satisfaction.Details[I],
+                                      getTrailingObjects() + I);
 }
 
 ASTConstraintSatisfaction::ASTConstraintSatisfaction(
@@ -51,9 +50,8 @@ ASTConstraintSatisfaction::ASTConstraintSatisfaction(
       IsSatisfied{Satisfaction.IsSatisfied},
       ContainsErrors{Satisfaction.ContainsErrors} {
   for (unsigned I = 0; I < NumRecords; ++I)
-    CreateUnsatisfiedConstraintRecord(
-        C, *(Satisfaction.begin() + I),
-        getTrailingObjects<UnsatisfiedConstraintRecord>() + I);
+    CreateUnsatisfiedConstraintRecord(C, *(Satisfaction.begin() + I),
+                                      getTrailingObjects() + I);
 }
 
 ASTConstraintSatisfaction *

@jurahul jurahul requested a review from kazutakahirata May 15, 2025 00:52
Copy link
Contributor

@kazutakahirata kazutakahirata left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@jurahul jurahul merged commit f1eebf9 into llvm:main May 15, 2025
16 checks passed
@jurahul jurahul deleted the clang_trailingobjects_astconcept branch May 15, 2025 12:32
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.