aaron.ballman added inline comments.

================
Comment at: clang/lib/Sema/SemaInit.cpp:3863
 
+  SourceLocation EndLoc = VD->getEndLoc();
+  if (const auto *VTSD = dyn_cast<VarTemplateSpecializationDecl>(VD)) {
----------------
erichkeane wrote:
> Hmm... it is strange to me that the variables 'endloc' is the end of the 
> identifier and not the end of the variable declaration.  I unfortunately 
> don't have a good feeling as to the 'correct' behavior for that (Aaron is 
> typically the one who understands source locations better than me!), so 
> hopefully he can come along and see.  
I don't think we should have to do this dance here, this is something that 
`getEndLoc()` should be able to tell us. The way that source locations work is 
that AST nodes can override `getSourceRange()` to produce the correct range 
information for the node, and then they expose different accessors for any 
other source location information. In this case, I think 
`VarTemplateSpecializationDecl` isn't overloading `getSourceRange()` and so 
we're getting the default behavior from `VarDecl`.


================
Comment at: clang/test/FixIt/fixit-const-var-init.cpp:24
+
+template <> constexpr float d<int, float>; // expected-error {{must be 
initialized by a constant expression}}
+// CHECK: fix-it:"{{.*}}":{24:42-24:42}:" = 0.0"
----------------
I'd like to see some additional test coverage for more complicated declarators:
```
void (* const func)(int, int);
const int var [[clang::annotate("")]];
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139705

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to