Commit Graph

133450 Commits

Author SHA1 Message Date
Evgeniy Stepanov 6e6817a823 [asan] Raise quarantine size a bit with ASAN_LOW_MEMORY.
Our tests expect that a 16M block will fit in the quarantine.

llvm-svn: 163384
2012-09-07 12:13:52 +00:00
Benjamin Kramer fa530570db MipsAsmParser: Fix a couple of string use-after-frees and misuses of classof.
llvm-svn: 163383
2012-09-07 09:47:42 +00:00
Manuel Klimek 3ca12c5b54 Implements hasAncestor.
Implements the hasAncestor matcher. This builds
on the previous patch that introduced DynTypedNode to build up
a parent map for an additional degree of freedom in the AST traversal.

The map is only built once we hit an hasAncestor matcher, in order
to not slow down matching for cases where this is not needed.

We could implement some speed-ups for special cases, like building up
the parent map as we go and only building up the full map if we break
out of the already visited part of the tree, but that is probably
not going to be worth it, and would make the code significantly more
complex.

Major TODOs are:
- implement hasParent
- implement type traversal
- implement memoization in hasAncestor

llvm-svn: 163382
2012-09-07 09:26:10 +00:00
Alexey Samsonov f42e860c51 [ASan] hack initialization-bug test so that it stably passes on both Linux and Mac: make the bug appear independent of the translation unit order
llvm-svn: 163381
2012-09-07 09:24:29 +00:00
Nuno Lopes 1cf578d599 yet another attempt at fixing @OCAMLOPT@ for sed.
Patch by Rick Foos.

llvm-svn: 163380
2012-09-07 09:24:13 +00:00
Alexey Samsonov 0f5f1d5bfa [ASan] add Linux-specific test for initialization order that checks that we find a bug independently of translation units order
llvm-svn: 163379
2012-09-07 09:04:31 +00:00
Hans Wennborg 08238adbbb SimplifyCFG: ValidLookupTableConstant should be static
llvm-svn: 163378
2012-09-07 08:22:57 +00:00
Ted Kremenek b2f6e69af9 Revert "Rework the retain-release.m test to use FileCheck and the "text" output"
Apparently the output of this test is not deterministic.  Needs investigation.

llvm-svn: 163377
2012-09-07 07:40:40 +00:00
Alexey Samsonov cd66d97799 [Sanitizer] add --demangle option to llvm-symbolizer (for now just assume that __cxa_demangle option is available)
llvm-svn: 163376
2012-09-07 07:26:35 +00:00
Ted Kremenek 3f58774c8d Fix off-by-one bug in diagnostic prose of ObjCContainersASTChecker.
While the check itself should count 0-based for the parameter index,
the diagnostic should be 1-based (first, second, third, not start at 0).

Fixes <rdar://problem/12249569>.

llvm-svn: 163375
2012-09-07 07:13:08 +00:00
Ted Kremenek 891bcdb644 ExplodedGraph::shouldCollectNode() should not collect nodes for non-Expr Stmts
(as this previously was the case before this was refactored).  We also shouldn't
need to specially handle BinaryOperators since the eagerly-assume heuristic tags
such nodes.

llvm-svn: 163374
2012-09-07 06:56:18 +00:00
Ted Kremenek 74eb55a23d Rework the retain-release.m test to use FileCheck and the "text" output
of the analyzer, as the RetainReleaseChecker has many fine-grain
path diagnostic events that were not being checked.  This uncovered
an inconsistency between the path diagnostics between Objective-C
and Objective-C++ code in ConditionBRVisitor that was fixed in a recent
patch.

llvm-svn: 163373
2012-09-07 06:51:47 +00:00
Ted Kremenek 7c15040e98 Fix bug in ConditionBRVisitor where for C++ (and not C) we were not ignoring
implicit pointer-to-boolean conversions in condition expressions.  This would
result in inconsistent diagnostic emission between C and C++.

A consequence of this is now ConditionBRVisitor and TrackConstraintBRVisitor may
emit redundant diagnostics, for example:

  "Assuming pointer value is null" (TrackConstraintBRVisitor)
  "Assuming 'p' is null" (ConditionBRVisitor)

