Commit Graph

23038 Commits

Author SHA1 Message Date
Chris Lattner da9e3287f9 another unneeded line.
llvm-svn: 104379
2010-05-21 21:02:17 +00:00
Chris Lattner 6fe3748de4 major update to the C++ status page. C++ support is
now done and no more patches to it will be accepted.

llvm-svn: 104378
2010-05-21 20:59:40 +00:00
John McCall b54367d2f8 Propagate access specifiers to anonymous union members nested within classes.
Fixes <rdar://problem/7987650>.

llvm-svn: 104376
2010-05-21 20:45:30 +00:00
Ted Kremenek 304a9537e1 Fix crash in CFG construction for 'break' statements appearing in statement expressions
within the increment code of a for loop.

llvm-svn: 104375
2010-05-21 20:30:15 +00:00
Douglas Gregor 27ac429624 Use CanQualType to enforce the use of a canonical type argument to
CXXBasePaths::isAmbiguous(), rather than just asserting that we have a
canonical type. Fixes PR7176.

llvm-svn: 104374
2010-05-21 20:29:55 +00:00
Chris Lattner c425fe4c80 don't make _Bool be a keyword in -fms-extensions mode, patch by
Steven Watanabe!

llvm-svn: 104373
2010-05-21 20:22:37 +00:00
Benjamin Kramer 71b0bb9922 Try to fix MSVC build.
llvm-svn: 104371
2010-05-21 19:58:44 +00:00
Douglas Gregor 3fe900e410 Don't remove the break/continue scope of a for loop until after we've
emitted the increment expression. Fixes PR7189.

If someone knows how to write a useful test for this, I'd be grateful. 

llvm-svn: 104335
2010-05-21 18:36:48 +00:00
Nick Lewycky 1a23f26832 TypeVisitor doesn't visit Stmts.
llvm-svn: 104332
2010-05-21 18:04:30 +00:00
Douglas Gregor c5871f07f0 When generating the call arguments in a thunk to call the thunkee, do
not make copies non-POD arguments or arguments passed by reference:
just copy the pointers directly. This eliminates another source of the
dreaded memcpy-of-non-PODs. Fixes PR7188.

llvm-svn: 104327
2010-05-21 17:55:12 +00:00
Fariborz Jahanian 6dc47ed396 Changed test to use FileCheck.
llvm-svn: 104319
2010-05-21 16:13:37 +00:00
Chandler Carruth 6bd3682f84 Teach the RecursiveASTVisitor to enter parts of the AST previously missed.
Factor its implementation to ease the addition of these custom edges to
traverse. With this patch we get initializer expressions, block bodies, type
source info, and function argument, result, and exception types. There are
probably still some more missed edges.

While we're here, clean up and flesh out a bunch of comments.

Patch by Zhanyong Wan; I've done a cursory review, but further review
appreciated. This is fast becoming one of the most important public APIs to the
AST.

llvm-svn: 104315
2010-05-21 10:29:57 +00:00
Chandler Carruth 7ea01c3f8a Add braces to avoid an ambiguous else, fixing a GCC warning.
llvm-svn: 104314
2010-05-21 10:29:28 +00:00
John McCall 9d42f0f174 Allocate space in a block record for implicit references to the Objective C
'self' variable arising from uses of the 'super' keyword.  Also reorganize
some code so that BlockInfo (now CGBlockInfo) can be opaque outside of
CGBlocks.cpp.

Fixes rdar://problem/8010633.

llvm-svn: 104312
2010-05-21 04:11:14 +00:00
John McCall c4094935c0 When emitting an lvalue for an anonymous struct or union member during
class initialization, drill down through an arbitrary number of anonymous
records.

llvm-svn: 104310
2010-05-21 01:18:57 +00:00
John McCall 61925b03cc Introduce a method to get from an anonymous struct or union record declaration
to the associated object declaration.

llvm-svn: 104309
2010-05-21 01:17:40 +00:00
Douglas Gregor 04163186a7 When instantiating anonymous structs/unions within a function, make
sure that the anonymous struct/union record declaration gets
instantiated before the variable declaration, and that it and its
fields (recursively) get entries in the local instantiation map. Fixes
PR7088.

llvm-svn: 104305
2010-05-21 00:31:19 +00:00
Daniel Dunbar 95dff818e7 docs: Man page tweaks, to mention the integrated assembler and the
-integrated-as and -no-integrated-as options.

llvm-svn: 104304
2010-05-21 00:28:14 +00:00
Daniel Dunbar 6ac7d7d068 Fix __crashreport_info__ declaration.
llvm-svn: 104301
2010-05-20 23:50:23 +00:00
Douglas Gregor aabdfcb29e Fix a crasher in constructor-initializer reordering warnings (PR7179).
llvm-svn: 104299
2010-05-20 23:49:34 +00:00
Chris Lattner c13a9e7382 make -Wc++-hex-floats be a member of -Wc++0x-compat,
thanks to doug for pointing this out!

