Commit Graph

9354 Commits

Author SHA1 Message Date
Douglas Gregor a6e053e61a Variadic templates: extend the Expr class with a bit that specifies
whether the expression contains an unexpanded parameter pack, in the
same vein as the changes to the Type hierarchy. Compute this bit
within all of the Expr subclasses.

This change required a bunch of reshuffling of dependency
calculations, mainly to consolidate them inside the constructors and
to fuse multiple loops that iterate over arguments to determine type
dependence, value dependence, and (now) containment of unexpanded
parameter packs.

Again, testing is painfully sparse, because all of the diagnostics
will change and it is more important to test the to-be-written visitor
that collects unexpanded parameter packs.

llvm-svn: 121831
2010-12-15 01:34:56 +00:00
Dan Gohman f99dbb9e77 Generalize this test to work without instruction names.
llvm-svn: 121742
2010-12-14 01:33:14 +00:00
Dan Gohman c2897692c3 Implement CodeGen support for the may_alias attribute.
llvm-svn: 121734
2010-12-13 23:51:08 +00:00
Douglas Gregor 506bd56484 Variadic templates: extend Type, NestedNameSpecifier, TemplateName,
and TemplateArgument with an operation that determines whether there
are any unexpanded parameter packs within that construct. Use this
information to diagnose the appearance of the names of parameter packs
that have not been expanded (C++ [temp.variadic]p5). Since this
property is checked often (every declaration, ever expression
statement, etc.), we extend Type and Expr with a bit storing the
result of this computation, rather than walking the AST each time to
determine whether any unexpanded parameter packs occur.

This commit is deficient in several ways, which will be remedied with
future commits:
  - Expr has a bit to store the presence of an unexpanded parameter
  pack, but it is never set.
  - The error messages don't point out where the unexpanded parameter
  packs were named in the type/expression, but they should. 
  - We don't check for unexpanded parameter packs in all of the places
  where we should.
  - Testing is sparse, pending the resolution of the above three
  issues.

llvm-svn: 121724
2010-12-13 22:49:22 +00:00
Chandler Carruth 78494f50e5 Remove a type that got reduced away from this test case but not actually deleted.
llvm-svn: 121694
2010-12-13 08:01:53 +00:00
Chandler Carruth 7a6d2e9ca1 Fix PR8774 by restricting when hasInit returns true. Previously, it
would return true if the initializer pointer union had *any* non-null
pointer in it, even if the pointer wasn't one that would actually be
returned via getInit(). This makes it more accurately model the logic of
'getInit() != NULL'.

This still isn't completely satisfying. From a principled stance,
I suspect we should make hasInit() and getInit() *always* return false
and NULL (resp.) for ParmVarDecl. We shouldn't at the API level treat
initializers and default arguments as the same thing.

llvm-svn: 121692
2010-12-13 07:40:47 +00:00
Peter Collingbourne e8cfaf4258 Sema: diagnose kernel functions with non-void return type
llvm-svn: 121653
2010-12-12 23:02:57 +00:00
Fariborz Jahanian 5d7e9160e7 Enhance my implementation of //rdar ://8747333 in r121597 to allow
for declaration of property setter/getter in forward
class extensions and also skip over
propeties which are @dynamic.

llvm-svn: 121617
2010-12-11 18:39:37 +00:00
Abramo Bagnara 9e0e7096a3 Improved complex constants evaluation.
llvm-svn: 121616
2010-12-11 16:05:48 +00:00
Fariborz Jahanian c21f543bc4 Any property declared in a class extension might have user
declared setter or getter in current class extension or one
of the other class extensions. Mark them as synthesized as
property will be synthesized when property with same name is
seen in the @implementation. This prevents bogus warning
about unimplemented methods to be issued for these methods.
Fixes // rdar://8747333

llvm-svn: 121597
2010-12-10 23:36:33 +00:00
Peter Collingbourne 0168763e7d Do not substitute template types if template has dependent context
We should not substitute template types if the template has a dependent
context because the template argument stack is not yet fully formed.
Instead, defer substitution until the template has a non-dependent
context (i.e. instantiation of an outer template).

llvm-svn: 121491
2010-12-10 17:08:53 +00:00
Douglas Gregor 3046b4d72f In clang_getCursor(), don't override a preprocessing cursor within
another preprocessing cursor, since we want the outermost one.

llvm-svn: 121470
2010-12-10 07:23:11 +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
NAKAMURA Takumi b761ee687f Add dependency to "make clang-test check-all".
llvm-svn: 121458
2010-12-10 02:58:03 +00:00
Fariborz Jahanian aae7926e79 Added remaining objective-c library builtins (as in gcc) to
clang. // rdar://8735023

llvm-svn: 121441
2010-12-10 00:39:16 +00:00
Argyrios Kyrtzidis 648fcbef5b Fix another obscure corner layout case.
llvm-svn: 121436
2010-12-10 00:11:00 +00:00
Douglas Gregor 9c7bd2f535 Don't crash when code-completing after "#include <". It would be far
better to actually produce a decent set of completions by checking the
system include paths, but not today. Fixes PR8744.

