[all-commits] [llvm/llvm-project] 77a8e9: [clang] WIP: Improved Context Declaration tracking

Matheus Izvekov via All-commits all-commits at lists.llvm.org
Mon Sep 9 17:31:53 PDT 2024


  Branch: refs/heads/users/mizvekov/clang-fix-lambda-context
  Home:   https://github.com/llvm/llvm-project
  Commit: 77a8e95f6cc7395a1fd5c345479181d9ec692769
      https://github.com/llvm/llvm-project/commit/77a8e95f6cc7395a1fd5c345479181d9ec692769
  Author: Matheus Izvekov <mizvekov at gmail.com>
  Date:   2024-09-09 (Mon, 09 Sep 2024)

  Changed paths:
    A benchmark.txt
    M clang-tools-extra/test/clang-change-namespace/lambda-function.cpp
    M clang/include/clang/AST/ASTLambda.h
    M clang/include/clang/AST/Decl.h
    M clang/include/clang/AST/DeclBase.h
    M clang/include/clang/AST/DeclCXX.h
    M clang/include/clang/Basic/Linkage.h
    M clang/include/clang/Parse/Parser.h
    M clang/include/clang/Sema/EnterExpressionEvaluationContext.h
    M clang/include/clang/Sema/Sema.h
    M clang/include/clang/Sema/Template.h
    M clang/include/clang/Serialization/ASTReader.h
    M clang/lib/AST/ASTContext.cpp
    M clang/lib/AST/ASTImporter.cpp
    M clang/lib/AST/Decl.cpp
    M clang/lib/AST/DeclBase.cpp
    M clang/lib/AST/DeclCXX.cpp
    M clang/lib/AST/ItaniumMangle.cpp
    M clang/lib/AST/Linkage.h
    M clang/lib/AST/MicrosoftMangle.cpp
    M clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
    M clang/lib/CodeGen/CGObjC.cpp
    M clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
    M clang/lib/CodeGen/CGStmtOpenMP.cpp
    M clang/lib/CodeGen/ItaniumCXXABI.cpp
    M clang/lib/CodeGen/MicrosoftCXXABI.cpp
    M clang/lib/Index/IndexSymbol.cpp
    M clang/lib/Parse/ParseDecl.cpp
    M clang/lib/Parse/ParseDeclCXX.cpp
    M clang/lib/Parse/ParseExpr.cpp
    M clang/lib/Parse/ParseExprCXX.cpp
    M clang/lib/Parse/ParseObjc.cpp
    M clang/lib/Parse/ParseStmt.cpp
    M clang/lib/Parse/ParseTemplate.cpp
    M clang/lib/Parse/Parser.cpp
    M clang/lib/Sema/HLSLExternalSemaSource.cpp
    M clang/lib/Sema/Sema.cpp
    M clang/lib/Sema/SemaCXXScopeSpec.cpp
    M clang/lib/Sema/SemaConcept.cpp
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaDeclCXX.cpp
    M clang/lib/Sema/SemaDeclObjC.cpp
    M clang/lib/Sema/SemaExpr.cpp
    M clang/lib/Sema/SemaExprCXX.cpp
    M clang/lib/Sema/SemaExprObjC.cpp
    M clang/lib/Sema/SemaLambda.cpp
    M clang/lib/Sema/SemaLookup.cpp
    M clang/lib/Sema/SemaObjCProperty.cpp
    M clang/lib/Sema/SemaOpenMP.cpp
    M clang/lib/Sema/SemaOverload.cpp
    M clang/lib/Sema/SemaPseudoObject.cpp
    M clang/lib/Sema/SemaRISCV.cpp
    M clang/lib/Sema/SemaTemplate.cpp
    M clang/lib/Sema/SemaTemplateDeduction.cpp
    M clang/lib/Sema/SemaTemplateDeductionGuide.cpp
    M clang/lib/Sema/SemaTemplateInstantiate.cpp
    M clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
    M clang/lib/Sema/SemaType.cpp
    M clang/lib/Sema/TreeTransform.h
    M clang/lib/Serialization/ASTReader.cpp
    M clang/lib/Serialization/ASTReaderDecl.cpp
    M clang/lib/Serialization/ASTWriter.cpp
    M clang/lib/Serialization/ASTWriterDecl.cpp
    M clang/test/AST/ast-dump-concepts.cpp
    M clang/test/CodeGenCXX/clang-abi-compat.cpp
    M clang/test/CodeGenCXX/cxx20-unevaluated-lambda-crash.cpp
    M clang/test/CodeGenCXX/mangle-lambdas-cxx20.cpp
    A clang/test/CodeGenCXX/mangle-lambdas-tentative.cpp
    M clang/test/CodeGenCXX/mangle-requires.cpp
    M clang/test/Index/complete-exprs.m
    A clang/test/Modules/requires.cpp
    M clang/test/Parser/backtrack-off-by-one.cpp
    M clang/test/SemaCXX/lambda-as-default-parameter.cpp
    M clang/test/SemaCXX/lambda-unevaluated.cpp
    M clang/test/SemaTemplate/alias-template-with-lambdas.cpp
    M clang/test/SemaTemplate/concepts.cpp
    M clang/tools/libclang/CIndex.cpp
    M clang/tools/libclang/CXIndexDataConsumer.cpp
    M clang/unittests/AST/ASTImporterTest.cpp
    M clang/unittests/Rename/RenameClassTest.cpp

  Log Message:
  -----------
  [clang] WIP: Improved Context Declaration tracking

This patch aims to improve how parenting relationships
are represented in the AST.

Currently regular declarations can only be children of
special AST nodes which inherit from DeclContext, except
for a few special cases which are required by itanium mangling.

Having this parenting relationship well described helps
in tracking which entities are dependent, and an improvement
here would allow us to drop a lot of workarounds and to
get some difficult cases right.

This patch extends the ContextDecl tracking which currently
is used for mangling, in order to cover almost needed cases.

Template type aliases represent a specially difficult case
which is addressed by this patch.
They can be contexts for other declarations, but besides not
being DeclContexts, they also lack a declaration which
represents their specialization.

This patch addresses the type alias context problem by
storing the specialization arguments along with the ContextDecl
for entities declared in their context.

TODO:

* Move away from using ExpressionEvaluationContexts, and use the same
stack used for tracking the CurContext. Remove the separate ContextDecl
field, and have that functionally built in to the base Decl class,
so that we don't separatelly treack both a parent Decl and a parent
DeclContext.

* A function type has ParmVarDecls, and these can appear inside
aliases and template type aliases in particular, so a ParmvarDecl
needs a ContextDecl too.



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