[llvm-branch-commits] [clang] Cherry pick: [Clang][Sema] Make UnresolvedLookupExprs in class scope explicit spec… (PR #102514)

2024-08-08 Thread Andrew Ng via llvm-branch-commits

https://github.com/nga888 created 
https://github.com/llvm/llvm-project/pull/102514

…ializations instantiation dependent (#100392)

Cherry pick of 55ea36002bd364518c20b3ce282640c920697bf7

>From c7377a35fc99b537a5198335c5aabc5d142a3972 Mon Sep 17 00:00:00 2001
From: Krystian Stasiowski 
Date: Tue, 6 Aug 2024 12:40:44 -0400
Subject: [PATCH] [Clang][Sema] Make UnresolvedLookupExprs in class scope
 explicit specializations instantiation dependent (#100392)

A class member named by an expression in a member function that may instantiate 
to a static _or_ non-static member is represented by a `UnresolvedLookupExpr` 
in order to defer the implicit transformation to a class member access 
expression until instantiation. Since `ASTContext::getDecltypeType` only 
creates a `DecltypeType` that has a `DependentDecltypeType` as its canonical 
type when the operand is instantiation dependent, and since we do not transform 
types unless they are instantiation dependent, we need to mark the 
`UnresolvedLookupExpr` as instantiation dependent in order to correctly build a 
`DecltypeType` using the expression as its operand with a 
`DependentDecltypeType` canonical type. Fixes #99873.

(cherry picked from commit 55ea36002bd364518c20b3ce282640c920697bf7)
---
 clang/include/clang/AST/ExprCXX.h |  7 ---
 clang/lib/AST/ASTImporter.cpp |  6 --
 clang/lib/AST/ExprCXX.cpp | 19 +++
 clang/lib/Sema/SemaCoroutine.cpp  |  3 ++-
 clang/lib/Sema/SemaDecl.cpp   |  2 +-
 clang/lib/Sema/SemaDeclCXX.cpp|  2 +-
 clang/lib/Sema/SemaExpr.cpp   |  2 +-
 clang/lib/Sema/SemaExprMember.cpp |  3 ++-
 clang/lib/Sema/SemaOpenMP.cpp |  6 --
 clang/lib/Sema/SemaOverload.cpp   |  6 +++---
 clang/lib/Sema/SemaTemplate.cpp   |  3 ++-
 clang/lib/Sema/TreeTransform.h|  8 
 clang/test/SemaCXX/decltype.cpp   | 25 +
 13 files changed, 64 insertions(+), 28 deletions(-)

diff --git a/clang/include/clang/AST/ExprCXX.h 
b/clang/include/clang/AST/ExprCXX.h
index c2feac525c1ea6..45cfd7bfb7f92c 100644
--- a/clang/include/clang/AST/ExprCXX.h
+++ b/clang/include/clang/AST/ExprCXX.h
@@ -3229,7 +3229,7 @@ class UnresolvedLookupExpr final
const DeclarationNameInfo &NameInfo, bool RequiresADL,
const TemplateArgumentListInfo *TemplateArgs,
UnresolvedSetIterator Begin, UnresolvedSetIterator End,
-   bool KnownDependent);
+   bool KnownDependent, bool KnownInstantiationDependent);
 
   UnresolvedLookupExpr(EmptyShell Empty, unsigned NumResults,
bool HasTemplateKWAndArgsInfo);
@@ -3248,7 +3248,7 @@ class UnresolvedLookupExpr final
  NestedNameSpecifierLoc QualifierLoc,
  const DeclarationNameInfo &NameInfo, bool RequiresADL,
  UnresolvedSetIterator Begin, UnresolvedSetIterator End,
- bool KnownDependent);
+ bool KnownDependent, bool KnownInstantiationDependent);
 
   // After canonicalization, there may be dependent template arguments in
   // CanonicalConverted But none of Args is dependent. When any of
@@ -3258,7 +3258,8 @@ class UnresolvedLookupExpr final
  NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc,
  const DeclarationNameInfo &NameInfo, bool RequiresADL,
  const TemplateArgumentListInfo *Args, UnresolvedSetIterator Begin,
- UnresolvedSetIterator End, bool KnownDependent);
+ UnresolvedSetIterator End, bool KnownDependent,
+ bool KnownInstantiationDependent);
 
   static UnresolvedLookupExpr *CreateEmpty(const ASTContext &Context,
unsigned NumResults,
diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp
index 08ef09d353afc9..e95992b99f7e9d 100644
--- a/clang/lib/AST/ASTImporter.cpp
+++ b/clang/lib/AST/ASTImporter.cpp
@@ -8578,13 +8578,15 @@ 
ASTNodeImporter::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
 return UnresolvedLookupExpr::Create(
 Importer.getToContext(), *ToNamingClassOrErr, *ToQualifierLocOrErr,
 *ToTemplateKeywordLocOrErr, ToNameInfo, E->requiresADL(), &ToTAInfo,
-ToDecls.begin(), ToDecls.end(), KnownDependent);
+ToDecls.begin(), ToDecls.end(), KnownDependent,
+/*KnownInstantiationDependent=*/E->isInstantiationDependent());
   }
 
   return UnresolvedLookupExpr::Create(
   Importer.getToContext(), *ToNamingClassOrErr, *ToQualifierLocOrErr,
   ToNameInfo, E->requiresADL(), ToDecls.begin(), ToDecls.end(),
-  /*KnownDependent=*/E->isTypeDependent());
+  /*KnownDependent=*/E->isTypeDependent(),
+  /*KnownInstantiationDependent=*/E->isInstantiationDependent());
 }
 
 ExpectedStmt
diff --git a/clang/lib/AST/ExprCXX.cpp b/clang/lib/AST/ExprCXX.cpp
index 8d2a1b5611ccc6..45e2badf2ddd4a 100644
--- a/clang/lib/AST/ExprCXX.cpp
+++ b/clang/lib/AST/ExprCXX.cpp
@@ -402,10 +402,11 @@ UnresolvedLookupExpr::U

[llvm-branch-commits] [clang] Cherry pick: [Clang][Sema] Make UnresolvedLookupExprs in class scope explicit spec… (PR #102514)

2024-08-08 Thread Andrew Ng via llvm-branch-commits

https://github.com/nga888 milestoned 
https://github.com/llvm/llvm-project/pull/102514
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] Cherry pick: [Clang][Sema] Make UnresolvedLookupExprs in class scope explicit spec… (PR #102514)

2024-08-08 Thread Andrew Ng via llvm-branch-commits

https://github.com/nga888 edited 
https://github.com/llvm/llvm-project/pull/102514
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] release/18.x: [Support] Fix color handling in formatted_raw_ostream (#86700) (PR #86940)

2024-04-02 Thread Andrew Ng via llvm-branch-commits

nga888 wrote:

> Hi @nga888 (or anyone else). If you would like to add a note about this fix 
> in the release notes (completely optional). Please reply to this comment with 
> a one or two sentence description of the fix.

Fix color handling for buffered formatted_raw_ostream which allows the 
unbuffered workaround in llvm-objdump to be removed, restoring the performance 
of llvm-objdump disassembly when the output is redirected.

https://github.com/llvm/llvm-project/pull/86940
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits