Commit Graph

5549 Commits

Author SHA1 Message Date
John McCall 717d9b0e2f It's kindof silly that ExtQuals has an ASTContext&, and we can use that
space better.  Remove this reference.  To make that work, change some APIs
(most importantly, getDesugaredType()) to take an ASTContext& if they
need to return a QualType.  Simultaneously, diminish the need to return a
QualType by introducing some useful APIs on SplitQualType, which is
just a std::pair<const Type *, Qualifiers>.

llvm-svn: 121478
2010-12-10 11:01:00 +00:00
Douglas Gregor 21c0fc18bf Use TypeAlignment constant rather than fixed alignment of 8
llvm-svn: 121473
2010-12-10 08:12:03 +00:00
John McCall 2faf32c4fd Treat visibility on an enclosing namespace as a non-explicit source of
visibility.  Fixes PR8713.

I've disabled a test which was testing that you can #pragma pop visibility
to get out of a namespace's visibility attribute.  We should probably just
diagnose that as an error unless it's instrumental to someone's system
headers.

llvm-svn: 121459
2010-12-10 02:59:44 +00:00
John McCall 4f26cd8101 Bind the result of a property fetch to a temporary.
llvm-svn: 121452
2010-12-10 01:49:45 +00:00
Fariborz Jahanian 31d6d84f27 Refactored/cleanedup ActOnFunctionDeclarator
and ActOnVariableDeclarator
No functionality change. // rdar://8751949

llvm-svn: 121427
2010-12-09 23:11:32 +00:00
Douglas Gregor b888acf413 Eliminate duplicate code completions for properties.
llvm-svn: 121424
2010-12-09 23:01:55 +00:00
Douglas Gregor a3b23b025b Don't walk the translation unit context to produce protocol names when
global code completions are disabled (e.g., because they are
cached). Also, make sure that forward-declared protocols are visited
when we look for all visible names within a declaration context.

Previously, we would end up with duplicate completions for protocols.

llvm-svn: 121416
2010-12-09 21:44:02 +00:00
Francois Pichet dbafc19fe0 Fix PR8760: IndirectFieldDecl Type was not updated during template instantiation.
llvm-svn: 121363
2010-12-09 10:07:54 +00:00
Douglas Gregor aed2efbbb5 A typename specifier can end up referring to a unresolved using
declaration that is a value in ill-formed code. Instead of crashing,
treat this as a dependent typename specifier and suggest that the
using add "typename" into the using declaration. Fixes <rdar://problem/8740998>.

llvm-svn: 121322
2010-12-09 00:06:27 +00:00
Francois Pichet 34b2113250 Remove the TypesCompatibleExprClass AST node. Merge its functionality into BinaryTypeTraitExpr.
llvm-svn: 121298
2010-12-08 22:35:30 +00:00
John McCall ed75c09401 Bump up property conversion earlier in the initialization process. Fixes
the failed compile in PR8751.

llvm-svn: 121192
2010-12-07 22:54:16 +00:00
Rafael Espindola 0017c5fa92 Fix PR8720 by printing an error message with a substring that the gcc testsuite searches for.
llvm-svn: 121137
2010-12-07 15:23:23 +00:00
Jay Foad 6d4db0c885 PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() and
zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method
trunc(), to be const and to return a new value instead of modifying the
object in place.

llvm-svn: 121121
2010-12-07 08:25:34 +00:00
John McCall 6dd27195b9 Kill FullExpr, as it was not, in fact, used anywhere in the code base.
I'm not opposed to the idea in concept, but there's no point in preserving
abortive experiments.

llvm-svn: 121083
2010-12-07 00:47:33 +00:00
Douglas Gregor a40433a33a Use Sema::MaybeCreateExprWithCleanups() only after we've checked for a NULL/invalid expression
llvm-svn: 121081
2010-12-07 00:41:46 +00:00
Francois Pichet 9dfa3ce94f Type traits intrinsic implementation: __is_base_of(T, U)
New AST node introduced: BinaryTypeTraitExpr; to be reused for more intrinsics.

llvm-svn: 121074
2010-12-07 00:08:36 +00:00
Douglas Gregor c6bd1d32bf Objective-C pointer conversions to 'id' or qualified 'id' subsume
cv-qualification conversions. More specifically, there's an implicit
cv-qualification conversion (even one that drops qualifiers) when
converting to 'id' or qualified 'id'. Fixes <rdar://problem/8734046>.

llvm-svn: 121047
2010-12-06 22:09:19 +00:00
John McCall 2758424d23 Split out a function to do lvalue conversion on objects; this is basically
FunctionArrayLvalueConversion but without the function/array decay.  Generally
this is only appropriate for use sites that know the type of the expression
and thus that it can't be subject to the decays.

Also make sure we do lvalue-to-rvalue on the bases of ivar references.

llvm-svn: 121035
2010-12-06 20:48:59 +00:00
Argyrios Kyrtzidis 7ddcb80efe Remove a fixme which was fixed in a previous commit.
llvm-svn: 121029
2010-12-06 19:36:50 +00:00
John McCall 9bc2677b8c Do unary conversions on vararg arguments and *then* special-case float.
Fixes PR8742.

llvm-svn: 121022
2010-12-06 18:36:11 +00:00
Argyrios Kyrtzidis e88168ae6e Use Sema's MarkDeclarationReferenced, which takes care of templates, instead of calling Decl's setUsed directly.
Thanks to John for the hint!

llvm-svn: 121014
2010-12-06 17:51:53 +00:00
Argyrios Kyrtzidis 7b608976b1 Use the source location of the parameter, when it makes sense, for diagnostics in HandleCleanupAttr.
llvm-svn: 121013
2010-12-06 17:51:50 +00:00
Chandler Carruth d44c3105fb Un-templatetize this method. It's definition is out of line in the .cpp file,
so that's not a valid thing to do at all. Instead, switch to a ValueDecl
argument, the template isn't really necessary here.

When handling the types explicitly in the code, it becomes awkward to cerate
the CXXBaseOrMemberInitializer object in so many places. Re-flow the code to
calculate the Init expression first, and then create the initializer. If this
is too gross, we can factor the init expression logic into helper functions,
but it's not past my threshold yet.

llvm-svn: 120997
2010-12-06 09:23:57 +00:00
John McCall 5d41378146 Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoretical
reason this is limited to C++, and it's certainly not limited to temporaries.

llvm-svn: 120996
2010-12-06 08:20:24 +00:00
John McCall 622114cfe3 Clarify the logic for when to build an overloaded binop. In particular,
build one when either of the operands calls itself type-dependent;
previously we were building when one of the operand types was dependent,
which is not always the same thing and which can lead to unfortunate
inconsistencies later.  Fixes PR8739.

llvm-svn: 120990
2010-12-06 05:26:58 +00:00
John McCall ca61b6567b First pass at implementing the intent of ANSI C DR106.
llvm-svn: 120904
2010-12-04 12:29:11 +00:00
John McCall a03eddad58 dyn_cast else unreachable -> cast
llvm-svn: 120902
2010-12-04 09:57:16 +00:00
Francois Pichet d583da04d0 More anonymous struct/union redesign. This one deals with anonymous field used in a constructor initializer list:
struct X {
  X() : au_i1(123) {}
  union {
    int au_i1;
    float au_f1;
  };
};

clang will now deal with au_i1 explicitly as an IndirectFieldDecl.

llvm-svn: 120900
2010-12-04 09:14:42 +00:00
John McCall 211e699754 Don't crash when initializing a subaggregate in C from a property r-value.
llvm-svn: 120899
2010-12-04 09:03:57 +00:00
John McCall e26a872b02 Remove some defensive calls to EmitLoadOfPropertyRefLValue that shouldn't
be required, and then fix up some missing loads on overloaded-operator
paths which that exposed.

llvm-svn: 120896
2010-12-04 08:14:53 +00:00
John McCall 29cb2fdbc1 When deciding whether to complain about the type of a boolean condition, use
the type of the expression *after* array/function decay.

llvm-svn: 120895
2010-12-04 06:09:13 +00:00
John McCall 34376a68c4 Although we currently have explicit lvalue-to-rvalue conversions, they're
not actually frequently used, because ImpCastExprToType only creates a node
if the types differ.  So explicitly create an ICE in the lvalue-to-rvalue
conversion code in DefaultFunctionArrayLvalueConversion() as well as several
other new places, and consistently deal with the consequences throughout the
compiler.

In addition, introduce a new cast kind for loading an ObjCProperty l-value,
and make sure we emit those nodes whenever an ObjCProperty l-value appears
that's not on the LHS of an assignment operator.

