[all-commits] [llvm/llvm-project] 25e00f: [Clang] Move DeclContext::getEnclosingFunction/cas...

DeanSturtevant1 via All-commits all-commits at lists.llvm.org
Fri Sep 18 13:00:57 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 25e00ff449d6c2a2d21a0b109f576be88847ce1f
      https://github.com/llvm/llvm-project/commit/25e00ff449d6c2a2d21a0b109f576be88847ce1f
  Author: DeanSturtevant1 <dsturtevant at google.com>
  Date:   2026-09-18 (Fri, 18 Sep 2026)

  Changed paths:
    M clang/include/clang/AST/DeclBase.h
    M clang/lib/AST/DeclBase.cpp

  Log Message:
  -----------
  [Clang] Move DeclContext::getEnclosingFunction/castEnclosingFunction out of line (#224711)

In DeclBase.h, clang::FunctionDecl is only forward-declared. Commit
c9074cfd0d95 defined getEnclosingFunction() and castEnclosingFunction()
inline in DeclBase.h, which instantiates dyn_cast<FunctionDecl> and
cast<FunctionDecl> on an incomplete type when DeclBase.h is compiled
standalone (e.g. with -fmodules / header units).

Move the non-const definitions to DeclBase.cpp where FunctionDecl is
complete, and delegate the const overloads via const_cast, matching
getOuterLexicalRecordContext() and
getEnclosingNonExpansionStatementContext().

Change prepared by Jetski and reviewed by me.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list