]> granicus.if.org Git - clang/log
clang
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

13 years agosimplify
Chris Lattner [Thu, 14 Jul 2011 18:45:41 +0000 (18:45 +0000)]
simplify

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

13 years agoStringMap::first() is about to start returning a StringRef, adapt.
Chris Lattner [Thu, 14 Jul 2011 18:24:21 +0000 (18:24 +0000)]
StringMap::first() is about to start returning a StringRef, adapt.

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

13 years agoChange intrinsic getter to take an ArrayRef, now that the underlying function in...
Benjamin Kramer [Thu, 14 Jul 2011 17:45:50 +0000 (17:45 +0000)]
Change intrinsic getter to take an ArrayRef, now that the underlying function in LLVM does.

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

13 years agoMoving one misplaced entry in the attribute enum in AttributeList.h into alphabetical...
Caitlin Sadowski [Thu, 14 Jul 2011 17:39:11 +0000 (17:39 +0000)]
Moving one misplaced entry in the attribute enum in AttributeList.h into alphabetical order.

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

13 years agoRevert r135147 and r135075. The consensus was that this wasn't the right thing to do.
Ted Kremenek [Thu, 14 Jul 2011 17:05:32 +0000 (17:05 +0000)]
Revert r135147 and r135075.  The consensus was that this wasn't the right thing to do.

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

13 years agoUpdate the remaining comments in Frontend to 'expansion'.
Chandler Carruth [Thu, 14 Jul 2011 16:14:52 +0000 (16:14 +0000)]
Update the remaining comments in Frontend to 'expansion'.

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

13 years agoClean up some comments I missed when switching from
Chandler Carruth [Thu, 14 Jul 2011 16:08:00 +0000 (16:08 +0000)]
Clean up some comments I missed when switching from
NestedMacroInstantiations -> NestedMacroExpansions.

With this change, libclang should be completely converted except for
uses of SourceManger and SourceLocation APIs, and the C bindings for
those APIs.

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

13 years agoClean up two lingering comments that mention 'instantiation' w.r.t.
Chandler Carruth [Thu, 14 Jul 2011 16:07:57 +0000 (16:07 +0000)]
Clean up two lingering comments that mention 'instantiation' w.r.t.
macros in libclang.

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

13 years agoAdd extra sanity checking in FormatString::matchesType() that we are comparing intege...
Ted Kremenek [Thu, 14 Jul 2011 15:43:21 +0000 (15:43 +0000)]
Add extra sanity checking in FormatString::matchesType() that we are comparing integers to integers.  This happens not to be an issue now, but the extra check helps future proof in case of future refactorings.

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

13 years agoNestedMacroInstantiations -> NestedMacroExpansions
Chandler Carruth [Thu, 14 Jul 2011 09:02:10 +0000 (09:02 +0000)]
NestedMacroInstantiations -> NestedMacroExpansions

This is switches all the interfaces points (and most of the commenst
/ local variables I saw on my way through) regarding the
NestedMacroInstantiations bit.

The libclang enums corresponding to this state were renamed, but
a legacy enum was added with the old name, and the same value to keep
existing clients working. I've added a documentation blurb for it, but
let me know if there is a canonical way to document legacy elemenst of
the libclang interface.

No functionality changed here, even in tests.

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

13 years agoUpdate all of the libclang code corresponding to the preprocessor
Chandler Carruth [Thu, 14 Jul 2011 08:41:15 +0000 (08:41 +0000)]
Update all of the libclang code corresponding to the preprocessor
MacroInstantiation -> MacroExpansion rename. Internally, everything is
switched.

Introduce a new cursor kind enum with the new name, but retain the old
name as an alias so that we don't break backwards compatibility.

Also update the debug printing routine to use 'macro expansions' as its
explicitly not guaranteed to be stable, and mechanically switch the test
cases over to that.

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

13 years agoMove the rest of the preprocessor terminology from 'instantiate' and
Chandler Carruth [Thu, 14 Jul 2011 08:20:46 +0000 (08:20 +0000)]
Move the rest of the preprocessor terminology from 'instantiate' and
variants to 'expand'. This changed a couple of public APIs, including
one public type "MacroInstantiation" which is now "MacroExpansion". The
rest of the codebase was updated to reflect this, especially the
libclang code. Two of the C++ (and thus easily changed) libclang APIs
were updated as well because they pertained directly to the old
MacroInstantiation class.