This breaks a couple of rewriter tests, which I've x-failed until future
development occurs on the rewriter.

Ted Kremenek kindly contributed the analyzer workarounds in this patch.

llvm-svn: 120890
2010-12-04 03:47:34 +00:00
Peter Collingbourne 0b69e1a628 Implement -cl-single-precision-constant
llvm-svn: 120877
2010-12-04 01:50:56 +00:00
Argyrios Kyrtzidis 86a26b8e35 Mark functions referenced by 'cleanup' attribute as used. Fixes rdar://8728293
llvm-svn: 120872
2010-12-04 01:12:11 +00:00
Fariborz Jahanian ecbbb6e9ba Diagnose when accessing property in a class method and
no property accessor class method to be found, instead of
crashing in IRGen. // rdar://8703553

llvm-svn: 120855
2010-12-03 23:37:08 +00:00
Abramo Bagnara 21e9d860b5 Fixed typo.
llvm-svn: 120839
2010-12-03 21:39:42 +00:00
Abramo Bagnara 0e05e24e9c Added struct/class syntactic info for c++0x scoped enum.
llvm-svn: 120828
2010-12-03 18:54:17 +00:00
Eric Christopher 515d87ff95 Add some warning messages about invalid use of common/nocommon attributes.
llvm-svn: 120799
2010-12-03 06:58:14 +00:00
Douglas Gregor 6dd3a6a181 When we're performing an explicit cast of some sort, don't complain
about deprecated Objective-C pointer conversions. Plus, make sure to
actually set an appropriate AssignmentAction when performing an
implicit conversion from an InitializationSequence. Fixes regressions
in the GCC DejaGNU testsuite.

llvm-svn: 120744
2010-12-02 21:47:04 +00:00
Douglas Gregor 2da6670ef0 Do not change the size of LookupResult::Filter based on the NDEBUG
macri; the extra bool fits into padding anyway.

llvm-svn: 120708
2010-12-02 16:19:31 +00:00
Eric Christopher 8a2ee390be Add support for the common and nocommon attributes.
rdar://8560647

llvm-svn: 120650
2010-12-02 02:45:55 +00:00
John McCall fee942d150 Perform lvalue-to-rvalue at the end of an expression statement in C.
llvm-svn: 120646
2010-12-02 02:07:15 +00:00
John McCall b7bd14fa08 Simplify the ASTs by consolidating ObjCImplicitGetterSetterExpr and ObjCPropertyRefExpr
into the latter.

llvm-svn: 120643
2010-12-02 01:19:52 +00:00
Bob Wilson 01856f38c2 Swap order of checking for compatible vector types.
Check for compatible gcc, Altivec and Neon vectors before handling the
lax-vector-conversions case.  Otherwise there is no way to avoid the
warnings from -Wvector-conversions.

llvm-svn: 120633
2010-12-02 00:25:15 +00:00
Douglas Gregor 451d1b1d27 Make TypeLocBuilder an implementation detail of Sema. Nobody else should be using it
llvm-svn: 120628
2010-12-02 00:05:49 +00:00
Fariborz Jahanian 7cfe7679aa Sema/AST work for capturing copy init expression
to be used in copy helper synthesis of __block
variables. wip.

llvm-svn: 120617
2010-12-01 22:29:46 +00:00
Eric Christopher bc638a83e0 80-col fixups.
llvm-svn: 120613
2010-12-01 22:13:54 +00:00
Douglas Gregor 8d6d06761f Improve our handling of cv-qualifiers in Objective-C pointer
conversions. Previously, we would end up collapsing qualification
conversions into the Objective-C pointer conversion step, including
(possibly) stripping qualifiers that shouldn't be removed.

This generalizes BuildSimilarlyQualifiedPointerType() to also work on
Objective-C object pointers, then eliminates the (redundant, not
totally correct) BuildSimilarlyQualifiedObjCObjectPointerType()
function.

Fixes <rdar://problem/8714395>.

llvm-svn: 120607
2010-12-01 21:43:58 +00:00
Douglas Gregor 1a099ba4db Improve the diagnostic when the fixed underlying type of a
redeclaration of an enum type differs from that of the original
declaration, from Daniel Wallin

llvm-svn: 120577
2010-12-01 16:10:38 +00:00
John McCall f3735e01ce Restore the lvalue-to-rvalue conversion patch with a minimal fix.
llvm-svn: 120555
2010-12-01 04:43:34 +00:00