Граф коммитов

20320 Коммитов

Автор SHA1 Сообщение Дата
Chris Lattner 9594675cc1 introduce a centralized place to introduce and inject llvm types into the
clang namespace.  There are a number of LLVM types that are used pervasively
and it doesn't make sense to keep qualifying them.  Start with casting
operators.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135574 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-20 06:37:11 +00:00
Chris Lattner b13eab95e1 fix rdar://9780211 - Clang crashes with an assertion failure building WKView.mm from WebKit
This is something of a hack, the problem is as follows:

1. we instantiate both copied of RetainPtr with the two different argument types
   (an id and protocol-qualified id).
2. We refer to the ctor of one of the instantiations when introducing global "x",
   this causes us to emit an llvm::Function for a prototype whose "this" has type
   "RetainPtr<id<bork> >*".
3. We refer to the ctor of the other instantiation when introducing global "y",
   however, because it *mangles to the same name as the other ctor* we just use
   a bitcasted version of the llvm::Function we previously emitted.
4. We emit deferred declarations, causing us to emit the body of the ctor, however
   the body we emit is for RetainPtr<id>, which expects its 'this' to have an IR
   type of "RetainPtr<id>*".

Because of the mangling collision, we don't have this case, and explode.

This is really some sort of weird AST invariant violation or something, but hey
a bitcast makes the pain go away.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135572 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-20 06:29:00 +00:00
Chris Lattner 181eeee36b fix a case where we're using ConvertType for a memory object.
It doesn't matter in practice, but it is good to be tidy.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135571 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-20 06:23:59 +00:00
Chris Lattner cb8095f766 as eli points out, we're not doing memory stuff here. While ConvertType
and ConvertTypeForMem are the same for pointers, it is best to just
use ConvertType.  Thanks Eli!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135567 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-20 04:59:57 +00:00
Chris Lattner 410b12e553 fix PR10395 - array decay can produce an interesting type when
decaying an array of incomplete type (which has type [0 x i8]*) to a
normal pointer (which has incompletetype*).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135565 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-20 04:31:01 +00:00
Douglas Gregor 14ad03b6f4 Use a ContinuousRangeMap to map from the global macro definition ID in
the AST reader down to the AST file + local ID, rather than walking
the PCH chain. More cleanup/generalization, although there is more
work to do for preprocessed entities. In particular, the
"preallocation" scheme for preprocessed entities is not going to work
well with late loading of PCH files, and it's likely we'll have to do
something akin to the SourceManager's negative/positive loading.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135556 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-20 01:29:15 +00:00
Douglas Gregor 96958cbe6f Use a ContinuousRangeMap to map from the global selector ID in the AST
reader down to the AST file + local ID, rather than walking the PCH
chain. No functionality change; this is generalization and cleanup.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135554 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-20 01:10:58 +00:00
Joerg Sonnenberger e23af2a86e PR10392: "#pragma GCC visibility" must not expand macros in its
arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135552 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-20 01:03:50 +00:00
Douglas Gregor 67268d0238 Use a ContinuousRangeMap to map from the global identifier ID in the
AST reader down to the AST file + local ID, rather than walking the
PCH chain. No functionality change; this is generalization and cleanup.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135551 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-20 00:59:32 +00:00
Douglas Gregor 96e973f2be Use a ContinuousRangeMap to map from the global declaration ID in the
AST reader down to the AST file + local ID within that file, rather
than lamely walking the PCH chain. There's no actual functionality
change now, but this is cleaner and more general.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135548 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-20 00:27:43 +00:00
Joerg Sonnenberger 19207f1e5f Spelling
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135545 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-20 00:14:37 +00:00
Richard Smith 0ff6f8f038 Replace r134583's fix for PR10290 with one which also works for non-value-dependent cases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135543 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-20 00:12:52 +00:00
Sean Callanan 673e775beb This fix (thanks to Doug Gregor) corrects a bug
in ImportDefinition when replacing a previously
forward-declared CXXRecordDecl with its full
definition.  The forward-declared type's
DefinitionData had not been intialized for the
forward-declared type, so adding fields to the
Decl caused CXXRecordDecl::addedMember() to
crash when accessing the DefinitionData.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135530 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 22:38:25 +00:00
Ted Kremenek 62d126e942 Fix false negative in -Wuninitialized involving a () wrapping an lvalue-to-rvalue conversion in a DeclStmt.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135525 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 21:41:51 +00:00
Ted Kremenek d626ec404f Fix assertion failure in UninitializedValues.cpp where an lvalue to rvalue conversion is wrapped in a parenthesis.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135519 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 20:33:49 +00:00
Jordy Rose 4cc1187e8a [analyzer] Very minor cleanup in PthreadLockChecker. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135518 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 20:31:42 +00:00
Jordy Rose dcb1d5d681 [analysis] Add checks for double-locking and lock order reversal bugs for
pthread and XNU locks. Patch by Rui Paulo!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135515 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 20:21:41 +00:00
Chad Rosier d9259f373f Refactor r135502 to avoid an empty if else condition, per Eric's suggestion (good call!).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135510 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 20:00:06 +00:00
Anna Zaks b89fe6b04c Add FixItHints in case a C++ function call is missing * or & operators on one/several of it's parameters (addresses http://llvm.org/PR5941).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135509 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 19:49:12 +00:00
Chad Rosier b536a1565c Clang asserts "Invalid environment!" when using -ccc-host-triple
arch-pc-win32-macho (e.g., x86_64-pc-win32-macho), which appears to be a false
positive.
rdar://9786307

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135502 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 19:36:03 +00:00
Benjamin Kramer 1c80eaf9b9 Update CMake build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135492 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 17:26:28 +00:00
Argyrios Kyrtzidis 7ee2049278 [arcmt] Add some additional driver flags to optionally emit or save the pre-migration ARC errors.
-arcmt-migrate-emit-errors : Emits the pre-migration ARC errors but it doesn't affect anything else
-arcmt-migrate-report-output : Writes out the pre-migration ARC errors to the provided plist file

