Re: [PATCH] D19451: [clang-tidy] New checker for redundant expressions.
Eugene.Zelenko added a subscriber: Eugene.Zelenko. Eugene.Zelenko added a comment. Please mention this check in docs/ReleaseNotes.rst (in alphabetical order). Will check catch more complicated cases, like if ((Point1.x < Point2.x) && (Point1.x < Point2.x)) ? Will be good idea to add such cases in test. http://reviews.llvm.org/D19451 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r267287 - Rename a few tests that had typos in their names. No functional change. Thanks to STL for the catch
Author: marshall Date: Sat Apr 23 09:31:00 2016 New Revision: 267287 URL: http://llvm.org/viewvc/llvm-project?rev=267287&view=rev Log: Rename a few tests that had typos in their names. No functional change. Thanks to STL for the catch Added: libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/narrow.pass.cpp - copied unchanged from r267282, libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/narow.pass.cpp libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream_delim.pass.cpp - copied unchanged from r267282, libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream_delem.pass.cpp libcxx/trunk/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp - copied unchanged from r267282, libcxx/trunk/test/std/utilities/memory/storage.iterator/raw_storag_iterator.base.pass.cpp libcxx/trunk/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp - copied unchanged from r267282, libcxx/trunk/test/std/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp Removed: libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/narow.pass.cpp libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream_delem.pass.cpp libcxx/trunk/test/std/utilities/memory/storage.iterator/raw_storag_iterator.base.pass.cpp libcxx/trunk/test/std/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp Removed: libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/narow.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/narow.pass.cpp?rev=267286&view=auto == --- libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/narow.pass.cpp (original) +++ libcxx/trunk/test/std/input.output/iostreams.base/ios/basic.ios.members/narow.pass.cpp (removed) @@ -1,24 +0,0 @@ -//===--===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===--===// - -// - -// template class basic_ios - -// char narrow(char_type c, char dfault) const; - -#include -#include - -int main() -{ -const std::ios ios(0); -assert(ios.narrow('c', '*') == 'c'); -assert(ios.narrow('\xFE', '*') == '*'); -} Removed: libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream_delem.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream_delem.pass.cpp?rev=267286&view=auto == --- libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream_delem.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream_delem.pass.cpp (removed) @@ -1,32 +0,0 @@ -//===--===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===--===// - -// - -// class ostream_iterator - -// ostream_iterator(ostream_type& s, const charT* delimiter); - -#include -#include -#include - -int main() -{ -{ -std::ostringstream outf; -std::ostream_iterator i(outf, ", "); -assert(outf.good()); -} -{ -std::wostringstream outf; -std::ostream_iterator i(outf, L", "); -assert(outf.good()); -} -} Removed: libcxx/trunk/test/std/utilities/memory/storage.iterator/raw_storag_iterator.base.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/storage.iterator/raw_storag_iterator.base.pass.cpp?rev=267286&view=auto == --- libcxx/trunk/test/std/utilities/memory/storage.iterator/raw_storag_iterator.base.pass.cpp (original) +++ libcxx/trunk/test/std/utilities/memory/storage.iterator/raw_storag_iterator.base.pass.cpp (removed) @@ -1,48 +0,0 @@ -//===--===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. Se
[clang-tools-extra] r267290 - clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp: Use raw_string_ostream::str() to flush the buffer explicitly.
Author: chapuni Date: Sat Apr 23 09:54:28 2016 New Revision: 267290 URL: http://llvm.org/viewvc/llvm-project?rev=267290&view=rev Log: clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp: Use raw_string_ostream::str() to flush the buffer explicitly. Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp?rev=267290&r1=267289&r2=267290&view=diff == --- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp Sat Apr 23 09:54:28 2016 @@ -145,7 +145,7 @@ struct IntializerInsertion { Stream << ", " << joined << "()"; break; } -return Code; +return Stream.str(); } InitializerPlacement Placement; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D18584: Complete support for C++ Core Guidelines Type.6: Always initialize a member variable.
chapuni added a subscriber: chapuni. chapuni added a comment. This had been failing. Fixed in r267290. See also http://bb.pgr.jp/builders/msbuild-llvmclang-x64-msc19-DA/builds/349 Comment at: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp:120 @@ -119,3 @@ -} -Stream.flush(); -// The initializer list is created, replace leading comma with colon. raw_string_ostream cannot be assumed as unbuffered, nor would be flushed by the destructor before Code copied to return value. Repository: rL LLVM http://reviews.llvm.org/D18584 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19194: fix for clang-tidy modernize-pass-by-value on copy constructor
Kessoufi updated this revision to Diff 54762. Kessoufi added a comment. - my previous fix was applied on the wrong location and accidentally worked. now applied on the right location - previous tests still pass - added a specific test to highlight my issue http://reviews.llvm.org/D19194 Files: clang-tidy/modernize/PassByValueCheck.cpp test/clang-tidy/modernize-pass-by-value.cpp Index: test/clang-tidy/modernize-pass-by-value.cpp === --- test/clang-tidy/modernize-pass-by-value.cpp +++ test/clang-tidy/modernize-pass-by-value.cpp @@ -194,3 +194,12 @@ Movable M; }; +// Test exclusion of copy constructors +// allowing modernize-pass-by-value on copy constructors causes: +// - compiler error: copy constructor must pass its first argument by +//reference +// - conflict when applying replacement for both modernize-pass-by-value and +//modernize-use-default +struct T { +T(const T&) {} +}; Index: clang-tidy/modernize/PassByValueCheck.cpp === --- clang-tidy/modernize/PassByValueCheck.cpp +++ clang-tidy/modernize/PassByValueCheck.cpp @@ -151,7 +151,8 @@ isCopyConstructor(), unless(isDeleted()), hasDeclContext( cxxRecordDecl(isMoveConstructible( -.bind("Initializer"))) +.bind("Initializer")), + unless(isCopyConstructor())) .bind("Ctor"), this); } Index: test/clang-tidy/modernize-pass-by-value.cpp === --- test/clang-tidy/modernize-pass-by-value.cpp +++ test/clang-tidy/modernize-pass-by-value.cpp @@ -194,3 +194,12 @@ Movable M; }; +// Test exclusion of copy constructors +// allowing modernize-pass-by-value on copy constructors causes: +// - compiler error: copy constructor must pass its first argument by +//reference +// - conflict when applying replacement for both modernize-pass-by-value and +//modernize-use-default +struct T { +T(const T&) {} +}; Index: clang-tidy/modernize/PassByValueCheck.cpp === --- clang-tidy/modernize/PassByValueCheck.cpp +++ clang-tidy/modernize/PassByValueCheck.cpp @@ -151,7 +151,8 @@ isCopyConstructor(), unless(isDeleted()), hasDeclContext( cxxRecordDecl(isMoveConstructible( -.bind("Initializer"))) +.bind("Initializer")), + unless(isCopyConstructor())) .bind("Ctor"), this); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19451: [clang-tidy] New checker for redundant expressions.
etienneb added a comment. In http://reviews.llvm.org/D19451#410014, @Eugene.Zelenko wrote: > Please mention this check in docs/ReleaseNotes.rst (in alphabetical order). > > Will check catch more complicated cases, like > > if ((Point1.x < Point2.x) && (Point1.x < Point2.x)) ? It is catching these cases. > Will be good idea to add such cases in test. I can add it as a test, no prob. I'm never against more tests. I have more cases implemented, but I prefer landing this piece by piece to let people review it and report false-positive. I'm able to recognize stuff like: x == 10 && x <= 12 (x <= 12 is redundant), and many other cases with bitwise operations. I need time to deal correctly with False positives. And, I'm not sure it will be part of the same matcher. Will see.. http://reviews.llvm.org/D19451 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19451: [clang-tidy] New checker for redundant expressions.
etienneb added a comment. > Will check catch more complicated cases, like [..] It is not "yet" catching these cases: if ((Point2.x > Point1.x) && (Point1.x < Point2.x)) ? I believe the AreEquivalentExpression should be extended, and probably llifted to utils. Here again, I propose to do it incrementally. An other nice extension is to catch cases like: (x | y | x) In this case, you need to implement the associative operators. http://reviews.llvm.org/D19451 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19451: [clang-tidy] New checker for redundant expressions.
etienneb updated this revision to Diff 54785. etienneb added a comment. addressed eugene requests. http://reviews.llvm.org/D19451 Files: clang-tidy/misc/CMakeLists.txt clang-tidy/misc/MiscTidyModule.cpp clang-tidy/misc/RedundantExpressionCheck.cpp clang-tidy/misc/RedundantExpressionCheck.h docs/ReleaseNotes.rst docs/clang-tidy/checks/list.rst docs/clang-tidy/checks/misc-redundant-expression.rst test/clang-tidy/misc-redundant-expression.cpp Index: test/clang-tidy/misc-redundant-expression.cpp === --- /dev/null +++ test/clang-tidy/misc-redundant-expression.cpp @@ -0,0 +1,120 @@ +// RUN: %check_clang_tidy %s misc-redundant-expression %t + +struct Point { + int x; + int y; + int a[5]; +} P; + +extern Point P1; +extern Point P2; + +extern int foo(int x); +extern int bar(int x); +extern int bat(int x, int y); + +int Test(int X, int Y) { + if (X - X) return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: both side of operator are equivalent [misc-redundant-expression] + if (X / X) return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: both side of operator are equivalent + if (X % X) return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: both side of operator are equivalent + + if (X & X) return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: both side of operator are equivalent + if (X | X) return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: both side of operator are equivalent + if (X ^ X) return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: both side of operator are equivalent + + if (X < X) return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: both side of operator are equivalent + if (X <= X) return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: both side of operator are equivalent + if (X > X) return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: both side of operator are equivalent + if (X >= X) return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: both side of operator are equivalent + + if (X && X) return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: both side of operator are equivalent + if (X || X) return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: both side of operator are equivalent + + if (X != (((X return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: both side of operator are equivalent + + if (X + 1 == X + 1) return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: both side of operator are equivalent + if (X + 1 != X + 1) return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: both side of operator are equivalent + if (X + 1 <= X + 1) return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: both side of operator are equivalent + if (X + 1 >= X + 1) return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: both side of operator are equivalent + + if ((X != 1 || Y != 1) && (X != 1 || Y != 1)) return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: both side of operator are equivalent + if (P.a[X - P.x] != P.a[X - P.x]) return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: both side of operator are equivalent + + if ((int)X < (int)X) return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: both side of operator are equivalent + + if ( + "dummy" == + "dummy") return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: both side of operator are equivalent + if (L"abc" == L"abc") return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: both side of operator are equivalent + + if (foo(0) - 2 < foo(0) - 2) return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: both side of operator are equivalent + if (foo(bar(0)) < (foo(bar((0) return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:19: warning: both side of operator are equivalent + + if (P1.x < P2.x && P1.x < P2.x) return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:19: warning: both side of operator are equivalent + if (P2.a[P1.x + 2] < P2.x && P2.a[(P1.x) + (2)] < (P2.x)) return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: both side of operator are equivalent + + return 0; +} + +int Valid(int X, int Y) { + if (X != Y) return 1; + if (X == X + 0) return 1; + if (P.x == P.y) return 1; + if (P.a[P.x] < P.a[P.y]) return 1; + if (P.a[0] < P.a[1]) return 1; + + if (P.a[0] < P.a[0ULL]) return 1; + if (0 < 0ULL) return 1; + if ((int)0 < (int)0ULL) return 1; + + if (++X != ++X) return 1; + if (P.a[X]++ != P.a[X]++) return 1; + if (P.a[X++] != P.a[X++]) return 1; + + if ("abc" == "ABC") return 1; + if (foo(bar(0)) < (foo(bat(0, 1 return 1; + return 0; +} + +#define LT(x, y) (void)((x) < (y)) + +int TestMacro(int X, int Y) { + LT(0, 0); + LT(1, 0); + LT(X, X); + LT(X+1, X + 1); +} + +int TestFalsePositive(int* A, int X, float F) { + // Produced by bison. + X = A[(2) - (2)]; + X = A['a' - 'a']; + + // Testing NaN. + if (F != F && F == F) return 1; + return 0; +} Index: docs/clang-tidy/checks/misc-redundant-expression.rst
[PATCH] D19459: Cleanup redundant expression in InstCombineAndOrXor.
etienneb created this revision. etienneb added a reviewer: rnk. etienneb added a subscriber: cfe-commits. The expression is redundant on both side of operator |. detected by : http://reviews.llvm.org/D19451 http://reviews.llvm.org/D19459 Files: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Index: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp === --- lib/Transforms/InstCombine/InstCombineAndOrXor.cpp +++ lib/Transforms/InstCombine/InstCombineAndOrXor.cpp @@ -465,11 +465,9 @@ if (CCst && CCst->isZero()) { // if C is zero, then both A and B qualify as mask result |= (icmp_eq ? (FoldMskICmp_Mask_AllZeroes | - FoldMskICmp_Mask_AllZeroes | FoldMskICmp_AMask_Mixed | FoldMskICmp_BMask_Mixed) : (FoldMskICmp_Mask_NotAllZeroes | - FoldMskICmp_Mask_NotAllZeroes | FoldMskICmp_AMask_NotMixed | FoldMskICmp_BMask_NotMixed)); if (icmp_abit) Index: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp === --- lib/Transforms/InstCombine/InstCombineAndOrXor.cpp +++ lib/Transforms/InstCombine/InstCombineAndOrXor.cpp @@ -465,11 +465,9 @@ if (CCst && CCst->isZero()) { // if C is zero, then both A and B qualify as mask result |= (icmp_eq ? (FoldMskICmp_Mask_AllZeroes | - FoldMskICmp_Mask_AllZeroes | FoldMskICmp_AMask_Mixed | FoldMskICmp_BMask_Mixed) : (FoldMskICmp_Mask_NotAllZeroes | - FoldMskICmp_Mask_NotAllZeroes | FoldMskICmp_AMask_NotMixed | FoldMskICmp_BMask_NotMixed)); if (icmp_abit) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D19460: Fix incorrect redundant expresion in target AMDGPU.
etienneb created this revision. etienneb added a reviewer: rnk. etienneb added a subscriber: cfe-commits. Herald added a reviewer: tstellarAMD. Herald added a subscriber: arsenm. The expression is detected as a redundant expression. Turn out, this is probably a bug. ``` /home/etienneb/llvm/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp:306:26: warning: both side of operator are equivalent [misc-redundant-expression] if (isSMRD(*FirstLdSt) && isSMRD(*FirstLdSt)) { ``` http://reviews.llvm.org/D19460 Files: lib/Target/AMDGPU/SIInstrInfo.cpp Index: lib/Target/AMDGPU/SIInstrInfo.cpp === --- lib/Target/AMDGPU/SIInstrInfo.cpp +++ lib/Target/AMDGPU/SIInstrInfo.cpp @@ -303,7 +303,7 @@ SecondDst = getNamedOperand(*SecondLdSt, AMDGPU::OpName::vdst); } - if (isSMRD(*FirstLdSt) && isSMRD(*FirstLdSt)) { + if (isSMRD(*FirstLdSt) && isSMRD(*SecondLdSt)) { FirstDst = getNamedOperand(*FirstLdSt, AMDGPU::OpName::sdst); SecondDst = getNamedOperand(*SecondLdSt, AMDGPU::OpName::sdst); } Index: lib/Target/AMDGPU/SIInstrInfo.cpp === --- lib/Target/AMDGPU/SIInstrInfo.cpp +++ lib/Target/AMDGPU/SIInstrInfo.cpp @@ -303,7 +303,7 @@ SecondDst = getNamedOperand(*SecondLdSt, AMDGPU::OpName::vdst); } - if (isSMRD(*FirstLdSt) && isSMRD(*FirstLdSt)) { + if (isSMRD(*FirstLdSt) && isSMRD(*SecondLdSt)) { FirstDst = getNamedOperand(*FirstLdSt, AMDGPU::OpName::sdst); SecondDst = getNamedOperand(*SecondLdSt, AMDGPU::OpName::sdst); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19451: [clang-tidy] New checker for redundant expressions.
etienneb added a comment. Tested over LLVM code, no false positives. Two catches: http://reviews.llvm.org/D19460 http://reviews.llvm.org/D19451 http://reviews.llvm.org/D19451 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r267297 - DebugInfo: Adapt to loss of DITypeRef in LLVM r267296
Author: dexonsmith Date: Sat Apr 23 16:08:27 2016 New Revision: 267297 URL: http://llvm.org/viewvc/llvm-project?rev=267297&view=rev Log: DebugInfo: Adapt to loss of DITypeRef in LLVM r267296 LLVM stopped using MDString-based type references, and DIBuilder no longer fills 'retainedTypes:' with every DICompositeType that has an 'identifier:' field. There are just minor changes to keep the same behaviour in CFE. Leaving 'retainedTypes:' unfilled has a dramatic impact on the output order of the IR though. There are a huge number of testcase changes, which were unfortunately not really scriptable. Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp cfe/trunk/test/CodeGen/debug-info-imported-entity.cpp cfe/trunk/test/CodeGenCXX/debug-info-access.cpp cfe/trunk/test/CodeGenCXX/debug-info-artificial-arg.cpp cfe/trunk/test/CodeGenCXX/debug-info-class.cpp cfe/trunk/test/CodeGenCXX/debug-info-cxx1y.cpp cfe/trunk/test/CodeGenCXX/debug-info-enum-class.cpp cfe/trunk/test/CodeGenCXX/debug-info-function-context.cpp cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp cfe/trunk/test/CodeGenCXX/debug-info-method.cpp cfe/trunk/test/CodeGenCXX/debug-info-namespace.cpp cfe/trunk/test/CodeGenCXX/debug-info-static-member.cpp cfe/trunk/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp cfe/trunk/test/CodeGenCXX/debug-info-template-limit.cpp cfe/trunk/test/CodeGenCXX/debug-info-template-member.cpp cfe/trunk/test/CodeGenCXX/debug-info-template-quals.cpp cfe/trunk/test/CodeGenCXX/debug-info-template.cpp cfe/trunk/test/CodeGenCXX/debug-info-varargs.cpp cfe/trunk/test/CodeGenCXX/debug-info.cpp cfe/trunk/test/CodeGenCXX/debug-lambda-expressions.cpp cfe/trunk/test/CodeGenCXX/debug-lambda-this.cpp cfe/trunk/test/CodeGenObjCXX/debug-info-block-capture-this.mm cfe/trunk/test/CodeGenObjCXX/debug-info-cyclic.mm cfe/trunk/test/Modules/ExtDebugInfo.cpp cfe/trunk/test/Modules/ModuleDebugInfo.cpp Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=267297&r1=267296&r2=267297&view=diff == --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Sat Apr 23 16:08:27 2016 @@ -1451,11 +1451,6 @@ llvm::DIType *CGDebugInfo::getOrCreateSt llvm::DIType *T = getOrCreateType(D, getOrCreateFile(Loc)); assert(T && "could not create debug info for type"); - // Composite types with UIDs were already retained by DIBuilder - // because they are only referenced by name in the IR. - if (auto *CTy = dyn_cast(T)) -if (!CTy->getIdentifier().empty()) - return T; RetainedTypes.push_back(D.getAsOpaquePtr()); return T; } @@ -3435,6 +3430,9 @@ void CGDebugInfo::EmitGlobalVariable(con auto *RD = cast(VarD->getDeclContext()); getDeclContextDescriptor(VarD); // Ensure that the type is retained even though it's otherwise unreferenced. +// +// FIXME: This is probably unnecessary, since Ty should reference RD +// through its scope. RetainedTypes.push_back( CGM.getContext().getRecordType(RD).getAsOpaquePtr()); return; Modified: cfe/trunk/test/CodeGen/debug-info-imported-entity.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-imported-entity.cpp?rev=267297&r1=267296&r2=267297&view=diff == --- cfe/trunk/test/CodeGen/debug-info-imported-entity.cpp (original) +++ cfe/trunk/test/CodeGen/debug-info-imported-entity.cpp Sat Apr 23 16:08:27 2016 @@ -6,5 +6,6 @@ using std::A; using ::A; // CHECK: [[CompileUnit:![0-9]+]] = distinct !DICompileUnit({{.+}} imports: [[Imports:![0-9]+]]) // CHECK: [[Imports]] = !{[[ImportedEntity:![0-9]+]]} -// CHECK: [[ImportedEntity]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[CompileUnit]], entity: !"_ZTSSt1A", line: 4) +// CHECK: [[ImportedEntity]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[CompileUnit]], entity: [[STDA:![0-9]+]], line: 4) +// CHECK: [[STDA]] = !DICompositeType(tag: DW_TAG_class_type, name: "A", Modified: cfe/trunk/test/CodeGenCXX/debug-info-access.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-access.cpp?rev=267297&r1=267296&r2=267297&view=diff == --- cfe/trunk/test/CodeGenCXX/debug-info-access.cpp (original) +++ cfe/trunk/test/CodeGenCXX/debug-info-access.cpp Sat Apr 23 16:08:27 2016 @@ -1,13 +1,16 @@ // RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple %itanium_abi_triple %s -o - | FileCheck %s // Test the various accessibility flags in the debug info. struct A { + // CHECK: ![[A:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A", + // CHECK-DA
Re: [PATCH] D19393: Move Checkers.inc to clang/include/.../Checkers
zaks.anna added a comment. Would it be possible to generate the diff that shows that the file moved as opposed to being deleted and added? http://reviews.llvm.org/D19393 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D18073: Add memory allocating functions
zaks.anna added a comment. "Since we are adding support for so many new APIs that are only available on Windows, could you please condition checking them only when we build for Windows. You probably can look and Language Options to figure that out." By this, I was suggesting that we should be conditionally checking for Windows functions in the checker, not only the tests. Are these all of the Windows-specific functions that will be added to the Malloc checker or do you plan on adding more? If there are more variants, I definitely think we should conditionally check (in the checker). Regarding tests, they should reflect what is in the checker. Currently, the checker will support '_mbsdup' on all architectures, but the tests only check it on Windows. Comment at: llvm/tools/clang/test/Analysis/malloc.c:1593 @@ -1511,3 +1592,3 @@ char *testLeakWithinReturn(char *str) { return strdup(strdup(str)); // expected-warning{{leak}} } This is not Windows-only! http://reviews.llvm.org/D18073 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r267302 - DebugInfo: DIGlobalVariables became 'distinct' in LLVM r267301
Author: dexonsmith Date: Sat Apr 23 17:29:26 2016 New Revision: 267302 URL: http://llvm.org/viewvc/llvm-project?rev=267302&view=rev Log: DebugInfo: DIGlobalVariables became 'distinct' in LLVM r267301 Update testcases due to DIBuilder change. Modified: cfe/trunk/test/CodeGenCXX/debug-info-global.cpp cfe/trunk/test/CodeGenCXX/debug-info-namespace.cpp Modified: cfe/trunk/test/CodeGenCXX/debug-info-global.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-global.cpp?rev=267302&r1=267301&r2=267302&view=diff == --- cfe/trunk/test/CodeGenCXX/debug-info-global.cpp (original) +++ cfe/trunk/test/CodeGenCXX/debug-info-global.cpp Sat Apr 23 17:29:26 2016 @@ -15,7 +15,7 @@ int f1() { // CHECK: [[GLOBALS]] = !{[[CNST:![0-9]*]]} -// CHECK: [[CNST]] = !DIGlobalVariable(name: "cnst", -// CHECK-SAME: scope: [[NS:![0-9]*]] +// CHECK: [[CNST]] = distinct !DIGlobalVariable(name: "cnst", +// CHECK-SAME: scope: [[NS:![0-9]*]] // CHECK: [[NS]] = !DINamespace(name: "ns" Modified: cfe/trunk/test/CodeGenCXX/debug-info-namespace.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-namespace.cpp?rev=267302&r1=267301&r2=267302&view=diff == --- cfe/trunk/test/CodeGenCXX/debug-info-namespace.cpp (original) +++ cfe/trunk/test/CodeGenCXX/debug-info-namespace.cpp Sat Apr 23 17:29:26 2016 @@ -57,14 +57,14 @@ void B::func_fwd() {} // CHECK: [[CU:![0-9]+]] = distinct !DICompileUnit( // CHECK-SAME:imports: [[MODULES:![0-9]*]] -// CHECK: [[I:![0-9]+]] = !DIGlobalVariable(name: "i",{{.*}} scope: [[NS:![0-9]+]], +// CHECK: [[I:![0-9]+]] = distinct !DIGlobalVariable(name: "i",{{.*}} scope: [[NS:![0-9]+]], // CHECK: [[NS]] = !DINamespace(name: "B", scope: [[CTXT:![0-9]+]], file: [[FOOCPP:![0-9]+]], line: 1) // CHECK: [[FOOCPP]] = !DIFile(filename: "foo.cpp" // CHECK: [[CTXT]] = !DINamespace(name: "A", scope: null, file: [[FILE:![0-9]+]], line: 5) // CHECK: [[FILE]] = !DIFile(filename: "{{.*}}debug-info-namespace.cpp", -// CHECK: [[VAR_FWD:![0-9]+]] = !DIGlobalVariable(name: "var_fwd",{{.*}} scope: [[NS]], -// CHECK-SAME:line: 44 -// CHECK-SAME:isDefinition: true +// CHECK: [[VAR_FWD:![0-9]+]] = distinct !DIGlobalVariable(name: "var_fwd",{{.*}} scope: [[NS]], +// CHECK-SAME: line: 44 +// CHECK-SAME: isDefinition: true // CHECK: [[MODULES]] = !{[[M1:![0-9]+]], [[M2:![0-9]+]], [[M3:![0-9]+]], [[M4:![0-9]+]], [[M5:![0-9]+]], [[M6:![0-9]+]], [[M7:![0-9]+]], [[M8:![0-9]+]], [[M9:![0-9]+]], [[M10:![0-9]+]], [[M11:![0-9]+]], [[M12:![0-9]+]], [[M13:![0-9]+]], [[M14:![0-9]+]], [[M15:![0-9]+]], [[M16:![0-9]+]], [[M17:![0-9]+]]} // CHECK: [[M1]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[CTXT]], entity: [[NS]], line: 15) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D18860: [analyzer] Fix the "Zombie symbols" issue.
zaks.anna added a comment. Thanks for working on this! The main unfinished task here is to investigate ways of reducing the performance hit. See more info below. > The patch was tested on Android open-source platform source code. Just to double check, have you compare the pre and after results and all of them but this one issue are the same? > Performance has slightly degraded (~5%) - hmm 5% is a considerable regression :( Comment at: lib/StaticAnalyzer/Core/Environment.cpp:180 @@ -179,3 +177,1 @@ - for (; SI != SE; ++SI) -SymReaper.maybeDead(*SI); } We are removing this because the maybeDead is no longer used, correct? Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:390 @@ -389,3 @@ - - } else { -// Call checkers with the non-cleaned state so that they could query the This removes an optimization to address the following issue: "removeDeadBindings is not run right after the last reference to the object is lost, which leads to imprecise error reports and failure to report the leak in some cases. It's because of how hasDeadSymbols() is implemented. That problem is solved if we disable the optimization, but I do not know how that effects performance. Maybe we can come up with something more clever. " I suspect the removal of this optimization causes the performance regression. In the patch I sent to the list, this was just a hack to demonstrate what causes the issue. I am not sure we should not just remove the optimization... The best proposal I have is to trigger remove dead bindings at the end of every basic block. This would degrade diagnostics (you will see leaks only at the end of the basic block), but should give us performance back or even improve performance. Artem and Devin, WDYT? Artem, can you experiment with this and investigate if the diagnostics become much worse? Maybe send a couple of examples? I suggest we implement this mode behind a flag as a separate patch. Comment at: lib/StaticAnalyzer/Core/RegionStore.cpp:2452 @@ -2451,3 +2440,1 @@ -SymReaper.maybeDead(*SI); -} } Looks like we are saying that we should no longer add to maybeDead because it's not used. http://reviews.llvm.org/D18860 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19057: [analyzer] Let TK_PreserveContents span across the whole base region.
zaks.anna accepted this revision. zaks.anna added a comment. This revision is now accepted and ready to land. LGTM! One thing to be aware here is that a const pointer could be deleted, so we should be able to delete a parent object without a warning. (I think that should work with this patch since you don't change the trait, but you might want to add a test.) > What i don't like about the approach this patch implements, is that it makes > the core rely on an > implementation detail of RegionStoreManager ("only base regions are > relevant" is such implementation > detail). Instead, i also tried to add a few extra virtual methods into the > StoreManager to avoid this > problem, but it made the patch much heavier. I can post that, unless anybody > else thinks that it's a > natural thing (rather than implementation detail) to propagate this trait to > base regions. I'd commit this patch. If you want, feel free to follow up with another to remove the leaking of the implementation detail. I do not fully understand what the alternate solution is... I do not think it would make sense to automatically apply the TK_PreserveContents trait to the base region when one calls ETraits.setTrait(); not sure if you are suggesting that. Comment at: lib/StaticAnalyzer/Core/CallEvent.cpp:182 @@ -181,3 +181,3 @@ RegionAndSymbolInvalidationTraits::TK_PreserveContents); // TODO: Factor this out + handle the lower level const pointers. Not sure, but this could mean to deal with cases where you pass a non const pointer to a class that has const fields.. http://reviews.llvm.org/D19057 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19393: Move Checkers.inc to clang/include/.../Checkers
srhines added a comment. Anna, if I scroll over the new include file in phabricator, it shows as a proper file move (in a yellow column at the start of the right diff - hover for it to say this). Every line is the same from the original file, as this is being moved only to fix up the relative paths, which are used across multiple directories. I know that git and svn both handle renames properly (via mv), but I have no clue whether phabricator + git-svn are going to preserve history in the nicest way possible. If there are suggestions there for minimizing trouble, we're happy to listen. http://reviews.llvm.org/D19393 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r267313 - Fix a couple assertions that can never fire because the condition ANDed with the string is just true or 1.
Author: ctopper Date: Sat Apr 23 21:08:22 2016 New Revision: 267313 URL: http://llvm.org/viewvc/llvm-project?rev=267313&view=rev Log: Fix a couple assertions that can never fire because the condition ANDed with the string is just true or 1. Modified: cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp Modified: cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp?rev=267313&r1=267312&r2=267313&view=diff == --- cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp (original) +++ cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp Sat Apr 23 21:08:22 2016 @@ -4640,7 +4640,7 @@ Stmt *RewriteModernObjC::SynthesizeBlock = dyn_cast(BlockExp)) { CPT = POE->getType()->castAs(); } else { -assert(1 && "RewriteBlockClass: Bad type"); +assert(false && "RewriteBlockClass: Bad type"); } assert(CPT && "RewriteBlockClass: Bad type"); const FunctionType *FT = CPT->getPointeeType()->getAs(); Modified: cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp?rev=267313&r1=267312&r2=267313&view=diff == --- cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp (original) +++ cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp Sat Apr 23 21:08:22 2016 @@ -3748,7 +3748,7 @@ Stmt *RewriteObjC::SynthesizeBlockCall(C = dyn_cast(BlockExp)) { CPT = POE->getType()->castAs(); } else { -assert(1 && "RewriteBlockClass: Bad type"); +assert(false && "RewriteBlockClass: Bad type"); } assert(CPT && "RewriteBlockClass: Bad type"); const FunctionType *FT = CPT->getPointeeType()->getAs(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19247: Deprecate C++03 Extensions: std::function, std::mem_fn and more
EricWF abandoned this revision. EricWF added a comment. Abandoning after advice from @mclow.lists http://reviews.llvm.org/D19247 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r267321 - Make thinlto clang test more robust against LLVM changes.
Author: mehdi_amini Date: Sat Apr 23 22:44:55 2016 New Revision: 267321 URL: http://llvm.org/viewvc/llvm-project?rev=267321&view=rev Log: Make thinlto clang test more robust against LLVM changes. We should just test the effect of the clang level option here, i.e. that a summary is correctly emitted with -flto=thin From: Mehdi Amini Modified: cfe/trunk/test/Misc/thinlto.c Modified: cfe/trunk/test/Misc/thinlto.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/thinlto.c?rev=267321&r1=267320&r2=267321&view=diff == --- cfe/trunk/test/Misc/thinlto.c (original) +++ cfe/trunk/test/Misc/thinlto.c Sat Apr 23 22:44:55 2016 @@ -1,9 +1,4 @@ // RUN: %clang_cc1 -flto=thin -emit-llvm-bc < %s | llvm-bcanalyzer -dump | FileCheck %s +// ; Check that the -flto=thin option emits a summary // CHECK: http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits