hokein added inline comments.
================
Comment at: clang/unittests/Tooling/RecursiveASTVisitorTests/Templates.cpp:12
+//
+// shouldVisitTemplateInstantiations() controls traversal of AST nodes that
+// were created by instantiation, rather than by written code. This means:
----------------
I think this is a very useful documentation about the RAV API, instead of
staying in the test file, I would suggest moving it to the RAV.h file.
================
Comment at: clang/unittests/Tooling/RecursiveASTVisitorTests/Templates.cpp:18
+// - Explicit instantiations are a tricky case:
+// - the "declaration part" (template args, function params etc) was
written
+// and should always be traversed.
----------------
Conceptually, an instantiations create a specific {Class,
Var}TemplateSpecializationDecl, functionDecl.
```
template <class T> void foo(T) { }
template void foo<char>(); // Line 2
```
For the statement on line 2 (called `explicit instantiation definition` I think)
- there is no corresponding node in the clang AST, this is a missing feature in
clang
- it creates a FunctionDecl, that is `void foo(char) { }`,
does the "declaration part" in the comment refer to the declaration part of the
`explicit instantiation definition` (I think so), or the declaration part of
the FunctionDecl `void foo(char) {}`? The same question to the definition, my
understanding from the comment is the function body of the `void foo(char) {}`,
which is `{}`.
We describe the expected behavior, but there are some bugs or unimplemented
features in clang, which creates discrepancies. I think this is confusing and
hard to follow, not sure how to do here (encoding a bunch of FIXMEs here is not
good, not mentioning them at all is not good neither, can we mention only
critical ones?)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120498/new/
https://reviews.llvm.org/D120498
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits