[PATCH] D86719: [SyntaxTree][NFC] Refactor function templates into functions taking base class
Eduardo Caldas via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 27 09:43:26 PDT 2020
eduucaldas added a reviewer: gribozavr2.
eduucaldas added a comment.
As a result of this change `getDeclaratorRange` is used exclusively inside `processDeclaratorAndDeclaration` and the last two arguments are direct results of `getQualifiedNameStart(D)` and `getInitializerRange(D)`, which are used exclusively in this context.
================
Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:1462
// Build node for the declarator, if any.
- auto ReturnDeclaratorRange =
- getDeclaratorRange(this->Builder.sourceManager(), ReturnedType,
- /*Name=*/SourceLocation(),
- /*Initializer=*/SourceLocation());
+ auto ReturnDeclaratorRange = SourceRange(GetStartLoc().Visit(ReturnedType),
+ ReturnedType.getEndLoc());
----------------
1. TrailingReturn is not a Declarator
2. Inlining the arguments is actually less code and much than using the `getDeclaratorRange` here.
================
Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:393
// Next sibling is not the same type, this one is responsible.
- if (NextT == nullptr) {
+ if (D->getKind() != Next->getKind()) {
return true;
----------------
I would argue that this is much clearer :)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86719/new/
https://reviews.llvm.org/D86719
More information about the cfe-commits
mailing list