Commit Graph

13169 Commits

Author SHA1 Message Date
Anders Carlsson 53cebd1ea6 Move code to apply a non-virtual and virtual offset out into a separate function.
llvm-svn: 101909
2010-04-20 16:03:35 +00:00
Douglas Gregor abd9e9689a Keep proper source location information for the type in an Objective-C
@encode expression. 

llvm-svn: 101907
2010-04-20 15:39:42 +00:00
Douglas Gregor ffed1cb339 Introduce a limit on the depth of the template instantiation backtrace
we will print with each error that occurs during template
instantiation. When the backtrace is longer than that, we will print
N/2 of the innermost backtrace entries and N/2 of the outermost
backtrace entries, then skip the middle entries with a note such as:

  note: suppressed 2 template instantiation contexts; use
  -ftemplate-backtrace-limit=N to change the number of template
  instantiation entries shown

This should eliminate some excessively long backtraces that aren't
providing any value.

llvm-svn: 101882
2010-04-20 07:18:24 +00:00
Chris Lattner 9cffdf1331 don't slap noalias attribute on stret result arguments.
This mirror's Dan's patch for llvm-gcc in r97989, and
fixes the miscompilation in PR6525.  There is some contention
over whether this is the right thing to do, but it is the
conservative answer and demonstrably fixes a miscompilation.

llvm-svn: 101877
2010-04-20 05:44:43 +00:00
Zhongxing Xu 23030c9004 Replace code with a method call. No functionality change.
llvm-svn: 101876
2010-04-20 05:40:40 +00:00
Anders Carlsson 652758c3ec Pass the nearest virtual base decl to InitializeVTablePointers. No functionality change right now.
llvm-svn: 101872
2010-04-20 05:22:15 +00:00
Chris Lattner b596ac718e reapply john's patch, he broke mainline again by changing the test.
llvm-svn: 101871
2010-04-20 05:19:10 +00:00
Anders Carlsson 3d4218570a Assert that the path from the derived to the base class in CodeGenFunction::GetAddressOfBaseClass is not ambiguous.
llvm-svn: 101869
2010-04-20 05:07:22 +00:00
Zhongxing Xu 4d4b8d833e Use GetState() to get the possible cleaned state.
llvm-svn: 101867
2010-04-20 04:53:09 +00:00
Chris Lattner 3da9a2a3a9 revert r101863, whcih is causing Sema/altivec-init.c to fail on a ton
of buildbots with:

error: 'error' diagnostics expected but not seen: 
  Line 9: too few elements in vector initialization (expected 8 elements, have 2)
1 warning and 1 error generated.

llvm-svn: 101864
2010-04-20 04:31:55 +00:00
John Thompson f351b2c2b4 Altivec vector literal initializer count mismatch error removed.
llvm-svn: 101863
2010-04-20 03:58:33 +00:00
Zhongxing Xu 40eb21a827 Improve handling of CXXNewExpr.
llvm-svn: 101862
2010-04-20 03:37:34 +00:00
John McCall 0f55a035cf Restore r101841 without modification. Also mark 'operator delete' as used for
actual delete expressions, not just new expressions.

llvm-svn: 101861
2010-04-20 02:18:25 +00:00
John McCall 44adf26dd0 Revert r101841 and follow-up.
llvm-svn: 101859
2010-04-20 01:42:53 +00:00
John McCall 75b4746e7d Don't bother looking for (or diagnosing problems with) the 'operator delete'
associated with a new expression if -fno-exceptions is set.

llvm-svn: 101841
2010-04-20 00:22:43 +00:00
Douglas Gregor dc35ef9279 Do not diagnose unused-parameter errors in template instantiations. We
will already have done so when the template is declared.

llvm-svn: 101838
2010-04-19 23:56:20 +00:00
Douglas Gregor c4df407604 Keep track of the actual storage specifier written on a variable or
function declaration, since it may end up being changed (e.g.,
"extern" can become "static" if a prior declaration was static). Patch
by Enea Zaffanella and Paolo Bolzoni.

