This adds helper classes to add using declaractions and namespace aliases to function bodies. These help making function calls to deeply nested functions concise (e.g. when calling helpers in a refactoring)
Details
- Reviewers
hokein alexfh - Commits
- rGada286202e2b: Recommit "[ClangTidy] Add UsingInserter and NamespaceAliaser"
rG6c24d9345d13: [ClangTidy] Add UsingInserter and NamespaceAliaser
rCTE284368: Recommit "[ClangTidy] Add UsingInserter and NamespaceAliaser"
rCTE283981: [ClangTidy] Add UsingInserter and NamespaceAliaser
rL284368: Recommit "[ClangTidy] Add UsingInserter and NamespaceAliaser"
rL283981: [ClangTidy] Add UsingInserter and NamespaceAliaser
Diff Detail
- Repository
- rL LLVM
Event Timeline
Looks almost fine, a few code-style comments.
clang-tidy/utils/ASTUtils.h | ||
---|---|---|
11 ↗ | (On Diff #72751) | A blank line between define guard and include. |
17 ↗ | (On Diff #72751) | Could you add a few documentation describing this interface? |
21 ↗ | (On Diff #72751) | A blank line below. |
clang-tidy/utils/NamespaceAliaser.cpp | ||
8 ↗ | (On Diff #72751) | A blank line. |
14 ↗ | (On Diff #72751) | A blank line below. |
41 ↗ | (On Diff #72751) | FIXME. |
44 ↗ | (On Diff #72751) | FIXME. |
85 ↗ | (On Diff #72751) | I'd prefer to declare it const auto *. |
clang-tidy/utils/NamespaceAliaser.h | ||
8 ↗ | (On Diff #72751) | A blank line. |
21 ↗ | (On Diff #72751) | A blank line below. |
28 ↗ | (On Diff #72751) | s/these/there? |
41 ↗ | (On Diff #72751) | Use llvm::DenseMap instead. |
clang-tidy/utils/UsingInserter.cpp | ||
49 ↗ | (On Diff #72751) | Use FIXME instead of TODO(bangert). |
clang-tidy/utils/UsingInserter.h | ||
23 ↗ | (On Diff #72751) | Could you elaborate a bit more? |
41 ↗ | (On Diff #72751) | It'd be clearer to use a typedef for std::pair<const FunctionDecl *, std::string> here. |
LGTM with one more nit.
clang-tidy/utils/ASTUtils.h | ||
---|---|---|
25 ↗ | (On Diff #74187) | missing a trailing comment // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ASTUTILS_H |
@jbangert, your patch broke the buildbot, and I reverted it in r283985. You need to add the new source files to the CMakefile. (I saw other compilation errors after I updated the cmake files, Could you take a look on it? )
clang-tidy/utils/UsingInserter.cpp | ||
---|---|---|
58 ↗ | (On Diff #74737) | Using emplace seems to break our modules libstdc++ 4.7 builds: http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules-2/builds/6066 . Doesn't that break other 4.7 or earlier builds? |
A few late comments (seems to be relevant to the revision finally committed after all fixes).
clang-tidy/utils/NamespaceAliaser.cpp | ||
---|---|---|
35 ↗ | (On Diff #72751) | nit: Too many empty lines. |
41 ↗ | (On Diff #72751) | Please use FIXME instead of TODO(...). |
clang-tidy/utils/NamespaceAliaser.h | ||
35 ↗ | (On Diff #74737) | Use llvm::ArrayRef instead. |