[clang] 18f230a - [Clang] Silence warning when building with MSVC 2022

Alexandre Ganea via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 5 17:34:03 PDT 2022


Author: Alexandre Ganea
Date: 2022-07-05T20:31:54-04:00
New Revision: 18f230a89aa234ac58be4fb8cee2bfa95ea67be4

URL: https://github.com/llvm/llvm-project/commit/18f230a89aa234ac58be4fb8cee2bfa95ea67be4
DIFF: https://github.com/llvm/llvm-project/commit/18f230a89aa234ac58be4fb8cee2bfa95ea67be4.diff

LOG: [Clang] Silence warning when building with MSVC 2022

Previously, the warning seen:

[22/95] Building CXX object tools\clang\lib\StaticAnalyzer\Checker...bj.clangStaticAnalyzerCheckers.dir\NoReturnFunctionChecker.cpp.objC:\git\llvm-project\clang\lib\StaticAnalyzer\Checkers\NoReturnFunctionChecker.cpp(149): warning C4305: 'if': truncation from 'size_t' to 'bool'
C:\git\llvm-project\clang\include\clang/Analysis/SelectorExtras.h(28): note: see reference to function template instantiation 'clang::Selector clang::getKeywordSelector<const char,const char,const char,const char>(clang::ASTContext &,const char *,const char *,const char *,const char *)' being compiled
C:\git\llvm-project\clang\lib\StaticAnalyzer\Checkers\NoReturnFunctionChecker.cpp(125): note: see reference to function template instantiation 'void clang::lazyInitKeywordSelector<const char,const char,const char,const char>(clang::Selector &,clang::ASTContext &,const char *,const char *,const char *,const char *)' being compiled

Added: 
    

Modified: 
    clang/include/clang/Analysis/SelectorExtras.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Analysis/SelectorExtras.h b/clang/include/clang/Analysis/SelectorExtras.h
index 278f20e87cc69..1e1daf5706bbf 100644
--- a/clang/include/clang/Analysis/SelectorExtras.h
+++ b/clang/include/clang/Analysis/SelectorExtras.h
@@ -16,7 +16,7 @@ namespace clang {
 template <typename... IdentifierInfos>
 static inline Selector getKeywordSelector(ASTContext &Ctx,
                                           IdentifierInfos *... IIs) {
-  static_assert(sizeof...(IdentifierInfos),
+  static_assert(sizeof...(IdentifierInfos) > 0,
                 "keyword selectors must have at least one argument");
   SmallVector<IdentifierInfo *, 10> II({&Ctx.Idents.get(IIs)...});
 


        


More information about the cfe-commits mailing list