We need to reconcile the two, and perhaps prefer one over the other in some
cases.

llvm-svn: 163372
2012-09-07 06:51:37 +00:00
Ted Kremenek 1cb637cc37 Add -exact-match option to FileCheck to allow clients to do exact matches without using regular expressions.
llvm-svn: 163371
2012-09-07 06:47:16 +00:00
Michael Liao b7cd341901 Stop emitting lifetime region info when stack coloring is not enabled in O0
- this should fix PR13780

llvm-svn: 163370
2012-09-07 05:13:00 +00:00
Richard Smith 1fde8ece37 PR9023: A template template parameter whose template parameter list contains an
unexpanded parameter pack is a pack expansion. Thus, as with a non-type template
parameter which is a pack expansion, it needs to be expanded early into a fixed
list of template parameters.

Since the expanded list of template parameters is not itself a parameter pack,
it is permitted to appear before the end of the template parameter list, so also
remove that restriction (for both template template parameter pack expansions and
non-type template parameter pack expansions).

llvm-svn: 163369
2012-09-07 02:06:42 +00:00
Jack Carter 97158ca5c2 The Mips standalone assembler aliased instruction support.
The assembler can alias one instruction into another based
on the operands. For example the jump instruction "J" takes
and immediate operand, but if the operand is a register the
assembler will change it into a jump register "JR" instruction.

These changes are in the instruction td file.

Test cases included

Contributer: Vladimir Medic
llvm-svn: 163368
2012-09-07 01:42:38 +00:00
Jordan Rose 81456d9f6d [analyzer] Fail gracefully when the dynamic type is outside the hierarchy.
With some particularly evil casts, we can get an object whose dynamic type
is not actually a subclass of its static type. In this case, we won't even
find the statically-resolved method as a devirtualization candidate.

Rather than assert that this situation cannot occur, we now simply check
that the dynamic type is not an ancestor or descendent of the static type,
and leave it at that.

This error actually occurred analyzing LLVM: CallEventManager uses a
BumpPtrAllocator to allocate a concrete subclass of CallEvent
(FunctionCall), but then casts it to the actual subclass requested
(such as ObjCMethodCall) to perform the constructor.

Yet another crash in PR13763.

llvm-svn: 163367
2012-09-07 01:19:42 +00:00
Jim Ingham f02a2e96b8 Ensure that the ShouldStopHere plans get called even when doing "virtual" steps.
llvm-svn: 163366
2012-09-07 01:11:44 +00:00
Jim Ingham 7da851a3e2 For now, treat breakpoint hits like regular stops when calculation InlinedStackDepth.
llvm-svn: 163365
2012-09-07 01:11:08 +00:00
Jack Carter be33217bb8 The Mips standalone assembler intial directive support.
Actually these are just stubs for parsing the directives.
Semantic support will come later.

Test cases included

Contributer: Vladimir Medic
llvm-svn: 163364
2012-09-07 00:48:02 +00:00
Jack Carter a63b16ac1e The Mips standalone assembler fpu instruction support.
Test cases included

Contributer: Vladimir Medic
llvm-svn: 163363
2012-09-07 00:23:42 +00:00
Ted Kremenek c008db99d7 Teach RetainCountChecker that CFPlugInInstanceCreate does not
return a CF object at all.

Fixes <rdar://problem/9566345>

llvm-svn: 163362
2012-09-06 23:47:02 +00:00
Jordan Rose 7e97996f4e [analyzer] Don't crash if we cache out while evaluating an ObjC message.
A bizarre series of coincidences led us to generate a previously-seen
node in the middle of processing an Objective-C message, where we assume
the receiver is non-nil. We were assuming that such an assumption would
never "cache out" like this, and blithely went on using a null ExplodedNode
as the predecessor for the next step in evaluation.

Although the test case committed here is complicated, this could in theory
happen in other ways as well, so the correct fix is just to test if the
non-nil assumption results in an ExplodedNode we've seen before.

<rdar://problem/12243648>

