Commit Graph

25913 Commits

Author SHA1 Message Date
Benjamin Kramer e2a929df73 Split out the "empty" case for compound statement into a separate ctor.
Move the ASTContext-dependent version out of line.

llvm-svn: 159717
2012-07-04 17:03:41 +00:00
Benjamin Kramer 300c063db3 CXXRecordDecl: Split getBases/getVBases into a slow and a fast path.
This avoids costly computation of getASTContext() and drops the header
dependency from DeclCXX.h to ASTContext.h.

llvm-svn: 159716
2012-07-04 17:03:33 +00:00
David Chisnall da22535573 Hoist the logic for selecting the Objective-C dispatch method into the runtime
class, from the target.  No functionality change, just less duplicated logic.

llvm-svn: 159710
2012-07-04 11:52:24 +00:00
David Chisnall 314896c9fc A few more cleanups for the GNU family of ObjC runtimes.
llvm-svn: 159708
2012-07-04 10:37:03 +00:00
Abramo Bagnara e06a8887d8 Renamed RawComment kinds to avoid name clash.
llvm-svn: 159706
2012-07-04 07:30:26 +00:00
Bob Wilson ef285b4c22 Move a comment from the commit message into the code.
llvm-svn: 159696
2012-07-04 00:18:41 +00:00
Fariborz Jahanian 8be1ecd615 Obj-C++11 parser: handle a fall out of delayed
c-function parsing when a declaration with
C++0x braced-init-list is inside an @implementation.

llvm-svn: 159693
2012-07-03 23:22:13 +00:00
Jordan Rose 017591ab45 [analyzer] For now, don't inline non-static member overloaded operators.
Our current inlining support (specifically RegionStore::enterStackFrame)
doesn't know that calls to overloaded operators may be calls to non-static
member functions, and that in these cases the first argument should be
treated as 'this'. This caused incorrect results and sometimes crashes.

The long-term fix will be to rewrite RegionStore::enterStackFrame to use
CallEvent and its subclasses, but for now we can just disable these
problematic calls by classifying them under a new CallEvent,
CXXMemberOperatorCall.

llvm-svn: 159692
2012-07-03 22:55:57 +00:00
Fariborz Jahanian 8a369a82d5 Obj-C++11 parser: fix broken parsing of c-function
defined in class implementations.

llvm-svn: 159691
2012-07-03 22:54:28 +00:00
Fariborz Jahanian f30f6ac7b9 Obj-C++11 parser: turn off buffering of
c-function defined in objc class
implementation for now.

llvm-svn: 159690
2012-07-03 22:29:23 +00:00
Fariborz Jahanian 450bb6e8ff objective-c: Refactor parse/sema portion of
objective-c's fast enumeration statement,
for more work to come.

llvm-svn: 159689
2012-07-03 22:00:52 +00:00
David Chisnall b601c96892 Rename the GCC Objective-C runtime to gcc from gnu-fragile and the GNUstep
runtime to gnustep from gnu.  Fix EH for the GCC runtime.

llvm-svn: 159684
2012-07-03 20:49:52 +00:00
Bob Wilson 1e148fe064 When using -pg targeting OS X 10.8, pass -no_new_main to the linker.
By default on OS X 10.8, we don't link with a crt1.o file and the linker
knows to use _main as the entry point.  But, when compiling with -pg, we
need to link with the gcrt1.o file, and the linker needs to be told to use
the "start" symbol as the entry point.  The -no_new_main linker option does
that last part.  <rdar://problem/11491405>

llvm-svn: 159683
2012-07-03 20:42:10 +00:00
DeLesley Hutchins 3a8d6cff14 Thread safety analysis: improve handling of smart pointers.
llvm-svn: 159679
2012-07-03 19:47:18 +00:00
Akira Hatanaka e1e3ad3d11 Make the following changes in the way Mips handles vector arguments and return
values:

- Return integer vectors in integer registers.
- Pass vector arguments in integer registers.
- Set an upper bound for argument alignment. The largest alignment is 8-byte
  for O32 and 16-byte for N32/64.