llvm-svn: 101826
2010-04-19 22:54:31 +00:00
Douglas Gregor f4cd8f4ece Only suppress the "extern variable has an initializer" warning when the extern entity being initialized is const.
llvm-svn: 101821
2010-04-19 22:34:40 +00:00
Douglas Gregor c81ca09830 Disable the "'extern' variable has an initializer" warning in C++,
since it makes sense there to have const extern variables. Fixes
PR6495.

llvm-svn: 101818
2010-04-19 21:31:25 +00:00
Daniel Dunbar ccabe48235 AST: Dump ASTRecordLayout objects when they are created with -fdump-record-layouts.
llvm-svn: 101815
2010-04-19 20:44:53 +00:00
Daniel Dunbar 2ea5183b59 IRgen: Kill unused function and move the type match assert to after record dumping.
llvm-svn: 101814
2010-04-19 20:44:47 +00:00
Chris Lattner 72286d6129 add a PPCallback handler for a skipped #include, patch by
Zhanyong Wan!

llvm-svn: 101813
2010-04-19 20:44:31 +00:00
Douglas Gregor ca7136b9ac When normal name lookup to disambiguiate an Objective-C message send
fails to find anything,  perform ivar lookup and, if we find one,
consider this an instance message.

llvm-svn: 101810
2010-04-19 20:09:36 +00:00
Fariborz Jahanian fd34b0ac84 Check for darwin befoer cheking for version.
(related to radar 7866951).

llvm-svn: 101799
2010-04-19 18:38:31 +00:00
Eric Christopher 63448c3de2 Remove the argument number from the constant integer diagnostic.
Update all of the testcases accordingly.

llvm-svn: 101795
2010-04-19 18:23:02 +00:00
Fariborz Jahanian 4d55b2d049 Some renaming of methods, fixes typo
(related to PR6769).

llvm-svn: 101794
2010-04-19 18:15:02 +00:00
Douglas Gregor 0b59e80db5 When searching for code-completion and typo-correction candidates,
look from an Objective-C class or category to its implementation, to
pick up synthesized ivars. Fixes a problem reported by David
Chisnall.

llvm-svn: 101792
2010-04-19 18:02:19 +00:00
Fariborz Jahanian dfb3983525 Force clang to produce legacy api for messaging
in for pre-snowleoprd (NeXt runtime). Fixes
radar 7866951

llvm-svn: 101791
2010-04-19 17:53:30 +00:00
Rafael Espindola 47cf5b581a Add comment explaning the use of c99 inline in c++.
llvm-svn: 101787
2010-04-19 16:58:20 +00:00
Dan Gohman 145f3f1e83 Fix -Wcast-qual warnings.
llvm-svn: 101786
2010-04-19 16:39:44 +00:00
Zhongxing Xu 6a479bf281 Move all C++ expression evaluation logic into its own file.
llvm-svn: 101772
2010-04-19 12:51:02 +00:00
Zhongxing Xu b6843f5f35 Analyzer: add support for CXXNewExpr.
llvm-svn: 101771
2010-04-19 11:47:28 +00:00
David Chisnall 44ec555a87 Don't just emit ivar metadata - emit CORRECT ivar metadata. (GNU runtime)
llvm-svn: 101759
2010-04-19 01:37:25 +00:00
David Chisnall 18cf7378de Fix emitting ivar metadata for synthesized ivars and some 64-bit fixes. (GNU runtime)
llvm-svn: 101758
2010-04-19 00:45:34 +00:00
Rafael Espindola 683fe4fc4c If a method is virtual and the class key function is in another file, emit the method as available_externally.
Fixes PR6747

llvm-svn: 101757
2010-04-19 00:44:22 +00:00
Fariborz Jahanian 3fef72f0ba Local static variables must be available module-wise
as they are accessible in static methods in a class
local to the same function. Fixes PR6769.

llvm-svn: 101756
2010-04-18 21:01:23 +00:00
Nuno Lopes 247a138ec6 recommit r101568 to fix PR6766
as a side-effect, remove two FIXMEs now fixed

llvm-svn: 101726
2010-04-18 19:06:43 +00:00
Douglas Gregor 1da2225786 Make sure that we don't visit redeclarations of nested classes while
instantiating class members as part of an explicit
instantiation. Addresses a compilation problem in
Boost.Serialization.

