[clang] [Clang][NFC] Use const ASTContext reference in Decl Create methods (PR #185401)

via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 10 21:34:17 PDT 2026


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 origin/main HEAD --extensions h,cpp -- clang/include/clang/AST/Decl.h clang/lib/AST/Decl.cpp clang/lib/AST/DeclCXX.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h
index 6b8f53658..736558c1c 100644
--- a/clang/include/clang/AST/Decl.h
+++ b/clang/include/clang/AST/Decl.h
@@ -138,9 +138,7 @@ public:
   using redeclarable_base::redecls_begin;
   using redeclarable_base::redecls_end;
 
-  ASTContext &getASTContext() const {
-    return const_cast<ASTContext &>(Ctx);
-  }
+  ASTContext &getASTContext() const { return const_cast<ASTContext &>(Ctx); }
 
   NamespaceDecl *getAnonymousNamespace() const { return AnonymousNamespace; }
   void setAnonymousNamespace(NamespaceDecl *D);

``````````

</details>


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


More information about the cfe-commits mailing list