Commit Graph

21645 Commits

Author SHA1 Message Date
Eric Christopher fab289a47d When constructing debug information for synthesized variables for the
non-fragile ABI we may not be able to lay out the type and the debugger
would ignore us even if we did put in the offset. Go ahead and just
put any value there and don't look up the offset since it may not exist.

rdar://10210157

llvm-svn: 141261
2011-10-06 00:31:18 +00:00
Eric Christopher 8c552308c6 Reformat comment.
llvm-svn: 141260
2011-10-06 00:30:52 +00:00
Ted Kremenek f3e3f6645e Fix major regression in RetainCountChecker. DefaultSummaries were not being used when they were meant to be. Fixes <rdar://problem/10241614>.
llvm-svn: 141250
2011-10-05 23:54:29 +00:00
Anna Zaks c4aa22cdd4 [analyzer] Remove the last dependency on CheckerContext::getNodeBuilder() as well as the method itself.
Checkers should not directly access NodeBuilder, nodes can be created by calling the CheckerContext's generateNode() methods.

llvm-svn: 141249
2011-10-05 23:44:11 +00:00
Anna Zaks 77f8661d18 [analyzer] OSAtomicChecker implements evalCall in a very invasive way - it essentially simulates inlining of compareAndSwap() by means of setting the NodeBuilder flags and calling ExprEngine directly.
This commit introduces a new callback just for this checker to unblock checker API cleanup. 

llvm-svn: 141246
2011-10-05 23:37:30 +00:00
Argyrios Kyrtzidis a7324ede34 Fix crash when using archaic protocol, rdar://10238337
llvm-svn: 141215
2011-10-05 21:28:06 +00:00
Daniel Dunbar 096ed290a1 Driver & AST: Implement support for -fpack-struct and -fpack-struct= command
line options.
 - <rdar://problem/10120602>, PR9631

llvm-svn: 141211
2011-10-05 21:04:55 +00:00
Eli Friedman 533920650b Use APFloat::toString to print APFloats more precisely in the AST printer. Patch by Olaf Krzikalla.
llvm-svn: 141208
2011-10-05 20:32:03 +00:00
Chad Rosier 10746f5ebb [driver] For consistency, handle all shell special characters handled by the
quoting code.

llvm-svn: 141205
2011-10-05 20:09:11 +00:00
Chad Rosier 9b1311df26 [driver] The -v option doesn't quoted the command line arguments for historical
reasons.  However, it does seems practical to quote strings that need it.
rdar://10221951

llvm-svn: 141202
2011-10-05 19:51:41 +00:00
Argyrios Kyrtzidis 78181b4b45 Fix the rewriter, rdar://10234024.
llvm-svn: 141201
2011-10-05 19:37:56 +00:00
Justin Holewinski 38031978b5 PTX: Set proper calling conventions for PTX in OpenCL mode.
llvm-svn: 141193
2011-10-05 17:58:44 +00:00
Douglas Gregor a04a46e8f4 Seriously ugly hack, part 2
llvm-svn: 141181
2011-10-05 14:59:36 +00:00
Douglas Gregor 10312ab129 Seriously ugly hack to try to get the Windows builders back online
llvm-svn: 141180
2011-10-05 14:58:46 +00:00
Douglas Gregor 54a888108a Introduce a simple file-based locking protocol for on-demand module
creation, so that only a single Clang instance will rebuild a given
module at once (and the others will wait).

We still don't clean up the lock files when we crash, which is a
rather unfortunate problem. I'll handle that next, and there is
certainly a *lot* of room for further improvements.

llvm-svn: 141179
2011-10-05 14:53:30 +00:00
Abramo Bagnara 635ed24e1d Added a flag to identify resolved overloaded function references.
llvm-svn: 141171
2011-10-05 07:56:41 +00:00
John McCall b50451a188 Refactor the analysis of C++ cast expressions so that even
C-style and functional casts are built in SemaCXXCast.cpp.
Introduce a helper class to encapsulate most of the random
state being passed around, at least one level down.