llvm-svn: 101725
2010-04-18 18:11:38 +00:00
Douglas Gregor b74b1038bb C++ [namespace.memdef]p3 only applies when the friend is not named via
a qualified name. We weren't checking for an empty
nested-name-specifier when dealing with friend class templates
(although we were checking in the other places where we deal with this
paragraph). Fixes a Boost.Serialization showstopper.

llvm-svn: 101724
2010-04-18 17:37:40 +00:00
Benjamin Kramer 98ff7f8730 Bail out early to avoid comparing the internals of two conversion sequences of
different kinds (aka garbage). This happens if we're comparing a standard
conversion sequence to an ambiguous one which have the same KindRank.

Found by valgrind.

llvm-svn: 101717
2010-04-18 12:05:54 +00:00
Douglas Gregor 870f3743e4 When performing reference initialization for the purposes of overload
resolution ([over.ics.ref]), we take some shortcuts required by the
standard that effectively permit binding of a const volatile reference
to an rvalue. We have to treat lightly here to avoid infinite
recursion.

Fixes PR6177.

llvm-svn: 101712
2010-04-18 09:22:00 +00:00
Douglas Gregor f93df19496 Binding a reference to an rvalue is a direct binding in C++0x but not
in C++03.

llvm-svn: 101707
2010-04-18 08:46:23 +00:00
Chandler Carruth aad3007fe5 Fix the access checking of function and function template argument types,
return types, and default arguments. This fixes PR6855 along with several
similar cases where we rejected valid code.

llvm-svn: 101706
2010-04-18 08:23:21 +00:00
Douglas Gregor 30b5277a0a When checking the copy constructor for the optional copy during a
reference binding to an rvalue of reference-compatible type, check
parameters after the first for complete parameter types and build any
required default function arguments. We're effectively simulating the
type-checking for a call without building the call itself.

llvm-svn: 101705
2010-04-18 07:57:34 +00:00
Douglas Gregor c9cd64eee3 In C++98/03, when binding a reference to an rvalue of
reference-compatible type, the implementation is permitted to make a
copy of the rvalue (or many such copies, even). However, even though
we don't make that copy, we are required to check for the presence of
a suitable copy constructor. With this change, we do.

Note that in C++0x we are not allowed to make these copies, so we test
both dialects separately.

Also note the FIXME in one of the C++03 tests, where we are not
instantiating default function arguments for the copy constructor we
pick (but do not call). The fix is obvious; eliminating the infinite
recursion it causes is not. Will address that next.

llvm-svn: 101704
2010-04-18 07:40:54 +00:00
Ted Kremenek 36712b2ac1 Allow the 'ibaction' attribute to be attached to method declarations (and not issue a warning).
llvm-svn: 101699
2010-04-18 04:59:38 +00:00
Douglas Gregor 7566e4ad2c Do not consider explicit constructors when performing a copy to a
temporary object. This is blindingly obvious from reading C++
[over.match.ctor]p1, but somehow I'd missed it and it took DR152 to
educate me. Adjust one test that was relying on this non-standard
behavior.

llvm-svn: 101688
2010-04-18 02:16:12 +00:00
Anders Carlsson d5f27b0583 Simplify wide bit-field layout in CGRecordLayoutBuilder, and also fix a bug where assigning to a bit-field member would overwrite other parts of the struct.
llvm-svn: 101681
2010-04-17 22:54:57 +00:00
Douglas Gregor 5ab1165531 Improve our handling of user-defined conversions as part of overload
resolution. There are two sources of problems involving user-defined
conversions that this change eliminates, along with providing simpler
interfaces for checking implicit conversions:

  - It eliminates a case of infinite recursion found in Boost.

  - It eliminates the search for the constructor needed to copy a temporary
    generated by an implicit conversion from overload
    resolution. Overload resolution assumes that, if it gets a value
    of the parameter's class type (or a derived class thereof), there
    is a way to copy if... even if there isn't. We now model this
    properly.

llvm-svn: 101680
2010-04-17 22:01:05 +00:00
Anders Carlsson 8345a70c67 Fix an assert when assigning a boolean value to a bitfield of type _Bool.
llvm-svn: 101678
2010-04-17 21:52:22 +00:00