[clang] 65e2fab - [Sema] Fix warnings

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Tue May 7 12:40:27 PDT 2024


Author: Kazu Hirata
Date: 2024-05-07T12:40:19-07:00
New Revision: 65e2fab401a2da55c51d3caceae8478c33f3c60f

URL: https://github.com/llvm/llvm-project/commit/65e2fab401a2da55c51d3caceae8478c33f3c60f
DIFF: https://github.com/llvm/llvm-project/commit/65e2fab401a2da55c51d3caceae8478c33f3c60f.diff

LOG: [Sema] Fix warnings

This patch fixes:

  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:3937:12: error:
  unused variable 'CanonType' [-Werror,-Wunused-variable]

  clang/lib/Sema/SemaTemplate.cpp:9279:18: error: unused variable
  'TemplateKWLoc' [-Werror,-Wunused-variable]

Added: 
    

Modified: 
    clang/lib/Sema/SemaTemplate.cpp
    clang/lib/Sema/SemaTemplateInstantiateDecl.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index b268d7c405df..6231b65bd842 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -9276,8 +9276,6 @@ DeclResult Sema::ActOnClassTemplateSpecialization(
 
   // NOTE: KWLoc is the location of the tag keyword. This will instead
   // store the location of the outermost template keyword in the declaration.
-  SourceLocation TemplateKWLoc = TemplateParameterLists.size() > 0
-    ? TemplateParameterLists[0]->getTemplateLoc() : KWLoc;
   SourceLocation TemplateNameLoc = TemplateId.TemplateNameLoc;
   SourceLocation LAngleLoc = TemplateId.LAngleLoc;
   SourceLocation RAngleLoc = TemplateId.RAngleLoc;

diff  --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 5315b143215e..884e98a300f5 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -3932,12 +3932,6 @@ TemplateDeclInstantiator::VisitClassTemplateSpecializationDecl(
   if (SubstQualifier(D, InstD))
     return nullptr;
 
-  // Build the canonical type that describes the converted template
-  // arguments of the class template explicit specialization.
-  QualType CanonType = SemaRef.Context.getTemplateSpecializationType(
-      TemplateName(InstClassTemplate), CanonicalConverted,
-      SemaRef.Context.getRecordType(InstD));
-
   InstD->setAccess(D->getAccess());
   InstD->setInstantiationOfMemberClass(D, TSK_ImplicitInstantiation);
   InstD->setSpecializationKind(D->getSpecializationKind());


        


More information about the cfe-commits mailing list