Rename llvm checkers to llvm-project, and namespace from llvm to llvm_project.
Includes renaming llvm directory, many files with llvm- in the name, and updating code and docs.
Differential D60151
[clang-tidy] Rename llvm checkers to llvm-project hintonda on Apr 2 2019, 2:07 PM. Authored by
Details
Rename llvm checkers to llvm-project, and namespace from llvm to llvm_project. Includes renaming llvm directory, many files with llvm- in the name, and updating code and docs.
Diff Detail
Event TimelineComment Actions The change looks fine, but I don't understand the description of this revision. Could you clarify which checkers you're talking about and which bug you observe?
Comment Actions Sorry for not being clearer in my original description. The error can be triggered by opening up a new llvm namespace under clang::tidy prior to referencing llvm::SmallSet, which would happened if a new llvm checker that gets included in LLVMTidyModule.cpp before HeaderGuardCheck.h -- HeaderGuardCheck.h includes HeaderFileExternsions.h prior to opening the new llvm namespace. Here's the error message you'd get: llvm-project/clang-tools-extra/clang-tidy/llvm/../utils/../utils/HeaderFileExtensionsUtils.h:24:9: error: no template named 'SmallSet' in namespace 'clang::tidy::llvm'; did you mean '::llvm::SmallSet'? typedef llvm::SmallSet<llvm::StringRef, 5> HeaderFileExtensionsSet; ^~~~~~~~~~~~~~ ::llvm::SmallSet llvm-project/llvm/include/llvm/ADT/SmallSet.h:134:7: note: '::llvm::SmallSet' declared here class SmallSet { ^ llvm-project/clang-tools-extra/clang-tidy/llvm/../utils/../utils/HeaderFileExtensionsUtils.h:24:30: error: no member named 'StringRef' in namespace 'clang::tidy::llvm' typedef llvm::SmallSet<llvm::StringRef, 5> HeaderFileExtensionsSet; ~~~~~~^ 2 errors generated. Here's the one line contrived change needed to demonstrate the error produced above, which is the same effect of including an llvm checker header before including this file: --- a/clang-tools-extra/clang-tidy/utils/HeaderFileExtensionsUtils.h +++ b/clang-tools-extra/clang-tidy/utils/HeaderFileExtensionsUtils.h @@ -16,6 +16,7 @@ namespace clang { namespace tidy { +namespace llvm {} namespace utils { typedef llvm::SmallSet<llvm::StringRef, 5> HeaderFileExtensionsSet;
Comment Actions Awesome! Thanks for doing this. Could you ensure that the add_new_check.py script still works? Comment Actions Thanks for mentioning this. Found a missing rename discovered by add_new_check.py which I'll checkin shortly. However, I'm not sure how best to solve a rename issue. In rename_check.py, module names can't be hyphenated, e.g.: 190: old_module = args.old_check_name.split('-')[0] 191: new_module = args.new_check_name.split('-')[0] If we keep this pattern, then "llvm-project" won't work. It would need to be something like "llvmproject" or something else. Please let me know your preference. Comment Actions Hmm, that's unfortunate behavior. I guess my preference would be to go with llvm_project, but it's not a strong preference. Comment Actions are we supporting "-llvm-*" in existing .clang-tidy files? If people selectively turn checkers off, won't all of a sudden everyone start getting llvm-project checks and fixes turned back on? https://github.com/search?q=-llvm-%2A&type=Code maybe we need to add something like: llvm-header-guard (redirects to llvm-project-header-guard) <llvm-header-guard> llvm-header-include-order (redirects to llvm-project-include-order) <llvm-include-order> llvm-header-namespace-comment(redirects to llvm-project-namespace-comment) <llvm-namespace-comment> llvm-header-twine-local(redirects to llvm-project-twine-local) <llvm-twine-local> Comment Actions I suppose we could keep the names and directory structure and just change the namespace. That would just be a special case in the scripts. Haven't looked into it yet, but will do so as soon as I can. Comment Actions Isn't that matching done on strings? I.e. is there difference between -llvm-* and -ll* ? Comment Actions
it would be if they only do it to -llm-* (which could possibly catch most cases) but what if someone is doing -llvm-header-guard We wouldn't catch those.. This is a snippet of a .clang-tidy file from a project I work on, we turn off specific checks by fully qualifying the checker .... llvm-*, -llvm-header-guard, -llvm-include-order, misc-*, modernize-*, ... Comment Actions You make a great point. I'll look into just changing the namespace name. I wasn't really comfortable with all the code churn it involved anyway, but once I got started, I figured I'd finish it. The duplicate llvm namespace is the issue, not other names. Thanks for the feedback... |
I do not like that we're removing the namespace qualifier here. I would prefer to leave it as ::llvm::SmallSet<::llvm::StringRef, 5> if there is a namespace clash.