llvm-svn: 159676
2012-07-03 19:24:06 +00:00
DeLesley Hutchins 0c1da20bf8 Thread Safety Analysis: handle expressions involving temporaries,
e.g. ExprWithCleanups.

llvm-svn: 159674
2012-07-03 18:25:56 +00:00
Dmitri Gribenko 767ea0ff4a CommentBriefParser: remove dead store. Found by Clang Analyzer.
llvm-svn: 159673
2012-07-03 18:10:20 +00:00
Hal Finkel 6b984f084c Add additional architecture defines for PPC targets.
Patch by Andy Gibbs.

llvm-svn: 159665
2012-07-03 16:51:04 +00:00
Argyrios Kyrtzidis 4cf2ffe28b [libclang] Protect against a race condition where a thread
may be destroying an ASTUnit while cleanupOnDiskMapAtExit is
getting called.

rdar://11781241

llvm-svn: 159664
2012-07-03 16:30:52 +00:00
Matt Beaumont-Gay 36af16affd Silence warning in -Asserts build
llvm-svn: 159635
2012-07-03 03:55:58 +00:00
Nico Weber 4b18c3ff40 Share ConvertUTF8toWide() between Lex and CodeGen.
llvm-svn: 159634
2012-07-03 02:24:52 +00:00
Nico Weber b8124d1af1 Rename -Wself-assign-memvar to -Wself-assign-field to improve local consistency a bit.
(cf -Wunused-private-field and several other existing -field diagnostics.)

llvm-svn: 159633
2012-07-03 02:03:06 +00:00
Chandler Carruth c4702dac1c Remove a redundant assignment to the FDecl variable from *inside* it's
initializer.

I really feel like Clang should warn about this, but I can't describe
a good reason. GCC will warn on this in some cases under
-Wsequence-point, but it actually seems like a false positive for that
warning....

llvm-svn: 159631
2012-07-03 00:15:11 +00:00
John McCall 4e8ca4fa14 Significantly simplify CGExprAgg's logic about ignored results:
if we want to ignore a result, the Dest will be null.  Otherwise,
we must copy into it.  This means we need to ensure a slot when
loading from a volatile l-value.

With all that in place, fix a bug with chained assignments into
__block variables of aggregate type where we were losing insight into
the actual source of the value during the second assignment.

llvm-svn: 159630
2012-07-02 23:58:38 +00:00
James Dennett 0bb4164ce8 Documentation cleanup: Delete a duplicated/malformed doc comment.
llvm-svn: 159628
2012-07-02 23:56:17 +00:00
Fariborz Jahanian 577574ab88 objective-c: just as we have done for method definitions,
c-functions declared in implementation should have their 
parsing delayed until the end so, they can access forward
declared private methods. // rdar://10387088

llvm-svn: 159626
2012-07-02 23:37:09 +00:00
Richard Smith b721e301df -Wuninitialized: assume that an __attribute__((returns_twice)) function might
initialize any variable. This is extremely conservative, but is sufficient for
now.

llvm-svn: 159620
2012-07-02 23:23:04 +00:00
DeLesley Hutchins ab0d4e6cd8 Thread safety analysis: fixed bug that occurs when very silly people
use scoped_lockable without putting unlock_function on the
destructor.

llvm-svn: 159609
2012-07-02 22:26:29 +00:00
Jordan Rose a4ee064cf3 [analyzer] Introduce CXXAllocatorCall to handle placement arg invalidation.
This is NOT full-blown support for operator new, but removes some nasty
duplicated code introduced in r158784.

llvm-svn: 159608
2012-07-02 22:21:47 +00:00
DeLesley Hutchins 6e6dbb7618 Thread safety analysis: fixed incorrect error message at the end of a locks_required function.
llvm-svn: 159607
2012-07-02 22:16:54 +00:00
DeLesley Hutchins 2a15baf968 Thread safety analysis: don't warn in case of duplicate annotation.
llvm-svn: 159606
2012-07-02 22:12:12 +00:00
DeLesley Hutchins c4a6e51596 Thread Safety Analysis: turn off checking within trylock functions.
llvm-svn: 159601
2012-07-02 21:59:24 +00:00
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
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
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
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 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
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
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
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