baloghadamsoftware added inline comments.
Comment at: lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:511
+ SSE->getLHS()->getType()->isSignedIntegerOrEnumerationType() ||
+ SSE->getLHS()->getType()->isPointerType()) {
+ return negV->Negate(BV, F);
baloghadamsoftware updated this revision to Diff 107032.
baloghadamsoftware added a comment.
Rearrangement of unsigned comparison removed (FIXME added). Comment regarding
the types of integer constants added.
https://reviews.llvm.org/D35109
Files:
lib/StaticAnalyzer/Core/SimpleSValBuilder.cp
baloghadamsoftware updated this revision to Diff 106627.
baloghadamsoftware added a comment.
Type selection simplified, FIXME added.
https://reviews.llvm.org/D35110
Files:
lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
test/Analysis/constraint_manager_negate_difference.c
test/Analysis
baloghadamsoftware updated this revision to Diff 106626.
baloghadamsoftware added a comment.
Difference of unsigned is converted to signed.
https://reviews.llvm.org/D35109
Files:
include/clang/AST/ASTContext.h
lib/AST/ASTContext.cpp
lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
test/Ana
baloghadamsoftware added a comment.
The other possibility is to make the difference signed.
https://reviews.llvm.org/D35109
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
baloghadamsoftware added a comment.
I tested the latest revision (this fronted patch already included) on my test
file in https://reviews.llvm.org/D33537. Disregarding of the (not so important)
check-specific parameters (`EnabledFunctions` and `IgnoredExceptions`) I do not
get warnings for any
baloghadamsoftware added inline comments.
Comment at: lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:511
+ SSE->getLHS()->getType()->isSignedIntegerOrEnumerationType() ||
+ SSE->getLHS()->getType()->isPointerType()) {
+ return negV->Negate(BV, F);
baloghadamsoftware added a comment.
I think we should exclude unsigned types completely. `A >= B` is converted to
`A - B >= 0`, thus the range of `A - B` is `[0 .. INT_MAX]` which is the full
range for the unsigned type. This implies that upon any conditional statement
`if (A >= B) ...` the ran
baloghadamsoftware added a comment.
In https://reviews.llvm.org/D35109#806156, @NoQ wrote:
> I think you might also need to convert `APSInt`s to an appropriate type, as
> done above. Type of right-hand-side `APSInt`s do not necessarily coincide
> with the type of the left-hand-side symbol or of
baloghadamsoftware marked an inline comment as done.
baloghadamsoftware added a comment.
In https://reviews.llvm.org/D35109#801921, @NoQ wrote:
> Because integer promotion rules are tricky, could we, for now, avoid dealing
> with the situation when left-hand side and right-hand side and the resu
baloghadamsoftware marked an inline comment as done.
baloghadamsoftware added inline comments.
Comment at: lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:583
+newRhs = BasicVals.evalAPSInt(BO_Add, *lInt, *rInt);
+reverse = (lop == BO_Add);
+ } else
baloghadamsoftware updated this revision to Diff 105628.
baloghadamsoftware added a comment.
Type check added and restricted to additive operators.
https://reviews.llvm.org/D35109
Files:
lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
test/Analysis/std-c-library-functions.c
test/Analysis/sv
baloghadamsoftware added a comment.
In https://reviews.llvm.org/D33537#771274, @aaron.ballman wrote:
> The check in https://reviews.llvm.org/D3 is using a CFG, not just
> checking direct throws.
I tested the latest revision (the fronted patch already included) on my test
file. Disregardin
baloghadamsoftware updated this revision to Diff 105594.
baloghadamsoftware added a comment.
Simplified for enhanced SValBuilder and ConstraintManager.
https://reviews.llvm.org/D32642
Files:
lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
test/Analysis/Inputs/system-header-simulator-cxx.h
baloghadamsoftware updated this revision to Diff 105593.
baloghadamsoftware added a comment.
Wrong patch files was uploaded first.
https://reviews.llvm.org/D35110
Files:
lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
test/Analysis/ptr-arith.c
Index: test/Analysis/ptr-arith.c
==
baloghadamsoftware created this revision.
If range `[m .. n]` is stored for symbolic expression `A - B`, then we can
deduce the range for `B - A` which is [-n .. -m]. This is only true for signed
types, unless the range is `[0 .. 0]`.
https://reviews.llvm.org/D35110
Files:
lib/StaticAnalyze
baloghadamsoftware created this revision.
Since the range-based constraint manager (default) is weak in handling
comparisons where symbols are on both sides it is wise to rearrange them to
have symbols only on the left side. Thus e.g. `A + n >= B + m` becomes `A - B
>= m - n` which enables the
baloghadamsoftware added a comment.
Now I can improve `SValBuilder` to compare `{conj_X}+n` to `conj_X}+m`, but I
am not sure if it helps to simplify `compare()` much. How to handle cases where
I have to compare `{conj_X}+n` to `{conj_Y}+m`, an we have a range `[k..k]` for
`{conj_X}-{conj_Y}` i
baloghadamsoftware updated this revision to Diff 103728.
baloghadamsoftware added a comment.
`SymbolManager::getSymIntExpr()` replaced by `SValBuilder::evalBinOp()`,
function `compact()` eliminated.
https://reviews.llvm.org/D32642
Files:
lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
test
baloghadamsoftware added a comment.
> I'm sure that simplification `(($x + N) + M) ~> ($x + (M + N))` is already
> working in `SValBuilder`.
No, it is unfortunately not working: I tried to increase `${conj_X}` by `1`,
then again by `1`, and I got symbolic expression `(${conj_X}+1)+1)`.
https:
baloghadamsoftware updated this revision to Diff 103568.
baloghadamsoftware added a comment.
Minor fixes according to the comments.
https://reviews.llvm.org/D32642
Files:
lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
test/Analysis/Inputs/system-header-simulator-cxx.h
test/Analysis/diagn
baloghadamsoftware added a comment.
I tried `SValBuilder::evalBinOp()` first but it did not help too much. It could
decide only if I compared the same conjured symbols or different ones, but
nothing more. It always gave me `UnknownVal`. Even if comparing ${conj_X} ==
${conj_X} + n where n was a
baloghadamsoftware added a comment.
Any progress in the review?
https://reviews.llvm.org/D32642
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
baloghadamsoftware added a comment.
In https://reviews.llvm.org/D33537#770264, @aaron.ballman wrote:
> I think we should try to get as much of this functionality in
> https://reviews.llvm.org/D3 as possible; there is a considerable amount
> of overlap between that functionality and this fun
baloghadamsoftware added a comment.
There is a patch (https://reviews.llvm.org/D33537) for a check which is a
superset of this: It does not only check for noexcept (and throw()) functions,
but also for destructors, move constructors, move assignments, the main()
function, swap() functions and a
baloghadamsoftware added a comment.
The matcher in https://reviews.llvm.org/D33537 could be reused here as well.
Maybe I should make it common, but it is more complex than any of the common
matchers.
Repository:
rL LLVM
https://reviews.llvm.org/D31370
baloghadamsoftware updated this revision to Diff 100848.
baloghadamsoftware added a comment.
Rebased to (committed) Part1 (https://reviews.llvm.org/rL304160) and updated
according to comments.
https://reviews.llvm.org/D32642
Files:
lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
test/Analy
baloghadamsoftware updated this revision to Diff 100382.
baloghadamsoftware added a comment.
Ignoring bad_alloc.
https://reviews.llvm.org/D33537
Files:
clang-tidy/misc/CMakeLists.txt
clang-tidy/misc/ExceptionEscapeCheck.cpp
clang-tidy/misc/ExceptionEscapeCheck.h
clang-tidy/misc/MiscTidy
baloghadamsoftware updated this revision to Diff 100374.
baloghadamsoftware added a comment.
Check added to the Release Notes.
https://reviews.llvm.org/D33537
Files:
clang-tidy/misc/CMakeLists.txt
clang-tidy/misc/ExceptionEscapeCheck.cpp
clang-tidy/misc/ExceptionEscapeCheck.h
clang-tidy
baloghadamsoftware added a comment.
In https://reviews.llvm.org/D33537#764834, @Prazek wrote:
> How is that compared to https://reviews.llvm.org/D19201 and the clang patch
> mentioned in this patch?
Actually, this check does much more. It does not only check for noexcept (and
throw()) functio
baloghadamsoftware updated this revision to Diff 100369.
baloghadamsoftware added a comment.
Docs fixed according to the comments.
https://reviews.llvm.org/D33537
Files:
clang-tidy/misc/CMakeLists.txt
clang-tidy/misc/ExceptionEscapeCheck.cpp
clang-tidy/misc/ExceptionEscapeCheck.h
clang-
baloghadamsoftware updated this revision to Diff 100239.
baloghadamsoftware added a comment.
Comments added and fixed.
https://reviews.llvm.org/D32592
Files:
include/clang/StaticAnalyzer/Checkers/Checkers.td
lib/StaticAnalyzer/Checkers/CMakeLists.txt
lib/StaticAnalyzer/Checkers/IteratorCh
baloghadamsoftware added a comment.
Any comments regarding the last changes?
https://reviews.llvm.org/D32592
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
baloghadamsoftware abandoned this revision.
baloghadamsoftware added a comment.
Superseded by https://reviews.llvm.org/D33537
https://reviews.llvm.org/D32350
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailm
baloghadamsoftware added a comment.
Supersedes https://reviews.llvm.org/D32350
https://reviews.llvm.org/D33537
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
baloghadamsoftware created this revision.
Herald added a subscriber: mgorny.
Finds functions which should not throw exceptions: Destructors, move
constructors, move assignment operators, the main() function, swap() functions,
functions marked with throw() or noexcept and functions given as optio
baloghadamsoftware added a comment.
In https://reviews.llvm.org/D32592#747132, @NoQ wrote:
> Then, in methods that deal with iterator `SVal`s directly, i wish we had
> hints explaining what's going on in these ~7 cases. In my opinion, that'd
> greatly help people understand the code later, and
baloghadamsoftware updated this revision to Diff 98275.
baloghadamsoftware marked 11 inline comments as done.
baloghadamsoftware added a comment.
Updated according to the review.
https://reviews.llvm.org/D32592
Files:
include/clang/StaticAnalyzer/Checkers/Checkers.td
lib/StaticAnalyzer/Chec
baloghadamsoftware added a comment.
Split to 10 parts.
https://reviews.llvm.org/D31975
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
baloghadamsoftware created this revision.
check::Bind() is not invoked for parameter passing. We use a trick instead: in
checkBeginFunction we copy the positions of iterator parameters from the
arguments to the parameters.
https://reviews.llvm.org/D32906
Files:
lib/StaticAnalyzer/Checkers/I
baloghadamsoftware created this revision.
This patch adds explicit evaluation of the following functions: std::find,
std::find_end, std::find_first_of, std::find_if, std::find_if_not,
std::lower_bound, std::upper_bound, std::search and std::search_n. On the one
hand this is an optimization sinc
baloghadamsoftware created this revision.
This patch adds support for the following operations in the iterator checkers:
assign, clear, insert, insert_after, emplace, emplace_after, erase and
erase_after. This affects mismatched iterator checks ("this" and parameter must
match) and invalidation
baloghadamsoftware updated this revision to Diff 97942.
baloghadamsoftware added a comment.
Wrong diff.
https://reviews.llvm.org/D32902
Files:
lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
test/Analysis/Inputs/system-header-simulator-cxx.h
test/Analysis/diagnostics/explicit-suppression.
baloghadamsoftware created this revision.
Extension of the mismatched iterator checker for constructors taking range of
first..last (first and last must be iterators of the same container) and also
for comparisons of iterators of different containers (one does not compare
iterators of different
baloghadamsoftware created this revision.
If a container is moved by its move assignment operator, according to the
standard all their iterators except the past-end iterators remain valid but
refer to the new container. This patch introduces support for this case in the
iterator checkers.
htt
baloghadamsoftware added inline comments.
Comment at: lib/StaticAnalyzer/Checkers/IteratorChecker.cpp:211-214
+std::pair
+createDifference(SymbolManager &SymMgr, SymbolRef Sym1, SymbolRef Sym2);
+const llvm::APSInt *getDifference(ProgramStateRef State, SymbolRef Sym1,
+
baloghadamsoftware updated this revision to Diff 97060.
baloghadamsoftware added a comment.
Checker and test included now :-)
https://reviews.llvm.org/D32592
Files:
include/clang/StaticAnalyzer/Checkers/Checkers.td
lib/StaticAnalyzer/Checkers/CMakeLists.txt
lib/StaticAnalyzer/Checkers/Ite
baloghadamsoftware created this revision.
Herald added a subscriber: mgorny.
This is the first part of the new Iterator Checker. This part contains the very
core infrastructure. It only checks for out-of-range iterators in a very simple
case.
https://reviews.llvm.org/D32592
Files:
include/c
baloghadamsoftware added a comment.
Thank you for your help.
Actually, I did neither merge the patches nor the checkers. Based on the
experiences in the prototype I created a totally new checker. Incremental
development sounds good, but I did a lot of experimenting in this particular
checker,
baloghadamsoftware created this revision.
Herald added a subscriber: mgorny.
This is an old checker used only internally until now. The original author is
Bence Babati, I added him as a subscriber.
The checker checks whather exceptions escape the main() function, destructors.
functions with exc
baloghadamsoftware added a comment.
Hello! I am not sure how to split it to incremental patches. As I mentioned in
the description, the state of the iterator position is always tracked. So if I
remove some of the checks it does not make the patch much smaller, since the
checking part is quite s
baloghadamsoftware created this revision.
Herald added a subscriber: whisperity.
Users reported some false positives using this check. This patch sets the
default value of the option for checking implicit widening casts to false. We
also suggest renaming the check to something like missing-or-mi
baloghadamsoftware added a comment.
Or I can do it for you if you wish.
Repository:
rL LLVM
https://reviews.llvm.org/D31097
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
baloghadamsoftware added a comment.
OK, please create a patch where implicit casts are disabled by default. You can
also find a new name for the checker.
Repository:
rL LLVM
https://reviews.llvm.org/D31097
___
cfe-commits mailing list
cfe-commit
baloghadamsoftware abandoned this revision.
baloghadamsoftware added a comment.
Whole checker superseeded by https://reviews.llvm.org/D31975.
https://reviews.llvm.org/D28771
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.o
baloghadamsoftware abandoned this revision.
baloghadamsoftware marked an inline comment as done.
baloghadamsoftware added a comment.
Superseeded by patch https://reviews.llvm.org/D31975.
https://reviews.llvm.org/D29419
___
cfe-commits mailing list
c
baloghadamsoftware added a comment.
Hi!
There is an option to disable the checking of widening casts. It is enabled by
default. You can disable it any time. Or, if you find too much false positives,
we can discuss about setting this option to disabled as default.
I am convinced that checking i
baloghadamsoftware added inline comments.
Comment at: lib/StaticAnalyzer/Checkers/IteratorPastEndChecker.cpp:530
+ auto value = RVal;
+ if (auto loc = value.getAs()) {
+value = State->getRawSVal(*loc);
NoQ wrote:
> baloghadamsoftware wrote:
> > NoQ wrote:
>
baloghadamsoftware updated this revision to Diff 89211.
baloghadamsoftware added a comment.
checkBind replaces checking of DeclStmt, CXXConstructExpr and assignment
operators. Incremention by 0 is not a bug anymore regardless the position of
the iterator.
https://reviews.llvm.org/D28771
Files
baloghadamsoftware marked 2 inline comments as done.
baloghadamsoftware added inline comments.
Comment at: lib/StaticAnalyzer/Checkers/MismatchedIteratorChecker.cpp:311
+
+void MismatchedIteratorChecker::checkPostStmt(const DeclStmt *DS,
+
baloghadamsoftware updated this revision to Diff 89123.
baloghadamsoftware added a comment.
Updated according to the comments.
https://reviews.llvm.org/D29419
Files:
include/clang/StaticAnalyzer/Checkers/Checkers.td
lib/StaticAnalyzer/Checkers/CMakeLists.txt
lib/StaticAnalyzer/Checkers/Mi
baloghadamsoftware added a comment.
In https://reviews.llvm.org/D29419#671839, @NoQ wrote:
> This one looks similar to the `IteratorPastEnd` checker, so much that i'd
> definitely advice re-using some code. At the very least, functions like
> `isIterator()` should definitely deserve a header so
baloghadamsoftware added inline comments.
Comment at: lib/StaticAnalyzer/Checkers/IteratorPastEndChecker.cpp:530
+ auto value = RVal;
+ if (auto loc = value.getAs()) {
+value = State->getRawSVal(*loc);
NoQ wrote:
> baloghadamsoftware wrote:
> > NoQ wrote:
>
baloghadamsoftware updated this revision to Diff 86709.
baloghadamsoftware added a comment.
Herald added a subscriber: mgorny.
The checker itself disappeared mystically from the previous diff...
https://reviews.llvm.org/D29419
Files:
include/clang/StaticAnalyzer/Checkers/Checkers.td
lib/Sta
baloghadamsoftware created this revision.
A new checker to check whether multiple iterators which should refer to the
same container refer to different ones. Here we include comparisons,
constructors which take an iterator pair and any template function which takes
iterator pair(s).
https://r
baloghadamsoftware added inline comments.
Comment at: lib/StaticAnalyzer/Checkers/IteratorPastEndChecker.cpp:530
+ auto value = RVal;
+ if (auto loc = value.getAs()) {
+value = State->getRawSVal(*loc);
NoQ wrote:
> Is there a test case for this hack?
>
> I
baloghadamsoftware updated this revision to Diff 86428.
baloghadamsoftware added a comment.
Updates based on the comments.
https://reviews.llvm.org/D28771
Files:
lib/StaticAnalyzer/Checkers/IteratorPastEndChecker.cpp
test/Analysis/Inputs/system-header-simulator-cxx.h
test/Analysis/diagnos
baloghadamsoftware added a comment.
In https://reviews.llvm.org/D29183#657706, @NoQ wrote:
> Hmm, we should have done better work reviewing
> https://reviews.llvm.org/D28905.
Oh, someone was quicker than me by one week...
https://reviews.llvm.org/D29183
___
baloghadamsoftware added a comment.
I wonder if this could also be a problem for nested messages in Objective-C,
since the call for VisitChildren() is also missing from
VisitObjCMessageExpr()...
https://reviews.llvm.org/D29183
___
cfe-commits mail
baloghadamsoftware added a comment.
Some comments how I found this bug. I got some strange false positives even
after the fix for the iterator past end checker
(https://reviews.llvm.org/D28771). I could reproduce it with the following code:
#include
using std::list;
using std::prev;
baloghadamsoftware added a comment.
In https://reviews.llvm.org/D29183#657669, @xazax.hun wrote:
> Great find! Could you transform your examole into a testcasr that fails
> before this patch? I think there should be already some tests for call
> graphs that you can take a look at.
Yes, but I
baloghadamsoftware created this revision.
Take the following example:
class Int {
public:
Int(int n = 0): num(n) {}
Int(const Int& rhs): num(rhs.num) {}
Int& operator=(const Int& rhs) { num = rhs.num; }
operator int() { return num; }
private:
int num;
};
templa
baloghadamsoftware added a comment.
Any progress regarding this patch? Is https://reviews.llvm.org/D26837
necessarily a dependency, or we just need isCompoundType() function? This
function could be moved to a separate patch so the dependency could be removed.
https://reviews.llvm.org/D27202
baloghadamsoftware created this revision.
baloghadamsoftware added reviewers: zaks.anna, NoQ.
baloghadamsoftware added subscribers: xazax.hun, o.gyorgy, cfe-commits.
This patch fixes some issues for the IteratorPastEnd checkers. There are
basically two main issues this patch targets: one is the h
baloghadamsoftware added a comment.
In https://reviews.llvm.org/D25660#613519, @zaks.anna wrote:
> Also, have you evaluated this on real codebases? What results do you see? Are
> there any false positives found? Are there any true positives found?
I am doing it right now. Unfortunately I found
baloghadamsoftware updated this revision to Diff 81224.
baloghadamsoftware added a comment.
Now isInStdNamespace is used. Hack is back so https://reviews.llvm.org/D27202
is not a dependency now.
https://reviews.llvm.org/D25660
Files:
include/clang/StaticAnalyzer/Checkers/Checkers.td
lib/St
baloghadamsoftware added a comment.
Could you please remove the IteratorPastEndChecker file differences from this
patch and make https://reviews.llvm.org/D25660 dependent on this one?
https://reviews.llvm.org/D27202
___
cfe-commits mailing list
cfe
baloghadamsoftware added a comment.
https://reviews.llvm.org/D27202 is now a dependency, but cannot add it.
Comment at: lib/StaticAnalyzer/Checkers/IteratorPastEndChecker.cpp:166
+IteratorPastEndChecker::IteratorPastEndChecker() {
+ PastEndBugType.reset(new BugType(this, "Iter
baloghadamsoftware updated this revision to Diff 80728.
baloghadamsoftware marked 4 inline comments as done.
baloghadamsoftware added a comment.
Minor corrections, comments, some new tests, test input headers merged.
https://reviews.llvm.org/D25660
Files:
include/clang/StaticAnalyzer/Checkers
baloghadamsoftware added inline comments.
Comment at: include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:282
+ static inline bool isCompoundType(QualType T) {
+return T->isArrayType() || T->isRecordType() ||
Could you please move this function into a
901 - 980 of 980 matches
Mail list logo