Re: [clang-tools-extra] r290202 - [clang-tidy] Add modernize-use-default-member-init check
On Thu, Dec 22, 2016 at 11:43 AM, NAKAMURA Takumiwrote: > Does the test invoke cl.exe? I supposed it were clang. It shouldn't, but the test also does not specify a target triple, so the behavior depends on what version of MSVC you built clang (and clang-tidy) with. What version of MSVC is used to build that configuration? ~Aaron > > On Thu, Dec 22, 2016 at 11:24 PM Aaron Ballman > wrote: >> >> On Wed, Dec 21, 2016 at 6:10 PM, NAKAMURA Takumi >> wrote: >> > It'd be the issue if the test depended on installed headers. The builder >> > doesn't have MS headers installed. >> >> Those type names do not require any headers to be installed. They're >> keywords in C++11 and later, but MSVC did not support them until MSVC >> 2015. >> >> ~Aaron >> >> > >> > On Thu, Dec 22, 2016 at 1:27 AM Aaron Ballman >> > wrote: >> >> >> >> On Tue, Dec 20, 2016 at 5:58 PM, Malcolm Parsons >> >> wrote: >> >> > On 20 December 2016 at 22:32, Aaron Ballman >> >> > wrote: >> >> >> On Tue, Dec 20, 2016 at 4:26 PM, Malcolm Parsons via cfe-commits >> >> >> wrote: >> >> >>> Author: malcolm.parsons >> >> >>> Date: Tue Dec 20 15:26:07 2016 >> >> >>> New Revision: 290202 >> >> >>> >> >> >>> URL: http://llvm.org/viewvc/llvm-project?rev=290202=rev >> >> >>> Log: >> >> >>> [clang-tidy] Add modernize-use-default-member-init check >> >> >>> >> >> >>> Summary: Fixes PR18858 >> >> >> >> >> >> This appears to have broken one of the bots: >> >> >> >> >> >> http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/33046 >> >> > >> >> > error: unknown type name 'char16_t' >> >> > error: unknown type name 'char32_t' >> >> > >> >> > I see commented tests in other clang-tidy tests: >> >> > >> >> > // TODO: enable these tests once all supported compilers >> >> > // support char16_t and char32_t (VS2013 does not) >> >> > >> >> > // disabled for now until it is clear >> >> > // how to enable them in the test >> >> > //} catch (const char16_t*) { >> >> >> >> We no longer support MSVC 2013, so that should not be an issue. >> >> Takumi, I'm not certain what to make of this builder (MSVC centos?). >> >> What version of Visual Studio is it compiling with? Or is this an >> >> instance where we need to set the -fms-compatibility-version=19 when >> >> running the test with clang-cl? >> >> >> >> ~Aaron >> >> >> >> > >> >> > -- >> >> > Malcolm Parsons ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [clang-tools-extra] r290202 - [clang-tidy] Add modernize-use-default-member-init check
Does the test invoke cl.exe? I supposed it were clang. On Thu, Dec 22, 2016 at 11:24 PM Aaron Ballmanwrote: > On Wed, Dec 21, 2016 at 6:10 PM, NAKAMURA Takumi > wrote: > > It'd be the issue if the test depended on installed headers. The builder > > doesn't have MS headers installed. > > Those type names do not require any headers to be installed. They're > keywords in C++11 and later, but MSVC did not support them until MSVC > 2015. > > ~Aaron > > > > > On Thu, Dec 22, 2016 at 1:27 AM Aaron Ballman > > wrote: > >> > >> On Tue, Dec 20, 2016 at 5:58 PM, Malcolm Parsons > >> wrote: > >> > On 20 December 2016 at 22:32, Aaron Ballman > >> > wrote: > >> >> On Tue, Dec 20, 2016 at 4:26 PM, Malcolm Parsons via cfe-commits > >> >> wrote: > >> >>> Author: malcolm.parsons > >> >>> Date: Tue Dec 20 15:26:07 2016 > >> >>> New Revision: 290202 > >> >>> > >> >>> URL: http://llvm.org/viewvc/llvm-project?rev=290202=rev > >> >>> Log: > >> >>> [clang-tidy] Add modernize-use-default-member-init check > >> >>> > >> >>> Summary: Fixes PR18858 > >> >> > >> >> This appears to have broken one of the bots: > >> >> > >> >> http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/33046 > >> > > >> > error: unknown type name 'char16_t' > >> > error: unknown type name 'char32_t' > >> > > >> > I see commented tests in other clang-tidy tests: > >> > > >> > // TODO: enable these tests once all supported compilers > >> > // support char16_t and char32_t (VS2013 does not) > >> > > >> > // disabled for now until it is clear > >> > // how to enable them in the test > >> > //} catch (const char16_t*) { > >> > >> We no longer support MSVC 2013, so that should not be an issue. > >> Takumi, I'm not certain what to make of this builder (MSVC centos?). > >> What version of Visual Studio is it compiling with? Or is this an > >> instance where we need to set the -fms-compatibility-version=19 when > >> running the test with clang-cl? > >> > >> ~Aaron > >> > >> > > >> > -- > >> > Malcolm Parsons > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [clang-tools-extra] r290202 - [clang-tidy] Add modernize-use-default-member-init check
On Wed, Dec 21, 2016 at 6:10 PM, NAKAMURA Takumiwrote: > It'd be the issue if the test depended on installed headers. The builder > doesn't have MS headers installed. Those type names do not require any headers to be installed. They're keywords in C++11 and later, but MSVC did not support them until MSVC 2015. ~Aaron > > On Thu, Dec 22, 2016 at 1:27 AM Aaron Ballman > wrote: >> >> On Tue, Dec 20, 2016 at 5:58 PM, Malcolm Parsons >> wrote: >> > On 20 December 2016 at 22:32, Aaron Ballman >> > wrote: >> >> On Tue, Dec 20, 2016 at 4:26 PM, Malcolm Parsons via cfe-commits >> >> wrote: >> >>> Author: malcolm.parsons >> >>> Date: Tue Dec 20 15:26:07 2016 >> >>> New Revision: 290202 >> >>> >> >>> URL: http://llvm.org/viewvc/llvm-project?rev=290202=rev >> >>> Log: >> >>> [clang-tidy] Add modernize-use-default-member-init check >> >>> >> >>> Summary: Fixes PR18858 >> >> >> >> This appears to have broken one of the bots: >> >> >> >> http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/33046 >> > >> > error: unknown type name 'char16_t' >> > error: unknown type name 'char32_t' >> > >> > I see commented tests in other clang-tidy tests: >> > >> > // TODO: enable these tests once all supported compilers >> > // support char16_t and char32_t (VS2013 does not) >> > >> > // disabled for now until it is clear >> > // how to enable them in the test >> > //} catch (const char16_t*) { >> >> We no longer support MSVC 2013, so that should not be an issue. >> Takumi, I'm not certain what to make of this builder (MSVC centos?). >> What version of Visual Studio is it compiling with? Or is this an >> instance where we need to set the -fms-compatibility-version=19 when >> running the test with clang-cl? >> >> ~Aaron >> >> > >> > -- >> > Malcolm Parsons ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [clang-tools-extra] r290202 - [clang-tidy] Add modernize-use-default-member-init check
It'd be the issue if the test depended on installed headers. The builder doesn't have MS headers installed. On Thu, Dec 22, 2016 at 1:27 AM Aaron Ballmanwrote: > On Tue, Dec 20, 2016 at 5:58 PM, Malcolm Parsons > wrote: > > On 20 December 2016 at 22:32, Aaron Ballman > wrote: > >> On Tue, Dec 20, 2016 at 4:26 PM, Malcolm Parsons via cfe-commits > >> wrote: > >>> Author: malcolm.parsons > >>> Date: Tue Dec 20 15:26:07 2016 > >>> New Revision: 290202 > >>> > >>> URL: http://llvm.org/viewvc/llvm-project?rev=290202=rev > >>> Log: > >>> [clang-tidy] Add modernize-use-default-member-init check > >>> > >>> Summary: Fixes PR18858 > >> > >> This appears to have broken one of the bots: > >> > >> http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/33046 > > > > error: unknown type name 'char16_t' > > error: unknown type name 'char32_t' > > > > I see commented tests in other clang-tidy tests: > > > > // TODO: enable these tests once all supported compilers > > // support char16_t and char32_t (VS2013 does not) > > > > // disabled for now until it is clear > > // how to enable them in the test > > //} catch (const char16_t*) { > > We no longer support MSVC 2013, so that should not be an issue. > Takumi, I'm not certain what to make of this builder (MSVC centos?). > What version of Visual Studio is it compiling with? Or is this an > instance where we need to set the -fms-compatibility-version=19 when > running the test with clang-cl? > > ~Aaron > > > > > -- > > Malcolm Parsons > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [clang-tools-extra] r290202 - [clang-tidy] Add modernize-use-default-member-init check
On Tue, Dec 20, 2016 at 5:58 PM, Malcolm Parsonswrote: > On 20 December 2016 at 22:32, Aaron Ballman wrote: >> On Tue, Dec 20, 2016 at 4:26 PM, Malcolm Parsons via cfe-commits >> wrote: >>> Author: malcolm.parsons >>> Date: Tue Dec 20 15:26:07 2016 >>> New Revision: 290202 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=290202=rev >>> Log: >>> [clang-tidy] Add modernize-use-default-member-init check >>> >>> Summary: Fixes PR18858 >> >> This appears to have broken one of the bots: >> >> http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/33046 > > error: unknown type name 'char16_t' > error: unknown type name 'char32_t' > > I see commented tests in other clang-tidy tests: > > // TODO: enable these tests once all supported compilers > // support char16_t and char32_t (VS2013 does not) > > // disabled for now until it is clear > // how to enable them in the test > //} catch (const char16_t*) { We no longer support MSVC 2013, so that should not be an issue. Takumi, I'm not certain what to make of this builder (MSVC centos?). What version of Visual Studio is it compiling with? Or is this an instance where we need to set the -fms-compatibility-version=19 when running the test with clang-cl? ~Aaron > > -- > Malcolm Parsons ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [clang-tools-extra] r290202 - [clang-tidy] Add modernize-use-default-member-init check
On 20 December 2016 at 22:32, Aaron Ballmanwrote: > On Tue, Dec 20, 2016 at 4:26 PM, Malcolm Parsons via cfe-commits > wrote: >> Author: malcolm.parsons >> Date: Tue Dec 20 15:26:07 2016 >> New Revision: 290202 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=290202=rev >> Log: >> [clang-tidy] Add modernize-use-default-member-init check >> >> Summary: Fixes PR18858 > > This appears to have broken one of the bots: > > http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/33046 error: unknown type name 'char16_t' error: unknown type name 'char32_t' I see commented tests in other clang-tidy tests: // TODO: enable these tests once all supported compilers // support char16_t and char32_t (VS2013 does not) // disabled for now until it is clear // how to enable them in the test //} catch (const char16_t*) { -- Malcolm Parsons ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [clang-tools-extra] r290202 - [clang-tidy] Add modernize-use-default-member-init check
On Tue, Dec 20, 2016 at 4:26 PM, Malcolm Parsons via cfe-commitswrote: > Author: malcolm.parsons > Date: Tue Dec 20 15:26:07 2016 > New Revision: 290202 > > URL: http://llvm.org/viewvc/llvm-project?rev=290202=rev > Log: > [clang-tidy] Add modernize-use-default-member-init check > > Summary: Fixes PR18858 This appears to have broken one of the bots: http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/33046 ~Aaron > > Reviewers: alexfh, hokein, aaron.ballman > > Subscribers: JDevlieghere, Eugene.Zelenko, Prazek, mgorny, cfe-commits, > modocache > > Differential Revision: https://reviews.llvm.org/D26750 > > Added: > clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp > clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultMemberInitCheck.h > > clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-default-member-init.rst > > clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-member-init-assignment.cpp > > clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-member-init.cpp > Modified: > clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt > clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp > clang-tools-extra/trunk/docs/ReleaseNotes.rst > clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst > > Modified: clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt?rev=290202=290201=290202=diff > == > --- clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt (original) > +++ clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt Tue Dec 20 > 15:26:07 2016 > @@ -16,6 +16,7 @@ add_clang_library(clangTidyModernizeModu >ShrinkToFitCheck.cpp >UseAutoCheck.cpp >UseBoolLiteralsCheck.cpp > + UseDefaultMemberInitCheck.cpp >UseEmplaceCheck.cpp >UseEqualsDefaultCheck.cpp >UseEqualsDeleteCheck.cpp > > Modified: clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp?rev=290202=290201=290202=diff > == > --- clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp > (original) > +++ clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp Tue > Dec 20 15:26:07 2016 > @@ -22,6 +22,7 @@ > #include "ShrinkToFitCheck.h" > #include "UseAutoCheck.h" > #include "UseBoolLiteralsCheck.h" > +#include "UseDefaultMemberInitCheck.h" > #include "UseEmplaceCheck.h" > #include "UseEqualsDefaultCheck.h" > #include "UseEqualsDeleteCheck.h" > @@ -56,6 +57,8 @@ public: > CheckFactories.registerCheck("modernize-use-auto"); > CheckFactories.registerCheck( > "modernize-use-bool-literals"); > +CheckFactories.registerCheck( > +"modernize-use-default-member-init"); > CheckFactories.registerCheck("modernize-use-emplace"); > > CheckFactories.registerCheck("modernize-use-equals-default"); > CheckFactories.registerCheck( > > Added: > clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp?rev=290202=auto > == > --- > clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp > (added) > +++ > clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp > Tue Dec 20 15:26:07 2016 > @@ -0,0 +1,241 @@ > +//===--- UseDefaultMemberInitCheck.cpp - > clang-tidy===// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open Source > +// License. See LICENSE.TXT for details. > +// > +//===--===// > + > +#include "UseDefaultMemberInitCheck.h" > +#include "clang/AST/ASTContext.h" > +#include "clang/ASTMatchers/ASTMatchFinder.h" > +#include "clang/Lex/Lexer.h" > + > +using namespace clang::ast_matchers; > + > +namespace clang { > +namespace tidy { > +namespace modernize { > + > +static StringRef getValueOfValueInit(const QualType InitType) { > + switch (InitType->getScalarTypeKind()) { > + case Type::STK_CPointer: > + case Type::STK_BlockPointer: > + case Type::STK_ObjCObjectPointer: > + case Type::STK_MemberPointer: > +return "nullptr"; > + > + case Type::STK_Bool: > +return "false"; > + > + case Type::STK_Integral: > +switch (InitType->getAs()->getKind()) { > +case BuiltinType::Char_U: > +case BuiltinType::UChar: > +case BuiltinType::Char_S: > +case
[clang-tools-extra] r290202 - [clang-tidy] Add modernize-use-default-member-init check
Author: malcolm.parsons Date: Tue Dec 20 15:26:07 2016 New Revision: 290202 URL: http://llvm.org/viewvc/llvm-project?rev=290202=rev Log: [clang-tidy] Add modernize-use-default-member-init check Summary: Fixes PR18858 Reviewers: alexfh, hokein, aaron.ballman Subscribers: JDevlieghere, Eugene.Zelenko, Prazek, mgorny, cfe-commits, modocache Differential Revision: https://reviews.llvm.org/D26750 Added: clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultMemberInitCheck.h clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-default-member-init.rst clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-member-init-assignment.cpp clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-member-init.cpp Modified: clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp clang-tools-extra/trunk/docs/ReleaseNotes.rst clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst Modified: clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt?rev=290202=290201=290202=diff == --- clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt Tue Dec 20 15:26:07 2016 @@ -16,6 +16,7 @@ add_clang_library(clangTidyModernizeModu ShrinkToFitCheck.cpp UseAutoCheck.cpp UseBoolLiteralsCheck.cpp + UseDefaultMemberInitCheck.cpp UseEmplaceCheck.cpp UseEqualsDefaultCheck.cpp UseEqualsDeleteCheck.cpp Modified: clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp?rev=290202=290201=290202=diff == --- clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp Tue Dec 20 15:26:07 2016 @@ -22,6 +22,7 @@ #include "ShrinkToFitCheck.h" #include "UseAutoCheck.h" #include "UseBoolLiteralsCheck.h" +#include "UseDefaultMemberInitCheck.h" #include "UseEmplaceCheck.h" #include "UseEqualsDefaultCheck.h" #include "UseEqualsDeleteCheck.h" @@ -56,6 +57,8 @@ public: CheckFactories.registerCheck("modernize-use-auto"); CheckFactories.registerCheck( "modernize-use-bool-literals"); +CheckFactories.registerCheck( +"modernize-use-default-member-init"); CheckFactories.registerCheck("modernize-use-emplace"); CheckFactories.registerCheck("modernize-use-equals-default"); CheckFactories.registerCheck( Added: clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp?rev=290202=auto == --- clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp (added) +++ clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp Tue Dec 20 15:26:07 2016 @@ -0,0 +1,241 @@ +//===--- UseDefaultMemberInitCheck.cpp - clang-tidy===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "UseDefaultMemberInitCheck.h" +#include "clang/AST/ASTContext.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" +#include "clang/Lex/Lexer.h" + +using namespace clang::ast_matchers; + +namespace clang { +namespace tidy { +namespace modernize { + +static StringRef getValueOfValueInit(const QualType InitType) { + switch (InitType->getScalarTypeKind()) { + case Type::STK_CPointer: + case Type::STK_BlockPointer: + case Type::STK_ObjCObjectPointer: + case Type::STK_MemberPointer: +return "nullptr"; + + case Type::STK_Bool: +return "false"; + + case Type::STK_Integral: +switch (InitType->getAs()->getKind()) { +case BuiltinType::Char_U: +case BuiltinType::UChar: +case BuiltinType::Char_S: +case BuiltinType::SChar: + return "'\\0'"; +case BuiltinType::WChar_U: +case BuiltinType::WChar_S: + return "L'\\0'"; +case BuiltinType::Char16: + return "u'\\0'"; +case BuiltinType::Char32: + return "U'\\0'"; +default: + return "0"; +} + + case Type::STK_Floating: +switch (InitType->getAs()->getKind()) { +case BuiltinType::Half: +case BuiltinType::Float: + return "0.0f"; +default: + return "0.0"; +