Commit Graph

22088 Commits

Author SHA1 Message Date
Rafael Espindola fffc1ce1d7 Fix PR9614 for functions with the always_inline attribute. Try to keep
the common case (-O0, no always_inline) fast.

llvm-svn: 143222
2011-10-28 20:43:56 +00:00
Fariborz Jahanian 2fa646d596 objective-c arc: type-casting of an objc pointer to
an rvalue retainable object type with life-time qualifier has no
effect and wil be diagnosed as error. // rdar://10244607

llvm-svn: 143219
2011-10-28 20:06:07 +00:00
Ted Kremenek a98358ea13 [analyzer] ObjC message sends to nil receivers that return structs are now okay (compiler zeroes out the data). Fixes <rdar://problem/9151319>.
llvm-svn: 143215
2011-10-28 19:05:10 +00:00
David Chisnall 0cc83e7518 It turns out that the Objective-C message lookup functions can throw exceptions after all...
llvm-svn: 143205
2011-10-28 17:55:06 +00:00
Richard Smith 11562c5e10 Reinstate r142844 (reverted in r142872) now that lvalue-to-rvalue conversions
are present in all the necessary places:

In constant expression evaluation, evaluate lvalues as lvalues and rvalues as
rvalues. Remove special case for caching reference initialization and fix a
cyclic initialization crash in the process.

llvm-svn: 143204
2011-10-28 17:51:58 +00:00
Benjamin Kramer 8dc5760eed Reflow code. No intended functionality change.
llvm-svn: 143192
2011-10-28 13:21:18 +00:00
Richard Smith 508ebf35ee Add (hopefully) the last missing lvalue-to-rvalue conversion. Add an assertion
to catch some future implicit lvalue-to-rvalue casts of inappropriate kinds.

llvm-svn: 143182
2011-10-28 03:31:48 +00:00
John McCall 9a43e12117 Be sure to build a dependent expression when we see
a binary operator involving a dependently-typed overload set.

llvm-svn: 143172
2011-10-28 01:04:34 +00:00
Richard Trieu 03cf7b70e0 Fix for PR9751 to change the behavior of -Wformat warnings. If the format
string is part of the function call, then there is no difference.  If the
format string is not, the warning will point to the call site and a note
will point to where the format string is.

Fix-it hints for strings are moved to the note if a note is emitted.  This will
prevent changes to format strings that may be used in multiple places.

llvm-svn: 143168
2011-10-28 00:41:25 +00:00
Richard Smith 01ebacd80d Add missing lvalue-to-rvalue conversion to vector splat casts.
llvm-svn: 143166
2011-10-27 23:31:58 +00:00
Richard Smith 08b12f1f5e Fix some cases where a CK_IntegralCast was being used to convert an lvalue to an
rvalue. An assertion to catch this is in ImpCastExprToType will follow, but
vector operations currently trip over this (due to omitting the usual arithmetic
conversions). Also add an assert to catch missing lvalue-to-rvalue conversions
on the LHS of ->.

llvm-svn: 143155
2011-10-27 22:11:44 +00:00
Fariborz Jahanian cceafc4931 objc: fix an ir-gen crash caused by recent
property refactoring. // rdar://10327068

llvm-svn: 143139
2011-10-27 20:06:32 +00:00
Ted Kremenek bd307a5372 Add mutex for accessing ASTUnit's global OnDisk data. This may be an issue as libclang could be processing multiple ASTUnit's at once.
llvm-svn: 143138
2011-10-27 19:44:25 +00:00
Peter Collingbourne 95fd2ca69f Annotate imprecise FP division with fpaccuracy metadata
The OpenCL single precision division operation is only required to
be accurate to 2.5ulp.  Annotate the fdiv instruction with metadata
which signals to the backend that an imprecise divide instruction
may be used.

llvm-svn: 143136
2011-10-27 19:19:51 +00:00
Argyrios Kyrtzidis 81ddd1866d [PCH] Pull the location out of the serialized declarations and put it in the array
of decl bit offsets.

This allows us to easily get at the location of a decl without deserializing it.
It increases size of Cocoa PCH by only 0.2%.

llvm-svn: 143123
2011-10-27 18:47:35 +00:00
Ted Kremenek 06b4f919e8 Move ASTUnit's handling of temporary files and the preamble file into a lazily-created static DenseMap. This DenseMap is cleared (and the files erased) via an atexit routine in the case an ASTUnit is not destroyed. Fixes <rdar://problem/10293367>.
llvm-svn: 143115
2011-10-27 17:55:18 +00:00
Douglas Gregor 935bc7a214 Make the loading of information attached to an IdentifierInfo from an
AST file more lazy, so that we don't eagerly load that information for
all known identifiers each time a new AST file is loaded. The eager
reloading made some sense in the context of precompiled headers, since
very few identifiers were defined before PCH load time. With modules,
however, a huge amount of code can get parsed before we see an
@import, so laziness becomes important here.