llvm-svn: 163361
2012-09-06 23:44:36 +00:00
Michael Liao 026f833368 Re-work bit/bits value resolving in tblgen
- This patch is inspired by the failure of the following code snippet
  which is used to convert enumerable values into encoding bits to
  improve the readability of td files.

  class S<int s> {
    bits<2> V = !if(!eq(s, 8),  {0, 0},
                !if(!eq(s, 16), {0, 1},
                !if(!eq(s, 32), {1, 0},
                !if(!eq(s, 64), {1, 1}, {?, ?}))));
  }

  Later, PR8330 is found to report not exactly the same bug relevant
  issue to bit/bits values.

- Instead of resolving bit/bits values separately through
  resolveBitReference(), this patch adds getBit() for all Inits and
  resolves bit value by resolving plus getting the specified bit. This
  unifies the resolving of bit with other values and removes redundant
  logic for resolving bit only. In addition,
  BitsInit::resolveReferences() is optimized to take advantage of this
  origanization by resolving VarBitInit's variable reference first and
  then getting bits from it.

- The type interference in '!if' operator is revised to support possible
  combinations of int and bits/bit in MHS and RHS.

- As there may be illegal assignments from integer value to bit, says
  assign 2 to a bit, but we only check this during instantiation in some
  cases, e.g.

  bit V = !if(!eq(x, 17), 0, 2);

  Verbose diagnostic message is generated when invalid value is
  resolveed to help locating the error.

- PR8330 is fixed as well.

llvm-svn: 163360
2012-09-06 23:32:48 +00:00
David Blaikie 4fc4775561 Remove unused variable introduced by r163346.
llvm-svn: 163359
2012-09-06 23:31:29 +00:00
Anna Zaks 772ee1ebad [analyzer] Assert that StmtPoint should be created with a non-null Stmt.
llvm-svn: 163358
2012-09-06 23:30:29 +00:00
Anna Zaks a2f970baa6 [analyzer] testing: add a build mode to allow C++11 testing.
llvm-svn: 163357
2012-09-06 23:30:27 +00:00
Ted Kremenek 2a786959b1 Refine diagnostics for leaks reported when returning an object
via function/method with [CF,NS]_RETURNS_NOT_RETAINED.

Fixes <rdar://problem/11379000>.

llvm-svn: 163355
2012-09-06 23:03:07 +00:00
Eli Friedman 713bbb78c6 Don't include stdint.h directly.
llvm-svn: 163354
2012-09-06 22:55:11 +00:00
Ted Kremenek cadd9f186a Tweak DeadStoresChecker to not warn about dead stores to variables that
are used in EH code.  Right now the CFG doesn't support exceptions well,
so we need this hack to avoid bogus dead store warnings.

Fixes <rdar://problem/12147586>

llvm-svn: 163353
2012-09-06 22:32:48 +00:00
Enrico Granata c30a73adf6 Fixing a constness issue in an otherwise trivial patch
llvm-svn: 163352
2012-09-06 22:02:28 +00:00
Enrico Granata 6b09d42335 Restoring an API as deprecated which was removed in a previous commit
llvm-svn: 163351
2012-09-06 21:58:25 +00:00
Sam Panzer 22a3fe1b9c Clarified diagnostics for range-based for loops with invalid ranges
llvm-svn: 163350
2012-09-06 21:50:08 +00:00
Bill Wendling 33fa1df67d Explicitly erase the file from disk if something bad happened. <rdar://problem/12184899>
llvm-svn: 163349
2012-09-06 21:07:57 +00:00
Jordan Rose 2bc9674b0a [analyzer] Don't attempt to devirtualize calls to base class destructors.
CXXDestructorCall now has a flag for when it is a base destructor call.
Other kinds of destructor calls (locals, fields, temporaries, and 'delete')
all behave as "whole-object" destructors and do not behave differently
from one another (specifically, in these cases we /should/ try to
devirtualize a call to a virtual destructor).

This was causing crashes in both our internal buildbot, the crash still
being tracked in PR13765, and some of the crashes being tracked in PR13763,
due to a assertion failure. (The behavior under -Asserts happened to be
correct anyway.)

Adding this knowledge also allows our DynamicTypePropagation checker to do
a bit less work; the special rules about virtual method calls during a
destructor only require extra handling during base destructors.

