[clang] 3533fe7 - Revert "[clang] Preserve found-decl when constructing VarTemplateIds (#82265)"
Kadir Cetinkaya via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 21 02:16:07 PST 2024
Author: Kadir Cetinkaya
Date: 2024-02-21T11:15:42+01:00
New Revision: 3533fe783df4b417f16077edb70099010d2d7eef
URL: https://github.com/llvm/llvm-project/commit/3533fe783df4b417f16077edb70099010d2d7eef
DIFF: https://github.com/llvm/llvm-project/commit/3533fe783df4b417f16077edb70099010d2d7eef.diff
LOG: Revert "[clang] Preserve found-decl when constructing VarTemplateIds (#82265)"
This reverts commit 50373506d570f3db1e1af7c13d46409736452f3a. Broke
include-cleaner tests
Added:
Modified:
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaTemplate.cpp
clang/test/AST/ast-dump-using.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 23e1a623a20d15..89215bf3d1c69a 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -8538,7 +8538,7 @@ class Sema final {
/// if the arguments are dependent.
ExprResult CheckVarTemplateId(const CXXScopeSpec &SS,
const DeclarationNameInfo &NameInfo,
- VarTemplateDecl *Template, NamedDecl *FoundD,
+ VarTemplateDecl *Template,
SourceLocation TemplateLoc,
const TemplateArgumentListInfo *TemplateArgs);
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 7d3d665194add1..1a975a8d0a0df5 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -4958,10 +4958,11 @@ Sema::CheckVarTemplateId(VarTemplateDecl *Template, SourceLocation TemplateLoc,
return Decl;
}
-ExprResult Sema::CheckVarTemplateId(
- const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo,
- VarTemplateDecl *Template, NamedDecl *FoundD, SourceLocation TemplateLoc,
- const TemplateArgumentListInfo *TemplateArgs) {
+ExprResult
+Sema::CheckVarTemplateId(const CXXScopeSpec &SS,
+ const DeclarationNameInfo &NameInfo,
+ VarTemplateDecl *Template, SourceLocation TemplateLoc,
+ const TemplateArgumentListInfo *TemplateArgs) {
DeclResult Decl = CheckVarTemplateId(Template, TemplateLoc, NameInfo.getLoc(),
*TemplateArgs);
@@ -4977,7 +4978,8 @@ ExprResult Sema::CheckVarTemplateId(
NameInfo.getLoc());
// Build an ordinary singleton decl ref.
- return BuildDeclarationNameExpr(SS, NameInfo, Var, FoundD, TemplateArgs);
+ return BuildDeclarationNameExpr(SS, NameInfo, Var,
+ /*FoundD=*/nullptr, TemplateArgs);
}
void Sema::diagnoseMissingTemplateArguments(TemplateName Name,
@@ -5064,9 +5066,9 @@ ExprResult Sema::BuildTemplateIdExpr(const CXXScopeSpec &SS,
bool KnownDependent = false;
// In C++1y, check variable template ids.
if (R.getAsSingle<VarTemplateDecl>()) {
- ExprResult Res = CheckVarTemplateId(
- SS, R.getLookupNameInfo(), R.getAsSingle<VarTemplateDecl>(),
- R.getRepresentativeDecl(), TemplateKWLoc, TemplateArgs);
+ ExprResult Res = CheckVarTemplateId(SS, R.getLookupNameInfo(),
+ R.getAsSingle<VarTemplateDecl>(),
+ TemplateKWLoc, TemplateArgs);
if (Res.isInvalid() || Res.isUsable())
return Res;
// Result is dependent. Carry on to build an UnresolvedLookupEpxr.
diff --git a/clang/test/AST/ast-dump-using.cpp b/clang/test/AST/ast-dump-using.cpp
index 8e5c60d3aabf4a..5a4e910ffb8654 100644
--- a/clang/test/AST/ast-dump-using.cpp
+++ b/clang/test/AST/ast-dump-using.cpp
@@ -2,7 +2,6 @@
namespace a {
struct S;
-template <typename T> T x = {};
}
namespace b {
using a::S;
@@ -22,10 +21,4 @@ typedef S e; // check the same UsingType is reused.
// CHECK-NEXT: `-UsingType [[TYPE_ADDR]] 'a::S' sugar
// CHECK-NEXT: |-UsingShadow [[SHADOW_ADDR]] 'S'
// CHECK-NEXT: `-RecordType {{.*}} 'a::S'
-using a::x;
-
-void foo() {
- x<int> = 3;
- // CHECK: DeclRefExpr {{.*}} 'x' {{.*}} (UsingShadow {{.*}} 'x')
-}
}
More information about the cfe-commits
mailing list