rdar://9791454

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135491 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 17:20:03 +00:00
Douglas Gregor f62d43d2af Revamp the SourceManager to separate the representation of parsed
source locations from source locations loaded from an AST/PCH file.

Previously, loading an AST/PCH file involved carefully pre-allocating
space at the beginning of the source manager for the source locations
and FileIDs that correspond to the prefix, and then appending the
source locations/FileIDs used for parsing the remaining translation
unit. This design forced us into loading PCH files early, as a prefix,
whic has become a rather significant limitation.

This patch splits the SourceManager space into two parts: for source
location "addresses", the lower values (growing upward) are used to
describe parsed code, while upper values (growing downward) are used
for source locations loaded from AST/PCH files. Similarly, positive
FileIDs are used to describe parsed code while negative FileIDs are
used to file/macro locations loaded from AST/PCH files. As a result,
we can load PCH/AST files even during parsing, making various
improvemnts in the future possible, e.g., teaching #include <foo.h> to
look for and load <foo.h.gch> if it happens to be already available.

This patch was originally written by Sebastian Redl, then brought
forward to the modern age by Jonathan Turner, and finally
polished/finished by me to be committed.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135484 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 16:10:42 +00:00
Ted Kremenek 0c8e5a0f70 Reduce -Wuninitialized time by 22% (on sqlite) by removing the recursive AST crawl.
This is accomplished by forcing the needed expressions for -Wuninitialized to always be CFGElements in the CFG.
This allows us to remove a fair amount of the code for -Wuninitialized.

Some fallout:
- AnalysisBasedWarnings.cpp now specifically toggles the CFGBuilder to create a CFG that is suitable for -Wuninitialized.  This
is a layering violation, since the logic for -Wuninitialized is in libAnalysis.  This can be fixed with the proper refactoring.
- Some of the source locations for -Wunreachable-code warnings have shifted.  While not ideal, this is okay because that analysis
already needs some serious reworking.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135480 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 14:18:48 +00:00
Ted Kremenek 74fb1a493c Add hooks into the CFG builder to force that specific expressions are always CFGElements.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135479 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 14:18:43 +00:00
Nick Lewycky 22de49cbed Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135473 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 08:48:08 +00:00
Evan Cheng 2860e30d83 Match createTargetMachine API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135469 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 06:37:41 +00:00
Devang Patel cb2a07e337 Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135456 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 00:52:18 +00:00
Sean Hunt 2f5127e6e0 Implement a __WCHAR_UNSIGNED__ macro and use it to include WCHAR_MIN and
WCHAR_MAX in limits.h, thus solving the problem where the system header
thinks it knows better.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135455 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 00:50:57 +00:00
Devang Patel 478b94b945 Check column number also.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135437 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 22:18:04 +00:00
Sean Hunt 858a325e5f Remember to add a has_feature macro for __underlying_type now that it is
correctly impelmented

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135401 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 17:08:00 +00:00
Jeffrey Yasskin 5b106a872d Define DiagnosticBuilder<<APValue so it's easy to include APValues in
diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135398 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 16:43:53 +00:00
Frits van Bommel e9c0265d6e Migrate LLVM and Clang to use the new makeArrayRef(...) functions where previously explicit non-default constructors were used.
Mostly mechanical with some manual reformatting.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135390 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 12:00:32 +00:00
NAKAMURA Takumi 2ac5321014 lib/Headers/mm_malloc.h: Use __mingw_aligned_malloc() in _mm_malloc() on mingw.
By default, mingw does not have _mm_alloc() nor _aligned_malloc().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135388 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 11:13:50 +00:00
Argyrios Kyrtzidis 05fdf9bc3f [arcmt] When a NSData's 'bytes' family of methods are used on a local var,
add __attribute__((objc_precise_lifetime)) to make sure that the object
(and its data) will not get released before the var goes out-of-scope.

