]> granicus.if.org Git - clang/log
clang
13 years agoAdd tests for the uninitialized checks added in r128376. Also clean up
Chandler Carruth [Sun, 27 Mar 2011 20:35:59 +0000 (20:35 +0000)]
Add tests for the uninitialized checks added in r128376. Also clean up
and flesh out the existing uninitialized testing for field initializers.

The tests come from Richard's original patch, but I've cleaned them up
a bit and ordered them more naturally.

Also, I added a test for the most simple base case:
int x = x;

And it turns out we miss this one! =[ That and another bad FIXME on the
field initializer checking are left in the test.

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

13 years agoConvert offset parameter in LayoutPrimaryAndSecondaryVTables() to CharUnits.
Ken Dyck [Sun, 27 Mar 2011 20:33:38 +0000 (20:33 +0000)]
Convert offset parameter in LayoutPrimaryAndSecondaryVTables() to CharUnits.
No change in functionality intended.

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

13 years agoConvert VTableBuilder::MostDerivedClassOffset to CharUnits. No change in
Ken Dyck [Sun, 27 Mar 2011 20:20:28 +0000 (20:20 +0000)]
Convert VTableBuilder::MostDerivedClassOffset to CharUnits. No change in
functionality intended.

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

13 years agoConvert FinalOverriders::MostDerivedClassOffset to CharUnits. No change in
Ken Dyck [Sun, 27 Mar 2011 20:10:29 +0000 (20:10 +0000)]
Convert FinalOverriders::MostDerivedClassOffset to CharUnits. No change in
functionality intended.

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

13 years agoFlip the default for showing include stacks on notes to false. This
Chandler Carruth [Sun, 27 Mar 2011 20:00:08 +0000 (20:00 +0000)]
Flip the default for showing include stacks on notes to false. This
required modifying a few tests that specifically use note include stacks
to check the source manager's view of include stacks. I've simply added
the flag to these tests for now, they may have to be more substantially
changed if we decide to remove support for note include stacks
altogether.

Also, add a test for include stacks on notes that was supposed to go in
with the previous commit.

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

13 years ago'self' is objective-c's 'self' objc pointer only in
Fariborz Jahanian [Sun, 27 Mar 2011 19:53:47 +0000 (19:53 +0000)]
'self' is objective-c's 'self' objc pointer only in
an objc method. Fixes // rdar://9181463

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

13 years agoImprove recovery (error + fix-it) when parsing type dependent template name without...
Francois Pichet [Sun, 27 Mar 2011 19:41:34 +0000 (19:41 +0000)]
Improve recovery (error + fix-it) when parsing type dependent template name without the "template" keyword.

For example:
   typename C1<T>:: /*template*/ Iterator<0> pos;

Also the error is downgraded to an ExtWarn in Microsoft mode.

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

13 years agoRemove a fixed FIXME comment (the base offset has already been converted to
Ken Dyck [Sun, 27 Mar 2011 19:19:52 +0000 (19:19 +0000)]
Remove a fixed FIXME comment (the base offset has already been converted to
CharUnits).

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

13 years agoConvert the offset parameters of AddMethods() to CharUnits. No change in
Ken Dyck [Sun, 27 Mar 2011 19:15:11 +0000 (19:15 +0000)]
Convert the offset parameters of AddMethods() to CharUnits. No change in
functionality intended.

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

13 years agoConvert the BaseOffsetInLayoutClass parameter of ComputeThisAdjustment() to
Ken Dyck [Sun, 27 Mar 2011 19:03:44 +0000 (19:03 +0000)]
Convert the BaseOffsetInLayoutClass parameter of ComputeThisAdjustment() to
CharUnits. No change in functionality intended.

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

13 years agoConvert offset members in MethodInfo to CharUnits. No change in
Ken Dyck [Sun, 27 Mar 2011 18:57:53 +0000 (18:57 +0000)]
Convert offset members in MethodInfo to CharUnits. No change in
functionality intended.

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

13 years agoAltiVec vector comparison logic now affect only vectors of fundamental AltiVec vector...
Anton Yartsev [Sun, 27 Mar 2011 15:36:07 +0000 (15:36 +0000)]
AltiVec vector comparison logic now affect only vectors of fundamental AltiVec vector types. It fixes bug 9347.

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

13 years agoClang supports __STDC_HOSTED__. Patch by Jonathan Sauer
Douglas Gregor [Sun, 27 Mar 2011 09:49:38 +0000 (09:49 +0000)]
Clang supports __STDC_HOSTED__. Patch by Jonathan Sauer

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

13 years agoDiagnose uninitialized uses of a variable within its own initializer.
Chandler Carruth [Sun, 27 Mar 2011 09:46:56 +0000 (09:46 +0000)]
Diagnose uninitialized uses of a variable within its own initializer.
This is basically the same idea as the warning on uninitialized uses of
fields within an initializer list. As such, it is on by default and
under -Wuninitialized.

Original patch by Richard Trieu, with some massaging from me on the
wording and grouping of the diagnostics.

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

13 years agosupported: AltiVec vector initialization with a single literal according to PIM secti...
Anton Yartsev [Sun, 27 Mar 2011 09:32:40 +0000 (09:32 +0000)]
supported: AltiVec vector initialization with a single literal according to PIM section 2.5.1 - after initialization all elements have the value specified by the literal

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

13 years agoWe were emitting construction v-tables with internal linkage all the time.
John McCall [Sun, 27 Mar 2011 09:00:25 +0000 (09:00 +0000)]
We were emitting construction v-tables with internal linkage all the time.
Emit them instead with the linkage of the VTT.

I'm actually really ambivalent about this;  it's what GCC does, but outside
of improving code size (if the linkage is coalescing), I'm not sure it's
at all relevant.  Construction vtables are naturally referenced only by the
VTT, which is itself only referenced by complete-object constructors and
destructors;  giving the construction vtables possibly-external linkage is
important if you have an optimization that drills through the VTT to a
reference to a particular construction vtable which it cannot just emit
itself.

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

13 years agowww/get_started.html: Fix a few URLs.
NAKAMURA Takumi [Sun, 27 Mar 2011 02:04:21 +0000 (02:04 +0000)]
www/get_started.html: Fix a few URLs.

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

13 years agoAdd an option to suppress include stack printing on note diagnostics.
Chandler Carruth [Sun, 27 Mar 2011 01:50:55 +0000 (01:50 +0000)]
Add an option to suppress include stack printing on note diagnostics.
These stacks are often less important than those on primary diagnostics.

As the number of notes grows, this becomes increasingly important. The
include stack printing is clever and doesn't print stacks for adjacent
diagnostics from the same file, but when a note is in between a sequence
of errors in a header file, and the notes all refer to some other file,
we end up getting a worst-case ping-pong of include stacks that take up
a great deal of vertical space.

Still, for now, the default behavior isn't changed. We can evaluate user
feedback with the flag.

Patch by Richard Trieu, a couple of style tweaks from me.

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

13 years agoAdd -f[no-]strict-overflow to the Clang driver. Use it to set the
Chandler Carruth [Sun, 27 Mar 2011 00:04:55 +0000 (00:04 +0000)]
Add -f[no-]strict-overflow to the Clang driver. Use it to set the
default for -fwrapv if that flag isn't specified explicitly. We always
prefer an explict setting of -fwrapv when present. Also adds support for
-fno-wrapv to allow disabling -fwrapv even when -fno-strict-overflow is
passed.

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

13 years agoImprove -Wheader-hygiene to warn about using directives inside linkage
Douglas Gregor [Sat, 26 Mar 2011 22:25:30 +0000 (22:25 +0000)]
Improve -Wheader-hygiene to warn about using directives inside linkage
specifications within the global scope, from Elliot Glaysher.

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

13 years agoMore coherent diagnostic attempting to assign to a member of a const object returned
Fariborz Jahanian [Sat, 26 Mar 2011 19:48:30 +0000 (19:48 +0000)]
More coherent diagnostic attempting to assign to a member of a const object returned
from an objective-c message: // rdar://9005189

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

13 years agoFor Diagnostic::Reset() also reset the state related to #pragma diagnostic. Fixes...
Argyrios Kyrtzidis [Sat, 26 Mar 2011 18:58:17 +0000 (18:58 +0000)]
For Diagnostic::Reset() also reset the state related to #pragma diagnostic. Fixes rdar://9170766.

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

13 years agofix the second part of rdar://8366474 - clang fails to parse ObjC selectors with...
Chris Lattner [Sat, 26 Mar 2011 18:11:38 +0000 (18:11 +0000)]
fix the second part of rdar://8366474 - clang fails to parse ObjC selectors with '::', when :: isn't the first part of the selector.

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

13 years agoMake diagnostic clearer.
Fariborz Jahanian [Sat, 26 Mar 2011 17:07:06 +0000 (17:07 +0000)]
Make diagnostic clearer.

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

13 years agoRemoved workaround for unspecified build problem on MinGW.
Oscar Fuentes [Sat, 26 Mar 2011 16:11:33 +0000 (16:11 +0000)]
Removed workaround for unspecified build problem on MinGW.

Tested that MinGW/MSYS builds fine without that.

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

13 years agoDon't add a symbolic region for 'this' if the member function is static.
Anders Carlsson [Sat, 26 Mar 2011 14:30:44 +0000 (14:30 +0000)]
Don't add a symbolic region for 'this' if the member function is static.

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

13 years agoMake helpers static.
Benjamin Kramer [Sat, 26 Mar 2011 12:38:21 +0000 (12:38 +0000)]
Make helpers static.

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

13 years agoAdd a __has_feature check for the 'availability' attribute
Douglas Gregor [Sat, 26 Mar 2011 12:16:15 +0000 (12:16 +0000)]
Add a __has_feature check for the 'availability' attribute

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

13 years agoOn Mac OS X, the presence of an 'availability' attribute for that
Douglas Gregor [Sat, 26 Mar 2011 12:10:19 +0000 (12:10 +0000)]
On Mac OS X, the presence of an 'availability' attribute for that
platform implies default visibility. To achieve these, refactor our
lookup of explicit visibility so that we search for both an explicit
VisibilityAttr and an appropriate AvailabilityAttr, favoring the
VisibilityAttr if it is present.

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

13 years agoReformatted doc comments so that they are now difficult to edit in any editor that...
David Chisnall [Sat, 26 Mar 2011 11:48:37 +0000 (11:48 +0000)]
Reformatted doc comments so that they are now difficult to edit in any editor that doesn't have explicit doxygen support, as per LLVM style guidelines.

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

13 years agoTest attribute merging for the availability attribute.
Douglas Gregor [Sat, 26 Mar 2011 10:47:34 +0000 (10:47 +0000)]
Test attribute merging for the availability attribute.

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

13 years agoExtend the new 'availability' attribute with support for an
Douglas Gregor [Sat, 26 Mar 2011 03:35:55 +0000 (03:35 +0000)]
Extend the new 'availability' attribute with support for an
'unavailable' argument, which specifies that the declaration to which
the attribute appertains is unavailable on that platform.

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

13 years agoAllow GC qualifiers to be added/removed by conversions from/to void*
John McCall [Sat, 26 Mar 2011 02:56:45 +0000 (02:56 +0000)]
Allow GC qualifiers to be added/removed by conversions from/to void*
without a warning.

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

13 years agoDon't warn about the 'extern' in 'extern "C"' on a tag decl. This is
John McCall [Sat, 26 Mar 2011 02:09:52 +0000 (02:09 +0000)]
Don't warn about the 'extern' in 'extern "C"' on a tag decl.   This is
usually useless, but not always.

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

13 years agoFix the recovery from missing semis on @property declarations to not consume
John McCall [Sat, 26 Mar 2011 01:53:26 +0000 (01:53 +0000)]
Fix the recovery from missing semis on @property declarations to not consume
the following '@'.  Conceivably, we could skip tokens until something that
can validly start an @interface declaration here, but it's not clear that
it matters.

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

13 years agoProperly move attributes to the decl spec when applying them there.
John McCall [Sat, 26 Mar 2011 01:39:56 +0000 (01:39 +0000)]
Properly move attributes to the decl spec when applying them there.

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

13 years agoConvert the OffsetInLayoutClass parameter of
Ken Dyck [Sat, 26 Mar 2011 01:36:26 +0000 (01:36 +0000)]
Convert the OffsetInLayoutClass parameter of
FinalOverriders::ComputeBaseOffsets() to CharUnits. No change in
functionality intended.

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

13 years agoConvert FinalOverriders::Offset to CharUnits. No change in functionality
Ken Dyck [Sat, 26 Mar 2011 01:29:16 +0000 (01:29 +0000)]
Convert FinalOverriders::Offset to CharUnits. No change in functionality
intended.

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

13 years agoConvert offset in MethodBaseOffsetPairTy to CharUnits. No change in
Ken Dyck [Sat, 26 Mar 2011 01:18:17 +0000 (01:18 +0000)]
Convert offset in MethodBaseOffsetPairTy to CharUnits. No change in
functionality intended.

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

13 years agoConvert the offsets in SubobjectOffsetMapTy to CharUnits. No change in
Ken Dyck [Sat, 26 Mar 2011 01:09:13 +0000 (01:09 +0000)]
Convert the offsets in SubobjectOffsetMapTy to CharUnits. No change in
functionality intended.

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

13 years agoConvert several local variables to CharUnits. No change in functionality
Ken Dyck [Sat, 26 Mar 2011 00:51:24 +0000 (00:51 +0000)]
Convert several local variables to CharUnits. No change in functionality
intended.

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

13 years agoTweak grammar in checker description.
Ted Kremenek [Sat, 26 Mar 2011 00:25:42 +0000 (00:25 +0000)]
Tweak grammar in checker description.

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

13 years agoTraverseNestedNameSpecifier -> TraverseNestedNameSpecifierLoc in a few
Craig Silverstein [Fri, 25 Mar 2011 23:31:36 +0000 (23:31 +0000)]
TraverseNestedNameSpecifier -> TraverseNestedNameSpecifierLoc in a few
places where we can, now.  OK-ed by dgregor.

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

13 years agoProvide blockDecl's startLoc to startFunction. This fixes hidden bug exposed by recen...
Devang Patel [Fri, 25 Mar 2011 21:26:13 +0000 (21:26 +0000)]
Provide blockDecl's startLoc to startFunction. This fixes hidden bug exposed by recent code gen changes. This is tested by global-blocks-lines.exp in gdb testsuite.

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

13 years agoObj-C/NeXT: Update and reapply 108847, now that changes are more baked.
Daniel Dunbar [Fri, 25 Mar 2011 20:09:09 +0000 (20:09 +0000)]
Obj-C/NeXT: Update and reapply 108847, now that changes are more baked.

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

13 years agoSilly mistake in integer constant folding cleanup.
Eli Friedman [Fri, 25 Mar 2011 19:07:11 +0000 (19:07 +0000)]
Silly mistake in integer constant folding cleanup.

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

13 years agoDriver/Darwin: Dsymutil actions should put the dSYM adjacent to the output file.
Daniel Dunbar [Fri, 25 Mar 2011 18:16:51 +0000 (18:16 +0000)]
Driver/Darwin: Dsymutil actions should put the dSYM adjacent to the output file.

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

13 years agoRefactor CGObjCMac to use the shared code for EH stuff.
David Chisnall [Fri, 25 Mar 2011 17:46:35 +0000 (17:46 +0000)]
Refactor CGObjCMac to use the shared code for EH stuff.

Sanity checked by John McCall.

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

13 years agowe can now claim to fully support the override control feature in C++0x.
Anders Carlsson [Fri, 25 Mar 2011 15:04:23 +0000 (15:04 +0000)]
we can now claim to fully support the override control feature in C++0x.

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

13 years agoFixup comments.
Anders Carlsson [Fri, 25 Mar 2011 14:55:14 +0000 (14:55 +0000)]
Fixup comments.

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

13 years agoRemove the last of ClassVirtSpecifiers.
Anders Carlsson [Fri, 25 Mar 2011 14:53:29 +0000 (14:53 +0000)]
Remove the last of ClassVirtSpecifiers.

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

13 years agoReplace the call to ParseOptionalCXX0XClassVirtSpecifierSeq with code to only parse...
Anders Carlsson [Fri, 25 Mar 2011 14:46:08 +0000 (14:46 +0000)]
Replace the call to ParseOptionalCXX0XClassVirtSpecifierSeq with code to only parse an optional 'final' keyword.

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

13 years agoGet rid of handling of the 'explicit' keyword from class-head. We still parse it...
Anders Carlsson [Fri, 25 Mar 2011 14:31:08 +0000 (14:31 +0000)]
Get rid of handling of the 'explicit' keyword from class-head. We still parse it though, although that will change shortly.

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

13 years agoUnbreak CMake build.
Anders Carlsson [Fri, 25 Mar 2011 14:16:48 +0000 (14:16 +0000)]
Unbreak CMake build.

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

13 years agoAdded some doc comments.
David Chisnall [Fri, 25 Mar 2011 14:06:20 +0000 (14:06 +0000)]
Added some doc comments.

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

13 years agoContinuing work on ObjC tidyup:
David Chisnall [Fri, 25 Mar 2011 11:57:33 +0000 (11:57 +0000)]
Continuing work on ObjC tidyup:

- Moved the CGObjCRuntime functions out of CGObjCMac.cpp into CGObjCRuntime.cpp

- Added generic functions in CGObjCRuntime for emitting @try and @synchronize
  blocks, usable by any runtime that uses DWARF exceptions.

- Made the GNU runtimes use these functions.

It should now be possible to replace the equivalent functions in
CGObjCNonFragileABIMac with simple calls to these two functions, providing the
runtime functions as arguments.  I'll post a diff to the list for review before
making any changes to the Mac runtime stuff.

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

13 years agoRemove warnings about using override control keywords in inline function definitions...
Anders Carlsson [Fri, 25 Mar 2011 11:28:25 +0000 (11:28 +0000)]
Remove warnings about using override control keywords in inline function definitions; they will be allowed in the next C++0x draft.

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

13 years agoFix some clang warnings.
Anders Carlsson [Fri, 25 Mar 2011 11:22:47 +0000 (11:22 +0000)]
Fix some clang warnings.

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

13 years agoRemove 'new' from virt-specifier since it's going to be removed in the next C++0x...
Anders Carlsson [Fri, 25 Mar 2011 11:19:41 +0000 (11:19 +0000)]
Remove 'new' from virt-specifier since it's going to be removed in the next C++0x draft

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

13 years agoApply the nonnull attribute to constructor expressions too.
Nick Lewycky [Fri, 25 Mar 2011 01:44:32 +0000 (01:44 +0000)]
Apply the nonnull attribute to constructor expressions too.

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

13 years agoSwitch constant evaluation of float casts over to cast kinds.
Eli Friedman [Fri, 25 Mar 2011 00:54:52 +0000 (00:54 +0000)]
Switch constant evaluation of float casts over to cast kinds.

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

13 years agoCleanup integral and vector constant evaluation of casts to use cast kinds.
Eli Friedman [Fri, 25 Mar 2011 00:43:55 +0000 (00:43 +0000)]
Cleanup integral and vector constant evaluation of casts to use cast kinds.

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

13 years agoFixed some of the incompatibilities with gcc.
John Thompson [Thu, 24 Mar 2011 18:51:57 +0000 (18:51 +0000)]
Fixed some of the incompatibilities with gcc.

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

13 years agoMinor fix in the injection of labels, since we want to look at the redeclaration...
Douglas Gregor [Thu, 24 Mar 2011 14:35:16 +0000 (14:35 +0000)]
Minor fix in the injection of labels, since we want to look at the redeclaration context of each declaration in the identifier chain. Should fix Linux self-host

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

13 years agoInsomniac refactoring: change how the parser allocates attributes so that
John McCall [Thu, 24 Mar 2011 11:26:52 +0000 (11:26 +0000)]
Insomniac refactoring:  change how the parser allocates attributes so that
AttributeLists do not accumulate over the lifetime of parsing, but are
instead reused.  Also make the arguments array not require a separate
allocation, and make availability attributes store their stuff in
augmented memory, too.

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

13 years agoFix the insertion of label declarations into the identifier chain in
Douglas Gregor [Thu, 24 Mar 2011 10:35:39 +0000 (10:35 +0000)]
Fix the insertion of label declarations into the identifier chain in
the case where we only have a single identifier with that name in the
chain. Fixes PR9463 for real this time.

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

13 years agoMake sure we aggressively attach nounwind (etc.) to calls to library
Eli Friedman [Thu, 24 Mar 2011 05:09:45 +0000 (05:09 +0000)]
Make sure we aggressively attach nounwind (etc.) to calls to library
functions of the form __builtin_XXX.

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

13 years agoConvert the BaseOffset member of BaseSubobject to CharUnits from bits. No
Ken Dyck [Thu, 24 Mar 2011 01:21:01 +0000 (01:21 +0000)]
Convert the BaseOffset member of BaseSubobject to CharUnits from bits. No
change in functionality intended.

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

13 years agoAdd a new warning for exit-time destructors.
Anders Carlsson [Thu, 24 Mar 2011 01:01:41 +0000 (01:01 +0000)]
Add a new warning for exit-time destructors.

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

13 years agoRework checker "packages" and groups to be more hierarchical.
Ted Kremenek [Thu, 24 Mar 2011 00:28:47 +0000 (00:28 +0000)]
Rework checker "packages" and groups to be more hierarchical.

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

13 years agoCall out ObjC parameter types as a different kind of declarator context
John McCall [Wed, 23 Mar 2011 23:43:04 +0000 (23:43 +0000)]
Call out ObjC parameter types as a different kind of declarator context
from a normal type-spec, just for completeness.

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

13 years agoFixed type error in last commit (forgot that now that selectors are not
David Chisnall [Wed, 23 Mar 2011 22:52:06 +0000 (22:52 +0000)]
Fixed type error in last commit (forgot that now that selectors are not
accessed via the indirect pointer, they don't need to be pointers to pointers).

Finished moving the message lookup code into separate subclasses for each
runtime.  Also performed a few smallish related tidies.

We're now bitcasting the result of the message lookup functions, rather than
casting the lookup functions themselves, so the messages.m test needed updating
to reflect this.

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

13 years agoFix CFG-construction bug when run from AnalysisBasedWarnings::IssueWarnings() where...
Ted Kremenek [Wed, 23 Mar 2011 21:33:21 +0000 (21:33 +0000)]
Fix CFG-construction bug when run from AnalysisBasedWarnings::IssueWarnings() where block-level expressions that need
to be recorded in the Stmt*->CFGBlock* map were not always done so.  Fixes <rdar://problem/9171946>.

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

13 years agoUnbreak test
Douglas Gregor [Wed, 23 Mar 2011 21:19:43 +0000 (21:19 +0000)]
Unbreak test

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

13 years agoSupport for Transparent unions used as overloadable
Fariborz Jahanian [Wed, 23 Mar 2011 19:50:54 +0000 (19:50 +0000)]
Support for Transparent unions used as overloadable
function parameter. // rdar:// 9129552
and PR9406.

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

13 years agoAdd a test for !ptr-to-member (should fail)
Marshall Clow [Wed, 23 Mar 2011 19:44:36 +0000 (19:44 +0000)]
Add a test for !ptr-to-member (should fail)

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

13 years agoRevert r128156 because of CodeGenObjC/messages.m and Coverage/codegen-gnu.m.
Andrew Trick [Wed, 23 Mar 2011 19:43:59 +0000 (19:43 +0000)]
Revert r128156 because of CodeGenObjC/messages.m and Coverage/codegen-gnu.m.

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

13 years agoRemove the redundant loads / stores to globals that we were generating for selectors...
David Chisnall [Wed, 23 Mar 2011 18:39:12 +0000 (18:39 +0000)]
Remove the redundant loads / stores to globals that we were generating for selectors (GNU runtimes).

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

13 years agoInitial work on refactoring GNU runtime code (long overdue - it's quite obvious
David Chisnall [Wed, 23 Mar 2011 16:36:54 +0000 (16:36 +0000)]
Initial work on refactoring GNU runtime code (long overdue - it's quite obvious
that I hadn't used C++ for several years before writing most of this code).
Still lots more to do.  This set of changes includes:

- Remove the distinction between typed and untyped selectors.  More accurately
  reflect what the runtime does, by using typed selectors everywhere, with an
  empty type field if the types are unknown.  Now we just store a small list of
  types for each selector (in theory, this should always be exactly one, but
  this constraint was not enforced back in 1986 when it should have been).

- Add some consistency to how runtime functions are created.  These are all
  generated via the LazyRuntimeFunction class (which might be useful outside
  CGObjCGNU - feel free to move it into a header if it is).  This function
  stores the types of a function, looks it up the first time it's used, and
  caches the result.  This means that we're now not wasting time constructing
  the llvm::FunctionType every time some of the functions are looked up, but
  also not inserting references to runtime functions into the module if they're
  not actually used.

- Started separating out the fragile and non-fragile ABI behaviours into two
  subclasses of CGObjCGNU: CGObjCGCC for the legacy GCC runtime ABI and
  CGObjCGNUstep for the new GNUstep ABI.  Not all of the differences in
  behaviour are factored out yet, but they will be in future commits.

- Removed all of the CodeGen:: things: we've been using namespace CodeGen in
  this file for ages, so having explicit namespace specifiers is just a bit
  confusing.

- Added a few more comments.

- Used llvm::StringRef instead of std::string in a few places.

- Finally got around to storing the module path in the module structure.  The
  ABI says that the compiler should do this, although it's not used in the
  runtime or exposed outside the runtime, so it's pretty useless.

Still to do:

- We currently have two code paths for generating try blocks, one for ObjC and
  one for ObjC++.  Not only are these substantially similar, they are also very
  similar to the CGObjCMac version.  These need factoring out into a single
  parameterised implementation, either in CGObjCRuntime or CodeGenFunction.
  The EmitObjCXXTryStmt() function was added so that the changes to fix a bug
  in time for the 2.9 release would be self-contained and reduce the chances of
  breaking anything else, but these should be done properly as soon as
  possible.

- Split up some large functions (e.g. GenerateClass()) into smaller functions
  for generating the various data structures.

- The method lookup code into the two subclasses, removing the conditionals in
  the message send functions.

- Add doxygen comments on the remaining undocumented functions.

- We seem to be generating global pointer variables for selectors, then storing
  a pointer to the selector, then generating a load of this pointer (and then a
  load of the real selector later) every time a static selector is used.  I can
  only assume I was asleep or drunk when I did this - we should just be
  referencing the selectors directly in the selector array.

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

13 years agoUpdate type cache when a type is completed.
Devang Patel [Wed, 23 Mar 2011 16:29:39 +0000 (16:29 +0000)]
Update type cache when a type is completed.
Radar 9168773

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

13 years agoTeach DelayedDiagnostic to copy its string, rather than hope that the
Douglas Gregor [Wed, 23 Mar 2011 15:13:44 +0000 (15:13 +0000)]
Teach DelayedDiagnostic to copy its string, rather than hope that the
string itself lives longer than the DelayedDiagnostic. Fixes a recent
use-after-free regression due to my availability attribute work.

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

13 years agoIgnore weak_import on Objective-C property and method declarations on
Douglas Gregor [Wed, 23 Mar 2011 13:27:51 +0000 (13:27 +0000)]
Ignore weak_import on Objective-C property and method declarations on
all platforms, not just darwin. Fixes the regression in this test case.

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

13 years agoswitch a few Driver APIs to use llvm::ArrayRef, cleaning up code.
Chris Lattner [Wed, 23 Mar 2011 04:04:01 +0000 (04:04 +0000)]
switch a few Driver APIs to use llvm::ArrayRef, cleaning up code.

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

13 years agoremove a dead variable.
Chris Lattner [Wed, 23 Mar 2011 04:03:30 +0000 (04:03 +0000)]
remove a dead variable.

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

13 years agoFix crash in clang_getInstantiationLoc() when SourceManager::getInstantiationLoc...
Ted Kremenek [Wed, 23 Mar 2011 02:16:44 +0000 (02:16 +0000)]
Fix crash in clang_getInstantiationLoc() when SourceManager::getInstantiationLoc() can return a SourceLocatin with an invalid
FileID on invalid code.  Fixes <rdar://problem/9164623>.

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

13 years agostd::vector::data() is not portable to VS. Use a gross hack instead.
Ted Kremenek [Wed, 23 Mar 2011 02:16:41 +0000 (02:16 +0000)]
std::vector::data() is not portable to VS.  Use a gross hack instead.

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

13 years agoConvert OffsetFromNearestVBast parameter of InitializeVTablePointer(s) to
Ken Dyck [Wed, 23 Mar 2011 01:04:18 +0000 (01:04 +0000)]
Convert OffsetFromNearestVBast parameter of InitializeVTablePointer(s) to
CharUnits. No change in functionality intended.

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

13 years agoImplement a new 'availability' attribute, that allows one to specify
Douglas Gregor [Wed, 23 Mar 2011 00:50:03 +0000 (00:50 +0000)]
Implement a new 'availability' attribute, that allows one to specify
which versions of an OS provide a certain facility. For example,

  void foo()
  __attribute__((availability(macosx,introduced=10.2,deprecated=10.4,obsoleted=10.6)));

says that the function "foo" was introduced in 10.2, deprecated in
10.4, and completely obsoleted in 10.6. This attribute ties in with
the deployment targets (e.g., -mmacosx-version-min=10.1 specifies that
we want to deploy back to Mac OS X 10.1). There are several concrete
behaviors that this attribute enables, as illustrated with the
function foo() above:

  - If we choose a deployment target >= Mac OS X 10.4, uses of "foo"
    will result in a deprecation warning, as if we had placed
    attribute((deprecated)) on it (but with a better diagnostic)
  - If we choose a deployment target >= Mac OS X 10.6, uses of "foo"
    will result in an "unavailable" warning (in C)/error (in C++), as
    if we had placed attribute((unavailable)) on it
  - If we choose a deployment target prior to 10.2, foo() is
    weak-imported (if it is a kind of entity that can be weak
    imported), as if we had placed the weak_import attribute on it.

Naturally, there can be multiple availability attributes on a
declaration, for different platforms; only the current platform
matters when checking availability attributes.

The only platforms this attribute currently works for are "ios" and
"macosx", since we already have -mxxxx-version-min flags for them and we
have experience there with macro tricks translating down to the
deprecated/unavailable/weak_import attributes. The end goal is to open
this up to other platforms, and even extension to other "platforms"
that are really libraries (say, through a #pragma clang
define_system), but that hasn't yet been designed and we may want to
shake out more issues with this narrower problem first.

Addresses <rdar://problem/6690412>.

As a drive-by bug-fix, if an entity is both deprecated and
unavailable, we only emit the "unavailable" diagnostic.

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

13 years agoConvert NonVirtual parameter of ApplyNonVirtualAndVirtualOffset() to
Ken Dyck [Wed, 23 Mar 2011 00:45:26 +0000 (00:45 +0000)]
Convert NonVirtual parameter of ApplyNonVirtualAndVirtualOffset() to
CharUnits. No change in functionality intended.

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

13 years agoFix an error with the declaration of block parameters that depend
John McCall [Tue, 22 Mar 2011 23:15:50 +0000 (23:15 +0000)]
Fix an error with the declaration of block parameters that depend
on previous block parameters that crept in as part of my captures
work a month or so ago.

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

13 years agoWarn about unused declaration-specifiers on tag declarations.
John McCall [Tue, 22 Mar 2011 23:00:04 +0000 (23:00 +0000)]
Warn about unused declaration-specifiers on tag declarations.

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

13 years agoMake the definition of "long double" consistent for llvm::Triple::Win32 for
Eli Friedman [Tue, 22 Mar 2011 21:25:11 +0000 (21:25 +0000)]
Make the definition of "long double" consistent for llvm::Triple::Win32 for
both 32-bit and 64-bit targets.

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

13 years agoSimplify Mac runtime selection - it's the factory function's job to select which...
David Chisnall [Tue, 22 Mar 2011 21:21:24 +0000 (21:21 +0000)]
Simplify Mac runtime selection - it's the factory function's job to select which class to produce, not CodeGenModule's.

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

13 years agoHopefully fix VS build by not using std::vector::data().
Ted Kremenek [Tue, 22 Mar 2011 20:16:19 +0000 (20:16 +0000)]
Hopefully fix VS build by not using std::vector::data().

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

13 years agoMake the property accessor functions that take a ptrdiff_t actually take a ptrdiff_t...
David Chisnall [Tue, 22 Mar 2011 20:03:13 +0000 (20:03 +0000)]
Make the property accessor functions that take a ptrdiff_t actually take a ptrdiff_t instead of a long (should have no impact on any sane platforms, but win64 is not sane).

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

13 years agoMake the ivar offset always be a ptrdiff_t, because stuff in CGObjC.cpp expects this...
David Chisnall [Tue, 22 Mar 2011 19:57:51 +0000 (19:57 +0000)]
Make the ivar offset always be a ptrdiff_t, because stuff in CGObjC.cpp expects this.  Actually, it expects a long, but that's a bug that will be fixed in the next commit...

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

13 years agoFix typo in comment.
Nick Lewycky [Tue, 22 Mar 2011 17:35:47 +0000 (17:35 +0000)]
Fix typo in comment.

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

13 years agoFrontend: Add a more explicit -backend-option flag for passing backend command
Daniel Dunbar [Tue, 22 Mar 2011 16:48:17 +0000 (16:48 +0000)]
Frontend: Add a more explicit -backend-option flag for passing backend command
line options, instead of leveraging the blanket -mllvm option.
 - This allows using the frontend itself without requiring the backend have
   those options available (i.e., if the target wasn't built).

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

13 years agoDon't clear OverloadCandidateSets on destruction, it has no effect anymore.
Benjamin Kramer [Tue, 22 Mar 2011 09:46:54 +0000 (09:46 +0000)]
Don't clear OverloadCandidateSets on destruction, it has no effect anymore.

And clearing a SmallPtrSet can be an expensive operation.

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

13 years agoApply Jonathan Sauer's proposed solution to PR9519. Thanks!
John McCall [Tue, 22 Mar 2011 07:16:37 +0000 (07:16 +0000)]
Apply Jonathan Sauer's proposed solution to PR9519.  Thanks!

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