]> granicus.if.org Git - clang/log
clang
13 years agoavoid using config.h in public headers
Dylan Noblesmith [Thu, 23 Jun 2011 12:20:57 +0000 (12:20 +0000)]
avoid using config.h in public headers

This is the only usage in clang's headers, and it's for a define
that only exists on CMake builds for the sake of the MSVC compiler,
so just use an ifdef instead.

Also add an include for config.h in a file that actually needs it,
and was picking it up by accident indirectly.

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

13 years agoAdd documentation about __has_feature(cxx_delegationg_constructors)
Sean Hunt [Thu, 23 Jun 2011 06:11:37 +0000 (06:11 +0000)]
Add documentation about __has_feature(cxx_delegationg_constructors)

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

13 years agoFix this test on machines that don't run clang -cc1as when asked to assemble.
Nick Lewycky [Thu, 23 Jun 2011 05:38:06 +0000 (05:38 +0000)]
Fix this test on machines that don't run clang -cc1as when asked to assemble.

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

13 years agoFix a minor copy-paste-o that broke the stylesheets
Sean Hunt [Thu, 23 Jun 2011 01:22:53 +0000 (01:22 +0000)]
Fix a minor copy-paste-o that broke the stylesheets

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

13 years agoFix a bunch of HTML compliance problems with LanguageExtensions.html
Sean Hunt [Thu, 23 Jun 2011 01:21:01 +0000 (01:21 +0000)]
Fix a bunch of HTML compliance problems with LanguageExtensions.html

One weird thing is the addition of several <a name=""> tags where
previously there were id attributes on the <h3> tags. This is because
the id attribute must begin with a letter, not an underscore. The name
attribute is not so constrained, so links will continue to work.

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

13 years agoMove all of Sema's member-access-related checking out of SemaExpr.cpp
Douglas Gregor [Thu, 23 Jun 2011 00:49:38 +0000 (00:49 +0000)]
Move all of Sema's member-access-related checking out of SemaExpr.cpp
and into a new file, SemaExprMember.cpp, bringing SemaExpr.cpp just
under 10,000 lines of code (ugh). No functionality change, although I
intend to do some refactoring of this code to address PR8368 at some
point in the "near" future.

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

13 years agoRevert "-fexceptions does not, in fact, enable C++ exceptions"
Sean Hunt [Thu, 23 Jun 2011 00:42:53 +0000 (00:42 +0000)]
Revert "-fexceptions does not, in fact, enable C++ exceptions"

In fact it does. For the driver anyway, and not cc1 which I'm supposed
to pretend doesn't exist.

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

13 years agoAllow unavailable function calls inside unavailable functions in C++/ObjC++ as well...
Argyrios Kyrtzidis [Thu, 23 Jun 2011 00:41:50 +0000 (00:41 +0000)]
Allow unavailable function calls inside unavailable functions in C++/ObjC++ as well. rdar://9660196

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

13 years agoClean up the heart of the caching code and miss fewer edge cases.
Sean Hunt [Thu, 23 Jun 2011 00:26:20 +0000 (00:26 +0000)]
Clean up the heart of the caching code and miss fewer edge cases.

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

13 years ago-fexceptions does not, in fact, enable C++ exceptions
Sean Hunt [Wed, 22 Jun 2011 23:49:12 +0000 (23:49 +0000)]
-fexceptions does not, in fact, enable C++ exceptions

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

13 years agolit support for REQUIRES: asserts.
Andrew Trick [Wed, 22 Jun 2011 23:23:49 +0000 (23:23 +0000)]
lit support for REQUIRES: asserts.

Take #2. Don't piggyback on the existing config.build_mode. Instead,
define a new lit feature for each build feature we need (currently
just "asserts"). Teach both autoconf'd and cmake'd Makefiles to define
this feature within test/lit.site.cfg. This doesn't require any lit
harness changes and should be more robust across build systems.

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

13 years agoCheck for placeholders early on in
Douglas Gregor [Wed, 22 Jun 2011 23:21:00 +0000 (23:21 +0000)]
Check for placeholders early on in
Sema::CreateUnaryExprOrTypeTraitExpr() rather than recursing in some
cases. Fixes <rdar://problem/9659191>.

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

13 years agoFix a think-o that amazingly didn't show up until I started writing
Sean Hunt [Wed, 22 Jun 2011 22:13:13 +0000 (22:13 +0000)]
Fix a think-o that amazingly didn't show up until I started writing
implicit move tests.

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