llvm-svn: 141170
2011-10-05 07:41:44 +00:00
Chandler Carruth e276b3662b Use the InstalledDir correctly, and test it correctly as well. =/ Should
have noticed this previously, sorry.

llvm-svn: 141167
2011-10-05 06:38:03 +00:00
Eric Christopher 8a39a01a10 Fix doxygen comment.
llvm-svn: 141165
2011-10-05 06:00:51 +00:00
Chandler Carruth cf59bc5939 Teach Clang to cope with GCC installations that have unusual patch
"versions". Currently, these are just dropped on the floor, A concrete
version number will always win out.

llvm-svn: 141159
2011-10-05 03:09:51 +00:00
Chandler Carruth f7e0ecb65d Implement the feature I was originally driving toward when I started
this saga. Teach the driver to detect a GCC installed along side Clang
using the existing InstalledDir support in the Clang driver. This makes
a lot of Clang's behavior more automatic when it is installed along side
GCC.

Also include the first test cases (more to come, honest) which test both
the install directory behavior, and the version sorting behavior to show
that we're actually searching for the best candidate GCC installation
now.

llvm-svn: 141145
2011-10-05 01:01:57 +00:00
Fariborz Jahanian 48c69106e4 c: assignment/init of a function pointer whose function(s)
return to one which does not return (has noreturn attribute) 
should warn as it is an unsafe assignment. // rdar://10095762
c++ already handles this. This is the c version.

llvm-svn: 141141
2011-10-05 00:05:34 +00:00
Douglas Gregor b0e6c8a350 Don't allow an rvalue reference to bind to the result of a calling a
conversion function whose result type is an lvalue reference. The
initialization code already handled this properly, but overload
resolution was allowing the binding. Fixes PR11003 /
<rdar://problem/10233078>.

llvm-svn: 141137
2011-10-04 23:59:32 +00:00
Anna Zaks 8569d2d8f2 [analyzer] Removing more references to CheckerContext::getNodeBuilder(): ask CheckerContext to generate the nodes.
llvm-svn: 141136
2011-10-04 23:29:16 +00:00
Chandler Carruth 486ed05105 Hoist the other messy part out of an inner loop and into a helper
function, cleaning up along the way.

llvm-svn: 141134
2011-10-04 23:17:12 +00:00
Chandler Carruth 59f4407d5b Hoist the first chunk of this into a helper function. No functionality
change.

llvm-svn: 141131
2011-10-04 22:58:04 +00:00
Chad Rosier 6c98dfd0f4 [driver] Improve r141053 by only emitting the warning if the original input
was assembly.  Otherwise, something like -save-temps causes the integrated
assembler to warn.

llvm-svn: 141127
2011-10-04 22:35:48 +00:00
Chandler Carruth 7dc477ef77 Fix Windows+MinGW which introduces noise into path separators.
There should be a better solution to this; Michael and I are continuing
to discuss exactly what it should be. The one solution I'm very
uncomfortable with is making the FileCheck tests use a regex for each
path separator.

llvm-svn: 141126
2011-10-04 22:22:13 +00:00
Chandler Carruth e683a18970 Now that multiple prefixes are much cheaper to search for GCC
installations, support them when installed directly under the system
root ('/lib/gcc/...' essentially).

With this, Clang can correctly detect and use a cross-compiling GCC
installation within a system root and use it.

Again, test cases will be coming in later commits, as I'm going to write
a few test cases that exercise nearly all of this logic.

llvm-svn: 141121
2011-10-04 21:22:42 +00:00
Chandler Carruth 531f1ff78c Rework the search for a GCC installation still further. This combines
two fundamental changes, as they ended up being interrelated.

The first is to walk from the root down through the filesystem so that
we prune subtrees which do not exist early. This greatly reduces the
filesystem traffic of this routine. We store the "best" GCC version we
encounter, and look at all of the GCC installations available.

