Commit Graph

5177 Commits

Author SHA1 Message Date
Douglas Gregor e0b2866147 Implement template instantiation for using directives, which is dead simple.
Also, make the "don't know how to instantiate a particular kind of
declaration" diagnostic nicer, so we don't have to trap Clang in a
debugger to figure out what went wrong.

llvm-svn: 89050
2009-11-17 06:07:40 +00:00
Ted Kremenek 4c4d643b6e Have clang_getCursorSource() return NULL when the source location is invalid or refers to a built-in buffer. Implements <rdar://problem/7296243>.
llvm-svn: 89044
2009-11-17 05:31:58 +00:00
Douglas Gregor 3fad61786e Require the object type of a member access expression ("." or "->") to
be complete.

llvm-svn: 89042
2009-11-17 05:17:33 +00:00
Anders Carlsson dee9a30204 Unify the way destructor epilogues are generated for synthesized and regular destructors. Also fix PR5529.
llvm-svn: 89034
2009-11-17 04:44:12 +00:00
Mike Stump 8f5e6770e7 Add typeinfo support for T* and const T* for all builtin types T.
llvm-svn: 89030
2009-11-17 02:57:13 +00:00
Ted Kremenek 5b2592ed65 Add test to verify that the analyzer plist output is what we expect.
llvm-svn: 89029
2009-11-17 02:31:39 +00:00
Mike Stump 3f75d552a3 Add typeid for the builtin types. WIP.
llvm-svn: 89028
2009-11-17 02:16:21 +00:00
Jakob Stoklund Olesen 4359796e52 Fix tests after enabling -split-phi-edges.
object-size.c aws simply too fragile.

constructor-default-arg.cpp triggers an issue when LiveVariables is run before RALocal.

llvm-svn: 89025
2009-11-17 01:47:01 +00:00
Eli Friedman b0bc559b19 PR5526: Make sure to set the right cast kinds for the inserted implicit casts.
llvm-svn: 89023
2009-11-17 01:22:05 +00:00
Mike Stump c2c03349f3 Ensure we peer through () when handling typeid(*p).
llvm-svn: 89015
2009-11-17 00:45:21 +00:00
Ted Kremenek c40943224d Remove extra space in warn_maynot_respond diagnostic. Fixes <rdar://problem/7364274>.
llvm-svn: 89013
2009-11-17 00:35:14 +00:00
Mike Stump 8a5acf1440 Note why this doesn't yet work.
llvm-svn: 89012
2009-11-17 00:30:31 +00:00
Mike Stump 61232fd252 Trim spacing.
llvm-svn: 89006
2009-11-17 00:14:04 +00:00
Eli Friedman e85ef718d5 Fix up EmitMemberInitializer to handle many more cases.
llvm-svn: 88999
2009-11-16 23:53:01 +00:00
Mike Stump 82a1e6184a Testcase for dynamic_cast.
llvm-svn: 88996
2009-11-16 23:36:30 +00:00
Eli Friedman c1daba3ec8 Make member initializers for union members work correctly.
llvm-svn: 88989
2009-11-16 22:58:01 +00:00
Daniel Dunbar 5e1415156a Update test, I don't know why this changed but seems innocuous.
llvm-svn: 88983
2009-11-16 22:38:57 +00:00
Eli Friedman c2ef215bda Implement a few more cases for copy constructor synthesis.
llvm-svn: 88971
2009-11-16 21:47:41 +00:00
Sebastian Redl 658262fd26 Repair broken FindCompositePointerType. Correct early termination condition. Get CVR qualifiers from canonical types. Traverse collected qualifiers in reverse order on rebuilding the pointer, so that we don't swap inner and outer qualifiers. That last one fixes PR5509.
llvm-svn: 88960
2009-11-16 21:03:45 +00:00
Mike Stump 4cdedd9d44 Fix members to be public.
llvm-svn: 88944
2009-11-16 19:48:50 +00:00
Mike Stump 3d47c2b3c2 Make bots happy.
llvm-svn: 88941
2009-11-16 19:34:15 +00:00
Eli Friedman f2f534d12a Fix PR5488: special-case the overloaded arrow operator so that we don't try to
treat it as a unary operator.

llvm-svn: 88938
2009-11-16 19:13:03 +00:00
Fariborz Jahanian 9290ede494 Handle case of missing '@end' in implementation context
gracefully, on par with gcc, by: Issuing a warning,
doing final sematinc check of its definitions and generating
its meta-data.

llvm-svn: 88934
2009-11-16 18:57:01 +00:00
Mike Stump 6fa768df29 Fix spelling for target triplet.
llvm-svn: 88928
2009-11-16 18:06:39 +00:00
Ken Dyck 2dc8d5fa3e Parameterize the constant-generating macros in stdint.h with new built-in
__INTn_C_SUFFIX__ macros that are defined for types with corresponding
constant suffixes (i.e. long and long long).

llvm-svn: 88914
2009-11-16 16:36:33 +00:00
Mike Stump 266ee4a5b3 Try and fix buildbot issue.
llvm-svn: 88900
2009-11-16 06:49:10 +00:00
Eli Friedman e6ce354795 Fix a couple of cases where we weren't generating the right kind of call
for a call to a virtual function.

llvm-svn: 88891
2009-11-16 05:31:29 +00:00
Eli Friedman 011c4c341b Implement two-argument form of delete operator.
llvm-svn: 88890
2009-11-16 05:16:40 +00:00
Eli Friedman 794d4d8127 Fix test on Linux.
llvm-svn: 88889
2009-11-16 05:14:40 +00:00
Eli Friedman 141fbf3f36 Add constant evaluation for comma operator with floating-point operand. Fixes
PR5449.

llvm-svn: 88885
2009-11-16 04:25:37 +00:00
Anders Carlsson 7ade203c6c Deallocation functions must also be static.
llvm-svn: 88859
2009-11-15 19:08:46 +00:00
Anders Carlsson 623e9798df allocation functions are always static.
llvm-svn: 88858
2009-11-15 18:59:32 +00:00
Mike Stump a46efbb857 Fix linux buildbots.
llvm-svn: 88856
2009-11-15 17:57:00 +00:00
Mike Stump 1bf924b121 Finish off zero check for typeid(*p) so that it will do a __cxa_bad_typeid.
llvm-svn: 88852
2009-11-15 16:52:53 +00:00
Anders Carlsson 2c9e274e57 If we find a deallocation function in the class scope, but it is a placement function we should not look for a deallocation function in the global scope.
llvm-svn: 88851
2009-11-15 16:43:15 +00:00
Douglas Gregor 8f3952cda9 When performing a static downcast as part of a static_cast, make sure
that we're dealing with canonical types like the documentation say
(yay, CanQualType). Alas, this is another instance where using
getQualifiers() on a non-canonical QualType got us in trouble.

Good news: with this fix, Clang can now parse all of its own headers!

llvm-svn: 88848
2009-11-15 09:20:52 +00:00
Douglas Gregor 598caeee37 Don't gratuitously mark the default constructors of base or member initializers as used
llvm-svn: 88847
2009-11-15 08:51:10 +00:00
Douglas Gregor 54fdb417fe When adding the underlying declaration of a decl to a lookup-results
set, expand overloaded function declarations. Long-term, this should
actually be done by the name-lookup code rather than here, but this
part of the code (involving using declarations) is getting a makeover
now and the test-case is useful.

llvm-svn: 88846
2009-11-15 08:11:13 +00:00
Mike Stump c9b231c8d1 Implement typeid for class types.
llvm-svn: 88843
2009-11-15 08:09:41 +00:00
Douglas Gregor c473cbb3b2 When looking for operator() to type-check a call to an object of class
type, use full qualified name lookup rather than the poking the
declaration context directly. This makes sure that we see operator()'s
in superclasses. Also, move the complete-type check before this name
lookup.

llvm-svn: 88842
2009-11-15 07:48:03 +00:00
Mike Stump 4c808dfc58 Finish off support for typeinfo generation for classes.
llvm-svn: 88828
2009-11-15 03:28:10 +00:00
Daniel Dunbar e13ada6a3b Add clang -mcpu=native support, patch by Roman Divacky, varioustweaks by me.
- We still need support for detecting the target features, since the name
   doesn't actually do a good job of decribing what the CPU supports (for LLVM).

llvm-svn: 88819
2009-11-14 22:04:54 +00:00
Anders Carlsson 6d41727a95 Add an internal CreateRecordDecl that will create a CXXRecordDecl when compiling C++ and a RecordDecl otherwise.
llvm-svn: 88816
2009-11-14 21:45:58 +00:00
Anders Carlsson 461a2c0640 Always build a builtin operator expression for the __extension__ unary operator.
llvm-svn: 88811
2009-11-14 21:26:41 +00:00
Anders Carlsson 50cb321fdc Handle CK_BitCast in EmitCastLValue.
llvm-svn: 88810
2009-11-14 21:21:42 +00:00
Sebastian Redl 7c353685bc - Have TryStaticImplicitCast set the cast kind to NoOp when binding a reference. CheckReferenceInit already inserts implicit casts to the necessary types. This fixes an assertion in CodeGen for some casts and brings a fix for PR5453 close, if I understand that bug correctly.
- Also, perform calculated implicit cast sequences if they're determined to work. This finally diagnoses static_cast to ambiguous or implicit bases and fixes two long-standing fixmes in the test case. For the C-style cast, this requires propagating the access check suppression pretty deep into other functions.
- Pass the expressions for TryStaticCast and TryStaticImplicitCast by reference. This should lead to a better AST being emitted for such casts, and also fixes a memory leak, because CheckReferenceInit and PerformImplicitConversion wrap the node passed to them. These wrappers were previously lost.

llvm-svn: 88809
2009-11-14 21:15:49 +00:00
Anders Carlsson 0acee6e0d7 Canonicalize the type before trying to create a debug type.
llvm-svn: 88808
2009-11-14 21:08:12 +00:00
Daniel Dunbar cf5be70032 Improve test to make sure -fixit is really working.
llvm-svn: 88801
2009-11-14 19:25:21 +00:00
Eli Friedman 274ab904d0 Avoid assert-crash in a case where the expression passed to EmitConstantExpr
legitimately has side-effects (and needs to be generated as a non-constant).

llvm-svn: 88767
2009-11-14 08:51:33 +00:00
Eli Friedman b210fc598f Make __func__ and friends work correctly within the initializer for a static
local variable.

llvm-svn: 88766
2009-11-14 08:37:13 +00:00