Commit Graph

129896 Commits

Author SHA1 Message Date
Jordan Rose e8d5567426 [analyzer] If 'super' is known to be nil, we can still mark its range.
llvm-svn: 159596
2012-07-02 21:41:56 +00:00
Jordan Rose 62146f67b7 Revert "Remove unused member (& consequently unused parameter) in SA's Call code."
...and instead add an accessor. We're not using this today, but it's something
that should probably stay in the source for potential clients, and it doesn't
cost a lot. (ObjCPropertyAccess is only created on the stack, and right now
there's only ever one alive at a time.)

This reverts r159581 / commit 8e674e1da34a131faa7d43dc3fcbd6e49120edbe.

llvm-svn: 159595
2012-07-02 21:41:53 +00:00
Chandler Carruth 3bf1d5d1de We support a mode where the Clang regression tests are run but not the
Clang unit tests. It's not clear why we support this mode in builds
where LLVM is available (LLVM itself does not), but at least this makes
us support it correctly.

This also fixes a long-standing bug where we would pass the unit test
param flag to lit in the standalone build even though the standalone
build *never* has the unittests built and ready for testing.

llvm-svn: 159594
2012-07-02 21:37:04 +00:00
Chandler Carruth aec961811b Revert r159588, and apply a more principled fix. Place the fix for this
in the abstraction for lit test suites so that the various other layers
of abstraction pick up the same behavioral fix, and so that we still get
a complete list of dependencies for the 'check-all' target.

This should fix the follow-on issues of the same nature with various
other build targets, including Clang targets. Sorry for the churn, and
again thanks to Matt for testing and breaking this more thoroughly.

llvm-svn: 159593
2012-07-02 21:31:03 +00:00
David Blaikie df9582cca5 Include -D files in crash report repro scripts. (PR13255)
Now that we're only using -frewrite-includes rather than full preprocessing
when producing repro source files, we should also include command line macro
definitions in the repro script.

I don't have a test case for this because I'm not sure if/how I can open the
crash report file when the name is only known by scraping the crash report
output. Suggestions welcome if anyone thinks it'd be helpful.

llvm-svn: 159592
2012-07-02 21:28:00 +00:00
Jordan Rose d39e5f1463 In blocks, only pretend that enum constants have enum type if necessary.
In C, enum constants have the type of the enum's underlying integer type,
rather than the type of the enum. (This is not true in C++.) Thus, when a
block's return type is inferred from an enum constant, it is incompatible
with expressions that return the enum type.

In r158899, I told block returns to pretend that enum constants have enum
type, like in C++. Doug Gregor pointed out that this can break existing code.

Now, we don't check the types of return statements until the end of the block.
This lets us go back and add implicit casts in blocks with mixed enum
constants and enum-typed expressions.

<rdar://problem/11662489> (again)

llvm-svn: 159591
2012-07-02 21:19:23 +00:00
Eric Christopher dd8638fb3e Turn an assert into an error to make it a bit more friendly.
Part of rdar://6880388 and rdar://11766377

llvm-svn: 159590
2012-07-02 21:16:43 +00:00
Chandler Carruth 6e80d5934d Work around a really frustrating apparant CMake bug.
No functionality changed here, except that the CMake installed by
default on Ubuntu Lucid should actually work with the makefile
generators now.

Thanks to Matt for the report and head-desking required to figure out
why it was failing.

llvm-svn: 159588
2012-07-02 21:14:06 +00:00
Eli Friedman c9f439461b When we're looking for redeclarations which might provide a definition in CodeGen, make sure we examine all the redeclarations. PR13252.
llvm-svn: 159586
2012-07-02 21:05:30 +00:00
Ted Kremenek b4204310f4 Make this test invariant to future changes of the max loop unrolling count.
llvm-svn: 159585
2012-07-02 21:02:22 +00:00
Douglas Gregor b9b8b81ef2 Be more eager about setting the 'Invalid' bit on an invalid class
template instantiation. I wasn't able to reproduce this down to
anything small enough to put in our test suite, but it's "obviously"
okay to set the invalid bit earlier and precludes a
known-broken-but-not-marked-broken class from being used elsewhere.

llvm-svn: 159584
2012-07-02 21:00:41 +00:00
David Blaikie 6b8b051b47 Fix -Wstring-conversion warning.
Patch by Matt Beaumont-Gay.

llvm-svn: 159583
2012-07-02 21:00:00 +00:00
Chandler Carruth e8f69b733a Clone a bit of LIT flag defaults from the LLVM CMake file into the
standalone section of the Clang CMake files.

This will likely make the lit runs in Clang much more suitable to IDEs
such as Xcode and MSVC when operating in a standalone mode.

llvm-svn: 159582
2012-07-02 20:52:55 +00:00
David Blaikie 977a35644e Remove unused member (& consequently unused parameter) in SA's Call code.
This member became unused in r159559.

llvm-svn: 159581
2012-07-02 20:44:57 +00:00
Chandler Carruth 498525e4bb Revert r159528 which taught lit's builtin shell test runner about the
'|&' bash syntax. We have lots of users with a bash on their system
which doesn't support this syntax, and as bash is still significantly
faster, we should support them.

The test suite has already been updated to cope with this.

llvm-svn: 159580
2012-07-02 20:43:21 +00:00
Abramo Bagnara b1cdde7d21 Reintroduced FieldDecl public methods setBitWidth and removeBitWidth.
llvm-svn: 159579
2012-07-02 20:35:48 +00:00
Ted Kremenek de21a1c964 Bail out the LiveVariables analysis when the CFG is very large, as
we are encountering some scalability issues with memory usage.   The
appropriate long term fix is to make the analysis more scalable, but
this will at least prevent the analyzer swapping when
analyzing very large functions.

llvm-svn: 159578
2012-07-02 20:21:52 +00:00
Ted Kremenek 146ef384da Fix subtle bug in AnalysisConsumer where we would not analyze functions whose parent
in the call graph had been inlined but for whatever reason we did not inline some
of its callees.

Also, fix a related traversal bug where we meant to do a BFS of the callgraph but
instead were doing a DFS.

llvm-svn: 159577
2012-07-02 20:21:48 +00:00
Chandler Carruth 6b963db39a Switch from using a lit.cfg-generator variable to the real variable in
the standalone mode. We've changed scoping and sequencing of variables
being defined and that cause this to start to be unset breaking some
cmake users. Thanks to Jordan Rose for the report.

The fix also makes the condition on the preceding line much more
sensible. =D

llvm-svn: 159576
2012-07-02 20:14:59 +00:00
Chandler Carruth cfa4652d3a Switch from using a lit.cfg-generator variable that happens to be found
due to strange scoping rules to the actual canonical variable name
within the LLVM CMake build.

No functionality changed.

llvm-svn: 159575
2012-07-02 20:14:54 +00:00
Jack Carter 06de0fb083 Pass the correct ELFOSABI enumeration to the MipsELFObjectWriter constructor
Contributer: Sasa Stankovic 
llvm-svn: 159574
2012-07-02 20:04:43 +00:00
Douglas Gregor 271205cedb Reduce default template instantiation depth to 512; we're blowing out
the stack too often with 1024. Fixes <rdar://problem/11678534>.

llvm-svn: 159573
2012-07-02 19:56:23 +00:00
Bob Wilson cac3b90633 Extend TargetPassConfig to allow running only a subset of the normal passes.
This is still a work in progress but I believe it is currently good enough
to fix PR13122 "Need unit test driver for codegen IR passes".  For example,
you can run llc with -stop-after=loop-reduce to have it dump out the IR after
running LSR.  Serializing machine-level IR is not yet supported but we have
some patches in progress for that.

The plan is to serialize the IR to a YAML file, containing separate sections
for the LLVM IR, machine-level IR, and whatever other info is needed.  Chad
suggested that we stash the stop-after pass in the YAML file and use that
instead of the start-after option to figure out where to restart the
compilation.  I think that's a great idea, but since it's not implemented yet
I put the -start-after option into this patch for testing purposes.

llvm-svn: 159570
2012-07-02 19:48:45 +00:00
Bob Wilson a3f9fa710a Move assertion with TargetPassConfig's Initialized flag.
llvm-svn: 159569
2012-07-02 19:48:39 +00:00
Bob Wilson b9b693650a Consistently use AnalysisID types in TargetPassConfig.
This makes it possible to just use a zero value to represent "no pass", so
the phony NoPassID global variable is no longer needed.

llvm-svn: 159568
2012-07-02 19:48:37 +00:00
Bob Wilson bbd38dd9c0 Add all codegen passes to the PassManager via TargetPassConfig.
This is a preliminary step toward having TargetPassConfig be able to
start and stop the compilation at specified passes for unit testing
and debugging.  No functionality change.

llvm-svn: 159567
2012-07-02 19:48:31 +00:00
Bob Wilson 36e31cca78 Add a missing forward declaration of PassManagerBase.
llvm-svn: 159566
2012-07-02 19:48:18 +00:00
Evan Cheng 58aeca0878 Need a space.
llvm-svn: 159565
2012-07-02 19:45:42 +00:00
Jordan Rose 682b31621f [analyzer] Convert existing checkers to use check::preCall and check::postCall.
llvm-svn: 159563
2012-07-02 19:28:21 +00:00
Jordan Rose afe7c2c2bf [analyzer] Add generic preCall and postCall checks.
llvm-svn: 159562
2012-07-02 19:28:16 +00:00
Jordan Rose f3c12ac3b1 [analyzer] Convert CXXConstructExpr over to use CallEvent for evaluation.
llvm-svn: 159561
2012-07-02 19:28:12 +00:00
Jordan Rose cbeef55886 [analyzer] Use CallEvent for inlining and call default-evaluation.
llvm-svn: 159560
2012-07-02 19:28:09 +00:00
Jordan Rose 547060b30b [analyzer] Finish replacing ObjCMessage with ObjCMethodDecl and friends.
The preObjCMessage and postObjCMessage callbacks now take an ObjCMethodCall
argument, which can represent an explicit message send (ObjCMessageSend) or an
implicit message generated by a property access (ObjCPropertyAccess).

llvm-svn: 159559
2012-07-02 19:28:04 +00:00
Jordan Rose 6bad4905d7 [analyzer] Begin replacing ObjCMessage with ObjCMethodCall and friends.
Previously, the CallEvent subclass ObjCMessageInvocation was just a wrapper
around the existing ObjCMessage abstraction (over message sends and property
accesses). Now, we have abstract CallEvent ObjCMethodCall with subclasses
ObjCMessageSend and ObjCPropertyAccess.

In addition to removing yet another wrapper object, this should make it easy
to add a ObjCSubscriptAccess call event soon.

llvm-svn: 159558
2012-07-02 19:27:56 +00:00
Jordan Rose 7ab0182e33 [analyzer] Move the last bits of CallOrObjCMessage over to CallEvent.
This involved refactoring some common pointer-escapes code onto CallEvent,
then having MallocChecker use those callbacks for whether or not to consider
a pointer's /ownership/ as escaping. This still needs to be pinned down, and
probably we want to make the new argumentsMayEscape() function a little more
discerning (content invalidation vs. ownership/metadata invalidation), but
this is a good improvement.

As a bonus, also remove CallOrObjCMessage from the source completely.

llvm-svn: 159557
2012-07-02 19:27:51 +00:00
Jordan Rose 2995349f3e [analyzer] Convert CallAndMessageChecker and ObjCSelfInitChecker to CallEvent.
Both of these got uglier rather than cleaner because we don't have preCall and
postCall yet; properly wrapping a CallExpr in a CallEvent requires doing a bit
of deconstruction on the callee. Even when we have preCall and postCall we may
want to expose the current CallEvent to pre/postStmt<CallExpr>.

llvm-svn: 159556
2012-07-02 19:27:46 +00:00
Jordan Rose eec1539a31 [analyzer] Convert RetainCountChecker to use CallEvent as much as possible.
This ended allowing quite a bit of cleanup, and some minor changes.

- CallEvent makes it easy to use hasNonZeroCallbackArg more aggressively, which
  we check in order to avoid false positives with callbacks that might release
  the object.
- In order to support this for functions which consume their arguments, there
  are two new ArgEffects: DecRefAndStopTracking and DecRefMsgAndStopTracking.
  These act just like StopTracking, except that if the object only had a
  return count of +1 it's now considered released instead (so we still get
  use-after-free messages).
- On the plus side, we no longer have to special-case
  +[NSObject performSelector:withObject:afterDelay:] and friends.
- The use of IdentifierInfos in the method summary cache is now hidden; only
  the ObjCInterfaceDecl gets passed around most of the time.
- Since we cache all "simple" summaries and check every function call, there is
  no real benefit to having NULL stand in for default summaries anymore.
- Whitespace, unused methods, etc.

Even more simplification to come when we get check::postCall and can unify all
these other post* checks.

llvm-svn: 159555
2012-07-02 19:27:43 +00:00
Jordan Rose 742920c8e7 [analyzer] Add a new abstraction over all types of calls: CallEvent
This is intended to replace CallOrObjCMessage, and is eventually intended to be
used for anything that cares more about /what/ is being called than /how/ it's
being called. For example, inlining destructors should be the same as inlining
blocks, and checking __attribute__((nonnull)) should apply to the allocator
calls generated by operator new.

llvm-svn: 159554
2012-07-02 19:27:35 +00:00
Argyrios Kyrtzidis 442dd80715 [PCH] Make sure that all newly introduced visible decls in a DeclContext
coming from an AST file are registered for serialization.

A static data member instantiation of in a chained PCH could be missed
when serializing decls; the result was that when emitting the visible decls
map of its DeclContext, we would use a DeclID that was not actually emitted,
leading to crashes or hangs.