No functionality changed.

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

13 years agoConvert terminology in the Lexer from 'instantiate' and variants to
Chandler Carruth [Thu, 14 Jul 2011 08:20:40 +0000 (08:20 +0000)]
Convert terminology in the Lexer from 'instantiate' and variants to
'expand'. Also update the public API it provides to the new term, and
propagate that update to the various clients.

No functionality changed.

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

13 years agoSwitch the TokenLexer's terminology from various forms of 'instantiate'
Chandler Carruth [Thu, 14 Jul 2011 08:20:34 +0000 (08:20 +0000)]
Switch the TokenLexer's terminology from various forms of 'instantiate'
to 'expand' for macros. Only comments and uses local to the TokenLexer
are updated.

No functionality changed.

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

13 years agoSwitch all local code and comments from '[Ii]nstantiat(ion|ed)' to
Chandler Carruth [Thu, 14 Jul 2011 08:20:31 +0000 (08:20 +0000)]
Switch all local code and comments from '[Ii]nstantiat(ion|ed)' to
'[Ee]xpan(sion|ded)' in the TextDiagnosticPrinter.

No functionality changed.

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

13 years agoSwitch the diagnostic messages about macros to use the terms 'expanded'
Chandler Carruth [Thu, 14 Jul 2011 08:20:28 +0000 (08:20 +0000)]
Switch the diagnostic messages about macros to use the terms 'expanded'
and 'expansions' rather than 'instantiated' and 'contexts'.

This is the first of several patches migrating Clang's terminology
surrounding macros from 'instantiation' to 'expansion'.

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

13 years agoReapply r135075, but modify format-strings.c and format-strings-fixit.c test cases...
Ted Kremenek [Thu, 14 Jul 2011 06:49:52 +0000 (06:49 +0000)]
Reapply r135075, but modify format-strings.c and format-strings-fixit.c test cases to be more portable with an explicit target triple.

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

13 years agoRevert r135075, "format string checking: long and int have the same widths on 32...
NAKAMURA Takumi [Thu, 14 Jul 2011 05:16:18 +0000 (05:16 +0000)]
Revert r135075, "format string checking: long and int have the same widths on 32-bit, so we shouldn't warn about using"

It fails on freebsd, mingw and msvc10.

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

13 years agoAdd a hackaround to avoid the crash in PR10355. However, our recovery
Douglas Gregor [Thu, 14 Jul 2011 04:54:23 +0000 (04:54 +0000)]
Add a hackaround to avoid the crash in PR10355. However, our recovery
is still terrible here because typo correction is not behaving well in
the presence of overloaded functions.

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

13 years ago[arcmt] Make sure migrating to ARC works even if '-fobjc-arc' is included in command...
Argyrios Kyrtzidis [Thu, 14 Jul 2011 00:17:54 +0000 (00:17 +0000)]
[arcmt] Make sure migrating to ARC works even if '-fobjc-arc' is included in command-line flags. rdar://9567824

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

13 years agoDocument the behavior of property modifiers in ARC.
John McCall [Wed, 13 Jul 2011 23:15:32 +0000 (23:15 +0000)]
Document the behavior of property modifiers in ARC.

rdar://problem/9768338

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

13 years agoPR8800: When building a conversion to A& using a member operatorA&(), do not require...
Richard Smith [Wed, 13 Jul 2011 22:53:21 +0000 (22:53 +0000)]
PR8800: When building a conversion to A& using a member operatorA&(), do not require A to be a complete type.

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

13 years agoReapply r134946 with fixes. Tested on Benjamin testcase and other test-suite failures.
Bruno Cardoso Lopes [Wed, 13 Jul 2011 21:58:55 +0000 (21:58 +0000)]
Reapply r134946 with fixes. Tested on Benjamin testcase and other test-suite failures.

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

13 years agoAdd 'mutable' to the function declarator chunk, to be used when
Douglas Gregor [Wed, 13 Jul 2011 21:47:47 +0000 (21:47 +0000)]
Add 'mutable' to the function declarator chunk, to be used when
parsing lambda expressions, from John Freeman!

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