llvm-svn: 121431
2010-12-09 23:35:36 +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
Devang Patel d81c110106 Update test.
This test intends to catch invalid use of ".byte 256" in output. Now, the assert in MC will be triggered in such cases.

llvm-svn: 121403
2010-12-09 19:27:37 +00:00
Douglas Gregor ff76cb9727 When an "inline" declaration was followed by a definition not marked
"inline", we weren't giving the definition weak linkage because the
"inline" bit wasn't propagated. This was a longstanding FIXME that,
somehow, hadn't triggered a bug in the wild. Fix this problem by
tracking whether any declaration was marked "inline", and clean up the
semantics of GNU's "extern inline" semantics calculation based on this
change.

Fixes <rdar://problem/8740363>.

llvm-svn: 121373
2010-12-09 16:59:22 +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
Argyrios Kyrtzidis d62c9be4fc Fix another unnecessary-struct-padding issue.
llvm-svn: 121352
2010-12-09 02:47:58 +00:00
Argyrios Kyrtzidis 8b54274fcf Before determining the effect the alignment of base struct will have in the aligment of the sub-struct,
take into account if the sub-struct is packed and its maximum field alignment.

Fixes rdar://8745206

llvm-svn: 121335
2010-12-09 00:35:20 +00:00
Devang Patel 9e54878884 Test case for r121323.
llvm-svn: 121324
2010-12-09 00:11:12 +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
Devang Patel 00afcbe366 Start using DIBuilder. It provides cleaner interface.
llvm-svn: 121302
2010-12-08 22:42:58 +00:00
Daniel Dunbar 86aed7d5fc Driver: M and MM should be grouped together, <rdar://problem/8744831>.
llvm-svn: 121284
2010-12-08 21:33:40 +00:00
Chandler Carruth 174305b94e Make this test resilient to whether or not the Linux toolchain renders the
sysroot flag to the link command as a joined flag or a separate flag.

llvm-svn: 121270
2010-12-08 19:11:45 +00:00
Douglas Gregor 35fd7bc7e0 Fix two thinkos and add a test for importing the AST of a category
implementation.

llvm-svn: 121263
2010-12-08 16:41:55 +00:00
Francois Pichet cf7731b40b Fix bug where annotate tokens was not working for BinaryTypeTraitExpr.
CIndex's EnqueueVisitor must visit elements backward apparently.

llvm-svn: 121247
2010-12-08 09:11:05 +00:00
Francois Pichet c247e1a119 Fix test that didn't really test anything.
llvm-svn: 121246
2010-12-08 09:04:37 +00:00
Argyrios Kyrtzidis ac3b3e8781 Handle parameter attributes when tentative parsing for function/variable disambiguation.
Fixes rdar://8739801.

llvm-svn: 121228
2010-12-08 02:02:46 +00:00
John McCall 26c935f564 Test case.
llvm-svn: 121194
2010-12-07 22:55:51 +00:00
Douglas Gregor 14a49e2fbe Implement AST import for Objective-C property implementations
(@synthesize and @dynamic).

llvm-svn: 121159
2010-12-07 18:32:03 +00:00
Douglas Gregor 4da9d68da0 Implement ASTImporter support for Objective-C category implementations.
llvm-svn: 121139
2010-12-07 15:32:12 +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
Douglas Gregor da8025c09e Extern the ASTImporter to import @implementation declarations.
llvm-svn: 121097
2010-12-07 01:26:03 +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 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
John McCall d0a300162e __block variables require us to evaluate the RHS of an assignment before
the LHS, or else the pointer might be invalid.  This is kindof dumb, but
go ahead and make sure we're doing that for l-value scalar assignment,
which fixes a miscompile of obj-c++.dg/block-seq.mm.

Leave a FIXME for how to solve this problem for agg __blocks.

llvm-svn: 120992
2010-12-06 06:10:02 +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 a2342eb857 Fix a bug in the emission of __real/__imag l-values on scalar operands.
Fix a bug in the emission of complex compound assignment l-values.
Introduce a method to emit an expression whose value isn't relevant.
Make that method evaluate its operand as an l-value if it is one.
Fixes our volatile compliance in C++.

llvm-svn: 120931
2010-12-05 02:00:02 +00:00
Anders Carlsson 0febb8acdf Put each test in class-layout.cpp into a separate namespace.
llvm-svn: 120925
2010-12-05 00:08:52 +00:00
Fariborz Jahanian 83e7d5a90a Fix rewriter to match recent changes in property ref
AST.

llvm-svn: 120919
2010-12-04 21:22:13 +00:00
John McCall 594827281c Silly special case: never load when dereferencing void*.
llvm-svn: 120905
2010-12-04 12:43:24 +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 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 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