Commit Graph

22255 Commits

Author SHA1 Message Date
Eli Friedman 055c970839 Add an option to emulate the strange Apple gcc behavior of #pragma pack.
<rdar://problem/10374763>

llvm-svn: 143527
2011-11-02 01:53:16 +00:00
Fariborz Jahanian 3018b95093 objc: warn if a readonly property has a setter attribute too.
// rdar://10357768

llvm-svn: 143518
2011-11-01 23:02:16 +00:00
Anna Zaks 49ea5bf562 [analyzer] Make sink attribute part of the node profile.
This prevents caching out on nodes with different sink flag.
(This is a cleaner fix for radar://10376675).

llvm-svn: 143517
2011-11-01 22:41:19 +00:00
Anna Zaks 9e82c62222 [analyzer] Fix PR11282 - an assert in markAsSink
This is another fallout from the refactoring. We were
calling MarkAsSink on a cached out node.
(Fixes radar://10376675)

llvm-svn: 143516
2011-11-01 22:41:14 +00:00
Anna Zaks bfb3520fc5 [analyzer] Make sure the child builder use temporary destination sets
The parent and child builders should not share node sets.

llvm-svn: 143515
2011-11-01 22:41:09 +00:00
Anna Zaks 6d319489df [analyzer] BranchNodeBuilder should not generate autotransitions.
This fixes radar://10367606

llvm-svn: 143514
2011-11-01 22:41:06 +00:00
Anna Zaks 1c887b35fb [analyzer] CheckerContext::getPredecessor() cleanup
Remove unnecessary calls to CheckerContext::getPredecessor() + Comments.

llvm-svn: 143513
2011-11-01 22:41:01 +00:00
Anna Zaks 658f977dba [analyzer] Remove the CheckerContext's destructor.
llvm-svn: 143512
2011-11-01 22:40:55 +00:00
Douglas Gregor c3ae7c363e When we run into a constructor or destructor that is defined in the
wrong class, make sure to drop it immediately; we don't want that
constructor to be available within the DeclContext. Fixes
<rdar://problem/9677163>.

llvm-svn: 143506
2011-11-01 22:13:30 +00:00
Douglas Gregor fe0055e6c8 When we see an out-of-line definition of a member class template that
does not match any declaration in the class (or class template), be
sure to mark it as invalid. Fixes PR10924 / <rdar://problem/10119422>.

llvm-svn: 143504
2011-11-01 21:35:16 +00:00
Sebastian Pop 8188c8a1f3 rename getHostTriple into getDefaultTargetTriple in clang
llvm-svn: 143503
2011-11-01 21:33:06 +00:00
Richard Smith cecf184e64 When constant-folding, don't look at the initializer of a global const variable
if it's marked as weak: that definition may not end up being used.

llvm-svn: 143496
2011-11-01 21:06:14 +00:00
Richard Smith 1f1f2d8ca3 Temporarily disable lvalue-to-rvalue conversions on const pointers while an
apparent miscompile triggered by this is investigated. This is essentially a
revert of r143298.

llvm-svn: 143491
2011-11-01 20:38:59 +00:00
Fariborz Jahanian ab92b753d6 Find copy constructor needed to copy an rvalue reference
c++ object into block descriptor. // rdar://9971124

llvm-svn: 143475
2011-11-01 18:57:34 +00:00
Matt Beaumont-Gay 3e59facf65 Silence a warning in -Asserts builds
llvm-svn: 143471
2011-11-01 18:10:22 +00:00
Ted Kremenek 5d6044e413 Downgrade err_iboutlet_object_type to a warning. It was breaking a bunch of code. We will reconsider promoting it back to an error later.
llvm-svn: 143470
2011-11-01 18:08:35 +00:00
Argyrios Kyrtzidis 244ce8b204 Put a reference of the ASTReader in the ASTUnit.
This is intended for direct access of the ASTReader for uses that make
little sense to try to shoehorn in the ExternalASTSource interface.

llvm-svn: 143465
2011-11-01 17:14:15 +00:00
Argyrios Kyrtzidis b9689bb46f [libclang] For a class extension, give it a unique USR but for any property or ivar
it contains give it a USR based on its semantic context, which is the interface.

This follows what we already did for objc methods. rdar://10371669

llvm-svn: 143464
2011-11-01 17:14:12 +00:00
Richard Smith fec0992aca Implement C++11 'constexpr calls must return constant expressions' rule, and
perform the code simplifications this rule allows.

llvm-svn: 143463
2011-11-01 16:57:24 +00:00
Sebastian Redl 72ef7bc2b5 Enable function call and some overload resolution with parameters of aggregate class type and initializer list arguments.
llvm-svn: 143462
2011-11-01 15:53:09 +00:00
Eli Friedman fcec630a57 Fix the representation of wide strings in the AST and IR so that it uses the native representation of integers for the elements. This fixes a bunch of nastiness involving
treating wide strings as a series of bytes.

Patch by Seth Cantrell.

llvm-svn: 143417
2011-11-01 02:23:42 +00:00
Eli Friedman 703e7153af Perform proper conversion for strings encoded in the source file as UTF-8. (For now, we are assuming the source character set is always UTF-8; this can be easily extended if necessary.)
Tests will be coming up in a subsequent commit.

Patch by Seth Cantrell.

llvm-svn: 143416
2011-11-01 02:14:50 +00:00
Eli Friedman 2ae0e1e279 Move ConvertUTF8toUTF32 out of #if 0, in preparation for a patch which needs it.
llvm-svn: 143415
2011-11-01 02:10:54 +00:00
Douglas Gregor a7efb88baa Add __has_feature(cxx_raw_string_literals) and
__has_feature(cxx_unicode_literals), from Michel Morin!

llvm-svn: 143412
2011-11-01 01:23:44 +00:00
Douglas Gregor 3c469769a2 Add __has_feature(cxx_defaulted_functions) for querying "defaulted
functions", from Michel Morin!

llvm-svn: 143411
2011-11-01 01:19:34 +00:00
Douglas Gregor d73f3ddb44 Rework the AST for the initializer of a delegating constructor, so
that it retains source location information for the type. Aside from
general goodness (being able to walk the types described in that
information), we now have a proper representation for dependent
delegating constructors. Fixes PR10457 (for real).

llvm-svn: 143410
2011-11-01 01:16:03 +00:00
Fariborz Jahanian f0cda63975 Adds IRGen support for captured rvalue references in blocks.
In this case, temporary value is copied into block descriptor
as their own copy to work on. // rdar://9971124

llvm-svn: 143399
2011-10-31 23:44:33 +00:00
Eli Friedman 42fbd62d92 Some minor comment changes in constant-folding comparisons.
llvm-svn: 143391
2011-10-31 22:54:30 +00:00
Eli Friedman c6be94b3de Don't try to fold comparisons between the address of an object and an arbitrary integer constant. Fixes regression from r143334.
llvm-svn: 143374
2011-10-31 22:28:05 +00:00
Argyrios Kyrtzidis 3689337c8e Revert r143342. Caching of code-completion results was intentionally placed in "reparse"
because we don't want to take this performance hit when doing code completion

Log of r143342:
Move caching of code-completion results from ASTUnit::Reparse to ASTUnit::CodeComplete,
so that it will happen when we are doing code-completion, not reparsing.

llvm-svn: 143367
2011-10-31 21:25:31 +00:00
Eli Friedman 90a2cdf1fb Add missing lvalue-to-rvalue conversion.
llvm-svn: 143364
2011-10-31 20:59:03 +00:00
Richard Smith dd78544d44 Refactoring and test for r143360. Support for array rvalue to pointer decay is
needed for C++11, and will follow later.

llvm-svn: 143363
2011-10-31 20:57:44 +00:00
Richard Smith fdc6a5956a Temporary fix for assert while evaluating array-to-pointer decay on array
rvalue. Test and better fix to follow.

llvm-svn: 143360
2011-10-31 20:20:33 +00:00
Anders Carlsson 2f1a6c3f01 In x86_64, when calling an Objective-C method that returns a _Complex long double, make sure to use the objc_msgSend_fp2ret function which ensures that the return value will be {0, 0} if the receiver is nil.
llvm-svn: 143350
2011-10-31 16:27:11 +00:00
Chandler Carruth 4c042fe667 Simplify the set of directories we look for on multiarch systems.
I don't have any Debian system with one of these currently, and it seems
unlikely for one to show up suddenly. We can add more patterns here if
they become necessary.

llvm-svn: 143346
2011-10-31 09:06:40 +00:00
Chandler Carruth 68ed0ae51c Add "just one more" include path to the monstrosity that is our header
search logic. The Debian multiarch seems to have completely changed from
when these were originally added, and I'd like to remove a bunch of
them, but I'll be lazy and delay that until this logic is hoisted into
the driver where it belongs.

This should resolve PR11223.

llvm-svn: 143345
2011-10-31 08:42:27 +00:00
Chandler Carruth fb7fa24e5c Fix part of PR11223 and probably a few dups as well. This teaches the
library search logic to "properly" handle multiarch installations. I've
tested this on both Debian unstable and the latest Ubuntu which both use
this setup, and this appears to work largely the same way as GCC does.
It isn't exactly the same, but it is close enough and more principled in
its behavior where it differs. This should resolve any failures to find
'crt1.o' etc on Debian-based Linux distributions. If folks find more
cases where we fail, please file bugs and CC me.

Test cases for all of the debian silliness are waiting both to simplify
the process of merging these down into the 3.0 release, and because
they're so crazy I haven't yet been able to really produce a fake tree
that represents what we need to test for. I'll eventually add them
though.

llvm-svn: 143344
2011-10-31 08:42:24 +00:00
Argyrios Kyrtzidis 1b544e3cf0 Move caching of code-completion results from ASTUnit::Reparse to ASTUnit::CodeComplete,
so that it will happen when we are doing code-completion, not reparsing.

llvm-svn: 143342
2011-10-31 07:20:19 +00:00
Argyrios Kyrtzidis 6fb6003aad [PCH] Now that we store the location of a decl outside its record
make sure that we keep track of locations of replaced decls as well.

llvm-svn: 143341
2011-10-31 07:20:15 +00:00
Argyrios Kyrtzidis 6c798bebc1 [PCH] For ASTReader's FileDeclIDs also associate the Module that the
local DeclIDs came from.

llvm-svn: 143340
2011-10-31 07:20:08 +00:00
Argyrios Kyrtzidis e54568d657 Have the ASTUnit associate the local declarations that get parsed with the file
that contains them.

llvm-svn: 143338
2011-10-31 07:19:59 +00:00
Richard Smith 4e4c78ffff C++11 generalized constant expression handling: evaluation support for
materialized temporaries.

llvm-svn: 143335
2011-10-31 05:52:43 +00:00
Richard Smith 83c682115b C++11 generalized constant expressions: evaluate equality comparisons between
arbitrary pointers, if those pointers don't point to weak objects or literals.

llvm-svn: 143334
2011-10-31 05:11:32 +00:00
Richard Smith 8b3497ee54 C++11 generalized constant expressions: support pointer comparisons where the
result is not unspecified.

llvm-svn: 143329
2011-10-31 01:37:14 +00:00
Nick Lewycky dd424a5bc4 Turn on the new .file directive when appropriate, instead of turning it off.
llvm-svn: 143327
2011-10-31 01:06:42 +00:00
Richard Smith 390cd49906 Fix assert on constant expression evaluation of floating point increment.
llvm-svn: 143320
2011-10-30 23:17:09 +00:00
Peter Collingbourne f1d76db466 Add support for lazily linking bitcode files (using a new
-mlink-bitcode-file flag), and more generally llvm::Modules, before
running optimisations.

llvm-svn: 143314
2011-10-30 17:30:44 +00:00
Roman Divacky ce253d89a2 Add support for sse4a and enable it for amdfam10 cpu.
llvm-svn: 143312
2011-10-30 13:47:56 +00:00
Jim Goodnow II 921b9f52f4 Fixed CXX struct and class initialization printing to support 'move'
type constructors.

llvm-svn: 143309
2011-10-30 11:17:39 +00:00
Roman Divacky 43eb6f8aeb Add support for amdfam10 cpu.
llvm-svn: 143305
2011-10-30 07:48:46 +00:00
Bob Wilson d32fba2379 Stop disabling integrated assembler with -static. <rdar://problem/10175391>
The integrated assembler seems to be working pretty well for -static code
now, so remove the hacks to disable it.

llvm-svn: 143304
2011-10-30 00:20:28 +00:00
Richard Smith 9c8d1c5c64 Don't crash if a GCC binary conditional is used in a constant expression on an
integer-cast pointer value.

llvm-svn: 143299
2011-10-29 22:55:55 +00:00
Richard Smith 35a1f85466 constexpr evaluation: allow lvalue-to-rvalue conversion on any literal type, not
just integers and floating point types. Since we don't support evaluating class
types or performing lvalue-to-rvalue conversions on array elements yet, this
just means pointer types right now.

llvm-svn: 143298
2011-10-29 21:53:17 +00:00
Richard Smith 0b0a0b6174 constexpr function substitution:
Track the function invocation where an lvalue referring to a constexpr function
parameter originated from, and use it to substitute the correct argument and to
determine whether such an argument's lifetime has ended.

llvm-svn: 143296
2011-10-29 20:57:55 +00:00
Abramo Bagnara 254b63068a Fixed FriendDecl source locations.
llvm-svn: 143295
2011-10-29 20:52:52 +00:00
Richard Smith 7b553f1b19 Rename Expr::Evaluate to Expr::EvaluateAsRValue to make it clear that it will
implicitly perform an lvalue-to-rvalue conversion if used on an lvalue
expression. Also improve the documentation of Expr::Evaluate* to indicate which
of them will accept expressions with side-effects.

llvm-svn: 143263
2011-10-29 00:50:52 +00:00
Ted Kremenek 4610ea2bcf Start work on SerializedDiagnosticPrinter, a new DiagnosticConsumer that serializes out the diagnostics for a given translation unit to a bit code file. This is a WIP.
The motivation for this new DiagnosticConsumer is to provide a way for tools invoking the compiler
to get its diagnostics via a libclang interface, rather than textually parsing the compiler output.
This gives us flexibility to change the compiler's textual output, but have a structured data format
for clients to use to get the diagnostics via a stable API.

I have no tests for this, but llvm-bcanalyzer so far shows that the emitted file is well-formed.

More work to follow.

llvm-svn: 143259
2011-10-29 00:12:39 +00:00
Fariborz Jahanian 244b187d22 objc-arc: desugar certain type and improve on diagnostic for
ownership qualifier cast which won't work.
// rdar://10244607

llvm-svn: 143258
2011-10-29 00:06:10 +00:00
Argyrios Kyrtzidis 7362e9bacb [PCH] Sort the file decls by file offset not raw source location.
Currently sorting by raw source location does work as intended but who knows
what may change in the future..

llvm-svn: 143256
2011-10-28 23:57:47 +00:00
Argyrios Kyrtzidis df53da8725 [PCH] In ASTWriter::associateDeclWithFile don't bother finding the file loc
if we are not interested in the decl.

llvm-svn: 143255
2011-10-28 23:57:43 +00:00
Richard Smith 472d495372 Fix assertion in constant expression evaluation. The LHS of a floating-point
binary operator isn't an rvalue if it's an assignment operator.

llvm-svn: 143250
2011-10-28 23:26:52 +00:00
Douglas Gregor 2c4542d3ec Give __STDC_VERSION__ the value 201001L when we're in C1x mode. The
committee hasn't set a value for __STDC_VERSION__ yet, so this is a
placeholder. But at least it's > 199901L.

llvm-svn: 143245
2011-10-28 23:02:54 +00:00
Argyrios Kyrtzidis b12986f1cb Make -error-on-deserialized-decl work correctly by correctly delegating to
the previous ASTDeserializationListener.

llvm-svn: 143241
2011-10-28 22:54:31 +00:00
Argyrios Kyrtzidis 729387327b [ARC] Do not transfer ARC ownership if the cast is going to result in r-value,
in which case the ownership is redundant. Thanks to John for the suggestion.

llvm-svn: 143240
2011-10-28 22:54:28 +00:00
Argyrios Kyrtzidis 5fc727a0c2 [PCH] Keep track of file-level declarations that are contained by files.
Introduce a FILE_SORTED_DECLS [de]serialization record that contains
a file sorted array of file-level DeclIDs in a PCH/Module.
The rationale is to allow "targeted" deserialization of decls inside
a range of a source file.

Cocoa PCH increased by 0.8%
Difference of creation time for Cocoa PCH is below the noise level.

llvm-svn: 143238
2011-10-28 22:54:21 +00:00
Richard Smith 254a73d636 Initial support for C++11 constexpr function invocation substitution. Using
constexpr function arguments outside of their function (passing or returning
them by reference) does not work correctly yet.

Calling constexpr function templates does not work yet, since the bodies are not
instantiated until the end of the translation unit.

llvm-svn: 143234
2011-10-28 22:34:42 +00:00
Devang Patel fa59ac363e In case of template specialization, do not try to delay emitting debug info for concrete type in -flimit-debug-info mode. This fixes some of the failures from bs15503.exp tests in gdb testsuite.
llvm-svn: 143227
2011-10-28 21:12:13 +00:00
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
John McCall c4a2d3259f Introduce a placeholder type for "pseudo object"
expressions: expressions which refer to a logical rather
than a physical l-value, where the logical object is
actually accessed via custom getter/setter code.
A subsequent patch will generalize the AST for these
so that arbitrary "implementing" sub-expressions can
be provided.

Right now the only client is ObjC properties, but
this should be generalizable to similar language
features, e.g. Managed C++'s __property methods.

llvm-svn: 142914
2011-10-25 07:27:56 +00:00
Eric Christopher 8605082dac Allow the -fno-operator-names option to be passed down to the rest
of the compiler.

Fixes PR10198
Patch by Brian Foley!

llvm-svn: 142913
2011-10-25 07:13:06 +00:00
Richard Smith d4268d91e7 Don't forget the lvalue-to-rvalue conversion on the LHS when instantiating a
dependent ->, where the member being referred to is an anonymous struct or
union. This path was missed by the fix in r142890.

llvm-svn: 142910
2011-10-25 06:33:21 +00:00
Ted Kremenek 7b2fbc61de Relax restriction of assigning to 'self' in ARC when a method is attributed with ns_consumes_self. Fixes <rdar://problem/10274056>.
llvm-svn: 142909
2011-10-25 04:52:20 +00:00
Ted Kremenek 74e82bd190 Tweak printf format string parsing to accept 'hh' conversion specifier to accept any char, not just signed char. Fixes <rdar://problem/10303638>.
llvm-svn: 142908
2011-10-25 04:20:41 +00:00
Douglas Gregor 4a2a8f7fb8 Check for unexpanded parameter packs in the name that guards a
Microsoft __if_exists/__if_not_exists statement. Also note that we
weren't traversing DeclarationNameInfo *at all* within the
RecursiveASTVisitor, which would be rather fatal for variadic
templates.

llvm-svn: 142906
2011-10-25 03:44:56 +00:00
Douglas Gregor deb4a2be67 Implement support for dependent Microsoft __if_exists/__if_not_exists
statements. As noted in the documentation for the AST node, the
semantics of __if_exists/__if_not_exists are somewhat different from
the way Visual C++ implements them, because our parsed-template
representation can't accommodate VC++ semantics without serious
contortions. Hopefully this implementation is "good enough".

llvm-svn: 142901
2011-10-25 01:33:02 +00:00
Richard Smith 841222ea75 Don't forget the lvalue-to-rvalue conversion on the LHS of an -> when rebuilding
it during template instantiation, for a known RHS decl.

llvm-svn: 142890
2011-10-25 00:41:24 +00:00
Argyrios Kyrtzidis 429ec024f8 [PCH] When visiting preprocessed entities, make it possible to avoid deserializing
preprocessed entities that are #included in the range that we are interested.

This is useful when we are interested in preprocessed entities of a specific file, e.g
when we are annotating tokens. There is also an optimization where we cache the last
result of PreprocessingRecord::getPreprocessedEntitiesInRange and we re-use it if
there is a call with the same range as before.

rdar://10313365

llvm-svn: 142887
2011-10-25 00:29:50 +00:00
Argyrios Kyrtzidis 8edffaa611 Use assert(0) instead of duplicating the check, suggestion by Anna.
llvm-svn: 142886
2011-10-25 00:29:44 +00:00
Ted Kremenek 0062e74961 Add source-level dominators analysis. Patch by Guoping Long!
llvm-svn: 142885
2011-10-25 00:25:24 +00:00
Richard Smith 2d7bb04788 Clean up, as suggested by John.
llvm-svn: 142884
2011-10-25 00:21:54 +00:00
Dan Gohman 93127aecb9 Remove the Blackfin backend.
llvm-svn: 142881
2011-10-25 00:06:12 +00:00
Dan Gohman 53bb0ff685 Remove the SystemZ backend.
llvm-svn: 142879
2011-10-24 23:48:52 +00:00
Devang Patel 242ce91ecc Do not drop type qualifiers in -flimit-debug-info mode.
llvm-svn: 142873
2011-10-24 23:15:17 +00:00
Richard Smith 733237db23 Revert r142844, it broke selfhost. The problem appears to be a missing
lvalue-to-rvalue conversion on the LHS operand of '->'.

llvm-svn: 142872
2011-10-24 23:14:33 +00:00
Richard Smith 62f6595122 Add explanatory comments for ICE checking in C99 mode.
llvm-svn: 142866
2011-10-24 22:35:48 +00:00
Douglas Gregor 43edb32f1f Rework Microsoft __if_exists/__if_not_exists parsing and semantic
analysis to separate dependent names from non-dependent names. For
dependent names, we'll behave differently from Visual C++:

  - For __if_exists/__if_not_exists at class scope, we'll just warn
    and then ignore them.
  - For __if_exists/__if_not_exists in statements, we'll treat the
    inner statement as a compound statement, which we only instantiate
    in templates where the dependent name (after instantiation)
    exists. This behavior is different from VC++, but it's as close as
    we can get without encroaching ridiculousness.

The latter part (dependent statements) is not yet implemented.

llvm-svn: 142864
2011-10-24 22:31:10 +00:00
Eli Friedman 9190e19b66 Don't try to emit CK_LValueBitCast casts as constants. PR9558.
llvm-svn: 142863
2011-10-24 22:25:55 +00:00
Douglas Gregor 89ab56d5fb When we perform a lookup for a dependent name that is a member of an
unknown specialization, treat this the same way as if the name were
not found in the current instantiation. No actual functionality
change, since apparently nothing depends on this.

llvm-svn: 142862
2011-10-24 22:24:50 +00:00
Anna Zaks e4e5712cd7 [analyzer] Node builders cleanup + comments
Renamed PureNodeBuilder->StmtNodeBuilder.

llvm-svn: 142849
2011-10-24 21:19:59 +00:00
Anna Zaks 2338c15efe [analyzer] Remove the old StmtNodeBuilder.
llvm-svn: 142848
2011-10-24 21:19:53 +00:00
Anna Zaks 4c9169254f [analyzer] Completely remove the global Builder object.
llvm-svn: 142847
2011-10-24 21:19:48 +00:00
Anna Zaks 7b8a2609ff [analyzer] Remove more dependencies from global Builder
- OSAtomicChecker
- ExprEngine::processStmt

llvm-svn: 142846
2011-10-24 21:19:43 +00:00
Richard Smith cbb407268e Constant expression evaluation: evaluate lvalues as lvalues, and rvalues as
rvalues, as C++11 constant evaluation semantics require. DeclRefs referring to
references can now use the normal initialization-caching codepath, which
incidentally fixes a crash in cyclic initialization of references.

llvm-svn: 142844
2011-10-24 21:07:08 +00:00
Chandler Carruth 8c43e66336 Switch to a more natural formatting of the macro name printing.
Suggested by John McCall.

llvm-svn: 142836
2011-10-24 18:51:08 +00:00
Richard Smith 4a6781215e Constant expression evaluation: factor out handling of ignored values.
llvm-svn: 142835
2011-10-24 18:44:57 +00:00
Richard Smith c3e31e7bb2 In accordance with the C89, C99 and C++98 standards, ICEs can only contain
floating-point literals if they are the immediate operands of casts.
ImplicitCastExpr is not a cast in the language-standards sense.

llvm-svn: 142832
2011-10-24 18:26:35 +00:00
Anna Zaks e594034f1f [analyzer] Convert ExprEngine::visit() to use short lived builders.
This commit removes the major functional dependency on the ExprEngine::Builder
member variable.

In some cases the code became more verbose. Particularly, we call takeNodes()
and addNodes() to move responsibility for the nodes from one builder to another.
This will get simplified later on.

llvm-svn: 142831
2011-10-24 18:26:19 +00:00
Anna Zaks 5236792019 [analyzer] Convert VisitDeclStmt to use local node builder.
llvm-svn: 142830
2011-10-24 18:26:12 +00:00
Anna Zaks cbdf10be19 [analyzer] Convert more functions (ex:evalBind()) to iterative builders
llvm-svn: 142829
2011-10-24 18:26:08 +00:00
Anna Zaks f011a4a6f9 [analyzer] Convert VisitUnaryOperator to use short lived Node builders
To convert iteratively, we take the nodes the local builder will
process from the from the global builder and add the generated nodes
after the short lived builder is done. PureStmtNodeBuilder is the
one we should eventually use everywhere. Added Stmt index and Builder
context as ExprEngine globals. To avoid passing them around.

llvm-svn: 142828
2011-10-24 18:26:03 +00:00
Anna Zaks 0bb9d1b917 [analyzer] Use a temporary builder in CheckerContext.
First step toward removing the global Stmt builder. Added several transitional methods (like takeNodes/addNodes).
+ Stop early if the set of exploded nodes for the next iteration is empty.

llvm-svn: 142827
2011-10-24 18:25:58 +00:00