[PATCH] D25675: clang-format: [JS] Fix template string ASI.
This revision was automatically updated to reflect the committed changes. mprobst marked an inline comment as done. Closed by commit rL284807: clang-format: [JS] Fix template string ASI. (authored by mprobst). Changed prior to commit: https://reviews.llvm.org/D25675?vs=74837&id=75390#toc Repository: rL LLVM https://reviews.llvm.org/D25675 Files: cfe/trunk/lib/Format/UnwrappedLineParser.cpp cfe/trunk/unittests/Format/FormatTestJS.cpp Index: cfe/trunk/lib/Format/UnwrappedLineParser.cpp === --- cfe/trunk/lib/Format/UnwrappedLineParser.cpp +++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp @@ -727,6 +727,8 @@ return; bool PreviousMustBeValue = mustBeJSIdentOrValue(Keywords, Previous); + bool PreviousStartsTemplateExpr = + Previous->is(TT_TemplateString) && Previous->TokenText.endswith("${"); if (PreviousMustBeValue && Line && Line->Tokens.size() > 1) { // If the token before the previous one is an '@', the previous token is an // annotation and can precede another identifier/value. @@ -737,9 +739,12 @@ if (Next->is(tok::exclaim) && PreviousMustBeValue) addUnwrappedLine(); bool NextMustBeValue = mustBeJSIdentOrValue(Keywords, Next); - if (NextMustBeValue && (PreviousMustBeValue || - Previous->isOneOf(tok::r_square, tok::r_paren, -tok::plusplus, tok::minusminus))) + bool NextEndsTemplateExpr = + Next->is(TT_TemplateString) && Next->TokenText.startswith("}"); + if (NextMustBeValue && !NextEndsTemplateExpr && !PreviousStartsTemplateExpr && + (PreviousMustBeValue || + Previous->isOneOf(tok::r_square, tok::r_paren, tok::plusplus, + tok::minusminus))) addUnwrappedLine(); if (PreviousMustBeValue && isJSDeclOrStmt(Keywords, Next)) addUnwrappedLine(); Index: cfe/trunk/unittests/Format/FormatTestJS.cpp === --- cfe/trunk/unittests/Format/FormatTestJS.cpp +++ cfe/trunk/unittests/Format/FormatTestJS.cpp @@ -1276,6 +1276,12 @@ verifyFormat("var x = ` \\${foo}`;\n"); } +TEST_F(FormatTestJS, TemplateStringASI) { + verifyFormat("var x = `hello${world}`;", "var x = `hello${\n" + "world\n" + "}`;"); +} + TEST_F(FormatTestJS, NestedTemplateStrings) { verifyFormat( "var x = `${xs.map(x => `${x}`).join('\\n')}`;"); Index: cfe/trunk/lib/Format/UnwrappedLineParser.cpp === --- cfe/trunk/lib/Format/UnwrappedLineParser.cpp +++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp @@ -727,6 +727,8 @@ return; bool PreviousMustBeValue = mustBeJSIdentOrValue(Keywords, Previous); + bool PreviousStartsTemplateExpr = + Previous->is(TT_TemplateString) && Previous->TokenText.endswith("${"); if (PreviousMustBeValue && Line && Line->Tokens.size() > 1) { // If the token before the previous one is an '@', the previous token is an // annotation and can precede another identifier/value. @@ -737,9 +739,12 @@ if (Next->is(tok::exclaim) && PreviousMustBeValue) addUnwrappedLine(); bool NextMustBeValue = mustBeJSIdentOrValue(Keywords, Next); - if (NextMustBeValue && (PreviousMustBeValue || - Previous->isOneOf(tok::r_square, tok::r_paren, -tok::plusplus, tok::minusminus))) + bool NextEndsTemplateExpr = + Next->is(TT_TemplateString) && Next->TokenText.startswith("}"); + if (NextMustBeValue && !NextEndsTemplateExpr && !PreviousStartsTemplateExpr && + (PreviousMustBeValue || + Previous->isOneOf(tok::r_square, tok::r_paren, tok::plusplus, + tok::minusminus))) addUnwrappedLine(); if (PreviousMustBeValue && isJSDeclOrStmt(Keywords, Next)) addUnwrappedLine(); Index: cfe/trunk/unittests/Format/FormatTestJS.cpp === --- cfe/trunk/unittests/Format/FormatTestJS.cpp +++ cfe/trunk/unittests/Format/FormatTestJS.cpp @@ -1276,6 +1276,12 @@ verifyFormat("var x = ` \\${foo}`;\n"); } +TEST_F(FormatTestJS, TemplateStringASI) { + verifyFormat("var x = `hello${world}`;", "var x = `hello${\n" + "world\n" + "}`;"); +} + TEST_F(FormatTestJS, NestedTemplateStrings) { verifyFormat( "var x = `${xs.map(x => `${x}`).join('\\n')}`;"); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25675: clang-format: [JS] Fix template string ASI.
mprobst marked an inline comment as done. mprobst added inline comments. Comment at: unittests/Format/FormatTestJS.cpp:1280 +TEST_F(FormatTestJS, TemplateStringASI) { + verifyFormat("var x = `hello${world}`;", "var x = `hello${\n" + "world\n" djasper wrote: > This doesn't look like it has been formatted with clang-format .. That is what clang-format does on my machine. https://reviews.llvm.org/D25675 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r284807 - clang-format: [JS] Fix template string ASI.
Author: mprobst Date: Fri Oct 21 00:11:38 2016 New Revision: 284807 URL: http://llvm.org/viewvc/llvm-project?rev=284807&view=rev Log: clang-format: [JS] Fix template string ASI. Summary: Previously, automatic semicolon insertion would add an unwrapped line when a template string contained a line break. var x = `foo${ bar}`; Would be formatted with `bar...` on a separate line and no indent. Reviewers: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D25675 Modified: cfe/trunk/lib/Format/UnwrappedLineParser.cpp cfe/trunk/unittests/Format/FormatTestJS.cpp Modified: cfe/trunk/lib/Format/UnwrappedLineParser.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.cpp?rev=284807&r1=284806&r2=284807&view=diff == --- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original) +++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Fri Oct 21 00:11:38 2016 @@ -727,6 +727,8 @@ void UnwrappedLineParser::readTokenWithJ return; bool PreviousMustBeValue = mustBeJSIdentOrValue(Keywords, Previous); + bool PreviousStartsTemplateExpr = + Previous->is(TT_TemplateString) && Previous->TokenText.endswith("${"); if (PreviousMustBeValue && Line && Line->Tokens.size() > 1) { // If the token before the previous one is an '@', the previous token is an // annotation and can precede another identifier/value. @@ -737,9 +739,12 @@ void UnwrappedLineParser::readTokenWithJ if (Next->is(tok::exclaim) && PreviousMustBeValue) addUnwrappedLine(); bool NextMustBeValue = mustBeJSIdentOrValue(Keywords, Next); - if (NextMustBeValue && (PreviousMustBeValue || - Previous->isOneOf(tok::r_square, tok::r_paren, -tok::plusplus, tok::minusminus))) + bool NextEndsTemplateExpr = + Next->is(TT_TemplateString) && Next->TokenText.startswith("}"); + if (NextMustBeValue && !NextEndsTemplateExpr && !PreviousStartsTemplateExpr && + (PreviousMustBeValue || + Previous->isOneOf(tok::r_square, tok::r_paren, tok::plusplus, + tok::minusminus))) addUnwrappedLine(); if (PreviousMustBeValue && isJSDeclOrStmt(Keywords, Next)) addUnwrappedLine(); Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=284807&r1=284806&r2=284807&view=diff == --- cfe/trunk/unittests/Format/FormatTestJS.cpp (original) +++ cfe/trunk/unittests/Format/FormatTestJS.cpp Fri Oct 21 00:11:38 2016 @@ -1276,6 +1276,12 @@ TEST_F(FormatTestJS, TemplateStrings) { verifyFormat("var x = ` \\${foo}`;\n"); } +TEST_F(FormatTestJS, TemplateStringASI) { + verifyFormat("var x = `hello${world}`;", "var x = `hello${\n" + "world\n" + "}`;"); +} + TEST_F(FormatTestJS, NestedTemplateStrings) { verifyFormat( "var x = `${xs.map(x => `${x}`).join('\\n')}`;"); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25844: [Sema][ObjC] Warn about implicitly autoreleasing indirect parameters that are captured by blocks
rjmccall added inline comments. Comment at: include/clang/Basic/DiagnosticSemaKinds.td:5080 +def note_explicit_ownership_qualification : Note< + "explicitly specify ownership qualification">; + How about: warning: block captures an autoreleasing out-parameter, which may result in use-after-free bugs note: declare the parameter __autoreleasing explicitly to suppress this warning (include a fixit on this one) note: declare the parameter __strong or capture a __block __strong variable to keep values alive across autorelease pools https://reviews.llvm.org/D25844 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25675: clang-format: [JS] Fix template string ASI.
djasper accepted this revision. djasper added inline comments. This revision is now accepted and ready to land. Comment at: unittests/Format/FormatTestJS.cpp:1280 +TEST_F(FormatTestJS, TemplateStringASI) { + verifyFormat("var x = `hello${world}`;", "var x = `hello${\n" + "world\n" This doesn't look like it has been formatted with clang-format .. https://reviews.llvm.org/D25675 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D23765: Fix for clang PR 29087
twoh added a comment. ping https://reviews.llvm.org/D23765 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r284802 - Don't try to use !Previous.empty() as a proxy for "Is this a redeclaration?" --
Author: rsmith Date: Thu Oct 20 22:15:03 2016 New Revision: 284802 URL: http://llvm.org/viewvc/llvm-project?rev=284802&view=rev Log: Don't try to use !Previous.empty() as a proxy for "Is this a redeclaration?" -- we don't collapse that down to a single entry if it's not a redeclaration. Instead, set the Redeclaration bit on the Declarator to indicate whether a function is a redeclaration (which may not have been linked into the redeclaration chain if it's a dependent context friend). Fixes a rejects-valid; see testcase. Modified: cfe/trunk/lib/Sema/SemaDecl.cpp cfe/trunk/lib/Sema/SemaDeclCXX.cpp cfe/trunk/test/SemaCXX/friend.cpp Modified: cfe/trunk/lib/Sema/SemaDecl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=284802&r1=284801&r2=284802&view=diff == --- cfe/trunk/lib/Sema/SemaDecl.cpp (original) +++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Oct 20 22:15:03 2016 @@ -8445,7 +8445,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, ? cast(FunctionTemplate) : NewFD); -if (isFriend && D.isRedeclaration()) { +if (isFriend && NewFD->getPreviousDecl()) { AccessSpecifier Access = AS_public; if (!NewFD->isInvalidDecl()) Access = NewFD->getPreviousDecl()->getAccess(); @@ -8901,8 +8901,6 @@ bool Sema::CheckFunctionDeclaration(Scop NewFD->setPreviousDeclaration(cast(OldDecl)); if (isa(NewFD)) NewFD->setAccess(OldDecl->getAccess()); - } else { -Redeclaration = false; } } } Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=284802&r1=284801&r2=284802&view=diff == --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original) +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Oct 20 22:15:03 2016 @@ -13785,10 +13785,9 @@ NamedDecl *Sema::ActOnFriendFunctionDecl // template in the translation unit. if (functionDeclHasDefaultArgument(FD)) { // We can't look at FD->getPreviousDecl() because it may not have been set - // if we're in a dependent context. If we get this far with a non-empty - // Previous set, we must have a valid previous declaration of this - // function. - if (!Previous.empty()) { + // if we're in a dependent context. If the function is known to be a + // redeclaration, we will have narrowed Previous down to the right decl. + if (D.isRedeclaration()) { Diag(FD->getLocation(), diag::err_friend_decl_with_def_arg_redeclared); Diag(Previous.getRepresentativeDecl()->getLocation(), diag::note_previous_declaration); Modified: cfe/trunk/test/SemaCXX/friend.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/friend.cpp?rev=284802&r1=284801&r2=284802&view=diff == --- cfe/trunk/test/SemaCXX/friend.cpp (original) +++ cfe/trunk/test/SemaCXX/friend.cpp Thu Oct 20 22:15:03 2016 @@ -379,3 +379,12 @@ namespace tag_redecl { X *q = p; } } + +namespace default_arg { + void f(); + void f(void*); // expected-note {{previous}} + struct X { +friend void f(int a, int b = 0) {} +friend void f(void *p = 0) {} // expected-error {{must be the only}} + }; +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r284801 - [ModuleMap] Add more module entries to cover some non modular headers
Author: bruno Date: Thu Oct 20 22:14:27 2016 New Revision: 284801 URL: http://llvm.org/viewvc/llvm-project?rev=284801&view=rev Log: [ModuleMap] Add more module entries to cover some non modular headers These modules are necessary on Darwin to allow modules with 'no_undeclared_includes' (introduced in clang r284797) to work properly while using libc++ headers. Patch extracted from a suggested module.modulemap from Richard Smith! Modified: libcxx/trunk/include/module.modulemap Modified: libcxx/trunk/include/module.modulemap URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/module.modulemap?rev=284801&r1=284800&r2=284801&view=diff == --- libcxx/trunk/include/module.modulemap (original) +++ libcxx/trunk/include/module.modulemap Thu Oct 20 22:14:27 2016 @@ -3,6 +3,348 @@ module std [system] { // re-exports its imported modules. We should provide an alternative form of // export that issues a warning if a name from the submodule is used, and // use that to provide a 'strict mode' for libc++. + + // Deprecated C-compatibility headers. These can all be included from within + // an 'extern "C"' context. + module depr [extern_c] { +// provided by C library. +module ctype_h { + header "ctype.h" + export * +} +module errno_h { + header "errno.h" + export * +} +// provided by C library. +// provided by compiler or C library. +module inttypes_h { + header "inttypes.h" + export stdint_h +/* + export_macros +PRId8, PRId16, PRId32, PRId64, PRIdFAST8, PRIdFAST16, PRIdFAST32, PRIdFAST64, PRIdLEAST8, PRIdLEAST16, PRIdLEAST32, PRIdLEAST64, PRIdMAX, PRIdPTR, +PRIi8, PRIi16, PRIi32, PRIi64, PRIiFAST8, PRIiFAST16, PRIiFAST32, PRIiFAST64, PRIiLEAST8, PRIiLEAST16, PRIiLEAST32, PRIiLEAST64, PRIiMAX, PRIiPTR, +PRIo8, PRIo16, PRIo32, PRIo64, PRIoFAST8, PRIoFAST16, PRIoFAST32, PRIoFAST64, PRIoLEAST8, PRIoLEAST16, PRIoLEAST32, PRIoLEAST64, PRIoMAX, PRIoPTR, +PRIu8, PRIu16, PRIu32, PRIu64, PRIuFAST8, PRIuFAST16, PRIuFAST32, PRIuFAST64, PRIuLEAST8, PRIuLEAST16, PRIuLEAST32, PRIuLEAST64, PRIuMAX, PRIuPTR, +PRIx8, PRIx16, PRIx32, PRIx64, PRIxFAST8, PRIxFAST16, PRIxFAST32, PRIxFAST64, PRIxLEAST8, PRIxLEAST16, PRIxLEAST32, PRIxLEAST64, PRIxMAX, PRIxPTR, +PRIX8, PRIX16, PRIX32, PRIX64, PRIXFAST8, PRIXFAST16, PRIXFAST32, PRIXFAST64, PRIXLEAST8, PRIXLEAST16, PRIXLEAST32, PRIXLEAST64, PRIXMAX, PRIXPTR, +SCNd8, SCNd16, SCNd32, SCNd64, SCNdFAST8, SCNdFAST16, SCNdFAST32, SCNdFAST64, SCNdLEAST8, SCNdLEAST16, SCNdLEAST32, SCNdLEAST64, SCNdMAX, SCNdPTR, +SCNi8, SCNi16, SCNi32, SCNi64, SCNiFAST8, SCNiFAST16, SCNiFAST32, SCNiFAST64, SCNiLEAST8, SCNiLEAST16, SCNiLEAST32, SCNiLEAST64, SCNiMAX, SCNiPTR, +SCNo8, SCNo16, SCNo32, SCNo64, SCNoFAST8, SCNoFAST16, SCNoFAST32, SCNoFAST64, SCNoLEAST8, SCNoLEAST16, SCNoLEAST32, SCNoLEAST64, SCNoMAX, SCNoPTR, +SCNu8, SCNu16, SCNu32, SCNu64, SCNuFAST8, SCNuFAST16, SCNuFAST32, SCNuFAST64, SCNuLEAST8, SCNuLEAST16, SCNuLEAST32, SCNuLEAST64, SCNuMAX, SCNuPTR, +SCNx8, SCNx16, SCNx32, SCNx64, SCNxFAST8, SCNxFAST16, SCNxFAST32, SCNxFAST64, SCNxLEAST8, SCNxLEAST16, SCNxLEAST32, SCNxLEAST64, SCNxMAX, SCNxPTR, +SCNX8, SCNX16, SCNX32, SCNX64, SCNXFAST8, SCNXFAST16, SCNXFAST32, SCNXFAST64, SCNXLEAST8, SCNXLEAST16, SCNXLEAST32, SCNXLEAST64, SCNXMAX, SCNXPTR +*/ + export * +} +// provided by compiler. +// provided by compiler or C library. +// provided by C library. +module math_h { + header "math.h" +/* + export_macros FP_FAST_FMA, FP_FAST_FMAF, FP_FAST_FMAL, FP_ILOGBO, FP_ILOGBNAN, +FP_INFINITE, FP_NAN, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, +HUGE_VAL, HUGE_VALF, HUGE_VALL, INFINITY, NAN, +MATH_ERRNO, MATH_ERREXCEPT, math_errhandling +*/ + export * +} +module setjmp_h { + header "setjmp.h" +/* + export_macros setjmp +*/ + export * +} +// FIXME: is missing. +// provided by C library. +// provided by compiler. +// provided by compiler. +module stddef_h { + // 's __need_* macros require textual inclusion. + textual header "stddef.h" +} +// provided by compiler or C library. +module stdio_h { + // 's __need_* macros require textual inclusion. + textual header "stdio.h" +/* + export_macros BUFSIZ, EOF, FILENAME_MAX, FOPEN_MAX, L_tmpnam, NULL, +SEEK_CUR, SEEK_END, SEEK_SET, TMP_MAX, _IOFBF, _IOLBF, +stdin, stdout, stderr +*/ + export * +} +module stdlib_h { + // 's __need_* macros require textual inclusion. + textual header "stdlib.h" +/* + export_macros RAND_MAX +*/ + export * +} +module string_h { + header "string.h" +/* + export_macros NULL +*/ + export * +} +// FI
[PATCH] D25850: [WIP] Accept nullability annotations (_Nullable) on array parameters
rsmith added a comment. This generally makes sense to me. `_Nonnull` in this position seems very similar to `static` (which typically also implies non-nullness). Comment at: lib/CodeGen/CGDebugInfo.cpp:2493-2499 case Type::Adjusted: - case Type::Decayed: + case Type::Decayed: { // Decayed and adjusted types use the adjusted type in LLVM and DWARF. -return CreateType( -cast(cast(Ty)->getAdjustedType()), Unit); +QualType Adjusted = cast(Ty)->getAdjustedType(); +(void)AttributedType::stripOuterNullability(Adjusted); +return CreateType(cast(Adjusted), Unit); + } I think this should be handled by `UnwrapTypeForDebugInfo` instead of here; this is after all just a type sugar node. Comment at: lib/Sema/SemaType.cpp:6659 attr.isContextSensitiveKeywordAttribute(), + state.getDeclarator().isPrototypeContext(), /*implicit=*/false)) { I'm not sure this is enough; you should make sure you also reject void f(int [5][_Nonnull 1]) {} and the like. Repository: rL LLVM https://reviews.llvm.org/D25850 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r284800 - DR583, DR1512: Implement a rewrite to C++'s 'composite pointer type' rules.
Author: rsmith Date: Thu Oct 20 21:36:37 2016 New Revision: 284800 URL: http://llvm.org/viewvc/llvm-project?rev=284800&view=rev Log: DR583, DR1512: Implement a rewrite to C++'s 'composite pointer type' rules. This has two significant effects: 1) Direct relational comparisons between null pointer constants (0 and nullopt) and pointers are now ill-formed. This was always the case for C, and it appears that C++ only ever permitted by accident. For instance, cases like nullptr < &a are now rejected. 2) Comparisons and conditional operators between differently-cv-qualified pointer types now work, and produce a composite type that both source pointer types can convert to (when possible). For instance, comparison between 'int **' and 'const int **' is now valid, and uses an intermediate type of 'const int *const *'. Clang previously supported #2 as an extension. We do not accept the cases in #1 as an extension. I've tested a fair amount of code to check that this doesn't break it, but if it turns out that someone is relying on this, we can easily add it back as an extension. Added: cfe/trunk/test/CXX/over/over.built/p15.cpp cfe/trunk/test/CXX/over/over.built/p16.cpp cfe/trunk/test/SemaCXX/libstdcxx_libcxx_less_hack.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/lib/Sema/SemaExpr.cpp cfe/trunk/lib/Sema/SemaExprCXX.cpp cfe/trunk/lib/Sema/SemaOverload.cpp cfe/trunk/test/CXX/drs/dr15xx.cpp cfe/trunk/test/CXX/drs/dr5xx.cpp cfe/trunk/test/CXX/expr/expr.const/p2-0x.cpp cfe/trunk/test/Misc/warning-flags.c cfe/trunk/test/OpenMP/distribute_parallel_for_simd_aligned_messages.cpp cfe/trunk/test/OpenMP/distribute_simd_aligned_messages.cpp cfe/trunk/test/OpenMP/for_simd_aligned_messages.cpp cfe/trunk/test/OpenMP/parallel_for_simd_aligned_messages.cpp cfe/trunk/test/OpenMP/simd_aligned_messages.cpp cfe/trunk/test/OpenMP/target_parallel_for_simd_aligned_messages.cpp cfe/trunk/test/OpenMP/target_simd_aligned_messages.cpp cfe/trunk/test/OpenMP/taskloop_simd_aligned_messages.cpp cfe/trunk/test/SemaCXX/compare.cpp cfe/trunk/test/SemaCXX/composite-pointer-type.cpp cfe/trunk/test/SemaCXX/constant-expression-cxx11.cpp cfe/trunk/test/SemaCXX/null_in_arithmetic_ops.cpp cfe/trunk/test/SemaCXX/nullptr.cpp cfe/trunk/test/SemaCXX/nullptr_in_arithmetic_ops.cpp cfe/trunk/test/SemaCXX/warn-memsize-comparison.cpp cfe/trunk/test/SemaObjCXX/null_objc_pointer.mm cfe/trunk/www/cxx_dr_status.html Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=284800&r1=284799&r2=284800&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Oct 20 21:36:37 2016 @@ -5536,6 +5536,8 @@ def ext_typecheck_ordered_comparison_of_ "ordered comparison between pointer and integer (%0 and %1)">; def ext_typecheck_ordered_comparison_of_pointer_and_zero : Extension< "ordered comparison between pointer and zero (%0 and %1) is an extension">; +def err_typecheck_ordered_comparison_of_pointer_and_zero : Error< + "ordered comparison between pointer and zero (%0 and %1)">; def ext_typecheck_ordered_comparison_of_function_pointers : ExtWarn< "ordered comparison of function pointers (%0 and %1)">; def ext_typecheck_comparison_of_fptr_to_void : Extension< @@ -5556,9 +5558,6 @@ def err_cond_voidptr_arc : Error < "in ARC mode">; def err_typecheck_comparison_of_distinct_pointers : Error< "comparison of distinct pointer types%diff{ ($ and $)|}0,1">; -def ext_typecheck_comparison_of_distinct_pointers_nonstandard : ExtWarn< - "comparison of distinct pointer types (%0 and %1) uses non-standard " - "composite pointer type %2">, InGroup; def err_typecheck_op_on_nonoverlapping_address_space_pointers : Error< "%select{comparison between %diff{ ($ and $)|}0,1" "|arithmetic operation with operands of type %diff{ ($ and $)|}0,1" @@ -6837,9 +6836,6 @@ def err_typecheck_expect_scalar_operand "operand of type %0 where arithmetic or pointer type is required">; def err_typecheck_cond_incompatible_operands : Error< "incompatible operand types%diff{ ($ and $)|}0,1">; -def ext_typecheck_cond_incompatible_operands_nonstandard : ExtWarn< - "incompatible operand types%diff{ ($ and $)|}0,1 use non-standard composite " - "pointer type %2">; def err_cast_selector_expr : Error< "cannot type cast @selector expression">; def ext_typecheck_cond_incompatible_pointers : ExtWarn< Modified: cfe/trunk/include/clang/Sema/Sema.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=284800&r1=284799&r2=284800&view=diff ===
r284798 - [Driver][Darwin] Pass -no_deduplicate to ld64
Author: bruno Date: Thu Oct 20 20:49:14 2016 New Revision: 284798 URL: http://llvm.org/viewvc/llvm-project?rev=284798&view=rev Log: [Driver][Darwin] Pass -no_deduplicate to ld64 Recent versions of ld64 run a deduplicate pass, which is on by default. Disable the pass by using -no_deduplicate in certain condition and enhance total compile time. rdar://problem/25455336 Added: cfe/trunk/test/Driver/darwin-ld-dedup.c Modified: cfe/trunk/include/clang/Driver/Job.h cfe/trunk/lib/Driver/Tools.cpp Modified: cfe/trunk/include/clang/Driver/Job.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Job.h?rev=284798&r1=284797&r2=284798&view=diff == --- cfe/trunk/include/clang/Driver/Job.h (original) +++ cfe/trunk/include/clang/Driver/Job.h Thu Oct 20 20:49:14 2016 @@ -175,6 +175,7 @@ public: const list_type &getJobs() const { return Jobs; } + bool empty() const { return Jobs.empty(); } size_type size() const { return Jobs.size(); } iterator begin() { return Jobs.begin(); } const_iterator begin() const { return Jobs.begin(); } Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=284798&r1=284797&r2=284798&view=diff == --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Thu Oct 20 20:49:14 2016 @@ -7882,6 +7882,29 @@ bool darwin::Linker::NeedsTempPath(const return false; } +/// \brief Pass -no_deduplicate to ld64 under certain conditions: +/// +/// - Either -O0 or -O1 is explicitly specified +/// - No -O option is specified *and* this is a compile+link (implicit -O0) +/// +/// Also do *not* add -no_deduplicate when no -O option is specified and this +/// is just a link (we can't imply -O0) +static bool shouldLinkerNotDedup(bool IsLinkerOnlyAction, const ArgList &Args) { + if (Arg *A = Args.getLastArg(options::OPT_O_Group)) { +if (A->getOption().matches(options::OPT_O0)) + return true; +if (A->getOption().matches(options::OPT_O)) + return llvm::StringSwitch(A->getValue()) +.Case("1", true) +.Default(false); +return false; // OPT_Ofast & OPT_O4 + } + + if (!IsLinkerOnlyAction) // Implicit -O0 for compile+linker only. +return true; + return false; +} + void darwin::Linker::AddLinkArgs(Compilation &C, const ArgList &Args, ArgStringList &CmdArgs, const InputInfoList &Inputs) const { @@ -7938,6 +7961,10 @@ void darwin::Linker::AddLinkArgs(Compila } } + // ld64 version 262 and above run the deduplicate pass by default. + if (Version[0] >= 262 && shouldLinkerNotDedup(C.getJobs().empty(), Args)) +CmdArgs.push_back("-no_deduplicate"); + // Derived from the "link" spec. Args.AddAllArgs(CmdArgs, options::OPT_static); if (!Args.hasArg(options::OPT_static)) Added: cfe/trunk/test/Driver/darwin-ld-dedup.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-ld-dedup.c?rev=284798&view=auto == --- cfe/trunk/test/Driver/darwin-ld-dedup.c (added) +++ cfe/trunk/test/Driver/darwin-ld-dedup.c Thu Oct 20 20:49:14 2016 @@ -0,0 +1,46 @@ +// REQUIRES: system-darwin + +// -no_deduplicate is only present from ld64 version 262 and later. +// RUN: %clang -target x86_64-apple-darwin10 -### %s \ +// RUN: -mlinker-version=261 -O0 2>&1 | FileCheck -check-prefix=LINK_DEDUP %s + +// Add -no_deduplicate when either -O0 or -O1 is explicitly specified +// RUN: %clang -target x86_64-apple-darwin10 -### %s \ +// RUN: -mlinker-version=262 -O0 2>&1 | FileCheck -check-prefix=LINK_NODEDUP %s +// RUN: %clang -target x86_64-apple-darwin10 -### %s \ +// RUN: -mlinker-version=262 -O1 2>&1 | FileCheck -check-prefix=LINK_NODEDUP %s + +// RUN: %clang -target x86_64-apple-darwin10 -### %s \ +// RUN: -mlinker-version=262 -O2 2>&1 | FileCheck -check-prefix=LINK_DEDUP %s +// RUN: %clang -target x86_64-apple-darwin10 -### %s \ +// RUN: -mlinker-version=262 -O3 2>&1 | FileCheck -check-prefix=LINK_DEDUP %s +// RUN: %clang -target x86_64-apple-darwin10 -### %s \ +// RUN: -mlinker-version=262 -Os 2>&1 | FileCheck -check-prefix=LINK_DEDUP %s +// RUN: %clang -target x86_64-apple-darwin10 -### %s \ +// RUN: -mlinker-version=262 -O4 2>&1 | FileCheck -check-prefix=LINK_DEDUP %s +// RUN: %clang -target x86_64-apple-darwin10 -### %s \ +// RUN: -mlinker-version=262 -Ofast 2>&1 | FileCheck -check-prefix=LINK_DEDUP %s + +// Add -no_deduplicate when no -O option is specified *and* this is a compile+link +// (implicit -O0) +// RUN: %clang -target x86_64-apple-darwin10 -### %s \ +// RUN: -mlinker-version=262 2>&1 | FileCheck -check-prefix=LINK_NODEDUP %s + +// Do *not* add -no_deduplicate when no -O option is specifi
r284797 - [Modules] Add 'no_undeclared_includes' module map attribute
Author: bruno Date: Thu Oct 20 20:41:56 2016 New Revision: 284797 URL: http://llvm.org/viewvc/llvm-project?rev=284797&view=rev Log: [Modules] Add 'no_undeclared_includes' module map attribute The 'no_undeclared_includes' attribute should be used in a module to tell that only non-modular headers and headers from used modules are accepted. The main motivation behind this is to prevent dep cycles between system libraries (such as darwin) and libc++. Patch by Richard Smith! Added: cfe/trunk/test/Modules/Inputs/libc-libcxx/ cfe/trunk/test/Modules/Inputs/libc-libcxx/include/ cfe/trunk/test/Modules/Inputs/libc-libcxx/include/c++/ cfe/trunk/test/Modules/Inputs/libc-libcxx/include/c++/math.h cfe/trunk/test/Modules/Inputs/libc-libcxx/include/c++/module.modulemap cfe/trunk/test/Modules/Inputs/libc-libcxx/include/c++/stdlib.h cfe/trunk/test/Modules/Inputs/libc-libcxx/include/math.h cfe/trunk/test/Modules/Inputs/libc-libcxx/include/module.modulemap cfe/trunk/test/Modules/Inputs/libc-libcxx/include/stdlib.h cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/ cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/ cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/ cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/ cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/ cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/__config cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/math.h cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/module.modulemap cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/stddef.h cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/stdio.h cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/stdlib.h cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/math.h cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/module.modulemap cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stddef.h cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stdint.h cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stdio.h cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stdlib.h cfe/trunk/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/util.h cfe/trunk/test/Modules/libc-libcxx.cpp Modified: cfe/trunk/docs/Modules.rst cfe/trunk/include/clang/Basic/Module.h cfe/trunk/include/clang/Lex/HeaderSearch.h cfe/trunk/include/clang/Lex/ModuleMap.h cfe/trunk/lib/Basic/Module.cpp cfe/trunk/lib/Lex/HeaderSearch.cpp cfe/trunk/lib/Lex/ModuleMap.cpp cfe/trunk/test/Modules/Inputs/System/usr/include/stdbool.h Modified: cfe/trunk/docs/Modules.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/Modules.rst?rev=284797&r1=284796&r2=284797&view=diff == --- cfe/trunk/docs/Modules.rst (original) +++ cfe/trunk/docs/Modules.rst Thu Oct 20 20:41:56 2016 @@ -365,6 +365,8 @@ The ``system`` attribute specifies that The ``extern_c`` attribute specifies that the module contains C code that can be used from within C++. When such a module is built for use in C++ code, all of the module's headers will be treated as if they were contained within an implicit ``extern "C"`` block. An import for a module with this attribute can appear within an ``extern "C"`` block. No other restrictions are lifted, however: the module currently cannot be imported within an ``extern "C"`` block in a namespace. +The ``no_undeclared_includes`` attribute specifies that the module can only reach non-modular headers and headers from used modules. Since some headers could be present in more than one search path and map to different modules in each path, this mechanism helps clang to find the right header, i.e., prefer the one for the current module or in a submodule instead of the first usual match in the search paths. + Modules can have a number of different kinds of members, each of which is described below: .. parsed-literal:: Modified: cfe/trunk/include/clang/Basic/Module.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Module.h?rev=284797&r1=284796&r2=284797&view=diff == --- cfe/trunk/include/clang/Basic/Module.h (original) +++ cfe/trunk/include/clang/Basic/Module.h Thu Oct 20 20:41:56 2016 @@ -201,6 +201,10 @@ public: /// built. unsigned ConfigMacrosExhaustive : 1; + /// \brief Whether files in this module can only include non-modular headers + /// and headers from used modules. + unsigned NoUndeclaredIncludes : 1; + /// \brief Describes the visibility of the various names within a /// particular module. enum NameVisibilityKind { Modified: cfe/trunk/include/clang/Lex/HeaderSearch.h
[PATCH] D25579: [codeview] emit debug info for indirect virtual base classes
inglorion updated this revision to Diff 75381. inglorion added a comment. Use insert's return value to save a set lookup, and use CanonicalDeclPtr https://reviews.llvm.org/D25579 Files: lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDebugInfo.h test/CodeGenCXX/debug-info-ms-vbase.cpp Index: test/CodeGenCXX/debug-info-ms-vbase.cpp === --- test/CodeGenCXX/debug-info-ms-vbase.cpp +++ test/CodeGenCXX/debug-info-ms-vbase.cpp @@ -24,6 +24,17 @@ // CHECK: ![[HasVirtualMethod_base]] = !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[HasPrimaryBase]], baseType: ![[HasVirtualMethod]]) +// CHECK: ![[HasIndirectVirtualBase:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "HasIndirectVirtualBase" +// CHECK-SAME: elements: ![[elements:[0-9]+]] + +// CHECK: !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[HasIndirectVirtualBase]], baseType: ![[HasPrimaryBase]] +// CHECK-NOT: DIFlagIndirectVirtualBase +// CHECK-SAME: ) + +// CHECK: !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[HasIndirectVirtualBase]], baseType: ![[SecondaryVTable]] +// CHECK-SAME: flags: +// CHECK-SAME: DIFlagIndirectVirtualBase + // CHECK: ![[DynamicNoVFPtr:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DynamicNoVFPtr", // CHECK-SAME: elements: ![[elements:[0-9]+]] @@ -52,3 +63,6 @@ HasPrimaryBase has_primary_base; +struct HasIndirectVirtualBase : public HasPrimaryBase {}; + +HasIndirectVirtualBase has_indirect_virtual_base; Index: lib/CodeGen/CGDebugInfo.h === --- lib/CodeGen/CGDebugInfo.h +++ lib/CodeGen/CGDebugInfo.h @@ -15,12 +15,14 @@ #define LLVM_CLANG_LIB_CODEGEN_CGDEBUGINFO_H #include "CGBuilder.h" +#include "clang/AST/DeclCXX.h" #include "clang/AST/Expr.h" #include "clang/AST/ExternalASTSource.h" #include "clang/AST/Type.h" #include "clang/Basic/SourceLocation.h" #include "clang/Frontend/CodeGenOptions.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/Optional.h" #include "llvm/IR/DIBuilder.h" #include "llvm/IR/DebugInfo.h" @@ -32,7 +34,6 @@ } namespace clang { -class CXXMethodDecl; class ClassTemplateSpecializationDecl; class GlobalDecl; class ModuleMap; @@ -218,6 +219,15 @@ SmallVectorImpl &EltTys, llvm::DIType *RecordTy); + /// Helper function for CollectCXXBases. + /// Adds debug info entries for types in Bases that are not in SeenTypes. + void CollectCXXBasesAux(const CXXRecordDecl *RD, llvm::DIFile *Unit, + SmallVectorImpl &EltTys, + llvm::DIType *RecordTy, + const CXXRecordDecl::base_class_const_range &Bases, + llvm::DenseSet> &SeenTypes, + llvm::DINode::DIFlags StartingFlags); + /// A helper function to collect template parameters. llvm::DINodeArray CollectTemplateParams(const TemplateParameterList *TPList, ArrayRef TAList, Index: lib/CodeGen/CGDebugInfo.cpp === --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -13,9 +13,9 @@ #include "CGDebugInfo.h" #include "CGBlocks.h" -#include "CGRecordLayout.h" #include "CGCXXABI.h" #include "CGObjCRuntime.h" +#include "CGRecordLayout.h" #include "CodeGenFunction.h" #include "CodeGenModule.h" #include "clang/AST/ASTContext.h" @@ -31,6 +31,7 @@ #include "clang/Lex/HeaderSearchOptions.h" #include "clang/Lex/ModuleMap.h" #include "clang/Lex/PreprocessorOptions.h" +#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringExtras.h" #include "llvm/IR/Constants.h" @@ -1380,13 +1381,33 @@ void CGDebugInfo::CollectCXXBases(const CXXRecordDecl *RD, llvm::DIFile *Unit, SmallVectorImpl &EltTys, llvm::DIType *RecordTy) { - const ASTRecordLayout &RL = CGM.getContext().getASTRecordLayout(RD); - for (const auto &BI : RD->bases()) { -llvm::DINode::DIFlags BFlags = llvm::DINode::FlagZero; -uint64_t BaseOffset; + llvm::DenseSet> SeenTypes; + CollectCXXBasesAux(RD, Unit, EltTys, RecordTy, RD->bases(), SeenTypes, + llvm::DINode::FlagZero); + + // If we are generating CodeView debug info, we also need to emit records for + // indirect virtual base classes. + if (CGM.getCodeGenOpts().EmitCodeView) { +CollectCXXBasesAux(RD, Unit, EltTys, RecordTy, RD->vbases(), SeenTypes, + llvm::DINode::FlagIndirectVirtualBase); + } +} +void CGDebugInfo::CollectCXXBasesAux( +const CXXRecordDecl *RD, llvm::DIFile *Unit, +SmallVectorImpl &EltTys, llvm::DIType *RecordTy, +const CXXRecordDecl::base_class_const_range &Bases, +llvm::DenseSet> &SeenTypes, +llvm::DINode::DIFlags StartingFlags
[PATCH] D25857: [tsan] Introduce a function attribute to disable TSan checking at run time
zaks.anna created this revision. zaks.anna added reviewers: kcc, kubabrecka, dvyukov. zaks.anna added a subscriber: cfe-commits. This introduces a function annotation that disables TSan checking for the function at run time. The benefit over __attribute__((no_sanitize("thread"))) is that the accesses within the callees will also be suppressed. The motivation for this attribute is a guarantee given by the objective C language that the calls to the reference count decrement and object deallocation will be synchronized. To model this properly, we would need to intercept all ref count decrement calls (which are very common in ObjC due to use of ARC) and also every single message send. Instead, we propose to just ignore all accesses made from within dealloc at run time. The main downside is that this still does not introduce any synchronization, which means we might still report false positives if the code that relies on this synchronization is not executed from within dealloc. However, we have not seen this in practice so far and think these cases will be very rare. (This problem is similar in nature to https://reviews.llvm.org/D21609; unfortunately, the same solution does not apply here.) https://reviews.llvm.org/D25857 Files: lib/CodeGen/CodeGenFunction.cpp test/CodeGen/sanitize-thread-attr-dealloc.m Index: test/CodeGen/sanitize-thread-attr-dealloc.m === --- /dev/null +++ test/CodeGen/sanitize-thread-attr-dealloc.m @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o - %s | FileCheck -check-prefix=WITHOUT %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o - %s -fsanitize=thread | FileCheck -check-prefix=TSAN %s + +__attribute__((objc_root_class)) +@interface NSObject +- (void)dealloc; +@end + +@interface MyObject : NSObject +- (void) dealloc; +@end + +@implementation MyObject +- (void)dealloc { + [super dealloc]; +} +@end + +// WITHOUT-NOT: "sanitize_thread_no_checking_at_run_time" + +// TSAN: dealloc{{.*}}) [[ATTR:#[0-9]+]] +// TSAN: attributes [[ATTR]] = { nounwind sanitize_thread {{.*}} "sanitize_thread_no_checking_at_run_time" {{.*}} } + Index: lib/CodeGen/CodeGenFunction.cpp === --- lib/CodeGen/CodeGenFunction.cpp +++ lib/CodeGen/CodeGenFunction.cpp @@ -714,6 +714,13 @@ if (SanOpts.has(SanitizerKind::SafeStack)) Fn->addFnAttr(llvm::Attribute::SafeStack); + // Ignore TSan memory acesses from within dealloc and all of its calees at + // run time. + if (SanOpts.has(SanitizerKind::Thread)) +if (const auto *M = dyn_cast_or_null(D)) + if (M->getMethodFamily() == OMF_dealloc) +Fn->addFnAttr("sanitize_thread_no_checking_at_run_time"); + // Apply xray attributes to the function (as a string, for now) if (D && ShouldXRayInstrumentFunction()) { if (const auto *XRayAttr = D->getAttr()) { Index: test/CodeGen/sanitize-thread-attr-dealloc.m === --- /dev/null +++ test/CodeGen/sanitize-thread-attr-dealloc.m @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o - %s | FileCheck -check-prefix=WITHOUT %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o - %s -fsanitize=thread | FileCheck -check-prefix=TSAN %s + +__attribute__((objc_root_class)) +@interface NSObject +- (void)dealloc; +@end + +@interface MyObject : NSObject +- (void) dealloc; +@end + +@implementation MyObject +- (void)dealloc { + [super dealloc]; +} +@end + +// WITHOUT-NOT: "sanitize_thread_no_checking_at_run_time" + +// TSAN: dealloc{{.*}}) [[ATTR:#[0-9]+]] +// TSAN: attributes [[ATTR]] = { nounwind sanitize_thread {{.*}} "sanitize_thread_no_checking_at_run_time" {{.*}} } + Index: lib/CodeGen/CodeGenFunction.cpp === --- lib/CodeGen/CodeGenFunction.cpp +++ lib/CodeGen/CodeGenFunction.cpp @@ -714,6 +714,13 @@ if (SanOpts.has(SanitizerKind::SafeStack)) Fn->addFnAttr(llvm::Attribute::SafeStack); + // Ignore TSan memory acesses from within dealloc and all of its calees at + // run time. + if (SanOpts.has(SanitizerKind::Thread)) +if (const auto *M = dyn_cast_or_null(D)) + if (M->getMethodFamily() == OMF_dealloc) +Fn->addFnAttr("sanitize_thread_no_checking_at_run_time"); + // Apply xray attributes to the function (as a string, for now) if (D && ShouldXRayInstrumentFunction()) { if (const auto *XRayAttr = D->getAttr()) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25853: [libcxx] [test] Fix non-Standard make_from_tuple() tests.
STL_MSFT created this revision. STL_MSFT added reviewers: EricWF, mclow.lists. STL_MSFT added a subscriber: cfe-commits. The Standard doesn't depict make_from_tuple() as conditionally noexcept. Mark these tests as libcxx-specific. https://reviews.llvm.org/D25853 Files: test/std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.pass.cpp Index: test/std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.pass.cpp === --- test/std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.pass.cpp +++ test/std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.pass.cpp @@ -175,14 +175,14 @@ Tuple tup; ((void)tup); Tuple const& ctup = tup; ((void)ctup); ASSERT_NOT_NOEXCEPT(std::make_from_tuple(ctup)); -ASSERT_NOEXCEPT(std::make_from_tuple(std::move(tup))); + LIBCPP_ONLY(ASSERT_NOEXCEPT(std::make_from_tuple(std::move(tup; } { using Tuple = std::pair; Tuple tup; ((void)tup); Tuple const& ctup = tup; ((void)ctup); ASSERT_NOT_NOEXCEPT(std::make_from_tuple(ctup)); -ASSERT_NOEXCEPT(std::make_from_tuple(std::move(tup))); + LIBCPP_ONLY(ASSERT_NOEXCEPT(std::make_from_tuple(std::move(tup; } { using Tuple = std::tuple; @@ -192,7 +192,7 @@ { using Tuple = std::tuple; Tuple tup; ((void)tup); -ASSERT_NOEXCEPT(std::make_from_tuple(tup)); +LIBCPP_ONLY(ASSERT_NOEXCEPT(std::make_from_tuple(tup))); } { using Tuple = std::array; @@ -202,7 +202,7 @@ { using Tuple = std::array; Tuple tup; ((void)tup); -ASSERT_NOEXCEPT(std::make_from_tuple(tup)); +LIBCPP_ONLY(ASSERT_NOEXCEPT(std::make_from_tuple(tup))); } } Index: test/std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.pass.cpp === --- test/std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.pass.cpp +++ test/std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.pass.cpp @@ -175,14 +175,14 @@ Tuple tup; ((void)tup); Tuple const& ctup = tup; ((void)ctup); ASSERT_NOT_NOEXCEPT(std::make_from_tuple(ctup)); -ASSERT_NOEXCEPT(std::make_from_tuple(std::move(tup))); +LIBCPP_ONLY(ASSERT_NOEXCEPT(std::make_from_tuple(std::move(tup; } { using Tuple = std::pair; Tuple tup; ((void)tup); Tuple const& ctup = tup; ((void)ctup); ASSERT_NOT_NOEXCEPT(std::make_from_tuple(ctup)); -ASSERT_NOEXCEPT(std::make_from_tuple(std::move(tup))); +LIBCPP_ONLY(ASSERT_NOEXCEPT(std::make_from_tuple(std::move(tup; } { using Tuple = std::tuple; @@ -192,7 +192,7 @@ { using Tuple = std::tuple; Tuple tup; ((void)tup); -ASSERT_NOEXCEPT(std::make_from_tuple(tup)); +LIBCPP_ONLY(ASSERT_NOEXCEPT(std::make_from_tuple(tup))); } { using Tuple = std::array; @@ -202,7 +202,7 @@ { using Tuple = std::array; Tuple tup; ((void)tup); -ASSERT_NOEXCEPT(std::make_from_tuple(tup)); +LIBCPP_ONLY(ASSERT_NOEXCEPT(std::make_from_tuple(tup))); } } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25852: [libcxx] [test] Fix shadow warnings.
STL_MSFT created this revision. STL_MSFT added reviewers: EricWF, mclow.lists. STL_MSFT added a subscriber: cfe-commits. Fix shadow warnings. This variable was scoped incorrectly, found by MSVC. https://reviews.llvm.org/D25852 Files: test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp Index: test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp === --- test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp +++ test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp @@ -81,8 +81,8 @@ { test_one_arg(); using Opt = std::optional; -Opt opt; { +Opt opt; opt.emplace(101, 41); assert(static_cast(opt) == true); assert(*opt == T(101, 41)); Index: test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp === --- test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp +++ test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp @@ -81,8 +81,8 @@ { test_one_arg(); using Opt = std::optional; -Opt opt; { +Opt opt; opt.emplace(101, 41); assert(static_cast(opt) == true); assert(*opt == T(101, 41)); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25851: [libcxx] [test] Fix unreferenced formal parameter warnings.
STL_MSFT created this revision. STL_MSFT added reviewers: EricWF, mclow.lists. STL_MSFT added a subscriber: cfe-commits. Fix unreferenced formal parameter warnings. Found by MSVC as usual. https://reviews.llvm.org/D25851 Files: test/std/utilities/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp test/std/utilities/optional/optional.object/optional.object.swap/swap.pass.cpp test/std/utilities/optional/optional.specalg/swap.pass.cpp test/support/archetypes.hpp Index: test/support/archetypes.hpp === --- test/support/archetypes.hpp +++ test/support/archetypes.hpp @@ -60,11 +60,11 @@ ++alive; ++constructed; ++value_constructed; } template ::type = true> -explicit TestBase(int x, int y) noexcept : value(y) { +explicit TestBase(int, int y) noexcept : value(y) { ++alive; ++constructed; ++value_constructed; } template ::type = true> -TestBase(int x, int y) noexcept : value(y) { +TestBase(int, int y) noexcept : value(y) { ++alive; ++constructed; ++value_constructed; } template ::type = true> @@ -131,9 +131,9 @@ template ::type = true> constexpr ValueBase(int x) : value(x) {} template ::type = true> -explicit constexpr ValueBase(int x, int y) : value(y) {} +explicit constexpr ValueBase(int, int y) : value(y) {} template ::type = true> -constexpr ValueBase(int x, int y) : value(y) {} +constexpr ValueBase(int, int y) : value(y) {} template ::type = true> explicit constexpr ValueBase(std::initializer_list& il, int y = 0) : value(il.size()) {} template ::type = true> @@ -189,9 +189,9 @@ template ::type = true> constexpr TrivialValueBase(int x) : value(x) {} template ::type = true> -explicit constexpr TrivialValueBase(int x, int y) : value(y) {} +explicit constexpr TrivialValueBase(int, int y) : value(y) {} template ::type = true> -constexpr TrivialValueBase(int x, int y) : value(y) {} +constexpr TrivialValueBase(int, int y) : value(y) {} template ::type = true> explicit constexpr TrivialValueBase(std::initializer_list& il, int y = 0) : value(il.size()) {} template ::type = true> Index: test/std/utilities/optional/optional.specalg/swap.pass.cpp === --- test/std/utilities/optional/optional.specalg/swap.pass.cpp +++ test/std/utilities/optional/optional.specalg/swap.pass.cpp @@ -60,7 +60,7 @@ Z(Z&&) { TEST_THROW(7);} friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;} -friend void swap(Z& x, Z& y) { TEST_THROW(6);} +friend void swap(Z&, Z&) { TEST_THROW(6);} }; Index: test/std/utilities/optional/optional.object/optional.object.swap/swap.pass.cpp === --- test/std/utilities/optional/optional.object/optional.object.swap/swap.pass.cpp +++ test/std/utilities/optional/optional.object/optional.object.swap/swap.pass.cpp @@ -61,7 +61,7 @@ Z(Z&&) {TEST_THROW(7);} friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;} -friend void swap(Z& x, Z& y) {TEST_THROW(6);} +friend void swap(Z&, Z&) {TEST_THROW(6);} }; Index: test/std/utilities/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp === --- test/std/utilities/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp +++ test/std/utilities/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp @@ -55,7 +55,7 @@ class Z { public: -Z(int i) {TEST_THROW(6);} +Z(int) {TEST_THROW(6);} }; Index: test/support/archetypes.hpp === --- test/support/archetypes.hpp +++ test/support/archetypes.hpp @@ -60,11 +60,11 @@ ++alive; ++constructed; ++value_constructed; } template ::type = true> -explicit TestBase(int x, int y) noexcept : value(y) { +explicit TestBase(int, int y) noexcept : value(y) { ++alive; ++constructed; ++value_constructed; } template ::type = true> -TestBase(int x, int y) noexcept : value(y) { +TestBase(int, int y) noexcept : value(y) { ++alive; ++constructed; ++value_constructed; } template ::type = true> @@ -131,9 +131,9 @@ template ::type = true> constexpr ValueBase(int x) : value(x) {} template ::type = true> -explicit constexpr ValueBase(int x, int y) : value(y) {} +explicit constexpr ValueBase(int, int y) : value(y) {} template ::type = true> -constexpr ValueBase(int x, int y) : value(y) {} +constexpr ValueBase(int, int y) : value(y) {} template ::type = true> explicit constexpr ValueBase(std::initializer_list& il, int y = 0) : value(il.size()) {} template ::type = true> @@ -189,
[PATCH] D25850: [WIP] Accept nullability annotations (_Nullable) on array parameters
jordan_rose created this revision. jordan_rose added reviewers: aprantl, doug.gregor. jordan_rose added a subscriber: cfe-commits. jordan_rose set the repository for this revision to rL LLVM. Last year Apple added new qualifiers to pointer types: `_Nullable`, `_Nonnull`, and `_Null_unspecified`. This patch extends that to array types used in function declarations, which should have always been supported since they immediately decay to pointers. I'm not really happy with the invariants I've had to break for this to work, though. Previously a DecayedType always contained a PointerType; now it may contain an AttributedType wrapped around a PointerType. Are there any other places where this is going to cause problems besides debug info? Still to do: - Tests (I've been ad-hoc testing with -ast-dump) - Probably fix up cases involving typedefs - Figure out how this affects `#pragma clang assume_nonnull` (in a follow-up commit) Part of rdar://problem/25846421 Repository: rL LLVM https://reviews.llvm.org/D25850 Files: include/clang/AST/Type.h include/clang/Sema/Sema.h lib/AST/ASTContext.cpp lib/CodeGen/CGDebugInfo.cpp lib/Parse/ParseDecl.cpp lib/Sema/SemaAPINotes.cpp lib/Sema/SemaType.cpp Index: lib/Sema/SemaType.cpp === --- lib/Sema/SemaType.cpp +++ lib/Sema/SemaType.cpp @@ -5808,6 +5808,7 @@ NullabilityKind nullability, SourceLocation nullabilityLoc, bool isContextSensitive, + bool isPrototypeContext, bool implicit, bool overrideExisting) { if (!implicit) { @@ -5889,7 +5890,8 @@ } // If this definitely isn't a pointer type, reject the specifier. - if (!desugared->canHaveNullability()) { + if (!desugared->canHaveNullability() && + !(isPrototypeContext && desugared->isArrayType())) { if (!implicit) { Diag(nullabilityLoc, diag::err_nullability_nonpointer) << DiagNullabilityKind(nullability, isContextSensitive) << type; @@ -6647,12 +6649,14 @@ // don't want to distribute the nullability specifier past any // dependent type, because that complicates the user model. if (type->canHaveNullability() || type->isDependentType() || + type->isArrayType() || !distributeNullabilityTypeAttr(state, type, attr)) { if (state.getSema().checkNullabilityTypeSpecifier( type, mapNullabilityAttrKind(attr.getKind()), attr.getLoc(), attr.isContextSensitiveKeywordAttribute(), + state.getDeclarator().isPrototypeContext(), /*implicit=*/false)) { attr.setInvalid(); } Index: lib/Sema/SemaAPINotes.cpp === --- lib/Sema/SemaAPINotes.cpp +++ lib/Sema/SemaAPINotes.cpp @@ -46,25 +46,30 @@ } QualType type; + bool isPrototypeContext; // Nullability for a function/method appertains to the retain type. if (auto function = dyn_cast(decl)) { type = function->getReturnType(); +isPrototypeContext = true; } else if (auto method = dyn_cast(decl)) { type = method->getReturnType(); +isPrototypeContext = true; } else if (auto value = dyn_cast(decl)) { type = value->getType(); +isPrototypeContext = isa(value); } else if (auto property = dyn_cast(decl)) { type = property->getType(); +isPrototypeContext = false; } else { return; } // Check the nullability specifier on this type. QualType origType = type; S.checkNullabilityTypeSpecifier(type, nullability, decl->getLocation(), /*isContextSensitive=*/false, - /*implicit=*/true, + isPrototypeContext, /*implicit=*/true, overrideExisting); if (type.getTypePtr() == origType.getTypePtr()) return; Index: lib/Parse/ParseDecl.cpp === --- lib/Parse/ParseDecl.cpp +++ lib/Parse/ParseDecl.cpp @@ -6275,16 +6275,15 @@ T.consumeClose(); - ParsedAttributes attrs(AttrFactory); - MaybeParseCXX11Attributes(attrs); + MaybeParseCXX11Attributes(DS.getAttributes()); // Remember that we parsed a array type, and remember its features. D.AddTypeInfo(DeclaratorChunk::getArray(DS.getTypeQualifiers(), StaticLoc.isValid(), isStar, NumElements.get(), T.getOpenLocation(), T.getCloseLocation()), -attrs, T.getCloseLocation()); +DS.getAttributes(), T.ge
Buildbot numbers for the week of 10/9/2016 - 10/15/2016
Hello everyone, Below are some buildbot numbers for the last week of 10/9/2016 - 10/15/2016. Please see the same data in attached csv files: The longest time each builder was red during the last week; "Status change ratio" by active builder (percent of builds that changed the builder status from greed to red or from red to green); Count of commits by project; Number of completed builds, failed builds and average build time for successful builds per active builder; Average waiting time for a revision to get build result per active builder (response time). Thanks Galina The longest time each builder was red during the last week: buildername| was_red +--- clang-x64-ninja-win7 | 67:36:45 clang-x86-win2008-selfhost | 61:19:47 lldb-x86_64-ubuntu-14.04-android | 60:16:16 clang-3stage-ubuntu| 38:20:15 sanitizer-x86_64-linux-bootstrap | 35:43:54 sanitizer-x86_64-linux-fast| 35:05:07 clang-ppc64le-linux-multistage | 23:51:21 clang-x86_64-linux-abi-test| 22:24:31 sanitizer-x86_64-linux | 20:24:08 clang-native-aarch64-full | 19:33:08 clang-cmake-mipsel | 18:40:38 clang-with-lto-ubuntu | 18:09:03 perf-x86_64-penryn-O3-polly-before-vectorizer-detect-only | 17:57:02 lld-x86_64-darwin13| 17:11:54 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast | 16:54:45 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast | 16:41:47 lld-x86_64-freebsd | 16:31:35 lld-x86_64-win7| 16:20:47 clang-x86-windows-msvc2015 | 15:01:25 clang-cmake-thumbv7-a15-full-sh| 14:05:44 clang-cmake-armv7-a15-selfhost-neon| 14:00:10 sanitizer-windows | 11:41:42 perf-x86_64-penryn-O3-polly-before-vectorizer | 11:35:48 clang-cmake-aarch64-full | 10:11:04 lldb-windows7-android | 08:50:43 clang-bpf-build| 08:46:37 clang-x86_64-debian-fast | 08:26:02 clang-ppc64le-linux-lnt| 08:23:46 libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11 | 08:03:53 clang-cmake-armv7-a15-selfhost | 07:33:56 clang-ppc64le-linux| 07:30:32 libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan | 07:27:22 clang-ppc64be-linux| 07:22:38 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx11 | 06:21:57 clang-hexagon-elf | 06:19:38 clang-x86_64-linux-selfhost-modules| 06:06:29 perf-x86_64-penryn-O3-polly| 05:53:44 clang-cmake-aarch64-42vma | 05:41:55 clang-cmake-mips | 05:41:14 clang-atom-d525-fedora-rel | 05:36:16 clang-cmake-armv7-a15-full | 05:02:14 clang-cmake-aarch64-quick | 04:55:24 clang-cmake-thumbv7-a15| 04:26:30 clang-cmake-armv7-a15 | 04:26:21 llvm-sphinx-docs | 04:09:27 libcxx-libcxxabi-libunwind-arm-linux-noexceptions | 04:05:07 libcxx-libcxxabi-libunwind-arm-linux | 03:14:22 clang-sphinx-docs | 02:54:08 libcxx-libcxxabi-x86_64-linux-ubuntu-msan | 02:44:20 llvm-mips-linux| 02:43:15 clang-ppc64be-linux-lnt| 02:28:38 clang-cuda-build | 02:19:59 sanitizer-ppc64be-linux| 02:00:44 sanitizer-ppc64le-linux| 01:59:40 clang-s390x-linux | 01:56:40 sanitizer-x86_64-linux-fuzzer | 01:55:56 clang-ppc64be-linux-multistage | 01:50:09 perf-x86_64-penryn-O3-polly-before-vectorizer-unprofitable | 01:47:58 sanitizer-x86_64-linux-autoconf| 01:46:12 libcxx-libcxxabi-x86_6
Buildbot numbers for the week of 10/2/2016 - 10/8/2016
Hello everyone, Below are some buildbot numbers for the week of 10/2/2016 - 10/8/2016. Please see the same data in attached csv files: The longest time each builder was red during the last week; "Status change ratio" by active builder (percent of builds that changed the builder status from greed to red or from red to green); Count of commits by project; Number of completed builds, failed builds and average build time for successful builds per active builder; Average waiting time for a revision to get build result per active builder (response time). Thanks Galina The longest time each builder was red during the last week: buildername| was_red +--- llvm-mips-linux| 115:07:03 clang-x86_64-linux-selfhost-modules| 103:05:40 clang-x86-win2008-selfhost | 97:31:46 clang-x64-ninja-win7 | 96:35:07 lldb-x86_64-darwin-13.4| 61:13:02 lldb-windows7-android | 55:09:48 lldb-x86_64-ubuntu-14.04-android | 51:58:18 lldb-amd64-ninja-netbsd7 | 39:33:03 lldb-x86-windows-msvc2015 | 32:55:44 sanitizer-windows | 31:21:37 clang-cmake-mipsel | 23:58:02 lldb-amd64-ninja-freebsd11 | 19:03:56 sanitizer-x86_64-linux-bootstrap | 18:26:55 sanitizer-x86_64-linux-fast| 18:08:29 libcxx-libcxxabi-x86_64-linux-debian | 17:23:28 clang-native-aarch64-full | 17:22:53 sanitizer-x86_64-linux | 15:16:52 clang-cmake-thumbv7-a15-full-sh| 14:54:59 clang-cmake-armv7-a15-selfhost-neon| 13:54:36 clang-cmake-armv7-a15-selfhost | 13:40:03 clang-x86-windows-msvc2015 | 11:53:44 libcxx-libcxxabi-x86_64-linux-debian-noexceptions | 11:40:10 libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11 | 10:46:46 libcxx-libcxxabi-x86_64-linux-ubuntu-asan | 10:29:33 clang-native-arm-lnt | 09:47:14 clang-atom-d525-fedora-rel | 07:54:46 sanitizer-ppc64le-linux| 06:18:32 clang-cmake-aarch64-quick | 06:06:36 sanitizer-ppc64be-linux| 06:06:16 clang-ppc64le-linux-multistage | 05:45:42 clang-with-lto-ubuntu | 05:39:10 libcxx-libcxxabi-x86_64-linux-ubuntu-msan | 04:01:40 clang-s390x-linux | 03:39:29 clang-bpf-build| 03:39:10 clang-ppc64le-linux-lnt| 03:38:49 clang-cuda-build | 03:37:45 llvm-hexagon-elf | 03:37:16 clang-cmake-armv7-a15-full | 03:34:57 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast | 03:32:46 clang-hexagon-elf | 03:32:00 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast | 03:29:20 clang-x86_64-debian-fast | 03:26:42 clang-cmake-aarch64-42vma | 03:25:16 clang-cmake-aarch64-full | 03:16:15 clang-ppc64le-linux| 02:59:12 clang-cmake-mips | 02:54:29 libcxx-libcxxabi-libunwind-x86_64-linux-ubuntu | 02:53:53 clang-cmake-armv7-a15 | 02:48:54 clang-cmake-thumbv7-a15| 02:48:39 perf-x86_64-penryn-O3-polly-before-vectorizer-unprofitable | 02:29:18 lld-sphinx-docs| 02:05:17 clang-sphinx-docs | 02:01:47 lldb-x86_64-ubuntu-14.04-cmake | 01:58:49 libcxx-libcxxabi-libunwind-x86_64-linux-debian | 01:47:23 clang-ppc64be-linux-multistage | 01:46:49 lld-x86_64-darwin13| 01:36:18 sanitizer-x86_64-linux-autoconf| 01:35:52 perf-x86_64-penryn-O3-polly-parallel-fast | 01:22:50 lldb-x86_64-ubuntu-14.04-buildserver | 01:22:37 clang-3stage-ubuntu
[PATCH] D25579: [codeview] emit debug info for indirect virtual base classes
inglorion updated this revision to Diff 75367. inglorion added a comment. Updated to track the latest state of https://reviews.llvm.org/D25578 https://reviews.llvm.org/D25579 Files: lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDebugInfo.h test/CodeGenCXX/debug-info-ms-vbase.cpp Index: test/CodeGenCXX/debug-info-ms-vbase.cpp === --- test/CodeGenCXX/debug-info-ms-vbase.cpp +++ test/CodeGenCXX/debug-info-ms-vbase.cpp @@ -24,6 +24,17 @@ // CHECK: ![[HasVirtualMethod_base]] = !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[HasPrimaryBase]], baseType: ![[HasVirtualMethod]]) +// CHECK: ![[HasIndirectVirtualBase:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "HasIndirectVirtualBase" +// CHECK-SAME: elements: ![[elements:[0-9]+]] + +// CHECK: !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[HasIndirectVirtualBase]], baseType: ![[HasPrimaryBase]] +// CHECK-NOT: DIFlagIndirectVirtualBase +// CHECK-SAME: ) + +// CHECK: !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[HasIndirectVirtualBase]], baseType: ![[SecondaryVTable]] +// CHECK-SAME: flags: +// CHECK-SAME: DIFlagIndirectVirtualBase + // CHECK: ![[DynamicNoVFPtr:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DynamicNoVFPtr", // CHECK-SAME: elements: ![[elements:[0-9]+]] @@ -52,3 +63,6 @@ HasPrimaryBase has_primary_base; +struct HasIndirectVirtualBase : public HasPrimaryBase {}; + +HasIndirectVirtualBase has_indirect_virtual_base; Index: lib/CodeGen/CGDebugInfo.h === --- lib/CodeGen/CGDebugInfo.h +++ lib/CodeGen/CGDebugInfo.h @@ -15,12 +15,14 @@ #define LLVM_CLANG_LIB_CODEGEN_CGDEBUGINFO_H #include "CGBuilder.h" +#include "clang/AST/DeclCXX.h" #include "clang/AST/Expr.h" #include "clang/AST/ExternalASTSource.h" #include "clang/AST/Type.h" #include "clang/Basic/SourceLocation.h" #include "clang/Frontend/CodeGenOptions.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/Optional.h" #include "llvm/IR/DIBuilder.h" #include "llvm/IR/DebugInfo.h" @@ -32,7 +34,6 @@ } namespace clang { -class CXXMethodDecl; class ClassTemplateSpecializationDecl; class GlobalDecl; class ModuleMap; @@ -218,6 +219,15 @@ SmallVectorImpl &EltTys, llvm::DIType *RecordTy); + /// Helper function for CollectCXXBases. + /// Adds debug info entries for types in Bases that are not in SeenTypes. + void CollectCXXBasesAux(const CXXRecordDecl *RD, llvm::DIFile *Unit, + SmallVectorImpl &EltTys, + llvm::DIType *RecordTy, + const CXXRecordDecl::base_class_const_range &Bases, + llvm::DenseSet &SeenTypes, + llvm::DINode::DIFlags StartingFlags); + /// A helper function to collect template parameters. llvm::DINodeArray CollectTemplateParams(const TemplateParameterList *TPList, ArrayRef TAList, Index: lib/CodeGen/CGDebugInfo.cpp === --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -13,9 +13,9 @@ #include "CGDebugInfo.h" #include "CGBlocks.h" -#include "CGRecordLayout.h" #include "CGCXXABI.h" #include "CGObjCRuntime.h" +#include "CGRecordLayout.h" #include "CodeGenFunction.h" #include "CodeGenModule.h" #include "clang/AST/ASTContext.h" @@ -31,6 +31,7 @@ #include "clang/Lex/HeaderSearchOptions.h" #include "clang/Lex/ModuleMap.h" #include "clang/Lex/PreprocessorOptions.h" +#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringExtras.h" #include "llvm/IR/Constants.h" @@ -1380,13 +1381,35 @@ void CGDebugInfo::CollectCXXBases(const CXXRecordDecl *RD, llvm::DIFile *Unit, SmallVectorImpl &EltTys, llvm::DIType *RecordTy) { - const ASTRecordLayout &RL = CGM.getContext().getASTRecordLayout(RD); - for (const auto &BI : RD->bases()) { -llvm::DINode::DIFlags BFlags = llvm::DINode::FlagZero; -uint64_t BaseOffset; + llvm::DenseSet SeenTypes; + CollectCXXBasesAux(RD, Unit, EltTys, RecordTy, RD->bases(), SeenTypes, + llvm::DINode::FlagZero); + + // If we are generating CodeView debug info, we also need to emit records for + // indirect virtual base classes. + if (CGM.getCodeGenOpts().EmitCodeView) { +CollectCXXBasesAux(RD, Unit, EltTys, RecordTy, RD->vbases(), SeenTypes, + llvm::DINode::FlagIndirectVirtualBase); + } +} +void CGDebugInfo::CollectCXXBasesAux( +const CXXRecordDecl *RD, llvm::DIFile *Unit, +SmallVectorImpl &EltTys, llvm::DIType *RecordTy, +const CXXRecordDecl::base_class_const_range &Bases, +llvm::DenseSet &SeenTypes, +llvm::DINode::DIFlags StartingFlags) { +
[PATCH] D25842: [clang] Limit clang test to ARM and AArch64 only
mgrang retitled this revision from "[clang] Limit clang test to ARM only" to "[clang] Limit clang test to ARM and AArch64 only". mgrang updated the summary for this revision. mgrang updated this revision to Diff 75368. mgrang added a comment. Test limited only to ARM and AArch64. https://reviews.llvm.org/D25842 Files: test/Frontend/gnu-mcount.c Index: test/Frontend/gnu-mcount.c === --- test/Frontend/gnu-mcount.c +++ test/Frontend/gnu-mcount.c @@ -1,3 +1,5 @@ +// REQUIRES: arm-registered-target,aarch64-registered-target + // RUN: %clang -target armv7-unknown-none-eabi -pg -S -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK -check-prefix CHECK-ARM-EABI // RUN: %clang -target armv7-unknown-none-eabi -pg -meabi gnu -S -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK -check-prefix CHECK-ARM-EABI-MEABI-GNU // RUN: %clang -target aarch64-unknown-none-eabi -pg -S -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK -check-prefix CHECK-ARM64-EABI Index: test/Frontend/gnu-mcount.c === --- test/Frontend/gnu-mcount.c +++ test/Frontend/gnu-mcount.c @@ -1,3 +1,5 @@ +// REQUIRES: arm-registered-target,aarch64-registered-target + // RUN: %clang -target armv7-unknown-none-eabi -pg -S -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK -check-prefix CHECK-ARM-EABI // RUN: %clang -target armv7-unknown-none-eabi -pg -meabi gnu -S -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK -check-prefix CHECK-ARM-EABI-MEABI-GNU // RUN: %clang -target aarch64-unknown-none-eabi -pg -S -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK -check-prefix CHECK-ARM64-EABI ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r284793 - Remove 24 instances of 'REQUIRES: shell'
On Thu, Oct 20, 2016 at 4:38 PM, Robinson, Paul wrote: > Is there any expectation that they _should_ (eventually) work on Windows? > Yes, LLVM is a cross-platform project, and there is an expectation that developers will attempt to write portable code. It seems like there is some dependence in these tests on the host compiler, the order of fields in a struct changes if the host compiler is MSVC. Also, I noticed I broke a bot. I reverted some changes, hopefully that's enough. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r284794 - Revert 9 changes from r284793, they still fail on some bots
Author: rnk Date: Thu Oct 20 18:30:39 2016 New Revision: 284794 URL: http://llvm.org/viewvc/llvm-project?rev=284794&view=rev Log: Revert 9 changes from r284793, they still fail on some bots Modified: cfe/trunk/test/Driver/rewrite-map-in-diagnostics.c cfe/trunk/test/OpenMP/task_firstprivate_codegen.cpp cfe/trunk/test/OpenMP/task_private_codegen.cpp cfe/trunk/test/OpenMP/taskloop_firstprivate_codegen.cpp cfe/trunk/test/OpenMP/taskloop_lastprivate_codegen.cpp cfe/trunk/test/OpenMP/taskloop_private_codegen.cpp cfe/trunk/test/OpenMP/taskloop_simd_firstprivate_codegen.cpp cfe/trunk/test/OpenMP/taskloop_simd_lastprivate_codegen.cpp cfe/trunk/test/OpenMP/taskloop_simd_private_codegen.cpp Modified: cfe/trunk/test/Driver/rewrite-map-in-diagnostics.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/rewrite-map-in-diagnostics.c?rev=284794&r1=284793&r2=284794&view=diff == --- cfe/trunk/test/Driver/rewrite-map-in-diagnostics.c (original) +++ cfe/trunk/test/Driver/rewrite-map-in-diagnostics.c Thu Oct 20 18:30:39 2016 @@ -9,3 +9,6 @@ // CHECK: note: diagnostic msg: {{.*}}rewrite.map // REQUIRES: crash-recovery + +// FIXME: This doesn't fail on "env clang". Investigating. +// REQUIRES: shell Modified: cfe/trunk/test/OpenMP/task_firstprivate_codegen.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/task_firstprivate_codegen.cpp?rev=284794&r1=284793&r2=284794&view=diff == --- cfe/trunk/test/OpenMP/task_firstprivate_codegen.cpp (original) +++ cfe/trunk/test/OpenMP/task_firstprivate_codegen.cpp Thu Oct 20 18:30:39 2016 @@ -7,7 +7,7 @@ // expected-no-diagnostics // REQUIRES: x86-registered-target // It doesn't pass on win32. -// XFAIL: win32 +// REQUIRES: shell #ifndef ARRAY #ifndef HEADER #define HEADER Modified: cfe/trunk/test/OpenMP/task_private_codegen.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/task_private_codegen.cpp?rev=284794&r1=284793&r2=284794&view=diff == --- cfe/trunk/test/OpenMP/task_private_codegen.cpp (original) +++ cfe/trunk/test/OpenMP/task_private_codegen.cpp Thu Oct 20 18:30:39 2016 @@ -7,7 +7,7 @@ // expected-no-diagnostics // REQUIRES: x86-registered-target // It doesn't pass on win32. Investigating. -// XFAIL: win32 +// REQUIRES: shell #ifndef ARRAY #ifndef HEADER Modified: cfe/trunk/test/OpenMP/taskloop_firstprivate_codegen.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/taskloop_firstprivate_codegen.cpp?rev=284794&r1=284793&r2=284794&view=diff == --- cfe/trunk/test/OpenMP/taskloop_firstprivate_codegen.cpp (original) +++ cfe/trunk/test/OpenMP/taskloop_firstprivate_codegen.cpp Thu Oct 20 18:30:39 2016 @@ -7,7 +7,7 @@ // expected-no-diagnostics // REQUIRES: x86-registered-target // It doesn't pass on win32. -// XFAIL: win32 +// REQUIRES: shell #ifndef ARRAY #ifndef HEADER #define HEADER Modified: cfe/trunk/test/OpenMP/taskloop_lastprivate_codegen.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/taskloop_lastprivate_codegen.cpp?rev=284794&r1=284793&r2=284794&view=diff == --- cfe/trunk/test/OpenMP/taskloop_lastprivate_codegen.cpp (original) +++ cfe/trunk/test/OpenMP/taskloop_lastprivate_codegen.cpp Thu Oct 20 18:30:39 2016 @@ -7,7 +7,7 @@ // expected-no-diagnostics // REQUIRES: x86-registered-target // It doesn't pass on win32. -// XFAIL: win32 +// REQUIRES: shell #ifndef ARRAY #ifndef HEADER #define HEADER Modified: cfe/trunk/test/OpenMP/taskloop_private_codegen.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/taskloop_private_codegen.cpp?rev=284794&r1=284793&r2=284794&view=diff == --- cfe/trunk/test/OpenMP/taskloop_private_codegen.cpp (original) +++ cfe/trunk/test/OpenMP/taskloop_private_codegen.cpp Thu Oct 20 18:30:39 2016 @@ -7,7 +7,7 @@ // expected-no-diagnostics // REQUIRES: x86-registered-target // It doesn't pass on win32. Investigating. -// XFAIL: win32 +// REQUIRES: shell #ifndef ARRAY #ifndef HEADER Modified: cfe/trunk/test/OpenMP/taskloop_simd_firstprivate_codegen.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/taskloop_simd_firstprivate_codegen.cpp?rev=284794&r1=284793&r2=284794&view=diff == --- cfe/trunk/test/OpenMP/taskloop_simd_firstprivate_codegen.cpp (original) +++ cfe/trunk/test/OpenMP/taskloop_simd_firstprivate_codegen.cpp Thu Oct 20 18:30:39 2016 @@ -7,7 +7,7 @@ // expected-no-diagnostics // REQUIRES: x86-registered-target // It doesn't pass on win
RE: r284793 - Remove 24 instances of 'REQUIRES: shell'
> -Original Message- > From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of > Reid Kleckner via cfe-commits > Sent: Thursday, October 20, 2016 4:12 PM > To: cfe-commits@lists.llvm.org > Subject: r284793 - Remove 24 instances of 'REQUIRES: shell' > > Author: rnk > Date: Thu Oct 20 18:11:45 2016 > New Revision: 284793 > > URL: http://llvm.org/viewvc/llvm-project?rev=284793&view=rev > Log: > Remove 24 instances of 'REQUIRES: shell' > > Tests fall into one of the following categories: > > - The requirement was unnecessary > > - Additional quoting was required for backslashes in paths (see "sed -e > 's/\\//g'") in the sanitizer tests. > > - OpenMP used 'REQUIRES: shell' as a proxy for the test failing on > Windows. Those tests fail there reliably, so use XFAIL instead. Is there any expectation that they _should_ (eventually) work on Windows? If not, seems like UNSUPPORTED would be clearer (and more efficient). --paulr > > I tried not to remove shell requirements that were added to suppress > flaky test failures, but if I screwed up, we can add it back as needed. > > Modified: > cfe/trunk/test/Analysis/plist-html-macros.c > cfe/trunk/test/CodeGen/address-safety-attr.cpp > cfe/trunk/test/CodeGen/asan-globals.cpp > cfe/trunk/test/CodeGen/sanitize-init-order.cpp > cfe/trunk/test/CodeGen/sanitize-thread-attr.cpp > cfe/trunk/test/CodeGen/ubsan-blacklist.c > cfe/trunk/test/Driver/fsanitize-blacklist.c > cfe/trunk/test/Driver/rewrite-map-in-diagnostics.c > cfe/trunk/test/Modules/ModuleDebugInfo.cpp > cfe/trunk/test/Modules/ModuleDebugInfo.m > cfe/trunk/test/Modules/dependency-dump-dependent-module.m > cfe/trunk/test/Modules/empty.modulemap > cfe/trunk/test/Modules/explicit-build-extra-files.cpp > cfe/trunk/test/Modules/prune.m > cfe/trunk/test/Modules/signal.m > cfe/trunk/test/OpenMP/task_firstprivate_codegen.cpp > cfe/trunk/test/OpenMP/task_private_codegen.cpp > cfe/trunk/test/OpenMP/taskloop_firstprivate_codegen.cpp > cfe/trunk/test/OpenMP/taskloop_lastprivate_codegen.cpp > cfe/trunk/test/OpenMP/taskloop_private_codegen.cpp > cfe/trunk/test/OpenMP/taskloop_simd_firstprivate_codegen.cpp > cfe/trunk/test/OpenMP/taskloop_simd_lastprivate_codegen.cpp > cfe/trunk/test/OpenMP/taskloop_simd_private_codegen.cpp > cfe/trunk/test/PCH/debug-info-pch-path.c > > Modified: cfe/trunk/test/Analysis/plist-html-macros.c > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/plist- > html-macros.c?rev=284793&r1=284792&r2=284793&view=diff > == > > --- cfe/trunk/test/Analysis/plist-html-macros.c (original) > +++ cfe/trunk/test/Analysis/plist-html-macros.c Thu Oct 20 18:11:45 2016 > @@ -1,12 +1,11 @@ > -// REQUIRES: shell > // RUN: %clang_cc1 -analyze -analyzer-checker=core -verify %s > // (sanity check) > > // RUN: rm -rf %t.dir > // RUN: mkdir -p %t.dir > // RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer- > output=plist-html -o %t.dir/index.plist %s > -// RUN: ls %t.dir | grep \\.html | count 1 > -// RUN: grep \\.html %t.dir/index.plist | count 1 > +// RUN: ls %t.dir | grep '\.html' | count 1 > +// RUN: grep '\.html' %t.dir/index.plist | count 1 > > // This tests two things: that the two calls to null_deref below are > coalesced > // into a single bug by both the plist and HTML diagnostics, and that the > plist > > Modified: cfe/trunk/test/CodeGen/address-safety-attr.cpp > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/address- > safety-attr.cpp?rev=284793&r1=284792&r2=284793&view=diff > == > > --- cfe/trunk/test/CodeGen/address-safety-attr.cpp (original) > +++ cfe/trunk/test/CodeGen/address-safety-attr.cpp Thu Oct 20 18:11:45 > 2016 > @@ -9,12 +9,11 @@ int DefinedInDifferentFile(int *a); > // RUN: echo "fun:*BlacklistedFunction*" > %t.func.blacklist > // RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin -emit-llvm -o - > %s -include %t.extra-source.cpp -fsanitize=address -fsanitize- > blacklist=%t.func.blacklist | FileCheck -check-prefix=BLFUNC %s > > -// RUN: echo "src:%s" > %t.file.blacklist > +// The blacklist file uses regexps, so escape backslashes, which are > common in > +// Windows paths. > +// RUN: echo "src:%s" | sed -e 's/\\//g' > %t.file.blacklist > // RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin -emit-llvm -o - > %s -include %t.extra-source.cpp -fsanitize=address -fsanitize- > blacklist=%t.file.blacklist | FileCheck -check-prefix=BLFILE %s > > -// FIXME: %t.file.blacklist is like > "src:x:\path\to\clang\test\CodeGen\address-safety-attr.cpp" > -// REQUIRES: shell > - > // The sanitize_address attribute should be attached to functions > // when AddressSanitizer is enabled, unless no_sanitize_address attribute > // is present. > > Modified: cfe/trunk/test
RE: r284777 - Fix off-by-one error in PPCaching.cpp token annotation assertion
Hi Reid, Just a heads up that the test you added fails if the compiler defaults to a different C++ standard. Our internal version defaults to c++11, and the test fails because the error "expected ';' after top level declarator" is not emitted. Douglas Yung > -Original Message- > From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf > Of Reid Kleckner via cfe-commits > Sent: Thursday, October 20, 2016 13:53 > To: cfe-commits@lists.llvm.org > Subject: r284777 - Fix off-by-one error in PPCaching.cpp token > annotation assertion > > Author: rnk > Date: Thu Oct 20 15:53:20 2016 > New Revision: 284777 > > URL: http://llvm.org/viewvc/llvm-project?rev=284777&view=rev > Log: > Fix off-by-one error in PPCaching.cpp token annotation assertion > > This assert is intended to defend against backtracking into the middle > of a sequence of tokens that is being replaced with an annotation, but > it's OK if we backtrack to the exact position of the start of the > annotation sequence. Use a <= comparison instead of <. > > Fixes PR25946 > > Added: > cfe/trunk/test/Parser/backtrack-off-by-one.cpp > Modified: > cfe/trunk/lib/Lex/PPCaching.cpp > > Modified: cfe/trunk/lib/Lex/PPCaching.cpp > URL: http://llvm.org/viewvc/llvm- > project/cfe/trunk/lib/Lex/PPCaching.cpp?rev=284777&r1=284776&r2=284777& > view=diff > === > === > --- cfe/trunk/lib/Lex/PPCaching.cpp (original) > +++ cfe/trunk/lib/Lex/PPCaching.cpp Thu Oct 20 15:53:20 2016 > @@ -105,7 +105,7 @@ void Preprocessor::AnnotatePreviousCache >for (CachedTokensTy::size_type i = CachedLexPos; i != 0; --i) { > CachedTokensTy::iterator AnnotBegin = CachedTokens.begin() + i-1; > if (AnnotBegin->getLocation() == Tok.getLocation()) { > - assert((BacktrackPositions.empty() || BacktrackPositions.back() > < i) && > + assert((BacktrackPositions.empty() || BacktrackPositions.back() > + <= i) && > "The backtrack pos points inside the annotated tokens!"); >// Replace the cached tokens with the single annotation token. >if (i < CachedLexPos) > > Added: cfe/trunk/test/Parser/backtrack-off-by-one.cpp > URL: http://llvm.org/viewvc/llvm- > project/cfe/trunk/test/Parser/backtrack-off-by- > one.cpp?rev=284777&view=auto > === > === > --- cfe/trunk/test/Parser/backtrack-off-by-one.cpp (added) > +++ cfe/trunk/test/Parser/backtrack-off-by-one.cpp Thu Oct 20 15:53:20 > +++ 2016 > @@ -0,0 +1,17 @@ > +// RUN: %clang_cc1 -verify %s > + > +// PR25946 > +// We had an off-by-one error in an assertion when annotating A > +below. Our // error recovery checks if A is a constructor > +declarator, and opens a // TentativeParsingAction. Then we attempt to > +annotate the token at the exact // position that we want to possibly > backtrack to, and this used to crash. > + > +template class A {}; > + > +// expected-error@+1 {{expected '{' after base class list}} template > + class B : T // not ',' or '{' > +// expected-error@+3 {{C++ requires a type specifier for all > +declarations}} // expected-error@+2 {{expected ';' after top level > +declarator}} // expected-error@+1 {{expected ';' after class}} A > { > +}; > > > ___ > 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
r284793 - Remove 24 instances of 'REQUIRES: shell'
Author: rnk Date: Thu Oct 20 18:11:45 2016 New Revision: 284793 URL: http://llvm.org/viewvc/llvm-project?rev=284793&view=rev Log: Remove 24 instances of 'REQUIRES: shell' Tests fall into one of the following categories: - The requirement was unnecessary - Additional quoting was required for backslashes in paths (see "sed -e 's/\\//g'") in the sanitizer tests. - OpenMP used 'REQUIRES: shell' as a proxy for the test failing on Windows. Those tests fail there reliably, so use XFAIL instead. I tried not to remove shell requirements that were added to suppress flaky test failures, but if I screwed up, we can add it back as needed. Modified: cfe/trunk/test/Analysis/plist-html-macros.c cfe/trunk/test/CodeGen/address-safety-attr.cpp cfe/trunk/test/CodeGen/asan-globals.cpp cfe/trunk/test/CodeGen/sanitize-init-order.cpp cfe/trunk/test/CodeGen/sanitize-thread-attr.cpp cfe/trunk/test/CodeGen/ubsan-blacklist.c cfe/trunk/test/Driver/fsanitize-blacklist.c cfe/trunk/test/Driver/rewrite-map-in-diagnostics.c cfe/trunk/test/Modules/ModuleDebugInfo.cpp cfe/trunk/test/Modules/ModuleDebugInfo.m cfe/trunk/test/Modules/dependency-dump-dependent-module.m cfe/trunk/test/Modules/empty.modulemap cfe/trunk/test/Modules/explicit-build-extra-files.cpp cfe/trunk/test/Modules/prune.m cfe/trunk/test/Modules/signal.m cfe/trunk/test/OpenMP/task_firstprivate_codegen.cpp cfe/trunk/test/OpenMP/task_private_codegen.cpp cfe/trunk/test/OpenMP/taskloop_firstprivate_codegen.cpp cfe/trunk/test/OpenMP/taskloop_lastprivate_codegen.cpp cfe/trunk/test/OpenMP/taskloop_private_codegen.cpp cfe/trunk/test/OpenMP/taskloop_simd_firstprivate_codegen.cpp cfe/trunk/test/OpenMP/taskloop_simd_lastprivate_codegen.cpp cfe/trunk/test/OpenMP/taskloop_simd_private_codegen.cpp cfe/trunk/test/PCH/debug-info-pch-path.c Modified: cfe/trunk/test/Analysis/plist-html-macros.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/plist-html-macros.c?rev=284793&r1=284792&r2=284793&view=diff == --- cfe/trunk/test/Analysis/plist-html-macros.c (original) +++ cfe/trunk/test/Analysis/plist-html-macros.c Thu Oct 20 18:11:45 2016 @@ -1,12 +1,11 @@ -// REQUIRES: shell // RUN: %clang_cc1 -analyze -analyzer-checker=core -verify %s // (sanity check) // RUN: rm -rf %t.dir // RUN: mkdir -p %t.dir // RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-output=plist-html -o %t.dir/index.plist %s -// RUN: ls %t.dir | grep \\.html | count 1 -// RUN: grep \\.html %t.dir/index.plist | count 1 +// RUN: ls %t.dir | grep '\.html' | count 1 +// RUN: grep '\.html' %t.dir/index.plist | count 1 // This tests two things: that the two calls to null_deref below are coalesced // into a single bug by both the plist and HTML diagnostics, and that the plist Modified: cfe/trunk/test/CodeGen/address-safety-attr.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/address-safety-attr.cpp?rev=284793&r1=284792&r2=284793&view=diff == --- cfe/trunk/test/CodeGen/address-safety-attr.cpp (original) +++ cfe/trunk/test/CodeGen/address-safety-attr.cpp Thu Oct 20 18:11:45 2016 @@ -9,12 +9,11 @@ int DefinedInDifferentFile(int *a); // RUN: echo "fun:*BlacklistedFunction*" > %t.func.blacklist // RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin -emit-llvm -o - %s -include %t.extra-source.cpp -fsanitize=address -fsanitize-blacklist=%t.func.blacklist | FileCheck -check-prefix=BLFUNC %s -// RUN: echo "src:%s" > %t.file.blacklist +// The blacklist file uses regexps, so escape backslashes, which are common in +// Windows paths. +// RUN: echo "src:%s" | sed -e 's/\\//g' > %t.file.blacklist // RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin -emit-llvm -o - %s -include %t.extra-source.cpp -fsanitize=address -fsanitize-blacklist=%t.file.blacklist | FileCheck -check-prefix=BLFILE %s -// FIXME: %t.file.blacklist is like "src:x:\path\to\clang\test\CodeGen\address-safety-attr.cpp" -// REQUIRES: shell - // The sanitize_address attribute should be attached to functions // when AddressSanitizer is enabled, unless no_sanitize_address attribute // is present. Modified: cfe/trunk/test/CodeGen/asan-globals.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/asan-globals.cpp?rev=284793&r1=284792&r2=284793&view=diff == --- cfe/trunk/test/CodeGen/asan-globals.cpp (original) +++ cfe/trunk/test/CodeGen/asan-globals.cpp Thu Oct 20 18:11:45 2016 @@ -1,9 +1,9 @@ // RUN: echo "int extra_global;" > %t.extra-source.cpp // RUN: echo "global:*blacklisted_global*" > %t.blacklist // RUN: %clang_cc1 -include %t.extra-source.cpp -fsanitize=address -fsanitize-blacklist=%t.blacklist -emit-llvm -o - %s | FileCheck %s -// RUN: echo "src:
Re: r284577 - [modules] Do not report missing definitions of demoted constexpr variable templates.
> On Oct 19, 2016, at 4:19 AM, Vassil Vassilev via cfe-commits > wrote: > > Author: vvassilev > Date: Wed Oct 19 06:19:30 2016 > New Revision: 284577 > > URL: http://llvm.org/viewvc/llvm-project?rev=284577&view=rev > Log: > [modules] Do not report missing definitions of demoted constexpr variable > templates. > > This is a followup to regression introduced in r284284. > > This should fix our libstdc++ modules builds. > > https://reviews.llvm.org/D25678 > > Reviewed by Richard Smith! > > Added: >cfe/trunk/test/Modules/Inputs/merge-var-template-def/a.h >cfe/trunk/test/Modules/Inputs/merge-var-template-def/b1.h >cfe/trunk/test/Modules/Inputs/merge-var-template-def/b2.h >cfe/trunk/test/Modules/Inputs/merge-var-template-def/module.modulemap >cfe/trunk/test/Modules/merge-var-template-def.cpp > Modified: >cfe/trunk/lib/Sema/SemaDecl.cpp > > Modified: cfe/trunk/lib/Sema/SemaDecl.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=284577&r1=284576&r2=284577&view=diff > == > --- cfe/trunk/lib/Sema/SemaDecl.cpp (original) > +++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Oct 19 06:19:30 2016 > @@ -10124,7 +10124,11 @@ void Sema::ActOnUninitializedDecl(Decl * > // C++11 [dcl.constexpr]p1: The constexpr specifier shall be applied only > to > // the definition of a variable [...] or the declaration of a static data > // member. > -if (Var->isConstexpr() && !Var->isThisDeclarationADefinition()) { > +if (Var->isConstexpr() && !Var->isThisDeclarationADefinition() && > +!Var->isThisDeclarationADemotedDefinition()) { > + assert((!Var->isThisDeclarationADemotedDefinition() || > + getLangOpts().Modules) && > + "Demoting decls is only in the contest of modules!”); Just noticed the mismatch between this commit and the last reviewed patch :] The assert is still here. Manman > if (Var->isStaticDataMember()) { > // C++1z removes the relevant rule; the in-class declaration is always > // a definition there. > > Added: cfe/trunk/test/Modules/Inputs/merge-var-template-def/a.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/merge-var-template-def/a.h?rev=284577&view=auto > == > --- cfe/trunk/test/Modules/Inputs/merge-var-template-def/a.h (added) > +++ cfe/trunk/test/Modules/Inputs/merge-var-template-def/a.h Wed Oct 19 > 06:19:30 2016 > @@ -0,0 +1,8 @@ > +#ifndef A_H > +#define A_H > +template > +struct S { static constexpr T value = v; }; > +template > +constexpr T S::value; > + > +#endif > > Added: cfe/trunk/test/Modules/Inputs/merge-var-template-def/b1.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/merge-var-template-def/b1.h?rev=284577&view=auto > == > --- cfe/trunk/test/Modules/Inputs/merge-var-template-def/b1.h (added) > +++ cfe/trunk/test/Modules/Inputs/merge-var-template-def/b1.h Wed Oct 19 > 06:19:30 2016 > @@ -0,0 +1,9 @@ > +#ifndef B1_H > +#define B1_H > +template > +struct S { static constexpr T value = v; }; > +template > +constexpr T S::value; > + > +#include "a.h" > +#endif > > Added: cfe/trunk/test/Modules/Inputs/merge-var-template-def/b2.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/merge-var-template-def/b2.h?rev=284577&view=auto > == > --- cfe/trunk/test/Modules/Inputs/merge-var-template-def/b2.h (added) > +++ cfe/trunk/test/Modules/Inputs/merge-var-template-def/b2.h Wed Oct 19 > 06:19:30 2016 > @@ -0,0 +1,9 @@ > +#ifndef B2_H > +#define B2_H > + > +template > +struct S { static constexpr T value = v; }; > +template > +constexpr T S::value; > + > +#endif > > Added: cfe/trunk/test/Modules/Inputs/merge-var-template-def/module.modulemap > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/merge-var-template-def/module.modulemap?rev=284577&view=auto > == > --- cfe/trunk/test/Modules/Inputs/merge-var-template-def/module.modulemap > (added) > +++ cfe/trunk/test/Modules/Inputs/merge-var-template-def/module.modulemap Wed > Oct 19 06:19:30 2016 > @@ -0,0 +1,5 @@ > +module a { header "a.h" export * } > +module b { > + module b1 { header "b1.h" export * } > + module b2 { header "b2.h" export * } > +} > > Added: cfe/trunk/test/Modules/merge-var-template-def.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/merge-var-template-def.cpp?rev=284577&view=auto > == > --- cfe/trunk/test/Modules/merge-var-template-def.cpp (added) > +++ cfe/trunk/test/Modules/merge-var-template-def.cpp Wed Oct 19 06:19:
r284785 - Re-commit r284753, reverted in r284778, with a fix for PR30749.
Author: rsmith Date: Thu Oct 20 16:53:09 2016 New Revision: 284785 URL: http://llvm.org/viewvc/llvm-project?rev=284785&view=rev Log: Re-commit r284753, reverted in r284778, with a fix for PR30749. Original commit message: [c++1z] Teach composite pointer type computation how to compute the composite pointer type of two function pointers with different noexcept specifications. While I'm here, also teach it how to merge dynamic exception specifications. Added: cfe/trunk/test/CXX/expr/p13.cpp - copied, changed from r284777, cfe/trunk/test/CXX/expr/p13.cpp Modified: cfe/trunk/include/clang/Sema/Overload.h cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/lib/Sema/SemaExprCXX.cpp cfe/trunk/lib/Sema/SemaOverload.cpp Modified: cfe/trunk/include/clang/Sema/Overload.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Overload.h?rev=284785&r1=284784&r2=284785&view=diff == --- cfe/trunk/include/clang/Sema/Overload.h (original) +++ cfe/trunk/include/clang/Sema/Overload.h Thu Oct 20 16:53:09 2016 @@ -145,7 +145,8 @@ namespace clang { /// pointer-to-member conversion, or boolean conversion. ImplicitConversionKind Second : 8; -/// Third - The third conversion can be a qualification conversion. +/// Third - The third conversion can be a qualification conversion +/// or a function conversion. ImplicitConversionKind Third : 8; /// \brief Whether this is the deprecated conversion of a Modified: cfe/trunk/include/clang/Sema/Sema.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=284785&r1=284784&r2=284785&view=diff == --- cfe/trunk/include/clang/Sema/Sema.h (original) +++ cfe/trunk/include/clang/Sema/Sema.h Thu Oct 20 16:53:09 2016 @@ -8954,13 +8954,15 @@ public: ExprResult &cond, ExprResult &lhs, ExprResult &rhs, ExprValueKind &VK, ExprObjectKind &OK, SourceLocation questionLoc); QualType FindCompositePointerType(SourceLocation Loc, Expr *&E1, Expr *&E2, -bool *NonStandardCompositeType = nullptr); +bool *NonStandardCompositeType = nullptr, +bool ConvertArgs = true); QualType FindCompositePointerType(SourceLocation Loc, ExprResult &E1, ExprResult &E2, -bool *NonStandardCompositeType = nullptr) { +bool *NonStandardCompositeType = nullptr, +bool ConvertArgs = true) { Expr *E1Tmp = E1.get(), *E2Tmp = E2.get(); -QualType Composite = FindCompositePointerType(Loc, E1Tmp, E2Tmp, - NonStandardCompositeType); +QualType Composite = FindCompositePointerType( +Loc, E1Tmp, E2Tmp, NonStandardCompositeType, ConvertArgs); E1 = E1Tmp; E2 = E2Tmp; return Composite; Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=284785&r1=284784&r2=284785&view=diff == --- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original) +++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Thu Oct 20 16:53:09 2016 @@ -3610,16 +3610,6 @@ Sema::PerformImplicitConversion(Expr *Fr // Nothing else to do. break; - case ICK_Function_Conversion: -// If both sides are functions (or pointers/references to them), there could -// be incompatible exception declarations. -if (CheckExceptionSpecCompatibility(From, ToType)) - return ExprError(); - -From = ImpCastExprToType(From, ToType, CK_NoOp, - VK_RValue, /*BasePath=*/nullptr, CCK).get(); -break; - case ICK_Integral_Promotion: case ICK_Integral_Conversion: if (ToType->isBooleanType()) { @@ -3866,6 +3856,7 @@ Sema::PerformImplicitConversion(Expr *Fr case ICK_Lvalue_To_Rvalue: case ICK_Array_To_Pointer: case ICK_Function_To_Pointer: + case ICK_Function_Conversion: case ICK_Qualification: case ICK_Num_Conversion_Kinds: case ICK_C_Only_Conversion: @@ -3878,6 +3869,16 @@ Sema::PerformImplicitConversion(Expr *Fr // Nothing to do. break; + case ICK_Function_Conversion: +// If both sides are functions (or pointers/references to them), there could +// be incompatible exception declarations. +if (CheckExceptionSpecCompatibility(From, ToType)) + return ExprError(); + +From = ImpCastExprToType(From, ToType, CK_NoOp, + VK_RValue, /*BasePath=*/nullptr, CCK).get(); +break; + case ICK_Qualification: { // The qualification keeps the category of the inner expression, unless the // target type isn't a reference. @@ -5393,6 +5394,20 @@ Qual
[PATCH] D24954: [Driver] Disable OpenSUSE rules for OpenSUSE/SLES 10 and older
mgorny marked 3 inline comments as done. mgorny added a comment. I think I've addressed all your concerns now. https://reviews.llvm.org/D24954 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25731: [analyzer] NumberObjectConversion: Support OSNumber and CFNumberRef.
zaks.anna added inline comments. Comment at: lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp:111 + QualType ObjT = (IsCpp || IsObjC) + ? Obj->getType().getCanonicalType().getUnqualifiedType() + : Obj->getType(); NoQ wrote: > zaks.anna wrote: > > Why do we need a case split here? Would calling > > getCanonicalType().getUnqualifiedType() result in a wrong result for ObjC? > It'd result in a wrong result for `CFNumberRef`, which is a typedef we > shouldn't remove (turning this into `struct __CFNumber *` would be ugly). > > I'd probably rather avoid the case split by removing the > `.getCanonicalType()` part, because rarely anybody makes typedefs for > `NSNumber*` or `OSBoolean*` etc (such as in tests with the word "sugared"). > > Or i could descend down to the necessary typedef for C objects, discarding > all user's typedefs but not library typedefs. But that'd be even more > complicated and probably not very useful for such minor matter. > It'd result in a wrong result for CFNumberRef, which is a typedef we > shouldn't > remove (turning this into struct __CFNumber * would be ugly). I see. Displaying "CFNumberRef" is definitely the right thing to do! Please, add a comment to explain this. https://reviews.llvm.org/D25731 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24954: [Driver] Disable OpenSUSE rules for OpenSUSE/SLES 10 and older
mgorny retitled this revision from "[ToolChains] Disable OpenSUSE rules for SLES10" to "[Driver] Disable OpenSUSE rules for OpenSUSE/SLES 10 and older". mgorny updated the summary for this revision. mgorny updated this revision to Diff 75357. https://reviews.llvm.org/D24954 Files: lib/Driver/ToolChains.cpp Index: lib/Driver/ToolChains.cpp === --- lib/Driver/ToolChains.cpp +++ lib/Driver/ToolChains.cpp @@ -3931,8 +3931,26 @@ .Default(UnknownDistro); } - if (VFS.exists("/etc/SuSE-release")) -return OpenSUSE; + File = VFS.getBufferForFile("/etc/SuSE-release"); + if (File) { +StringRef Data = File.get()->getBuffer(); +SmallVector Lines; +Data.split(Lines, "\n"); +for (const StringRef& Line : Lines) { + std::pair SplitLine = Line.split('='); + int Version; + if (SplitLine.first.trim() == "VERSION" && + !SplitLine.second.trim().getAsInteger(10, Version)) { +// OpenSUSE/SLES 10 and older are not supported and not compatible +// with our rules, so just treat them as UnknownDistro. +if (Version > 10) + return OpenSUSE; +else + return UnknownDistro; + } +} +return UnknownDistro; + } if (VFS.exists("/etc/exherbo-release")) return Exherbo; Index: lib/Driver/ToolChains.cpp === --- lib/Driver/ToolChains.cpp +++ lib/Driver/ToolChains.cpp @@ -3931,8 +3931,26 @@ .Default(UnknownDistro); } - if (VFS.exists("/etc/SuSE-release")) -return OpenSUSE; + File = VFS.getBufferForFile("/etc/SuSE-release"); + if (File) { +StringRef Data = File.get()->getBuffer(); +SmallVector Lines; +Data.split(Lines, "\n"); +for (const StringRef& Line : Lines) { + std::pair SplitLine = Line.split('='); + int Version; + if (SplitLine.first.trim() == "VERSION" && + !SplitLine.second.trim().getAsInteger(10, Version)) { +// OpenSUSE/SLES 10 and older are not supported and not compatible +// with our rules, so just treat them as UnknownDistro. +if (Version > 10) + return OpenSUSE; +else + return UnknownDistro; + } +} +return UnknownDistro; + } if (VFS.exists("/etc/exherbo-release")) return Exherbo; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D22712: Remove FileEntry copy-constructor
This revision was automatically updated to reflect the committed changes. Closed by commit rL284782: [clang] Remove FileEntry copy-constructor (authored by alexshap). Changed prior to commit: https://reviews.llvm.org/D22712?vs=65187&id=75356#toc Repository: rL LLVM https://reviews.llvm.org/D22712 Files: cfe/trunk/include/clang/Basic/FileManager.h Index: cfe/trunk/include/clang/Basic/FileManager.h === --- cfe/trunk/include/clang/Basic/FileManager.h +++ cfe/trunk/include/clang/Basic/FileManager.h @@ -65,22 +65,14 @@ mutable std::unique_ptr File; friend class FileManager; + FileEntry(const FileEntry &) = delete; void operator=(const FileEntry &) = delete; public: FileEntry() : UniqueID(0, 0), IsNamedPipe(false), InPCH(false), IsValid(false) {} - // FIXME: this is here to allow putting FileEntry in std::map. Once we have - // emplace, we shouldn't need a copy constructor anymore. - /// Intentionally does not copy fields that are not set in an uninitialized - /// \c FileEntry. - FileEntry(const FileEntry &FE) : UniqueID(FE.UniqueID), - IsNamedPipe(FE.IsNamedPipe), InPCH(FE.InPCH), IsValid(FE.IsValid) { -assert(!isValid() && "Cannot copy an initialized FileEntry"); - } - StringRef getName() const { return Name; } StringRef tryGetRealPathName() const { return RealPathName; } bool isValid() const { return IsValid; } Index: cfe/trunk/include/clang/Basic/FileManager.h === --- cfe/trunk/include/clang/Basic/FileManager.h +++ cfe/trunk/include/clang/Basic/FileManager.h @@ -65,22 +65,14 @@ mutable std::unique_ptr File; friend class FileManager; + FileEntry(const FileEntry &) = delete; void operator=(const FileEntry &) = delete; public: FileEntry() : UniqueID(0, 0), IsNamedPipe(false), InPCH(false), IsValid(false) {} - // FIXME: this is here to allow putting FileEntry in std::map. Once we have - // emplace, we shouldn't need a copy constructor anymore. - /// Intentionally does not copy fields that are not set in an uninitialized - /// \c FileEntry. - FileEntry(const FileEntry &FE) : UniqueID(FE.UniqueID), - IsNamedPipe(FE.IsNamedPipe), InPCH(FE.InPCH), IsValid(FE.IsValid) { -assert(!isValid() && "Cannot copy an initialized FileEntry"); - } - StringRef getName() const { return Name; } StringRef tryGetRealPathName() const { return RealPathName; } bool isValid() const { return IsValid; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r284782 - [clang] Remove FileEntry copy-constructor
Author: alexshap Date: Thu Oct 20 16:20:35 2016 New Revision: 284782 URL: http://llvm.org/viewvc/llvm-project?rev=284782&view=rev Log: [clang] Remove FileEntry copy-constructor Code cleanup: address FIXME in the file include/clang/Basic/FileManager.h and remove copy-constructor of the class FileEntry. Test plan: make check-clang Differential revision: https://reviews.llvm.org/D22712 Modified: cfe/trunk/include/clang/Basic/FileManager.h Modified: cfe/trunk/include/clang/Basic/FileManager.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/FileManager.h?rev=284782&r1=284781&r2=284782&view=diff == --- cfe/trunk/include/clang/Basic/FileManager.h (original) +++ cfe/trunk/include/clang/Basic/FileManager.h Thu Oct 20 16:20:35 2016 @@ -65,6 +65,7 @@ class FileEntry { mutable std::unique_ptr File; friend class FileManager; + FileEntry(const FileEntry &) = delete; void operator=(const FileEntry &) = delete; public: @@ -72,15 +73,6 @@ public: : UniqueID(0, 0), IsNamedPipe(false), InPCH(false), IsValid(false) {} - // FIXME: this is here to allow putting FileEntry in std::map. Once we have - // emplace, we shouldn't need a copy constructor anymore. - /// Intentionally does not copy fields that are not set in an uninitialized - /// \c FileEntry. - FileEntry(const FileEntry &FE) : UniqueID(FE.UniqueID), - IsNamedPipe(FE.IsNamedPipe), InPCH(FE.InPCH), IsValid(FE.IsValid) { -assert(!isValid() && "Cannot copy an initialized FileEntry"); - } - StringRef getName() const { return Name; } StringRef tryGetRealPathName() const { return RealPathName; } bool isValid() const { return IsValid; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r284781 - Revert "Disable swiftcall test on windows: More brutal way to appease windows bots"
Author: rnk Date: Thu Oct 20 16:17:28 2016 New Revision: 284781 URL: http://llvm.org/viewvc/llvm-project?rev=284781&view=rev Log: Revert "Disable swiftcall test on windows: More brutal way to appease windows bots" This reverts commit r284174. The tests pass for me locally. It must have been a 2015 only crash. Fixes PR30699 Modified: cfe/trunk/test/CodeGen/64bit-swiftcall.c Modified: cfe/trunk/test/CodeGen/64bit-swiftcall.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/64bit-swiftcall.c?rev=284781&r1=284780&r2=284781&view=diff == --- cfe/trunk/test/CodeGen/64bit-swiftcall.c (original) +++ cfe/trunk/test/CodeGen/64bit-swiftcall.c Thu Oct 20 16:17:28 2016 @@ -3,9 +3,6 @@ // REQUIRES: aarch64-registered-target,x86-registered-target -// The union_het_vecint test case crashes on windows bot but only in stage1 and not in stage2. -// UNSUPPORTED: system-windows - #define SWIFTCALL __attribute__((swiftcall)) #define OUT __attribute__((swift_indirect_result)) #define ERROR __attribute__((swift_error_result)) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r284753 - [c++1z] Teach composite pointer type computation how to compute the composite
On Thu, Oct 20, 2016 at 10:57 AM, Richard Smith via cfe-commits wrote: > Author: rsmith > Date: Thu Oct 20 12:57:33 2016 > New Revision: 284753 > > URL: http://llvm.org/viewvc/llvm-project?rev=284753&view=rev > Log: > [c++1z] Teach composite pointer type computation how to compute the composite > pointer type of two function pointers with different noexcept specifications. > While I'm here, also teach it how to merge dynamic exception specifications. This caused asserts to fire when building Chromium. I've filed PR30749 with a repro, and reverted in r284778. Thanks, Hans ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25153: preprocessor supports `-dI` flag
elsteveogrande updated this revision to Diff 75351. elsteveogrande added a comment. Fixed an error. A newline is sometimes not appended prior to this `#include`. When returning from an included file which doesn't have a trailing newline, the #include is stuck at the end of some other line, i.e. the include's own `#` isn't the first character in the line. Added a new line if needed like the other code just above it. I copied+pasted the `moveTo` as well. https://reviews.llvm.org/D25153 Files: include/clang/Driver/Options.td include/clang/Frontend/PreprocessorOutputOptions.h lib/Frontend/CompilerInvocation.cpp lib/Frontend/PrintPreprocessedOutput.cpp test/Preprocessor/dump_import.h test/Preprocessor/dump_import.m test/Preprocessor/dump_include.c test/Preprocessor/dump_include.h Index: test/Preprocessor/dump_include.h === --- /dev/null +++ test/Preprocessor/dump_include.h @@ -0,0 +1,2 @@ +#pragma once +#define DUMP_INCLUDE_TESTVAL 1 Index: test/Preprocessor/dump_include.c === --- /dev/null +++ test/Preprocessor/dump_include.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -w -E -dI -isystem %S -imacros %S/dump_include.h %s -o - | FileCheck %s +// CHECK: {{^}}#__include_macros "/{{([^/]+/)+}}dump_ +// CHECK: {{^}}#include +#include "dump_include.h" +#include_next "dump_include.h" Index: test/Preprocessor/dump_import.m === --- /dev/null +++ test/Preprocessor/dump_import.m @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -E -dI %s -o - | FileCheck %s +// CHECK: {{^}}#import "dump_ + +// See also `dump_include.c` which tests other inclusion cases with `-dI`. + +#import "dump_import.h" Index: test/Preprocessor/dump_import.h === --- /dev/null +++ test/Preprocessor/dump_import.h @@ -0,0 +1 @@ +#define DUMP_IMPORT_TESTVAL 1 Index: lib/Frontend/PrintPreprocessedOutput.cpp === --- lib/Frontend/PrintPreprocessedOutput.cpp +++ lib/Frontend/PrintPreprocessedOutput.cpp @@ -93,13 +93,16 @@ bool Initialized; bool DisableLineMarkers; bool DumpDefines; + bool DumpIncludeDirectives; bool UseLineDirectives; bool IsFirstFileEntered; public: PrintPPOutputPPCallbacks(Preprocessor &pp, raw_ostream &os, bool lineMarkers, - bool defines, bool UseLineDirectives) + bool defines, bool DumpIncludeDirectives, + bool UseLineDirectives) : PP(pp), SM(PP.getSourceManager()), ConcatInfo(PP), OS(os), DisableLineMarkers(lineMarkers), DumpDefines(defines), +DumpIncludeDirectives(DumpIncludeDirectives), UseLineDirectives(UseLineDirectives) { CurLine = 0; CurFilename += ""; @@ -320,20 +323,20 @@ StringRef SearchPath, StringRef RelativePath, const Module *Imported) { - // When preprocessing, turn implicit imports into @imports. - // FIXME: This is a stop-gap until a more comprehensive "preprocessing with - // modules" solution is introduced. if (Imported) { +// When preprocessing, turn implicit imports into @imports. +// FIXME: This is a stop-gap until a more comprehensive "preprocessing with +// modules" solution is introduced. startNewLineIfNeeded(); MoveToLine(HashLoc); if (PP.getLangOpts().ObjC2) { OS << "@import " << Imported->getFullModuleName() << ";" << " /* clang -E: implicit import for \"" << File->getName() << "\" */"; } else { - // FIXME: Preseve whether this was a - // #include/#include_next/#include_macros/#import. - OS << "#include " + const std::string TokenText = PP.getSpelling(IncludeTok); + assert(!TokenText.empty()); + OS << "#" << TokenText << " " << (IsAngled ? '<' : '"') << FileName << (IsAngled ? '>' : '"') @@ -344,6 +347,20 @@ // line immediately. EmittedTokensOnThisLine = true; startNewLineIfNeeded(); + } else { +// Not a module import; it's a more vanilla inclusion of some file using one +// of: #include, #import, #include_next, #include_macros. +if (DumpIncludeDirectives) { + startNewLineIfNeeded(); + MoveToLine(HashLoc); + const std::string TokenText = PP.getSpelling(IncludeTok); + assert(!TokenText.empty()); + OS << "#" << TokenText << " " + << (IsAngled ? '<' : '"') << FileName << (IsAngled ? '>' : '"') + << " /* clang -E -dI */"; + setEmittedDirectiveOnThisLine(); + startNewLineIfNeeded(); +} } } @@ -751,7 +768,8 @@ PP.SetCommentRetentionState(Opts.ShowComments, Opts.ShowMacroComments); PrintPP
r284778 - Revert r284753 "[c++1z] Teach composite pointer type computation how to compute the composite"
Author: hans Date: Thu Oct 20 15:54:32 2016 New Revision: 284778 URL: http://llvm.org/viewvc/llvm-project?rev=284778&view=rev Log: Revert r284753 "[c++1z] Teach composite pointer type computation how to compute the composite" It caused PR30749. Removed: cfe/trunk/test/CXX/expr/p13.cpp Modified: cfe/trunk/include/clang/Sema/Overload.h cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/lib/Sema/SemaExprCXX.cpp cfe/trunk/lib/Sema/SemaOverload.cpp Modified: cfe/trunk/include/clang/Sema/Overload.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Overload.h?rev=284778&r1=284777&r2=284778&view=diff == --- cfe/trunk/include/clang/Sema/Overload.h (original) +++ cfe/trunk/include/clang/Sema/Overload.h Thu Oct 20 15:54:32 2016 @@ -145,8 +145,7 @@ namespace clang { /// pointer-to-member conversion, or boolean conversion. ImplicitConversionKind Second : 8; -/// Third - The third conversion can be a qualification conversion -/// or a function conversion. +/// Third - The third conversion can be a qualification conversion. ImplicitConversionKind Third : 8; /// \brief Whether this is the deprecated conversion of a Modified: cfe/trunk/include/clang/Sema/Sema.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=284778&r1=284777&r2=284778&view=diff == --- cfe/trunk/include/clang/Sema/Sema.h (original) +++ cfe/trunk/include/clang/Sema/Sema.h Thu Oct 20 15:54:32 2016 @@ -8954,15 +8954,13 @@ public: ExprResult &cond, ExprResult &lhs, ExprResult &rhs, ExprValueKind &VK, ExprObjectKind &OK, SourceLocation questionLoc); QualType FindCompositePointerType(SourceLocation Loc, Expr *&E1, Expr *&E2, -bool *NonStandardCompositeType = nullptr, -bool ConvertArgs = true); +bool *NonStandardCompositeType = nullptr); QualType FindCompositePointerType(SourceLocation Loc, ExprResult &E1, ExprResult &E2, -bool *NonStandardCompositeType = nullptr, -bool ConvertArgs = true) { +bool *NonStandardCompositeType = nullptr) { Expr *E1Tmp = E1.get(), *E2Tmp = E2.get(); -QualType Composite = FindCompositePointerType( -Loc, E1Tmp, E2Tmp, NonStandardCompositeType, ConvertArgs); +QualType Composite = FindCompositePointerType(Loc, E1Tmp, E2Tmp, + NonStandardCompositeType); E1 = E1Tmp; E2 = E2Tmp; return Composite; Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=284778&r1=284777&r2=284778&view=diff == --- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original) +++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Thu Oct 20 15:54:32 2016 @@ -3610,6 +3610,16 @@ Sema::PerformImplicitConversion(Expr *Fr // Nothing else to do. break; + case ICK_Function_Conversion: +// If both sides are functions (or pointers/references to them), there could +// be incompatible exception declarations. +if (CheckExceptionSpecCompatibility(From, ToType)) + return ExprError(); + +From = ImpCastExprToType(From, ToType, CK_NoOp, + VK_RValue, /*BasePath=*/nullptr, CCK).get(); +break; + case ICK_Integral_Promotion: case ICK_Integral_Conversion: if (ToType->isBooleanType()) { @@ -3856,7 +3866,6 @@ Sema::PerformImplicitConversion(Expr *Fr case ICK_Lvalue_To_Rvalue: case ICK_Array_To_Pointer: case ICK_Function_To_Pointer: - case ICK_Function_Conversion: case ICK_Qualification: case ICK_Num_Conversion_Kinds: case ICK_C_Only_Conversion: @@ -3869,16 +3878,6 @@ Sema::PerformImplicitConversion(Expr *Fr // Nothing to do. break; - case ICK_Function_Conversion: -// If both sides are functions (or pointers/references to them), there could -// be incompatible exception declarations. -if (CheckExceptionSpecCompatibility(From, ToType)) - return ExprError(); - -From = ImpCastExprToType(From, ToType, CK_NoOp, - VK_RValue, /*BasePath=*/nullptr, CCK).get(); -break; - case ICK_Qualification: { // The qualification keeps the category of the inner expression, unless the // target type isn't a reference. @@ -5394,17 +5393,6 @@ QualType Sema::CXXCheckConditionalOperan if (LHS.get()->getObjectKind() == OK_BitField || RHS.get()->getObjectKind() == OK_BitField) OK = OK_BitField; - -// If we have function pointer types, unify them anyway to unify their -// exception specifications
r284777 - Fix off-by-one error in PPCaching.cpp token annotation assertion
Author: rnk Date: Thu Oct 20 15:53:20 2016 New Revision: 284777 URL: http://llvm.org/viewvc/llvm-project?rev=284777&view=rev Log: Fix off-by-one error in PPCaching.cpp token annotation assertion This assert is intended to defend against backtracking into the middle of a sequence of tokens that is being replaced with an annotation, but it's OK if we backtrack to the exact position of the start of the annotation sequence. Use a <= comparison instead of <. Fixes PR25946 Added: cfe/trunk/test/Parser/backtrack-off-by-one.cpp Modified: cfe/trunk/lib/Lex/PPCaching.cpp Modified: cfe/trunk/lib/Lex/PPCaching.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPCaching.cpp?rev=284777&r1=284776&r2=284777&view=diff == --- cfe/trunk/lib/Lex/PPCaching.cpp (original) +++ cfe/trunk/lib/Lex/PPCaching.cpp Thu Oct 20 15:53:20 2016 @@ -105,7 +105,7 @@ void Preprocessor::AnnotatePreviousCache for (CachedTokensTy::size_type i = CachedLexPos; i != 0; --i) { CachedTokensTy::iterator AnnotBegin = CachedTokens.begin() + i-1; if (AnnotBegin->getLocation() == Tok.getLocation()) { - assert((BacktrackPositions.empty() || BacktrackPositions.back() < i) && + assert((BacktrackPositions.empty() || BacktrackPositions.back() <= i) && "The backtrack pos points inside the annotated tokens!"); // Replace the cached tokens with the single annotation token. if (i < CachedLexPos) Added: cfe/trunk/test/Parser/backtrack-off-by-one.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/backtrack-off-by-one.cpp?rev=284777&view=auto == --- cfe/trunk/test/Parser/backtrack-off-by-one.cpp (added) +++ cfe/trunk/test/Parser/backtrack-off-by-one.cpp Thu Oct 20 15:53:20 2016 @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -verify %s + +// PR25946 +// We had an off-by-one error in an assertion when annotating A below. Our +// error recovery checks if A is a constructor declarator, and opens a +// TentativeParsingAction. Then we attempt to annotate the token at the exact +// position that we want to possibly backtrack to, and this used to crash. + +template class A {}; + +// expected-error@+1 {{expected '{' after base class list}} +template class B : T // not ',' or '{' +// expected-error@+3 {{C++ requires a type specifier for all declarations}} +// expected-error@+2 {{expected ';' after top level declarator}} +// expected-error@+1 {{expected ';' after class}} +A { +}; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25258: [coroutines] Create allocation and deallocation sub-statements.
GorNishanov abandoned this revision. GorNishanov added a comment. I'll simplify and split it into super tiny microscopic patches to have a better chance of being reviewed. https://reviews.llvm.org/D25258 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25819: [Driver] Refactor DetectDistro() parameters to take VFS ref only. NFC
This revision was automatically updated to reflect the committed changes. Closed by commit rL284774: [Driver] Refactor DetectDistro() parameters to take VFS ref only. NFC (authored by mgorny). Changed prior to commit: https://reviews.llvm.org/D25819?vs=75283&id=75350#toc Repository: rL LLVM https://reviews.llvm.org/D25819 Files: cfe/trunk/lib/Driver/ToolChains.cpp Index: cfe/trunk/lib/Driver/ToolChains.cpp === --- cfe/trunk/lib/Driver/ToolChains.cpp +++ cfe/trunk/lib/Driver/ToolChains.cpp @@ -3850,9 +3850,9 @@ return Distro >= UbuntuHardy && Distro <= UbuntuYakkety; } -static Distro DetectDistro(const Driver &D, llvm::Triple::ArchType Arch) { +static Distro DetectDistro(vfs::FileSystem &VFS) { llvm::ErrorOr> File = - D.getVFS().getBufferForFile("/etc/lsb-release"); + VFS.getBufferForFile("/etc/lsb-release"); if (File) { StringRef Data = File.get()->getBuffer(); SmallVector Lines; @@ -3884,7 +3884,7 @@ return Version; } - File = D.getVFS().getBufferForFile("/etc/redhat-release"); + File = VFS.getBufferForFile("/etc/redhat-release"); if (File) { StringRef Data = File.get()->getBuffer(); if (Data.startswith("Fedora release")) @@ -3902,7 +3902,7 @@ return UnknownDistro; } - File = D.getVFS().getBufferForFile("/etc/debian_version"); + File = VFS.getBufferForFile("/etc/debian_version"); if (File) { StringRef Data = File.get()->getBuffer(); // Contents: < major.minor > or < codename/sid > @@ -3931,13 +3931,13 @@ .Default(UnknownDistro); } - if (D.getVFS().exists("/etc/SuSE-release")) + if (VFS.exists("/etc/SuSE-release")) return OpenSUSE; - if (D.getVFS().exists("/etc/exherbo-release")) + if (VFS.exists("/etc/exherbo-release")) return Exherbo; - if (D.getVFS().exists("/etc/arch-release")) + if (VFS.exists("/etc/arch-release")) return ArchLinux; return UnknownDistro; @@ -4122,7 +4122,7 @@ GCCInstallation.getTriple().str() + "/bin") .str()); - Distro Distro = DetectDistro(D, Arch); + Distro Distro = DetectDistro(D.getVFS()); if (IsOpenSUSE(Distro) || IsUbuntu(Distro)) { ExtraOpts.push_back("-z"); @@ -4326,7 +4326,7 @@ const llvm::Triple::ArchType Arch = getArch(); const llvm::Triple &Triple = getTriple(); - const enum Distro Distro = DetectDistro(getDriver(), Arch); + const enum Distro Distro = DetectDistro(getDriver().getVFS()); if (Triple.isAndroid()) return Triple.isArch64Bit() ? "/system/bin/linker64" : "/system/bin/linker"; Index: cfe/trunk/lib/Driver/ToolChains.cpp === --- cfe/trunk/lib/Driver/ToolChains.cpp +++ cfe/trunk/lib/Driver/ToolChains.cpp @@ -3850,9 +3850,9 @@ return Distro >= UbuntuHardy && Distro <= UbuntuYakkety; } -static Distro DetectDistro(const Driver &D, llvm::Triple::ArchType Arch) { +static Distro DetectDistro(vfs::FileSystem &VFS) { llvm::ErrorOr> File = - D.getVFS().getBufferForFile("/etc/lsb-release"); + VFS.getBufferForFile("/etc/lsb-release"); if (File) { StringRef Data = File.get()->getBuffer(); SmallVector Lines; @@ -3884,7 +3884,7 @@ return Version; } - File = D.getVFS().getBufferForFile("/etc/redhat-release"); + File = VFS.getBufferForFile("/etc/redhat-release"); if (File) { StringRef Data = File.get()->getBuffer(); if (Data.startswith("Fedora release")) @@ -3902,7 +3902,7 @@ return UnknownDistro; } - File = D.getVFS().getBufferForFile("/etc/debian_version"); + File = VFS.getBufferForFile("/etc/debian_version"); if (File) { StringRef Data = File.get()->getBuffer(); // Contents: < major.minor > or < codename/sid > @@ -3931,13 +3931,13 @@ .Default(UnknownDistro); } - if (D.getVFS().exists("/etc/SuSE-release")) + if (VFS.exists("/etc/SuSE-release")) return OpenSUSE; - if (D.getVFS().exists("/etc/exherbo-release")) + if (VFS.exists("/etc/exherbo-release")) return Exherbo; - if (D.getVFS().exists("/etc/arch-release")) + if (VFS.exists("/etc/arch-release")) return ArchLinux; return UnknownDistro; @@ -4122,7 +4122,7 @@ GCCInstallation.getTriple().str() + "/bin") .str()); - Distro Distro = DetectDistro(D, Arch); + Distro Distro = DetectDistro(D.getVFS()); if (IsOpenSUSE(Distro) || IsUbuntu(Distro)) { ExtraOpts.push_back("-z"); @@ -4326,7 +4326,7 @@ const llvm::Triple::ArchType Arch = getArch(); const llvm::Triple &Triple = getTriple(); - const enum Distro Distro = DetectDistro(getDriver(), Arch); + const enum Distro Distro = DetectDistro(getDriver().getVFS()); if (Triple.isAndroid()) return Triple.isArch64Bit() ? "/system/bin/linker64" : "/system/bin/linker"; ___ cfe-commits mailing list c
r284774 - [Driver] Refactor DetectDistro() parameters to take VFS ref only. NFC
Author: mgorny Date: Thu Oct 20 15:45:40 2016 New Revision: 284774 URL: http://llvm.org/viewvc/llvm-project?rev=284774&view=rev Log: [Driver] Refactor DetectDistro() parameters to take VFS ref only. NFC Refactor the DetectDistro() function to take a single vfs::FileSystem reference only, instead of Driver and llvm::Triple::ArchType. The ArchType parameter was not used anyway, and Driver was only used to obtain the VFS. Aside to making the API simpler and more transparent, it makes it easier to add unit tests for the function in the future -- since the tests would need only to provide an appropriate VFS. Differential Revision: https://reviews.llvm.org/D25819 Modified: cfe/trunk/lib/Driver/ToolChains.cpp Modified: cfe/trunk/lib/Driver/ToolChains.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=284774&r1=284773&r2=284774&view=diff == --- cfe/trunk/lib/Driver/ToolChains.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains.cpp Thu Oct 20 15:45:40 2016 @@ -3850,9 +3850,9 @@ static bool IsUbuntu(enum Distro Distro) return Distro >= UbuntuHardy && Distro <= UbuntuYakkety; } -static Distro DetectDistro(const Driver &D, llvm::Triple::ArchType Arch) { +static Distro DetectDistro(vfs::FileSystem &VFS) { llvm::ErrorOr> File = - D.getVFS().getBufferForFile("/etc/lsb-release"); + VFS.getBufferForFile("/etc/lsb-release"); if (File) { StringRef Data = File.get()->getBuffer(); SmallVector Lines; @@ -3884,7 +3884,7 @@ static Distro DetectDistro(const Driver return Version; } - File = D.getVFS().getBufferForFile("/etc/redhat-release"); + File = VFS.getBufferForFile("/etc/redhat-release"); if (File) { StringRef Data = File.get()->getBuffer(); if (Data.startswith("Fedora release")) @@ -3902,7 +3902,7 @@ static Distro DetectDistro(const Driver return UnknownDistro; } - File = D.getVFS().getBufferForFile("/etc/debian_version"); + File = VFS.getBufferForFile("/etc/debian_version"); if (File) { StringRef Data = File.get()->getBuffer(); // Contents: < major.minor > or < codename/sid > @@ -3931,13 +3931,13 @@ static Distro DetectDistro(const Driver .Default(UnknownDistro); } - if (D.getVFS().exists("/etc/SuSE-release")) + if (VFS.exists("/etc/SuSE-release")) return OpenSUSE; - if (D.getVFS().exists("/etc/exherbo-release")) + if (VFS.exists("/etc/exherbo-release")) return Exherbo; - if (D.getVFS().exists("/etc/arch-release")) + if (VFS.exists("/etc/arch-release")) return ArchLinux; return UnknownDistro; @@ -4122,7 +4122,7 @@ Linux::Linux(const Driver &D, const llvm GCCInstallation.getTriple().str() + "/bin") .str()); - Distro Distro = DetectDistro(D, Arch); + Distro Distro = DetectDistro(D.getVFS()); if (IsOpenSUSE(Distro) || IsUbuntu(Distro)) { ExtraOpts.push_back("-z"); @@ -4326,7 +4326,7 @@ std::string Linux::getDynamicLinker(cons const llvm::Triple::ArchType Arch = getArch(); const llvm::Triple &Triple = getTriple(); - const enum Distro Distro = DetectDistro(getDriver(), Arch); + const enum Distro Distro = DetectDistro(getDriver().getVFS()); if (Triple.isAndroid()) return Triple.isArch64Bit() ? "/system/bin/linker64" : "/system/bin/linker"; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25844: [Sema][ObjC] Warn about implicitly autoreleasing indirect parameters that are captured by blocks
ahatanak created this revision. ahatanak added a reviewer: rjmccall. ahatanak added a subscriber: cfe-commits. ARC implicitly marks indirect parameters passed to a function as autoreleasing and passing a block that captures those parameters to another function sometimes causes problems that are hard to debug. For example, in the code below, a block capturing fillMeIn is passed to enumerateObjectsUsingBlock, in which an autorelease pool is pushed and popped before and after the block is invoked: void doStuff(NSString **fillMeIn) { [@[@"array"] enumerateObjectsUsingBlock: ^(id obj, NSUInteger idx, BOOL* stop) { *stop = YES; *fillMeIn = [@"wow" mutableCopy]; } ]; } The object assigned to *fillMeIn gets autoreleased inside the block, so it gets destructed when the autorelease pool is drained, and the program will crash if it tries to access the NSString returned in fillMeIn after doStuff returns. To help the users figure out why the program is crashing, this patch adds a new warning "-Wblock-capture-autoreleasing" which warns about implicitly autoreleasing indirect parameters captured by blocks and suggests explicitly specifying ownership qualification. https://reviews.llvm.org/D25844 Files: include/clang/Basic/DiagnosticGroups.td include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaExpr.cpp test/SemaObjC/arc.m Index: test/SemaObjC/arc.m === --- test/SemaObjC/arc.m +++ test/SemaObjC/arc.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -fblocks -verify -Wno-objc-root-class %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -fblocks -verify -Wno-objc-root-class -Wblock-capture-autoreleasing %s typedef unsigned long NSUInteger; typedef const void * CFTypeRef; @@ -808,3 +808,10 @@ TKAssertEqual(object, nil); TKAssertEqual(object, (id)nil); } + +void block_capture_autoreleasing(A * __autoreleasing *a, A **b) { // expected-note {{explicitly specify ownership qualification}} + ^{ +(void)*a; +(void)*b; // expected-warning {{block captures indirect parameter implicitly qualified with __autoreleasing}} + }(); +} Index: lib/Sema/SemaExpr.cpp === --- lib/Sema/SemaExpr.cpp +++ lib/Sema/SemaExpr.cpp @@ -13473,6 +13473,20 @@ } return false; } + + // Warn about implicitly autoreleasing indirect parameters captured by blocks. + if (auto *PT = dyn_cast(CaptureType)) { +QualType PointeeTy = PT->getPointeeType(); +if (isa(PointeeTy.getCanonicalType()) && +PointeeTy.getObjCLifetime() == Qualifiers::OCL_Autoreleasing && +!isa(PointeeTy)) { + if (BuildAndDiagnose) { +S.Diag(Loc, diag::warn_block_capture_autoreleasing); +S.Diag(Var->getLocation(), diag::note_explicit_ownership_qualification); + } +} + } + const bool HasBlocksAttr = Var->hasAttr(); if (HasBlocksAttr || CaptureType->isReferenceType() || (S.getLangOpts().OpenMP && S.IsOpenMPCapturedDecl(Var))) { Index: include/clang/Basic/DiagnosticSemaKinds.td === --- include/clang/Basic/DiagnosticSemaKinds.td +++ include/clang/Basic/DiagnosticSemaKinds.td @@ -5073,6 +5073,12 @@ } // end "ARC and @properties" category +def warn_block_capture_autoreleasing : Warning< + "block captures indirect parameter implicitly qualified with __autoreleasing">, + InGroup, DefaultIgnore; +def note_explicit_ownership_qualification : Note< + "explicitly specify ownership qualification">; + def err_arc_atomic_ownership : Error< "cannot perform atomic operation on a pointer to type %0: type has " "non-trivial ownership">; Index: include/clang/Basic/DiagnosticGroups.td === --- include/clang/Basic/DiagnosticGroups.td +++ include/clang/Basic/DiagnosticGroups.td @@ -498,6 +498,7 @@ def ARCRepeatedUseOfWeakMaybe : DiagGroup<"arc-maybe-repeated-use-of-weak">; def ARCRepeatedUseOfWeak : DiagGroup<"arc-repeated-use-of-weak", [ARCRepeatedUseOfWeakMaybe]>; +def BlockCaptureAutoReleasing : DiagGroup<"block-capture-autoreleasing">; def ObjCBridge : DiagGroup<"bridge-cast">; def DeallocInCategory:DiagGroup<"dealloc-in-category">; Index: test/SemaObjC/arc.m === --- test/SemaObjC/arc.m +++ test/SemaObjC/arc.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -fblocks -verify -Wno-objc-root-class %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -fblocks -verify -Wno-objc-root-class -Wblock-capture-autoreleasing %s typede
[PATCH] D25845: [CUDA] Ignore implicit target attributes during function template instantiation.
tra created this revision. tra added reviewers: jlebar, rsmith. tra added a subscriber: cfe-commits. Some functions and templates are treated as `__host__` `__device__` even when they don't have explicitly specified target attributes. What's worse, this treatment may change depending on command line options (-fno-cuda-host-device-constexpr) or `#pragma clang force_cuda_host_device`. Combined with strict checking for matching function target that comes with https://reviews.llvm.org/D25809, it makes it hard to write code which would explicitly instantiate or specialize some functions regardless of pragmas or command line options in effect. This patch changes the way we match target attributes of base template vs attributes used in explicit instantiation or specialization so that only explicitly specified attributes are considered. https://reviews.llvm.org/D25845 Files: include/clang/Sema/Sema.h lib/Sema/SemaCUDA.cpp lib/Sema/SemaDeclAttr.cpp lib/Sema/SemaTemplate.cpp test/SemaCUDA/function-template-overload.cu Index: test/SemaCUDA/function-template-overload.cu === --- test/SemaCUDA/function-template-overload.cu +++ test/SemaCUDA/function-template-overload.cu @@ -56,24 +56,51 @@ template __host__ __device__ HDType overload_h_d2(T a) { return HDType(); } template __device__ DType overload_h_d2(T1 a) { T1 x; T2 y; return DType(); } +// constexpr functions are implicitly HD, but explicit +// instantiation/specialization must use target attributes as written. +template constexpr T overload_ce_implicit_hd(T a) { return a+1; } +// expected-note@-1 3 {{candidate template ignored: target attributes do not match}} + +// These will not match the template. +template __host__ __device__ int overload_ce_implicit_hd(int a); +// expected-error@-1 {{explicit instantiation of 'overload_ce_implicit_hd' does not refer to a function template, variable template, member function, member class, or static data member}} +template <> __host__ __device__ long overload_ce_implicit_hd(long a); +// expected-error@-1 {{no function template matches function template specialization 'overload_ce_implicit_hd'}} +template <> __host__ __device__ constexpr long overload_ce_implicit_hd(long a); +// expected-error@-1 {{no function template matches function template specialization 'overload_ce_implicit_hd'}} + +// These should work. +template __host__ int overload_ce_implicit_hd(int a); +template <> __host__ long overload_ce_implicit_hd(long a); + +template float overload_ce_implicit_hd(float a); +template <> float* overload_ce_implicit_hd(float *a); +template <> constexpr double overload_ce_implicit_hd(double a) { return a + 3.0; }; + __host__ void hf() { overload_hd(13); + overload_ce_implicit_hd('h');// Implicitly instantiated + overload_ce_implicit_hd(1.0f); // Explicitly instantiated + overload_ce_implicit_hd(2.0);// Explicitly specialized HType h = overload_h_d(10); HType h2i = overload_h_d2(11); HType h2ii = overload_h_d2(12); // These should be implicitly instantiated from __host__ template returning HType. - DType d = overload_h_d(20); // expected-error {{no viable conversion from 'HType' to 'DType'}} - DType d2i = overload_h_d2(21); // expected-error {{no viable conversion from 'HType' to 'DType'}} + DType d = overload_h_d(20); // expected-error {{no viable conversion from 'HType' to 'DType'}} + DType d2i = overload_h_d2(21); // expected-error {{no viable conversion from 'HType' to 'DType'}} DType d2ii = overload_h_d2(22); // expected-error {{no viable conversion from 'HType' to 'DType'}} } __device__ void df() { overload_hd(23); + overload_ce_implicit_hd('d');// Implicitly instantiated + overload_ce_implicit_hd(1.0f); // Explicitly instantiated + overload_ce_implicit_hd(2.0);// Explicitly specialized // These should be implicitly instantiated from __device__ template returning DType. - HType h = overload_h_d(10); // expected-error {{no viable conversion from 'DType' to 'HType'}} - HType h2i = overload_h_d2(11); // expected-error {{no viable conversion from 'DType' to 'HType'}} + HType h = overload_h_d(10); // expected-error {{no viable conversion from 'DType' to 'HType'}} + HType h2i = overload_h_d2(11); // expected-error {{no viable conversion from 'DType' to 'HType'}} HType h2ii = overload_h_d2(12); // expected-error {{no viable conversion from 'DType' to 'HType'}} DType d = overload_h_d(20); Index: lib/Sema/SemaTemplate.cpp === --- lib/Sema/SemaTemplate.cpp +++ lib/Sema/SemaTemplate.cpp @@ -7043,13 +7043,13 @@ // Filter out matches that have different target. if (LangOpts.CUDA && - IdentifyCUDATarget(Specialization) != IdentifyCUDATarget(FD)) { + IdentifyCUDATarget(Specialization, true) != + IdentifyCUDATarget(FD, tr
[PATCH] D25842: [clang] Limit clang test to ARM only
rengolin added inline comments. Comment at: test/Frontend/gnu-mcount.c:1 +// REQUIRES: arm-registered-target + If you have ARM but not AArch64, this test will also fail. Can you use AND on REQUIRES? https://reviews.llvm.org/D25842 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25696: [Driver] Parse Debian version as integer when possible. NFC
This revision was automatically updated to reflect the committed changes. Closed by commit rL284770: [Driver] Parse Debian version as integer when possible. NFC (authored by mgorny). Changed prior to commit: https://reviews.llvm.org/D25696?vs=75269&id=75345#toc Repository: rL LLVM https://reviews.llvm.org/D25696 Files: cfe/trunk/lib/Driver/ToolChains.cpp Index: cfe/trunk/lib/Driver/ToolChains.cpp === --- cfe/trunk/lib/Driver/ToolChains.cpp +++ cfe/trunk/lib/Driver/ToolChains.cpp @@ -3905,17 +3905,30 @@ File = D.getVFS().getBufferForFile("/etc/debian_version"); if (File) { StringRef Data = File.get()->getBuffer(); -if (Data[0] == '5') - return DebianLenny; -else if (Data.startswith("squeeze/sid") || Data[0] == '6') - return DebianSqueeze; -else if (Data.startswith("wheezy/sid") || Data[0] == '7') - return DebianWheezy; -else if (Data.startswith("jessie/sid") || Data[0] == '8') - return DebianJessie; -else if (Data.startswith("stretch/sid") || Data[0] == '9') - return DebianStretch; -return UnknownDistro; +// Contents: < major.minor > or < codename/sid > +int MajorVersion; +if (!Data.split('.').first.getAsInteger(10, MajorVersion)) { + switch (MajorVersion) { + case 5: +return DebianLenny; + case 6: +return DebianSqueeze; + case 7: +return DebianWheezy; + case 8: +return DebianJessie; + case 9: +return DebianStretch; + default: +return UnknownDistro; + } +} +return llvm::StringSwitch(Data.split("\n").first) +.Case("squeeze/sid", DebianSqueeze) +.Case("wheezy/sid", DebianWheezy) +.Case("jessie/sid", DebianJessie) +.Case("stretch/sid", DebianStretch) +.Default(UnknownDistro); } if (D.getVFS().exists("/etc/SuSE-release")) Index: cfe/trunk/lib/Driver/ToolChains.cpp === --- cfe/trunk/lib/Driver/ToolChains.cpp +++ cfe/trunk/lib/Driver/ToolChains.cpp @@ -3905,17 +3905,30 @@ File = D.getVFS().getBufferForFile("/etc/debian_version"); if (File) { StringRef Data = File.get()->getBuffer(); -if (Data[0] == '5') - return DebianLenny; -else if (Data.startswith("squeeze/sid") || Data[0] == '6') - return DebianSqueeze; -else if (Data.startswith("wheezy/sid") || Data[0] == '7') - return DebianWheezy; -else if (Data.startswith("jessie/sid") || Data[0] == '8') - return DebianJessie; -else if (Data.startswith("stretch/sid") || Data[0] == '9') - return DebianStretch; -return UnknownDistro; +// Contents: < major.minor > or < codename/sid > +int MajorVersion; +if (!Data.split('.').first.getAsInteger(10, MajorVersion)) { + switch (MajorVersion) { + case 5: +return DebianLenny; + case 6: +return DebianSqueeze; + case 7: +return DebianWheezy; + case 8: +return DebianJessie; + case 9: +return DebianStretch; + default: +return UnknownDistro; + } +} +return llvm::StringSwitch(Data.split("\n").first) +.Case("squeeze/sid", DebianSqueeze) +.Case("wheezy/sid", DebianWheezy) +.Case("jessie/sid", DebianJessie) +.Case("stretch/sid", DebianStretch) +.Default(UnknownDistro); } if (D.getVFS().exists("/etc/SuSE-release")) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25819: [Driver] Refactor DetectDistro() parameters to take VFS ref only. NFC
bruno accepted this revision. bruno added a comment. This revision is now accepted and ready to land. Very nice! LGTM https://reviews.llvm.org/D25819 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r284770 - [Driver] Parse Debian version as integer when possible. NFC
Author: mgorny Date: Thu Oct 20 15:13:35 2016 New Revision: 284770 URL: http://llvm.org/viewvc/llvm-project?rev=284770&view=rev Log: [Driver] Parse Debian version as integer when possible. NFC Replace the string matching for /etc/debian_version with split integer/string matching algorithm. When the file contains 'major.minor' version number, parse the major version as integer and use a switch clause to match it. Otherwise, attempt 'codename/sid' matching using a StringSwitch. Differential Revision: https://reviews.llvm.org/D25696 Modified: cfe/trunk/lib/Driver/ToolChains.cpp Modified: cfe/trunk/lib/Driver/ToolChains.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=284770&r1=284769&r2=284770&view=diff == --- cfe/trunk/lib/Driver/ToolChains.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains.cpp Thu Oct 20 15:13:35 2016 @@ -3905,17 +3905,30 @@ static Distro DetectDistro(const Driver File = D.getVFS().getBufferForFile("/etc/debian_version"); if (File) { StringRef Data = File.get()->getBuffer(); -if (Data[0] == '5') - return DebianLenny; -else if (Data.startswith("squeeze/sid") || Data[0] == '6') - return DebianSqueeze; -else if (Data.startswith("wheezy/sid") || Data[0] == '7') - return DebianWheezy; -else if (Data.startswith("jessie/sid") || Data[0] == '8') - return DebianJessie; -else if (Data.startswith("stretch/sid") || Data[0] == '9') - return DebianStretch; -return UnknownDistro; +// Contents: < major.minor > or < codename/sid > +int MajorVersion; +if (!Data.split('.').first.getAsInteger(10, MajorVersion)) { + switch (MajorVersion) { + case 5: +return DebianLenny; + case 6: +return DebianSqueeze; + case 7: +return DebianWheezy; + case 8: +return DebianJessie; + case 9: +return DebianStretch; + default: +return UnknownDistro; + } +} +return llvm::StringSwitch(Data.split("\n").first) +.Case("squeeze/sid", DebianSqueeze) +.Case("wheezy/sid", DebianWheezy) +.Case("jessie/sid", DebianJessie) +.Case("stretch/sid", DebianStretch) +.Default(UnknownDistro); } if (D.getVFS().exists("/etc/SuSE-release")) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25696: [Driver] Parse Debian version as integer when possible. NFC
mgorny added a comment. Thanks for the review. I'll now look into updating the code for other distros to follow suit. https://reviews.llvm.org/D25696 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25842: [clang] Limit clang test to ARM only
mgrang created this revision. mgrang added reviewers: abdulras, honggyu.kim. mgrang added a subscriber: cfe-commits. mgrang added a project: clang-c. Herald added subscribers: rengolin, aemerson. Limit clang/test/Frontend/gnu-mcount.c to ARM only. https://reviews.llvm.org/D25842 Files: test/Frontend/gnu-mcount.c Index: test/Frontend/gnu-mcount.c === --- test/Frontend/gnu-mcount.c +++ test/Frontend/gnu-mcount.c @@ -1,3 +1,5 @@ +// REQUIRES: arm-registered-target + // RUN: %clang -target armv7-unknown-none-eabi -pg -S -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK -check-prefix CHECK-ARM-EABI // RUN: %clang -target armv7-unknown-none-eabi -pg -meabi gnu -S -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK -check-prefix CHECK-ARM-EABI-MEABI-GNU // RUN: %clang -target aarch64-unknown-none-eabi -pg -S -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK -check-prefix CHECK-ARM64-EABI Index: test/Frontend/gnu-mcount.c === --- test/Frontend/gnu-mcount.c +++ test/Frontend/gnu-mcount.c @@ -1,3 +1,5 @@ +// REQUIRES: arm-registered-target + // RUN: %clang -target armv7-unknown-none-eabi -pg -S -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK -check-prefix CHECK-ARM-EABI // RUN: %clang -target armv7-unknown-none-eabi -pg -meabi gnu -S -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK -check-prefix CHECK-ARM-EABI-MEABI-GNU // RUN: %clang -target aarch64-unknown-none-eabi -pg -S -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK -check-prefix CHECK-ARM64-EABI ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25696: [Driver] Parse Debian version as integer when possible. NFC
bruno accepted this revision. bruno added a comment. This revision is now accepted and ready to land. LGTM! https://reviews.llvm.org/D25696 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25839: Removed unused function argument. NFC.
tra created this revision. tra added a reviewer: jlebar. tra added a subscriber: cfe-commits. https://reviews.llvm.org/D25839 Files: include/clang/Sema/Sema.h lib/Sema/SemaCUDA.cpp lib/Sema/SemaDecl.cpp Index: lib/Sema/SemaDecl.cpp === --- lib/Sema/SemaDecl.cpp +++ lib/Sema/SemaDecl.cpp @@ -8264,7 +8264,7 @@ ProcessDeclAttributes(S, NewFD, D); if (getLangOpts().CUDA) -maybeAddCUDAHostDeviceAttrs(S, NewFD, Previous); +maybeAddCUDAHostDeviceAttrs(NewFD, Previous); if (getLangOpts().OpenCL) { // OpenCL v1.1 s6.5: Using an address space qualifier in a function return Index: lib/Sema/SemaCUDA.cpp === --- lib/Sema/SemaCUDA.cpp +++ lib/Sema/SemaCUDA.cpp @@ -439,7 +439,7 @@ // ForceCUDAHostDeviceDepth > 0 (corresponding to code within a // #pragma clang force_cuda_host_device_begin/end // pair). -void Sema::maybeAddCUDAHostDeviceAttrs(Scope *S, FunctionDecl *NewD, +void Sema::maybeAddCUDAHostDeviceAttrs(FunctionDecl *NewD, const LookupResult &Previous) { assert(getLangOpts().CUDA && "Should only be called during CUDA compilation"); Index: include/clang/Sema/Sema.h === --- include/clang/Sema/Sema.h +++ include/clang/Sema/Sema.h @@ -9443,7 +9443,7 @@ /// May add implicit CUDAHostAttr and CUDADeviceAttr attributes to FD, /// depending on FD and the current compilation settings. - void maybeAddCUDAHostDeviceAttrs(Scope *S, FunctionDecl *FD, + void maybeAddCUDAHostDeviceAttrs(FunctionDecl *FD, const LookupResult &Previous); public: Index: lib/Sema/SemaDecl.cpp === --- lib/Sema/SemaDecl.cpp +++ lib/Sema/SemaDecl.cpp @@ -8264,7 +8264,7 @@ ProcessDeclAttributes(S, NewFD, D); if (getLangOpts().CUDA) -maybeAddCUDAHostDeviceAttrs(S, NewFD, Previous); +maybeAddCUDAHostDeviceAttrs(NewFD, Previous); if (getLangOpts().OpenCL) { // OpenCL v1.1 s6.5: Using an address space qualifier in a function return Index: lib/Sema/SemaCUDA.cpp === --- lib/Sema/SemaCUDA.cpp +++ lib/Sema/SemaCUDA.cpp @@ -439,7 +439,7 @@ // ForceCUDAHostDeviceDepth > 0 (corresponding to code within a // #pragma clang force_cuda_host_device_begin/end // pair). -void Sema::maybeAddCUDAHostDeviceAttrs(Scope *S, FunctionDecl *NewD, +void Sema::maybeAddCUDAHostDeviceAttrs(FunctionDecl *NewD, const LookupResult &Previous) { assert(getLangOpts().CUDA && "Should only be called during CUDA compilation"); Index: include/clang/Sema/Sema.h === --- include/clang/Sema/Sema.h +++ include/clang/Sema/Sema.h @@ -9443,7 +9443,7 @@ /// May add implicit CUDAHostAttr and CUDADeviceAttr attributes to FD, /// depending on FD and the current compilation settings. - void maybeAddCUDAHostDeviceAttrs(Scope *S, FunctionDecl *FD, + void maybeAddCUDAHostDeviceAttrs(FunctionDecl *FD, const LookupResult &Previous); public: ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25838: [Fuchsia] Support for additional architectures
phosek created this revision. phosek added a reviewer: rsmith. phosek added a subscriber: cfe-commits. phosek set the repository for this revision to rL LLVM. Herald added a subscriber: aemerson. Fuchsia also experimentally supports ARM32 architecture, add it to the list of supported targets. Repository: rL LLVM https://reviews.llvm.org/D25838 Files: lib/Basic/Targets.cpp Index: lib/Basic/Targets.cpp === --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -8296,20 +8296,22 @@ return new CloudABITargetInfo(Triple, Opts); case llvm::Triple::FreeBSD: return new FreeBSDTargetInfo(Triple, Opts); +case llvm::Triple::Fuchsia: + return new FuchsiaTargetInfo(Triple, Opts); case llvm::Triple::Linux: return new LinuxTargetInfo(Triple, Opts); case llvm::Triple::NetBSD: return new NetBSDTargetInfo(Triple, Opts); -case llvm::Triple::Fuchsia: - return new FuchsiaTargetInfo(Triple, Opts); default: return new AArch64leTargetInfo(Triple, Opts); } case llvm::Triple::aarch64_be: switch (os) { case llvm::Triple::FreeBSD: return new FreeBSDTargetInfo(Triple, Opts); +case llvm::Triple::Fuchsia: + return new FuchsiaTargetInfo(Triple, Opts); case llvm::Triple::Linux: return new LinuxTargetInfo(Triple, Opts); case llvm::Triple::NetBSD: @@ -8330,6 +8332,8 @@ return new LinuxTargetInfo(Triple, Opts); case llvm::Triple::FreeBSD: return new FreeBSDTargetInfo(Triple, Opts); +case llvm::Triple::Fuchsia: + return new FuchsiaTargetInfo(Triple, Opts); case llvm::Triple::NetBSD: return new NetBSDTargetInfo(Triple, Opts); case llvm::Triple::OpenBSD: @@ -8366,6 +8370,8 @@ return new LinuxTargetInfo(Triple, Opts); case llvm::Triple::FreeBSD: return new FreeBSDTargetInfo(Triple, Opts); +case llvm::Triple::Fuchsia: + return new FuchsiaTargetInfo(Triple, Opts); case llvm::Triple::NetBSD: return new NetBSDTargetInfo(Triple, Opts); case llvm::Triple::OpenBSD: Index: lib/Basic/Targets.cpp === --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -8296,20 +8296,22 @@ return new CloudABITargetInfo(Triple, Opts); case llvm::Triple::FreeBSD: return new FreeBSDTargetInfo(Triple, Opts); +case llvm::Triple::Fuchsia: + return new FuchsiaTargetInfo(Triple, Opts); case llvm::Triple::Linux: return new LinuxTargetInfo(Triple, Opts); case llvm::Triple::NetBSD: return new NetBSDTargetInfo(Triple, Opts); -case llvm::Triple::Fuchsia: - return new FuchsiaTargetInfo(Triple, Opts); default: return new AArch64leTargetInfo(Triple, Opts); } case llvm::Triple::aarch64_be: switch (os) { case llvm::Triple::FreeBSD: return new FreeBSDTargetInfo(Triple, Opts); +case llvm::Triple::Fuchsia: + return new FuchsiaTargetInfo(Triple, Opts); case llvm::Triple::Linux: return new LinuxTargetInfo(Triple, Opts); case llvm::Triple::NetBSD: @@ -8330,6 +8332,8 @@ return new LinuxTargetInfo(Triple, Opts); case llvm::Triple::FreeBSD: return new FreeBSDTargetInfo(Triple, Opts); +case llvm::Triple::Fuchsia: + return new FuchsiaTargetInfo(Triple, Opts); case llvm::Triple::NetBSD: return new NetBSDTargetInfo(Triple, Opts); case llvm::Triple::OpenBSD: @@ -8366,6 +8370,8 @@ return new LinuxTargetInfo(Triple, Opts); case llvm::Triple::FreeBSD: return new FreeBSDTargetInfo(Triple, Opts); +case llvm::Triple::Fuchsia: + return new FuchsiaTargetInfo(Triple, Opts); case llvm::Triple::NetBSD: return new NetBSDTargetInfo(Triple, Opts); case llvm::Triple::OpenBSD: ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24991: Inline hot functions in libcxx shared_ptr implementation.
sebpop added a comment. In https://reviews.llvm.org/D24991#571056, @hiraditya wrote: > Marshall suggests using macro as we discussed offline. For some reason the > reply does not appear here: > http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20161010/173780.html Ping. Repository: rL LLVM https://reviews.llvm.org/D24991 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25813: [CodeGen] Devirtualize calls to methods marked final in a derived class
This revision was automatically updated to reflect the committed changes. Closed by commit rL284766: [CodeGen] Devirtualize calls to methods marked final in a derived class (authored by vedantk). Changed prior to commit: https://reviews.llvm.org/D25813?vs=75266&id=75331#toc Repository: rL LLVM https://reviews.llvm.org/D25813 Files: cfe/trunk/lib/CodeGen/CGClass.cpp cfe/trunk/test/CodeGenCXX/devirtualize-virtual-function-calls-final.cpp cfe/trunk/test/CodeGenCXX/ubsan-devirtualized-calls.cpp Index: cfe/trunk/lib/CodeGen/CGClass.cpp === --- cfe/trunk/lib/CodeGen/CGClass.cpp +++ cfe/trunk/lib/CodeGen/CGClass.cpp @@ -2873,6 +2873,11 @@ if (getLangOpts().AppleKext) return false; + // If the member function is marked 'final', we know that it can't be + // overridden and can therefore devirtualize it. + if (MD->hasAttr()) +return true; + // If the most derived class is marked final, we know that no subclass can // override this member function and so we can devirtualize it. For example: // @@ -2883,14 +2888,17 @@ // b->f(); // } // - const CXXRecordDecl *MostDerivedClassDecl = Base->getBestDynamicClassType(); - if (MostDerivedClassDecl->hasAttr()) -return true; + if (const CXXRecordDecl *BestDynamicDecl = Base->getBestDynamicClassType()) { +if (BestDynamicDecl->hasAttr()) + return true; - // If the member function is marked 'final', we know that it can't be - // overridden and can therefore devirtualize it. - if (MD->hasAttr()) -return true; +// There may be a method corresponding to MD in a derived class. If that +// method is marked final, we can devirtualize it. +const CXXMethodDecl *DevirtualizedMethod = +MD->getCorrespondingMethodInClass(BestDynamicDecl); +if (DevirtualizedMethod->hasAttr()) + return true; + } // Similarly, if the class itself is marked 'final' it can't be overridden // and we can therefore devirtualize the member function call. Index: cfe/trunk/test/CodeGenCXX/ubsan-devirtualized-calls.cpp === --- cfe/trunk/test/CodeGenCXX/ubsan-devirtualized-calls.cpp +++ cfe/trunk/test/CodeGenCXX/ubsan-devirtualized-calls.cpp @@ -16,9 +16,6 @@ void f1() override {} }; -// PR13127 documents some missed devirtualization opportunities, including -// devirt for methods marked 'final'. We can enable the checks marked 'PR13127' -// if we implement this in the frontend. struct Derived3 : Base1 { void f1() override /* nofinal */ {} }; @@ -30,10 +27,10 @@ // CHECK: [[UBSAN_TI_DERIVED1_1:@[0-9]+]] = private unnamed_addr global {{.*}} i8* bitcast {{.*}} @_ZTI8Derived1 to i8* // CHECK: [[UBSAN_TI_DERIVED2_1:@[0-9]+]] = private unnamed_addr global {{.*}} i8* bitcast {{.*}} @_ZTI8Derived2 to i8* // CHECK: [[UBSAN_TI_DERIVED2_2:@[0-9]+]] = private unnamed_addr global {{.*}} i8* bitcast {{.*}} @_ZTI8Derived2 to i8* -// PR13127: [[UBSAN_TI_DERIVED3:@[0-9]+]] = private unnamed_addr global {{.*}} i8* bitcast {{.*}} @_ZTI8Derived3 to i8* -// PR13127: [[UBSAN_TI_BASE1:@[0-9]+]] = private unnamed_addr global {{.*}} i8* bitcast {{.*}} @_ZTI5Base1 to i8* -// PR13127: [[UBSAN_TI_DERIVED4_1:@[0-9]+]] = private unnamed_addr global {{.*}} i8* bitcast {{.*}} @_ZTI8Derived4 to i8* -// PR13127: [[UBSAN_TI_DERIVED4_2:@[0-9]+]] = private unnamed_addr global {{.*}} i8* bitcast {{.*}} @_ZTI8Derived4 to i8* +// CHECK: [[UBSAN_TI_DERIVED3:@[0-9]+]] = private unnamed_addr global {{.*}} i8* bitcast {{.*}} @_ZTI8Derived3 to i8* +// CHECK: [[UBSAN_TI_BASE1:@[0-9]+]] = private unnamed_addr global {{.*}} i8* bitcast {{.*}} @_ZTI5Base1 to i8* +// CHECK: [[UBSAN_TI_DERIVED4_1:@[0-9]+]] = private unnamed_addr global {{.*}} i8* bitcast {{.*}} @_ZTI8Derived4 to i8* +// CHECK: [[UBSAN_TI_DERIVED4_2:@[0-9]+]] = private unnamed_addr global {{.*}} i8* bitcast {{.*}} @_ZTI8Derived4 to i8* // CHECK-LABEL: define void @_Z2t1v void t1() { @@ -59,26 +56,26 @@ // CHECK-NEXT: call void @__ubsan_handle_dynamic_type_cache{{[_a-z]*}}({{.*}} [[UBSAN_TI_DERIVED2_2]] {{.*}}, i{{[0-9]+}} %[[D2_2]] } -// PR13127-LABEL: define void @_Z2t4v +// CHECK-LABEL: define void @_Z2t4v void t4() { Base1 p; Derived3 *badp = static_cast(&p); //< Check that &p isa Derived3. - // PR13127: %[[P1:[0-9]+]] = ptrtoint %struct.Derived3* {{%[0-9]+}} to i{{[0-9]+}}, !nosanitize - // PR13127-NEXT: call void @__ubsan_handle_dynamic_type_cache{{[_a-z]*}}({{.*}} [[UBSAN_TI_DERIVED3]] {{.*}}, i{{[0-9]+}} %[[P1]] + // CHECK: %[[P1:[0-9]+]] = ptrtoint %struct.Derived3* {{%[0-9]+}} to i{{[0-9]+}}, !nosanitize + // CHECK-NEXT: call void @__ubsan_handle_dynamic_type_cache{{[_a-z]*}}({{.*}} [[UBSAN_TI_DERIVED3]] {{.*}}, i{{[0-9]+}} %[[P1]] static_cast(badp)->f1(); //< No devirt, test 'badp isa Base1'. - // PR13127: %[[BADP1:[0-9]+]] = ptrtoint %struct.Base1* {{%[0-9]+}} to i{{[0-9]+}}, !nosanitize - // PR13127-NEXT: call v
r284766 - [CodeGen] Devirtualize calls to methods marked final in a derived class
Author: vedantk Date: Thu Oct 20 13:44:14 2016 New Revision: 284766 URL: http://llvm.org/viewvc/llvm-project?rev=284766&view=rev Log: [CodeGen] Devirtualize calls to methods marked final in a derived class If we see a virtual method call to Base::foo() but can infer that the object is an instance of Derived, and that 'foo' is marked 'final' in Derived, we can devirtualize the call to Derived::foo(). Differential Revision: https://reviews.llvm.org/D25813 Modified: cfe/trunk/lib/CodeGen/CGClass.cpp cfe/trunk/test/CodeGenCXX/devirtualize-virtual-function-calls-final.cpp cfe/trunk/test/CodeGenCXX/ubsan-devirtualized-calls.cpp Modified: cfe/trunk/lib/CodeGen/CGClass.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=284766&r1=284765&r2=284766&view=diff == --- cfe/trunk/lib/CodeGen/CGClass.cpp (original) +++ cfe/trunk/lib/CodeGen/CGClass.cpp Thu Oct 20 13:44:14 2016 @@ -2873,6 +2873,11 @@ CodeGenFunction::CanDevirtualizeMemberFu if (getLangOpts().AppleKext) return false; + // If the member function is marked 'final', we know that it can't be + // overridden and can therefore devirtualize it. + if (MD->hasAttr()) +return true; + // If the most derived class is marked final, we know that no subclass can // override this member function and so we can devirtualize it. For example: // @@ -2883,14 +2888,17 @@ CodeGenFunction::CanDevirtualizeMemberFu // b->f(); // } // - const CXXRecordDecl *MostDerivedClassDecl = Base->getBestDynamicClassType(); - if (MostDerivedClassDecl->hasAttr()) -return true; + if (const CXXRecordDecl *BestDynamicDecl = Base->getBestDynamicClassType()) { +if (BestDynamicDecl->hasAttr()) + return true; - // If the member function is marked 'final', we know that it can't be - // overridden and can therefore devirtualize it. - if (MD->hasAttr()) -return true; +// There may be a method corresponding to MD in a derived class. If that +// method is marked final, we can devirtualize it. +const CXXMethodDecl *DevirtualizedMethod = +MD->getCorrespondingMethodInClass(BestDynamicDecl); +if (DevirtualizedMethod->hasAttr()) + return true; + } // Similarly, if the class itself is marked 'final' it can't be overridden // and we can therefore devirtualize the member function call. Modified: cfe/trunk/test/CodeGenCXX/devirtualize-virtual-function-calls-final.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/devirtualize-virtual-function-calls-final.cpp?rev=284766&r1=284765&r2=284766&view=diff == --- cfe/trunk/test/CodeGenCXX/devirtualize-virtual-function-calls-final.cpp (original) +++ cfe/trunk/test/CodeGenCXX/devirtualize-virtual-function-calls-final.cpp Thu Oct 20 13:44:14 2016 @@ -225,3 +225,19 @@ namespace Test9 { return -static_cast(*x); } } + +namespace Test10 { + struct A { +virtual int f(); + }; + + struct B : A { +int f() final; + }; + + // CHECK-LABEL: define i32 @_ZN6Test101fEPNS_1BE + int f(B *b) { +// CHECK: call i32 @_ZN6Test101B1fEv +return static_cast(b)->f(); + } +} Modified: cfe/trunk/test/CodeGenCXX/ubsan-devirtualized-calls.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/ubsan-devirtualized-calls.cpp?rev=284766&r1=284765&r2=284766&view=diff == --- cfe/trunk/test/CodeGenCXX/ubsan-devirtualized-calls.cpp (original) +++ cfe/trunk/test/CodeGenCXX/ubsan-devirtualized-calls.cpp Thu Oct 20 13:44:14 2016 @@ -16,9 +16,6 @@ struct Derived2 final : Base1, Base2 { void f1() override {} }; -// PR13127 documents some missed devirtualization opportunities, including -// devirt for methods marked 'final'. We can enable the checks marked 'PR13127' -// if we implement this in the frontend. struct Derived3 : Base1 { void f1() override /* nofinal */ {} }; @@ -30,10 +27,10 @@ struct Derived4 final : Base1 { // CHECK: [[UBSAN_TI_DERIVED1_1:@[0-9]+]] = private unnamed_addr global {{.*}} i8* bitcast {{.*}} @_ZTI8Derived1 to i8* // CHECK: [[UBSAN_TI_DERIVED2_1:@[0-9]+]] = private unnamed_addr global {{.*}} i8* bitcast {{.*}} @_ZTI8Derived2 to i8* // CHECK: [[UBSAN_TI_DERIVED2_2:@[0-9]+]] = private unnamed_addr global {{.*}} i8* bitcast {{.*}} @_ZTI8Derived2 to i8* -// PR13127: [[UBSAN_TI_DERIVED3:@[0-9]+]] = private unnamed_addr global {{.*}} i8* bitcast {{.*}} @_ZTI8Derived3 to i8* -// PR13127: [[UBSAN_TI_BASE1:@[0-9]+]] = private unnamed_addr global {{.*}} i8* bitcast {{.*}} @_ZTI5Base1 to i8* -// PR13127: [[UBSAN_TI_DERIVED4_1:@[0-9]+]] = private unnamed_addr global {{.*}} i8* bitcast {{.*}} @_ZTI8Derived4 to i8* -// PR13127: [[UBSAN_TI_DERIVED4_2:@[0-9]+]] = private unnamed_addr global {{.*}} i8* bitcast {{.*}} @_ZTI8Derived4 to i8* +// CHE
[PATCH] D25731: [analyzer] NumberObjectConversion: Support OSNumber and CFNumberRef.
alexshap added inline comments. Comment at: lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp:149 BugReporter &BR) const { MatchFinder F; Callback CB(this, BR, AM.getAnalysisDeclContext(D)); probably it would make sense to move "MatchFinder F;" to the line 276 (closer to the place where it's actually being used)(or maybe i'm missing smth ?) https://reviews.llvm.org/D25731 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r284761 - [c++1z] Fix assertion failure when using the wrong number of bindings for a
Author: rsmith Date: Thu Oct 20 13:29:25 2016 New Revision: 284761 URL: http://llvm.org/viewvc/llvm-project?rev=284761&view=rev Log: [c++1z] Fix assertion failure when using the wrong number of bindings for a struct with unnamed bitfields. Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp cfe/trunk/test/SemaCXX/cxx1z-decomposition.cpp Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=284761&r1=284760&r2=284761&view=diff == --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original) +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Oct 20 13:29:25 2016 @@ -1279,7 +1279,9 @@ static bool checkMemberDecomposition(Sem DecompType.getQualifiers()); auto DiagnoseBadNumberOfBindings = [&]() -> bool { -unsigned NumFields = std::distance(RD->field_begin(), RD->field_end()); +unsigned NumFields = +std::count_if(RD->field_begin(), RD->field_end(), + [](FieldDecl *FD) { return !FD->isUnnamedBitfield(); }); assert(Bindings.size() != NumFields); S.Diag(Src->getLocation(), diag::err_decomp_decl_wrong_number_bindings) << DecompType << (unsigned)Bindings.size() << NumFields Modified: cfe/trunk/test/SemaCXX/cxx1z-decomposition.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx1z-decomposition.cpp?rev=284761&r1=284760&r2=284761&view=diff == --- cfe/trunk/test/SemaCXX/cxx1z-decomposition.cpp (original) +++ cfe/trunk/test/SemaCXX/cxx1z-decomposition.cpp Thu Oct 20 13:29:25 2016 @@ -47,4 +47,10 @@ void enclosing() { (void) [n] {}; // expected-error {{'n' in capture list does not name a variable}} } +void bitfield() { + struct { int a : 3, : 4, b : 5; } a; + auto &[x, y] = a; + auto &[p, q, r] = a; // expected-error {{decomposes into 2 elements, but 3 names were provided}} +} + // FIXME: by-value array copies ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25806: Module: correctly set the module file kind when emitting diagnostics for file_modified
manmanren updated this revision to Diff 75326. manmanren added a comment. Thanks Richard for the testing case. It is also obvious from the testing case that we can have another diagnostic in flight when emitting err_fe_pch_file_modified. https://reviews.llvm.org/D25806 Files: include/clang/Basic/DiagnosticSerializationKinds.td lib/Serialization/ASTReader.cpp test/Modules/module-file-modified.c Index: test/Modules/module-file-modified.c === --- test/Modules/module-file-modified.c +++ test/Modules/module-file-modified.c @@ -0,0 +1,11 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: echo 'int foo = 0;' > %t/a.h +// RUN: echo 'module A { header "a.h" }' > %t/m.modulemap +// RUN: %clang_cc1 -fmodules -emit-module -fmodule-name=A -x c %t/m.modulemap -o %t/m.pcm +// RUN: echo 'int bar;' > %t/a.h +// RUN: not %clang_cc1 -fmodules -fmodule-file=%t/m.pcm -fmodule-map-file=%t/m.modulemap -x c %s -I%t -fsyntax-only 2>&1 | FileCheck %s +#include "a.h" +int foo = 0; // redefinition of 'foo' +// CHECK: fatal error: file {{.*}} has been modified since the module file {{.*}} was built +// REQUIRES: shell Index: lib/Serialization/ASTReader.cpp === --- lib/Serialization/ASTReader.cpp +++ lib/Serialization/ASTReader.cpp @@ -1983,6 +1983,7 @@ return R; } +static unsigned moduleKindForDiagnostic(ModuleKind Kind); InputFile ASTReader::getInputFile(ModuleFile &F, unsigned ID, bool Complain) { // If this ID is bogus, just return an empty input file. if (ID == 0 || ID > F.InputFilesLoaded.size()) @@ -2079,7 +2080,13 @@ // The top-level PCH is stale. StringRef TopLevelPCHName(ImportStack.back()->FileName); - Error(diag::err_fe_pch_file_modified, Filename, TopLevelPCHName); + unsigned DiagnosticKind = moduleKindForDiagnostic(ImportStack.back()->Kind); + if (DiagnosticKind == 0) +Error(diag::err_fe_pch_file_modified, Filename, TopLevelPCHName); + else if (DiagnosticKind == 1) +Error(diag::err_fe_module_file_modified, Filename, TopLevelPCHName); + else +Error(diag::err_fe_ast_file_modified, Filename, TopLevelPCHName); // Print the import stack. if (ImportStack.size() > 1 && !Diags.isDiagnosticInFlight()) { Index: include/clang/Basic/DiagnosticSerializationKinds.td === --- include/clang/Basic/DiagnosticSerializationKinds.td +++ include/clang/Basic/DiagnosticSerializationKinds.td @@ -21,6 +21,12 @@ def err_fe_pch_file_modified : Error< "file '%0' has been modified since the precompiled header '%1' was built">, DefaultFatal; +def err_fe_module_file_modified : Error< +"file '%0' has been modified since the module file '%1' was built">, +DefaultFatal; +def err_fe_ast_file_modified : Error< +"file '%0' has been modified since the AST file '%1' was built">, +DefaultFatal; def err_fe_pch_file_overridden : Error< "file '%0' from the precompiled header has been overridden">; def note_pch_required_by : Note<"'%0' required by '%1'">; Index: test/Modules/module-file-modified.c === --- test/Modules/module-file-modified.c +++ test/Modules/module-file-modified.c @@ -0,0 +1,11 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: echo 'int foo = 0;' > %t/a.h +// RUN: echo 'module A { header "a.h" }' > %t/m.modulemap +// RUN: %clang_cc1 -fmodules -emit-module -fmodule-name=A -x c %t/m.modulemap -o %t/m.pcm +// RUN: echo 'int bar;' > %t/a.h +// RUN: not %clang_cc1 -fmodules -fmodule-file=%t/m.pcm -fmodule-map-file=%t/m.modulemap -x c %s -I%t -fsyntax-only 2>&1 | FileCheck %s +#include "a.h" +int foo = 0; // redefinition of 'foo' +// CHECK: fatal error: file {{.*}} has been modified since the module file {{.*}} was built +// REQUIRES: shell Index: lib/Serialization/ASTReader.cpp === --- lib/Serialization/ASTReader.cpp +++ lib/Serialization/ASTReader.cpp @@ -1983,6 +1983,7 @@ return R; } +static unsigned moduleKindForDiagnostic(ModuleKind Kind); InputFile ASTReader::getInputFile(ModuleFile &F, unsigned ID, bool Complain) { // If this ID is bogus, just return an empty input file. if (ID == 0 || ID > F.InputFilesLoaded.size()) @@ -2079,7 +2080,13 @@ // The top-level PCH is stale. StringRef TopLevelPCHName(ImportStack.back()->FileName); - Error(diag::err_fe_pch_file_modified, Filename, TopLevelPCHName); + unsigned DiagnosticKind = moduleKindForDiagnostic(ImportStack.back()->Kind); + if (DiagnosticKind == 0) +Error(diag::err_fe_pch_file_modified, Filename, TopLevelPCHName); + else if (DiagnosticKind == 1) +Error(diag::err_fe_module_file_modified, Filename, TopLevelPCHName); + else +Error(diag::err_fe_ast_file_modified, Filename,
[PATCH] D25731: [analyzer] NumberObjectConversion: Support OSNumber and CFNumberRef.
NoQ added a comment. Ouch, i think i forgot about `OSNumber`, including tests. Comment at: lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp:111 + QualType ObjT = (IsCpp || IsObjC) + ? Obj->getType().getCanonicalType().getUnqualifiedType() + : Obj->getType(); zaks.anna wrote: > Why do we need a case split here? Would calling > getCanonicalType().getUnqualifiedType() result in a wrong result for ObjC? It'd result in a wrong result for `CFNumberRef`, which is a typedef we shouldn't remove (turning this into `struct __CFNumber *` would be ugly). I'd probably rather avoid the case split by removing the `.getCanonicalType()` part, because rarely anybody makes typedefs for `NSNumber*` or `OSBoolean*` etc (such as in tests with the word "sugared"). Or i could descend down to the necessary typedef for C objects, discarding all user's typedefs but not library typedefs. But that'd be even more complicated and probably not very useful for such minor matter. https://reviews.llvm.org/D25731 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r284754 - Add more doxygen comments to emmintrin.h's intrinsics.
Author: kromanova Date: Thu Oct 20 12:59:15 2016 New Revision: 284754 URL: http://llvm.org/viewvc/llvm-project?rev=284754&view=rev Log: Add more doxygen comments to emmintrin.h's intrinsics. With this patch, 75% of the intrinsics in this file will be documented now. The patches for the rest of the intrisics in this file will be send out later. The doxygen comments are automatically generated based on Sony's intrinsics document. I got an OK from Eric Christopher to commit doxygen comments without prior code review upstream. This patch was internally reviewed by Yunzhong Gao. Modified: cfe/trunk/lib/Headers/emmintrin.h Modified: cfe/trunk/lib/Headers/emmintrin.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/emmintrin.h?rev=284754&r1=284753&r2=284754&view=diff == --- cfe/trunk/lib/Headers/emmintrin.h (original) +++ cfe/trunk/lib/Headers/emmintrin.h Thu Oct 20 12:59:15 2016 @@ -49,6 +49,21 @@ typedef signed char __v16qs __attribute_ /* Define the default attributes for the functions in this file. */ #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("sse2"))) +/// \brief Adds lower double-precision values in both operands and returns the +///sum in the lower 64 bits of the result. The upper 64 bits of the result +///are copied from the upper double-precision value of the first operand. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the \c VADDSD / ADDSD instruction. +/// +/// \param __a +///A 128-bit vector of [2 x double] containing one of the source operands. +/// \param __b +///A 128-bit vector of [2 x double] containing one of the source operands. +/// \returns A 128-bit vector of [2 x double] whose lower 64 bits contain the +///sum of the lower 64 bits of both operands. The upper 64 bits are copied +///from the upper 64 bits of the first source operand. static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_add_sd(__m128d __a, __m128d __b) { @@ -56,12 +71,41 @@ _mm_add_sd(__m128d __a, __m128d __b) return __a; } +/// \brief Adds two 128-bit vectors of [2 x double]. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the \c VADDPD / ADDPD instruction. +/// +/// \param __a +///A 128-bit vector of [2 x double] containing one of the source operands. +/// \param __b +///A 128-bit vector of [2 x double] containing one of the source operands. +/// \returns A 128-bit vector of [2 x double] containing the sums of both +///operands. static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_add_pd(__m128d __a, __m128d __b) { return (__m128d)((__v2df)__a + (__v2df)__b); } +/// \brief Subtracts the lower double-precision value of the second operand +///from the lower double-precision value of the first operand and returns +///the difference in the lower 64 bits of the result. The upper 64 bits of +///the result are copied from the upper double-precision value of the first +///operand. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the \c VSUBSD / SUBSD instruction. +/// +/// \param __a +///A 128-bit vector of [2 x double] containing the minuend. +/// \param __b +///A 128-bit vector of [2 x double] containing the subtrahend. +/// \returns A 128-bit vector of [2 x double] whose lower 64 bits contain the +///difference of the lower 64 bits of both operands. The upper 64 bits are +///copied from the upper 64 bits of the first source operand. static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_sub_sd(__m128d __a, __m128d __b) { @@ -69,12 +113,40 @@ _mm_sub_sd(__m128d __a, __m128d __b) return __a; } +/// \brief Subtracts two 128-bit vectors of [2 x double]. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the \c VSUBPD / SUBPD instruction. +/// +/// \param __a +///A 128-bit vector of [2 x double] containing the minuend. +/// \param __b +///A 128-bit vector of [2 x double] containing the subtrahend. +/// \returns A 128-bit vector of [2 x double] containing the differences between +///both operands. static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_sub_pd(__m128d __a, __m128d __b) { return (__m128d)((__v2df)__a - (__v2df)__b); } +/// \brief Multiplies lower double-precision values in both operands and returns +///the product in the lower 64 bits of the result. The upper 64 bits of the +///result are copied from the upper double-precision value of the first +///operand. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the \c VMULSD / MULSD instruction. +/// +/// \param __a +///A 128-bit vector of [2 x double] containing one of the source operands. +/// \param __b +///A 128-bit vector of [2 x double] containing one of the source operands. +/// \returns A 128-bit vector of [2 x double] whose lower 64 bits contain the +///product of the lower 64 bits of both operands. The upper 64 bits are +///
[PATCH] D25813: [CodeGen] Devirtualize calls to methods marked final in a derived class
rjmccall added a comment. Looks great to me, thanks. https://reviews.llvm.org/D25813 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r284753 - [c++1z] Teach composite pointer type computation how to compute the composite
Author: rsmith Date: Thu Oct 20 12:57:33 2016 New Revision: 284753 URL: http://llvm.org/viewvc/llvm-project?rev=284753&view=rev Log: [c++1z] Teach composite pointer type computation how to compute the composite pointer type of two function pointers with different noexcept specifications. While I'm here, also teach it how to merge dynamic exception specifications. Added: cfe/trunk/test/CXX/expr/p13.cpp Modified: cfe/trunk/include/clang/Sema/Overload.h cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/lib/Sema/SemaExprCXX.cpp cfe/trunk/lib/Sema/SemaOverload.cpp Modified: cfe/trunk/include/clang/Sema/Overload.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Overload.h?rev=284753&r1=284752&r2=284753&view=diff == --- cfe/trunk/include/clang/Sema/Overload.h (original) +++ cfe/trunk/include/clang/Sema/Overload.h Thu Oct 20 12:57:33 2016 @@ -145,7 +145,8 @@ namespace clang { /// pointer-to-member conversion, or boolean conversion. ImplicitConversionKind Second : 8; -/// Third - The third conversion can be a qualification conversion. +/// Third - The third conversion can be a qualification conversion +/// or a function conversion. ImplicitConversionKind Third : 8; /// \brief Whether this is the deprecated conversion of a Modified: cfe/trunk/include/clang/Sema/Sema.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=284753&r1=284752&r2=284753&view=diff == --- cfe/trunk/include/clang/Sema/Sema.h (original) +++ cfe/trunk/include/clang/Sema/Sema.h Thu Oct 20 12:57:33 2016 @@ -8954,13 +8954,15 @@ public: ExprResult &cond, ExprResult &lhs, ExprResult &rhs, ExprValueKind &VK, ExprObjectKind &OK, SourceLocation questionLoc); QualType FindCompositePointerType(SourceLocation Loc, Expr *&E1, Expr *&E2, -bool *NonStandardCompositeType = nullptr); +bool *NonStandardCompositeType = nullptr, +bool ConvertArgs = true); QualType FindCompositePointerType(SourceLocation Loc, ExprResult &E1, ExprResult &E2, -bool *NonStandardCompositeType = nullptr) { +bool *NonStandardCompositeType = nullptr, +bool ConvertArgs = true) { Expr *E1Tmp = E1.get(), *E2Tmp = E2.get(); -QualType Composite = FindCompositePointerType(Loc, E1Tmp, E2Tmp, - NonStandardCompositeType); +QualType Composite = FindCompositePointerType( +Loc, E1Tmp, E2Tmp, NonStandardCompositeType, ConvertArgs); E1 = E1Tmp; E2 = E2Tmp; return Composite; Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=284753&r1=284752&r2=284753&view=diff == --- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original) +++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Thu Oct 20 12:57:33 2016 @@ -3610,16 +3610,6 @@ Sema::PerformImplicitConversion(Expr *Fr // Nothing else to do. break; - case ICK_Function_Conversion: -// If both sides are functions (or pointers/references to them), there could -// be incompatible exception declarations. -if (CheckExceptionSpecCompatibility(From, ToType)) - return ExprError(); - -From = ImpCastExprToType(From, ToType, CK_NoOp, - VK_RValue, /*BasePath=*/nullptr, CCK).get(); -break; - case ICK_Integral_Promotion: case ICK_Integral_Conversion: if (ToType->isBooleanType()) { @@ -3866,6 +3856,7 @@ Sema::PerformImplicitConversion(Expr *Fr case ICK_Lvalue_To_Rvalue: case ICK_Array_To_Pointer: case ICK_Function_To_Pointer: + case ICK_Function_Conversion: case ICK_Qualification: case ICK_Num_Conversion_Kinds: case ICK_C_Only_Conversion: @@ -3878,6 +3869,16 @@ Sema::PerformImplicitConversion(Expr *Fr // Nothing to do. break; + case ICK_Function_Conversion: +// If both sides are functions (or pointers/references to them), there could +// be incompatible exception declarations. +if (CheckExceptionSpecCompatibility(From, ToType)) + return ExprError(); + +From = ImpCastExprToType(From, ToType, CK_NoOp, + VK_RValue, /*BasePath=*/nullptr, CCK).get(); +break; + case ICK_Qualification: { // The qualification keeps the category of the inner expression, unless the // target type isn't a reference. @@ -5393,6 +5394,17 @@ QualType Sema::CXXCheckConditionalOperan if (LHS.get()->getObjectKind() == OK_BitField || RHS.get()->getObjectKind() == OK_BitField) OK = OK_Bit
[PATCH] D25012: [x86][inline-asm] Add support for curly brackets escape using "%" in extended inline asm.
rnk accepted this revision. rnk added a comment. This revision is now accepted and ready to land. lgtm Repository: rL LLVM https://reviews.llvm.org/D25012 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D22374: [analyzer] Copy and move constructors - ExprEngine extended for "almost trivial" copy and move constructors
NoQ added a reviewer: zaks.anna. NoQ added a comment. Ping!~ Did my idea sound completely wrong to you? :) Does https://reviews.llvm.org/D25660 depend on this patch? And/or did you find another workaround? https://reviews.llvm.org/D22374 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24888: [clang-tidy] Use [[clang::suppress]] with cppcoreguidelines-pro-type-reinterpret-cast
mgehre added inline comments. Comment at: clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.cpp:25 - Finder->addMatcher(cxxReinterpretCastExpr().bind("cast"), this); + std::vector Rules{"type", "type.1", "cppcoreguidelines-pro-type-reinterpret-cast"}; + Finder->addMatcher(cxxReinterpretCastExpr(unless(isSuppressed(Rules))).bind("cast"), this); aaron.ballman wrote: > malcolm.parsons wrote: > > aaron.ballman wrote: > > > mgehre wrote: > > > > aaron.ballman wrote: > > > > > Hmm, it seems like this is boilerplate we are going to want for every > > > > > rule, and that it's pretty easy to not get this right (for instance, > > > > > if you change the way the check is spelled, you have to remember to > > > > > update this as well). Could this actually be handled more > > > > > transparently, by gathering this information when the check is > > > > > registered and exposing it to the check? > > > > > > > > > > The checks would still need to use `unless(isSuppressed(Rules))` in > > > > > some form, but I am thinking that it would be more convenient if we > > > > > could do: > > > > > `Finder->addMatcher(cxxReinterpretCastExpr(unlessSuppressed(*this)).bind("cast"), > > > > > this);` > > > > I see multiple ways on how to integrate that into clang-tidy: > > > > 1) Add something like you proposed to each matcher of each check > > > > 2) Change (or add overload of) > > > > ``` > > > > DiagnosticBuilder diag(SourceLocation Loc, StringRef Description, > > > > DiagnosticIDs::Level Level = > > > > DiagnosticIDs::Warning); > > > > ``` > > > > to add a AST node as parameter and make the SourceLocation optional. > > > > Most checks anyhow > > > > call this like diag(E->getLoc(), ""), and then they would do > > > > diag(E, "..."). > > > > Diag then would check from the that AST node upwards to see if it finds > > > > a matching [[suppress]] attribute > > > > > > > > 3) Change the RecursiveASTVistor that drives the AST Matches to prune > > > > certain matchers from the list of to-be-evaluated matchers > > > > for all AST subtrees that are below a certain [[suppress]] attribute. > > > > (This is based on how I image that the AST matchers work) > > > Ideally, I would like to see this attribute used to suppress Clang > > > diagnostics as well, however. So while I think Option 2 is better suited > > > to that future direction, it's still not ideal because all instances of > > > diag() need to be updated to take advantage. Options 1 and 3 are > > > basically limited to clang-tidy use. > > > > > > I wonder if there's a way to modify the diagnostic builder to > > > transparently handle this without requiring modifying all of the call > > > sites? > > clang-tidy reports how many warnings were suppressed by NOLINT comments. > > I'd expect the number of warnings suppressed by [[clang::suppress]] to be > > included in the count. > > Handling suppressions in the matchers or visitors would prevent this. > As would handling the suppression transparently within the diagnostic engine > itself. If there is a way to turn a SourceLocation into a ASTNode, diag() could handle this transparently (do you know how?). I would still add an overload of diag that takes an AST node as a performance optimization, because I imagine that going from SourceLocation to ASTNode would be a costly operation. I can prototype that approach, if you like. Comment at: clang-tidy/cppcoreguidelines/Suppression.h:59 + anyOf(hasAncestor(attributedStmt(hasSuppressAttr(Rules))), + hasAncestor(decl(hasAttrs(), hasSuppressAttr(Rules) + .matches(Node, Finder, Builder); aaron.ballman wrote: > mgehre wrote: > > aaron.ballman wrote: > > > Why is the check for `hasAttrs` required? > > > > > > Also, this use of `hasAncestor()` makes this expensive to use, and that > > > expense may be hidden from the caller. Is there a way to structure this > > > so that we don't need to walk the entire ancestor tree? > > hasAttr() is needed here, because inside of hasSuppressAttr(), we call > > getAttrs() which would assert if hasAttr() is false. > > I cannot push hasAttr() into hasSuppressAttr(), because hasSuppressAttr() > > is a template getting either Decl or AttributedStmt, > > and AttributedStmt does not have an hasAttr() method. > I believe that `getSpecificAttr` should be resilient to no attributes being > present (since it also has to handle the case there are no attributes of the > specific type, so no attributes at all is simply a degenerate case), and so > the check for `hasAttrs()` should be redundant. Decl::getAttrs() will assert if called on a Decl where hasAttrs() is false, see http://clang.llvm.org/doxygen/DeclBase_8cpp_source.html#l00741 https://reviews.llvm.org/D24888 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org
[PATCH] D25063: [x86][inline-asm][AVX512][clang][PART-1] Introducing "k" and "Yk" constraints for extended inline assembly, enabling use of AVX512 masked vectorized instructions.
rnk added inline comments. Comment at: test/CodeGen/avx512-kconstraints-att_inline_asm.c:6 +void mask_Yk_i8(char msk){ +//CHECK: #APP +//CHECK: vpaddb %xmm1, %xmm0, %xmm1 {%k1} The LLVM IR won't have #APP markers in it. Does this test really pass? https://reviews.llvm.org/D25063 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D20811: [analyzer] Model some library functions
dcoughlin added a comment. In https://reviews.llvm.org/D20811#575521, @NoQ wrote: > I thought to give it a pause to take a fresh look at how to arrange the > macro-hints in the summaries. > > Maybe something like that: > > CASE > ARGUMENT_CONDITION(ARG_NO(0), OutOfRange) > RANGE('0', '9') > RANGE('A', 'Z') > RANGE('a', 'z') > RANGE(128, 255) > END_ARGUMENT_CONDITION > RETURN_VALUE_CONDITION(WithinRange) > SINGLE_VALUE(0) > END_RETURN_VALUE_CONDITION > END_CASE > Looks great to me! https://reviews.llvm.org/D20811 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r284749 - [clang-cl] Fix test that shouldn't be running on non-x86
Author: rengolin Date: Thu Oct 20 12:41:08 2016 New Revision: 284749 URL: http://llvm.org/viewvc/llvm-project?rev=284749&view=rev Log: [clang-cl] Fix test that shouldn't be running on non-x86 The clang-cl test required x86-registered-target but it defaulted to the host's triple and AArch64 still doesn't support COFF, so the test failed. The triple was "aarch64-pc-windows-msvc18.0.0" with ObjectFormat equals llvm::Triple::COFF, failing assertion: Assertion `(TT.isOSBinFormatELF() || TT.isOSBinFormatMachO()) && "Only expect Darwin and ELF targets" in AArch64MCTargetDesc.cpp:78. Making the test only run on Windows hosts obviously fixes the problem. Modified: cfe/trunk/test/Driver/cl-pch.c Modified: cfe/trunk/test/Driver/cl-pch.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-pch.c?rev=284749&r1=284748&r2=284749&view=diff == --- cfe/trunk/test/Driver/cl-pch.c (original) +++ cfe/trunk/test/Driver/cl-pch.c Thu Oct 20 12:41:08 2016 @@ -1,4 +1,4 @@ -// REQUIRES: x86-registered-target +// REQUIRES: system-windows // // RUN: rm -rf %t // RUN: mkdir %t ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25777: [Sema][TreeTransform] Re-create DesignatedInitExpr when it has a field designator with a valid FieldDecl
rjmccall added a comment. The fact that this bug only arises when performing a *second* instantiation suggests that there's a deeper bug here, because template instantiation is not supposed to modify the pattern AST. In this case, the basic problem is that, when the parser processes a designator, it only has an identifier, not a FieldDecl*, because it doesn't know what type is being initialized yet. SemaInit eventually resolves that identifier to a FieldDecl and needs to record that in the AST; typically the AST is treated as immutable, but in this case, instead of cloning the expression, Sema just modifies the field designator in-place. That's not completely unreasonable, and it's definitely the most space-efficient solution for non-template code-building; but in template code, it does mean that we have to take care to not present the same unresolved field designator to Sema twice. Fortunately, this is pretty easy: we just need to need to flag the expression as needing rebuilding when there isn't a resolved field in the field designator. When there *is* a resolved field, we just need to map it using TransformDecl; the expression then only needs to be rebuilt if that fails or returns a different declaration. Repository: rL LLVM https://reviews.llvm.org/D25777 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
RE: [PATCH] D25343: [OpenCL] Mark group functions as convergent in opencl-c.h
+ Tom Matt Thanks Ettore. I think OpenCL is subject to the same issue, and noduplicate does not help either. Basically if a function A directly or indirectly calls a convergent function e.g. barrier, function A itself must also be marked as convergent, otherwise optimization passes may transform a convergent call of A into multiple divergent calls of A. That means if we only know the declaration of a function, we have to assume it is convergent since in its body it may call a convergent function. I think probably OpenCL should take the same approach, i.e., mark all functions as convergent, then let Transforms/IPO/FunctionAttrs.cpp to remove unnecessary convergent attribute. Sam -Original Message- From: Ettore Speziale [mailto:speziale.ett...@gmail.com] Sent: Thursday, October 20, 2016 11:42 AM To: reviews+d25343+public+a10e9553b0fc8...@reviews.llvm.org; Liu, Yaxun (Sam) Cc: Ettore Speziale ; alexey.ba...@intel.com; anastasia.stul...@arm.com; aaron.ball...@gmail.com; Clang Commits ; Sumner, Brian Subject: Re: [PATCH] D25343: [OpenCL] Mark group functions as convergent in opencl-c.h Hello guys, >> Should we deprecate noduplicate then as convergent should cover both use >> cases for OpenCL I believe? As far as I understand noduplicate was added >> specifically for SPMD use cases... > > noduplicate has different semantics than convergent. Although it is proposed > for SPMD originally, it could be used by non-SPMD programs to forbid > duplicate of functions. There may be applications using this attribute. > > I would suggest to leave this question for future. Probably ask llvm-dev > first since the attribute is also in LLVM. I just want to clarify why I withdraw the convergent patch I initially submitted some time ago. It has a problem when dealing with multiple modules. Consider the following example: int foo(void) __attribute__((pure)); int bar(int x) { int y = foo(); if (x) return y; return 0; } I’ve just marked foo with the pure attribute to mark the function readonly in LLVM IR. Given that IR, the IR sinking pass pushes the foo call site into the then branch: ; Function Attrs: nounwind readonly ssp uwtable define i32 @bar(i32) #0 { %2 = icmp eq i32 %0, 0 br i1 %2, label %5, label %3 ; :3 ; preds = %1 %4 = tail call i32 @foo() #2 br label %5 ; :5 ; preds = %1, %3 %6 = phi i32 [ %4, %3 ], [ 0, %1 ] ret i32 %6 } ; Function Attrs: nounwind readonly declare i32 @foo() #1 This is kind of dangerous, as we do not know what is inside foo — i.e. it might contains a convergent call. If I understand correctly, the CUDA guys solved the problem in two steps. At CodeGen time all the device function calls are marked convergent: if (getLangOpts().CUDA && getLangOpts().CUDAIsDevice) { // Conservatively, mark all functions and calls in CUDA as convergent // (meaning, they may call an intrinsically convergent op, such as // __syncthreads(), and so can't have certain optimizations applied around // them). LLVM will remove this attribute where it safely can. FuncAttrs.addAttribute(llvm::Attribute::Convergent); Then LLVM function attribute pass — lib/Transforms/IPO/FunctionAttrs.cpp — remove the unnecessary convergent attributes starting from the leaf nodes — i.e. external calls. Provide that intrinsics are correctly marked convergent only when needed, that allow to get rid of the unnecessary convergent attributes. Since you are introducing an explicit convergent attribute it seems that OpenCL is requiring the developers to explicitly mark the functions that might contain convergent function calls with the convergent attribute. Am I understand correctly? Thanks -- Ettore Speziale — Compiler Engineer speziale.ett...@gmail.com espezi...@apple.com -- ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D20811: [analyzer] Model some library functions
NoQ marked 9 inline comments as done. NoQ added a comment. I thought to give it a pause to take a fresh look at how to arrange the macro-hints in the summaries. Maybe something like that: CASE ARGUMENT_CONDITION(ARG_NO(0), OutOfRange) RANGE('0', '9') RANGE('A', 'Z') RANGE('a', 'z') RANGE(128, 255) END_ARGUMENT_CONDITION RETURN_VALUE_CONDITION(WithinRange) SINGLE_VALUE(0) END_RETURN_VALUE_CONDITION END_CASE Comment at: lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:547 +RANGE { + RET_VAL, RANGE_KIND(OutOfRange), + SET { POINT(0) } dcoughlin wrote: > NoQ wrote: > > dcoughlin wrote: > > > Is it ever the case that this final 'RANGE" constrains anything other > > > than the return value? If not, can 'RET_VAL' be elided? > > Some summaries only have pre-conditions: "for this argument constraint, any > > return value is possible". We should also be able to support void > > functions, which have no return values. > What does a postcondition on a void function mean in this context? Can you > refer to argument values? Such as "If the the function terminates then it > must have been the case that the first argument was in the rangy x..z even > though we didn't know that going in? Is this useful? No, i don't think this is useful. There are just timeless immutable symbols about which we learn something new on every branch. If the function doesn't terminate on certain pre-conditons, then we can model it by never mentioning these pre-conditions in any of the branches (we don't use this trick anywhere yet - all functions listed here shall terminate in all cases). This would have been useful if we start referring to the heap shape (eg. "if the value behind the pointer passed as second argument to the call was in range [1,10] before the call, then it would be equal to 42 after the call"), but we don't do that yet. https://reviews.llvm.org/D20811 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24339: [clang-tidy] Add check 'readability-redundant-member-init'
This revision was automatically updated to reflect the committed changes. Closed by commit rL284742: [clang-tidy] Add check 'readability-redundant-member-init' (authored by malcolm.parsons). Changed prior to commit: https://reviews.llvm.org/D24339?vs=74769&id=75311#toc Repository: rL LLVM https://reviews.llvm.org/D24339 Files: clang-tools-extra/trunk/clang-tidy/readability/CMakeLists.txt clang-tools-extra/trunk/clang-tidy/readability/ReadabilityTidyModule.cpp clang-tools-extra/trunk/clang-tidy/readability/RedundantMemberInitCheck.cpp clang-tools-extra/trunk/clang-tidy/readability/RedundantMemberInitCheck.h clang-tools-extra/trunk/docs/ReleaseNotes.rst clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst clang-tools-extra/trunk/docs/clang-tidy/checks/readability-redundant-member-init.rst clang-tools-extra/trunk/test/clang-tidy/readability-redundant-member-init.cpp Index: clang-tools-extra/trunk/test/clang-tidy/readability-redundant-member-init.cpp === --- clang-tools-extra/trunk/test/clang-tidy/readability-redundant-member-init.cpp +++ clang-tools-extra/trunk/test/clang-tidy/readability-redundant-member-init.cpp @@ -0,0 +1,181 @@ +// RUN: %check_clang_tidy %s readability-redundant-member-init %t + +struct S { + S() = default; + S(int i) : i(i) {} + int i = 1; +}; + +struct T { + T(int i = 1) : i(i) {} + int i; +}; + +struct U { + int i; +}; + +union V { + int i; + double f; +}; + +// Initializer calls default constructor +struct F1 { + F1() : f() {} + // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for member 'f' is redundant + // CHECK-FIXES: F1() {} + S f; +}; + +// Initializer calls default constructor with default argument +struct F2 { + F2() : f() {} + // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for member 'f' is redundant + // CHECK-FIXES: F2() {} + T f; +}; + +// Multiple redundant initializers for same constructor +struct F3 { + F3() : f(), g(1), h() {} + // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for member 'f' is redundant + // CHECK-MESSAGES: :[[@LINE-2]]:21: warning: initializer for member 'h' is redundant + // CHECK-FIXES: F3() : g(1) {} + S f, g, h; +}; + +// Templated class independent type +template +struct F4 { + F4() : f() {} + // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for member 'f' is redundant + // CHECK-FIXES: F4() {} + S f; +}; +F4 f4i; +F4 f4s; + +// Base class +struct F5 : S { + F5() : S() {} + // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for base class 'S' is redundant + // CHECK-FIXES: F5() {} +}; + +// Constructor call requires cleanup +struct Cleanup { + ~Cleanup() {} +}; + +struct UsesCleanup { + UsesCleanup(const Cleanup &c = Cleanup()) {} +}; + +struct F6 { + F6() : uc() {} + // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for member 'uc' is redundant + // CHECK-FIXES: F6() {} + UsesCleanup uc; +}; + +// Multiple inheritance +struct F7 : S, T { + F7() : S(), T() {} + // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for base class 'S' is redundant + // CHECK-MESSAGES: :[[@LINE-2]]:15: warning: initializer for base class 'T' is redundant + // CHECK-FIXES: F7() {} +}; + +// Initializer not written +struct NF1 { + NF1() {} + S f; +}; + +// Initializer doesn't call default constructor +struct NF2 { + NF2() : f(1) {} + S f; +}; + +// Initializer calls default constructor without using default argument +struct NF3 { + NF3() : f(1) {} + T f; +}; + +// Initializer calls default constructor without using default argument +struct NF4 { + NF4() : f(2) {} + T f; +}; + +// Initializer is zero-initialization +struct NF5 { + NF5() : i() {} + int i; +}; + +// Initializer is direct-initialization +struct NF6 { + NF6() : i(1) {} + int i; +}; + +// Initializer is aggregate initialization of struct +struct NF7 { + NF7() : f{} {} + U f; +}; + +// Initializer is zero-initialization of struct +struct NF7b { + NF7b() : f() {} + U f; +}; + +// Initializer is aggregate initialization of array +struct NF8 { + NF8() : f{} {} + int f[2]; +}; + +struct NF9 { + NF9() : f{} {} + S f[2]; +}; + +// Initializing member of union +union NF10 { + NF10() : s() {} + int i; + S s; +}; + +// Templated class dependent type +template +struct NF11 { + NF11() : f() {} + V f; +}; +NF11 nf11i; +NF11 nf11s; + +// Delegating constructor +class NF12 { + NF12() = default; + NF12(int) : NF12() {} +}; + +// Const member +struct NF13 { + NF13() : f() {} + const S f; +}; + +// Union member +struct NF14 { + NF14() : f() {} + V f; +}; Index: clang-tools-extra/trunk/clang-tidy/readability/RedundantMemberInitCheck.h === --- clang-tools-extra/trunk/clang-tidy/readability/RedundantMemberInitCheck.h +++ clang-tools-extra/trunk/clang-tidy/readability/RedundantMemberInitCheck.h @@ -0,0 +1,36 @@ +//===--- RedundantMemberInitCheck.h
[clang-tools-extra] r284742 - [clang-tidy] Add check 'readability-redundant-member-init'
Author: malcolm.parsons Date: Thu Oct 20 11:08:03 2016 New Revision: 284742 URL: http://llvm.org/viewvc/llvm-project?rev=284742&view=rev Log: [clang-tidy] Add check 'readability-redundant-member-init' Summary: The check emits a warning if a member-initializer calls the member's default constructor with no arguments. Reviewers: sbenza, alexfh, aaron.ballman Subscribers: modocache, mgorny, Eugene.Zelenko, etienneb, Prazek, hokein, cfe-commits, beanz Differential Revision: https://reviews.llvm.org/D24339 Added: clang-tools-extra/trunk/clang-tidy/readability/RedundantMemberInitCheck.cpp clang-tools-extra/trunk/clang-tidy/readability/RedundantMemberInitCheck.h clang-tools-extra/trunk/docs/clang-tidy/checks/readability-redundant-member-init.rst clang-tools-extra/trunk/test/clang-tidy/readability-redundant-member-init.cpp Modified: clang-tools-extra/trunk/clang-tidy/readability/CMakeLists.txt clang-tools-extra/trunk/clang-tidy/readability/ReadabilityTidyModule.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/readability/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/CMakeLists.txt?rev=284742&r1=284741&r2=284742&view=diff == --- clang-tools-extra/trunk/clang-tidy/readability/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-tidy/readability/CMakeLists.txt Thu Oct 20 11:08:03 2016 @@ -16,6 +16,7 @@ add_clang_library(clangTidyReadabilityMo NonConstParameterCheck.cpp ReadabilityTidyModule.cpp RedundantControlFlowCheck.cpp + RedundantMemberInitCheck.cpp RedundantStringCStrCheck.cpp RedundantSmartptrGetCheck.cpp RedundantStringInitCheck.cpp Modified: clang-tools-extra/trunk/clang-tidy/readability/ReadabilityTidyModule.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/ReadabilityTidyModule.cpp?rev=284742&r1=284741&r2=284742&view=diff == --- clang-tools-extra/trunk/clang-tidy/readability/ReadabilityTidyModule.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/readability/ReadabilityTidyModule.cpp Thu Oct 20 11:08:03 2016 @@ -23,6 +23,7 @@ #include "NamedParameterCheck.h" #include "NonConstParameterCheck.h" #include "RedundantControlFlowCheck.h" +#include "RedundantMemberInitCheck.h" #include "RedundantSmartptrGetCheck.h" #include "RedundantStringCStrCheck.h" #include "RedundantStringInitCheck.h" @@ -57,6 +58,8 @@ public: "readability-inconsistent-declaration-parameter-name"); CheckFactories.registerCheck( "readability-misplaced-array-index"); +CheckFactories.registerCheck( +"readability-redundant-member-init"); CheckFactories.registerCheck( "readability-static-definition-in-anonymous-namespace"); CheckFactories.registerCheck( Added: clang-tools-extra/trunk/clang-tidy/readability/RedundantMemberInitCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/RedundantMemberInitCheck.cpp?rev=284742&view=auto == --- clang-tools-extra/trunk/clang-tidy/readability/RedundantMemberInitCheck.cpp (added) +++ clang-tools-extra/trunk/clang-tidy/readability/RedundantMemberInitCheck.cpp Thu Oct 20 11:08:03 2016 @@ -0,0 +1,65 @@ +//===--- RedundantMemberInitCheck.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 "RedundantMemberInitCheck.h" +#include "clang/AST/ASTContext.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" +#include "clang/Lex/Lexer.h" +#include "../utils/Matchers.h" +#include + +using namespace clang::ast_matchers; +using namespace clang::tidy::matchers; + +namespace clang { +namespace tidy { +namespace readability { + +void RedundantMemberInitCheck::registerMatchers(MatchFinder *Finder) { + auto Construct = + cxxConstructExpr( + hasDeclaration(cxxConstructorDecl(hasParent( + cxxRecordDecl(unless(isTriviallyDefaultConstructible())) + .bind("construct"); + + Finder->addMatcher( + cxxConstructorDecl( + unless(isDelegatingConstructor()), + ofClass(unless( + anyOf(isUnion(), ast_matchers::isTemplateInstantiation(, + forEachConstructorInitializer( + cxxCtorInitializer(isWritten(), + withInitializer(ignoringImplicit(Construct)), + unless(forField(hasType(isConstQualified() +
[clang-tools-extra] r284737 - Use auto in for loop
Author: malcolm.parsons Date: Thu Oct 20 10:40:34 2016 New Revision: 284737 URL: http://llvm.org/viewvc/llvm-project?rev=284737&view=rev Log: Use auto in for loop Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp?rev=284737&r1=284736&r2=284737&view=diff == --- clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp Thu Oct 20 10:40:34 2016 @@ -263,7 +263,7 @@ void UseDefaultCheck::check(const MatchF return; SpecialFunctionName = "copy constructor"; // If there are constructor initializers, they must be removed. - for (const CXXCtorInitializer *Init : Ctor->inits()) { + for (const auto *Init : Ctor->inits()) { RemoveInitializers.emplace_back( FixItHint::CreateRemoval(Init->getSourceRange())); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D25343: [OpenCL] Mark group functions as convergent in opencl-c.h
Hello guys, >> Should we deprecate noduplicate then as convergent should cover both use >> cases for OpenCL I believe? As far as I understand noduplicate was added >> specifically for SPMD use cases... > > noduplicate has different semantics than convergent. Although it is proposed > for SPMD originally, it could be used by non-SPMD programs to forbid > duplicate of functions. There may be applications using this attribute. > > I would suggest to leave this question for future. Probably ask llvm-dev > first since the attribute is also in LLVM. I just want to clarify why I withdraw the convergent patch I initially submitted some time ago. It has a problem when dealing with multiple modules. Consider the following example: int foo(void) __attribute__((pure)); int bar(int x) { int y = foo(); if (x) return y; return 0; } I’ve just marked foo with the pure attribute to mark the function readonly in LLVM IR. Given that IR, the IR sinking pass pushes the foo call site into the then branch: ; Function Attrs: nounwind readonly ssp uwtable define i32 @bar(i32) #0 { %2 = icmp eq i32 %0, 0 br i1 %2, label %5, label %3 ; :3 ; preds = %1 %4 = tail call i32 @foo() #2 br label %5 ; :5 ; preds = %1, %3 %6 = phi i32 [ %4, %3 ], [ 0, %1 ] ret i32 %6 } ; Function Attrs: nounwind readonly declare i32 @foo() #1 This is kind of dangerous, as we do not know what is inside foo — i.e. it might contains a convergent call. If I understand correctly, the CUDA guys solved the problem in two steps. At CodeGen time all the device function calls are marked convergent: if (getLangOpts().CUDA && getLangOpts().CUDAIsDevice) { // Conservatively, mark all functions and calls in CUDA as convergent // (meaning, they may call an intrinsically convergent op, such as // __syncthreads(), and so can't have certain optimizations applied around // them). LLVM will remove this attribute where it safely can. FuncAttrs.addAttribute(llvm::Attribute::Convergent); Then LLVM function attribute pass — lib/Transforms/IPO/FunctionAttrs.cpp — remove the unnecessary convergent attributes starting from the leaf nodes — i.e. external calls. Provide that intrinsics are correctly marked convergent only when needed, that allow to get rid of the unnecessary convergent attributes. Since you are introducing an explicit convergent attribute it seems that OpenCL is requiring the developers to explicitly mark the functions that might contain convergent function calls with the convergent attribute. Am I understand correctly? Thanks -- Ettore Speziale — Compiler Engineer speziale.ett...@gmail.com espezi...@apple.com -- ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25769: [clang-tidy] Simplify modernize-use-default
This revision was automatically updated to reflect the committed changes. Closed by commit rL284735: [clang-tidy] Simplify modernize-use-default (authored by malcolm.parsons). Changed prior to commit: https://reviews.llvm.org/D25769?vs=75140&id=75307#toc Repository: rL LLVM https://reviews.llvm.org/D25769 Files: clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-copy.cpp Index: clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp === --- clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp @@ -20,37 +20,6 @@ static const char SpecialFunction[] = "SpecialFunction"; -/// \brief Finds the SourceLocation of the colon ':' before the initialization -/// list in the definition of a constructor. -static SourceLocation getColonLoc(const ASTContext *Context, - const CXXConstructorDecl *Ctor) { - // FIXME: First init is the first initialization that is going to be - // performed, no matter what was the real order in the source code. If the - // order of the inits is wrong in the code, it may result in a false negative. - SourceLocation FirstInit = (*Ctor->init_begin())->getSourceLocation(); - SourceLocation LastArg = - Ctor->getParamDecl(Ctor->getNumParams() - 1)->getLocEnd(); - // We need to find the colon between the ')' and the first initializer. - bool Invalid = false; - StringRef Text = Lexer::getSourceText( - CharSourceRange::getCharRange(LastArg, FirstInit), - Context->getSourceManager(), Context->getLangOpts(), &Invalid); - if (Invalid) -return SourceLocation(); - - size_t ColonPos = Text.rfind(':'); - if (ColonPos == StringRef::npos) -return SourceLocation(); - - Text = Text.drop_front(ColonPos + 1); - if (std::strspn(Text.data(), " \t\r\n") != Text.size()) { -// If there are comments, preprocessor directives or anything, abort. -return SourceLocation(); - } - // FIXME: don't remove comments in the middle of the initializers. - return LastArg.getLocWithOffset(ColonPos); -} - /// \brief Finds all the named non-static fields of \p Record. static std::set getAllNamedFields(const CXXRecordDecl *Record) { @@ -262,7 +231,6 @@ void UseDefaultCheck::check(const MatchFinder::MatchResult &Result) { std::string SpecialFunctionName; - SourceLocation StartLoc, EndLoc; // Both CXXConstructorDecl and CXXDestructorDecl inherit from CXXMethodDecl. const auto *SpecialFunctionDecl = @@ -280,27 +248,24 @@ if (!Body) return; - // Default locations. - StartLoc = Body->getLBracLoc(); - EndLoc = Body->getRBracLoc(); - // If there are comments inside the body, don't do the change. if (!SpecialFunctionDecl->isCopyAssignmentOperator() && !bodyEmpty(Result.Context, Body)) return; + std::vector RemoveInitializers; + if (const auto *Ctor = dyn_cast(SpecialFunctionDecl)) { if (Ctor->getNumParams() == 0) { SpecialFunctionName = "default constructor"; } else { if (!isCopyConstructorAndCanBeDefaulted(Result.Context, Ctor)) return; SpecialFunctionName = "copy constructor"; // If there are constructor initializers, they must be removed. - if (Ctor->getNumCtorInitializers() != 0) { -StartLoc = getColonLoc(Result.Context, Ctor); -if (!StartLoc.isValid()) - return; + for (const CXXCtorInitializer *Init : Ctor->inits()) { +RemoveInitializers.emplace_back( +FixItHint::CreateRemoval(Init->getSourceRange())); } } } else if (isa(SpecialFunctionDecl)) { @@ -313,8 +278,8 @@ diag(SpecialFunctionDecl->getLocStart(), "use '= default' to define a trivial " + SpecialFunctionName) - << FixItHint::CreateReplacement( - CharSourceRange::getTokenRange(StartLoc, EndLoc), "= default;"); + << FixItHint::CreateReplacement(Body->getSourceRange(), "= default;") + << RemoveInitializers; } } // namespace modernize Index: clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-copy.cpp === --- clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-copy.cpp +++ clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-copy.cpp @@ -8,7 +8,7 @@ }; OL::OL(const OL &Other) : Field(Other.Field) {} // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use '= default' to define a trivial copy constructor [modernize-use-default] -// CHECK-FIXES: OL::OL(const OL &Other) = default; +// CHECK-FIXES: OL::OL(const OL &Other) = default; OL &OL::operator=(const OL &Other) { Field = Other.Field; return *this; @@ -20,7 +20,7 @@ struct IL { IL(const IL &Other) : Field(Other.Field) {} // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= default' - // CHECK-FIXES: IL(cons
[clang-tools-extra] r284735 - [clang-tidy] Simplify modernize-use-default
Author: malcolm.parsons Date: Thu Oct 20 10:31:34 2016 New Revision: 284735 URL: http://llvm.org/viewvc/llvm-project?rev=284735&view=rev Log: [clang-tidy] Simplify modernize-use-default Summary: clang-tidy now cleans up after replacements, so leave colon and comma removal to that. Reviewers: angelgarcia, alexfh, aaron.ballman, djasper, ioeric Subscribers: djasper, cfe-commits Differential Revision: https://reviews.llvm.org/D25769 Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-copy.cpp Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp?rev=284735&r1=284734&r2=284735&view=diff == --- clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp Thu Oct 20 10:31:34 2016 @@ -20,37 +20,6 @@ namespace modernize { static const char SpecialFunction[] = "SpecialFunction"; -/// \brief Finds the SourceLocation of the colon ':' before the initialization -/// list in the definition of a constructor. -static SourceLocation getColonLoc(const ASTContext *Context, - const CXXConstructorDecl *Ctor) { - // FIXME: First init is the first initialization that is going to be - // performed, no matter what was the real order in the source code. If the - // order of the inits is wrong in the code, it may result in a false negative. - SourceLocation FirstInit = (*Ctor->init_begin())->getSourceLocation(); - SourceLocation LastArg = - Ctor->getParamDecl(Ctor->getNumParams() - 1)->getLocEnd(); - // We need to find the colon between the ')' and the first initializer. - bool Invalid = false; - StringRef Text = Lexer::getSourceText( - CharSourceRange::getCharRange(LastArg, FirstInit), - Context->getSourceManager(), Context->getLangOpts(), &Invalid); - if (Invalid) -return SourceLocation(); - - size_t ColonPos = Text.rfind(':'); - if (ColonPos == StringRef::npos) -return SourceLocation(); - - Text = Text.drop_front(ColonPos + 1); - if (std::strspn(Text.data(), " \t\r\n") != Text.size()) { -// If there are comments, preprocessor directives or anything, abort. -return SourceLocation(); - } - // FIXME: don't remove comments in the middle of the initializers. - return LastArg.getLocWithOffset(ColonPos); -} - /// \brief Finds all the named non-static fields of \p Record. static std::set getAllNamedFields(const CXXRecordDecl *Record) { @@ -262,7 +231,6 @@ void UseDefaultCheck::registerMatchers(M void UseDefaultCheck::check(const MatchFinder::MatchResult &Result) { std::string SpecialFunctionName; - SourceLocation StartLoc, EndLoc; // Both CXXConstructorDecl and CXXDestructorDecl inherit from CXXMethodDecl. const auto *SpecialFunctionDecl = @@ -280,15 +248,13 @@ void UseDefaultCheck::check(const MatchF if (!Body) return; - // Default locations. - StartLoc = Body->getLBracLoc(); - EndLoc = Body->getRBracLoc(); - // If there are comments inside the body, don't do the change. if (!SpecialFunctionDecl->isCopyAssignmentOperator() && !bodyEmpty(Result.Context, Body)) return; + std::vector RemoveInitializers; + if (const auto *Ctor = dyn_cast(SpecialFunctionDecl)) { if (Ctor->getNumParams() == 0) { SpecialFunctionName = "default constructor"; @@ -297,10 +263,9 @@ void UseDefaultCheck::check(const MatchF return; SpecialFunctionName = "copy constructor"; // If there are constructor initializers, they must be removed. - if (Ctor->getNumCtorInitializers() != 0) { -StartLoc = getColonLoc(Result.Context, Ctor); -if (!StartLoc.isValid()) - return; + for (const CXXCtorInitializer *Init : Ctor->inits()) { +RemoveInitializers.emplace_back( +FixItHint::CreateRemoval(Init->getSourceRange())); } } } else if (isa(SpecialFunctionDecl)) { @@ -313,8 +278,8 @@ void UseDefaultCheck::check(const MatchF diag(SpecialFunctionDecl->getLocStart(), "use '= default' to define a trivial " + SpecialFunctionName) - << FixItHint::CreateReplacement( - CharSourceRange::getTokenRange(StartLoc, EndLoc), "= default;"); + << FixItHint::CreateReplacement(Body->getSourceRange(), "= default;") + << RemoveInitializers; } } // namespace modernize Modified: clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-copy.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-copy.cpp?rev=284735&r1=284734&r2=284735&view=diff == --- clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-cop
[PATCH] D25828: Implement part of P0031; adding `constexpr` to `move_iterator`
mclow.lists added inline comments. Comment at: include/iterator:1559 struct __libcpp_is_trivial_iterator - : public _LIBCPP_BOOL_CONSTANT(is_pointer<_Iter>::value) {}; - +: public _LIBCPP_BOOL_CONSTANT(is_pointer<_Iter>::value) {}; + These changes are just getting rid of tabs. https://reviews.llvm.org/D25828 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25828: Implement part of P0031; adding `constexpr` to `move_iterator`
mclow.lists created this revision. mclow.lists added reviewers: EricWF, lefticus, AntonBikineev. mclow.lists added a subscriber: cfe-commits. This just does the `move_iterator` bits of http://wg21.link/P0031 - not any of the other parts. This duplicates some (but not all) of the work that was done in https://reviews.llvm.org/D20915 and https://reviews.llvm.org/D22584. Again, the whole reason for this is all the tests. https://reviews.llvm.org/D25828 Files: include/iterator test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/minus.pass.cpp test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/plus.pass.cpp test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+/difference_type.pass.cpp test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+=/difference_type.pass.cpp test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-/difference_type.pass.cpp test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-=/difference_type.pass.cpp test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_eq.pass.cpp test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gt.pass.cpp test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gte.pass.cpp test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lt.pass.cpp test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lte.pass.cpp test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_neq.pass.cpp test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/convert.pass.cpp test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/iter.pass.cpp test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/post.pass.cpp test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/pre.pass.cpp test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/post.pass.cpp test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/pre.pass.cpp test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.ref/op_arrow.pass.cpp test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp Index: test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp === --- test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp +++ test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp @@ -15,10 +15,13 @@ // requires HasAssign // move_iterator& // operator=(const move_iterator& u); +// +// constexpr in C++17 #include #include +#include "test_macros.h" #include "test_iterators.h" template @@ -44,4 +47,14 @@ test >(bidirectional_iterator(&d)); test >(random_access_iterator(&d)); test(&d); +#if TEST_STD_VER > 14 +{ +using BaseIter= std::move_iterator; +using DerivedIter = std::move_iterator; +constexpr const Derived *p = nullptr; +constexpr DerivedIter it1 = std::make_move_iterator(p); +constexpr BaseIterit2 = (BaseIter{nullptr} = it1); +static_assert(it2.base() == p, ""); +} +#endif } Index: test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp === --- test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp +++ test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp @@ -12,6 +12,8 @@ // move_iterator // reference operator*() const; +// +// constexpr in C++17 #include #include @@ -19,6 +21,8 @@ #include #endif +#include "test_macros.h" + class A { int data_; @@ -58,4 +62,15 @@ std::unique_ptr p(&i); test(&p, std::unique_ptr(&i)); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +#if TEST_STD_VER > 14 +{ +constexpr const char *p = "123456789"; +typedef std::move_iterator MI; +constexpr MI it1 = std::make_move_iterator(p); +constexpr MI it2 = std::make_move
[PATCH] D22712: Remove FileEntry copy-constructor
bkramer accepted this revision. bkramer added a comment. GCC 4.7 is dead. Go ahead if it compiles. https://reviews.llvm.org/D22712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D25817: [Sema] Improve the error diagnostic for dot destructor calls on pointer objects
On Thu, Oct 20, 2016 at 11:02 AM, David Blaikie wrote: > If we issue a fixit we should recover as-if the code was written with the > fixit in. Does this code do that? That's a good point; I don't think this patch does the fix. > (can we test it? I know we test some > fixits - not sure it's necessary/worthwhile to test them all, but maybe we > have a good idiom for testing that the recovery is correct) We have some fixit tests in the frontend. See test/FixIt/ ~Aaron > > On Thu, Oct 20, 2016 at 6:47 AM Aaron Ballman > wrote: >> >> aaron.ballman accepted this revision. >> aaron.ballman added a reviewer: aaron.ballman. >> aaron.ballman added a comment. >> This revision is now accepted and ready to land. >> >> LGTM >> >> >> >> >> Comment at: lib/Sema/SemaExprCXX.cpp:6287 >> +Context.hasSameUnqualifiedType(DestructedType, >> + ObjectType->getPointeeType())) >> { >> + Diag(OpLoc, diag::err_typecheck_member_reference_suggestion) >> >> You can elide the curly braces. >> >> >> Repository: >> rL LLVM >> >> https://reviews.llvm.org/D25817 >> >> >> > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r284732 - [Format] Cleanup after replacing constructor body with = default
Author: malcolm.parsons Date: Thu Oct 20 09:58:45 2016 New Revision: 284732 URL: http://llvm.org/viewvc/llvm-project?rev=284732&view=rev Log: [Format] Cleanup after replacing constructor body with = default Summary: Remove colon and commas after replacing constructor body with = default. Fix annotation of TT_CtorInitializerColon when preceded by a comment. Reviewers: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D25768 Modified: cfe/trunk/lib/Format/Format.cpp cfe/trunk/lib/Format/TokenAnnotator.cpp cfe/trunk/unittests/Format/CleanupTest.cpp Modified: cfe/trunk/lib/Format/Format.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=284732&r1=284731&r2=284732&view=diff == --- cfe/trunk/lib/Format/Format.cpp (original) +++ cfe/trunk/lib/Format/Format.cpp Thu Oct 20 09:58:45 2016 @@ -1024,6 +1024,7 @@ public: cleanupLeft(Line->First, tok::comma, tok::r_paren); cleanupLeft(Line->First, TT_CtorInitializerComma, tok::l_brace); cleanupLeft(Line->First, TT_CtorInitializerColon, tok::l_brace); +cleanupLeft(Line->First, TT_CtorInitializerColon, tok::equal); } } Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=284732&r1=284731&r2=284732&view=diff == --- cfe/trunk/lib/Format/TokenAnnotator.cpp (original) +++ cfe/trunk/lib/Format/TokenAnnotator.cpp Thu Oct 20 09:58:45 2016 @@ -520,7 +520,8 @@ private: Tok->Type = TT_BitFieldColon; } else if (Contexts.size() == 1 && !Line.First->isOneOf(tok::kw_enum, tok::kw_case)) { -if (Tok->Previous->isOneOf(tok::r_paren, tok::kw_noexcept)) +if (Tok->getPreviousNonComment()->isOneOf(tok::r_paren, + tok::kw_noexcept)) Tok->Type = TT_CtorInitializerColon; else Tok->Type = TT_InheritanceColon; Modified: cfe/trunk/unittests/Format/CleanupTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/CleanupTest.cpp?rev=284732&r1=284731&r2=284732&view=diff == --- cfe/trunk/unittests/Format/CleanupTest.cpp (original) +++ cfe/trunk/unittests/Format/CleanupTest.cpp Thu Oct 20 09:58:45 2016 @@ -151,6 +151,16 @@ TEST_F(CleanupTest, CtorInitializationSi EXPECT_EQ(Expected, cleanupAroundOffsets({15}, Code)); } +TEST_F(CleanupTest, CtorInitializationSimpleRedundantColon) { + std::string Code = "class A {\nA() : =default; };"; + std::string Expected = "class A {\nA() =default; };"; + EXPECT_EQ(Expected, cleanupAroundOffsets({15}, Code)); + + Code = "class A {\nA() : , =default; };"; + Expected = "class A {\nA() =default; };"; + EXPECT_EQ(Expected, cleanupAroundOffsets({15}, Code)); +} + TEST_F(CleanupTest, ListRedundantComma) { std::string Code = "void f() { std::vector v = {1,2,,,3,{4,5}}; }"; std::string Expected = "void f() { std::vector v = {1,2,3,{4,5}}; }"; @@ -239,6 +249,14 @@ TEST_F(CleanupTest, RemoveCommentsAround Code = "class A {\nA() : , // comment\n y(1),{} };"; Expected = "class A {\nA() : // comment\n y(1){} };"; EXPECT_EQ(Expected, cleanupAroundOffsets({17}, Code)); + + Code = "class A {\nA() // comment\n : ,,{} };"; + Expected = "class A {\nA() // comment\n {} };"; + EXPECT_EQ(Expected, cleanupAroundOffsets({30}, Code)); + + Code = "class A {\nA() // comment\n : ,,=default; };"; + Expected = "class A {\nA() // comment\n =default; };"; + EXPECT_EQ(Expected, cleanupAroundOffsets({30}, Code)); } TEST_F(CleanupTest, CtorInitializerInNamespace) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25768: [Format] Cleanup after replacing constructor body with = default
This revision was automatically updated to reflect the committed changes. Closed by commit rL284732: [Format] Cleanup after replacing constructor body with = default (authored by malcolm.parsons). Changed prior to commit: https://reviews.llvm.org/D25768?vs=75138&id=75299#toc Repository: rL LLVM https://reviews.llvm.org/D25768 Files: cfe/trunk/lib/Format/Format.cpp cfe/trunk/lib/Format/TokenAnnotator.cpp cfe/trunk/unittests/Format/CleanupTest.cpp Index: cfe/trunk/lib/Format/TokenAnnotator.cpp === --- cfe/trunk/lib/Format/TokenAnnotator.cpp +++ cfe/trunk/lib/Format/TokenAnnotator.cpp @@ -520,7 +520,8 @@ Tok->Type = TT_BitFieldColon; } else if (Contexts.size() == 1 && !Line.First->isOneOf(tok::kw_enum, tok::kw_case)) { -if (Tok->Previous->isOneOf(tok::r_paren, tok::kw_noexcept)) +if (Tok->getPreviousNonComment()->isOneOf(tok::r_paren, + tok::kw_noexcept)) Tok->Type = TT_CtorInitializerColon; else Tok->Type = TT_InheritanceColon; Index: cfe/trunk/lib/Format/Format.cpp === --- cfe/trunk/lib/Format/Format.cpp +++ cfe/trunk/lib/Format/Format.cpp @@ -1024,6 +1024,7 @@ cleanupLeft(Line->First, tok::comma, tok::r_paren); cleanupLeft(Line->First, TT_CtorInitializerComma, tok::l_brace); cleanupLeft(Line->First, TT_CtorInitializerColon, tok::l_brace); +cleanupLeft(Line->First, TT_CtorInitializerColon, tok::equal); } } Index: cfe/trunk/unittests/Format/CleanupTest.cpp === --- cfe/trunk/unittests/Format/CleanupTest.cpp +++ cfe/trunk/unittests/Format/CleanupTest.cpp @@ -151,6 +151,16 @@ EXPECT_EQ(Expected, cleanupAroundOffsets({15}, Code)); } +TEST_F(CleanupTest, CtorInitializationSimpleRedundantColon) { + std::string Code = "class A {\nA() : =default; };"; + std::string Expected = "class A {\nA() =default; };"; + EXPECT_EQ(Expected, cleanupAroundOffsets({15}, Code)); + + Code = "class A {\nA() : , =default; };"; + Expected = "class A {\nA() =default; };"; + EXPECT_EQ(Expected, cleanupAroundOffsets({15}, Code)); +} + TEST_F(CleanupTest, ListRedundantComma) { std::string Code = "void f() { std::vector v = {1,2,,,3,{4,5}}; }"; std::string Expected = "void f() { std::vector v = {1,2,3,{4,5}}; }"; @@ -239,6 +249,14 @@ Code = "class A {\nA() : , // comment\n y(1),{} };"; Expected = "class A {\nA() : // comment\n y(1){} };"; EXPECT_EQ(Expected, cleanupAroundOffsets({17}, Code)); + + Code = "class A {\nA() // comment\n : ,,{} };"; + Expected = "class A {\nA() // comment\n {} };"; + EXPECT_EQ(Expected, cleanupAroundOffsets({30}, Code)); + + Code = "class A {\nA() // comment\n : ,,=default; };"; + Expected = "class A {\nA() // comment\n =default; };"; + EXPECT_EQ(Expected, cleanupAroundOffsets({30}, Code)); } TEST_F(CleanupTest, CtorInitializerInNamespace) { Index: cfe/trunk/lib/Format/TokenAnnotator.cpp === --- cfe/trunk/lib/Format/TokenAnnotator.cpp +++ cfe/trunk/lib/Format/TokenAnnotator.cpp @@ -520,7 +520,8 @@ Tok->Type = TT_BitFieldColon; } else if (Contexts.size() == 1 && !Line.First->isOneOf(tok::kw_enum, tok::kw_case)) { -if (Tok->Previous->isOneOf(tok::r_paren, tok::kw_noexcept)) +if (Tok->getPreviousNonComment()->isOneOf(tok::r_paren, + tok::kw_noexcept)) Tok->Type = TT_CtorInitializerColon; else Tok->Type = TT_InheritanceColon; Index: cfe/trunk/lib/Format/Format.cpp === --- cfe/trunk/lib/Format/Format.cpp +++ cfe/trunk/lib/Format/Format.cpp @@ -1024,6 +1024,7 @@ cleanupLeft(Line->First, tok::comma, tok::r_paren); cleanupLeft(Line->First, TT_CtorInitializerComma, tok::l_brace); cleanupLeft(Line->First, TT_CtorInitializerColon, tok::l_brace); +cleanupLeft(Line->First, TT_CtorInitializerColon, tok::equal); } } Index: cfe/trunk/unittests/Format/CleanupTest.cpp === --- cfe/trunk/unittests/Format/CleanupTest.cpp +++ cfe/trunk/unittests/Format/CleanupTest.cpp @@ -151,6 +151,16 @@ EXPECT_EQ(Expected, cleanupAroundOffsets({15}, Code)); } +TEST_F(CleanupTest, CtorInitializationSimpleRedundantColon) { + std::string Code = "class A {\nA() : =default; };"; + std::string Expected = "class A {\nA() =default; };"; + EXPECT_EQ(Expected, cleanupAroundOffsets({15}, Code)); + + Code = "class A {\nA() : , =default; };"; + Expected = "class A {\nA() =default; };"; + EXPECT_EQ(Expected, cleanupAroundOffsets({15}, Code)); +} + TEST_F(CleanupT
[libcxx] r284731 - Adding a missing constexpr test for reverse_iterator operator[].
Author: marshall Date: Thu Oct 20 09:57:34 2016 New Revision: 284731 URL: http://llvm.org/viewvc/llvm-project?rev=284731&view=rev Log: Adding a missing constexpr test for reverse_iterator operator[]. Modified: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opindex/difference_type.pass.cpp Modified: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opindex/difference_type.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opindex/difference_type.pass.cpp?rev=284731&r1=284730&r2=284731&view=diff == --- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opindex/difference_type.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opindex/difference_type.pass.cpp Thu Oct 20 09:57:34 2016 @@ -17,6 +17,7 @@ #include #include +#include "test_macros.h" #include "test_iterators.h" template @@ -35,4 +36,14 @@ int main() const char* s = "1234567890"; test(random_access_iterator(s+5), 4, '1'); test(s+5, 4, '1'); + +#if TEST_STD_VER > 14 +{ +constexpr const char *p = "123456789"; +typedef std::reverse_iterator RI; +constexpr RI it1 = std::make_reverse_iterator(p + 5); +static_assert(it1[0] == '5', ""); +static_assert(it1[4] == '1', ""); +} +#endif } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D22712: Remove FileEntry copy-constructor
alexshap added a comment. i see, thanks. So do i understand correctly that we can proceed with this patch ? https://reviews.llvm.org/D22712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D22712: Remove FileEntry copy-constructor
vsk added a comment. I believe gcc 4.7 and msvc 2013 are now unsupported (see e.g r284729). https://reviews.llvm.org/D22712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D25817: [Sema] Improve the error diagnostic for dot destructor calls on pointer objects
If we issue a fixit we should recover as-if the code was written with the fixit in. Does this code do that? (can we test it? I know we test some fixits - not sure it's necessary/worthwhile to test them all, but maybe we have a good idiom for testing that the recovery is correct) On Thu, Oct 20, 2016 at 6:47 AM Aaron Ballman wrote: > aaron.ballman accepted this revision. > aaron.ballman added a reviewer: aaron.ballman. > aaron.ballman added a comment. > This revision is now accepted and ready to land. > > LGTM > > > > > Comment at: lib/Sema/SemaExprCXX.cpp:6287 > +Context.hasSameUnqualifiedType(DestructedType, > + ObjectType->getPointeeType())) > { > + Diag(OpLoc, diag::err_typecheck_member_reference_suggestion) > > You can elide the curly braces. > > > Repository: > rL LLVM > > https://reviews.llvm.org/D25817 > > > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25820: [Sema][Objective-C] Formatting warnings should see through Objective-C message sends
aaron.ballman added inline comments. Comment at: test/SemaObjC/format-strings-objc.m:299 + NSLog([self str: @"%@ %@"], @"name"); // expected-warning {{more '%' conversions than data arguments}} +} + Can you add an example showing a positive use case as well? Repository: rL LLVM https://reviews.llvm.org/D25820 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r284730 - Retire llvm::alignOf in favor of C++11 alignof.
Author: d0k Date: Thu Oct 20 09:27:22 2016 New Revision: 284730 URL: http://llvm.org/viewvc/llvm-project?rev=284730&view=rev Log: Retire llvm::alignOf in favor of C++11 alignof. No functionality change intended. Modified: cfe/trunk/include/clang/AST/ASTContext.h cfe/trunk/include/clang/AST/ASTVector.h cfe/trunk/include/clang/AST/Stmt.h cfe/trunk/include/clang/AST/StmtOpenMP.h cfe/trunk/include/clang/AST/TypeLoc.h cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyUtil.h cfe/trunk/include/clang/Basic/SourceManager.h cfe/trunk/include/clang/Sema/Overload.h cfe/trunk/lib/AST/ASTContext.cpp cfe/trunk/lib/AST/DeclBase.cpp cfe/trunk/lib/AST/DeclCXX.cpp cfe/trunk/lib/AST/DeclGroup.cpp cfe/trunk/lib/AST/DeclObjC.cpp cfe/trunk/lib/AST/DeclTemplate.cpp cfe/trunk/lib/AST/Expr.cpp cfe/trunk/lib/AST/ExprCXX.cpp cfe/trunk/lib/AST/ExprObjC.cpp cfe/trunk/lib/AST/NestedNameSpecifier.cpp cfe/trunk/lib/AST/Stmt.cpp cfe/trunk/lib/AST/StmtCXX.cpp cfe/trunk/lib/AST/StmtObjC.cpp cfe/trunk/lib/AST/StmtOpenMP.cpp cfe/trunk/lib/AST/TemplateBase.cpp cfe/trunk/lib/AST/TypeLoc.cpp cfe/trunk/lib/Analysis/CFG.cpp cfe/trunk/lib/Basic/IdentifierTable.cpp cfe/trunk/lib/CodeGen/CGCleanup.cpp cfe/trunk/lib/CodeGen/CGCleanup.h cfe/trunk/lib/CodeGen/CodeGenFunction.h cfe/trunk/lib/CodeGen/EHScopeStack.h cfe/trunk/lib/Lex/MacroInfo.cpp cfe/trunk/lib/Lex/PPDirectives.cpp cfe/trunk/lib/Lex/PreprocessingRecord.cpp cfe/trunk/lib/Sema/AttributeList.cpp cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp cfe/trunk/lib/Sema/TypeLocBuilder.h Modified: cfe/trunk/include/clang/AST/ASTContext.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=284730&r1=284729&r2=284730&view=diff == --- cfe/trunk/include/clang/AST/ASTContext.h (original) +++ cfe/trunk/include/clang/AST/ASTContext.h Thu Oct 20 09:27:22 2016 @@ -582,7 +582,7 @@ public: return BumpAlloc.Allocate(Size, Align); } template T *Allocate(size_t Num = 1) const { -return static_cast(Allocate(Num * sizeof(T), llvm::alignOf())); +return static_cast(Allocate(Num * sizeof(T), alignof(T))); } void Deallocate(void *Ptr) const { } Modified: cfe/trunk/include/clang/AST/ASTVector.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTVector.h?rev=284730&r1=284729&r2=284730&view=diff == --- cfe/trunk/include/clang/AST/ASTVector.h (original) +++ cfe/trunk/include/clang/AST/ASTVector.h Thu Oct 20 09:27:22 2016 @@ -380,7 +380,7 @@ void ASTVector::grow(const ASTContext NewCapacity = MinSize; // Allocate the memory from the ASTContext. - T *NewElts = new (C, llvm::alignOf()) T[NewCapacity]; + T *NewElts = new (C, alignof(T)) T[NewCapacity]; // Copy the elements over. if (Begin != End) { Modified: cfe/trunk/include/clang/AST/Stmt.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=284730&r1=284729&r2=284730&view=diff == --- cfe/trunk/include/clang/AST/Stmt.h (original) +++ cfe/trunk/include/clang/AST/Stmt.h Thu Oct 20 09:27:22 2016 @@ -340,7 +340,7 @@ protected: public: Stmt(StmtClass SC) { -static_assert(sizeof(*this) % llvm::AlignOf::Alignment == 0, +static_assert(sizeof(*this) % alignof(void *) == 0, "Insufficient alignment!"); StmtBits.sClass = SC; if (StatisticsEnabled) Stmt::addStmtClass(SC); Modified: cfe/trunk/include/clang/AST/StmtOpenMP.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtOpenMP.h?rev=284730&r1=284729&r2=284730&view=diff == --- cfe/trunk/include/clang/AST/StmtOpenMP.h (original) +++ cfe/trunk/include/clang/AST/StmtOpenMP.h Thu Oct 20 09:27:22 2016 @@ -70,7 +70,7 @@ protected: : Stmt(SC), Kind(K), StartLoc(std::move(StartLoc)), EndLoc(std::move(EndLoc)), NumClauses(NumClauses), NumChildren(NumChildren), -ClausesOffset(llvm::alignTo(sizeof(T), llvm::alignOf())) {} +ClausesOffset(llvm::alignTo(sizeof(T), alignof(OMPClause *))) {} /// \brief Sets the list of variables for this clause. /// Modified: cfe/trunk/include/clang/AST/TypeLoc.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TypeLoc.h?rev=284730&r1=284729&r2=284730&view=diff == --- cfe/trunk/include/clang/AST/TypeLoc.h (original) +++ cfe/trunk/include/clang/AST/TypeLoc.h Thu Oct 20 09:27:22 2016 @@ -347,7 +347,7 @@ class ConcreteTypeLoc : public Base { public: unsigned getLocalDataAlignment() const
[PATCH] D22712: Remove FileEntry copy-constructor
alexshap added a comment. @bkramer ? https://reviews.llvm.org/D22712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r284729 - Clean up alignment hacks now that MSVC 2013 and GCC 4.7 are gone.
Author: d0k Date: Thu Oct 20 08:52:26 2016 New Revision: 284729 URL: http://llvm.org/viewvc/llvm-project?rev=284729&view=rev Log: Clean up alignment hacks now that MSVC 2013 and GCC 4.7 are gone. Modified: cfe/trunk/include/clang/AST/Stmt.h cfe/trunk/include/clang/AST/TemplateBase.h cfe/trunk/include/clang/Sema/DeclSpec.h cfe/trunk/include/clang/Sema/TemplateDeduction.h Modified: cfe/trunk/include/clang/AST/Stmt.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=284729&r1=284728&r2=284729&view=diff == --- cfe/trunk/include/clang/AST/Stmt.h (original) +++ cfe/trunk/include/clang/AST/Stmt.h Thu Oct 20 08:52:26 2016 @@ -56,7 +56,7 @@ namespace clang { /// Stmt - This represents one statement. /// -class LLVM_ALIGNAS(LLVM_PTR_SIZE) Stmt { +class alignas(void *) Stmt { public: enum StmtClass { NoStmtClass = 0, Modified: cfe/trunk/include/clang/AST/TemplateBase.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TemplateBase.h?rev=284729&r1=284728&r2=284729&view=diff == --- cfe/trunk/include/clang/AST/TemplateBase.h (original) +++ cfe/trunk/include/clang/AST/TemplateBase.h Thu Oct 20 08:52:26 2016 @@ -607,7 +607,7 @@ public: /// as such, doesn't contain the array of TemplateArgumentLoc itself, /// but expects the containing object to also provide storage for /// that. -struct LLVM_ALIGNAS(LLVM_PTR_SIZE) ASTTemplateKWAndArgsInfo { +struct alignas(void *) ASTTemplateKWAndArgsInfo { /// \brief The source location of the left angle bracket ('<'). SourceLocation LAngleLoc; Modified: cfe/trunk/include/clang/Sema/DeclSpec.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/DeclSpec.h?rev=284729&r1=284728&r2=284729&view=diff == --- cfe/trunk/include/clang/Sema/DeclSpec.h (original) +++ cfe/trunk/include/clang/Sema/DeclSpec.h Thu Oct 20 08:52:26 2016 @@ -1417,15 +1417,12 @@ struct DeclaratorChunk { unsigned TypeQuals : 5; // CXXScopeSpec has a constructor, so it can't be a direct member. // So we need some pointer-aligned storage and a bit of trickery. -union { - void *Aligner; - char Mem[sizeof(CXXScopeSpec)]; -} ScopeMem; +alignas(CXXScopeSpec) char ScopeMem[sizeof(CXXScopeSpec)]; CXXScopeSpec &Scope() { - return *reinterpret_cast(ScopeMem.Mem); + return *reinterpret_cast(ScopeMem); } const CXXScopeSpec &Scope() const { - return *reinterpret_cast(ScopeMem.Mem); + return *reinterpret_cast(ScopeMem); } void destroy() { Scope().~CXXScopeSpec(); @@ -1580,7 +1577,7 @@ struct DeclaratorChunk { I.EndLoc= Loc; I.Mem.TypeQuals = TypeQuals; I.Mem.AttrList = nullptr; -new (I.Mem.ScopeMem.Mem) CXXScopeSpec(SS); +new (I.Mem.ScopeMem) CXXScopeSpec(SS); return I; } Modified: cfe/trunk/include/clang/Sema/TemplateDeduction.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/TemplateDeduction.h?rev=284729&r1=284728&r2=284729&view=diff == --- cfe/trunk/include/clang/Sema/TemplateDeduction.h (original) +++ cfe/trunk/include/clang/Sema/TemplateDeduction.h Thu Oct 20 08:52:26 2016 @@ -199,10 +199,7 @@ struct DeductionFailureInfo { void *Data; /// \brief A diagnostic indicating why deduction failed. - union { -void *Align; -char Diagnostic[sizeof(PartialDiagnosticAt)]; - }; + alignas(PartialDiagnosticAt) char Diagnostic[sizeof(PartialDiagnosticAt)]; /// \brief Retrieve the diagnostic which caused this deduction failure, /// if any. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25769: [clang-tidy] Simplify modernize-use-default
ioeric accepted this revision. ioeric added inline comments. Comment at: test/clang-tidy/modernize-use-default-copy.cpp:85 + // CHECK-MESSAGES: :[[@LINE-2]]:3: warning: use '= default' + // CHECK-FIXES: /* don't delete */ = default; int Field; malcolm.parsons wrote: > I don't know why cleanup removes this comment, but there are format units > tests that check that it does. This is intended behavior of `cleanup`. Generally, if a deleted code results in a redundant token around it, comments between the redundant token and its previous/next token (ignoring the deleted code) are considered belonging to the deleted code. Considering how a normal developer writes code, this would be correct most of the time IMO. https://reviews.llvm.org/D25769 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25817: [Sema] Improve the error diagnostic for dot destructor calls on pointer objects
aaron.ballman accepted this revision. aaron.ballman added a reviewer: aaron.ballman. aaron.ballman added a comment. This revision is now accepted and ready to land. LGTM Comment at: lib/Sema/SemaExprCXX.cpp:6287 +Context.hasSameUnqualifiedType(DestructedType, + ObjectType->getPointeeType())) { + Diag(OpLoc, diag::err_typecheck_member_reference_suggestion) You can elide the curly braces. Repository: rL LLVM https://reviews.llvm.org/D25817 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25811: [libcxx] Fix toupper/tolower tests for UTF-8 locale
kparzysz updated this revision to Diff 75292. kparzysz added a comment. Unxfail these tests on Linux. Repository: rL LLVM https://reviews.llvm.org/D25811 Files: test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp Index: test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp === --- test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp +++ test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp @@ -17,7 +17,6 @@ // XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 -// XFAIL: linux #include #include @@ -35,7 +34,7 @@ std::string in("\xFA A\x07.a1"); assert(f.toupper(&in[0], in.data() + in.size()) == in.data() + in.size()); -assert(in[0] == '\xDA'); +assert(in[0] == '\xFA'); assert(in[1] == ' '); assert(in[2] == 'A'); assert(in[3] == '\x07'); Index: test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp === --- test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp +++ test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp @@ -17,7 +17,6 @@ // XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 -// XFAIL: linux #include #include @@ -39,7 +38,7 @@ assert(f.toupper('a') == 'A'); assert(f.toupper('1') == '1'); assert(f.toupper('\xDA') == '\xDA'); -assert(f.toupper('\xFA') == '\xDA'); +assert(f.toupper('\xFA') == '\xFA'); } } { Index: test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp === --- test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp +++ test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp @@ -17,7 +17,6 @@ // XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 -// XFAIL: linux #include #include @@ -35,7 +34,7 @@ std::string in("\xDA A\x07.a1"); assert(f.tolower(&in[0], in.data() + in.size()) == in.data() + in.size()); -assert(in[0] == '\xFA'); +assert(in[0] == '\xDA'); assert(in[1] == ' '); assert(in[2] == 'a'); assert(in[3] == '\x07'); Index: test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp === --- test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp +++ test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp @@ -17,7 +17,6 @@ // XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 -// XFAIL: linux #include #include @@ -38,7 +37,7 @@ assert(f.tolower('.') == '.'); assert(f.tolower('a') == 'a'); assert(f.tolower('1') == '1'); -assert(f.tolower('\xDA') == '\xFA'); +assert(f.tolower('\xDA') == '\xDA'); assert(f.tolower('\xFA') == '\xFA'); } } Index: test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp === --- test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp +++ test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp @@ -17,7 +17,6 @@ // XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 -// XFAIL: linux #include #include @@ -35,7 +34,7 @@ std::string in("\xFA A\x07.a1"); assert(f.toupper(&in[0], in.data() + in.size()) == in.data() + in.size()); -assert(in[0] == '\xDA'); +assert(in[0] == '\xFA'); assert(in[1] == ' '); assert(in[2] == 'A'); assert(in[3] == '\x07'); Index: test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp ==
[PATCH] D25769: [clang-tidy] Simplify modernize-use-default
djasper accepted this revision. djasper added a reviewer: djasper. djasper added a comment. I don't know whether it is an intentional choice to remove this comment. I'd be fine either way (I think there are arguments for and against it). So, this looks good to me. But maybe Eric has something to add. https://reviews.llvm.org/D25769 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25811: [libcxx] Fix toupper/tolower tests for UTF-8 locale
kparzysz added a comment. In https://reviews.llvm.org/D25811#575105, @EricWF wrote: > Seems like we should figure out why these pass on ToT OS X. All of them have // XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 Maybe that's it. I don't have access to OS X, so I can't test it there. Repository: rL LLVM https://reviews.llvm.org/D25811 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25363: [Sema] Store a SourceRange for multi-token builtin types
aaron.ballman added inline comments. Comment at: include/clang/AST/TypeLoc.h:533 +} else { + BuiltinRange.setBegin(std::min(Range.getBegin(), BuiltinRange.getBegin())); + BuiltinRange.setEnd(std::max(Range.getEnd(), BuiltinRange.getEnd())); malcolm.parsons wrote: > I suspect that using `min` and `max` on `SourceLocation`s is only valid if > both locations are in the same file. > > Doing this > long.h: > ``` > long > ``` > unsigned.cpp: > ``` > unsigned > #include "long.h" > i; > ``` > > causes > clang-query> match typeLoc() > ... > clang-query: llvm/tools/clang/lib/Frontend/DiagnosticRenderer.cpp:273: > clang::SourceLocation retrieveMacroLocation(clang::SourceLocation, > clang::FileID, clang::FileID, const llvm::SmallVectorImpl&, > bool, const clang::SourceManager*): Assertion `SM->getFileID(Loc) == > MacroFileID' failed. > > Is there a better way to combine `SourceRange`s, or should the final range be > accumulated in DeclSpec.cpp? Hmm, that's a good point, but I'm not aware of a better utility. Perhaps @rsmith knows of one? https://reviews.llvm.org/D25363 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25769: [clang-tidy] Simplify modernize-use-default
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. LGTM with a small nit, but you may want to wait for @djasper to weigh in on the removed comment question. Comment at: clang-tidy/modernize/UseDefaultCheck.cpp:266 // If there are constructor initializers, they must be removed. - if (Ctor->getNumCtorInitializers() != 0) { -StartLoc = getColonLoc(Result.Context, Ctor); -if (!StartLoc.isValid()) - return; + for (const CXXCtorInitializer *Init : Ctor->inits()) { +RemoveInitializers.emplace_back( You can use `const auto *` here. https://reviews.llvm.org/D25769 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25816: Use descriptive message if list initializer is incorrectly parenthesized.
arphaman added a comment. Thanks for working on this! I have a couple of comments: Comment at: include/clang/Basic/DiagnosticSemaKinds.td:1762 def err_init_incomplete_type : Error<"initialization of incomplete type %0">; +def err_list_init_in_parens : Error<"list-initializer for non-class type " + "must not be parenthesized">; Wouldn't it be better if we had a diagnostic with the type information? So, instead of showing `list-initializer for non-class type must not be parenthesized` clang would show `list-initializer for non-class type 'int' must not be parenthesized`. What do you think? As well as that, it seems that GCC issues a warning instead of an error for this diagnostic, so should this be a warning in clang as well? Comment at: include/clang/Sema/Sema.h:1802 void ActOnInitializerError(Decl *Dcl); + bool cannotBeInitializededByParenthzedList(QualType TargetType); void ActOnPureSpecifier(Decl *D, SourceLocation PureSpecLoc); I think you mean `parenthesized` instead of `parenthzed` here. As well as that, I think that it would be better to use a name without the `not`, something like `canInitializeWithParenthesizedList`. Also, please add a comment that explains what this method does. Comment at: include/clang/Sema/Sema.h:1803 + bool cannotBeInitializededByParenthzedList(QualType TargetType); void ActOnPureSpecifier(Decl *D, SourceLocation PureSpecLoc); void ActOnCXXForRangeDecl(Decl *D); Please add a blank line here to separate unrelated `Act...` methods from the new method. Comment at: lib/Sema/SemaDecl.cpp:9796 +Diag(VDecl->getLocation(), diag::err_list_init_in_parens) + << CXXDirectInit->getSourceRange() + << FixItHint::CreateRemoval(CXXDirectInit->getLocStart()) Slight formatting issue: please indent the three lines that start with '<<' using 4 extra spaces instead of 2 (just like you did in your changes for SemaExprCXX.cpp). Comment at: lib/Sema/SemaDecl.cpp:10110 +bool Sema::cannotBeInitializededByParenthzedList(QualType TargetType) { + return !TargetType->isDependentType() && !TargetType->isRecordType() && + !TargetType->getContainedAutoType(); If you change the name as I suggested to something like `canInitializeWithParenthesizedList` then the logic here would have to be inverted: `TargetType()->isDependentType() || TargetType()->isRecordType() || TargetType()->getContainedAutoType()`. Consequently, the call sites will have to be updated to include a `!` before the call. Comment at: lib/Sema/SemaExprCXX.cpp:1229 + Diag(TInfo->getTypeLoc().getLocStart(), diag::err_list_init_in_parens) + << IList->getSourceRange() + << FixItHint::CreateRemoval(LParenLoc) Formatting issue: clang-format replaces ``` << IList->getSourceRange() << FixItHint::CreateRemoval(LParenLoc) ``` with ``` << IList->getSourceRange() << FixItHint::CreateRemoval(LParenLoc) ``` Comment at: test/SemaCXX/cxx0x-initializer-scalars.cpp:96 +(void) int({0}); // expected-error {{list-initializer for non-class type must not be parenthesized}} +new int({0}); // expected-error {{list-initializer for non-class type must not be parenthesized}} } Please add a test case for a pointer type as well, something like this should work: ``` int *x({0}); ``` As well as that, please add a test for a dependent type. https://reviews.llvm.org/D25816 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits