| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now that SmallString is a first-class citizen, most SmallString::str()
calls are not required. This patch removes a whole bunch of them, yet
there are lots more.
There are two use cases where str() is really needed:
1) To use one of StringRef member functions which is not available in
SmallString.
2) To convert to std::string, as StringRef implicitly converts while
SmallString do not. We may wish to change this, but it may introduce
ambiguity.
llvm-svn: 232622
|
|
|
|
|
|
|
| |
CloudABI also supports the arc4random() function. We can enable compiler
warnings for rand(), random() and *rand48() on this system as well.
llvm-svn: 231914
|
|
|
|
| |
llvm-svn: 231863
|
|
|
|
|
|
|
|
|
|
|
| |
In theory we could assume a CF property is stored at +0 if there's not a custom
setter, but that's not really worth the complexity. What we do know is that a
CF property can't have ownership attributes, and so we shouldn't assume anything
about the ownership of the ivar.
rdar://problem/20076963
llvm-svn: 231553
|
|
|
|
|
|
| |
r229593")
llvm-svn: 231548
|
|
|
|
| |
llvm-svn: 231540
|
|
|
|
| |
llvm-svn: 231314
|
|
|
|
|
|
|
|
|
|
| |
Reviewed by: Anna Zaks
Original patch by: Aleksei Sidorin
Differential Revision: http://reviews.llvm.org/D7905
llvm-svn: 231266
|
|
|
|
|
|
| |
Binding __builtin_alloca() return value to the symbolic value kills previous binding to a AllocaRegion established by the core.BuiltinFunctions checker. Other checkers may rely upon this information. Rollback handling of __builtin_alloca() to the way prior to r229850.
llvm-svn: 231160
|
|
|
|
|
|
|
|
|
| |
We would wrongfully reject (a.~A)() in both the destructor and
pseudo-destructor cases.
This fixes PR22668.
llvm-svn: 230512
|
|
|
|
|
|
|
|
|
|
|
| |
We expect in general that any nil value has no retain count information
associated with it; violating this results in unexpected state unification
/later/ when we decide to throw the information away. Unexpectedly caching
out can lead to an assertion failure or crash.
rdar://problem/19862648
llvm-svn: 229934
|
|
|
|
|
|
|
|
|
|
| |
+ separate bug report for "Free alloca()" error to be able to customize checkers responsible for this error.
+ Muted "Free alloca()" error for NewDelete checker that is not responsible for c-allocated memory, turned on for unix.MismatchedDeallocator checker.
+ RefState for alloca() - to be able to detect usage of zero-allocated memory by upcoming ZeroAllocDereference checker.
+ AF_Alloca family to handle alloca() consistently - keep proper family in RefState, handle 'alloca' by getCheckIfTracked() facility, etc.
+ extra tests.
llvm-svn: 229850
|
|
|
|
| |
llvm-svn: 229593
|
|
|
|
|
|
| |
The state obtained from CheckerContext::getState() may be outdated by the time the alloc/dealloc handling function is called (e.g. the state was modified but the transition was not performed). State argument was added to all alloc/dealloc handling functions in order to get the latest state and to allow sequential calls to those functions.
llvm-svn: 228737
|
|
|
|
|
|
| |
Convert uses of those APIs into ranged for loops. NFC.
llvm-svn: 228404
|
|
|
|
| |
llvm-svn: 228248
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
current one.
Instead of handling edge cases (mostly involving blocks), where we have difficulty finding
an allocation statement, allow the allocation site to be in a parent node.
Previously we assumed that the allocation site can always be found in the same frame
as allocation, but there are scenarios in which an element is leaked in a child
frame but is allocated in the parent.
llvm-svn: 228247
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A refinement of r204730, itself a refinement of r198953, to better handle
cases where an object is accessed both through a property getter and
through direct ivar access. An object accessed through a property should
always be treated as +0, i.e. not owned by the caller. However, an object
accessed through an ivar may be at +0 or at +1, depending on whether the
ivar is a strong reference. Outside of ARC, we don't always have that
information.
The previous attempt would clear out the +0 provided by a getter, but only
if that +0 hadn't already participated in other retain counting operations.
(That is, "self.foo" is okay, but "[[self.foo retain] autorelease]" is
problematic.) This turned out to not be good enough when our synthesized
getters get involved.
This commit drops the notion of "overridable" reference counting and instead
just tracks whether a value ever came from a (strong) ivar. If it has, we
allow one more release than we otherwise would. This has the added benefit
of being able to catch /some/ overreleases of instance variables, though
it's not likely to come up in practice.
We do still get some false negatives because we currently throw away
refcount state upon assigning a value into an ivar. We should probably
improve on that in the future, especially once we synthesize setters as
well as getters.
rdar://problem/18075108
llvm-svn: 228174
|
|
|
|
|
|
|
|
|
|
|
| |
Richard rejected my Sema change to interpret an integer literal zero in
a varargs context as a null pointer, so -Wsentinel sees an integer
literal zero and fires off a warning. Only CodeGen currently knows that
it promotes integer literal zeroes in this context to pointer size on
Windows. I didn't want to teach -Wsentinel about that compatibility
hack. Therefore, I'm migrating to C++11 nullptr.
llvm-svn: 223079
|
|
|
|
| |
llvm-svn: 221217
|
|
|
|
|
|
| |
package.
llvm-svn: 220289
|
|
|
|
|
|
|
|
|
|
|
| |
allocate a bunch of any pointer type.
This suppresses a common false positive when analyzing libc++.
Along the way, introduce some tests to show this checker actually
works with C++ static_cast<>.
llvm-svn: 220160
|
|
|
|
|
|
| |
Patch by Daniel Fahlgren!
llvm-svn: 219625
|
|
|
|
| |
llvm-svn: 219031
|
|
|
|
|
|
|
|
|
|
| |
There are three copies of IsCompleteType(...) functions in CSA and all
of them are incomplete (I experienced crashes in some CSA's test cases).
I have replaced these function calls with Type::isIncompleteType() calls.
A patch by Aleksei Sidorin!
llvm-svn: 219026
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The MallocChecker does currently not track the memory allocated by
if_nameindex. That memory is dynamically allocated and should be freed
by calling if_freenameindex. The attached patch teaches the checker
about these functions.
Memory allocated by if_nameindex is treated as a separate allocation
"family". That way the checker can verify it is freed by the correct
function.
A patch by Daniel Fahlgren!
llvm-svn: 219025
|
|
|
|
|
|
|
|
|
|
| |
The return value of mempcpy is only correct when the destination type is
one byte in size. This patch casts the argument to a char* so the
calculation is also correct for structs, ints etc.
A patch by Daniel Fahlgren!
llvm-svn: 219024
|
|
|
|
|
|
| |
No functionality change.
llvm-svn: 217586
|
|
|
|
|
|
| |
Patch by Daniel Fahlgren!
llvm-svn: 217461
|
|
|
|
|
|
| |
Patch by Daniel Fahlgren!
llvm-svn: 217258
|
|
|
|
| |
llvm-svn: 217205
|
|
|
|
| |
llvm-svn: 216751
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
the no-arguments case. Don't expand this to an __attribute__((nonnull(A, B,
C))) attribute, since that does the wrong thing for function templates and
varargs functions.
In passing, fix a grammar error in the diagnostic, a crash if
__attribute__((nonnull(N))) is applied to a varargs function,
a bug where the same null argument could be diagnosed multiple
times if there were multiple nonnull attributes referring to it,
and a bug where nonnull attributes would not be accumulated correctly
across redeclarations.
llvm-svn: 216520
|
|
|
|
|
|
|
|
|
| |
The ObjCDealloc checker is currently disabled because it was too aggressive, but this
is a good first step in getting it back to a useful state.
Patch by David Kilzer!
llvm-svn: 216272
|
|
|
|
|
|
|
| |
to +initilize as this results in an extra call
to this method. rdar://16628028
llvm-svn: 216271
|
|
|
|
|
|
|
| |
The call will never go to a more derived class, but that's intentional in those
cases.
llvm-svn: 216167
|
|
|
|
|
|
|
|
| |
an integer.
Patch by Daniel Fahlgren.
llvm-svn: 216079
|
|
|
|
|
|
| |
Patch by Daniel Fahlgren.
llvm-svn: 216078
|
|
|
|
|
|
|
|
| |
different widths.
PR20659. Patch by Anders Rönnholm.
llvm-svn: 216076
|
|
|
|
|
|
|
|
| |
string literals.
PR20693. Patch by Anders Rönnholm.
llvm-svn: 216075
|
|
|
|
|
|
| |
Modifications made by clang-tidy with minor tweaks.
llvm-svn: 215557
|
|
|
|
|
|
|
|
| |
array.
Patch by Daniel Fahlgren!
llvm-svn: 215456
|
|
|
|
|
|
| |
Newly-created unconsumed instance is now assumed escaped if an invoked constructor has an argument of a pointer-to-record type.
llvm-svn: 214909
|
|
|
|
|
|
| |
msc17.
llvm-svn: 212789
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
denominator.
This new checker, alpha.core.TestAfterDivZero, catches issues like this:
int sum = ...
int avg = sum / count; // potential division by zero...
if (count == 0) { ... } // ...caught here
Because the analyzer does not necessarily explore /all/ paths through a program,
this check is restricted to only work on zero checks that immediately follow a
division operation (/ % /= %=). This could later be expanded to handle checks
dominated by a division operation but not necessarily in the same CFG block.
Patch by Anders Rönnholm! (with very minor modifications by me)
llvm-svn: 212731
|
|
|
|
| |
llvm-svn: 212369
|
|
|
|
|
|
| |
Patch by Sean McBride, tests adjusted by me.
llvm-svn: 211453
|
|
|
|
|
|
|
|
|
| |
Fixes a crash in Retain Count checker error reporting logic by handing
the allocation statement retrieval from a BlockEdge program point.
Also added a simple CFG dump routine for debugging.
llvm-svn: 210960
|
|
|
|
|
|
| |
be performed by using Decl::isInStdNamespace or DeclContext::isStdNamespace
llvm-svn: 209708
|
|
|
|
| |
llvm-svn: 209642
|