The approach taken to make this information lazy is fairly simple:
when we load a new AST file, we mark all of the existing identifiers
as being out-of-date. Whenever we want to access information that may
come from an AST (e.g., whether the identifier has a macro definition,
or what top-level declarations have that name), we check the
out-of-date bit and, if it's set, ask the AST reader to update the
IdentifierInfo from the AST files. The update is a merge, and we now
take care to merge declarations before/after imports with declarations
from multiple imports.

The results of this optimization are fairly dramatic. On a small
application that brings in 14 non-trivial modules, this takes modules
from being > 3x slower than a "perfect" PCH file down to 30% slower
for a full rebuild. A partial rebuild (where the PCH file or modules
can be re-used) is down to 7% slower. Making the PCH file just a
little imperfect (e.g., adding two smallish modules used by a bunch of
.m files that aren't in the PCH file) tips the scales in favor of the
modules approach, with 24% faster partial rebuilds.

This is just a first step; the lazy scheme could possibly be improved
by adding versioning, so we don't search into modules we already
searched. Moreover, we'll need similar lazy schemes for all of the
other lookup data structures, such as DeclContexts.

llvm-svn: 143100
2011-10-27 09:33:13 +00:00
Hans Wennborg 27541dbe1a Teach format string analysis that "%zu" means size_t.
The code had it backwards, thinking size_t was signed, and using that for "%zd".

Also let the analysis get the types for (u)intmax_t while we are at it.

llvm-svn: 143099
2011-10-27 08:29:09 +00:00
Anna Zaks 0ec04bf738 [analyzer] Move enqueueEndOfFunction into CoreEngine.
llvm-svn: 143090
2011-10-27 00:59:28 +00:00
Anna Zaks b1d3d96872 [analyzer] Make CoreEngine responsible for enqueueing Stmt Nodes.
Enqueue the nodes generated as the result of processing a statement
inside the Core Engine. This makes sure ExpEngine does not access
CoreEngine's private members and is more concise.

llvm-svn: 143089
2011-10-27 00:59:23 +00:00
Argyrios Kyrtzidis 67f914dc97 Make use of the parameter in Sema::ActOnObjCTemporaryExitContainerContext.
llvm-svn: 143088
2011-10-27 00:53:06 +00:00
Argyrios Kyrtzidis a9aabf7d51 Fix crash on an @interface nested inside @implementation, rdar://10336158
llvm-svn: 143085
2011-10-27 00:09:34 +00:00
Argyrios Kyrtzidis f26b12ada0 For the "'@end' is missing in implementation context" point at the location of '@'.
llvm-svn: 143084
2011-10-27 00:09:29 +00:00
Fariborz Jahanian 3249a1e862 Do not warn when weak-import attribute is applied to enum
decl. in Darwin due to certain projects requirement. 
// rdar://10277579

llvm-svn: 143082
2011-10-26 23:59:12 +00:00
Anna Zaks c9abbe2b3e [analyzer] Add getLocationContext to CheckerContext
CheckerContext::getPredecessor is only used to get to the LocationContext
half of the times.

llvm-svn: 143061
2011-10-26 21:06:44 +00:00
Anna Zaks 6b1c21268d [analyzer] Remove EmitBasicReport form CheckerContext.
The path sensitive checkers should use EmitBasicReport, which provides the
node information.

llvm-svn: 143060
2011-10-26 21:06:39 +00:00
Anna Zaks da4c8d6811 [analyzer] Rename generateNode -> addTransition in CheckerContext
Also document addTransition methods.

llvm-svn: 143059
2011-10-26 21:06:34 +00:00
Anna Zaks b31d0143dd [analyzer] GenericNodeBuilder -> NodeBuilder.
Remove GenericNodeBuilder and use a class inherited from NodeBuilder instead.

llvm-svn: 143057
2011-10-26 21:06:22 +00:00
Fariborz Jahanian b005070b83 Objective-c: fix an ir-gen crash where objc messag returns a _Complex
value and ABI requires return slot to be passed as first
argument to message sent. // rdar://10331109

llvm-svn: 143053
2011-10-26 20:53:59 +00:00
Rafael Espindola c594135b68 Fix pr9614 by not emitting an available_externally function when it calls
itself via an asm label.

available_externally functions are supposed to correspond to an external
function, and that is not the case in the examples in pr9614.

llvm-svn: 143049
2011-10-26 20:41:06 +00:00
Richard Smith cab9a7d51c Pull out conversion on LHS of -> and . into its own function. This happens
implicitly in LookupMemberExpr and explicitly in cases where template
instantiation doesn't redo the lookup.

llvm-svn: 143046
2011-10-26 19:06:56 +00:00
Douglas Gregor 3e30010d99 Eliminate a hang while loading a sequence of redeclarable entities. In
essence, the redeclaration chain for a class could end up in an
inconsistent state while deserializing multiple declarations in that
chain, where the circular linked list was not, in fact,
circular. Since only two redeclarations of the same entity will get
loaded when we're in this state, restore circularity when both have
been loaded. Fixes <rdar://problem/10324940> / PR11195.

llvm-svn: 143037
2011-10-26 17:53:41 +00:00
Eli Friedman 64d9504b8f Compute the promoted integer type of fixed-width enums correctly. Found by inspection.
llvm-svn: 143021
2011-10-26 07:38:19 +00:00
Eli Friedman 3f37c1ce4c Correctly perform integral promotions on wchar_t/char16_t/char32_t in C++. <rdar://problem/10309088>.
llvm-svn: 143019
2011-10-26 07:22:48 +00:00
Richard Smith ae1bab56d9 Fix crash due to missing array-to-pointer decay when instantiating an unresolved
member expression. Refactoring to follow.

llvm-svn: 143017
2011-10-26 06:49:26 +00:00
Richard Smith 3d5c1fa93f UnresolvedMemberExprs need lvalue-to-rvalue conversions during template
instantiations too.

llvm-svn: 143016
2011-10-26 06:15:36 +00:00
Anna Zaks 58734db080 [analyzer] Remove getEngine() form CheckerContext
A step toward making sure that diagnostics report should only
be generated though the CheckerContext and not though BugReporter
or ExprEngine directly.

llvm-svn: 142947
2011-10-25 19:57:11 +00:00
Anna Zaks b473816b4a [analyzer] Simplify CheckerContext
Remove dead members/parameters: ProgramState, respondsToCallback, autoTransition.
Remove addTransition method since it's the same as generateNode. Maybe we should
rename generateNode to genTransition (since a transition is always automatically
generated)?

llvm-svn: 142946
2011-10-25 19:57:06 +00:00
Anna Zaks 513921dc8a [analyzer] Remove unused headers.
llvm-svn: 142945
2011-10-25 19:56:58 +00:00
Anna Zaks f380534a1a [analyzer] Make branch for condition callback use CheckerContext
Now, all the path sensitive checkers use CheckerContext!

llvm-svn: 142944
2011-10-25 19:56:54 +00:00
Anna Zaks 3eae33412d [analyze] Convert EndOfPath callback to use CheckerContext
Get rid of the EndOfPathBuilder completely.
Use the generic NodeBuilder to generate nodes.
Enqueue the end of path frontier explicitly.

llvm-svn: 142943
2011-10-25 19:56:48 +00:00
David Blaikie dd58d4ca8f Handle redundant 'typename' on base class specifications.
llvm-svn: 142937
2011-10-25 18:46:41 +00:00
David Blaikie afa155fb88 Fix erroneous name-specifiers prior to decltypes better/correctly as per Doug's feedback.
llvm-svn: 142935
2011-10-25 18:17:58 +00:00
John McCall 526ab47a55 Restore r142914 and r142915, now with missing file and apparent
GCC compiler workaround.

llvm-svn: 142931
2011-10-25 17:37:35 +00:00
David Blaikie b75951f477 Initialize the BaseLoc for decltype base type specifications.
llvm-svn: 142929
2011-10-25 17:14:10 +00:00
David Blaikie 1cd50022b2 Fix cases where the optional nested-name-specifier erroneously preceeded a decltype-specification when specifying a base type.
llvm-svn: 142928
2011-10-25 17:10:12 +00:00
David Blaikie 00ee7a081d Support the use of decltype for specifying base types. Fixes PR11216.
llvm-svn: 142926
2011-10-25 15:01:20 +00:00
NAKAMURA Takumi 9a8f13961c Revert r142914 and r142915, due to possibly missing file.
r142914: "Introduce a placeholder type for "pseudo object""
r142915: "Pull the pseudo-object stuff into its own file."
llvm-svn: 142921
2011-10-25 14:32:25 +00:00
David Chisnall e89ac0666b Change an int64_t to an intptr_t so that we don't end up with crashes in the back end on large classes on 32-bit.
llvm-svn: 142918
2011-10-25 10:12:21 +00:00
John McCall 2ab33d28a8 Pull the pseudo-object stuff into its own file.
Tidy up some marginally related code just to annoy
single-purpose-commit lovers.  No functionality change.

llvm-svn: 142915
2011-10-25 08:42:34 +00:00