llvm-svn: 163348
2012-09-06 20:37:08 +00:00
Jack Carter dc1e35d418 The Mips standalone assembler memory instruction support.
This includes sb,sc,sh,sw,lb,lw,lbu,lh,lhu,ll,lw

Test case included

Contributer: Vladimir Medic
llvm-svn: 163346
2012-09-06 20:00:02 +00:00
Chad Rosier 46b0a0adbe [ms-inline asm] Output empty asm statements for the directives we don't
handle.  Otherwise, the AsmParser will explode if we try to generate an
object files.

llvm-svn: 163345
2012-09-06 19:56:25 +00:00
Manman Ren c3366ccecb Release build: guard dump functions with "ifndef NDEBUG"
No functional change.

llvm-svn: 163344
2012-09-06 19:55:56 +00:00
Jakob Stoklund Olesen 84ecc3481b TiedTo is an integer, not a bool.
Thanks, Andy.

llvm-svn: 163343
2012-09-06 19:51:21 +00:00
Chad Rosier c05d2c908d [ms-inline asm] The IR representation of inline assembly enumerates the input
and output expressions much like that in GNU-style inline assembly. Output
expressions are first.  Do this for MS-style inline asms.

llvm-svn: 163342
2012-09-06 19:35:00 +00:00
Jim Ingham 9786eeeb6f When you reach the bottom of the inlined stack, don't say you can do a virtual step.
llvm-svn: 163341
2012-09-06 19:24:57 +00:00
Jim Ingham 46ef1807fc Include a useful bit of log output in the "step" as well as the "process" logs.
llvm-svn: 163340
2012-09-06 19:24:17 +00:00
Manman Ren 742534c4dc Release build: guard dump functions with "ifndef NDEBUG"
No functional change.

llvm-svn: 163339
2012-09-06 19:06:06 +00:00
Fariborz Jahanian 979780f68f refactoring + objective-C specific test for my last patch.
// rdar://12233989

llvm-svn: 163338
2012-09-06 18:38:58 +00:00
Richard Smith 09b031fbc0 Don't try to check override control for invalid member functions. Fixes a crash in a corner case. Patch by Olivier Goffart!
llvm-svn: 163337
2012-09-06 18:32:18 +00:00
Jakob Stoklund Olesen 866908c42c Allow overlaps between virtreg and physreg live ranges.
The RegisterCoalescer understands overlapping live ranges where one
register is defined as a copy of the other. With this change, register
allocators using LiveRegMatrix can do the same, at least for copies
between physical and virtual registers.

When a physreg is defined by a copy from a virtreg, allow those live
ranges to overlap:

  %CL<def> = COPY %vreg11:sub_8bit; GR32_ABCD:%vreg11
  %vreg13<def,tied1> = SAR32rCL %vreg13<tied0>, %CL<imp-use,kill>

We can assign %vreg11 to %ECX, overlapping the live range of %CL.

llvm-svn: 163336
2012-09-06 18:15:23 +00:00
Jakob Stoklund Olesen bb4bdd8912 Handle overlapping regunit intervals in LiveIntervals::addKillFlags().
We will soon allow virtual register live ranges to overlap regunit live
ranges when the physreg is defined as a copy of the virtreg:

  %EAX = COPY %vreg5
  FOO %vreg5
  BAR %EAX<kill>

There is no real interference since %vreg5 and %EAX have the same value
where they overlap.

This patch prevents addKillFlags from adding virtreg kill flags to FOO
where the assigned physreg is overlapping the virtual register live
range.

llvm-svn: 163335
2012-09-06 18:15:18 +00:00
Jakob Stoklund Olesen 4aed470376 Clear kill flags while computing live ranges.
Kill flags are difficult to maintain, and liveness queries are better
handled by live intervals.

Kill flags are reinserted after register allocation by addKillFlags().

llvm-svn: 163334
2012-09-06 18:15:15 +00:00
Derek Schuff 09338a250a Use custom ABIInfo for le32/PNaCl argument codegen
This patch uses a new ABIInfo implementation specific to the le32
target, rather than falling back to DefaultABIInfo. Its behavior is
basically the same, but it also allows the regparm argument attribute.
It also includes basic tests for argument codegen and attributes.

llvm-svn: 163333
2012-09-06 17:37:28 +00:00