]> granicus.if.org Git - clang/log
clang
13 years agointroduce a centralized place to introduce and inject llvm types into the
Chris Lattner [Wed, 20 Jul 2011 06:37:11 +0000 (06:37 +0000)]
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

13 years agofix rdar://9780211 - Clang crashes with an assertion failure building WKView.mm from...
Chris Lattner [Wed, 20 Jul 2011 06:29:00 +0000 (06:29 +0000)]
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

13 years agofix a case where we're using ConvertType for a memory object.
Chris Lattner [Wed, 20 Jul 2011 06:23:59 +0000 (06:23 +0000)]
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

13 years agoMatch LLVM API change.
Evan Cheng [Wed, 20 Jul 2011 06:22:27 +0000 (06:22 +0000)]
Match LLVM API change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135570 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoas eli points out, we're not doing memory stuff here. While ConvertType
Chris Lattner [Wed, 20 Jul 2011 04:59:57 +0000 (04:59 +0000)]
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

13 years agofix PR10395 - array decay can produce an interesting type when
Chris Lattner [Wed, 20 Jul 2011 04:31:01 +0000 (04:31 +0000)]
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

13 years agoUse a ContinuousRangeMap to map from the global macro definition ID in
Douglas Gregor [Wed, 20 Jul 2011 01:29:15 +0000 (01:29 +0000)]
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

13 years agoUse a ContinuousRangeMap to map from the global selector ID in the AST
Douglas Gregor [Wed, 20 Jul 2011 01:10:58 +0000 (01:10 +0000)]
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

13 years agoPR10392: "#pragma GCC visibility" must not expand macros in its
Joerg Sonnenberger [Wed, 20 Jul 2011 01:03:50 +0000 (01:03 +0000)]
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

13 years agoUse a ContinuousRangeMap to map from the global identifier ID in the
Douglas Gregor [Wed, 20 Jul 2011 00:59:32 +0000 (00:59 +0000)]
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

13 years agoTry to appease MSVC's standard library.
Douglas Gregor [Wed, 20 Jul 2011 00:31:58 +0000 (00:31 +0000)]
Try to appease MSVC's standard library.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135549 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUse a ContinuousRangeMap to map from the global declaration ID in the
Douglas Gregor [Wed, 20 Jul 2011 00:27:43 +0000 (00:27 +0000)]
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

13 years agoSpelling
Joerg Sonnenberger [Wed, 20 Jul 2011 00:14:37 +0000 (00:14 +0000)]
Spelling

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135545 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoReplace r134583's fix for PR10290 with one which also works for non-value-dependent...
Richard Smith [Wed, 20 Jul 2011 00:12:52 +0000 (00:12 +0000)]
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

13 years agoUse the zero from the correct enumeration when initializing this variable.
Richard Smith [Wed, 20 Jul 2011 00:10:13 +0000 (00:10 +0000)]
Use the zero from the correct enumeration when initializing this variable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135541 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoThis fix (thanks to Doug Gregor) corrects a bug
Sean Callanan [Tue, 19 Jul 2011 22:38:25 +0000 (22:38 +0000)]
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

13 years agoFix false negative in -Wuninitialized involving a () wrapping an lvalue-to-rvalue...
Ted Kremenek [Tue, 19 Jul 2011 21:41:51 +0000 (21:41 +0000)]
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

13 years agoFix assertion failure in UninitializedValues.cpp where an lvalue to rvalue conversion...
Ted Kremenek [Tue, 19 Jul 2011 20:33:49 +0000 (20:33 +0000)]
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