Also, we look through GCC versions by scanning the directory rather than
using a hard-coded list of versions. This has several benefits. It makes
it much more efficient to locate a GCC installation even in the presence
of a large number of different options by simply reading the directory
once. It also future-proofs us as new GCC versions are released and
installed. We no longer have a hard coded list of version numbers, and
won't need to manually updated it. We can still filter out known-bad
versions as needed. Currently I've left in filtering for all GCC
installations prior to 4.1.1, as that was the first one supported
previously.

llvm-svn: 141120
2011-10-04 21:22:33 +00:00
Daniel Dunbar 2fba0979fe Basic/Diagnostics: Apparently, #pragma ... diagnostic is intended to override
the command line options (at least according to GCC's documentation). GCC 4.2
didn't appear to actually do this, but it seems like that has been fixed in
later release, so we will follow the docs.

llvm-svn: 141119
2011-10-04 21:17:24 +00:00
Anna Zaks 23d7ba3579 [analyzer] Removing references to CheckerContext::getNodeBuilder(): checkers can obtain block count directly from the Context.
llvm-svn: 141112
2011-10-04 20:43:05 +00:00
Eli Friedman 606c103644 Remove a nonsensical bit of code from InitListChecker::getStructuredSubobjectInit which was increasing the reserved size for an init list past its maximum possible size. Fixes PR11056, a case where we were reserving a bunch of memory for arrays that was never actually used.
(No testcase because I don't think we have any way to actually write a testcase for this; the chosen value of NumElements has no effects on anything other than performance and memory usage.)

llvm-svn: 141106
2011-10-04 20:31:48 +00:00
Fariborz Jahanian f2a7b0eade objc: Turn diagnostic on property type mismatch in
continuation class into warning. // rdar://10231514

llvm-svn: 141100
2011-10-04 18:44:26 +00:00
Anna Zaks c76ec12ccf [analyzer] Remove unused methods, add comments to others.
llvm-svn: 141098
2011-10-04 18:34:40 +00:00
Justin Holewinski 83aacf82e7 Fix include path detection on Fedora 15 with GCC 4.6.1. Patch by Arthur Haas.
llvm-svn: 141086
2011-10-04 15:35:52 +00:00
David Chisnall cdd207e43e Add bitmaps for strong / weak ivar layout (GNUstep runtime).
llvm-svn: 141085
2011-10-04 15:35:30 +00:00
Chandler Carruth 1a98ab4fc3 Add a comment explaining that I have a better plan for implementing the
GCC installation search that requires fewer filesystem operations.
Planning to implement that next as the current approcah while thorough
(and so far looks correct) does a very unfortunate number of filesystem
operations.

I'm motivated to fix this in no small part because I would like to
support a much larger space of triples and GCC versions, which would
explode the current algorithm.

llvm-svn: 141073
2011-10-04 09:58:21 +00:00
Chandler Carruth 1d6073abad Invert the loop for detecting installed GCC trees. This make the loop
find the newest GCC available, among other goodness. It makes the entire
system much less prone to error from prefixes and/or system roots
pruning early the set of triples and GCC versions available.

Also, improve some comments and simplify the forms of some of the loops.

This causes the driver to stat directories more often than is strictly
necessary, but the alternatives which I looked at that still
accomplished this goal needed quite a bit more code and were likely not
much faster.

Test cases for this, now that our behavior here is significantly more
principled and predictable, should come tomorrow as I walk back through
VMs looking for edge cases that are missed after this.

llvm-svn: 141072
2011-10-04 09:47:17 +00:00
Chandler Carruth 621fed5f5a Fuse the two halves of the GCC installation detection. This is
significantly cleaner (IMO) and more principled. We now walk down each
layer of the directory hierarchy searching for the GCC install. This
change does in fact introduce a significant behavior change in theory,
although in practice I don't know of any distro that will be impacted by
it negatively, and Debian may (untested) get slightly better through it.

Specifically, the logic now looks exhaustively for patterns such as:

  /usr/lib/<triple>/gcc/<triple>

Previously, this would only be selected if there was *also*
a '/usr/lib/gcc/<triple>' directory, or if '<triple>' were the excat
DefaultHostTriple in the driver.

There is a 4-deep nested loop here, but it doesn't do terribly many
filesystem operations, as we skip at each layer of that layer's
directory doesn't exist.

There remains a significant FIXME in this logic: it would be much better
to first build up a set of candidate components for each of the four
layers with a bottom-up pruning such as this, but then select the final
installation using a top-down algorithm in order to find the newest GCC
installation available, regardless of which particular path leads to it.

llvm-svn: 141071
2011-10-04 08:32:14 +00:00
John McCall ff61303bd0 Mark calls to objc_retainBlock that don't result from casts
to id so that we can still optimize them appropriately.

llvm-svn: 141064
2011-10-04 06:23:45 +00:00
Bob Wilson 05de0298d2 Rip out flags for controlling C++ "production mode" separately.
This is old leftover cruft from the days when C++ was not yet ready
for prime time.

llvm-svn: 141063
2011-10-04 05:34:14 +00:00
Argyrios Kyrtzidis 52f53fb303 Improve location fidelity of objc decls.
-Add the location of the class name to all objc container decls, not just ObjCInterfaceDecl.
-Make objc decls consistent with the rest of the NamedDecls and have getLocation() point to the
 class name, not the location of '@'.

llvm-svn: 141061
2011-10-04 04:48:02 +00:00
Chandler Carruth 7e6d8cc46c Factor the data apart from the logic of locating various GCC
installations. This first selects a set of prefixes and a set of
compatible triples for the current architecture. Once selected, we drive
the search with a single piece of code.

This code isn't particularly efficient as it stands, but its only
executed once. I'm hoping as I clean up the users of this information,
it will also slowly become both cleaner and more efficient.

This also changes the behavior slightly. Previously, we had an ad-hoc
list of prefixes and triples, and we only looked for some triples
beneath specific prefixes and vice versa. This has led to lots of
one-off patches to support triple X, or support lib dir Y. Even without
going to a fully universal driver, we can do better here. This patch
makes us always look first in either 'lib32' or 'lib64' on 32- or 64-bit
hosts (resp.). However, we *always* look in 'lib'.

Currently I have one lingering problem with this strategy. We might find
a newer or better GCC version under a different (but equally compatible)
triple. Fundamentally, this loop needs to be fused with the one below.
That's my next patch.

llvm-svn: 141056
2011-10-04 02:28:41 +00:00
Chad Rosier 83200fdc65 [driver] Improve r141053 by only emitting the warning if the original input
was assembly.  Otherwise, something like -save-temps causes the integrated
assembler to warn.

llvm-svn: 141055
2011-10-04 01:53:36 +00:00
Chad Rosier 672831dec7 [driver] Emit a warning if the user has requested debug information and we're
using the integrated assembler.
rdar://10216353

llvm-svn: 141053
2011-10-04 01:01:30 +00:00
Douglas Gregor 51e0b54197 When build a module on demand, run the module-building job on a
separate thread with the "suitably large" stack, so we don't blow the
stack when building modules recursively.

llvm-svn: 141051
2011-10-04 00:21:21 +00:00
Argyrios Kyrtzidis 25029d499e Make sure SourceManager::getFileIDLoaded doesn't hang in release build because of invalid passed parameter.
rdar://10210140

llvm-svn: 141048
2011-10-03 23:43:01 +00:00
Anna Zaks 208d54ce09 [analyzer] Remove redundant state (AnalysisContext pointer for every BinaryOperator tracked) from IdempotentOperationChecker.
llvm-svn: 141045
2011-10-03 23:07:13 +00:00
Fariborz Jahanian ed1933b02b objc arc: Suppress certain arc diagnostics on unavailable
functions. // rdar://10186536

llvm-svn: 141037
2011-10-03 22:11:57 +00:00