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

1482 Коммитов

Автор SHA1 Сообщение Дата
Fariborz Jahanian e2573e529d Warn instead of error on duplicate protocol definitions.
Be kind to so many projects which are doing this (and be
like gcc).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68474 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-06 23:43:32 +00:00
Steve Naroff fc479d793b Make casting 'super' a deprecated warning (instead of a hard error).
This will simplify clang adoption, and is probably better "etiquette" (since gcc has always accepted this idiom without warning). Once we are over the adoption hurdle, we can turn this into an error.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68468 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-06 22:07:54 +00:00
Douglas Gregor a86b832906 Fixed the Fix-It hints for comparison against a string literal. Thanks, Chris!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68454 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-06 18:45:53 +00:00
Fariborz Jahanian 77c9fd2eee Fixed visibility issues related to objc2's synthesized
ivars.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68453 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-06 18:30:00 +00:00
Chris Lattner 3f41976128 Daniel convinced me that accepting "const va_list" arguments to va_arg is
a really really bad idea.  Now that we emit an error about the unpromoted
type, users should be able to understand what is going on.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68447 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-06 17:07:34 +00:00
Fariborz Jahanian 50efe04835 writable property in a category of class's superclass
makes the property writable in the current class.
 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68446 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-06 16:59:10 +00:00
Chris Lattner 0d20b8a6d8 in va_arg diagnostics, print out the unpromoted type. This makes the
diagnostic use the va_list typedef more often, see the difference in the 
changed testcase.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68441 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-05 15:49:53 +00:00
Chris Lattner 9dc8f19a53 Add a warning for questionable va_args usage.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68435 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-05 00:59:53 +00:00
Chris Lattner f502691c86 GCC compatibility: gcc allows applying va_args to const
va_lists for some reason.  This fixes rdar://6726818


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68434 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-05 00:52:59 +00:00
Anton Korobeynikov 348f28ab6a Extend possible handled regparm(N) value
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68424 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-04 10:27:50 +00:00
Anton Korobeynikov 1102f4282c Basic support for regparm codegen
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68414 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-04 00:49:24 +00:00
Anton Korobeynikov 264a76cdf3 Provide sema proper values of maximal number of arguments passed in registers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68413 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-03 23:38:25 +00:00
Fariborz Jahanian b072b7125b Real corener case of a method declared in a protocol
used in a class which declares a property of the same
name. This should not result in an unimplemented
method warning.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68409 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-03 21:51:32 +00:00
Chris Lattner 95f49fb266 improve the string literal comparison warning to not call @encode's "string literals".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68407 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-03 21:11:28 +00:00
Fariborz Jahanian d09a456e46 Fix up lookup rules for properties declared in
objc's continuation class.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68339 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-02 18:44:20 +00:00
Douglas Gregor 74734d576b When calling a function without a prototype for which we have a
definition, warn if there are too many/too few function call
arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68318 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-02 15:37:10 +00:00
Douglas Gregor 261034861d Clean up -fixit output slightly
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68278 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-02 03:14:12 +00:00
Douglas Gregor 558cb56caf Introduce a "-fixit" mode to clang-cc that applies code-modification hints.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68268 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-02 01:08:08 +00:00
Douglas Gregor a3a835149e Add some more code modification hints
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68261 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 23:51:29 +00:00
Fariborz Jahanian 22b6e0682d Fix a bug in declaration of property in continuation
class which was exposed by implementation of 
objc2's nonfragile abi code gen.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68259 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 23:23:53 +00:00
Douglas Gregor 31a19b6989 Make parsing a semantic analysis a little more robust following Sema
failures that involve malformed types, e.g., "typename X::foo" where
"foo" isn't a type, or "std::vector<void>" that doens't instantiate
properly.

Similarly, be a bit smarter in our handling of ambiguities that occur
in Sema::getTypeName, to eliminate duplicate error messages about
ambiguous name lookup.

This eliminates two XFAILs in test/SemaCXX, one of which was crying
out to us, trying to tell us that we were producing repeated error
messages.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68251 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 21:51:26 +00:00
Steve Naroff b59212a6e4 CodeGenModule::GetAddrOfConstantCFString():
- Finish up support for converting UTF8->UTF16 to support ObjC @"string" constants.

Remove warning from CheckObjCString.

As the FIXME in the test case indicates, I still have a bug to work out (apparently with \u handling).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68245 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 21:16:31 +00:00
Douglas Gregor 969c689d89 Give Type::getDesugaredType a "for-display" mode that can apply more
heuristics to determine when it's useful to desugar a type for display
to the user. Introduce two C++-specific heuristics:

  - For a qualified type (like "foo::bar"), only produce a new
    desugred type if desugaring the qualified type ("bar", in this
    case) produces something interesting. For example, if "foo::bar"
    refers to a class named "bar", don't desugar. However, if
    "foo::bar" refers to a typedef of something else, desugar to that
    something else. This gives some useful desugaring such as
    "foo::bar (aka 'int')".
  - Don't desugar class template specialization types like
    "basic_string<char>" down to their underlying "class
    basic_string<char, char_traits<char>, allocator<char>>, etc.";
    it's better just to leave such types alone. 

Update diagnostics.html with some discussion and examples of type
preservation in C++, showing qualified names and class template
specialization types.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68207 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 15:47:24 +00:00
Douglas Gregor 1734317845 Parsing, semantic analysis, and template instantiation for typename
specifiers that terminate in a simple-template-id, e.g.,

  typename MetaFun::template apply<T1, T2>

Also, implement template instantiation for dependent
nested-name-specifiers that involve unresolved identifiers, e.g.,

  typename T::type::type





git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68166 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 00:28:59 +00:00
Douglas Gregor 9bde77309f Some cleanup and renaming. No functionality change
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68140 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 20:22:05 +00:00
Douglas Gregor de650ae96b Implement template instantiation for template names, including both
template template parameters and dependent template names. For
example, the oft-mentioned

  typename MetaFun::template apply<T1, T2>::type

can now be instantiated, with the appropriate name lookup for "apply".



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68128 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 18:38:02 +00:00
Douglas Gregor 8499f3f5ff Implement -Wmissing-prototypes. Fixes PR3911.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68110 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 16:35:03 +00:00
Chris Lattner a3d2524e70 reduce nesting.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68091 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 08:18:48 +00:00
Chris Lattner d013aa1ee7 Codegen sometimes crashes on comparisons that aren't legal, just
disable this feature for now, to err on the side of rejecting instead
of sometimes crashing.  rdar://6326239


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68088 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 07:46:52 +00:00
Douglas Gregor c45c232440 Parsing and AST representation for dependent template names that occur
within nested-name-specifiers, e.g., for the "apply" in

  typename MetaFun::template apply<T1, T2>::type

At present, we can't instantiate these nested-name-specifiers, so our
testing is sketchy.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68081 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 00:43:58 +00:00
Fariborz Jahanian af3e722852 fe support for objc2's nonfragile-abi synthesized ivars.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68077 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 00:06:29 +00:00
Douglas Gregor 7532dc6664 Improve the representation of template names in the AST. This
representation handles the various ways in which one can name a
template, including unqualified references ("vector"), qualified
references ("std::vector"), and dependent template names
("MetaFun::template apply").

One immediate effect of this change is that the representation of
nested-name-specifiers in type names for class template
specializations (e.g., std::vector<int>) is more accurate. Rather than
representing std::vector<int> as

  std::(vector<int>)

we represent it as

  (std::vector)<int>

which more closely follows the C++ grammar. 

Additionally, templates are no longer represented as declarations
(DeclPtrTy) in Parse-Sema interactions. Instead, I've introduced a new
OpaquePtr type (TemplateTy) that holds the representation of a
TemplateName. This will simplify the handling of dependent
template-names, once we get there.






git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68074 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30 22:58:21 +00:00
Sebastian Redl 85002394ca Hopefully fix the rval regressions. Thanks to Chris for pointing out that valgrind complains.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68021 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 22:46:24 +00:00
Chris Lattner 682bf92db4 Push DeclGroup much farther throughout the compiler. Now the various
productions (except the already broken ObjC cases like @class X,Y;) in 
the parser that can produce more than one Decl return a DeclGroup instead
of a Decl, etc.

This allows elimination of the Decl::NextDeclarator field, and exposes
various clients that should look at all decls in a group, but which were
only looking at one (such as the dumper, printer, etc).  These have been
fixed.

Still TODO:

1) there are some FIXME's in the code about potentially using
DeclGroup for better location info.
2) ParseObjCAtDirectives should return a DeclGroup due to @class etc.
3) I'm not sure what is going on with StmtIterator.cpp, or if it can
   be radically simplified now.
4) I put a truly horrible hack in ParseTemplate.cpp.

I plan to bring up #3/4 on the mailing list, but don't plan to tackle
#1/2 in the short term.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68002 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 16:50:03 +00:00
Sebastian Redl a98458054d Reintroduce r67870 (rval ref overloading), since I can't reproduce any test failures on i386 or x86_64. If this fails for someone, please contact me.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67999 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 15:27:50 +00:00
Chris Lattner 64540d71b4 various cleanups
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67981 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 05:01:10 +00:00
Chris Lattner 32d3f9cee6 tighten this up, the decl *must* be a declcontext, no need for the dynamic check.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67978 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 04:30:19 +00:00
Chris Lattner e37b94c718 QualType can go in SmallPtrSet now, simplify code that used to have
to work around this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67968 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 00:04:01 +00:00
Anders Carlsson 81c85c4211 More improvements to namespace aliases. We now support everything except aliases in using directives.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67966 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 23:53:49 +00:00
Anders Carlsson dd729fce03 Fix lookup bug
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67964 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 23:49:35 +00:00
Anders Carlsson 68771c73f4 Create AST nodes for namespace aliases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67962 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 22:58:02 +00:00
Anders Carlsson 03bd5a1e9a Parse the location of the 'namespace' token to ActOnNamespaceAliasDef. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67961 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 22:53:22 +00:00
Chris Lattner b28317a8e5 Introduce a new OpaquePtr<N> struct type, which is a simple POD wrapper for a
pointer.  Its purpose in life is to be a glorified void*, but which does not
implicitly convert to void* or other OpaquePtr's with a different UID.

Introduce Action::DeclPtrTy which is a typedef for OpaquePtr<0>.  Change the 
entire parser/sema interface to use DeclPtrTy instead of DeclTy*.  This
makes the C++ compiler enforce that these aren't convertible to other opaque
types.

We should also convert ExprTy, StmtTy, TypeTy, AttrTy, BaseTy, etc,
but I don't plan to do that in the short term.

The one outstanding known problem with this patch is that we lose the 
bitmangling optimization where ActionResult<DeclPtrTy> doesn't know how to
bitmangle the success bit into the low bit of DeclPtrTy.  I will rectify
this with a subsequent patch.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67952 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 19:18:32 +00:00
Anders Carlsson a1a1b30694 As Eli pointed out, it is possible that a namespace lookup is ambiguous!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67932 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 07:51:31 +00:00
Anders Carlsson 5721c68299 Check that the alias points to a valid namespace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67925 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 06:42:02 +00:00
Chris Lattner 7e24e82a70 rename some methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67923 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 06:33:19 +00:00
Anders Carlsson 8d7ba402ba Check that the namespace alias doesn't conflict with a previous declaration in this scope.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67921 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 06:23:46 +00:00
Anders Carlsson dbb0094f44 Add an ActOnNamespaceAliasDef action and have the parser call it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67915 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 05:27:17 +00:00
Chris Lattner 557c5b1717 push more ASTContext goodness out through interfaces that use
TranslationUnit


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67913 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 04:27:18 +00:00
Anders Carlsson 14734f7d2a Revert Sebastian's rvalue patch (r67870) since it caused test failures in
SemaCXX//overload-member-call.cpp
SemaCXX//overloaded-operator.cpp
SemaTemplate//instantiate-method.cpp



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67912 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 04:17:27 +00:00