13 years agoIssue warning if weak_import attribute is added to an already
Fariborz Jahanian [Wed, 22 Jun 2011 22:08:50 +0000 (22:08 +0000)]
Issue warning if weak_import attribute is added to an already
declared variable and ignore it. // rdar://9538608

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

13 years agotest/Unit: Fixup lit.cfg to allow running inside test/Unit (with llvm-config in
Daniel Dunbar [Wed, 22 Jun 2011 21:46:43 +0000 (21:46 +0000)]
test/Unit: Fixup lit.cfg to allow running inside test/Unit (with llvm-config in
path).

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

13 years agoAlloa catching Objective-C id's being thrown with C++ throw
Fariborz Jahanian [Wed, 22 Jun 2011 20:21:51 +0000 (20:21 +0000)]
Alloa catching Objective-C id's being thrown with C++ throw
in Darwin's fragile abi mode.  // rdar://8940528

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

13 years agoChanges ParenListExpr to always require a type.
Manuel Klimek [Wed, 22 Jun 2011 20:02:16 +0000 (20:02 +0000)]
Changes ParenListExpr to always require a type.
Removes dead code found in the process.
Adds a test to verify that ParenListExprs do not have NULL types.

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

13 years agoCopy diagnostic pragmas to the preprocessed output, from Richard Osborne!
Douglas Gregor [Wed, 22 Jun 2011 19:41:48 +0000 (19:41 +0000)]
Copy diagnostic pragmas to the preprocessed output, from Richard Osborne!

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

13 years agoFix the starting location of the Fix-It note for suspicious precedence
Douglas Gregor [Wed, 22 Jun 2011 18:41:08 +0000 (18:41 +0000)]
Fix the starting location of the Fix-It note for suspicious precedence
issues between a bitwise operator and a comparison operator. Fixes
<rdar://problem/9637759>.

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

13 years agoWhen instantiating a function template declaration that was expressed
Douglas Gregor [Wed, 22 Jun 2011 18:16:25 +0000 (18:16 +0000)]
When instantiating a function template declaration that was expressed
via a typedef of a function, make sure to synthesize parameter
declarations. Fixes PR9654 / <rdar://problem/9257497>.

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

13 years ago[arcmt] Make -Warc-unsafe-retained-assign an error when migrating. rdar://8939557
Argyrios Kyrtzidis [Wed, 22 Jun 2011 18:03:59 +0000 (18:03 +0000)]
[arcmt] Make -Warc-unsafe-retained-assign an error when migrating. rdar://8939557

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

13 years agoPut all ARC-related warnings into the "arc" diagnostic group.
Argyrios Kyrtzidis [Wed, 22 Jun 2011 18:03:56 +0000 (18:03 +0000)]
Put all ARC-related warnings into the "arc" diagnostic group.

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

13 years agoChange "cannot assign retained object.." warning to "assigning retained object.."
Argyrios Kyrtzidis [Wed, 22 Jun 2011 18:03:53 +0000 (18:03 +0000)]
Change "cannot assign retained object.." warning to "assigning retained object.."

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

13 years agoBuild and use libcompiler_rt whenever possible.
Eric Christopher [Wed, 22 Jun 2011 17:41:40 +0000 (17:41 +0000)]
Build and use libcompiler_rt whenever possible.

Patch by Jean-Daniel Dupas!

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

13 years agoTry to silence GCC warning
Douglas Gregor [Wed, 22 Jun 2011 16:43:25 +0000 (16:43 +0000)]
Try to silence GCC warning

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

13 years agoobjc-arc: Allow unbridged cast of retainable object to
Fariborz Jahanian [Wed, 22 Jun 2011 16:36:45 +0000 (16:36 +0000)]
objc-arc: Allow unbridged cast of retainable object to
integral as it is not transferring ownership..
// rdar://9619861

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

13 years agoImplement the C++0x move optimization for Automatic Reference Counting
Douglas Gregor [Wed, 22 Jun 2011 16:32:26 +0000 (16:32 +0000)]
Implement the C++0x move optimization for Automatic Reference Counting
objects, so that we steal the retain count of a temporary __strong
pointer (zeroing out that temporary), eliding a retain/release
pair. Addresses <rdar://problem/9364932>.

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

13 years agoWhen binding a reference to an Automatic Reference Counting temporary,
Douglas Gregor [Wed, 22 Jun 2011 16:12:01 +0000 (16:12 +0000)]
When binding a reference to an Automatic Reference Counting temporary,
retain/release the temporary object appropriately. Previously, we
would only perform the retain/release operations when the reference
would extend the lifetime of the temporary, but this does the wrong
thing across calls.

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

13 years agoGive MaterializeTemporaryExpr the exact type of the lvalue it binds
Douglas Gregor [Wed, 22 Jun 2011 15:05:02 +0000 (15:05 +0000)]
Give MaterializeTemporaryExpr the exact type of the lvalue it binds
to, including cv-qualifications.

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

13 years agoFix typo in comment
Douglas Gregor [Wed, 22 Jun 2011 14:41:20 +0000 (14:41 +0000)]
Fix typo in comment

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

13 years agoReplace the existing forms of ConstantArray::get() with a single form
Jay Foad [Wed, 22 Jun 2011 09:24:39 +0000 (09:24 +0000)]
Replace the existing forms of ConstantArray::get() with a single form
that takes an ArrayRef.

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

13 years agoIntroduce DelayedCleanupPool useful for simplifying clean-up of certain resources...
Argyrios Kyrtzidis [Wed, 22 Jun 2011 06:09:49 +0000 (06:09 +0000)]
Introduce DelayedCleanupPool useful for simplifying clean-up of certain resources that, while their
lifetime is well-known and restricted, cleaning them up manually is easy to miss and cause a leak.

Use it to plug the leaking of TemplateIdAnnotation objects. rdar://9634138.

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

13 years agoOnly do config-time substitution of LLVM_BUILD_MODE in
Andrew Trick [Wed, 22 Jun 2011 05:44:01 +0000 (05:44 +0000)]
Only do config-time substitution of LLVM_BUILD_MODE in
test/lit.site.cfg, not Unit/test/lit.site.cfg.

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

13 years agoActually, you know, fix the problem.
Sean Hunt [Wed, 22 Jun 2011 02:58:46 +0000 (02:58 +0000)]
Actually, you know, fix the problem.

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

13 years agoEmit @finally blocks completely lazily instead of forcing their
John McCall [Wed, 22 Jun 2011 02:32:12 +0000 (02:32 +0000)]
Emit @finally blocks completely lazily instead of forcing their
existence by always threading an edge from the catchall.  Not doing
this was previously causing a crash in the very extreme case where
neither the normal cleanup nor the EH catchall was actually reachable:
we would delete the catchall entry block, which would cause us to
delete the entry block of the finally cleanup as well because the
cleanup logic would merge the blocks, which in turn triggered an assert
because later blocks in the finally would still be using values from the
entry.  Laziness turns out to be the most elegant solution to the problem.

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

13 years agoAvoid making assumption that this is either a CXXMethodDecl or a
Sean Hunt [Wed, 22 Jun 2011 02:25:26 +0000 (02:25 +0000)]
Avoid making assumption that this is either a CXXMethodDecl or a
FunctionTemplateDecl. I'm not quite sure what else it could be, though,
and would appreciate some insight.

This ought to fix the broken builds

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

13 years agoExtend the deleted overload candidate note to cover all cases. It
Sean Hunt [Wed, 22 Jun 2011 01:05:16 +0000 (01:05 +0000)]
Extend the deleted overload candidate note to cover all cases. It
probably shouldn't cover the implicit member case, but it needs to until
more descriptive diagnostics are implemented.

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

13 years agoEnsure that we delete implict copy members when explicit move members
Sean Hunt [Wed, 22 Jun 2011 01:05:13 +0000 (01:05 +0000)]
Ensure that we delete implict copy members when explicit move members
are also present.

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

13 years agoIt is possible to request the nonfragile ABI with -fobjc-abi-version=2;
John McCall [Wed, 22 Jun 2011 00:53:57 +0000 (00:53 +0000)]
It is possible to request the nonfragile ABI with -fobjc-abi-version=2;
respect that when deciding whether -objc-exceptions implies the
-fexceptions -cc1 option.

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

13 years agoAttempt to reapply this patch for caching copy assignment operator
Sean Hunt [Tue, 21 Jun 2011 23:42:56 +0000 (23:42 +0000)]
Attempt to reapply this patch for caching copy assignment operator
lookup. Previously, it was breaking self-host, but it's been a week and
a half and I can't reproduce, so I need to see if it's still failing.

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

13 years agoFix PR10168: don't warn for unused non-dependent variables in both the template defin...
Richard Smith [Tue, 21 Jun 2011 23:42:09 +0000 (23:42 +0000)]
Fix PR10168: don't warn for unused non-dependent variables in both the template definition and each instantiation.

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

13 years agoFix a missing space noticed by matthewbg in code review.
Chandler Carruth [Tue, 21 Jun 2011 23:26:32 +0000 (23:26 +0000)]
Fix a missing space noticed by matthewbg in code review.

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

13 years agoFirst part of PR9968: the __range variable in a dependent C++11 for-range statement...
Richard Smith [Tue, 21 Jun 2011 23:07:19 +0000 (23:07 +0000)]
First part of PR9968: the __range variable in a dependent C++11 for-range statement is implicitly used by that statement.

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

13 years agoFix some grammar nits in the comments from Nick.
Chandler Carruth [Tue, 21 Jun 2011 23:04:20 +0000 (23:04 +0000)]
Fix some grammar nits in the comments from Nick.

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

13 years agoRevert r133526 which re-orders the suggestions for -Wparentheses on ?:
Chandler Carruth [Tue, 21 Jun 2011 23:04:18 +0000 (23:04 +0000)]
Revert r133526 which re-orders the suggestions for -Wparentheses on ?:
operators. There is a consistent design of having the "silence the
warning" option first.

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

13 years agoUnbreak the CMake build
Sean Hunt [Tue, 21 Jun 2011 22:16:17 +0000 (22:16 +0000)]
Unbreak the CMake build

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

13 years agoFix the mangling of dependent-scope decl ref expressions so that they
John McCall [Tue, 21 Jun 2011 22:12:46 +0000 (22:12 +0000)]
Fix the mangling of dependent-scope decl ref expressions so that they
use the unresolved-name production correctly.

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

13 years agoFix a case that I missed in r133550.
Bob Wilson [Tue, 21 Jun 2011 21:58:07 +0000 (21:58 +0000)]
Fix a case that I missed in r133550.

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

13 years agoMake InitHeaderSearch::AddPath and HeaderSearchOptions::AddPath consistent
Bob Wilson [Tue, 21 Jun 2011 21:53:08 +0000 (21:53 +0000)]
Make InitHeaderSearch::AddPath and HeaderSearchOptions::AddPath consistent
use an "IgnoreSysRoot" argument.  HeaderSearchOptions had been using the
opposite form with "IsSysRootRelative", which made for much confusion when
looking at true/false values in calls in AddPath.  No functional change.

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

13 years agoDriver/Darwin: Fixup version check for -object_path_lto support.
Daniel Dunbar [Tue, 21 Jun 2011 21:18:32 +0000 (21:18 +0000)]
Driver/Darwin: Fixup version check for -object_path_lto support.

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

13 years agoFix the default libc++ header search path to be sysrooted. Radar 9639692.
Bob Wilson [Tue, 21 Jun 2011 21:12:29 +0000 (21:12 +0000)]
Fix the default libc++ header search path to be sysrooted.  Radar 9639692.

The -cxx-isystem path is not prefixed with the sysroot directory, so it's
not a good way for the driver to set the system default C++ search path.
Instead, add -stdlib as a cc1 option and teach the frontend how to find the
headers.  The driver can then just pass -stdlib through to "cc1".

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

13 years agoFix cut-and-paste error: --stdlib is an alias for -stdlib, not -std.
Bob Wilson [Tue, 21 Jun 2011 21:12:21 +0000 (21:12 +0000)]
Fix cut-and-paste error: --stdlib is an alias for -stdlib, not -std.

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

13 years agoDriver/Darwin: When invoking the linker, automatically pass -object_path_lto so
Daniel Dunbar [Tue, 21 Jun 2011 20:55:11 +0000 (20:55 +0000)]
Driver/Darwin: When invoking the linker, automatically pass -object_path_lto so
that the linker has a place to put the temporary object file and can leave it
around (for the driver to clean up). This is important so that the object file
references in the debug info are preserved for possible use by dsymutil.
 - <rdar://problem/8294279> executable has no debug symbols when compiled with LTO

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

13 years agoDriver: Factor out IsUsingLTO helper function.
Daniel Dunbar [Tue, 21 Jun 2011 20:55:08 +0000 (20:55 +0000)]
Driver: Factor out IsUsingLTO helper function.

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

13 years ago[arcmt] Merge 'removeEmptyStatements' and 'removeDeallocMethod' passes to cut down...
Argyrios Kyrtzidis [Tue, 21 Jun 2011 20:20:42 +0000 (20:20 +0000)]
[arcmt] Merge 'removeEmptyStatements' and 'removeDeallocMethod' passes to cut down on one compilation
pass and increase migration speed.

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

13 years ago[arcmt] Break apart Transforms.cpp.
Argyrios Kyrtzidis [Tue, 21 Jun 2011 20:20:39 +0000 (20:20 +0000)]
[arcmt] Break apart Transforms.cpp.

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

13 years agoobjc-arc: Add support for unbridged cast of
Fariborz Jahanian [Tue, 21 Jun 2011 19:42:38 +0000 (19:42 +0000)]
objc-arc: Add support for unbridged cast of
__builtin___CFStringMakeConstantString and CF typed function calls
with explicit cf_returns_retained/cf_returns_not_retained attributes.
// rdar://9544832

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

13 years agoIRgen: Add a -fuse-register-sized-bitfield-access option, for testing.
Daniel Dunbar [Tue, 21 Jun 2011 18:54:46 +0000 (18:54 +0000)]
IRgen: Add a -fuse-register-sized-bitfield-access option, for testing.
 - Changes bit-field access policy to try to use (aligned) register sized accesses.

The idea here is that by using larger accesses we expose more coalescing
potential to the backend when we have situations like adjacent bit-fields in the
same structure (which is common), and that the backend should be smart enough to
narrow the accesses down when no coalescing is done or when it is shown not to
be profitable.

--
$ clang -m32 -O3 -S -o - t.c
_f0:                                    ## @f0
pushl %ebp
movl %esp, %ebp
movl 8(%ebp), %eax
movb (%eax), %cl
andb $-128, %cl
orb $1, %cl
movb %cl, (%eax)
movb 1(%eax), %cl
andb $-128, %cl
orb $1, %cl
movb %cl, 1(%eax)
movb 2(%eax), %cl
andb $-128, %cl
orb $1, %cl
movb %cl, 2(%eax)
movb 3(%eax), %cl
andb $-128, %cl
orb $1, %cl
movb %cl, 3(%eax)
popl %ebp
ret

$ clang -m32 -O3 -S -o - t.c -Xclang -fuse-register-sized-bitfield-access
_f0:                                    ## @f0
pushl %ebp
movl %esp, %ebp
movl 8(%ebp), %eax
movl $-2139062144, %ecx      ## imm = 0xFFFFFFFF80808080
andl (%eax), %ecx
orl $16843009, %ecx         ## imm = 0x1010101
movl %ecx, (%eax)
popl %ebp
ret
--

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

13 years agoBasic: Add TargetInfo::getRegisterWidth hook.
Daniel Dunbar [Tue, 21 Jun 2011 18:54:42 +0000 (18:54 +0000)]
Basic: Add TargetInfo::getRegisterWidth hook.
 - For clarity only, currently just assumes register width == long width.

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

13 years agoIRgen: Add CGOptions to CGTypes.
Daniel Dunbar [Tue, 21 Jun 2011 18:54:39 +0000 (18:54 +0000)]
IRgen: Add CGOptions to CGTypes.

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

13 years ago^cat^cast^
Fariborz Jahanian [Tue, 21 Jun 2011 18:21:32 +0000 (18:21 +0000)]
^cat^cast^

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

13 years agoA few tweaks to MaterializeTemporaryExpr suggested by John.
Douglas Gregor [Tue, 21 Jun 2011 18:20:46 +0000 (18:20 +0000)]
A few tweaks to MaterializeTemporaryExpr suggested by John.

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

13 years agoAdd comment before CheckObjCARCConversion is called on
Fariborz Jahanian [Tue, 21 Jun 2011 18:19:51 +0000 (18:19 +0000)]
Add comment before CheckObjCARCConversion is called on
Expr value not getting changed by this call.

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

13 years agoSwitch the order of the notes for the parentheses suggested in the case
Chandler Carruth [Tue, 21 Jun 2011 18:07:33 +0000 (18:07 +0000)]
Switch the order of the notes for the parentheses suggested in the case
of: a + b ? x : y. In our testing of this flag we've yet to hit a single
case where the existing precedence was correct, so we should suggest
grouping the ?: first.

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

13 years agoobjc-arc: CodeGen part of unbridged cast of CF types.
Fariborz Jahanian [Tue, 21 Jun 2011 17:38:29 +0000 (17:38 +0000)]
objc-arc: CodeGen part of unbridged cast of CF types.
// rdar://9474349

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

13 years agoFix a crash when a pointer-to-member function is called in the condition
Chandler Carruth [Tue, 21 Jun 2011 17:22:09 +0000 (17:22 +0000)]
Fix a crash when a pointer-to-member function is called in the condition
expression of '?:'. Add a test case for this pattern, and also test the
code that led to the crash in a "working" case as well.

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

13 years agoIntroduce a new AST node describing reference binding to temporaries.
Douglas Gregor [Tue, 21 Jun 2011 17:03:29 +0000 (17:03 +0000)]
Introduce a new AST node describing reference binding to temporaries.

MaterializeTemporaryExpr captures a reference binding to a temporary
value, making explicit that the temporary value (a prvalue) needs to
be materialized into memory so that its address can be used. The
intended AST invariant here is that a reference will always bind to a
glvalue, and MaterializeTemporaryExpr will be used to convert prvalues
into glvalues for that binding to happen. For example, given

  const int& r = 1.0;

The initializer of "r" will be a MaterializeTemporaryExpr whose
subexpression is an implicit conversion from the double literal "1.0"
to an integer value.

IR generation benefits most from this new node, since it was
previously guessing (badly) when to materialize temporaries for the
purposes of reference binding. There are likely more refactoring and
cleanups we could perform there, but the introduction of
MaterializeTemporaryExpr fixes PR9565, a case where IR generation
would effectively bind a const reference directly to a bitfield in a
struct. Addresses <rdar://problem/9552231>.

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

13 years agoMake more use of llvm::StringRef in various APIs. In particular, don't
Jay Foad [Tue, 21 Jun 2011 15:13:30 +0000 (15:13 +0000)]
Make more use of llvm::StringRef in various APIs. In particular, don't
use the deprecated forms of llvm::StringMap::GetOrCreateValue().

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

13 years agoFix typo. From Damjan Marion.
Joerg Sonnenberger [Tue, 21 Jun 2011 08:45:08 +0000 (08:45 +0000)]
Fix typo. From Damjan Marion.

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

13 years agoDe-Unicode-ify in comments.
NAKAMURA Takumi [Tue, 21 Jun 2011 03:19:28 +0000 (03:19 +0000)]
De-Unicode-ify in comments.

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

13 years agoAlso fix the warning about using "clang" instead of %clang.
Nick Lewycky [Tue, 21 Jun 2011 00:23:47 +0000 (00:23 +0000)]
Also fix the warning about using "clang" instead of %clang.

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

13 years agoRemove the leading hyphen so that grep doesn't parse it as one long option :)
Nick Lewycky [Tue, 21 Jun 2011 00:21:22 +0000 (00:21 +0000)]
Remove the leading hyphen so that grep doesn't parse it as one long option :)

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

13 years agoDriver/Darwin: Honor -Xarch_FOO when the arch matches either the toolchain or
Daniel Dunbar [Tue, 21 Jun 2011 00:20:17 +0000 (00:20 +0000)]
Driver/Darwin: Honor -Xarch_FOO when the arch matches either the toolchain or
the architecture being bound.
 - Fixes things like -Xarch_armv7.

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

13 years agoAdd support for -Wa,--noexecstack when building from a non-assembly file. For
Nick Lewycky [Tue, 21 Jun 2011 00:14:18 +0000 (00:14 +0000)]
Add support for -Wa,--noexecstack when building from a non-assembly file. For
an assembly file it worked correctly, while for a .c file it would given an
error about how --noexecstack is not a supported argument to -Wa.

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

13 years agoCanonicalize register names properly.
Eric Christopher [Tue, 21 Jun 2011 00:07:10 +0000 (00:07 +0000)]
Canonicalize register names properly.

Fixes rdar://9425559

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

13 years agoMove additional register names to their own lookup, separate from
Eric Christopher [Tue, 21 Jun 2011 00:05:20 +0000 (00:05 +0000)]
Move additional register names to their own lookup, separate from
register aliases. Fixes unnecessary renames of clobbers.

Fixes part of rdar://9425559

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

13 years ago[arcmt] Always add '__bridge' cast when 'self' is cast to a C pointer. rdar://9644061
Argyrios Kyrtzidis [Mon, 20 Jun 2011 23:39:20 +0000 (23:39 +0000)]
[arcmt] Always add '__bridge' cast when 'self' is cast to a C pointer.  rdar://9644061

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

13 years ago[analyzer] Finish size argument checking for strncat (and strncpy).
Jordy Rose [Mon, 20 Jun 2011 21:55:40 +0000 (21:55 +0000)]
[analyzer] Finish size argument checking for strncat (and strncpy).

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

13 years agoobjc-arc: allow explicit unbridged casts if the source of the cast is a
Fariborz Jahanian [Mon, 20 Jun 2011 20:54:42 +0000 (20:54 +0000)]
objc-arc: allow explicit unbridged casts if the source of the cast is a
message sent to an objc method (or property access)
// rdar://9474349

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

13 years ago[arcmt] Find out whether there is an ARC runtime directly from the triple, avoid...
Argyrios Kyrtzidis [Mon, 20 Jun 2011 19:59:52 +0000 (19:59 +0000)]
[arcmt] Find out whether there is an ARC runtime directly from the triple, avoid hacky delegation to the driver for that.

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

13 years agoWarn for un-parenthesized '&' inside '|' (a & b | c), rdar://9553326.
Argyrios Kyrtzidis [Mon, 20 Jun 2011 18:41:26 +0000 (18:41 +0000)]
Warn for un-parenthesized '&' inside '|' (a & b | c), rdar://9553326.

Patch by Henry Mason with tweaks by me.

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

13 years agollvm-gcc treats a tentative definition with a previous
Fariborz Jahanian [Mon, 20 Jun 2011 17:50:03 +0000 (17:50 +0000)]
llvm-gcc treats a tentative definition with a previous
(or follow up) extern declaration with weak_import as
an actual definition. make clang follows this behavior.
// rdar://9538608
llvm-gcc treats an extern declaration with weak_import

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

13 years agoDefine va_copy when in C++0x mode; C++0x picked it up from C99.
Douglas Gregor [Mon, 20 Jun 2011 15:03:22 +0000 (15:03 +0000)]
Define va_copy when in C++0x mode; C++0x picked it up from C99.

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

13 years agoDefine __cplusplus to 201103L when in (non-GNU) C++0x mode.
Douglas Gregor [Mon, 20 Jun 2011 15:00:58 +0000 (15:00 +0000)]
Define __cplusplus to 201103L when in (non-GNU) C++0x mode.

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

13 years agoChange how PHINodes store their operands.
Jay Foad [Mon, 20 Jun 2011 14:38:01 +0000 (14:38 +0000)]
Change how PHINodes store their operands.

Change PHINodes to store simple pointers to their incoming basic blocks,
instead of full-blown Uses.

Note that this loses an optimization in SplitCriticalEdge(), because we
can no longer walk the use list of a BasicBlock to find phi nodes. See
the comment I removed starting "However, the foreach loop is slow for
blocks with lots of predecessors".

Extend replaceAllUsesWith() on a BasicBlock to also update any phi
nodes in the block's successors. This mimics what would have happened
when PHINodes were proper Users of their incoming blocks. (Note that
this only works if OldBB->replaceAllUsesWith(NewBB) is called when
OldBB still has a terminator instruction, so it still has some
successors.)

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

13 years agoUse an explicitly 64-bit triple flag to ensure we can easily verify the
Chandler Carruth [Mon, 20 Jun 2011 08:59:25 +0000 (08:59 +0000)]
Use an explicitly 64-bit triple flag to ensure we can easily verify the
types printed in various diagnostics.

We could omit checking for the types, but that can mask errors where the
wrong type is streamed into the diagnostic. There was at least one of
these caught by this test already.

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

13 years agoFix a problem with the diagnostics of invalid arithmetic with function
Chandler Carruth [Mon, 20 Jun 2011 07:52:11 +0000 (07:52 +0000)]
Fix a problem with the diagnostics of invalid arithmetic with function
pointers I found while working on the NULL arithmetic warning. We here
always assuming the LHS was the pointer, instead of using the selected
pointer expression.

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

13 years agoRemove this poor "abstraction" from the AST. Sorry! =D
Chandler Carruth [Mon, 20 Jun 2011 07:38:56 +0000 (07:38 +0000)]
Remove this poor "abstraction" from the AST. Sorry! =D

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

13 years agoMove away from the poor "abstraction" I added to Type. John argued
Chandler Carruth [Mon, 20 Jun 2011 07:38:51 +0000 (07:38 +0000)]
Move away from the poor "abstraction" I added to Type. John argued
effectively that this abstraction simply doesn't exist. That is
highlighted by the fact that by using it we were papering over a more
serious error in this warning: the fact that we warned for *invalid*
constructs involving member pointers and block pointers.

I've fixed the obvious issues with the warning here, but this is
confirming an original suspicion that this warning's implementation is
flawed. I'm looking into how we can implement this more reasonably. WIP
on that front.

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

13 years agoRemove more unnecessary #include <llvm/ADT/SmallVector.h>
Francois Pichet [Mon, 20 Jun 2011 06:11:46 +0000 (06:11 +0000)]
Remove more unnecessary #include <llvm/ADT/SmallVector.h>

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

13 years agoRemove unnecessary include.
Francois Pichet [Mon, 20 Jun 2011 05:47:47 +0000 (05:47 +0000)]
Remove unnecessary include.

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

13 years agoUpdate to match mainline ConstantStruct::get API change. Also, use
Chris Lattner [Mon, 20 Jun 2011 04:01:35 +0000 (04:01 +0000)]
Update to match mainline ConstantStruct::get API change.  Also, use
ConvertType on InitListExprs as they are being converted.  This is
needed for a forthcoming patch, and improves the IR generated anyway
(see additional type names in testcases).

This patch also converts a bunch of std::vector's in CGObjCMac to use
C arrays.  There are a ton more that should be converted as well.

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

13 years ago[analyzer] Replace stream-built error message with constant string. No functionality...
Jordy Rose [Mon, 20 Jun 2011 03:51:53 +0000 (03:51 +0000)]
[analyzer] Replace stream-built error message with constant string. No functionality change.

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

13 years ago[analyzer] Re-enable checking for strncpy, along with a new validation of the size...
Jordy Rose [Mon, 20 Jun 2011 03:49:16 +0000 (03:49 +0000)]
[analyzer] Re-enable checking for strncpy, along with a new validation of the size argument. strncat is not yet up-to-date, but I'm leaving it enabled for now (there shouldn't be any false positives, at least...)

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