rdar://9206226

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135382 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 07:44:50 +00:00
Argyrios Kyrtzidis fd10398c10 [arcmt] NSInvocation's [get/set]ReturnValue and [get/set]Argument are only safe
with __unsafe_unretained parameters. Emit error for strong/weak ones. rdar://9206226

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135381 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 07:44:45 +00:00
Nick Lewycky f57ef0516c Don't crash when codegen'ing an empty redecl of a function in C99 mode, when
neither was inline. Fixes bug introduced in r135377.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135380 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 07:11:55 +00:00
Nick Lewycky dce67a70a8 In C99, emit an inline function when encountering an extern redeclaration.
Fixes PR10233!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135377 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 05:26:13 +00:00
Chris Lattner 2acc6e3fed de-constify llvm::Type, patch by David Blaikie!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135370 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 04:24:23 +00:00
Chris Lattner b5f65475d2 Use the new llvm::TinyPtrVector class, which implements exactly what
ShadowMapEntry was.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135368 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 01:54:02 +00:00
Chandler Carruth 8435069798 Revert r135217, which wasn't the correct fix for PR10358. With this
patch, we actually move the state-machine for the value set backwards
one step. This can pretty easily lead to infinite loops where we
continually try to propagate a bit, succeed for one iteration, but then
back up because we find an uninitialized use.

A reduced test case from PR10379 is included.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135359 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-16 22:27:02 +00:00
Francois Pichet a6c2b3a648 Do not modify string returned by getenv on Windows.
Fixes PR9875, patch by Nikola Smiljanic!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135356 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-16 21:17:14 +00:00
Benjamin Kramer 12efd57ee4 Zero this struct in a way that neither depends on the size of the struct nor triggers warnings from GCC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135351 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-16 20:13:06 +00:00
Ted Kremenek 797a7be0de [analyzer] Per discussions with the Cocoa team, extend CF naming conventions to extend to camel case functions instead of just title case functions. Fixes <rdar://problem/9732321>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135350 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-16 19:50:36 +00:00
Ted Kremenek 0556048ae8 [analyzer] Place checking for Core Foundation "Create" rule into a proper API. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135349 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-16 19:50:32 +00:00
Fariborz Jahanian 57080fbac1 Remove a gcc warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135348 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-16 18:31:33 +00:00
Joerg Sonnenberger 59c8457f01 Correctly handle sysroot prefix in -print-search-dirs. Makes libtool
more happy on NetBSD.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135344 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-16 10:50:05 +00:00
Fariborz Jahanian 1e159bc43c Fix a typo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135328 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-16 00:08:33 +00:00
Argyrios Kyrtzidis 82a921a1a4 [arcmt] It's not safe to remove the -release on "[[someivar delegate] release];" since it's very likely
that, after migration, the object that was passed to 'setDelegate:' will not be properly retained, e.g:

-whatever {
  id x = [[MyDoHicky alloc] init];
  [someivar setDelegate: x]; // x won't get retained in ARC.
}
-dealloc {
  [[someivar delegate] release]; // give migration error here.
}

rdar://8858009

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135327 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 23:48:56 +00:00
Tanya Lattner 61b4bc80e9 This handles the missing cases of opencl vector literals.
Test cases provided by Anton Lokhmot.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135322 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 23:07:01 +00:00