13 years agoFix an incorrect namespace typo-correction diagnostic, from Kaelyn
Douglas Gregor [Wed, 13 Jul 2011 21:36:26 +0000 (21:36 +0000)]
Fix an incorrect namespace typo-correction diagnostic, from Kaelyn
Uhrain! Fixes PR10318.

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

13 years agoEmit debug info for extended vectors.
Devang Patel [Wed, 13 Jul 2011 21:23:30 +0000 (21:23 +0000)]
Emit debug info for extended vectors.

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

13 years agoformat string checking: long and int have the same widths on 32-bit, so we shouldn...
Ted Kremenek [Wed, 13 Jul 2011 20:20:58 +0000 (20:20 +0000)]
format string checking: long and int have the same widths on 32-bit, so we shouldn't warn about using
an "int" format specifier with a "long" type in 32-bit.

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

13 years agoEnforce access control for the destructor in a new[] expression and mark
John McCall [Wed, 13 Jul 2011 20:12:57 +0000 (20:12 +0000)]
Enforce access control for the destructor in a new[] expression and mark
it as used.  Otherwise, we can fail to instantiate or validate the destructor,
which can lead to crashes in IR gen like PR10351.

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

13 years ago[arcmt] Add weak/unsafe_unretained for "@property (readonly)" when we are @synthesizi...
Argyrios Kyrtzidis [Wed, 13 Jul 2011 19:47:57 +0000 (19:47 +0000)]
[arcmt] Add weak/unsafe_unretained for "@property (readonly)" when we are @synthesizing it.

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

13 years ago[arcmt] For properties rewrite 'assign' -> 'weak or unsafe_unretained', 'retain'...
Argyrios Kyrtzidis [Wed, 13 Jul 2011 19:22:00 +0000 (19:22 +0000)]
[arcmt] For properties rewrite 'assign' -> 'weak or unsafe_unretained', 'retain' -> 'strong', and add
'weak or unsafe_unretained' when 'assign' is missing. rdar://9496219&9602589.

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

13 years agoWith -Wselector, don't warn about unimplemented optional method
Fariborz Jahanian [Wed, 13 Jul 2011 19:05:43 +0000 (19:05 +0000)]
With -Wselector, don't warn about unimplemented optional method
used in @selector expression because, well, their implementation
is optional. // rdar://9545564

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

13 years agoDon't crash if defining -dealloc in a category.
John McCall [Wed, 13 Jul 2011 18:26:47 +0000 (18:26 +0000)]
Don't crash if defining -dealloc in a category.

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

13 years agoIn debugger mode, make ObjC message sends to unknown selectors return
John McCall [Wed, 13 Jul 2011 17:56:40 +0000 (17:56 +0000)]
In debugger mode, make ObjC message sends to unknown selectors return
__unknown_anytype, and rewrite such message sends correctly.

I had to bite the bullet and actually add a debugger support mode for this
one, which is a bit unfortunate, but there really isn't anything else
I could imagine doing;  this is clearly just debugger-specific behavior.

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

13 years agoobjc++: Some level of covariance is allowed in ObjC properties.
Fariborz Jahanian [Wed, 13 Jul 2011 17:55:01 +0000 (17:55 +0000)]
objc++: Some level of covariance is allowed in ObjC properties.
Make it also available in ObjC++ propeties. Use common code for
objc and objc++ so they don't diverge. // rdar://9740328

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

13 years agoRe-relax conversion specifier checking for printf format strings and conversion speci...
Ted Kremenek [Wed, 13 Jul 2011 17:35:14 +0000 (17:35 +0000)]
Re-relax conversion specifier checking for printf format strings and conversion specifiers.  My recent change was a mistake.

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

13 years agoFix inversion in argument type checking for format strings with conversion specifiers...
Ted Kremenek [Wed, 13 Jul 2011 17:25:47 +0000 (17:25 +0000)]
Fix inversion in argument type checking for format strings with conversion specifiers for character types.

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

13 years agoOkay, that rule about zero-length arrays applies to destroying
John McCall [Wed, 13 Jul 2011 08:09:46 +0000 (08:09 +0000)]
Okay, that rule about zero-length arrays applies to destroying
them, too.

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

13 years agoArrays are permitted to be zero-length in some situations.
John McCall [Wed, 13 Jul 2011 07:37:11 +0000 (07:37 +0000)]
Arrays are permitted to be zero-length in some situations.

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