llvm-svn: 104297
2010-05-20 23:43:05 +00:00
Fariborz Jahanian 2792f30f13 Generate objc_memmove_collectable write-barrier for
classes whose base class have GC'able object pointers.

llvm-svn: 104296
2010-05-20 23:34:56 +00:00
Chris Lattner fd8fb3c4cd Don't warn about use of hex floats in c++ mode by default,
matching G++'s behavior.

Warn when -pedantic or -Wc++-hex-floats is passed, and
don't warn if -pedantic -Wno-c++-hex-floats are both passed.

llvm-svn: 104295
2010-05-20 23:33:51 +00:00
John McCall bc83b3f011 Be sure to apply initializers to members of anonymous structs and unions
recursively, e.g. so that members of anonymous unions inside anonymous structs
still get initialized.  Also generate default constructor calls for anonymous
struct members when necessary.

llvm-svn: 104292
2010-05-20 23:23:51 +00:00
Douglas Gregor 4abc32d033 Improve parser recovery when a switch condition is invalid; fixes
<rdar://problem/7971948>.

llvm-svn: 104291
2010-05-20 23:20:59 +00:00
Douglas Gregor 3f4f03a235 Add a new failure kind, FK_Incomplete, to InitializationSequence, to
capture failures when we try to initialize an incomplete
type. Previously, we would (ab)use FK_ConversionFailed, then
occasionally dereference a null pointer when trying to diagnose the
failure. Fixes <rdar://problem/7959007>.

llvm-svn: 104286
2010-05-20 22:12:02 +00:00
Daniel Dunbar 6232d347bc Driver: Switch to using the integrated assembler for standalone assembly jobs
(or -save-temps), when the integrated assembler is enabled.

llvm-svn: 104282
2010-05-20 21:48:38 +00:00
Fariborz Jahanian 60d215b6fd Adds support for generation of objc_memmove_collectable API
in Objective-C++ mode.

llvm-svn: 104281
2010-05-20 21:38:57 +00:00
Daniel Dunbar 4f5e79c67d Driver: Add a tool definition for the Clang integrated assembler.
llvm-svn: 104280
2010-05-20 21:30:13 +00:00
Douglas Gregor 3e51e173b6 Reinstate r104117, Chandler Carruth's change that "[provides] a naming
class for UnresolvedLookupExprs, even when occuring on template
names" along with a fix for an Objective-C++ crasher it introduced.

llvm-svn: 104277
2010-05-20 20:58:56 +00:00
Fariborz Jahanian c21ba96566 More Objective-C++ GC tests.
llvm-svn: 104253
2010-05-20 18:22:28 +00:00
Daniel Dunbar 0454f657ce clang -cc1as: Add -help, -version, and -mllvm support.
Also, fix output defaulting to match llvm-mc.

llvm-svn: 104246
2010-05-20 18:15:20 +00:00
Daniel Dunbar 2fcaa549a8 Driver/MC: Add 'clang -cc1as' integrated assembler tool, currently accepts approximately the same interface as 'llvm-mc'.
llvm-svn: 104239
2010-05-20 17:49:16 +00:00
Daniel Dunbar 3730048129 Driver: Move some argument lookup utilities into driver::ArgList.
llvm-svn: 104237
2010-05-20 16:54:55 +00:00
Fariborz Jahanian 6855ba2c95 Copy construction of non-trivial properties must not
be turned into a setter call (fixes radar 8008649).

llvm-svn: 104235
2010-05-20 16:46:55 +00:00
Douglas Gregor 265b8b8de0 Picky, picky
llvm-svn: 104230
2010-05-20 15:48:29 +00:00
Douglas Gregor c19108118d Fix a thinko
llvm-svn: 104229
2010-05-20 15:47:46 +00:00
Douglas Gregor f22101a059 Assert that we do not try to memcpy a non-POD class type in C++. This
particular issue was the cause of the Boost.Interprocess failures, and
in general will lead to horrendous, hard-to-diagnose miscompiles. The
assertion itself has survives self-host and a full Boost build, so we
are close to eradicating this problem in C++.

Note that the assertion is *not* turned on for Objective-C++, where we
still have problems with introducing memcpy's of non-POD class
types. That part of the assertion will go away as soon as we fix the
known issues in Objective-C++.

llvm-svn: 104227
2010-05-20 15:39:01 +00:00
Abramo Bagnara 02ccd28a92 Added TemplateArgumentListInfo to FunctionTemplateSpecializationInfo.
llvm-svn: 104226
2010-05-20 15:32:11 +00:00
David Chisnall 29cefd1cc3 Fix my inability to spell 'continue' and a case where message sends returning non-pointer-sized things were generating invalid IR inside @try blocks.
llvm-svn: 104222
2010-05-20 13:45:48 +00:00
Abramo Bagnara 1108e7b873 Renamed misleading getSourceRange -> getLocalSourceRange and getFullSourceRange -> getSourceRange for TypeLoc.
llvm-svn: 104220
2010-05-20 10:00:11 +00:00
Douglas Gregor 7c38f153ac Rework our handling of binding a reference to a temporary
subobject. Previously, we could only properly bind to a base class
subobject while extending the lifetime of the complete object (of a
derived type); for non-static data member subobjects, we could memcpy
(!) the result and bind to that, which is rather broken.

Now, we pull apart the expression that we're binding to, to figure out
which subobject we're accessing, then construct the temporary object
(adding a destruction if needed) and, finally, dig out the subobject
we actually meant to access.

This fixes yet another instance where we were memcpy'ing rather than
doing the right thing. However, note the FIXME in references.cpp:
there's more work to be done for binding to subobjects, since the AST
is incorrectly modeling some member accesses in base classes as
lvalues when they are really rvalues.

llvm-svn: 104219
2010-05-20 08:36:28 +00:00
John McCall 58efb8e2bb Whoops.
llvm-svn: 104218
2010-05-20 07:13:26 +00:00
John McCall deb5e728ae Don't try to check jump scopes in invalid functions. Fixes
<rdar://problem/7995494>.

llvm-svn: 104217
2010-05-20 07:05:55 +00:00
Douglas Gregor aa2ac80eaa When creating a this-adjustment thunk where the return value is of C++
class type (that uses a return slot), pass the return slot to the
callee directly rather than allocating new storage and trying to copy
the object. This appears to have been the cause of the remaining two
Boost.Interprocess failures.

llvm-svn: 104215
2010-05-20 05:54:35 +00:00
Ted Kremenek 76a434840a Add libclang function 'clang_isFromMainFile()' (which just wraps SourceManager::isFromMainFile()).
llvm-svn: 104208
2010-05-20 02:59:19 +00:00
Douglas Gregor fe60c14263 Remove accidental commit
llvm-svn: 104207
2010-05-20 02:26:51 +00:00
Douglas Gregor 527786ea3a Various small fixes for construction/destruction of Objective-C++
instance variables:
  - Use isRecordType() rather than isa<RecordType>(), so that we see
  through typedefs in ivar types.
  - Mark the destructor as referenced
  - Perform C++ access control on the destructor

