Граф коммитов

5549 Коммитов

Автор SHA1 Сообщение Дата
John McCall 49f4e1cbd8 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>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121478 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 11:01:00 +00:00
Douglas Gregor eb0eb49ce5 Use TypeAlignment constant rather than fixed alignment of 8
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121473 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 08:12:03 +00:00
John McCall 90f1450c10 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121459 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 02:59:44 +00:00
John McCall db67e2f5b8 Bind the result of a property fetch to a temporary.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121452 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 01:49:45 +00:00
Fariborz Jahanian bfe5788a00 Refactored/cleanedup ActOnFunctionDeclarator
and ActOnVariableDeclarator
No functionality change. // rdar://8751949


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121427 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09 23:11:32 +00:00
Douglas Gregor 7344921b22 Eliminate duplicate code completions for properties.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121424 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09 23:01:55 +00:00
Douglas Gregor 70c233591a 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121416 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09 21:44:02 +00:00
Francois Pichet 40e1775208 Fix PR8760: IndirectFieldDecl Type was not updated during template instantiation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121363 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09 10:07:54 +00:00
Douglas Gregor d95450421e 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>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121322 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09 00:06:27 +00:00
Francois Pichet f187237d91 Remove the TypesCompatibleExprClass AST node. Merge its functionality into BinaryTypeTraitExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121298 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-08 22:35:30 +00:00
John McCall 241d5580d2 Bump up property conversion earlier in the initialization process. Fixes
the failed compile in PR8751.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121192 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 22:54:16 +00:00
Rafael Espindola f5fe2925b8 Fix PR8720 by printing an error message with a substring that the gcc testsuite searches for.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121137 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 15:23:23 +00:00
Jay Foad 9f71a8f4c7 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121121 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 08:25:34 +00:00
John McCall 6f18fca241 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121083 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 00:47:33 +00:00
Douglas Gregor 53c374f1ac Use Sema::MaybeCreateExprWithCleanups() only after we've checked for a NULL/invalid expression
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121081 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 00:41:46 +00:00
Francois Pichet 6ad6f2848d Type traits intrinsic implementation: __is_base_of(T, U)
New AST node introduced: BinaryTypeTraitExpr; to be reused for more intrinsics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121074 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 00:08:36 +00:00
Douglas Gregor 143c7acef3 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>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121047 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 22:09:19 +00:00
John McCall 409fa9ab95 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121035 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 20:48:59 +00:00
Argyrios Kyrtzidis 7e112c0827 Remove a fixme which was fixed in a previous commit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121029 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 19:36:50 +00:00
John McCall 40c2913cef Do unary conversions on vararg arguments and *then* special-case float.
Fixes PR8742.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121022 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 18:36:11 +00:00
Argyrios Kyrtzidis 223ae5c266 Use Sema's MarkDeclarationReferenced, which takes care of templates, instead of calling Decl's setUsed directly.
Thanks to John for the hint!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121014 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 17:51:53 +00:00
Argyrios Kyrtzidis f0b0ccce12 Use the source location of the parameter, when it makes sense, for diagnostics in HandleCleanupAttr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121013 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 17:51:50 +00:00
Chandler Carruth 894aed964f 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120997 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 09:23:57 +00:00
John McCall 4765fa05b5 Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoretical
reason this is limited to C++, and it's certainly not limited to temporaries.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120996 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 08:20:24 +00:00
John McCall 01b2e4e3e2 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120990 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 05:26:58 +00:00
John McCall 85515d64c1 First pass at implementing the intent of ANSI C DR106.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120904 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 12:29:11 +00:00
John McCall 9ec9445402 dyn_cast else unreachable -> cast
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120902 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 09:57:16 +00:00
Francois Pichet 00eb3f9c5b 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120900 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 09:14:42 +00:00
John McCall 74e40b7030 Don't crash when initializing a subaggregate in C from a property r-value.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120899 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 09:03:57 +00:00
John McCall 0e800c9c20 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120896 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 08:14:53 +00:00
John McCall abc56c7261 When deciding whether to complain about the type of a boolean condition, use
the type of the expression *after* array/function decay.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120895 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 06:09:13 +00:00
John McCall f6a1648197 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120890 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 03:47:34 +00:00
Peter Collingbourne 0982136cb7 Implement -cl-single-precision-constant
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120877 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 01:50:56 +00:00
Argyrios Kyrtzidis ae3038c5e8 Mark functions referenced by 'cleanup' attribute as used. Fixes rdar://8728293
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120872 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 01:12:11 +00:00
Fariborz Jahanian 74b2756bc1 Diagnose when accessing property in a class method and
no property accessor class method to be found, instead of
crashing in IRGen. // rdar://8703553


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120855 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-03 23:37:08 +00:00
Abramo Bagnara 6c572f1b5b Fixed typo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120839 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-03 21:39:42 +00:00
Abramo Bagnara a88cefd266 Added struct/class syntactic info for c++0x scoped enum.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120828 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-03 18:54:17 +00:00
Eric Christopher 722109c1b7 Add some warning messages about invalid use of common/nocommon attributes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120799 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-03 06:58:14 +00:00
Douglas Gregor a3998bd364 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120744 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02 21:47:04 +00:00
Douglas Gregor fce5656f75 Do not change the size of LookupResult::Filter based on the NDEBUG
macri; the extra bool fits into padding anyway.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120708 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02 16:19:31 +00:00
Eric Christopher a6cf1e709b Add support for the common and nocommon attributes.
rdar://8560647


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120650 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02 02:45:55 +00:00
John McCall a878cda355 Perform lvalue-to-rvalue at the end of an expression statement in C.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120646 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02 02:07:15 +00:00
John McCall 12f78a6741 Simplify the ASTs by consolidating ObjCImplicitGetterSetterExpr and ObjCPropertyRefExpr
into the latter.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120643 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02 01:19:52 +00:00
Bob Wilson de3deea827 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120633 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02 00:25:15 +00:00
Douglas Gregor 7e44e3fcd7 Make TypeLocBuilder an implementation detail of Sema. Nobody else should be using it
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120628 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02 00:05:49 +00:00
Fariborz Jahanian 1ceee5c42d Sema/AST work for capturing copy init expression
to be used in copy helper synthesis of __block
variables. wip.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120617 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01 22:29:46 +00:00
Eric Christopher f48f367cfe 80-col fixups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120613 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01 22:13:54 +00:00
Douglas Gregor da80f74d8a 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>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120607 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01 21:43:58 +00:00
Douglas Gregor d11617f6e0 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120577 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01 16:10:38 +00:00
John McCall 0ae287a498 Restore the lvalue-to-rvalue conversion patch with a minimal fix.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120555 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01 04:43:34 +00:00