13 years agoMake the integer-range analysis recognize ^= correctly,
John McCall [Wed, 13 Jul 2011 06:35:24 +0000 (06:35 +0000)]
Make the integer-range analysis recognize ^= correctly,
and (while I'm at it) teach it to grok the results of simple
assignments.

The first is PR10336.

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

13 years agoConvert the standard default-construction loops to use phis and
John McCall [Wed, 13 Jul 2011 06:10:41 +0000 (06:10 +0000)]
Convert the standard default-construction loops to use phis and
partial destruction.

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

13 years agoper john's advice, speculatively lower uses of forward-declared enums to
Chris Lattner [Wed, 13 Jul 2011 05:31:19 +0000 (05:31 +0000)]
per john's advice, speculatively lower uses of forward-declared enums to
i32.  They almost always end up this way in the end anyway, and if we get
lucky, this avoids generating some bitcasts.

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

13 years agoPR10337 reminds me that calls return values, lets handle them just
Chris Lattner [Wed, 13 Jul 2011 03:59:32 +0000 (03:59 +0000)]
PR10337 reminds me that calls return values, lets handle them just
like arguments.  Thanks PR10337! :)

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

13 years agoAggressive dead code elimination.
John McCall [Wed, 13 Jul 2011 03:03:51 +0000 (03:03 +0000)]
Aggressive dead code elimination.

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

13 years agoGeneralize the routine for destroying an object with static
John McCall [Wed, 13 Jul 2011 03:01:35 +0000 (03:01 +0000)]
Generalize the routine for destroying an object with static
storage duration, then explicitly exempt ownership-qualified
types from it.

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