llvm-svn: 104206
2010-05-20 02:24:22 +00:00
Ted Kremenek bd7b3ccbf8 Expose -fobjc-nonfragile-abi2 as a top-level clang driver option. Fixes <rdar://problem/8007063>.
llvm-svn: 104205
2010-05-20 02:12:37 +00:00
John McCall 87fe5d5618 Support implicitly closing on 'this' in a block. Fixed PR7165.
(the codegen works here, too, but that's annoying to test without execution)

llvm-svn: 104202
2010-05-20 01:18:31 +00:00
Chris Lattner 8ca2fd2e93 just add a fixme for the StructuredArgs leak, it shouldn't affect
c++'03 code and variadic support "needs work".

llvm-svn: 104195
2010-05-20 00:26:28 +00:00
Chris Lattner 047f5aa007 switch TemplateArgumentListBuilder to hold its flat argument list in a smallvector
instead of new[]'d.  This greatly reduces the number of new[]'s, and guess what, 
they were all leaked.

This adds a fixme in this hunk:

   unsigned NumPackArgs = NumFlatArgs - PackBeginIndex;
+  // FIXME: NumPackArgs shouldn't be negative here???
   if (NumPackArgs)
-    PackArgs = &FlatArgs[PackBeginIndex];
+    PackArgs = FlatArgs.data()+PackBeginIndex;

where test/SemaTemplate/variadic-class-template-2.cpp is accessing the vector
out of range and NumPackArgs is negative.  I assume variadic template args are
completely hosed.

llvm-svn: 104194
2010-05-20 00:25:36 +00:00
Chris Lattner ce7a22d97c fix the TemplateArgumentList copy constructor to not
be a copy constructor (since it isn't one semantically)
and fix the ownership bits it sets to be correct!

llvm-svn: 104192
2010-05-20 00:19:09 +00:00
Chris Lattner c9b03bcc5d Clarify TemplateArgumentList ownership over its "flat" and
"structure" arg lists, the first step to fixing some massive
memory leaks.

llvm-svn: 104191
2010-05-20 00:11:47 +00:00
Jim Grosbach db061516be tweak to (hopefully) fix darwin[89] buildbots. Thanks to Doug for the suggested modification.
llvm-svn: 104188
2010-05-19 23:53:08 +00:00
Douglas Gregor fa6010b6e4 When a conditional operator is an rvalue of class type, we need to
create a temporary copy of both the "true" and "false" results. Fixes
the Boost.Interprocess failures.

Daniel did all the hard work of tracking down the issue, I get to type
up the trivial fix for this horrible miscompile.

llvm-svn: 104184
2010-05-19 23:40:50 +00:00
Fariborz Jahanian e150539100 More tests for ObjC++ GC support.
llvm-svn: 104176
2010-05-19 23:07:54 +00:00
Ted Kremenek 08de5c1418 Move CXCursor_FirstDecl definition later to make the results more readable in the debugger.
llvm-svn: 104171
2010-05-19 21:51:10 +00:00
Abramo Bagnara d754848f10 Added basic source locations to Elaborated and DependentName types.
llvm-svn: 104169
2010-05-19 21:37:53 +00:00
Fariborz Jahanian f633ebd961 Adds support for ObjC++'s GC attribute on declaration of
object variables and functions returning such objects.

llvm-svn: 104168
2010-05-19 21:37:30 +00:00
Daniel Dunbar fd5ed84873 Revert r104117, "Provide a naming class for UnresolvedLookupExprs, even when
occuring on..." which breaks some Objective-C code. Working on getting a test
case...

llvm-svn: 104150
2010-05-19 21:07:14 +00:00
Douglas Gregor 0e0f67ec95 Fill in some silly defaults to silence a GCC warning
llvm-svn: 104140
2010-05-19 18:41:43 +00:00
Douglas Gregor a72a4e3229 Cache the linkage of a type within its canonical type, eliminating
some seriously non-linear performance with deeply nested template
instantiations, as shown in PR6998.

llvm-svn: 104139
2010-05-19 18:39:18 +00:00
Ted Kremenek 84d2bd759f Remove clang_isDeclarationADefinition() since its functionality is already provided by clang_isCursorDefinition().
llvm-svn: 104138
2010-05-19 18:36:55 +00:00
Ted Kremenek 26bde774df Add clang support for IBOutletCollection.
llvm-svn: 104135
2010-05-19 17:38:06 +00:00
Douglas Gregor 6044d691bb Revert r104106; it's breaking linking of Boost.Serialization.
llvm-svn: 104121
2010-05-19 17:02:24 +00:00
Benjamin Kramer fdb61d78e9 Implement codegen for __builtin_isnormal.
llvm-svn: 104118
2010-05-19 11:24:26 +00:00
Chandler Carruth 8fd2b8935e Provide a naming class for UnresolvedLookupExprs, even when occuring on
template names. We were completely missing naming classes for many unqualified
lookups, but this didn't trigger code paths that need it. This removes part of
an optimization that re-uses the template name lookup done by the parser to
determine if explicit template arguments actually form a template-id.
Unfortunately the technique for avoiding the duplicate lookup lost needed data
such as the class context in which the lookup succeeded.

llvm-svn: 104117
2010-05-19 09:39:06 +00:00
Douglas Gregor e9ceb31405 Profile type-dependent uses of overloaded operators in C++ the same
way regardless of whether some overloaded operator functions were
found by name lookup within the template. Fixes PR6851.

llvm-svn: 104107
2010-05-19 04:13:23 +00:00
Douglas Gregor 21553f5970 Teach clang to instantiate attributes on more declarations. Fixes PR7102.
llvm-svn: 104106
2010-05-19 03:39:53 +00:00
Douglas Gregor cbfbca14d0 Implement C++ builtin operator candidates for vector types.
llvm-svn: 104105
2010-05-19 03:21:00 +00:00
Chandler Carruth 425cec3e33 Fix a GCC warning about inline functions not being defined. Until r104081, only
the same .cpp file as provided the definitions referenced these functions,
hiding the issue. However, they are clearly no longer inline. Let me know if
there is a reason to move their definitions to the header and make them truly
inline.

llvm-svn: 104104
2010-05-19 02:12:56 +00:00
Chandler Carruth eba788efa6 Fix an obvious goof that rjmccall found by inspection. No testcase, suggestions
welcome for one.

llvm-svn: 104101
2010-05-19 01:37:01 +00:00
Douglas Gregor bd130a2962 Basic test for user-defined conversions involving vector types
llvm-svn: 104085
2010-05-18 23:05:44 +00:00
Fariborz Jahanian 9f963c2488 Misc. fixes to bring Objetive-C++'s handling of
gc attributes to be inline with Objective-C
(for radar 7925141).

llvm-svn: 104084
2010-05-18 23:04:17 +00:00
Douglas Gregor bdb604a806 Protect isIntegerConstantExpr from seeing type- or value-dependent
expressions in attributes, pragmas.

llvm-svn: 104083
2010-05-18 23:01:22 +00:00
Douglas Gregor 4618868a7d Implement C++ support for vector and extended vector types. This
involves extending implicit conversion sequences to model vector
conversions and vector splats, along with teaching the C++ conditional
operator-checking code about vector types.

Fixes <rdar://problem/7983501>.

llvm-svn: 104081
2010-05-18 22:42:18 +00:00
Ted Kremenek a10f12829f Add function 'clang_isTagDeclDefinition()' to allow clients of libclang to distinguish between
forward declarations and definitions of structs/classes/enums.

llvm-svn: 104075
2010-05-18 22:32:15 +00:00
Ted Kremenek 49be9e0819 Teach CursorVisitor about duplicate ObjCPropertyDecls that can arise because of a current
design limitation in how we handle Objective-C class extensions.  This was causing the CursorVisitor
to essentially visit an @property twice (once in the @interface, the other in the class extension).
Fixes <rdar://problem/7410145>.

llvm-svn: 104055
2010-05-18 21:09:07 +00:00
Fariborz Jahanian 87b915a9bc These test now run in objective-c++ mode we well.
llvm-svn: 104041
2010-05-18 18:24:06 +00:00
Douglas Gregor 162b419a02 Add missing test case, provided by Steven Watanabe.
llvm-svn: 104037
2010-05-18 17:43:51 +00:00
Douglas Gregor 8b6be164d6 Fix typo test case
llvm-svn: 104027
2010-05-18 16:57:36 +00:00
Douglas Gregor a941dcae16 Add support for Microsoft's __thiscall, from Steven Watanabe!
llvm-svn: 104026
2010-05-18 16:57:00 +00:00
Anders Carlsson be48c548c5 Correctly initialize bases with member pointers. This should fix PR6441 but that test case is a bit weird and I'd like to investigate further before closing that bug.
llvm-svn: 104025
2010-05-18 16:51:41 +00:00
Douglas Gregor 86ad085b40 Give a slight edge to the context-sensitive keyword 'super' over
non-function-local declarations with names similar to what the user
typed. For example, this allows us to correct 'supper' to 'super' in
an Objective-C message send, even though the C function 'isupper' has
the same edit distance.

llvm-svn: 104023
2010-05-18 16:30:22 +00:00
Douglas Gregor 5fd04d4832 Tweak typo-correction logic a bit regarding "super", so that we
consider "super" as a candidate whenever we're parsing an expression
within an Objective-C method in an interface that has a superclass. At
some point, we'd like to give "super" a little edge over non-local
names; that will come later.

llvm-svn: 104022
2010-05-18 16:14:23 +00:00
John McCall 0e704f7fcd Permit Objective C object pointers to be const_casted.
llvm-svn: 104019
2010-05-18 09:35:29 +00:00
Alexis Hunt abb2ac8889 Switch over the tablegen to use much prettier range technology
Also rename ABSTRACT to ABSTRACT_STMT, in keeping with the other .def
files

llvm-svn: 104017
2010-05-18 06:22:21 +00:00
Douglas Gregor 923d2252dc "The attached patch allows clang to find the headers
for Visual Studio 2010.  It also adds a registry search
for the Express edition,", from Steven Watanabe!

llvm-svn: 104015
2010-05-18 05:47:04 +00:00
Douglas Gregor b92ea59481 I hate this commit.
Revert much of the implementation of C++98/03 [temp.friend]p5 in
r103943 and its follow-ons r103948 and r103952. While our
implementation was technically correct, other compilers don't seem to
implement this paragraph (which forces the instantiation of friend
functions defined in a class template when a class template
specialization is instantiated), and doing so broke a bunch of Boost
libraries. 

Since this behavior has changed in C++0x (which instantiates the
friend function definitions when they are used), we're going to skip
the nowhere-implemented C++98/03 semantics and go straight to the
C++0x semantics.

This commit is a band-aid to get Boost up and running again. It
doesn't really fix PR6952 (which this commit un-fixes), but it does
deal with the way Boost.Units abuses this particular paragraph.

llvm-svn: 104014
2010-05-18 05:45:02 +00:00
Anders Carlsson 061ca524b7 Keep track of the LLVM field numbers for non-virtual bases.
llvm-svn: 104013
2010-05-18 05:22:06 +00:00
Anders Carlsson af9e5afe54 Start laying out bases as individual fields. We still use ugly i8 arrays but this is a step in the right direction.
llvm-svn: 104012
2010-05-18 05:12:20 +00:00
Anders Carlsson 864d1b555e Add CodeGenTypes::ContainsPointerToDataMember overload that takes a CXXRecordDecl.
llvm-svn: 104011
2010-05-18 03:47:15 +00:00
John McCall d3dfbd6f4f If a switch condition is constant, don't warn about missing enum cases.
If a switch condition is constant, warn if there's no case for it.

Constant switch conditions do come up in reasonable template code.

llvm-svn: 104010
2010-05-18 03:19:21 +00:00
Zhongxing Xu b013b0bc04 Add option '-analyzer-max-loop', which specifies the maximum
number of times the analyzer will go through a loop.

llvm-svn: 104007
2010-05-18 00:28:37 +00:00
John McCall a9e6e8d654 Teach the ObjC mangler to ignore member pointers just like gcc does.
llvm-svn: 104001
2010-05-17 23:56:34 +00:00
Chandler Carruth 3b43338870 Add a hack to silence warnings about failing to return from functions after
a temporary with a noreturn destructor has been created. Fixes PR6884 for now.

llvm-svn: 104000
2010-05-17 23:51:52 +00:00
Douglas Gregor 96cdb1590e Instantiate attributes on typedefs. This is a quick fix for PR7148,
when we really need a proper audit of our handling of attributes in
templates.

llvm-svn: 103999
2010-05-17 23:46:49 +00:00
Nick Lewycky 47b92a2cc4 Add a 'Base' type to RecursiveASTVisitor to make recursing easier and document
how you're supposed to use it.

llvm-svn: 103993
2010-05-17 23:15:38 +00:00
Ted Kremenek 990783e345 Clean up test case and remove XFAIL. This test can now distinguish between
cases where Clang can suggest and fix and suggest and not auto-fix (because of
current limitations).

llvm-svn: 103987
2010-05-17 23:03:33 +00:00
John McCall 1b84d1106e Comments and assorted cleanups for the Objective C type AST.
llvm-svn: 103986
2010-05-17 23:00:45 +00:00
John McCall 96fa4845f7 Clean up some more uses of getAs<ObjCInterfaceType>() that Fariborz pointed
out.  The remaining ones are okay.

llvm-svn: 103973
2010-05-17 21:00:27 +00:00
Chandler Carruth 0450cc684c Fix an ambiguous else warning from GCC by adding some much needed curlies.
llvm-svn: 103972
2010-05-17 20:58:49 +00:00
Chris Lattner 467f6bcfe5 robustify the conflict marker stuff. Don't add 7 twice, which would
make it miss (invalid) things like:
<<<<<<<
>>>>>>>

and crash if 

<<<<<<< 

was at the end of the line.  When we find a >>>>>>> that is not at the
end of the line, make sure to reset Pos so we don't crash on something
like:
<<<<<<< >>>>>>>

This isn't worth making testcases for, since each would require a new file.

rdar://7987078 - signal 11 compiling "<<<<<<<<<<"

llvm-svn: 103968
2010-05-17 20:27:25 +00:00
Ted Kremenek 0ed7549343 Fix missing '}'.
llvm-svn: 103966
2010-05-17 20:12:45 +00:00
John McCall 3e294929b8 Correctly generate IR for ObjC messages sends to protocol-qualified types.
Fixes rdar://problem/7992749

llvm-svn: 103965
2010-05-17 20:12:43 +00:00
Ted Kremenek 9cfe9e6a4a Add libclang function 'clang_CXXMethod_isStatic' to query of a C++ method
is declared static.

llvm-svn: 103963
2010-05-17 20:06:56 +00:00
Douglas Gregor c4c574bd2e Test that mutability of class members that involve class definitions actually works
llvm-svn: 103959
2010-05-17 19:45:25 +00:00
Douglas Gregor 3b05bdba5a Teach ASTContext::getUnqualifiedArrayType() how to look through
typedefs. As a drive-by, teach hit how to build VLA types, since those
will eventually be supported in C++.

llvm-svn: 103958
2010-05-17 18:45:21 +00:00
Douglas Gregor c9a99c5e5c mutable is a storage class that can follow a class/struct/union definition. Fixes PR7153
llvm-svn: 103954
2010-05-17 18:19:56 +00:00
Fariborz Jahanian 16f94c6e8f Don't attempt to poke into an invalid field's class type
to mark its destructors as referenced which may cause 
a crash. Fixes radar 7896920

llvm-svn: 103953
2010-05-17 18:15:18 +00:00
Douglas Gregor fd7224fee0 Diagnose a redefinition error when there are two instantiations of friend
functions defined inside a class template. Fixes PR6952, the last
Boost.Units failure.

llvm-svn: 103952
2010-05-17 17:57:54 +00:00
Douglas Gregor 69f6a365d3 Determine when the instantiation of a friend function defined inside a
class template conflicts with an existing (non-template)
definition. This is another part of PR6952.

llvm-svn: 103948
2010-05-17 17:34:56 +00:00
Daniel Dunbar f7a8825484 IRgen: Remove dead function.
llvm-svn: 103945
2010-05-17 16:46:02 +00:00
Daniel Dunbar cd20ce1513 C++/Darwin/i386 ABI: Fix some problems with empty record handling.
- Check bases as part of isEmptyRecord().

 - C++ record fields are never empty in the Itanium ABI.

llvm-svn: 103944
2010-05-17 16:46:00 +00:00
Douglas Gregor 1cd6ea0b24 C++98/03 [temp.friend]p4 requires that inline function definitions
within class templates be instantiated along with each class template
specialization, even if the functions are not used. Do so, as a baby
step toward PR6952.

llvm-svn: 103943
2010-05-17 16:38:00 +00:00
Douglas Gregor 9154b5dffe Ensure that destructors are called for NRVO'd objects when the
function does not return. Thanks to Eli for pointing out this corner
case.

llvm-svn: 103941
2010-05-17 15:52:46 +00:00
David Chisnall f9c4225af6 Pick the correct personality function based on the language. This prevents link failures when C/ObjC code uses __attribute__((cleanup())) (previously this was inserting references to two libstc++ symbols; the personality function and the __terminate() function).
This is still probably wrong for Objective-C++ and adds a couple of lines in CGException that should probably be in the CGObjCRuntime subclass.  The personality function is now only looked up in one place in CGException though, so this should be easier to fix in the future.

llvm-svn: 103938
2010-05-17 13:49:20 +00:00
Eli Friedman b41ad0fbea PR7117: Make sure we don't lose the calling convention for K&R-style
definitions.
 

llvm-svn: 103932
2010-05-17 02:50:18 +00:00
Chris Lattner 561aabd943 when code completing inside a C-style block comment, don't emit errors about
a missing */ since we truncated the file.

This fixes rdar://7948776

llvm-svn: 103913
2010-05-16 19:54:05 +00:00
mike-m c6da261fb4 Moved clang-builtin include dir position to immediately precede C includes.
This aligns with how gcc compiler does things.

llvm-svn: 103912
2010-05-16 19:03:52 +00:00
Anders Carlsson e6ae81b0a2 Correctly diagnose array 'new' with initialization arguments when the new type is a typedef to an array type.
llvm-svn: 103909
2010-05-16 16:24:20 +00:00
Douglas Gregor cda95f47e5 When the type-id or new-type-id of a C++ "new" expression is a typedef
of an array type, use the outermost array bound as the number of
elements to allocate. Fixes PR7147.

llvm-svn: 103908
2010-05-16 16:01:03 +00:00
John McCall 5c6ec8c797 Don't emit any fallthrough / missing-noreturn warnings if we can't
compute a CFG for a function.

llvm-svn: 103905
2010-05-16 09:34:11 +00:00
Chandler Carruth e299ba66f5 When constant folding reference variables with an initializer to the
initializer, don't fold paramters. Their initializers are just default
arguments which can be overridden. This fixes some spectacular regressions due
to more things making it into the constant folding.

llvm-svn: 103904
2010-05-16 09:32:51 +00:00
Chris Lattner fc1e1c649f really use valist.
llvm-svn: 103900
2010-05-16 05:00:34 +00:00
Chris Lattner bb53efb016 fix rdar://7985267 - Don't emit an error about a non-pod argument
passed to va_start, it doesn't actually pass it.

llvm-svn: 103899
2010-05-16 04:01:30 +00:00
John McCall 94f619ac2b Emit a type record for TYPE_OBJC_OBJECT in the PCH file. I'm not
entirely sure what this does, to be honest.

llvm-svn: 103895
2010-05-16 02:12:35 +00:00
John McCall 7f0a3dfc01 Be sure to initialize the "has base type as written" field of an
ObjCObjectTypeLoc.  This should clear up some valgrind errors we've
been seeing.

llvm-svn: 103894
2010-05-16 02:12:01 +00:00
John McCall 3f435e6693 Avoid doing two switches in TypeLoc's initialize() loop. The optimizer
can probably do this for us, but it's actually somewhat nicer to write it
out here.

llvm-svn: 103893
2010-05-16 02:09:32 +00:00
Douglas Gregor 51150ab1f1 When initializing thread-safe statics, put the call to
__cxa_guard_abort along the exceptional edge into (in effect) a nested
"try" that rethrows after aborting. Fixes PR7144 and the remaining
Boost.ProgramOptions failures, along with the regressions that r103880
caused.

The crucial difference between this and r103880 is that we now follow
LLVM's little dance with the llvm.eh.exception and llvm.eh.selector
calls, then use _Unwind_Resume_or_Rethrow to rethrow.

llvm-svn: 103892
2010-05-16 01:24:12 +00:00
Douglas Gregor c278d1b3b9 Revert r103880 (thread-safe static initialization w/ exceptions),
because it's causing strange linker errors. Unfixes PR7144.

llvm-svn: 103890
2010-05-16 00:44:00 +00:00
Fariborz Jahanian 1b8b8bf25f Minor twik to my last patch. (for radar 7986354).
llvm-svn: 103889
2010-05-16 00:10:46 +00:00
Fariborz Jahanian e1b45a5e6b Fix API gen for objc_msgSend property of aggregate types
in Objective-c++ mode. Fixes radar 7986354.

llvm-svn: 103887
2010-05-15 23:05:52 +00:00
Douglas Gregor 58142dd8a1 When initializing thread-safe statics, put the call to
__cxa_guard_abort along the exceptional edge into (in effect) a nested
"try" that rethrows after aborting. Fixes PR7144 and the remaining
Boost.ProgramOptions failures.

llvm-svn: 103880
2010-05-15 17:55:51 +00:00
Douglas Gregor 4f0ed42601 Attempt to satisfy Release-Asserts build
llvm-svn: 103879
2010-05-15 17:28:53 +00:00
John McCall b0efad148c Modify this comment per Doug's suggestion: we don't need to mangle protocols.
llvm-svn: 103875
2010-05-15 17:06:29 +00:00
Chris Lattner 6459bbe14a sigh
llvm-svn: 103874
2010-05-15 16:56:34 +00:00
Chris Lattner 8b3b145342 fix _mm_shuffle_pd too, thanks to Joel Falcou for pointing this out.
llvm-svn: 103873
2010-05-15 16:54:46 +00:00
Douglas Gregor 170125648c When applying the named return value optimization, we still need to
destroy the variable along the exceptional edge; it's only during
normal execution that we avoid destroying this variable.

llvm-svn: 103872
2010-05-15 16:39:56 +00:00
John McCall 8b07ec253d Substantially alter the design of the Objective C type AST by introducing
ObjCObjectType, which is basically just a pair of
  one of {primitive-id, primitive-Class, user-defined @class}
with
  a list of protocols.
An ObjCObjectPointerType is therefore just a pointer which always points to
one of these types (possibly sugared).  ObjCInterfaceType is now just a kind
of ObjCObjectType which happens to not carry any protocols.

Alter a rather large number of use sites to use ObjCObjectType instead of
ObjCInterfaceType.  Store an ObjCInterfaceType as a pointer on the decl rather
than hashing them in a FoldingSet.  Remove some number of methods that are no
longer used, at least after this patch.

By simplifying ObjCObjectPointerType, we are now able to easily remove and apply
pointers to Objective-C types, which is crucial for a certain kind of ObjC++
metaprogramming common in WebKit.

llvm-svn: 103870
2010-05-15 11:32:37 +00:00
Douglas Gregor 290c93ec0d Implement a simple form of the C++ named return value optimization for
return statements. We perform NRVO only when all of the return
statements in the function return the same variable. Fixes some link
failures in Boost.Interprocess (which is relying on NRVO), and
probably improves performance for some C++ applications.

llvm-svn: 103867
2010-05-15 06:46:45 +00:00
Douglas Gregor 6fd1b1802f Implement semantic analysis and an AST representation for the named
return value optimization. Sema marks return statements with their
NRVO candidates (which may or may not end up using the NRVO), then, at
the end of a function body, computes and marks those variables that
can be allocated into the return slot.

I've checked this locally with some debugging statements (not
committed), but there won't be any tests until CodeGen comes along.

llvm-svn: 103865
2010-05-15 06:01:05 +00:00
Chris Lattner 6625c7028e add type casts to _mm_shuffle_ps so the front-end applies
implicit conversions where needed.  This fixes an error reported
on cfe-dev, not really worth a testcase though.

llvm-svn: 103864
2010-05-15 05:53:53 +00:00
Douglas Gregor 222cf0efbc Recognize when the named return value optimization applies in a
"return" statement and mark the corresponding CXXConstructExpr as
elidable. Teach CodeGen that eliding a temporary is different from
eliding an object construction.

This is just a baby step toward NRVO.

llvm-svn: 103849
2010-05-15 00:13:29 +00:00
Daniel Dunbar 36d4d1541c C++/ABI/x86_64: Member pointers should be classified as INTEGER.
llvm-svn: 103843
2010-05-15 00:00:37 +00:00
Daniel Dunbar 4bd95c65e7 C++/ABI/i386: Member function pointers should be passed by value.
llvm-svn: 103842
2010-05-15 00:00:30 +00:00
Ted Kremenek be4556f550 Change install_name for libclang.dylib to '@rpath/libclang.dylib'. Fixes <rdar://problem/7987039>.
llvm-svn: 103837
2010-05-14 23:50:33 +00:00
Daniel Dunbar 0d8ca9e91a Driver: Make -fverbose-asm the default for platforms where the integrated
assembler defaults to on.

llvm-svn: 103825
2010-05-14 22:00:22 +00:00
Douglas Gregor 2d15ecad39 Tweak test so that it does not require <typeinfo>
llvm-svn: 103819
2010-05-14 21:50:50 +00:00