[PATCH] D37958: [libc++] Correctly propagate user-defined lookup_classname().
timshen created this revision. Herald added a subscriber: sanjoy. Herald added a reviewer: EricWF. Always lookup the class name, even when the traits type is regex_traits<>. The lookup happens at regex compile time, so it shouldn't affect the performance. I also added ja_JP.UTF-8 as a common locale. https://reviews.llvm.org/D37958 Files: libcxx/include/regex libcxx/test/std/re/re.traits/lookup_classname_user_defined.pass.cpp libcxx/utils/libcxx/test/target_info.py Index: libcxx/utils/libcxx/test/target_info.py === --- libcxx/utils/libcxx/test/target_info.py +++ libcxx/utils/libcxx/test/target_info.py @@ -55,6 +55,7 @@ ('fr_FR.UTF-8', 'French_France.1252'), ('ru_RU.UTF-8', 'Russian_Russia.1251'), ('zh_CN.UTF-8', 'Chinese_China.936'), +('ja_JP.UTF-8', 'Japanese_Japan.932'), ('fr_CA.ISO8859-1', 'French_Canada.1252'), ('cs_CZ.ISO8859-2', 'Czech_Czech Republic.1250') ] Index: libcxx/test/std/re/re.traits/lookup_classname_user_defined.pass.cpp === --- /dev/null +++ libcxx/test/std/re/re.traits/lookup_classname_user_defined.pass.cpp @@ -0,0 +1,54 @@ +//===--===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===--===// + +// REQUIRES: locale.ja_JP.UTF-8 + +// + +// template struct regex_traits; + +// template +// char_class_type +// lookup_classname(ForwardIterator first, ForwardIterator last, +//bool icase = false) const; + +#include +#include +#include "test_macros.h" +#include "platform_support.h" // locale name macros + +struct wctype_traits : std::regex_traits +{ +using char_class_type = std::wctype_t; +template +char_class_type lookup_classname(ForwardIt first, ForwardIt last, bool icase = false ) const { +(void)icase; +return std::wctype(std::string(first, last).c_str()); +} +bool isctype(wchar_t c, char_class_type f) const { +return std::iswctype(c, f); +} +}; + +int main() +{ +std::locale::global(std::locale("ja_JP.utf8")); +std::wsmatch m; +std::wstring in = L"風の谷のナウシカ"; + +// matches all characters (they are classified as alnum) +std::wstring re1 = L"([[:alnum:]]+)"; +std::regex_search(in, m, std::wregex(re1)); +assert(m[1] == L"風の谷のナウシカ"); + +// matches only the kanji +std::wstring re2 = L"([[:jkata:]]+)"; +std::regex_search(in, m, std::basic_regex(re2)); +assert(m[1] == L"ナウシカ"); +} Index: libcxx/include/regex === --- libcxx/include/regex +++ libcxx/include/regex @@ -2213,8 +2213,8 @@ vector > __ranges_; vector > __digraphs_; vector __equivalences_; -typename regex_traits<_CharT>::char_class_type __mask_; -typename regex_traits<_CharT>::char_class_type __neg_mask_; +typename _Traits::char_class_type __mask_; +typename _Traits::char_class_type __neg_mask_; bool __negate_; bool __icase_; bool __collate_; @@ -2307,12 +2307,26 @@ _LIBCPP_INLINE_VISIBILITY void __add_equivalence(const string_type& __s) {__equivalences_.push_back(__s);} + +template _LIBCPP_INLINE_VISIBILITY -void __add_class(typename regex_traits<_CharT>::char_class_type __mask) -{__mask_ |= __mask;} +void __add_class(_Iter __begin, _Iter __end) +{ + auto __class_type = __traits_.lookup_classname(__begin, __end, __icase_); + if (__class_type == 0) + __throw_regex_error(); + __mask_ |= __class_type; +} + +template _LIBCPP_INLINE_VISIBILITY -void __add_neg_class(typename regex_traits<_CharT>::char_class_type __mask) -{__neg_mask_ |= __mask;} +void __add_neg_class(_Iter __begin, _Iter __end) +{ + auto __class_type = __traits_.lookup_classname(__begin, __end, true); + if (__class_type == 0) + __throw_regex_error(); + __neg_mask_ |= __class_type; +} }; template @@ -3841,23 +3855,23 @@ __str = _CharT(8); return ++__first; case 'd': -__ml->__add_class(ctype_base::digit); +__ml->__add_class(__first, std::next(__first)); return ++__first; case 'D': -__ml->__add_neg_class(ctype_base::digit); +__ml->__add_neg_class(__first, std::next(__first)); return ++__first; case 's': -__ml->__add_class(ctype_base::space); +__ml->__add_class(__first, std::next(__first)); return ++__first; case 'S': -__ml->__add_neg_class(ctype_base::space); +__ml->__add_neg_class(__first, std::next(__first));
[PATCH] D37958: [libc++] Correctly propagate user-defined lookup_classname().
timshen added a comment. I'm not sure if we need to change the CI server to suport ja_JP.UTF-8. https://reviews.llvm.org/D37958 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D37958: [libc++] Correctly propagate user-defined lookup_classname().
timshen updated this revision to Diff 115559. timshen added a comment. Update description. https://reviews.llvm.org/D37958 Files: libcxx/include/regex libcxx/test/std/re/re.traits/lookup_classname_user_defined.pass.cpp libcxx/utils/libcxx/test/target_info.py Index: libcxx/utils/libcxx/test/target_info.py === --- libcxx/utils/libcxx/test/target_info.py +++ libcxx/utils/libcxx/test/target_info.py @@ -55,6 +55,7 @@ ('fr_FR.UTF-8', 'French_France.1252'), ('ru_RU.UTF-8', 'Russian_Russia.1251'), ('zh_CN.UTF-8', 'Chinese_China.936'), +('ja_JP.UTF-8', 'Japanese_Japan.932'), ('fr_CA.ISO8859-1', 'French_Canada.1252'), ('cs_CZ.ISO8859-2', 'Czech_Czech Republic.1250') ] Index: libcxx/test/std/re/re.traits/lookup_classname_user_defined.pass.cpp === --- /dev/null +++ libcxx/test/std/re/re.traits/lookup_classname_user_defined.pass.cpp @@ -0,0 +1,54 @@ +//===--===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===--===// + +// REQUIRES: locale.ja_JP.UTF-8 + +// + +// template struct regex_traits; + +// template +// char_class_type +// lookup_classname(ForwardIterator first, ForwardIterator last, +//bool icase = false) const; + +#include +#include +#include "test_macros.h" +#include "platform_support.h" // locale name macros + +struct wctype_traits : std::regex_traits +{ +using char_class_type = std::wctype_t; +template +char_class_type lookup_classname(ForwardIt first, ForwardIt last, bool icase = false ) const { +(void)icase; +return std::wctype(std::string(first, last).c_str()); +} +bool isctype(wchar_t c, char_class_type f) const { +return std::iswctype(c, f); +} +}; + +int main() +{ +std::locale::global(std::locale("ja_JP.utf8")); +std::wsmatch m; +std::wstring in = L"風の谷のナウシカ"; + +// matches all characters (they are classified as alnum) +std::wstring re1 = L"([[:alnum:]]+)"; +std::regex_search(in, m, std::wregex(re1)); +assert(m[1] == L"風の谷のナウシカ"); + +// matches only the kanji +std::wstring re2 = L"([[:jkata:]]+)"; +std::regex_search(in, m, std::basic_regex(re2)); +assert(m[1] == L"ナウシカ"); +} Index: libcxx/include/regex === --- libcxx/include/regex +++ libcxx/include/regex @@ -2213,8 +2213,8 @@ vector > __ranges_; vector > __digraphs_; vector __equivalences_; -typename regex_traits<_CharT>::char_class_type __mask_; -typename regex_traits<_CharT>::char_class_type __neg_mask_; +typename _Traits::char_class_type __mask_; +typename _Traits::char_class_type __neg_mask_; bool __negate_; bool __icase_; bool __collate_; @@ -2307,12 +2307,26 @@ _LIBCPP_INLINE_VISIBILITY void __add_equivalence(const string_type& __s) {__equivalences_.push_back(__s);} + +template _LIBCPP_INLINE_VISIBILITY -void __add_class(typename regex_traits<_CharT>::char_class_type __mask) -{__mask_ |= __mask;} +void __add_class(_Iter __begin, _Iter __end) +{ + auto __class_type = __traits_.lookup_classname(__begin, __end, __icase_); + if (__class_type == 0) + __throw_regex_error(); + __mask_ |= __class_type; +} + +template _LIBCPP_INLINE_VISIBILITY -void __add_neg_class(typename regex_traits<_CharT>::char_class_type __mask) -{__neg_mask_ |= __mask;} +void __add_neg_class(_Iter __begin, _Iter __end) +{ + auto __class_type = __traits_.lookup_classname(__begin, __end, true); + if (__class_type == 0) + __throw_regex_error(); + __neg_mask_ |= __class_type; +} }; template @@ -3841,23 +3855,23 @@ __str = _CharT(8); return ++__first; case 'd': -__ml->__add_class(ctype_base::digit); +__ml->__add_class(__first, std::next(__first)); return ++__first; case 'D': -__ml->__add_neg_class(ctype_base::digit); +__ml->__add_neg_class(__first, std::next(__first)); return ++__first; case 's': -__ml->__add_class(ctype_base::space); +__ml->__add_class(__first, std::next(__first)); return ++__first; case 'S': -__ml->__add_neg_class(ctype_base::space); +__ml->__add_neg_class(__first, std::next(__first)); return ++__first; case 'w': -__ml->__add_class(ctype_base::alnum); +__ml->__add_class(__first, std::next(__first)); __ml->__add_char('_'); return ++__first; c
[PATCH] D37958: [libc++] Correctly propagate user-defined lookup_classname().
timshen updated this revision to Diff 115560. timshen added a comment. Stylize template decl to "template https://reviews.llvm.org/D37958 Files: libcxx/include/regex libcxx/test/std/re/re.traits/lookup_classname_user_defined.pass.cpp libcxx/utils/libcxx/test/target_info.py Index: libcxx/utils/libcxx/test/target_info.py === --- libcxx/utils/libcxx/test/target_info.py +++ libcxx/utils/libcxx/test/target_info.py @@ -55,6 +55,7 @@ ('fr_FR.UTF-8', 'French_France.1252'), ('ru_RU.UTF-8', 'Russian_Russia.1251'), ('zh_CN.UTF-8', 'Chinese_China.936'), +('ja_JP.UTF-8', 'Japanese_Japan.932'), ('fr_CA.ISO8859-1', 'French_Canada.1252'), ('cs_CZ.ISO8859-2', 'Czech_Czech Republic.1250') ] Index: libcxx/test/std/re/re.traits/lookup_classname_user_defined.pass.cpp === --- /dev/null +++ libcxx/test/std/re/re.traits/lookup_classname_user_defined.pass.cpp @@ -0,0 +1,54 @@ +//===--===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===--===// + +// REQUIRES: locale.ja_JP.UTF-8 + +// + +// template struct regex_traits; + +// template +// char_class_type +// lookup_classname(ForwardIterator first, ForwardIterator last, +//bool icase = false) const; + +#include +#include +#include "test_macros.h" +#include "platform_support.h" // locale name macros + +struct wctype_traits : std::regex_traits +{ +using char_class_type = std::wctype_t; +template +char_class_type lookup_classname(ForwardIt first, ForwardIt last, bool icase = false ) const { +(void)icase; +return std::wctype(std::string(first, last).c_str()); +} +bool isctype(wchar_t c, char_class_type f) const { +return std::iswctype(c, f); +} +}; + +int main() +{ +std::locale::global(std::locale("ja_JP.utf8")); +std::wsmatch m; +std::wstring in = L"風の谷のナウシカ"; + +// matches all characters (they are classified as alnum) +std::wstring re1 = L"([[:alnum:]]+)"; +std::regex_search(in, m, std::wregex(re1)); +assert(m[1] == L"風の谷のナウシカ"); + +// matches only the kanji +std::wstring re2 = L"([[:jkata:]]+)"; +std::regex_search(in, m, std::basic_regex(re2)); +assert(m[1] == L"ナウシカ"); +} Index: libcxx/include/regex === --- libcxx/include/regex +++ libcxx/include/regex @@ -2213,8 +2213,8 @@ vector > __ranges_; vector > __digraphs_; vector __equivalences_; -typename regex_traits<_CharT>::char_class_type __mask_; -typename regex_traits<_CharT>::char_class_type __neg_mask_; +typename _Traits::char_class_type __mask_; +typename _Traits::char_class_type __neg_mask_; bool __negate_; bool __icase_; bool __collate_; @@ -2307,12 +2307,26 @@ _LIBCPP_INLINE_VISIBILITY void __add_equivalence(const string_type& __s) {__equivalences_.push_back(__s);} + +template _LIBCPP_INLINE_VISIBILITY -void __add_class(typename regex_traits<_CharT>::char_class_type __mask) -{__mask_ |= __mask;} +void __add_class(_Iter __begin, _Iter __end) +{ + auto __class_type = __traits_.lookup_classname(__begin, __end, __icase_); + if (__class_type == 0) + __throw_regex_error(); + __mask_ |= __class_type; +} + +template _LIBCPP_INLINE_VISIBILITY -void __add_neg_class(typename regex_traits<_CharT>::char_class_type __mask) -{__neg_mask_ |= __mask;} +void __add_neg_class(_Iter __begin, _Iter __end) +{ + auto __class_type = __traits_.lookup_classname(__begin, __end, true); + if (__class_type == 0) + __throw_regex_error(); + __neg_mask_ |= __class_type; +} }; template @@ -3841,23 +3855,23 @@ __str = _CharT(8); return ++__first; case 'd': -__ml->__add_class(ctype_base::digit); +__ml->__add_class(__first, std::next(__first)); return ++__first; case 'D': -__ml->__add_neg_class(ctype_base::digit); +__ml->__add_neg_class(__first, std::next(__first)); return ++__first; case 's': -__ml->__add_class(ctype_base::space); +__ml->__add_class(__first, std::next(__first)); return ++__first; case 'S': -__ml->__add_neg_class(ctype_base::space); +__ml->__add_neg_class(__first, std::next(__first)); return ++__first; case 'w': -__ml->__add_class(ctype_base::alnum); +__ml->__add_class(__first, std::next(__first)); __ml->__add_char('_'); return ++
[PATCH] D37466: D37461: fixups for existing InlineAsm tests + adding new ones
coby added a comment. ping Repository: rL LLVM https://reviews.llvm.org/D37466 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D37413: [X86][MS-InlineAsm] Extended support for variables / identifiers on memory / immediate expressions
coby updated this revision to Diff 115564. coby added a comment. addressed @rnk 's suggestions: cuteness out c++ mischief in Repository: rL LLVM https://reviews.llvm.org/D37413 Files: include/clang/Parse/Parser.h include/clang/Sema/Sema.h lib/Parse/ParseStmtAsm.cpp lib/Sema/SemaStmtAsm.cpp test/CodeGen/ms-inline-asm-enums.cpp test/CodeGen/ms-inline-asm-variables.c Index: lib/Parse/ParseStmtAsm.cpp === --- lib/Parse/ParseStmtAsm.cpp +++ lib/Parse/ParseStmtAsm.cpp @@ -54,17 +54,17 @@ assert(AsmToks.size() == AsmTokOffsets.size()); } - void *LookupInlineAsmIdentifier(StringRef &LineBuf, - llvm::InlineAsmIdentifierInfo &Info, - bool IsUnevaluatedContext) override { + void LookupInlineAsmIdentifier(StringRef &LineBuf, + llvm::InlineAsmIdentifierInfo &Info, + bool IsUnevaluatedContext) override { // Collect the desired tokens. SmallVector LineToks; const Token *FirstOrigToken = nullptr; findTokensForString(LineBuf, LineToks, FirstOrigToken); unsigned NumConsumedToks; ExprResult Result = TheParser.ParseMSAsmIdentifier( -LineToks, NumConsumedToks, &Info, IsUnevaluatedContext); +LineToks, NumConsumedToks, IsUnevaluatedContext); // If we consumed the entire line, tell MC that. // Also do this if we consumed nothing as a way of reporting failure. @@ -89,9 +89,10 @@ LineBuf = LineBuf.substr(0, TotalOffset); } -// Initialize the "decl" with the lookup result. -Info.OpDecl = static_cast(Result.get()); -return Info.OpDecl; +// Initialize Info with the lookup result. +if (!Result.isUsable()) + return; +TheParser.getActions().FillInlineAsmIdentifierInfo(Result.get(), Info); } StringRef LookupInlineAsmLabel(StringRef Identifier, llvm::SourceMgr &LSM, @@ -178,16 +179,9 @@ } /// Parse an identifier in an MS-style inline assembly block. -/// -/// \param CastInfo - a void* so that we don't have to teach Parser.h -/// about the actual type. ExprResult Parser::ParseMSAsmIdentifier(llvm::SmallVectorImpl &LineToks, unsigned &NumLineToksConsumed, -void *CastInfo, bool IsUnevaluatedContext) { - llvm::InlineAsmIdentifierInfo &Info = - *(llvm::InlineAsmIdentifierInfo *)CastInfo; - // Push a fake token on the end so that we don't overrun the token // stream. We use ';' because it expression-parsing should never // overrun it. @@ -227,7 +221,7 @@ /*AllowDeductionGuide=*/false, /*ObjectType=*/nullptr, TemplateKWLoc, Id); // Perform the lookup. -Result = Actions.LookupInlineAsmIdentifier(SS, TemplateKWLoc, Id, Info, +Result = Actions.LookupInlineAsmIdentifier(SS, TemplateKWLoc, Id, IsUnevaluatedContext); } // While the next two tokens are 'period' 'identifier', repeatedly parse it as @@ -241,7 +235,7 @@ IdentifierInfo *Id = Tok.getIdentifierInfo(); ConsumeToken(); // Consume the identifier. Result = Actions.LookupInlineAsmVarDeclField(Result.get(), Id->getName(), - Info, Tok.getLocation()); + Tok.getLocation()); } // Figure out how many tokens we are into LineToks. Index: lib/Sema/SemaStmtAsm.cpp === --- lib/Sema/SemaStmtAsm.cpp +++ lib/Sema/SemaStmtAsm.cpp @@ -48,10 +48,10 @@ if (E != E2 && E2->isLValue()) { if (!S.getLangOpts().HeinousExtensions) S.Diag(E2->getLocStart(), diag::err_invalid_asm_cast_lvalue) -<< E->getSourceRange(); + << E->getSourceRange(); else S.Diag(E2->getLocStart(), diag::warn_invalid_asm_cast_lvalue) -<< E->getSourceRange(); + << E->getSourceRange(); // Accept, even if we emitted an error diagnostic. return false; } @@ -607,23 +607,31 @@ return NS; } -static void fillInlineAsmTypeInfo(const ASTContext &Context, QualType T, - llvm::InlineAsmIdentifierInfo &Info) { - // Compute the type size (and array length if applicable?). - Info.Type = Info.Size = Context.getTypeSizeInChars(T).getQuantity(); - if (T->isArrayType()) { -const ArrayType *ATy = Context.getAsArrayType(T); -Info.Type = Context.getTypeSizeInChars(ATy->getElementType()).getQuantity(); -Info.Length = Info.Size / Info.Type; - } +void Sema::FillInlineAsmIdentifierInfo(Expr *Res, + llvm::InlineAsmIdentifierInfo &Info) { + QualType T = Res->getType(); + Expr::EvalResult Eval; + if (T->isFunctionType() || T->i
[PATCH] D36836: [clang-tidy] Implement readability-function-cognitive-complexity check
JonasToth added a comment. For my part the current state is ok. @alexfh and @aaron.ballman but should do their review before committing. I would be interested in a exampleoutput for any real project. Comment at: clang-tidy/readability/FunctionCognitiveComplexityCheck.cpp:102-114 +const std::array CognitiveComplexity::Msgs = {{ +// B1 + B2 + B3 +"+%0, including nesting penalty of %1, nesting level increased to %2", + +// B1 + B2 +"+%0, nesting level increased to %2", + lebedev.ri wrote: > JonasToth wrote: > > lebedev.ri wrote: > > > JonasToth wrote: > > > > could this initialization land in line 45? that would be directly close > > > > to the criteria. > > > It would be nice indeed, but if i do > > > ``` > > > // All the possible messages that can be outputed. The choice of the > > > message > > > // to use is based of the combination of the Criterias > > > static constexpr std::array Msgs = {{ > > > // B1 + B2 + B3 > > > "+%0, including nesting penalty of %1, nesting level increased to > > > %2", > > > > > > // B1 + B2 > > > "+%0, nesting level increased to %2", > > > > > > // B1 > > > "+%0", > > > > > > // B2 > > > "nesting level increased to %2", > > > }}; > > > ``` > > > i get > > > ``` > > > $ ninja check-clang-tools -j1 > > > [1/5] Linking CXX executable bin/clang-tidy > > > FAILED: bin/clang-tidy > > > : && /usr/local/bin/clang++ -fPIC -fvisibility-inlines-hidden > > > -Werror=date-time -Werror=unguarded-availability-new -std=c++11 -Wall -W > > > -Wno-unused-parameter -Wwrite-strings -Wcast-qual > > > -Wmissing-field-initializers -pedantic -Wno-long-long > > > -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor > > > -Wstring-conversion -fcolor-diagnostics -ffunction-sections > > > -fdata-sections -fno-common -Woverloaded-virtual -Wno-nested-anon-types > > > -O3 -DNDEBUG -Wl,-allow-shlib-undefined-Wl,-O3 -Wl,--gc-sections > > > tools/clang/tools/extra/clang-tidy/tool/CMakeFiles/clang-tidy.dir/ClangTidyMain.cpp.o > > > -o bin/clang-tidy -Wl,-rpath,"\$ORIGIN/../lib" lib/libLLVMSupport.a > > > -lpthread lib/libclangAST.a lib/libclangASTMatchers.a lib/libclangBasic.a > > > lib/libclangTidy.a lib/libclangTidyAndroidModule.a > > > lib/libclangTidyBoostModule.a lib/libclangTidyBugproneModule.a > > > lib/libclangTidyCERTModule.a lib/libclangTidyCppCoreGuidelinesModule.a > > > lib/libclangTidyGoogleModule.a lib/libclangTidyHICPPModule.a > > > lib/libclangTidyLLVMModule.a lib/libclangTidyMiscModule.a > > > lib/libclangTidyModernizeModule.a lib/libclangTidyMPIModule.a > > > lib/libclangTidyPerformanceModule.a lib/libclangTidyReadabilityModule.a > > > lib/libclangTooling.a lib/libclangToolingCore.a > > > lib/libclangTidyCppCoreGuidelinesModule.a lib/libclangTidyGoogleModule.a > > > lib/libclangTidyMiscModule.a lib/libclangTidyReadabilityModule.a > > > lib/libclangTidyUtils.a lib/libclangTidy.a lib/libclangTooling.a > > > lib/libclangFormat.a lib/libclangToolingCore.a > > > lib/libclangStaticAnalyzerFrontend.a lib/libclangFrontend.a > > > lib/libclangDriver.a lib/libLLVMOption.a lib/libclangParse.a > > > lib/libLLVMMCParser.a lib/libclangSerialization.a lib/libclangSema.a > > > lib/libclangEdit.a lib/libLLVMBitReader.a lib/libLLVMProfileData.a > > > lib/libclangStaticAnalyzerCheckers.a lib/libclangStaticAnalyzerCore.a > > > lib/libclangASTMatchers.a lib/libclangRewrite.a lib/libclangAnalysis.a > > > lib/libclangAST.a lib/libclangLex.a lib/libclangBasic.a lib/libLLVMCore.a > > > lib/libLLVMBinaryFormat.a lib/libLLVMMC.a lib/libLLVMSupport.a -lrt -ldl > > > -ltinfo -lpthread -lz -lm lib/libLLVMDemangle.a && : > > > lib/libclangTidyReadabilityModule.a(FunctionCognitiveComplexityCheck.cpp.o):FunctionCognitiveComplexityCheck.cpp:function > > > > > > clang::tidy::readability::FunctionCognitiveComplexityCheck::check(clang::ast_matchers::MatchFinder::MatchResult > > > const&): error: undefined reference to > > > 'clang::tidy::readability::(anonymous > > > namespace)::CognitiveComplexity::Msgs' > > > ``` > > > Same if `process()` returns `std::pair` and in > > > `FunctionCognitiveComplexityCheck::check()` i do `const char > > > *IncreaseMessage = Visitor.CC.Msgs[IncreaseMsgId];` > > might the `static` cause that linking error? > > Did you consider using `StringRef` instead of `const char*`? It is better > > behaved. > > > > ```constexpr std::array Msgs = { /* messages */ };``` > Actually, found a combination that works, done. > FIXME: so should `const std::array > CognitiveComplexity::Msgs` be `static` and initialized out-of-line, or not > `static`, but initialized in-line? Since it is already in an anonymous namespace, static would be duplicated, wouldn't it? I like it now! Comment at: docs/ReleaseNotes.rst:138 + + Checks function Cognitive Complexity metric, and flags the functions with + Cognitive Complexity exce
[PATCH] D36836: [clang-tidy] Implement readability-function-cognitive-complexity check
lebedev.ri added inline comments. Comment at: clang-tidy/readability/FunctionCognitiveComplexityCheck.cpp:102-114 +const std::array CognitiveComplexity::Msgs = {{ +// B1 + B2 + B3 +"+%0, including nesting penalty of %1, nesting level increased to %2", + +// B1 + B2 +"+%0, nesting level increased to %2", + JonasToth wrote: > lebedev.ri wrote: > > JonasToth wrote: > > > lebedev.ri wrote: > > > > JonasToth wrote: > > > > > could this initialization land in line 45? that would be directly > > > > > close to the criteria. > > > > It would be nice indeed, but if i do > > > > ``` > > > > // All the possible messages that can be outputed. The choice of the > > > > message > > > > // to use is based of the combination of the Criterias > > > > static constexpr std::array Msgs = {{ > > > > // B1 + B2 + B3 > > > > "+%0, including nesting penalty of %1, nesting level increased to > > > > %2", > > > > > > > > // B1 + B2 > > > > "+%0, nesting level increased to %2", > > > > > > > > // B1 > > > > "+%0", > > > > > > > > // B2 > > > > "nesting level increased to %2", > > > > }}; > > > > ``` > > > > i get > > > > ``` > > > > $ ninja check-clang-tools -j1 > > > > [1/5] Linking CXX executable bin/clang-tidy > > > > FAILED: bin/clang-tidy > > > > : && /usr/local/bin/clang++ -fPIC -fvisibility-inlines-hidden > > > > -Werror=date-time -Werror=unguarded-availability-new -std=c++11 -Wall > > > > -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual > > > > -Wmissing-field-initializers -pedantic -Wno-long-long > > > > -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor > > > > -Wstring-conversion -fcolor-diagnostics -ffunction-sections > > > > -fdata-sections -fno-common -Woverloaded-virtual -Wno-nested-anon-types > > > > -O3 -DNDEBUG -Wl,-allow-shlib-undefined-Wl,-O3 -Wl,--gc-sections > > > > tools/clang/tools/extra/clang-tidy/tool/CMakeFiles/clang-tidy.dir/ClangTidyMain.cpp.o > > > > -o bin/clang-tidy -Wl,-rpath,"\$ORIGIN/../lib" lib/libLLVMSupport.a > > > > -lpthread lib/libclangAST.a lib/libclangASTMatchers.a > > > > lib/libclangBasic.a lib/libclangTidy.a lib/libclangTidyAndroidModule.a > > > > lib/libclangTidyBoostModule.a lib/libclangTidyBugproneModule.a > > > > lib/libclangTidyCERTModule.a lib/libclangTidyCppCoreGuidelinesModule.a > > > > lib/libclangTidyGoogleModule.a lib/libclangTidyHICPPModule.a > > > > lib/libclangTidyLLVMModule.a lib/libclangTidyMiscModule.a > > > > lib/libclangTidyModernizeModule.a lib/libclangTidyMPIModule.a > > > > lib/libclangTidyPerformanceModule.a lib/libclangTidyReadabilityModule.a > > > > lib/libclangTooling.a lib/libclangToolingCore.a > > > > lib/libclangTidyCppCoreGuidelinesModule.a > > > > lib/libclangTidyGoogleModule.a lib/libclangTidyMiscModule.a > > > > lib/libclangTidyReadabilityModule.a lib/libclangTidyUtils.a > > > > lib/libclangTidy.a lib/libclangTooling.a lib/libclangFormat.a > > > > lib/libclangToolingCore.a lib/libclangStaticAnalyzerFrontend.a > > > > lib/libclangFrontend.a lib/libclangDriver.a lib/libLLVMOption.a > > > > lib/libclangParse.a lib/libLLVMMCParser.a lib/libclangSerialization.a > > > > lib/libclangSema.a lib/libclangEdit.a lib/libLLVMBitReader.a > > > > lib/libLLVMProfileData.a lib/libclangStaticAnalyzerCheckers.a > > > > lib/libclangStaticAnalyzerCore.a lib/libclangASTMatchers.a > > > > lib/libclangRewrite.a lib/libclangAnalysis.a lib/libclangAST.a > > > > lib/libclangLex.a lib/libclangBasic.a lib/libLLVMCore.a > > > > lib/libLLVMBinaryFormat.a lib/libLLVMMC.a lib/libLLVMSupport.a -lrt > > > > -ldl -ltinfo -lpthread -lz -lm lib/libLLVMDemangle.a && : > > > > lib/libclangTidyReadabilityModule.a(FunctionCognitiveComplexityCheck.cpp.o):FunctionCognitiveComplexityCheck.cpp:function > > > > > > > > clang::tidy::readability::FunctionCognitiveComplexityCheck::check(clang::ast_matchers::MatchFinder::MatchResult > > > > const&): error: undefined reference to > > > > 'clang::tidy::readability::(anonymous > > > > namespace)::CognitiveComplexity::Msgs' > > > > ``` > > > > Same if `process()` returns `std::pair` and > > > > in `FunctionCognitiveComplexityCheck::check()` i do `const char > > > > *IncreaseMessage = Visitor.CC.Msgs[IncreaseMsgId];` > > > might the `static` cause that linking error? > > > Did you consider using `StringRef` instead of `const char*`? It is better > > > behaved. > > > > > > ```constexpr std::array Msgs = { /* messages */ };``` > > Actually, found a combination that works, done. > > FIXME: so should `const std::array > > CognitiveComplexity::Msgs` be `static` and initialized out-of-line, or not > > `static`, but initialized in-line? > Since it is already in an anonymous namespace, static would be duplicated, > wouldn't it? I like it now! `Msgs` is in a `struct CognitiveComplexity`, which is in anonymous namespace Repository: rL LLVM https://reviews.llvm.org/D36836 __
[PATCH] D36836: [clang-tidy] Implement readability-function-cognitive-complexity check
JonasToth added inline comments. Comment at: clang-tidy/readability/FunctionCognitiveComplexityCheck.cpp:102-114 +const std::array CognitiveComplexity::Msgs = {{ +// B1 + B2 + B3 +"+%0, including nesting penalty of %1, nesting level increased to %2", + +// B1 + B2 +"+%0, nesting level increased to %2", + lebedev.ri wrote: > JonasToth wrote: > > lebedev.ri wrote: > > > JonasToth wrote: > > > > lebedev.ri wrote: > > > > > JonasToth wrote: > > > > > > could this initialization land in line 45? that would be directly > > > > > > close to the criteria. > > > > > It would be nice indeed, but if i do > > > > > ``` > > > > > // All the possible messages that can be outputed. The choice of > > > > > the message > > > > > // to use is based of the combination of the Criterias > > > > > static constexpr std::array Msgs = {{ > > > > > // B1 + B2 + B3 > > > > > "+%0, including nesting penalty of %1, nesting level increased > > > > > to %2", > > > > > > > > > > // B1 + B2 > > > > > "+%0, nesting level increased to %2", > > > > > > > > > > // B1 > > > > > "+%0", > > > > > > > > > > // B2 > > > > > "nesting level increased to %2", > > > > > }}; > > > > > ``` > > > > > i get > > > > > ``` > > > > > $ ninja check-clang-tools -j1 > > > > > [1/5] Linking CXX executable bin/clang-tidy > > > > > FAILED: bin/clang-tidy > > > > > : && /usr/local/bin/clang++ -fPIC -fvisibility-inlines-hidden > > > > > -Werror=date-time -Werror=unguarded-availability-new -std=c++11 -Wall > > > > > -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual > > > > > -Wmissing-field-initializers -pedantic -Wno-long-long > > > > > -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor > > > > > -Wstring-conversion -fcolor-diagnostics -ffunction-sections > > > > > -fdata-sections -fno-common -Woverloaded-virtual > > > > > -Wno-nested-anon-types -O3 -DNDEBUG -Wl,-allow-shlib-undefined > > > > > -Wl,-O3 -Wl,--gc-sections > > > > > tools/clang/tools/extra/clang-tidy/tool/CMakeFiles/clang-tidy.dir/ClangTidyMain.cpp.o > > > > > -o bin/clang-tidy -Wl,-rpath,"\$ORIGIN/../lib" > > > > > lib/libLLVMSupport.a -lpthread lib/libclangAST.a > > > > > lib/libclangASTMatchers.a lib/libclangBasic.a lib/libclangTidy.a > > > > > lib/libclangTidyAndroidModule.a lib/libclangTidyBoostModule.a > > > > > lib/libclangTidyBugproneModule.a lib/libclangTidyCERTModule.a > > > > > lib/libclangTidyCppCoreGuidelinesModule.a > > > > > lib/libclangTidyGoogleModule.a lib/libclangTidyHICPPModule.a > > > > > lib/libclangTidyLLVMModule.a lib/libclangTidyMiscModule.a > > > > > lib/libclangTidyModernizeModule.a lib/libclangTidyMPIModule.a > > > > > lib/libclangTidyPerformanceModule.a > > > > > lib/libclangTidyReadabilityModule.a lib/libclangTooling.a > > > > > lib/libclangToolingCore.a lib/libclangTidyCppCoreGuidelinesModule.a > > > > > lib/libclangTidyGoogleModule.a lib/libclangTidyMiscModule.a > > > > > lib/libclangTidyReadabilityModule.a lib/libclangTidyUtils.a > > > > > lib/libclangTidy.a lib/libclangTooling.a lib/libclangFormat.a > > > > > lib/libclangToolingCore.a lib/libclangStaticAnalyzerFrontend.a > > > > > lib/libclangFrontend.a lib/libclangDriver.a lib/libLLVMOption.a > > > > > lib/libclangParse.a lib/libLLVMMCParser.a lib/libclangSerialization.a > > > > > lib/libclangSema.a lib/libclangEdit.a lib/libLLVMBitReader.a > > > > > lib/libLLVMProfileData.a lib/libclangStaticAnalyzerCheckers.a > > > > > lib/libclangStaticAnalyzerCore.a lib/libclangASTMatchers.a > > > > > lib/libclangRewrite.a lib/libclangAnalysis.a lib/libclangAST.a > > > > > lib/libclangLex.a lib/libclangBasic.a lib/libLLVMCore.a > > > > > lib/libLLVMBinaryFormat.a lib/libLLVMMC.a lib/libLLVMSupport.a -lrt > > > > > -ldl -ltinfo -lpthread -lz -lm lib/libLLVMDemangle.a && : > > > > > lib/libclangTidyReadabilityModule.a(FunctionCognitiveComplexityCheck.cpp.o):FunctionCognitiveComplexityCheck.cpp:function > > > > > > > > > > clang::tidy::readability::FunctionCognitiveComplexityCheck::check(clang::ast_matchers::MatchFinder::MatchResult > > > > > const&): error: undefined reference to > > > > > 'clang::tidy::readability::(anonymous > > > > > namespace)::CognitiveComplexity::Msgs' > > > > > ``` > > > > > Same if `process()` returns `std::pair` and > > > > > in `FunctionCognitiveComplexityCheck::check()` i do `const char > > > > > *IncreaseMessage = Visitor.CC.Msgs[IncreaseMsgId];` > > > > might the `static` cause that linking error? > > > > Did you consider using `StringRef` instead of `const char*`? It is > > > > better behaved. > > > > > > > > ```constexpr std::array Msgs = { /* messages */ };``` > > > Actually, found a combination that works, done. > > > FIXME: so should `const std::array > > > CognitiveComplexity::Msgs` be `static` and initialized out-of-line, or > > > not `static`, but initialized in-line? > > Since it is already in an anonymous
[PATCH] D36836: [clang-tidy] Implement readability-function-cognitive-complexity check
lebedev.ri added a comment. In https://reviews.llvm.org/D36836#873246, @JonasToth wrote: > For my part the current state is ok. @JonasToth thank you for the review! > but @alexfh and @aaron.ballman should do their review before committing. +1 :) Now what one full review is done, it may be easier to start for the other reviewers.. > I would be interested in a exampleoutput for any real project. TBD Comment at: clang-tidy/readability/FunctionCognitiveComplexityCheck.cpp:102-114 +const std::array CognitiveComplexity::Msgs = {{ +// B1 + B2 + B3 +"+%0, including nesting penalty of %1, nesting level increased to %2", + +// B1 + B2 +"+%0, nesting level increased to %2", + JonasToth wrote: > lebedev.ri wrote: > > JonasToth wrote: > > > lebedev.ri wrote: > > > > JonasToth wrote: > > > > > lebedev.ri wrote: > > > > > > JonasToth wrote: > > > > > > > could this initialization land in line 45? that would be directly > > > > > > > close to the criteria. > > > > > > It would be nice indeed, but if i do > > > > > > ``` > > > > > > // All the possible messages that can be outputed. The choice of > > > > > > the message > > > > > > // to use is based of the combination of the Criterias > > > > > > static constexpr std::array Msgs = {{ > > > > > > // B1 + B2 + B3 > > > > > > "+%0, including nesting penalty of %1, nesting level > > > > > > increased to %2", > > > > > > > > > > > > // B1 + B2 > > > > > > "+%0, nesting level increased to %2", > > > > > > > > > > > > // B1 > > > > > > "+%0", > > > > > > > > > > > > // B2 > > > > > > "nesting level increased to %2", > > > > > > }}; > > > > > > ``` > > > > > > i get > > > > > > ``` > > > > > > $ ninja check-clang-tools -j1 > > > > > > [1/5] Linking CXX executable bin/clang-tidy > > > > > > FAILED: bin/clang-tidy > > > > > > : && /usr/local/bin/clang++ -fPIC -fvisibility-inlines-hidden > > > > > > -Werror=date-time -Werror=unguarded-availability-new -std=c++11 > > > > > > -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual > > > > > > -Wmissing-field-initializers -pedantic -Wno-long-long > > > > > > -Wcovered-switch-default -Wnon-virtual-dtor > > > > > > -Wdelete-non-virtual-dtor -Wstring-conversion -fcolor-diagnostics > > > > > > -ffunction-sections -fdata-sections -fno-common > > > > > > -Woverloaded-virtual -Wno-nested-anon-types -O3 -DNDEBUG > > > > > > -Wl,-allow-shlib-undefined-Wl,-O3 -Wl,--gc-sections > > > > > > tools/clang/tools/extra/clang-tidy/tool/CMakeFiles/clang-tidy.dir/ClangTidyMain.cpp.o > > > > > > -o bin/clang-tidy -Wl,-rpath,"\$ORIGIN/../lib" > > > > > > lib/libLLVMSupport.a -lpthread lib/libclangAST.a > > > > > > lib/libclangASTMatchers.a lib/libclangBasic.a lib/libclangTidy.a > > > > > > lib/libclangTidyAndroidModule.a lib/libclangTidyBoostModule.a > > > > > > lib/libclangTidyBugproneModule.a lib/libclangTidyCERTModule.a > > > > > > lib/libclangTidyCppCoreGuidelinesModule.a > > > > > > lib/libclangTidyGoogleModule.a lib/libclangTidyHICPPModule.a > > > > > > lib/libclangTidyLLVMModule.a lib/libclangTidyMiscModule.a > > > > > > lib/libclangTidyModernizeModule.a lib/libclangTidyMPIModule.a > > > > > > lib/libclangTidyPerformanceModule.a > > > > > > lib/libclangTidyReadabilityModule.a lib/libclangTooling.a > > > > > > lib/libclangToolingCore.a lib/libclangTidyCppCoreGuidelinesModule.a > > > > > > lib/libclangTidyGoogleModule.a lib/libclangTidyMiscModule.a > > > > > > lib/libclangTidyReadabilityModule.a lib/libclangTidyUtils.a > > > > > > lib/libclangTidy.a lib/libclangTooling.a lib/libclangFormat.a > > > > > > lib/libclangToolingCore.a lib/libclangStaticAnalyzerFrontend.a > > > > > > lib/libclangFrontend.a lib/libclangDriver.a lib/libLLVMOption.a > > > > > > lib/libclangParse.a lib/libLLVMMCParser.a > > > > > > lib/libclangSerialization.a lib/libclangSema.a lib/libclangEdit.a > > > > > > lib/libLLVMBitReader.a lib/libLLVMProfileData.a > > > > > > lib/libclangStaticAnalyzerCheckers.a > > > > > > lib/libclangStaticAnalyzerCore.a lib/libclangASTMatchers.a > > > > > > lib/libclangRewrite.a lib/libclangAnalysis.a lib/libclangAST.a > > > > > > lib/libclangLex.a lib/libclangBasic.a lib/libLLVMCore.a > > > > > > lib/libLLVMBinaryFormat.a lib/libLLVMMC.a lib/libLLVMSupport.a -lrt > > > > > > -ldl -ltinfo -lpthread -lz -lm lib/libLLVMDemangle.a && : > > > > > > lib/libclangTidyReadabilityModule.a(FunctionCognitiveComplexityCheck.cpp.o):FunctionCognitiveComplexityCheck.cpp:function > > > > > > > > > > > > clang::tidy::readability::FunctionCognitiveComplexityCheck::check(clang::ast_matchers::MatchFinder::MatchResult > > > > > > const&): error: undefined reference to > > > > > > 'clang::tidy::readability::(anonymous > > > > > > namespace)::CognitiveComplexity::Msgs' > > > > > > ``` > > > > > > Same if `process()` returns `std::pair` > > > > > > and in `FunctionCognitiveComplexityCheck::check()` i
Re: [PATCH] D37954: Expand absolute system header paths when using -MD depfiles
Have you checked how much the additional stat()ing added in this patch slows down builds? On Sep 16, 2017 11:49 PM, "Peter Wu via Phabricator via cfe-commits" < cfe-commits@lists.llvm.org> wrote: > Lekensteyn added a comment. > > I tried to contact Simon (the author of the GCC) patch with a question > about the -fno-canonical-system-headers, but his Google address is bouncing. > > GCC has long survived with doing this by default, I wonder if this option > could just me omitted, enabling the feature by default. > > > https://reviews.llvm.org/D37954 > > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r313487 - Fix the second half of PR34266: Don't implicitly capture '*this' if the members are found in a class unrelated to the enclosing class.
Author: faisalv Date: Sun Sep 17 08:37:51 2017 New Revision: 313487 URL: http://llvm.org/viewvc/llvm-project?rev=313487&view=rev Log: Fix the second half of PR34266: Don't implicitly capture '*this' if the members are found in a class unrelated to the enclosing class. https://bugs.llvm.org/show_bug.cgi?id=34266 For e.g. struct A { void f(int); static void f(char); }; struct B { auto foo() { return [&] (auto a) { A::f(a); // this should not cause a capture of '*this' }; } }; The patch does the following: 1) It moves the check to attempt an implicit capture of '*this' by reference into the more logical location of when the call is actually built within ActOnCallExpr (as opposed to when the unresolved-member-lookup node is created). - Reminder: A capture of '*this' by value has to always be an explicit capture. 2) It additionally checks whether the naming class of the UnresolvedMemberExpr ('A' in the example above) is related to the enclosing class ('B' above). P.S. If you have access to ISO-C++'s CWG reflector, see this thread for some potentially related discussion: http://lists.isocpp.org/core/2017/08/2851.php Modified: cfe/trunk/lib/Sema/SemaExpr.cpp cfe/trunk/lib/Sema/SemaExprMember.cpp cfe/trunk/test/SemaCXX/cxx1y-generic-lambdas-capturing.cpp Modified: cfe/trunk/lib/Sema/SemaExpr.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=313487&r1=313486&r2=313487&view=diff == --- cfe/trunk/lib/Sema/SemaExpr.cpp (original) +++ cfe/trunk/lib/Sema/SemaExpr.cpp Sun Sep 17 08:37:51 2017 @@ -5125,6 +5125,87 @@ static void checkDirectCallValidity(Sema } } +static bool enclosingClassIsRelatedToClassInWhichMembersWereFound( +const UnresolvedMemberExpr *const UME, Sema &S) { + + const auto GetFunctionLevelDCIfCXXClass = + [](Sema &S) -> const CXXRecordDecl * { +const DeclContext *const DC = S.getFunctionLevelDeclContext(); +if (!DC || !DC->getParent()) + return nullptr; + +// If the call to some member function was made from within a member +// function body 'M' return return 'M's parent. +if (const auto *MD = dyn_cast(DC)) + return MD->getParent()->getCanonicalDecl(); +// else the call was made from within a default member initializer of a +// class, so return the class. +if (const auto *RD = dyn_cast(DC)) + return RD->getCanonicalDecl(); +return nullptr; + }; + // If our DeclContext is neither a member function nor a class (in the + // case of a lambda in a default member initializer), we can't have an + // enclosing 'this'. + + const CXXRecordDecl *const CurParentClass = GetFunctionLevelDCIfCXXClass(S); + if (!CurParentClass) +return false; + + // The naming class for implicit member functions call is the class in which + // name lookup starts. + const CXXRecordDecl *const NamingClass = + UME->getNamingClass()->getCanonicalDecl(); + assert(NamingClass && "Must have naming class even for implicit access"); + + // If the unresolved member functions were found in a 'naming class' that is + // related (either the same or derived from) to the class that contains the + // member function that itself contained the implicit member access. + + return CurParentClass == NamingClass || + CurParentClass->isDerivedFrom(NamingClass); +} + +static void +tryImplicitlyCaptureThisIfImplicitMemberFunctionAccessWithDependentArgs( +Sema &S, const UnresolvedMemberExpr *const UME, SourceLocation CallLoc) { + + if (!UME) +return; + + LambdaScopeInfo *const CurLSI = S.getCurLambda(); + // Only try and implicitly capture 'this' within a C++ Lambda if it hasn't + // already been captured, or if this is an implicit member function call (if + // it isn't, an attempt to capture 'this' should already have been made). + if (!CurLSI || CurLSI->ImpCaptureStyle == CurLSI->ImpCap_None || + !UME->isImplicitAccess() || CurLSI->isCXXThisCaptured()) +return; + + // Check if the naming class in which the unresolved members were found is + // related (same as or is a base of) to the enclosing class. + + if (!enclosingClassIsRelatedToClassInWhichMembersWereFound(UME, S)) +return; + + + DeclContext *EnclosingFunctionCtx = S.CurContext->getParent()->getParent(); + // If the enclosing function is not dependent, then this lambda is + // capture ready, so if we can capture this, do so. + if (!EnclosingFunctionCtx->isDependentContext()) { +// If the current lambda and all enclosing lambdas can capture 'this' - +// then go ahead and capture 'this' (since our unresolved overload set +// contains at least one non-static member function). +if (!S.CheckCXXThisCapture(CallLoc, /*Explcit*/ false, /*Diagnose*/ false)) + S.CheckCXXThisCapture(CallLoc); + } else if (S.CurContext->isDependentContext()) { +// ... since this is an
Re: [PATCH] D37954: Expand absolute system header paths when using -MD depfiles
Hi Nico, On Sun, Sep 17, 2017 at 10:47:24AM -0400, Nico Weber wrote: > Have you checked how much the additional stat()ing added in this patch > slows down builds? Additional cost: zero :-) The information is already collected by FileManager::getFile(), calling tryGetRealPathName just reads information without extra stat() calls. For the next patch revision I would have to either add documentation, or remove the -fno-canonical-system-headers option. What would you recommend? Kind regards, Peter > On Sep 16, 2017 11:49 PM, "Peter Wu via Phabricator via cfe-commits" < > cfe-commits@lists.llvm.org> wrote: > > > Lekensteyn added a comment. > > > > I tried to contact Simon (the author of the GCC) patch with a question > > about the -fno-canonical-system-headers, but his Google address is bouncing. > > > > GCC has long survived with doing this by default, I wonder if this option > > could just me omitted, enabling the feature by default. > > > > > > https://reviews.llvm.org/D37954 -- Kind regards, Peter Wu https://lekensteyn.nl ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D37958: [libc++] Correctly propagate user-defined lookup_classname().
Quuxplusone added inline comments. Comment at: libcxx/test/std/re/re.traits/lookup_classname_user_defined.pass.cpp:46 +// matches all characters (they are classified as alnum) +std::wstring re1 = L"([[:alnum:]]+)"; +std::regex_search(in, m, std::wregex(re1)); Could you add a test here for std::wstring re3 = L"([[:ALNUM:]]+)"; std::regex_search(in, m, std::wregex(re3, std::regex_constants::icase)); std::wstring re4 = L"(\\W+)"; std::regex_search(in, m, std::wregex(re4, std::regex_constants::icase)); documenting the expected outputs? It's unclear to me from cppreference http://en.cppreference.com/w/cpp/regex/regex_traits/lookup_classname whether lookup_classname("W") is supposed to produce a result or not (but you seem to assume it does). My understanding is that the "icase" parameter to lookup_classname is talking about the icaseness of the regex matcher; classnames should always be matched with exact case, i.e. `[[:alnum:]]` is always a valid classname and `[[:ALNUM:]]` is always invalid, regardless of regex_constants::icase. But I'm not sure. https://reviews.llvm.org/D37958 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] SpacesBeforeSquareBrackets and SpacesBeforeAngleBrackets options were added All FormatTest passed
Hi, I would present patch: The small extension of clang-format. I added two additional format options: - Space before square bracket. - Space before angle bracket. I know that it's very strange formatting, but unfortunately, it's formatting style in the company I work in it. I'm not really sure what is the patch confirmation process: So, I just attach my patch to the mail. Thanks. Kostya. 0001-SpacesBeforeSquareBrackets-and-SpacesBeforeAngleBrac.patch Description: Binary data ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D37941: [X86] Move even more of our CPU to feature mapping switch to use fallthroughs
This revision was automatically updated to reflect the committed changes. Closed by commit rL313497: [X86] Move even more of our CPU to feature mapping switch to use fallthroughs (authored by ctopper). Changed prior to commit: https://reviews.llvm.org/D37941?vs=115517&id=115585#toc Repository: rL LLVM https://reviews.llvm.org/D37941 Files: cfe/trunk/lib/Basic/Targets/X86.cpp Index: cfe/trunk/lib/Basic/Targets/X86.cpp === --- cfe/trunk/lib/Basic/Targets/X86.cpp +++ cfe/trunk/lib/Basic/Targets/X86.cpp @@ -123,40 +123,14 @@ case CK_PentiumPro: case CK_Lakemont: break; + case CK_PentiumMMX: case CK_Pentium2: case CK_K6: case CK_WinChipC6: setFeatureEnabledImpl(Features, "mmx", true); break; - case CK_Pentium3: - case CK_C3_2: -setFeatureEnabledImpl(Features, "sse", true); -setFeatureEnabledImpl(Features, "fxsr", true); -break; - case CK_PentiumM: - case CK_Pentium4: - case CK_x86_64: -setFeatureEnabledImpl(Features, "sse2", true); -setFeatureEnabledImpl(Features, "fxsr", true); -break; - case CK_Yonah: - case CK_Prescott: - case CK_Nocona: -setFeatureEnabledImpl(Features, "sse3", true); -setFeatureEnabledImpl(Features, "fxsr", true); -setFeatureEnabledImpl(Features, "cx16", true); -break; - case CK_Core2: -setFeatureEnabledImpl(Features, "ssse3", true); -setFeatureEnabledImpl(Features, "fxsr", true); -setFeatureEnabledImpl(Features, "cx16", true); -break; - case CK_Penryn: -setFeatureEnabledImpl(Features, "sse4.1", true); -setFeatureEnabledImpl(Features, "fxsr", true); -setFeatureEnabledImpl(Features, "cx16", true); -break; + case CK_Cannonlake: setFeatureEnabledImpl(Features, "avx512ifma", true); setFeatureEnabledImpl(Features, "avx512vbmi", true); @@ -207,9 +181,30 @@ LLVM_FALLTHROUGH; case CK_Nehalem: setFeatureEnabledImpl(Features, "sse4.2", true); -setFeatureEnabledImpl(Features, "fxsr", true); +LLVM_FALLTHROUGH; + case CK_Penryn: +setFeatureEnabledImpl(Features, "sse4.1", true); +LLVM_FALLTHROUGH; + case CK_Core2: +setFeatureEnabledImpl(Features, "ssse3", true); +LLVM_FALLTHROUGH; + case CK_Yonah: + case CK_Prescott: + case CK_Nocona: +setFeatureEnabledImpl(Features, "sse3", true); setFeatureEnabledImpl(Features, "cx16", true); +LLVM_FALLTHROUGH; + case CK_PentiumM: + case CK_Pentium4: + case CK_x86_64: +setFeatureEnabledImpl(Features, "sse2", true); +LLVM_FALLTHROUGH; + case CK_Pentium3: + case CK_C3_2: +setFeatureEnabledImpl(Features, "sse", true); +setFeatureEnabledImpl(Features, "fxsr", true); break; + case CK_Goldmont: setFeatureEnabledImpl(Features, "sha", true); setFeatureEnabledImpl(Features, "rdrnd", true); @@ -232,6 +227,7 @@ setFeatureEnabledImpl(Features, "fxsr", true); setFeatureEnabledImpl(Features, "cx16", true); break; + case CK_KNL: setFeatureEnabledImpl(Features, "avx512f", true); setFeatureEnabledImpl(Features, "avx512cd", true); @@ -256,36 +252,34 @@ setFeatureEnabledImpl(Features, "xsave", true); setFeatureEnabledImpl(Features, "movbe", true); break; + case CK_K6_2: case CK_K6_3: case CK_WinChip2: case CK_C3: setFeatureEnabledImpl(Features, "3dnow", true); break; - case CK_Athlon: - case CK_Geode: -setFeatureEnabledImpl(Features, "3dnowa", true); -break; - case CK_AthlonXP: -setFeatureEnabledImpl(Features, "sse", true); -setFeatureEnabledImpl(Features, "3dnowa", true); -setFeatureEnabledImpl(Features, "fxsr", true); -break; - case CK_K8: -setFeatureEnabledImpl(Features, "sse2", true); -setFeatureEnabledImpl(Features, "3dnowa", true); -setFeatureEnabledImpl(Features, "fxsr", true); -break; + case CK_AMDFAM10: setFeatureEnabledImpl(Features, "sse4a", true); setFeatureEnabledImpl(Features, "lzcnt", true); setFeatureEnabledImpl(Features, "popcnt", true); LLVM_FALLTHROUGH; case CK_K8SSE3: setFeatureEnabledImpl(Features, "sse3", true); -setFeatureEnabledImpl(Features, "3dnowa", true); +LLVM_FALLTHROUGH; + case CK_K8: +setFeatureEnabledImpl(Features, "sse2", true); +LLVM_FALLTHROUGH; + case CK_AthlonXP: +setFeatureEnabledImpl(Features, "sse", true); setFeatureEnabledImpl(Features, "fxsr", true); +LLVM_FALLTHROUGH; + case CK_Athlon: + case CK_Geode: +setFeatureEnabledImpl(Features, "3dnowa", true); break; + case CK_BTVER2: setFeatureEnabledImpl(Features, "avx", true); setFeatureEnabledImpl(Features, "aes", true); @@ -304,6 +298,7 @@ setFeatureEnabledImpl(Features, "cx16", true); setFeatureEnabledImpl(Features, "fxsr", true); break; + case CK_ZNVER1: setFeatureEnabledImpl(Features, "adx", true); setFeatureEnabledImpl(Features, "aes", true); @@ -332,6 +327,7 @@ setFeatureEnable
r313497 - [X86] Move even more of our CPU to feature mapping switch to use fallthroughs
Author: ctopper Date: Sun Sep 17 12:05:46 2017 New Revision: 313497 URL: http://llvm.org/viewvc/llvm-project?rev=313497&view=rev Log: [X86] Move even more of our CPU to feature mapping switch to use fallthroughs This arranges more of the Intel and AMD CPUs into fallthrough positions based on their features. We may be able to merge this new AMD set with the BTVER or BDVER sets but I didn't look that closely. Differential Revision: https://reviews.llvm.org/D37941 Modified: cfe/trunk/lib/Basic/Targets/X86.cpp Modified: cfe/trunk/lib/Basic/Targets/X86.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/X86.cpp?rev=313497&r1=313496&r2=313497&view=diff == --- cfe/trunk/lib/Basic/Targets/X86.cpp (original) +++ cfe/trunk/lib/Basic/Targets/X86.cpp Sun Sep 17 12:05:46 2017 @@ -123,40 +123,14 @@ bool X86TargetInfo::initFeatureMap( case CK_PentiumPro: case CK_Lakemont: break; + case CK_PentiumMMX: case CK_Pentium2: case CK_K6: case CK_WinChipC6: setFeatureEnabledImpl(Features, "mmx", true); break; - case CK_Pentium3: - case CK_C3_2: -setFeatureEnabledImpl(Features, "sse", true); -setFeatureEnabledImpl(Features, "fxsr", true); -break; - case CK_PentiumM: - case CK_Pentium4: - case CK_x86_64: -setFeatureEnabledImpl(Features, "sse2", true); -setFeatureEnabledImpl(Features, "fxsr", true); -break; - case CK_Yonah: - case CK_Prescott: - case CK_Nocona: -setFeatureEnabledImpl(Features, "sse3", true); -setFeatureEnabledImpl(Features, "fxsr", true); -setFeatureEnabledImpl(Features, "cx16", true); -break; - case CK_Core2: -setFeatureEnabledImpl(Features, "ssse3", true); -setFeatureEnabledImpl(Features, "fxsr", true); -setFeatureEnabledImpl(Features, "cx16", true); -break; - case CK_Penryn: -setFeatureEnabledImpl(Features, "sse4.1", true); -setFeatureEnabledImpl(Features, "fxsr", true); -setFeatureEnabledImpl(Features, "cx16", true); -break; + case CK_Cannonlake: setFeatureEnabledImpl(Features, "avx512ifma", true); setFeatureEnabledImpl(Features, "avx512vbmi", true); @@ -207,9 +181,30 @@ bool X86TargetInfo::initFeatureMap( LLVM_FALLTHROUGH; case CK_Nehalem: setFeatureEnabledImpl(Features, "sse4.2", true); -setFeatureEnabledImpl(Features, "fxsr", true); +LLVM_FALLTHROUGH; + case CK_Penryn: +setFeatureEnabledImpl(Features, "sse4.1", true); +LLVM_FALLTHROUGH; + case CK_Core2: +setFeatureEnabledImpl(Features, "ssse3", true); +LLVM_FALLTHROUGH; + case CK_Yonah: + case CK_Prescott: + case CK_Nocona: +setFeatureEnabledImpl(Features, "sse3", true); setFeatureEnabledImpl(Features, "cx16", true); +LLVM_FALLTHROUGH; + case CK_PentiumM: + case CK_Pentium4: + case CK_x86_64: +setFeatureEnabledImpl(Features, "sse2", true); +LLVM_FALLTHROUGH; + case CK_Pentium3: + case CK_C3_2: +setFeatureEnabledImpl(Features, "sse", true); +setFeatureEnabledImpl(Features, "fxsr", true); break; + case CK_Goldmont: setFeatureEnabledImpl(Features, "sha", true); setFeatureEnabledImpl(Features, "rdrnd", true); @@ -232,6 +227,7 @@ bool X86TargetInfo::initFeatureMap( setFeatureEnabledImpl(Features, "fxsr", true); setFeatureEnabledImpl(Features, "cx16", true); break; + case CK_KNL: setFeatureEnabledImpl(Features, "avx512f", true); setFeatureEnabledImpl(Features, "avx512cd", true); @@ -256,26 +252,14 @@ bool X86TargetInfo::initFeatureMap( setFeatureEnabledImpl(Features, "xsave", true); setFeatureEnabledImpl(Features, "movbe", true); break; + case CK_K6_2: case CK_K6_3: case CK_WinChip2: case CK_C3: setFeatureEnabledImpl(Features, "3dnow", true); break; - case CK_Athlon: - case CK_Geode: -setFeatureEnabledImpl(Features, "3dnowa", true); -break; - case CK_AthlonXP: -setFeatureEnabledImpl(Features, "sse", true); -setFeatureEnabledImpl(Features, "3dnowa", true); -setFeatureEnabledImpl(Features, "fxsr", true); -break; - case CK_K8: -setFeatureEnabledImpl(Features, "sse2", true); -setFeatureEnabledImpl(Features, "3dnowa", true); -setFeatureEnabledImpl(Features, "fxsr", true); -break; + case CK_AMDFAM10: setFeatureEnabledImpl(Features, "sse4a", true); setFeatureEnabledImpl(Features, "lzcnt", true); @@ -283,9 +267,19 @@ bool X86TargetInfo::initFeatureMap( LLVM_FALLTHROUGH; case CK_K8SSE3: setFeatureEnabledImpl(Features, "sse3", true); -setFeatureEnabledImpl(Features, "3dnowa", true); +LLVM_FALLTHROUGH; + case CK_K8: +setFeatureEnabledImpl(Features, "sse2", true); +LLVM_FALLTHROUGH; + case CK_AthlonXP: +setFeatureEnabledImpl(Features, "sse", true); setFeatureEnabledImpl(Features, "fxsr", true); +LLVM_FALLTHROUGH; + case CK_Athlon: + case CK_Geode: +setFeatureEnabledImpl(Features, "3d
[PATCH] D37806: [analyzer] PthreadLock: Fix return values of XNU lock functions.
NoQ added inline comments. Comment at: lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp:271 } -assert(lockFail && lockSucc); -C.addTransition(lockFail); - +// We might want to handle the case when the mutex lock function was inlined +// and returned an Unknown or Undefined value. zaks.anna wrote: > This comment is repeated several times... Because it is relevant in both places. Should i rephrase with "also"/"as well"/"here too"? Comment at: test/Analysis/Inputs/system-header-simulator-for-pthread-lock.h:29 +extern void lck_mtx_unlock(lck_mtx_t *); +extern boolean_t lck_mtx_try_lock(lck_mtx_t *); extern void lck_mtx_destroy(lck_mtx_t *lck, lck_grp_t *grp); zaks.anna wrote: > Should there be a test added that uses the function? The tests are already there for all three functions. I just fixed their prototype to match the real-world prototype, and then adjusted the code accordingly, so that the existing tests kept passing. https://reviews.llvm.org/D37806 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D37809: [analyzer] PthreadLock: Refactor, use PostCall API. NFC.
NoQ updated this revision to Diff 115586. NoQ added a comment. Remove the changes in tests for now. I guess they'd need more cleanup anyway. https://reviews.llvm.org/D37809 Files: lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp Index: lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp === --- lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp +++ lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp @@ -17,7 +17,7 @@ #include "clang/StaticAnalyzer/Core/Checker.h" #include "clang/StaticAnalyzer/Core/CheckerManager.h" #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h" -#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h" +#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h" using namespace clang; using namespace ento; @@ -67,7 +67,7 @@ }; class PthreadLockChecker -: public Checker, check::DeadSymbols> { +: public Checker { mutable std::unique_ptr BT_doublelock; mutable std::unique_ptr BT_doubleunlock; mutable std::unique_ptr BT_destroylock; @@ -78,23 +78,54 @@ PthreadSemantics, XNUSemantics }; -public: - void checkPostStmt(const CallExpr *CE, CheckerContext &C) const; - void checkDeadSymbols(SymbolReaper &SymReaper, CheckerContext &C) const; - void printState(raw_ostream &Out, ProgramStateRef State, - const char *NL, const char *Sep) const override; - void AcquireLock(CheckerContext &C, const CallExpr *CE, SVal lock, - bool isTryLock, enum LockingSemantics semantics) const; + typedef void (PthreadLockChecker::*FnCheck)(const CallEvent &Call, + CheckerContext &C) const; + struct SupportedAPI { +CallDescription Name; +FnCheck Callback; + }; + typedef SmallVector SupportedAPIList; + SupportedAPIList SupportedAPIs; - void ReleaseLock(CheckerContext &C, const CallExpr *CE, SVal lock) const; - void DestroyLock(CheckerContext &C, const CallExpr *CE, SVal Lock, - enum LockingSemantics semantics) const; - void InitLock(CheckerContext &C, const CallExpr *CE, SVal Lock) const; - void reportUseDestroyedBug(CheckerContext &C, const CallExpr *CE) const; ProgramStateRef resolvePossiblyDestroyedMutex(ProgramStateRef state, const MemRegion *lockR, const SymbolRef *sym) const; + void reportUseDestroyedBug(const CallEvent &Call, CheckerContext &C, + unsigned ArgNo) const; + + // Init. + void InitAnyLock(const CallEvent &Call, CheckerContext &C) const; + void InitLockAux(const CallEvent &Call, CheckerContext &C, unsigned ArgNo, + SVal Lock) const; + + // Lock, Try-lock. + void AcquirePthreadLock(const CallEvent &Call, CheckerContext &C) const; + void AcquireXNULock(const CallEvent &Call, CheckerContext &C) const; + void TryPthreadLock(const CallEvent &Call, CheckerContext &C) const; + void TryXNULock(const CallEvent &Call, CheckerContext &C) const; + void AcquireLockAux(const CallEvent &Call, CheckerContext &C, unsigned ArgNo, + SVal lock, bool isTryLock, + enum LockingSemantics semantics) const; + + // Release. + void ReleaseAnyLock(const CallEvent &Call, CheckerContext &C) const; + void ReleaseLockAux(const CallEvent &Call, CheckerContext &C, unsigned ArgNo, + SVal lock) const; + + // Destroy. + void DestroyPthreadLock(const CallEvent &Call, CheckerContext &C) const; + void DestroyXNULock(const CallEvent &Call, CheckerContext &C) const; + void DestroyLockAux(const CallEvent &Call, CheckerContext &C, unsigned ArgNo, + SVal Lock, enum LockingSemantics semantics) const; + +public: + PthreadLockChecker(); + + void checkPostCall(const CallEvent &Call, CheckerContext &C) const; + void checkDeadSymbols(SymbolReaper &SymReaper, CheckerContext &C) const; + void printState(raw_ostream &Out, ProgramStateRef State, + const char *NL, const char *Sep) const override; }; } // end anonymous namespace @@ -107,50 +138,55 @@ // Return values for unresolved calls to pthread_mutex_destroy(). REGISTER_MAP_WITH_PROGRAMSTATE(DestroyRetVal, const MemRegion *, SymbolRef) -void PthreadLockChecker::checkPostStmt(const CallExpr *CE, +PthreadLockChecker::PthreadLockChecker() : SupportedAPIs({ + // Init. + {{"pthread_mutex_init",2}, &PthreadLockChecker::InitAnyLock}, + // TODO: pthread_rwlock_init(2 arguments). + // TODO: lck_mtx_init(3 arguments). + // TODO: lck_mtx_alloc_init(2 arguments) => returns the mutex. + // TODO: lck_rw_init(3 arguments). + // TODO: lck_rw_alloc_init(2 arguments) => returns the mutex. + + // Acquire. + {{"pthread_mutex_lock",1}, &PthreadLockChecker::AcquirePthreadLock}, + {{"pthread_rwlock_rdlock", 1}, &PthreadLockChecker::AcquirePthreadLock}, + {{"pthr
Re: r313315 - Diagnostic specific failed condition in a static_assert.
I'll correct them. /Eric On Sat, Sep 16, 2017 at 6:28 PM, Richard Smith wrote: > This is a bug in the libc++ tests. It's OK for them to check that the > static_assert message is produced, but not that they're prefixed with the > exact string "static_assert failed:". > > On 16 September 2017 at 05:54, NAKAMURA Takumi via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> This triggered failure in libcxx tests. >> http://bb.pgr.jp/builders/bootstrap-clang-libcxx-lld-i686-linux/builds/97 >> >> >> On Fri, Sep 15, 2017 at 8:40 AM Douglas Gregor via cfe-commits < >> cfe-commits@lists.llvm.org> wrote: >> >>> Author: dgregor >>> Date: Thu Sep 14 16:38:42 2017 >>> New Revision: 313315 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=313315&view=rev >>> Log: >>> Diagnostic specific failed condition in a static_assert. >>> >>> When a static_assert fails, dig out a specific condition to diagnose, >>> using the same logic that we use to find the enable_if condition to >>> diagnose. >>> >>> Modified: >>> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td >>> cfe/trunk/include/clang/Sema/Sema.h >>> cfe/trunk/lib/Sema/SemaDeclCXX.cpp >>> cfe/trunk/lib/Sema/SemaTemplate.cpp >>> cfe/trunk/test/SemaCXX/static-assert.cpp >>> >>> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td >>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ >>> Basic/DiagnosticSemaKinds.td?rev=313315&r1=313314&r2=313315&view=diff >>> >>> == >>> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) >>> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Sep 14 >>> 16:38:42 2017 >>> @@ -1219,6 +1219,8 @@ def warn_messaging_unqualified_id : Warn >>> def err_static_assert_expression_is_not_constant : Error< >>>"static_assert expression is not an integral constant expression">; >>> def err_static_assert_failed : Error<"static_assert failed%select{ >>> %1|}0">; >>> +def err_static_assert_requirement_failed : Error< >>> + "static_assert failed due to requirement '%0'%select{ %2|}1">; >>> def ext_static_assert_no_message : ExtWarn< >>>"static_assert with no message is a C++17 extension">, InGroup; >>> def warn_cxx14_compat_static_assert_no_message : Warning< >>> >>> Modified: cfe/trunk/include/clang/Sema/Sema.h >>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ >>> Sema/Sema.h?rev=313315&r1=313314&r2=313315&view=diff >>> >>> == >>> --- cfe/trunk/include/clang/Sema/Sema.h (original) >>> +++ cfe/trunk/include/clang/Sema/Sema.h Thu Sep 14 16:38:42 2017 >>> @@ -2783,6 +2783,14 @@ public: >>>EnableIfAttr *CheckEnableIf(FunctionDecl *Function, ArrayRef >>> Args, >>>bool MissingImplicitThis = false); >>> >>> + /// Find the failed Boolean condition within a given Boolean >>> + /// constant expression, and describe it with a string. >>> + /// >>> + /// \param AllowTopLevelCond Whether to allow the result to be the >>> + /// complete top-level condition. >>> + std::pair >>> + findFailedBooleanCondition(Expr *Cond, bool AllowTopLevelCond); >>> + >>>/// Emit diagnostics for the diagnose_if attributes on Function, >>> ignoring any >>>/// non-ArgDependent DiagnoseIfAttrs. >>>/// >>> >>> Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp >>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaD >>> eclCXX.cpp?rev=313315&r1=313314&r2=313315&view=diff >>> >>> == >>> --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original) >>> +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Sep 14 16:38:42 2017 >>> @@ -13296,8 +13296,20 @@ Decl *Sema::BuildStaticAssertDeclaration >>>llvm::raw_svector_ostream Msg(MsgBuffer); >>>if (AssertMessage) >>> AssertMessage->printPretty(Msg, nullptr, getPrintingPolicy()); >>> - Diag(StaticAssertLoc, diag::err_static_assert_failed) >>> -<< !AssertMessage << Msg.str() << AssertExpr->getSourceRange(); >>> + >>> + Expr *InnerCond = nullptr; >>> + std::string InnerCondDescription; >>> + std::tie(InnerCond, InnerCondDescription) = >>> +findFailedBooleanCondition(Converted.get(), >>> + /*AllowTopLevelCond=*/false); >>> + if (InnerCond) { >>> +Diag(StaticAssertLoc, diag::err_static_assert_requir >>> ement_failed) >>> + << InnerCondDescription << !AssertMessage >>> + << Msg.str() << InnerCond->getSourceRange(); >>> + } else { >>> +Diag(StaticAssertLoc, diag::err_static_assert_failed) >>> + << !AssertMessage << Msg.str() << >>> AssertExpr->getSourceRange(); >>> + } >>>Failed = true; >>> } >>>} >>> >>> Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp >>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Se
[PATCH] D37963: [analyzer] PthreadLock: Don't track dead regions.
NoQ created this revision. Standard boilerplate: stop tracking mutex state when the mutex dies as a region. Clean up the destroyed symbol cleanup code a tiny bit. Note that this code is unaffected by the zombie symbol bug because whenever we need to take action, constraint manager is bound to mark the symbol as maybe-dead for us. No tests because this is merely an optimization. https://reviews.llvm.org/D37963 Files: lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp Index: lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp === --- lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp +++ lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp @@ -556,19 +556,20 @@ CheckerContext &C) const { ProgramStateRef State = C.getState(); - // TODO: Clean LockMap when a mutex region dies. - - DestroyRetValTy TrackedSymbols = State->get(); - for (DestroyRetValTy::iterator I = TrackedSymbols.begin(), - E = TrackedSymbols.end(); - I != E; ++I) { -const SymbolRef Sym = I->second; -const MemRegion *lockR = I->first; -bool IsSymDead = SymReaper.isDead(Sym); -// Remove the dead symbol from the return value symbols map. -if (IsSymDead) - State = resolvePossiblyDestroyedMutex(State, lockR, &Sym); + for (auto I : State->get()) { +// Once the return value symbol dies, no more checks can be performed +// against it. See if the return value was checked before this point. +// This would remove the symbol from the map as well. +if (SymReaper.isDead(I.second)) + State = resolvePossiblyDestroyedMutex(State, I.first, &I.second); } + + for (auto I : State->get()) { +// Stop tracking dead mutex regions as well. +if (!SymReaper.isLiveRegion(I.first)) + State = State->remove(I.first); + } + C.addTransition(State); } Index: lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp === --- lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp +++ lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp @@ -556,19 +556,20 @@ CheckerContext &C) const { ProgramStateRef State = C.getState(); - // TODO: Clean LockMap when a mutex region dies. - - DestroyRetValTy TrackedSymbols = State->get(); - for (DestroyRetValTy::iterator I = TrackedSymbols.begin(), - E = TrackedSymbols.end(); - I != E; ++I) { -const SymbolRef Sym = I->second; -const MemRegion *lockR = I->first; -bool IsSymDead = SymReaper.isDead(Sym); -// Remove the dead symbol from the return value symbols map. -if (IsSymDead) - State = resolvePossiblyDestroyedMutex(State, lockR, &Sym); + for (auto I : State->get()) { +// Once the return value symbol dies, no more checks can be performed +// against it. See if the return value was checked before this point. +// This would remove the symbol from the map as well. +if (SymReaper.isDead(I.second)) + State = resolvePossiblyDestroyedMutex(State, I.first, &I.second); } + + for (auto I : State->get()) { +// Stop tracking dead mutex regions as well. +if (!SymReaper.isLiveRegion(I.first)) + State = State->remove(I.first); + } + C.addTransition(State); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r313499 - Fix failing -verify tests due to change in Clangs static_assert message.
Author: ericwf Date: Sun Sep 17 13:57:05 2017 New Revision: 313499 URL: http://llvm.org/viewvc/llvm-project?rev=313499&view=rev Log: Fix failing -verify tests due to change in Clangs static_assert message. Clang recently changed the way it outputs static assert diagnostics. This patch fixes libc++'s -verify tests so they tolerate both the old and new message format. Modified: libcxx/trunk/test/libcxx/experimental/filesystem/class.path/path.itr/reverse_iterator_produces_diagnostic.fail.cpp libcxx/trunk/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp libcxx/trunk/test/std/experimental/any/any.class/any.assign/value_non_copyable_assign.fail.cpp libcxx/trunk/test/std/experimental/any/any.class/any.cons/non_copyable_value.fail.cpp libcxx/trunk/test/std/experimental/any/any.nonmembers/any.cast/reference_types.fail.cpp libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/reference_types.fail.cpp libcxx/trunk/test/std/utilities/optional/optional.object/optional_requires_destructible_object.fail.cpp libcxx/trunk/test/std/utilities/utility/forward/forward.fail.cpp Modified: libcxx/trunk/test/libcxx/experimental/filesystem/class.path/path.itr/reverse_iterator_produces_diagnostic.fail.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/experimental/filesystem/class.path/path.itr/reverse_iterator_produces_diagnostic.fail.cpp?rev=313499&r1=313498&r2=313499&view=diff == --- libcxx/trunk/test/libcxx/experimental/filesystem/class.path/path.itr/reverse_iterator_produces_diagnostic.fail.cpp (original) +++ libcxx/trunk/test/libcxx/experimental/filesystem/class.path/path.itr/reverse_iterator_produces_diagnostic.fail.cpp Sun Sep 17 13:57:05 2017 @@ -23,7 +23,7 @@ int main() { using namespace fs; using RIt = std::reverse_iterator; - // expected-error@iterator:* {{static_assert failed "The specified iterator type cannot be used with reverse_iterator; Using stashing iterators with reverse_iterator causes undefined behavior"}} + // expected-error-re@iterator:* {{static_assert failed{{.*}} "The specified iterator type cannot be used with reverse_iterator; Using stashing iterators with reverse_iterator causes undefined behavior"}} { RIt r; ((void)r); Modified: libcxx/trunk/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp?rev=313499&r1=313498&r2=313499&view=diff == --- libcxx/trunk/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp (original) +++ libcxx/trunk/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp Sun Sep 17 13:57:05 2017 @@ -36,7 +36,7 @@ int main() { SPtr<2> s2(getFn<2>(), Deleter{}); // OK SPtr<3> s3(nullptr, Deleter{}); // OK } - // expected-error@memory:* 2 {{static_assert failed "default_delete cannot be instantiated for function types"}} + // expected-error-re@memory:* 2 {{static_assert failed{{.*}} "default_delete cannot be instantiated for function types"}} { SPtr<4> s4(getFn<4>()); // expected-note {{requested here}} SPtr<5> s5(getFn<5>(), std::default_delete>{}); // expected-note {{requested here}} Modified: libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp?rev=313499&r1=313498&r2=313499&view=diff == --- libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp (original) +++ libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp Sun Sep 17 13:57:05 2017 @@ -22,7 +22,7 @@ int main() { std::allocator alloc; -// expected-error@tuple:* 4 {{static_assert failed "Attempted to construct a reference element in a tuple with an rvalue"}} +// expected-error-re@tuple:* 4 {{static_assert failed{{.*}} "Attempted to construct a reference element in a tuple with an rvalue"}} // bind lvalue to rvalue std::tuple t(42); // expected-note {{requested her
Re: r313315 - Diagnostic specific failed condition in a static_assert.
Fixed in r313499. /Eric On Sun, Sep 17, 2017 at 2:04 PM, Eric Fiselier wrote: > I'll correct them. > > /Eric > > On Sat, Sep 16, 2017 at 6:28 PM, Richard Smith > wrote: > >> This is a bug in the libc++ tests. It's OK for them to check that the >> static_assert message is produced, but not that they're prefixed with the >> exact string "static_assert failed:". >> >> On 16 September 2017 at 05:54, NAKAMURA Takumi via cfe-commits < >> cfe-commits@lists.llvm.org> wrote: >> >>> This triggered failure in libcxx tests. >>> http://bb.pgr.jp/builders/bootstrap-clang-libcxx-lld-i686-li >>> nux/builds/97 >>> >>> >>> On Fri, Sep 15, 2017 at 8:40 AM Douglas Gregor via cfe-commits < >>> cfe-commits@lists.llvm.org> wrote: >>> Author: dgregor Date: Thu Sep 14 16:38:42 2017 New Revision: 313315 URL: http://llvm.org/viewvc/llvm-project?rev=313315&view=rev Log: Diagnostic specific failed condition in a static_assert. When a static_assert fails, dig out a specific condition to diagnose, using the same logic that we use to find the enable_if condition to diagnose. Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/lib/Sema/SemaDeclCXX.cpp cfe/trunk/lib/Sema/SemaTemplate.cpp cfe/trunk/test/SemaCXX/static-assert.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ Basic/DiagnosticSemaKinds.td?rev=313315&r1=313314&r2=313315&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Sep 14 16:38:42 2017 @@ -1219,6 +1219,8 @@ def warn_messaging_unqualified_id : Warn def err_static_assert_expression_is_not_constant : Error< "static_assert expression is not an integral constant expression">; def err_static_assert_failed : Error<"static_assert failed%select{ %1|}0">; +def err_static_assert_requirement_failed : Error< + "static_assert failed due to requirement '%0'%select{ %2|}1">; def ext_static_assert_no_message : ExtWarn< "static_assert with no message is a C++17 extension">, InGroup; def warn_cxx14_compat_static_assert_no_message : Warning< Modified: cfe/trunk/include/clang/Sema/Sema.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ Sema/Sema.h?rev=313315&r1=313314&r2=313315&view=diff == --- cfe/trunk/include/clang/Sema/Sema.h (original) +++ cfe/trunk/include/clang/Sema/Sema.h Thu Sep 14 16:38:42 2017 @@ -2783,6 +2783,14 @@ public: EnableIfAttr *CheckEnableIf(FunctionDecl *Function, ArrayRef Args, bool MissingImplicitThis = false); + /// Find the failed Boolean condition within a given Boolean + /// constant expression, and describe it with a string. + /// + /// \param AllowTopLevelCond Whether to allow the result to be the + /// complete top-level condition. + std::pair + findFailedBooleanCondition(Expr *Cond, bool AllowTopLevelCond); + /// Emit diagnostics for the diagnose_if attributes on Function, ignoring any /// non-ArgDependent DiagnoseIfAttrs. /// Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaD eclCXX.cpp?rev=313315&r1=313314&r2=313315&view=diff == --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original) +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Sep 14 16:38:42 2017 @@ -13296,8 +13296,20 @@ Decl *Sema::BuildStaticAssertDeclaration llvm::raw_svector_ostream Msg(MsgBuffer); if (AssertMessage) AssertMessage->printPretty(Msg, nullptr, getPrintingPolicy()); - Diag(StaticAssertLoc, diag::err_static_assert_failed) -<< !AssertMessage << Msg.str() << AssertExpr->getSourceRange(); + + Expr *InnerCond = nullptr; + std::string InnerCondDescription; + std::tie(InnerCond, InnerCondDescription) = +findFailedBooleanCondition(Converted.get(), + /*AllowTopLevelCond=*/false); + if (InnerCond) { +Diag(StaticAssertLoc, diag::err_static_assert_requir ement_failed) + << InnerCondDescription << !AssertMessage + << Msg.str() << InnerCond->getSourceRange(); + } else { +Diag(StaticAssertLoc, diag::err_static_assert_failed) + << !AssertMessage << Msg.str() << >
[libcxx] r313500 - ABI: Fix for undefined "___cxa_deleted_virtual" symbol in MacOSX
Author: ericwf Date: Sun Sep 17 13:59:43 2017 New Revision: 313500 URL: http://llvm.org/viewvc/llvm-project?rev=313500&view=rev Log: ABI: Fix for undefined "___cxa_deleted_virtual" symbol in MacOSX Patch from Eddie Elizondo. Reviewed as D37830 (https://reviews.llvm.org/D37830). On MacOSX the following program: struct S { virtual void f() = delete; }; int main() { new S; } Fails with the following error: Undefined symbols for architecture x86_64: "___cxa_deleted_virtual" This adds a fix to export the needed symbols. Test: > lit -sv test/libcxx/language.support/cxa_deleted_virtual.pass.cpp > Testing Time: 0.21s > Expected Passes: 1 Added: libcxx/trunk/test/libcxx/language.support/cxa_deleted_virtual.pass.cpp Modified: libcxx/trunk/lib/abi/CHANGELOG.TXT libcxx/trunk/lib/abi/x86_64-apple-darwin16.abilist libcxx/trunk/lib/libc++abi.exp libcxx/trunk/lib/libc++abi2.exp libcxx/trunk/lib/libc++sjlj-abi.exp Modified: libcxx/trunk/lib/abi/CHANGELOG.TXT URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/abi/CHANGELOG.TXT?rev=313500&r1=313499&r2=313500&view=diff == --- libcxx/trunk/lib/abi/CHANGELOG.TXT (original) +++ libcxx/trunk/lib/abi/CHANGELOG.TXT Sun Sep 17 13:59:43 2017 @@ -16,6 +16,16 @@ New entries should be added directly bel Version 5.0 --- +* rTBD - Fix undefined "___cxa_deleted_virtual" symbol in macosx + + x86_64-linux-gnu + + No changes + + x86_64-apple-darwin16.0 + --- + Symbol added: ___cxa_deleted_virtual + * r296729 - Remove std::num_get template methods which should be inline These functions should never have had visible definitions in the dylib but Modified: libcxx/trunk/lib/abi/x86_64-apple-darwin16.abilist URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/abi/x86_64-apple-darwin16.abilist?rev=313500&r1=313499&r2=313500&view=diff == --- libcxx/trunk/lib/abi/x86_64-apple-darwin16.abilist (original) +++ libcxx/trunk/lib/abi/x86_64-apple-darwin16.abilist Sun Sep 17 13:59:43 2017 @@ -2323,6 +2323,8 @@ {'type': 'I', 'is_defined': True, 'name': '___cxa_current_exception_type'} {'type': 'U', 'is_defined': False, 'name': '___cxa_current_primary_exception'} {'type': 'U', 'is_defined': False, 'name': '___cxa_decrement_exception_refcount'} +{'type': 'U', 'is_defined': False, 'name': '___cxa_deleted_virtual'} +{'type': 'I', 'is_defined': True, 'name': '___cxa_deleted_virtual'} {'type': 'U', 'is_defined': False, 'name': '___cxa_demangle'} {'type': 'I', 'is_defined': True, 'name': '___cxa_demangle'} {'type': 'U', 'is_defined': False, 'name': '___cxa_end_catch'} Modified: libcxx/trunk/lib/libc++abi.exp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/libc%2B%2Babi.exp?rev=313500&r1=313499&r2=313500&view=diff == --- libcxx/trunk/lib/libc++abi.exp (original) +++ libcxx/trunk/lib/libc++abi.exp Sun Sep 17 13:59:43 2017 @@ -12,6 +12,7 @@ ___cxa_guard_acquire ___cxa_guard_release ___cxa_rethrow ___cxa_pure_virtual +___cxa_deleted_virtual ___cxa_begin_catch ___cxa_throw ___cxa_vec_cctor Modified: libcxx/trunk/lib/libc++abi2.exp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/libc%2B%2Babi2.exp?rev=313500&r1=313499&r2=313500&view=diff == --- libcxx/trunk/lib/libc++abi2.exp (original) +++ libcxx/trunk/lib/libc++abi2.exp Sun Sep 17 13:59:43 2017 @@ -12,6 +12,7 @@ ___cxa_guard_acquire ___cxa_guard_release ___cxa_rethrow ___cxa_pure_virtual +___cxa_deleted_virtual ___cxa_begin_catch ___cxa_throw ___cxa_vec_cctor Modified: libcxx/trunk/lib/libc++sjlj-abi.exp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/libc%2B%2Bsjlj-abi.exp?rev=313500&r1=313499&r2=313500&view=diff == --- libcxx/trunk/lib/libc++sjlj-abi.exp (original) +++ libcxx/trunk/lib/libc++sjlj-abi.exp Sun Sep 17 13:59:43 2017 @@ -12,6 +12,7 @@ ___cxa_guard_acquire ___cxa_guard_release ___cxa_rethrow ___cxa_pure_virtual +___cxa_deleted_virtual ___cxa_begin_catch ___cxa_throw ___cxa_vec_cctor Added: libcxx/trunk/test/libcxx/language.support/cxa_deleted_virtual.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/language.support/cxa_deleted_virtual.pass.cpp?rev=313500&view=auto == --- libcxx/trunk/test/libcxx/language.support/cxa_deleted_virtual.pass.cpp (added) +++ libcxx/trunk/test/libcxx/language.support/cxa_deleted_virtual.pass.cpp Sun Sep 17 13:59:43 2017 @@ -0,0 +1,15 @@ +//===--===// +// +// The LLVM Compiler Infrastructure
[libcxx] r313501 - Update changelog revision
Author: ericwf Date: Sun Sep 17 14:00:27 2017 New Revision: 313501 URL: http://llvm.org/viewvc/llvm-project?rev=313501&view=rev Log: Update changelog revision Modified: libcxx/trunk/lib/abi/CHANGELOG.TXT Modified: libcxx/trunk/lib/abi/CHANGELOG.TXT URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/abi/CHANGELOG.TXT?rev=313501&r1=313500&r2=313501&view=diff == --- libcxx/trunk/lib/abi/CHANGELOG.TXT (original) +++ libcxx/trunk/lib/abi/CHANGELOG.TXT Sun Sep 17 14:00:27 2017 @@ -16,7 +16,7 @@ New entries should be added directly bel Version 5.0 --- -* rTBD - Fix undefined "___cxa_deleted_virtual" symbol in macosx +* r313500 - Fix undefined "___cxa_deleted_virtual" symbol in macosx x86_64-linux-gnu ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r313315 - Diagnostic specific failed condition in a static_assert.
Thank you! Sent from my iPhone > On Sep 17, 2017, at 1:58 PM, Eric Fiselier wrote: > > Fixed in r313499. > > /Eric > >> On Sun, Sep 17, 2017 at 2:04 PM, Eric Fiselier wrote: >> I'll correct them. >> >> /Eric >> >>> On Sat, Sep 16, 2017 at 6:28 PM, Richard Smith >>> wrote: >> >>> This is a bug in the libc++ tests. It's OK for them to check that the >>> static_assert message is produced, but not that they're prefixed with the >>> exact string "static_assert failed:". >>> On 16 September 2017 at 05:54, NAKAMURA Takumi via cfe-commits wrote: This triggered failure in libcxx tests. http://bb.pgr.jp/builders/bootstrap-clang-libcxx-lld-i686-linux/builds/97 > On Fri, Sep 15, 2017 at 8:40 AM Douglas Gregor via cfe-commits > wrote: > Author: dgregor > Date: Thu Sep 14 16:38:42 2017 > New Revision: 313315 > > URL: http://llvm.org/viewvc/llvm-project?rev=313315&view=rev > Log: > Diagnostic specific failed condition in a static_assert. > > When a static_assert fails, dig out a specific condition to diagnose, > using the same logic that we use to find the enable_if condition to > diagnose. > > Modified: > cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td > cfe/trunk/include/clang/Sema/Sema.h > cfe/trunk/lib/Sema/SemaDeclCXX.cpp > cfe/trunk/lib/Sema/SemaTemplate.cpp > cfe/trunk/test/SemaCXX/static-assert.cpp > > Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=313315&r1=313314&r2=313315&view=diff > == > --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) > +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Sep 14 > 16:38:42 2017 > @@ -1219,6 +1219,8 @@ def warn_messaging_unqualified_id : Warn > def err_static_assert_expression_is_not_constant : Error< >"static_assert expression is not an integral constant expression">; > def err_static_assert_failed : Error<"static_assert failed%select{ > %1|}0">; > +def err_static_assert_requirement_failed : Error< > + "static_assert failed due to requirement '%0'%select{ %2|}1">; > def ext_static_assert_no_message : ExtWarn< >"static_assert with no message is a C++17 extension">, InGroup; > def warn_cxx14_compat_static_assert_no_message : Warning< > > Modified: cfe/trunk/include/clang/Sema/Sema.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=313315&r1=313314&r2=313315&view=diff > == > --- cfe/trunk/include/clang/Sema/Sema.h (original) > +++ cfe/trunk/include/clang/Sema/Sema.h Thu Sep 14 16:38:42 2017 > @@ -2783,6 +2783,14 @@ public: >EnableIfAttr *CheckEnableIf(FunctionDecl *Function, ArrayRef > Args, >bool MissingImplicitThis = false); > > + /// Find the failed Boolean condition within a given Boolean > + /// constant expression, and describe it with a string. > + /// > + /// \param AllowTopLevelCond Whether to allow the result to be the > + /// complete top-level condition. > + std::pair > + findFailedBooleanCondition(Expr *Cond, bool AllowTopLevelCond); > + >/// Emit diagnostics for the diagnose_if attributes on Function, > ignoring any >/// non-ArgDependent DiagnoseIfAttrs. >/// > > Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=313315&r1=313314&r2=313315&view=diff > == > --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original) > +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Sep 14 16:38:42 2017 > @@ -13296,8 +13296,20 @@ Decl *Sema::BuildStaticAssertDeclaration >llvm::raw_svector_ostream Msg(MsgBuffer); >if (AssertMessage) > AssertMessage->printPretty(Msg, nullptr, getPrintingPolicy()); > - Diag(StaticAssertLoc, diag::err_static_assert_failed) > -<< !AssertMessage << Msg.str() << AssertExpr->getSourceRange(); > + > + Expr *InnerCond = nullptr; > + std::string InnerCondDescription; > + std::tie(InnerCond, InnerCondDescription) = > +findFailedBooleanCondition(Converted.get(), > + /*AllowTopLevelCond=*/false); > + if (InnerCond) { > +Diag(StaticAssertLoc, diag::err_static_assert_requirement_failed) > + << InnerCondDescription << !AssertMessage > + << Msg.str() << InnerCond->getSourceRange(); > +
[PATCH] D37954: Expand absolute system header paths when using -MD depfiles
joerg added a comment. The comments at the very least are misleading. Resolving the path doesn't necessary shorten the string at all, in many cases it will be longer. I'm really not sure if clang should resolve symlinks like this as it can be quite surprising. https://reviews.llvm.org/D37954 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r313502 - Fix two failing -verify tests to tolerate old and new clang versions
Author: ericwf Date: Sun Sep 17 14:50:59 2017 New Revision: 313502 URL: http://llvm.org/viewvc/llvm-project?rev=313502&view=rev Log: Fix two failing -verify tests to tolerate old and new clang versions Modified: libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp libcxx/trunk/test/std/utilities/utility/forward/forward.fail.cpp Modified: libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp?rev=313502&r1=313501&r2=313502&view=diff == --- libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp (original) +++ libcxx/trunk/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp Sun Sep 17 14:50:59 2017 @@ -29,18 +29,18 @@ int main() any a; // expected-error@any:* {{binding value of type 'const TestType' to reference to type 'TestType' drops 'const' qualifier}} -// expected-error-re@any:* {{static_assert failed {{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}} +// expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}} any_cast(static_cast(a)); // expected-note {{requested here}} // expected-error@any:* {{cannot cast from lvalue of type 'const TestType' to rvalue reference type 'TestType &&'; types are not compatible}} -// expected-error-re@any:* {{static_assert failed {{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}} +// expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}} any_cast(static_cast(a)); // expected-note {{requested here}} // expected-error@any:* {{binding value of type 'const TestType2' to reference to type 'TestType2' drops 'const' qualifier}} -// expected-error-re@any:* {{static_assert failed {{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}} +// expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}} any_cast(static_cast(a)); // expected-note {{requested here}} // expected-error@any:* {{cannot cast from lvalue of type 'const TestType2' to rvalue reference type 'TestType2 &&'; types are not compatible}} -// expected-error-re@any:* {{static_assert failed {{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}} +// expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be a const lvalue reference or a CopyConstructible type"}} any_cast(static_cast(a)); // expected-note {{requested here}} } Modified: libcxx/trunk/test/std/utilities/utility/forward/forward.fail.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/utility/forward/forward.fail.cpp?rev=313502&r1=313501&r2=313502&view=diff == --- libcxx/trunk/test/std/utilities/utility/forward/forward.fail.cpp (original) +++ libcxx/trunk/test/std/utilities/utility/forward/forward.fail.cpp Sun Sep 17 14:50:59 2017 @@ -25,7 +25,7 @@ int main() #if TEST_STD_VER >= 11 { std::forward(source()); // expected-note {{requested here}} -// expected-error-re@type_traits:* 1 {{static_assert failed {{.*}} "can not forward an rvalue as an lvalue"}} +// expected-error-re@type_traits:* 1 {{static_assert failed{{.*}} "can not forward an rvalue as an lvalue"}} } #else { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D37954: Expand absolute system header paths when using -MD depfiles
Lekensteyn added a comment. In https://reviews.llvm.org/D37954#873373, @joerg wrote: > Resolving the path doesn't necessary shorten the string at all, in many cases > it will be longer. The description was based on the GCC manual page (" When preprocessing, do not shorten system header paths with canonicalization.") Maybe something like: "Do not canonicalize absolute system header paths in depfiles" > I'm really not sure if clang should resolve symlinks like this as it can be > quite surprising. This provides compatibility with GCC and fixes a bug with Ninja. At minimum, this canonicalization should be done when the path contains ".." components. Can you think of a practical reason why this would cause issues? https://reviews.llvm.org/D37954 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D37954: Expand absolute system header paths when using -MD depfiles
joerg added a comment. ninja is not the only consumer of this. For human inspection, it can be quite surprising to see symlinks resolved, i.e. /usr/include/machine on NetBSD. Build systems have different ideas on whether they want absolute resolved paths or not, so it seems like ninja should be able to cope with either format. This is a lossy transformation, so I'm somewhat reluctant to agree with it. https://reviews.llvm.org/D37954 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r313315 - Diagnostic specific failed condition in a static_assert.
Thanks! On Mon, Sep 18, 2017 at 5:58 AM Eric Fiselier wrote: > Fixed in r313499. > > /Eric > > On Sun, Sep 17, 2017 at 2:04 PM, Eric Fiselier wrote: > >> I'll correct them. >> >> /Eric >> >> On Sat, Sep 16, 2017 at 6:28 PM, Richard Smith >> wrote: >> >>> This is a bug in the libc++ tests. It's OK for them to check that the >>> static_assert message is produced, but not that they're prefixed with the >>> exact string "static_assert failed:". >>> >>> On 16 September 2017 at 05:54, NAKAMURA Takumi via cfe-commits < >>> cfe-commits@lists.llvm.org> wrote: >>> This triggered failure in libcxx tests. http://bb.pgr.jp/builders/bootstrap-clang-libcxx-lld-i686-linux/builds/97 On Fri, Sep 15, 2017 at 8:40 AM Douglas Gregor via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: dgregor > Date: Thu Sep 14 16:38:42 2017 > New Revision: 313315 > > URL: http://llvm.org/viewvc/llvm-project?rev=313315&view=rev > Log: > Diagnostic specific failed condition in a static_assert. > > When a static_assert fails, dig out a specific condition to diagnose, > using the same logic that we use to find the enable_if condition to > diagnose. > > Modified: > cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td > cfe/trunk/include/clang/Sema/Sema.h > cfe/trunk/lib/Sema/SemaDeclCXX.cpp > cfe/trunk/lib/Sema/SemaTemplate.cpp > cfe/trunk/test/SemaCXX/static-assert.cpp > > Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=313315&r1=313314&r2=313315&view=diff > > == > --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) > +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Sep 14 > 16:38:42 2017 > @@ -1219,6 +1219,8 @@ def warn_messaging_unqualified_id : Warn > def err_static_assert_expression_is_not_constant : Error< >"static_assert expression is not an integral constant expression">; > def err_static_assert_failed : Error<"static_assert failed%select{ > %1|}0">; > +def err_static_assert_requirement_failed : Error< > + "static_assert failed due to requirement '%0'%select{ %2|}1">; > def ext_static_assert_no_message : ExtWarn< >"static_assert with no message is a C++17 extension">, > InGroup; > def warn_cxx14_compat_static_assert_no_message : Warning< > > Modified: cfe/trunk/include/clang/Sema/Sema.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=313315&r1=313314&r2=313315&view=diff > > == > --- cfe/trunk/include/clang/Sema/Sema.h (original) > +++ cfe/trunk/include/clang/Sema/Sema.h Thu Sep 14 16:38:42 2017 > @@ -2783,6 +2783,14 @@ public: >EnableIfAttr *CheckEnableIf(FunctionDecl *Function, ArrayRef *> Args, >bool MissingImplicitThis = false); > > + /// Find the failed Boolean condition within a given Boolean > + /// constant expression, and describe it with a string. > + /// > + /// \param AllowTopLevelCond Whether to allow the result to be the > + /// complete top-level condition. > + std::pair > + findFailedBooleanCondition(Expr *Cond, bool AllowTopLevelCond); > + >/// Emit diagnostics for the diagnose_if attributes on Function, > ignoring any >/// non-ArgDependent DiagnoseIfAttrs. >/// > > Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=313315&r1=313314&r2=313315&view=diff > > == > --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original) > +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Sep 14 16:38:42 2017 > @@ -13296,8 +13296,20 @@ Decl *Sema::BuildStaticAssertDeclaration >llvm::raw_svector_ostream Msg(MsgBuffer); >if (AssertMessage) > AssertMessage->printPretty(Msg, nullptr, getPrintingPolicy()); > - Diag(StaticAssertLoc, diag::err_static_assert_failed) > -<< !AssertMessage << Msg.str() << > AssertExpr->getSourceRange(); > + > + Expr *InnerCond = nullptr; > + std::string InnerCondDescription; > + std::tie(InnerCond, InnerCondDescription) = > +findFailedBooleanCondition(Converted.get(), > + /*AllowTopLevelCond=*/false); > + if (InnerCond) { > +Diag(StaticAssertLoc, > diag::err_static_assert_requirement_failed) > + << InnerCondDescription << !AssertMessage > + <<
r313510 - Reformat.
Author: chapuni Date: Sun Sep 17 21:55:31 2017 New Revision: 313510 URL: http://llvm.org/viewvc/llvm-project?rev=313510&view=rev Log: Reformat. Modified: cfe/trunk/lib/Lex/PPLexerChange.cpp Modified: cfe/trunk/lib/Lex/PPLexerChange.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPLexerChange.cpp?rev=313510&r1=313509&r2=313510&view=diff == --- cfe/trunk/lib/Lex/PPLexerChange.cpp (original) +++ cfe/trunk/lib/Lex/PPLexerChange.cpp Sun Sep 17 21:55:31 2017 @@ -40,10 +40,9 @@ bool Preprocessor::isInPrimaryFile() con // If there are any stacked lexers, we're in a #include. assert(IsFileLexer(IncludeMacroStack[0]) && "Top level include stack isn't our primary lexer?"); - return std::none_of(IncludeMacroStack.begin() + 1, IncludeMacroStack.end(), - [this](const IncludeStackInfo &ISI) -> bool { -return IsFileLexer(ISI); - }); + return std::none_of( + IncludeMacroStack.begin() + 1, IncludeMacroStack.end(), + [this](const IncludeStackInfo &ISI) -> bool { return IsFileLexer(ISI); }); } /// getCurrentLexer - Return the current file lexer being lexed from. Note ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r313511 - Fix a warning discovered by rL313487. [-Wunused-lambda-capture]
Author: chapuni Date: Sun Sep 17 21:55:33 2017 New Revision: 313511 URL: http://llvm.org/viewvc/llvm-project?rev=313511&view=rev Log: Fix a warning discovered by rL313487. [-Wunused-lambda-capture] Modified: cfe/trunk/lib/Lex/PPLexerChange.cpp Modified: cfe/trunk/lib/Lex/PPLexerChange.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPLexerChange.cpp?rev=313511&r1=313510&r2=313511&view=diff == --- cfe/trunk/lib/Lex/PPLexerChange.cpp (original) +++ cfe/trunk/lib/Lex/PPLexerChange.cpp Sun Sep 17 21:55:33 2017 @@ -42,7 +42,7 @@ bool Preprocessor::isInPrimaryFile() con "Top level include stack isn't our primary lexer?"); return std::none_of( IncludeMacroStack.begin() + 1, IncludeMacroStack.end(), - [this](const IncludeStackInfo &ISI) -> bool { return IsFileLexer(ISI); }); + [](const IncludeStackInfo &ISI) -> bool { return IsFileLexer(ISI); }); } /// getCurrentLexer - Return the current file lexer being lexed from. Note ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r313513 - Revert rL313511, "Fix a warning discovered by rL313487. [-Wunused-lambda-capture]"
Author: chapuni Date: Sun Sep 17 22:52:57 2017 New Revision: 313513 URL: http://llvm.org/viewvc/llvm-project?rev=313513&view=rev Log: Revert rL313511, "Fix a warning discovered by rL313487. [-Wunused-lambda-capture]" It was incompatible to msc. Modified: cfe/trunk/lib/Lex/PPLexerChange.cpp Modified: cfe/trunk/lib/Lex/PPLexerChange.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPLexerChange.cpp?rev=313513&r1=313512&r2=313513&view=diff == --- cfe/trunk/lib/Lex/PPLexerChange.cpp (original) +++ cfe/trunk/lib/Lex/PPLexerChange.cpp Sun Sep 17 22:52:57 2017 @@ -42,7 +42,7 @@ bool Preprocessor::isInPrimaryFile() con "Top level include stack isn't our primary lexer?"); return std::none_of( IncludeMacroStack.begin() + 1, IncludeMacroStack.end(), - [](const IncludeStackInfo &ISI) -> bool { return IsFileLexer(ISI); }); + [this](const IncludeStackInfo &ISI) -> bool { return IsFileLexer(ISI); }); } /// getCurrentLexer - Return the current file lexer being lexed from. Note ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D37958: [libc++] Correctly propagate user-defined lookup_classname().
timshen updated this revision to Diff 115597. timshen added a comment. Propagate __icase_ correctly into lookup_classname. https://reviews.llvm.org/D37958 Files: libcxx/include/regex libcxx/test/std/re/re.traits/lookup_classname_user_defined.pass.cpp libcxx/utils/libcxx/test/target_info.py Index: libcxx/utils/libcxx/test/target_info.py === --- libcxx/utils/libcxx/test/target_info.py +++ libcxx/utils/libcxx/test/target_info.py @@ -55,6 +55,7 @@ ('fr_FR.UTF-8', 'French_France.1252'), ('ru_RU.UTF-8', 'Russian_Russia.1251'), ('zh_CN.UTF-8', 'Chinese_China.936'), +('ja_JP.UTF-8', 'Japanese_Japan.932'), ('fr_CA.ISO8859-1', 'French_Canada.1252'), ('cs_CZ.ISO8859-2', 'Czech_Czech Republic.1250') ] Index: libcxx/test/std/re/re.traits/lookup_classname_user_defined.pass.cpp === --- /dev/null +++ libcxx/test/std/re/re.traits/lookup_classname_user_defined.pass.cpp @@ -0,0 +1,54 @@ +//===--===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===--===// + +// REQUIRES: locale.ja_JP.UTF-8 + +// + +// template struct regex_traits; + +// template +// char_class_type +// lookup_classname(ForwardIterator first, ForwardIterator last, +//bool icase = false) const; + +#include +#include +#include "test_macros.h" +#include "platform_support.h" // locale name macros + +struct wctype_traits : std::regex_traits +{ +using char_class_type = std::wctype_t; +template +char_class_type lookup_classname(ForwardIt first, ForwardIt last, bool icase = false ) const { +(void)icase; +return std::wctype(std::string(first, last).c_str()); +} +bool isctype(wchar_t c, char_class_type f) const { +return std::iswctype(c, f); +} +}; + +int main() +{ +std::locale::global(std::locale("ja_JP.utf8")); +std::wsmatch m; +std::wstring in = L"風の谷のナウシカ"; + +// matches all characters (they are classified as alnum) +std::wstring re1 = L"([[:alnum:]]+)"; +std::regex_search(in, m, std::wregex(re1)); +assert(m[1] == L"風の谷のナウシカ"); + +// matches only the kanji +std::wstring re2 = L"([[:jkata:]]+)"; +std::regex_search(in, m, std::basic_regex(re2)); +assert(m[1] == L"ナウシカ"); +} Index: libcxx/include/regex === --- libcxx/include/regex +++ libcxx/include/regex @@ -2213,8 +2213,8 @@ vector > __ranges_; vector > __digraphs_; vector __equivalences_; -typename regex_traits<_CharT>::char_class_type __mask_; -typename regex_traits<_CharT>::char_class_type __neg_mask_; +typename _Traits::char_class_type __mask_; +typename _Traits::char_class_type __neg_mask_; bool __negate_; bool __icase_; bool __collate_; @@ -2307,12 +2307,26 @@ _LIBCPP_INLINE_VISIBILITY void __add_equivalence(const string_type& __s) {__equivalences_.push_back(__s);} + +template _LIBCPP_INLINE_VISIBILITY -void __add_class(typename regex_traits<_CharT>::char_class_type __mask) -{__mask_ |= __mask;} +void __add_class(_Iter __begin, _Iter __end) +{ + auto __class_type = __traits_.lookup_classname(__begin, __end, __icase_); + if (__class_type == 0) + __throw_regex_error(); + __mask_ |= __class_type; +} + +template _LIBCPP_INLINE_VISIBILITY -void __add_neg_class(typename regex_traits<_CharT>::char_class_type __mask) -{__neg_mask_ |= __mask;} +void __add_neg_class(_Iter __begin, _Iter __end) +{ + auto __class_type = __traits_.lookup_classname(__begin, __end, __icase_); + if (__class_type == 0) + __throw_regex_error(); + __neg_mask_ |= __class_type; +} }; template @@ -3841,23 +3855,23 @@ __str = _CharT(8); return ++__first; case 'd': -__ml->__add_class(ctype_base::digit); +__ml->__add_class(__first, std::next(__first)); return ++__first; case 'D': -__ml->__add_neg_class(ctype_base::digit); +__ml->__add_neg_class(__first, std::next(__first)); return ++__first; case 's': -__ml->__add_class(ctype_base::space); +__ml->__add_class(__first, std::next(__first)); return ++__first; case 'S': -__ml->__add_neg_class(ctype_base::space); +__ml->__add_neg_class(__first, std::next(__first)); return ++__first; case 'w': -__ml->__add_class(ctype_base::alnum); +__ml->__add_class(__first, std::next(__first)); __ml->__add_char('
[PATCH] D37958: [libc++] Correctly propagate user-defined lookup_classname().
timshen added inline comments. Comment at: libcxx/test/std/re/re.traits/lookup_classname_user_defined.pass.cpp:46 +// matches all characters (they are classified as alnum) +std::wstring re1 = L"([[:alnum:]]+)"; +std::regex_search(in, m, std::wregex(re1)); Quuxplusone wrote: > Could you add a test here for > > std::wstring re3 = L"([[:ALNUM:]]+)"; > std::regex_search(in, m, std::wregex(re3, std::regex_constants::icase)); > > std::wstring re4 = L"(\\W+)"; > std::regex_search(in, m, std::wregex(re4, std::regex_constants::icase)); > > documenting the expected outputs? It's unclear to me from cppreference > http://en.cppreference.com/w/cpp/regex/regex_traits/lookup_classname > whether lookup_classname("W") is supposed to produce a result or not (but you > seem to assume it does). > > My understanding is that the "icase" parameter to lookup_classname is talking > about the icaseness of the regex matcher; classnames should always be matched > with exact case, i.e. `[[:alnum:]]` is always a valid classname and > `[[:ALNUM:]]` is always invalid, regardless of regex_constants::icase. But > I'm not sure. [re.req] says that, for lookup_classname(), "The value returned shall be independent of the case of the characters in the sequence." I take it as regardless of lookup_classname()'s icase argument, [[:ALNUM:]] is always valid. There are existing tests that confirms it in std/re/re.traits/lookup_classname.pass.cpp. Search for "AlNum". I fixed my patch, since I was misunderstanding it as well (I thought icase is for the input char sequence). Now they are just forwarded into lookup_classname(). https://reviews.llvm.org/D37958 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits