hintonda added a comment.

In D60151#1453099 <https://reviews.llvm.org/D60151#1453099>, @alexfh wrote:

> 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?


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;


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D60151



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

Reply via email to