[PATCH] D68143: [clang] Make handling of unnamed template params similar to function params

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 1 03:34:00 PDT 2019


kadircet marked an inline comment as done.
kadircet added inline comments.


================
Comment at: clang/lib/AST/DeclTemplate.cpp:513
                        getDefaultArgumentInfo()->getTypeLoc().getEndLoc());
-  else
-    return TypeDecl::getSourceRange();
+  else if(getName().empty())
+    return SourceRange(getBeginLoc());
----------------
ilya-biryukov wrote:
> kadircet wrote:
> > ilya-biryukov wrote:
> > > Could you provide more details why we need this change?
> > added comments, you can also see the similar case in `DeclaratorDecl::getSourceRange()`
> Could you provide an example? What the range was before and what is it now?
> 
TypeDecl::getSourceRange will also include the next token if template parameter is unnamed for example:

```
template <typename>
          ~~~~~~~~~
```

has the following `>` covered inside typerange.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68143





More information about the cfe-commits mailing list