Fix this by making sure such decls are always registered for serialization.
Also introduce extra sanity checks to make sure we don't register new
declarations or types after we have serialized the types/decls block.

rdar://11728990

llvm-svn: 159550
2012-07-02 19:19:01 +00:00
Richard Smith 200f47c65d A ':' after an enum-specifier at class scope is a bitfield, not a typo for a ';'.
llvm-svn: 159549
2012-07-02 19:14:01 +00:00
Andrew Trick 21cca97d95 Revert accidental checkin.
My last checkin was apparently not the branch I intended. It was missing one change (added by chandlerc), and contained a spurious change.

llvm-svn: 159548
2012-07-02 19:12:29 +00:00
Chandler Carruth ff123d5c63 Fix the remaining TCL-style quotes found in the testsuite. This is
another mechanical change accomplished though the power of terrible Perl
scripts.

I have manually switched some "s to 's to make escaping simpler.

While I started this to fix tests that aren't run in all configurations,
the massive number of tests is due to a really frustrating fragility of
our testing infrastructure: things like 'grep -v', 'not grep', and
'expected failures' can mask broken tests all too easily.

Essentially, I'm deeply disturbed that I can change the testsuite so
radically without causing any change in results for most platforms. =/

llvm-svn: 159547
2012-07-02 19:09:46 +00:00
Duncan Sands e8ce94fcd7 GlobalOpt forgot to handle bitcast when analyzing globals. Found by inspection.
llvm-svn: 159546
2012-07-02 18:55:39 +00:00
Manman Ren 72098b2c91 Added assertion in getVRegDef of MachineRegisterInfo to make sure the virtual
register does not have multiple definitions. Modified TwoAddressInstructionPass
to use getUniqueVRegDef instead of getVRegDef.