13 years ago[analyzer] Very minor cleanup in PthreadLockChecker. No functionality change.
Jordy Rose [Tue, 19 Jul 2011 20:31:42 +0000 (20:31 +0000)]
[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

13 years ago[analysis] Add checks for double-locking and lock order reversal bugs for
Jordy Rose [Tue, 19 Jul 2011 20:21:41 +0000 (20:21 +0000)]
[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

13 years agoRefactor r135502 to avoid an empty if else condition, per Eric's suggestion (good...
Chad Rosier [Tue, 19 Jul 2011 20:00:06 +0000 (20:00 +0000)]
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

13 years agoAdd FixItHints in case a C++ function call is missing * or & operators on one/several...
Anna Zaks [Tue, 19 Jul 2011 19:49:12 +0000 (19:49 +0000)]
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

13 years agoClang asserts "Invalid environment!" when using -ccc-host-triple
Chad Rosier [Tue, 19 Jul 2011 19:36:03 +0000 (19:36 +0000)]
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

13 years agoUpdate CMake build.
Benjamin Kramer [Tue, 19 Jul 2011 17:26:28 +0000 (17:26 +0000)]
Update CMake build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135492 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] Add some additional driver flags to optionally emit or save the pre-migration...
Argyrios Kyrtzidis [Tue, 19 Jul 2011 17:20:03 +0000 (17:20 +0000)]
[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

13 years agoName the "c++0x-compat" warning group, and fix the names of two
Jeffrey Yasskin [Tue, 19 Jul 2011 16:38:48 +0000 (16:38 +0000)]
Name the "c++0x-compat" warning group, and fix the names of two
warnings that were intended to be inside it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135487 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRevamp the SourceManager to separate the representation of parsed
Douglas Gregor [Tue, 19 Jul 2011 16:10:42 +0000 (16:10 +0000)]
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

13 years agoReduce -Wuninitialized time by 22% (on sqlite) by removing the recursive AST crawl.
Ted Kremenek [Tue, 19 Jul 2011 14:18:48 +0000 (14:18 +0000)]
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

13 years agoAdd hooks into the CFG builder to force that specific expressions are always CFGElements.
Ted Kremenek [Tue, 19 Jul 2011 14:18:43 +0000 (14:18 +0000)]
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

13 years agoFix typo.
Nick Lewycky [Tue, 19 Jul 2011 08:48:08 +0000 (08:48 +0000)]
Fix typo.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135473 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMatch createTargetMachine API change.
Evan Cheng [Tue, 19 Jul 2011 06:37:41 +0000 (06:37 +0000)]
Match createTargetMachine API change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135469 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSimplify.
Devang Patel [Tue, 19 Jul 2011 00:52:18 +0000 (00:52 +0000)]
Simplify.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135456 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImplement a __WCHAR_UNSIGNED__ macro and use it to include WCHAR_MIN and
Sean Hunt [Tue, 19 Jul 2011 00:50:57 +0000 (00:50 +0000)]
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

13 years agoAdd .gitignore file.
Eric Christopher [Mon, 18 Jul 2011 23:05:36 +0000 (23:05 +0000)]
Add .gitignore file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135440 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCheck column number also.
Devang Patel [Mon, 18 Jul 2011 22:18:04 +0000 (22:18 +0000)]
Check column number also.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135437 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMCContext now takes MCRegisterInfo.
Evan Cheng [Mon, 18 Jul 2011 20:57:51 +0000 (20:57 +0000)]
MCContext now takes MCRegisterInfo.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135425 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoThanks to Chandler for reminding me to update the documentation for the
Sean Hunt [Mon, 18 Jul 2011 17:22:33 +0000 (17:22 +0000)]
Thanks to Chandler for reminding me to update the documentation for the
__underlying_type feature.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135402 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemember to add a has_feature macro for __underlying_type now that it is
Sean Hunt [Mon, 18 Jul 2011 17:08:00 +0000 (17:08 +0000)]
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

13 years agoDefine DiagnosticBuilder<<APValue so it's easy to include APValues in
Jeffrey Yasskin [Mon, 18 Jul 2011 16:43:53 +0000 (16:43 +0000)]
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

13 years agoMigrate LLVM and Clang to use the new makeArrayRef(...) functions where previously...
Frits van Bommel [Mon, 18 Jul 2011 12:00:32 +0000 (12:00 +0000)]
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

13 years agolib/Headers/mm_malloc.h: Use __mingw_aligned_malloc() in _mm_malloc() on mingw.
NAKAMURA Takumi [Mon, 18 Jul 2011 11:13:50 +0000 (11:13 +0000)]
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

13 years ago[arcmt] When a NSData's 'bytes' family of methods are used on a local var,
Argyrios Kyrtzidis [Mon, 18 Jul 2011 07:44:50 +0000 (07:44 +0000)]
[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

13 years ago[arcmt] NSInvocation's [get/set]ReturnValue and [get/set]Argument are only safe
Argyrios Kyrtzidis [Mon, 18 Jul 2011 07:44:45 +0000 (07:44 +0000)]
[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

13 years agoDon't crash when codegen'ing an empty redecl of a function in C99 mode, when
Nick Lewycky [Mon, 18 Jul 2011 07:11:55 +0000 (07:11 +0000)]
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

13 years agoIn C99, emit an inline function when encountering an extern redeclaration.
Nick Lewycky [Mon, 18 Jul 2011 05:26:13 +0000 (05:26 +0000)]
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

13 years agode-constify llvm::Type, patch by David Blaikie!
Chris Lattner [Mon, 18 Jul 2011 04:24:23 +0000 (04:24 +0000)]
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

13 years agoUse the new llvm::TinyPtrVector class, which implements exactly what
Chris Lattner [Mon, 18 Jul 2011 01:54:02 +0000 (01:54 +0000)]
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

13 years agoRevert r135217, which wasn't the correct fix for PR10358. With this
Chandler Carruth [Sat, 16 Jul 2011 22:27:02 +0000 (22:27 +0000)]
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

13 years agoDo not modify string returned by getenv on Windows.
Francois Pichet [Sat, 16 Jul 2011 21:17:14 +0000 (21:17 +0000)]
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

13 years agoZero this struct in a way that neither depends on the size of the struct nor triggers...
Benjamin Kramer [Sat, 16 Jul 2011 20:13:06 +0000 (20:13 +0000)]
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

13 years ago[analyzer] Per discussions with the Cocoa team, extend CF naming conventions to exten...
Ted Kremenek [Sat, 16 Jul 2011 19:50:36 +0000 (19:50 +0000)]
[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

13 years ago[analyzer] Place checking for Core Foundation "Create" rule into a proper API. No...
Ted Kremenek [Sat, 16 Jul 2011 19:50:32 +0000 (19:50 +0000)]
[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

13 years agoRemove a gcc warning.
Fariborz Jahanian [Sat, 16 Jul 2011 18:31:33 +0000 (18:31 +0000)]
Remove a gcc warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135348 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCorrectly handle sysroot prefix in -print-search-dirs. Makes libtool
Joerg Sonnenberger [Sat, 16 Jul 2011 10:50:05 +0000 (10:50 +0000)]
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

13 years agoFix a typo.
Fariborz Jahanian [Sat, 16 Jul 2011 00:08:33 +0000 (00:08 +0000)]
Fix a typo.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135328 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] It's not safe to remove the -release on "[[someivar delegate] release];"...
Argyrios Kyrtzidis [Fri, 15 Jul 2011 23:48:56 +0000 (23:48 +0000)]
[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

13 years agoThis handles the missing cases of opencl vector literals.
Tanya Lattner [Fri, 15 Jul 2011 23:07:01 +0000 (23:07 +0000)]
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

13 years agoUpdate retain-release.m to match updated warnings from r135310
Jordy Rose [Fri, 15 Jul 2011 22:38:26 +0000 (22:38 +0000)]
Update retain-release.m to match updated warnings from r135310

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135317 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[libclang] Map canonical decl of a category implementation to the category decl.
Argyrios Kyrtzidis [Fri, 15 Jul 2011 22:37:58 +0000 (22:37 +0000)]
[libclang] Map canonical decl of a category implementation to the category decl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135316 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRevert r135304 and apply fix in clang_getCanonicalCursor per Doug's, Fariborz's comments.
Argyrios Kyrtzidis [Fri, 15 Jul 2011 22:27:18 +0000 (22:27 +0000)]
Revert r135304 and apply fix in clang_getCanonicalCursor per Doug's, Fariborz's comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135314 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd tests for CFRefReport's path notes, and fix a few typos and non-standard terminol...
Jordy Rose [Fri, 15 Jul 2011 22:17:54 +0000 (22:17 +0000)]
Add tests for CFRefReport's path notes, and fix a few typos and non-standard terminology ('+0 retain counts') caught by the tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135310 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] Rewrite to "foo = nil;" not "foo = 0;", as suggested by Jordy.
Argyrios Kyrtzidis [Fri, 15 Jul 2011 22:04:00 +0000 (22:04 +0000)]
[arcmt] Rewrite to "foo = nil;" not "foo = 0;", as suggested by Jordy.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135309 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoPrevent the -save-temps flag from modifying the input file if the input filename
Chad Rosier [Fri, 15 Jul 2011 21:54:29 +0000 (21:54 +0000)]
Prevent the -save-temps flag from modifying the input file if the input filename
conflicts with a to be produced temp filename.
rdar://9724657

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135308 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAugment the interface of ExternalASTSource::FindExternalLexicalDecls()
Douglas Gregor [Fri, 15 Jul 2011 21:46:17 +0000 (21:46 +0000)]
Augment the interface of ExternalASTSource::FindExternalLexicalDecls()
to allow clients to specify that they've already (correctly) loaded
declarations, and that no further action is needed.

Also, make sure that we clear the "has external lexical declarations"
bit before calling FindExternalLexicalDecls(), to avoid infinite
recursion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135306 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoThe canonical decl for an ObjCImplDecl is it's interface class. Fixes rdar://8728637.
Argyrios Kyrtzidis [Fri, 15 Jul 2011 21:39:32 +0000 (21:39 +0000)]
The canonical decl for an ObjCImplDecl is it's interface class. Fixes rdar://8728637.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135304 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] For:
Argyrios Kyrtzidis [Fri, 15 Jul 2011 21:11:23 +0000 (21:11 +0000)]
[arcmt] For:

id x = ...
@try {
 ...
} @finally {
 [x release];
}

Migrator will drop the release. It's better to change it to "x = 0" in a @finally to avoid leak when exception is thrown.

rdar://9398256

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135301 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDon't refer to check.deps unless LLVM_INCLUDE_TESTS is enabled
Douglas Gregor [Fri, 15 Jul 2011 21:03:20 +0000 (21:03 +0000)]
Don't refer to check.deps unless LLVM_INCLUDE_TESTS is enabled

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135300 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[analyzer] GNU __null is a pointer-sized integer, not a pointer. Fixes PR10372.
Jordy Rose [Fri, 15 Jul 2011 20:29:02 +0000 (20:29 +0000)]
[analyzer] GNU __null is a pointer-sized integer, not a pointer. Fixes PR10372.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135294 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix typo
Joerg Sonnenberger [Fri, 15 Jul 2011 18:23:44 +0000 (18:23 +0000)]
Fix typo

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135285 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUse the new APFloat::convertToInt(APSInt) function to simplify uses of
Jeffrey Yasskin [Fri, 15 Jul 2011 17:03:07 +0000 (17:03 +0000)]
Use the new APFloat::convertToInt(APSInt) function to simplify uses of
convertToInt(integerParts*) and make them more reliable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135279 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoStore bracket locations for array subscript expressions, from Erik Verbruggen!
Douglas Gregor [Fri, 15 Jul 2011 16:25:15 +0000 (16:25 +0000)]
Store bracket locations for array subscript expressions, from Erik Verbruggen!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135275 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWhen creating a property in a class extension, make sure to check its
Douglas Gregor [Fri, 15 Jul 2011 15:30:21 +0000 (15:30 +0000)]
When creating a property in a class extension, make sure to check its
attributes. Fixes <rdar://problem/9561076>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135273 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoConvert CallInst and InvokeInst APIs to use ArrayRef.
Jay Foad [Fri, 15 Jul 2011 08:37:34 +0000 (08:37 +0000)]
Convert CallInst and InvokeInst APIs to use ArrayRef.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135265 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRestore the C-style cast hack for enum template arguments,
John McCall [Fri, 15 Jul 2011 07:47:58 +0000 (07:47 +0000)]
Restore the C-style cast hack for enum template arguments,
which is required given the current setup for template
argument deduction substitution validation, and add a test
case to make sure we don't break it in the future.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135262 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMove the Serialization library from 'instantiation' to 'expansion', with
Chandler Carruth [Fri, 15 Jul 2011 07:25:21 +0000 (07:25 +0000)]
Move the Serialization library from 'instantiation' to 'expansion', with
the exception of its uses of SourceManager and SourceLocation APIs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135260 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd serialization support for SubstNonTypeTemplateParmExpr.
John McCall [Fri, 15 Jul 2011 07:00:14 +0000 (07:00 +0000)]
Add serialization support for SubstNonTypeTemplateParmExpr.
Also add the missing serialization support for SEHTryStmt,
SEHFinallyStmt, and SEHExceptStmt, and fix and finish the
serialization support for AsTypeExpr.  In addition, change
the code so that it will no longer link if a Stmt subclass
is missing serialization support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135258 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix the definition of AsTypeExpr. I'm still not sure this
John McCall [Fri, 15 Jul 2011 06:56:33 +0000 (06:56 +0000)]
Fix the definition of AsTypeExpr.  I'm still not sure this
is right --- shouldn't there be a TypeLoc in here somewhere? ---
but at least it doesn't have a redundant QualType and a broken
children() method.

Noticed this while doing things in serialization.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135257 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoprotect some calls to ConvertType when a function info is under construction
Chris Lattner [Fri, 15 Jul 2011 06:41:05 +0000 (06:41 +0000)]
protect some calls to ConvertType when a function info is under construction
to prevent recursive compilation problems.  This fixes a failure of CodeGen/decl.c
on x86-32 targets that don't fill in the coerce-to type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135256 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoClean up UnixAPIChecker, including switching its array of BugTypes to llvm::OwningPtr...
Jordy Rose [Fri, 15 Jul 2011 06:28:59 +0000 (06:28 +0000)]
Clean up UnixAPIChecker, including switching its array of BugTypes to llvm::OwningPtr<BugType> vars (the new convention). No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135255 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoClean up MacOSXAPIChecker, including switching its array of BugTypes to a single...
Jordy Rose [Fri, 15 Jul 2011 06:02:19 +0000 (06:02 +0000)]
Clean up MacOSXAPIChecker, including switching its array of BugTypes to a single llvm::OwningPtr<BugType> (the new convention). No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135250 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoEnhance the IR type lowering code to be much smarter about recursively lowering
Chris Lattner [Fri, 15 Jul 2011 05:16:14 +0000 (05:16 +0000)]
Enhance the IR type lowering code to be much smarter about recursively lowering
types.  Fore xample, we used to lower:

struct bar { int a; };
struct foo {
 void (*FP)(struct bar);
} G;

to:

%struct.foo = type { {}* }

since the function pointer would cause recursive translation of bar and
we didn't know if that would get us into trouble.  We are now smart enough
to know that it is fine, so we get this type instead:

%struct.foo = type { void (i32)* }

Codegen still needs to be prepared for uncooperative types at any place,
which is why I let the maximally uncooperative code sit around for awhile to
help shake out the bugs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135244 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCreate a new expression node, SubstNonTypeTemplateParmExpr,
John McCall [Fri, 15 Jul 2011 05:09:51 +0000 (05:09 +0000)]
Create a new expression node, SubstNonTypeTemplateParmExpr,
to represent a fully-substituted non-type template parameter.
This should improve source fidelity, as well as being generically
useful for diagnostics and such.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135243 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd 'Contains()' method to GRStateTrait for ImmutableList. Patch by Rui Paulo.
Ted Kremenek [Fri, 15 Jul 2011 03:32:56 +0000 (03:32 +0000)]
Add 'Contains()' method to GRStateTrait for ImmutableList.  Patch by Rui Paulo.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135241 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSwitch a comment in Rewrite from 'instantiation' to 'expansion'.
Chandler Carruth [Fri, 15 Jul 2011 00:04:40 +0000 (00:04 +0000)]
Switch a comment in Rewrite from 'instantiation' to 'expansion'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135226 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSwitch help text in the CC1 driver from 'instantiation' to 'expansion'.
Chandler Carruth [Fri, 15 Jul 2011 00:04:38 +0000 (00:04 +0000)]
Switch help text in the CC1 driver from 'instantiation' to 'expansion'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135225 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSwitch comments and assert text in AST from 'instantiation' to
Chandler Carruth [Fri, 15 Jul 2011 00:04:35 +0000 (00:04 +0000)]
Switch comments and assert text in AST from 'instantiation' to
'expansion'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135224 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSwitch comments about 'macro instantiation' to 'macro expansion' in
Chandler Carruth [Fri, 15 Jul 2011 00:04:31 +0000 (00:04 +0000)]
Switch comments about 'macro instantiation' to 'macro expansion' in
ARCMigrate.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135223 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove warnings of constant operands of logical operators from template instantiation...
Richard Trieu [Fri, 15 Jul 2011 00:00:51 +0000 (00:00 +0000)]
Remove warnings of constant operands of logical operators from template instantiations.  Upon instantiation of template, value-dependent parameters are replaced by equivalent literals, so code like:

template<unsigned int A, unsigned int B> struct S {
  int foo() {
    int x = A && B;
  }
}

will not warn on A && B on every instantiation.  This will still warn on other cases inside templates, which will be caught on checking the template definition.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135222 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMatch llvm API change.
Evan Cheng [Thu, 14 Jul 2011 23:50:56 +0000 (23:50 +0000)]
Match llvm API change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135220 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix false negative reported in PR 10358 by using 'Unknown' in -Wuninitialized to...
Ted Kremenek [Thu, 14 Jul 2011 23:43:06 +0000 (23:43 +0000)]
Fix false negative reported in PR 10358 by using 'Unknown' in -Wuninitialized to avoid cascading warnings.  Patch by Kaelyn Uhrain.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135217 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTweak the CMake build so that building a project just containing Clang
Douglas Gregor [Thu, 14 Jul 2011 23:42:32 +0000 (23:42 +0000)]
Tweak the CMake build so that building a project just containing Clang
(and linking to an already-build LLVM) works with Xcode. The resulting
Xcode project for Clang is quite a bit smaller and builds/loads faster.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135216 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] Don't remove retains/releases on a global variable, flag them with errors...
Argyrios Kyrtzidis [Thu, 14 Jul 2011 23:32:04 +0000 (23:32 +0000)]
[arcmt] Don't remove retains/releases on a global variable, flag them with errors. rdar://9402555.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135213 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRevert 135177 to fix PR10363.
Rafael Espindola [Thu, 14 Jul 2011 22:58:04 +0000 (22:58 +0000)]
Revert 135177 to fix PR10363.

Revert "For C++11, do more checking of initializer lists up-front, enabling some subset of the final functionality. C just leaves the function early. C++98 runs through the same code path, but has no changed functionality either."

This reverts commit ac420c5053d6aa41d59f782caad9e46e5baaf2c2.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135210 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] Allow -retain of an __unsafe_unretained receiver if the result gets used.
Argyrios Kyrtzidis [Thu, 14 Jul 2011 22:46:12 +0000 (22:46 +0000)]
[arcmt] Allow -retain of an __unsafe_unretained receiver if the result gets used.
Keep the error if the result is unused. rdar://9552694.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135209 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTeach -Wconversion, -Wsign-compare etc. about division and remainder.
John McCall [Thu, 14 Jul 2011 22:39:48 +0000 (22:39 +0000)]
Teach -Wconversion, -Wsign-compare etc. about division and remainder.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135208 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoPR10359: Template declarations which define classes are not permitted to also contain...
Richard Smith [Thu, 14 Jul 2011 21:35:26 +0000 (21:35 +0000)]
PR10359: Template declarations which define classes are not permitted to also contain declarators. Previously we would accept code like this:

  template<typename T> struct S { } f() { return 0; }

This case now produces a missing ';' diagnostic, since that seems like a much more likely error than an attempt to declare a function or variable in addition to the class template.

Treat this

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135195 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] Emit an error for unused -autorelease messages.
Argyrios Kyrtzidis [Thu, 14 Jul 2011 21:26:49 +0000 (21:26 +0000)]
[arcmt] Emit an error for unused -autorelease messages.

An unused autorelease is badness. If we remove it the receiver
will likely die immediately while previously it was kept alive
by the autorelease pool. This is bad practice in general, so leave it
and emit an error to force the user to restructure his code.

rdar://9599884

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135193 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFor C++11, do more checking of initializer lists up-front, enabling some subset of...
Sebastian Redl [Thu, 14 Jul 2011 19:08:10 +0000 (19:08 +0000)]
For C++11, do more checking of initializer lists up-front, enabling some subset of the final functionality. C just leaves the function early. C++98 runs through the same code path, but has no changed functionality either.
This is a first baby step towards supporting generalized initializer lists. This also removes an aggregate
test case that was just plain wrong, assuming that non-aggregates couldn't be initialized with initializer lists
in C++11 mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135177 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix problems Johannes noticed, and extend test cases further.
Sebastian Redl [Thu, 14 Jul 2011 19:08:01 +0000 (19:08 +0000)]
Fix problems Johannes noticed, and extend test cases further.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135176 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove InitializationSequence::ReferenceBinding, the last redundant sequence kind.
Sebastian Redl [Thu, 14 Jul 2011 19:07:55 +0000 (19:07 +0000)]
Remove InitializationSequence::ReferenceBinding, the last redundant sequence kind.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135175 91177308-0d34-0410-b5e6-96231b3b80d8