13 years ago[analyzer] Eliminate "byte string function" from CStringChecker's diagnostics, and...
Jordy Rose [Mon, 20 Jun 2011 02:06:40 +0000 (02:06 +0000)]
[analyzer] Eliminate "byte string function" from CStringChecker's diagnostics, and make it easier to provide custom messages for overflow checking, in preparation for re-enabling strncpy checking.

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

13 years agoRestructure the API in Type based on a conversation with Richard Smith.
Chandler Carruth [Mon, 20 Jun 2011 01:23:19 +0000 (01:23 +0000)]
Restructure the API in Type based on a conversation with Richard Smith.
This makes 'isPointerLikeType' a little less confusing, and pulls the
decay check into a separate interface that is much more clear and
concrete. Also, just implement these as logical wrappers around other
predicates. Having a switch based implementation isn't likely to be
necessary. We can try to optimize them later if they show up on
a profile.

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

13 years agoMore clarifications.
John McCall [Sun, 19 Jun 2011 10:12:24 +0000 (10:12 +0000)]
More clarifications.

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

13 years agoImprove the intro to the runtime-functions section.
John McCall [Sun, 19 Jun 2011 09:59:33 +0000 (09:59 +0000)]
Improve the intro to the runtime-functions section.

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

13 years agoDescribe the ARC runtime support calls.
John McCall [Sun, 19 Jun 2011 09:36:02 +0000 (09:36 +0000)]
Describe the ARC runtime support calls.

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

13 years agoTurn -Wnull-arithmetic back on by default -- we now have tests for the
Chandler Carruth [Sun, 19 Jun 2011 09:05:19 +0000 (09:05 +0000)]
Turn -Wnull-arithmetic back on by default -- we now have tests for the
false positives, including those in the GCC test suite, and don't warn
about them.

Let me know if this causes fallout, we can turn it back off if needed.

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