13 years agoEliminate an incomplete/incorrect attempt to provide support for C++0x
Douglas Gregor [Wed, 13 Jul 2011 02:14:02 +0000 (02:14 +0000)]
Eliminate an incomplete/incorrect attempt to provide support for C++0x
unrestricted unions, which ended up attempting to initialize objects
in a union (which CodeGen isn't prepared for). Fixes PR9683.

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

13 years agoSilliness with commas, as reported at http://blog.regehr.org/archives/558 . As it...
Eli Friedman [Wed, 13 Jul 2011 02:05:57 +0000 (02:05 +0000)]
Silliness with commas, as reported at http://blog.regehr.org/archives/558 .  As it turns out, this is my fault for not noticing this was an issue when I was looking at this a long time ago. :(

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

13 years agoSwitch delete[] IR-generation over to the destroy framework,
John McCall [Wed, 13 Jul 2011 01:41:37 +0000 (01:41 +0000)]
Switch delete[] IR-generation over to the destroy framework,
which implicitly makes it EH-safe as well.

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

13 years agoWhen compiling ::delete for a class with a virtual destructor, call
Douglas Gregor [Wed, 13 Jul 2011 00:54:47 +0000 (00:54 +0000)]
When compiling ::delete for a class with a virtual destructor, call
the complete destructor and then invoke the global delete
operator. Previously, we would invoke the deleting destructor, which
calls the wrong delete operator. Fixes PR10341.

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

13 years agoCorrectly set up the list of virtual base classes for a CXXRecordDecl. Previously...
Richard Smith [Tue, 12 Jul 2011 23:49:11 +0000 (23:49 +0000)]
Correctly set up the list of virtual base classes for a CXXRecordDecl. Previously we got the source range wrong for everything in the virtual bases list.

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

13 years agorevert fix for // rdar://9740328
Fariborz Jahanian [Tue, 12 Jul 2011 23:20:13 +0000 (23:20 +0000)]
revert fix for // rdar://9740328

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

13 years agoRevert r134946
Bruno Cardoso Lopes [Tue, 12 Jul 2011 22:30:58 +0000 (22:30 +0000)]
Revert r134946

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

13 years ago[arcmt] Also avoid 'weak' for forward references to objc classes.
Argyrios Kyrtzidis [Tue, 12 Jul 2011 22:16:25 +0000 (22:16 +0000)]
[arcmt] Also avoid 'weak' for forward references to objc classes.

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

13 years ago[arcmt] Before applying '__weak' check whether the objc class is annotated with objc_...
Argyrios Kyrtzidis [Tue, 12 Jul 2011 22:05:17 +0000 (22:05 +0000)]
[arcmt] Before applying '__weak' check whether the objc class is annotated with objc_arc_weak_reference_unavailable
or is in a list of classes not supporting 'weak'.

rdar://9489367.

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

13 years agoobjc++: Some level of covariance is allowed in ObjC properties.
Fariborz Jahanian [Tue, 12 Jul 2011 22:05:16 +0000 (22:05 +0000)]
objc++: Some level of covariance is allowed in ObjC properties.
Make it also available in ObjC++ propeties. // rdar://9740328

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

13 years agoFix another typo (int -> id for captured_obj).
David Chisnall [Tue, 12 Jul 2011 20:34:06 +0000 (20:34 +0000)]
Fix another typo (int -> id for captured_obj).

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

13 years agoGeneralize Cleanup::Emit's "isForEH" parameter into a set
John McCall [Tue, 12 Jul 2011 20:27:29 +0000 (20:27 +0000)]
Generalize Cleanup::Emit's "isForEH" parameter into a set
of flags.  No functionality change.

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

13 years agoImplement -MG. Fixes PR9613
Peter Collingbourne [Tue, 12 Jul 2011 19:35:15 +0000 (19:35 +0000)]
Implement -MG.  Fixes PR9613

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

13 years agoAdd more compiler workarounds. Should fix the build with old GCCs and MSVC.
Benjamin Kramer [Tue, 12 Jul 2011 18:37:23 +0000 (18:37 +0000)]
Add more compiler workarounds. Should fix the build with old GCCs and MSVC.

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

13 years agoIn ARC mode, consider Objective-C lifetime types (object pointers and
Douglas Gregor [Tue, 12 Jul 2011 17:28:52 +0000 (17:28 +0000)]
In ARC mode, consider Objective-C lifetime types (object pointers and
block pointers) that don't have any qualification to be POD types. We
were previously considering them to be non-POD types, because this was
convenient in C++ for is_pod-like traits. However, we now end up
inferring lifetime in such cases (template arguments infer __strong),
so it is not necessary.

Moreover, we want rvalues of object type (which have their lifetime
stripped) to be PODs to allow, e.g., va_arg(arglist, id) to function
properly. Fixes <rdar://problem/9758798>.

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

13 years agoFix a bug where a local variable named 'self' is causing
Fariborz Jahanian [Tue, 12 Jul 2011 17:16:56 +0000 (17:16 +0000)]
Fix a bug where a local variable named 'self' is causing
implicit ivar accesses to go through the 'self' variable
rather than the real 'self' for the method. // rdar://9730771

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

13 years agoUgh, use this compiler workaround again.
John McCall [Tue, 12 Jul 2011 16:53:04 +0000 (16:53 +0000)]
Ugh, use this compiler workaround again.

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

13 years agoSwitch field destruction over to use the new destroyer-based API
John McCall [Tue, 12 Jul 2011 16:41:08 +0000 (16:41 +0000)]
Switch field destruction over to use the new destroyer-based API
and kill a lot of redundant code.

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

13 years agoImprove name mangling for instantiation-dependent types that are not
Douglas Gregor [Tue, 12 Jul 2011 15:18:55 +0000 (15:18 +0000)]
Improve name mangling for instantiation-dependent types that are not
dependent. This covers an odd class of types such as

  int (&)[sizeof(sizeof(T() + T()))];

which involve template parameters but, because of some trick typically
involving a form of expression that is never type-dependent, resolve
down to a non-dependent type. Such types need to be mangled
essentially as they were written in the source code (involving
template parameters), rather than via their canonical type.

In general, instantiation-dependent types should be mangled as
they were written in the source. However, since we can't do that now
without non-trivial refactoring of the AST (see the new FIXME), I've
gone for this partial solution: only use the as-written-in-the-source
mangling for these strange types that are instantiation-dependent but
not dependent. This provides better compatibility with previous
incarnations of Clang and with GCC. In the future, we'd like to get
this right.

Fixes <rdar://problem/9663282>.

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

13 years agoPop block scope after reading from it.
Benjamin Kramer [Tue, 12 Jul 2011 14:11:05 +0000 (14:11 +0000)]
Pop block scope after reading from it.

Found by valgrind.

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

13 years agoSecond attempt at de-constifying LLVM Types in FunctionType::get(),
Jay Foad [Tue, 12 Jul 2011 14:06:48 +0000 (14:06 +0000)]
Second attempt at de-constifying LLVM Types in FunctionType::get(),
StructType::get() and TargetData::getIntPtrType().

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

13 years agoWork around a problem with a static helper's formulation in release
Chandler Carruth [Tue, 12 Jul 2011 08:58:26 +0000 (08:58 +0000)]
Work around a problem with a static helper's formulation in release
builds introduced in r134972:

lib/CodeGen/CGExpr.cpp:1294:7: error: no matching function for call to 'EmitBitCastOfLValueToProperType'
lib/CodeGen/CGExpr.cpp:1278:1: note: candidate function not viable: no known conversion from 'CGBuilderTy' (aka 'IRBuilder<false>') to 'llvm::IRBuilder<> &' for 1st argument

This fixes the issue by passing CodeGenFunction on down, and using its
builder directly rather than passing just the builder down.

This may not be the best / cleanest fix, Chris please review. It at
least fixes builds.

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

13 years agoFix typo correction crash on overloaded functions, pr10283.
Hans Wennborg [Tue, 12 Jul 2011 08:45:31 +0000 (08:45 +0000)]
Fix typo correction crash on overloaded functions, pr10283.

It would be cool if we could do overload resolution to suggest
the right function, but at least this fixes the crashing.

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

13 years agoImplement name mangling for sizeof...(function parameter pack).
Douglas Gregor [Tue, 12 Jul 2011 07:03:48 +0000 (07:03 +0000)]
Implement name mangling for sizeof...(function parameter pack).

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

13 years agoFix the desugaring of dependent decltype and typeof(expr) nodes. The
Douglas Gregor [Tue, 12 Jul 2011 06:55:29 +0000 (06:55 +0000)]
Fix the desugaring of dependent decltype and typeof(expr) nodes. The
isSugared() and desugar() routines previously provided were never
actually called, since the corresponding types
(DependentTypeOfExprType, DependentDecltypeType) don't have
corresponding type classes. Outside of the current (incomplete) patch
I'm working on, I haven't found a way to trigger this problem.

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

13 years agoFix a problem Eli ran into where we now reject incomplete arrays of
Chris Lattner [Tue, 12 Jul 2011 06:52:18 +0000 (06:52 +0000)]
Fix a problem Eli ran into where we now reject incomplete arrays of
uncompleted struct types.  We now do what llvm-gcc does and compile
them into [i8 x 0].  If the type is later completed, we make sure that
it is appropriately cast.

We compile the terrible example to something like this now:

%struct.A = type { i32, i32, i32 }

@g = external global [0 x i8]

define void @_Z1fv() nounwind {
entry:
  call void @_Z3fooP1A(%struct.A* bitcast ([0 x i8]* @g to %struct.A*))
  ret void
}

declare void @_Z3fooP1A(%struct.A*)

define %struct.A* @_Z2f2v() nounwind {
entry:
  ret %struct.A* getelementptr inbounds ([0 x %struct.A]* bitcast ([0 x i8]* @g to [0 x %struct.A]*), i32 0, i64 1)
}

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

13 years agoinsert a bitcast in the 'expand' case of argument passing when needed. This
Chris Lattner [Tue, 12 Jul 2011 06:29:11 +0000 (06:29 +0000)]
insert a bitcast in the 'expand' case of argument passing when needed.  This
fixes the -m32 build of oggenc.

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

13 years agofix an unintended behavior change in the type system rewrite, which caused us to...
Chris Lattner [Tue, 12 Jul 2011 05:53:08 +0000 (05:53 +0000)]
fix an unintended behavior change in the type system rewrite, which caused us to compile
stuff like this:

typedef struct {
 int x, y, z;
} foo_t;

foo_t g;

into:
%"struct.<anonymous>" = type { i32, i32, i32 }
we now get:
%struct.foo_t = type { i32, i32, i32 }

This doesn't change the behavior of the compiler, but makes the IR much easier to read.

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

13 years agoMangle dependent template names of unknown arity
Douglas Gregor [Tue, 12 Jul 2011 05:06:05 +0000 (05:06 +0000)]
Mangle dependent template names of unknown arity

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

13 years agofix PR10335 by watching out for IR type compatibility in call argument lists.
Chris Lattner [Tue, 12 Jul 2011 04:53:39 +0000 (04:53 +0000)]
fix PR10335 by watching out for IR type compatibility in call argument lists.

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

13 years agoMove OBJC_PR_NumBits out of PropertyAttributeKind enum, to its own NumPropertyAttrsBits.
Argyrios Kyrtzidis [Tue, 12 Jul 2011 04:52:08 +0000 (04:52 +0000)]
Move OBJC_PR_NumBits out of PropertyAttributeKind enum, to its own NumPropertyAttrsBits.
No functionality change.

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

13 years agomake test name less specific
Chris Lattner [Tue, 12 Jul 2011 04:51:05 +0000 (04:51 +0000)]
make test name less specific

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

13 years agoImplement the Itanium C++ ABI's mangling rule for
Douglas Gregor [Tue, 12 Jul 2011 04:47:20 +0000 (04:47 +0000)]
Implement the Itanium C++ ABI's mangling rule for
non-instantiation-dependent sizeof and alignof expressions.

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

13 years agoadd some aggressive assertions that call arguments match up to callee
Chris Lattner [Tue, 12 Jul 2011 04:46:18 +0000 (04:46 +0000)]
add some aggressive assertions that call arguments match up to callee
expectations in EmitCall.  Next patch will take this further.

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

13 years agoCentralize the getCanonicalType() calls in the Itanium C++ mangling
Douglas Gregor [Tue, 12 Jul 2011 04:42:08 +0000 (04:42 +0000)]
Centralize the getCanonicalType() calls in the Itanium C++ mangling
code so that they only occur in a single place. No functionality change.

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

13 years ago[ARC] Complain about property without storage attribute when @synthesizing it, not...
Argyrios Kyrtzidis [Tue, 12 Jul 2011 04:30:16 +0000 (04:30 +0000)]
[ARC] Complain about property without storage attribute when @synthesizing it, not at its declaration.

For this sample:

@interface Foo
@property id x;
@end

we get:

t.m:2:1: error: ARC forbids properties of Objective-C objects with unspecified storage attribute
@property  id x;
^
1 error generated.

The error should be imposed on the implementor of the interface, not the user. If the user uses
a header of a non-ARC library whose source code he does not have, we are basically asking him to
go change the header of the library (bad in general), possible overriding how the property is
implemented if he gets confused and says "Oh I'll just add 'copy' then" (even worse).

Second issue is that we don't emit any error for 'readonly' properties, e.g:

@interface Foo
@property (readonly) id x; // no error  here
@end

@implementation Foo
@synthesize x; // no error here too
@end

We should give an error when the implementor is @synthesizing a property which doesn't have
any storage specifier; this is when the explicit specifier is important, because we are
going to create an ivar and we want its ownership to be explicit.

Related improvements:
-OBJC_PR_unsafe_unretained turned out to not fit in ObjCPropertyDecl's bitfields, fix it.
-For properties of extension classes don't drop PropertyAttributesAsWritten values.
-Have PropertyAttributesAsWritten actually only reflect what the user wrote

rdar://9756610.

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

13 years agoFix a typo!
Bruno Cardoso Lopes [Tue, 12 Jul 2011 02:47:38 +0000 (02:47 +0000)]
Fix a typo!

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

13 years agoDo the same as r134946 for arrays. Add more testcases for avx x86_64 arg
Bruno Cardoso Lopes [Tue, 12 Jul 2011 01:27:38 +0000 (01:27 +0000)]
Do the same as r134946 for arrays. Add more testcases for avx x86_64 arg
passing.

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

13 years agoRevert r134888 (and related patches in other trees). It was causing
Bill Wendling [Tue, 12 Jul 2011 01:16:47 +0000 (01:16 +0000)]
Revert r134888 (and related patches in other trees). It was causing
an assert on Darwin llvm-gcc builds.

Assertion failed: (castIsValid(op, S, Ty) && "Invalid cast!"), function Create, file /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.llvm-gcc-i386-darwin9-RA/llvm.src/lib/VMCore/Instructions.cpp, line 2067.
etc.

http://smooshlab.apple.com:8013/builders/llvm-gcc-i386-darwin9-RA/builds/2354

--- Reverse-merging r134888 into '.':
U    lib/CodeGen/CodeGenModule.cpp

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

13 years agoFix one x86_64 abi issue and the test to actually look for the right thing,
Bruno Cardoso Lopes [Tue, 12 Jul 2011 00:30:27 +0000 (00:30 +0000)]
Fix one x86_64 abi issue and the test to actually look for the right thing,
which is: { <4 x float>, <4 x float> } should continue to go through memory.

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

13 years agoDo full-expression cleanups in a much more sensible way that still lets
John McCall [Tue, 12 Jul 2011 00:15:30 +0000 (00:15 +0000)]
Do full-expression cleanups in a much more sensible way that still lets
people write useful cleanup classes.

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

13 years agoDisable avx feature from corei7-avx, and use -mavx for now. Right now, if -mavx is
Bruno Cardoso Lopes [Mon, 11 Jul 2011 23:33:46 +0000 (23:33 +0000)]
Disable avx feature from corei7-avx, and use -mavx for now. Right now, if -mavx is
specified, 128 avx code is used and we're not sure yet if this the behavior
we want (and if it does, some improvements are needed before relying on it).

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

13 years agoStyle tweak to the more idiomatic 'assert(!bad_state())'.
Chandler Carruth [Mon, 11 Jul 2011 23:33:05 +0000 (23:33 +0000)]
Style tweak to the more idiomatic 'assert(!bad_state())'.

Patch by Caitlin Sadowski.

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

13 years agoHoist the logic for checking the number of arguments to an attribute
Chandler Carruth [Mon, 11 Jul 2011 23:30:35 +0000 (23:30 +0000)]
Hoist the logic for checking the number of arguments to an attribute
into a static helper.

Original patch by Caitlin Sadowski, style tweaks by me.

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

13 years agoEnable "avx" feature, so it can be seen by llvm
Bruno Cardoso Lopes [Mon, 11 Jul 2011 22:50:13 +0000 (22:50 +0000)]
Enable "avx" feature, so it can be seen by llvm

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

13 years agoReapply r134754, which turns out to be working correctly and also
Bruno Cardoso Lopes [Mon, 11 Jul 2011 22:41:29 +0000 (22:41 +0000)]
Reapply r134754, which turns out to be working correctly and also
add one more testcase.

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

13 years agoAllow us to compute linkage et al for instantiation-dependent types.
Douglas Gregor [Mon, 11 Jul 2011 22:38:07 +0000 (22:38 +0000)]
Allow us to compute linkage et al for instantiation-dependent types.

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

13 years agoRevert r134898, "test/Frontend/dependency-gen.c: Mark XFAIL: mingw due to PR10331...
NAKAMURA Takumi [Mon, 11 Jul 2011 22:34:14 +0000 (22:34 +0000)]
Revert r134898, "test/Frontend/dependency-gen.c: Mark XFAIL: mingw due to PR10331. to appease mingw-target (and non-mingw-host) builds.

PR10331 is still alive I suppose.

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

13 years agoReenable test.
Argyrios Kyrtzidis [Mon, 11 Jul 2011 21:58:47 +0000 (21:58 +0000)]
Reenable test.

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

13 years agoAdd missing header file for the test.
Argyrios Kyrtzidis [Mon, 11 Jul 2011 21:58:44 +0000 (21:58 +0000)]
Add missing header file for the test.

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

13 years agoAdd diagnostic for constructs like "va_arg(l, float)" which have undefined behavior...
Eli Friedman [Mon, 11 Jul 2011 21:45:59 +0000 (21:45 +0000)]
Add diagnostic for constructs like "va_arg(l, float)" which have undefined behavior. PR10201.

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

13 years agoTest is broken; XFAIL it until Argyrios gets a chance to look at it.
Eli Friedman [Mon, 11 Jul 2011 21:44:14 +0000 (21:44 +0000)]
Test is broken; XFAIL it until Argyrios gets a chance to look at it.

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

13 years agoDon't warn for unused macro when undef'ing it, if it comes from an included file...
Argyrios Kyrtzidis [Mon, 11 Jul 2011 20:39:47 +0000 (20:39 +0000)]
Don't warn for unused macro when undef'ing it, if it comes from an included file. rdar://9745065

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