llvm-svn: 159545
2012-07-02 18:55:36 +00:00
Chandler Carruth 5da53436d5 Convert the uses of '|&' to use '2>&1 |' instead, which works on old
versions of Bash. In addition, I can back out the change to the lit
built-in shell test runner to support this.

This should fix the majority of fallout on Darwin, but I suspect there
will be a few straggling issues.

llvm-svn: 159544
2012-07-02 18:37:59 +00:00
Chandler Carruth 9b887d11b5 Fix the C++11 build. I hate narrowing conversions.
llvm-svn: 159543
2012-07-02 18:28:34 +00:00
Andrew Trick f161e391f8 Reapply "Make NumMicroOps a variable in the subtarget's instruction itinerary."
Reapplies r159406 with minor cleanup. The regressions appear to have been spurious.

llvm-svn: 159541
2012-07-02 18:10:42 +00:00
Stepan Dyatkovskiy 1698d50aac Fixed switch in IntRange::isSingleNumber method.
llvm-svn: 159540
2012-07-02 17:42:46 +00:00
Dmitri Gribenko 3292d06a1b Add a new libclang completion API to get brief documentation comment that is
attached to a declaration in the completion string.

Since extracting comments isn't free, a new code completion option is
introduced.

A new code completion option that enables including brief comments
into CodeCompletionString should be a, err, code completion option.
But because ASTUnit caches global declarations during parsing before
even completion consumer is created, the option is duplicated as a
translation unit option (in both libclang and ASTUnit, like the option
to cache code completion results).

llvm-svn: 159539
2012-07-02 17:35:10 +00:00
Bob Wilson 2297221028 Do not attempt to use ROR for Thumb1.
Patch by Matt Fischer!

llvm-svn: 159538
2012-07-02 17:22:47 +00:00