[PATCH] D152707: [clang][Sema] Provide source range to several Wunused warnings

Takuya Shimizu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 14 04:40:06 PDT 2023


hazohelet added inline comments.


================
Comment at: clang/lib/Sema/Sema.cpp:1386
+        if (const auto *VTSD = dyn_cast<VarTemplateSpecializationDecl>(DiagD))
+          DiagRange.setEnd(VTSD->getTemplateArgsInfo()->RAngleLoc);
         if (DiagD->isReferenced()) {
----------------
It looks like `VarTemplateSpecializationDecl::getTemplateArgsInfo()` could be null, so I'll add another check for that to avoid regression.

(This seems weird to me because IIRC there's no template type deduction for variable templates and thus every specialization for variable templates has explicit template arguments provided)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152707/new/

https://reviews.llvm.org/D152707



More information about the cfe-commits mailing list