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

386 Коммитов

Автор SHA1 Сообщение Дата
Richard Smith 162e1c1b48 Support for C++11 (non-template) alias declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129567 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 14:24:37 +00:00
Anton Korobeynikov 414d8967e1 Implement ARM pcs attribute. Basically it's another way of calling convention selection (AAPCS or
AAPCS+VFP), similar to fastcall / stdcall / whatevercall seen on x86.

In particular, all library functions should always be AAPCS regardless of floating point ABI used.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129534 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-14 20:06:49 +00:00
John McCall fb8721ce4c Simplify calling CheckPlaceholderExpr, converge on it in a few places,
and move a vector-splat check to follow l-value conversion.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129254 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-10 19:13:55 +00:00
John McCall a5fc472b35 Fix a bunch of major problems with __unknown_anytype and properly test
for them.  The only major missing feature is references.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129234 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-09 22:50:59 +00:00
Eli Friedman a49218e17b PR8369: make __attribute((regparm(0))) work correctly. Original patch by
pageexec@freemail.hu, tweaks by me.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129206 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-09 08:18:08 +00:00
John Wiegley 429bb27699 Use ExprResult& instead of Expr *& in Sema
This patch authored by Eric Niebler.

Many methods on the Sema class (e.g. ConvertPropertyForRValue) take Expr
pointers as in/out parameters (Expr *&).  This is especially true for the
routines that apply implicit conversions to nodes in-place.  This design is
workable only as long as those conversions cannot fail.  If they are allowed
to fail, they need a way to report their failures.  The typical way of doing
this in clang is to use an ExprResult, which has an extra bit to signal a
valid/invalid state.  Returning ExprResult is de riguour elsewhere in the Sema
interface.  We suggest changing the Expr *& parameters in the Sema interface
to ExprResult &.  This increases interface consistency and maintainability.

This interface change is important for work supporting MS-style C++
properties.  For reasons explained here
<http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-February/013180.html>,
seemingly trivial operations like rvalue/lvalue conversions that formerly
could not fail now can.  (The reason is that given the semantics of the
feature, getter/setter method lookup cannot happen until the point of use, at
which point it may be found that the method does not exist, or it may have the
wrong type, or overload resolution may fail, or it may be inaccessible.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129143 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-08 18:41:53 +00:00
John McCall 7ea21937de Properly move attributes to the decl spec when applying them there.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128324 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-26 01:39:56 +00:00
John McCall 0b7e678a11 Insomniac refactoring: change how the parser allocates attributes so that
AttributeLists do not accumulate over the lifetime of parsing, but are
instead reused.  Also make the arguments array not require a separate
allocation, and make availability attributes store their stuff in
augmented memory, too.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128209 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-24 11:26:52 +00:00
John McCall c05a94b7ac Call out ObjC parameter types as a different kind of declarator context
from a normal type-spec, just for completeness.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128185 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-23 23:43:04 +00:00
Peter Collingbourne 148f1f7936 Only objects are declared const by a constexpr specifier, per C++0x [dcl.constexpr]p9
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127967 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-20 08:06:45 +00:00
Peter Collingbourne 207f4d8543 Add support for language-specific address spaces. On top of that,
add support for the OpenCL __private, __local, __constant and
__global address spaces, as well as the __read_only, _read_write and
__write_only image access specifiers.  Patch originally by ARM;
language-specific address space support by myself.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127915 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-18 22:38:29 +00:00
Abramo Bagnara 0daaf32723 Use ElaboratedType also for C.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127755 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-16 20:16:18 +00:00
Sebastian Redl 8999fe1bc3 Make deallocation functions implicitly noexcept in C++0x.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127596 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-14 18:08:30 +00:00
Sebastian Redl 60618fa7f8 Propagate the new exception information to FunctionProtoType.
Change the interface to expose the new information and deal with the enormous fallout.
Introduce the new ExceptionSpecificationType value EST_DynamicNone to more easily deal with empty throw specifications.
Update the tests for noexcept and fix the various bugs uncovered, such as lack of tentative parsing support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127537 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-12 11:50:43 +00:00
Abramo Bagnara 796aa443ab Forgotten part of previous commit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127536 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-12 11:17:06 +00:00
Rafael Espindola 1e15394853 Fix PR9453 by not trying to print a warning about ignored qualifiers
in conversion functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127460 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-11 04:56:58 +00:00
Abramo Bagnara 91ce2c4484 Fixed class type generation for MemberPointerType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127401 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10 10:18:27 +00:00
John McCall eecf5fa12d Add a bit to ParmVarDecl indicating whether the parameter undergoes
K&R-style default argument promotion.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127313 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 04:22:44 +00:00
Abramo Bagnara 15987970ee Fixed isEmbeddedInDeclarator flag loading.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127285 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 22:33:38 +00:00
John McCall 834e3f6c77 Fix my earlier commit to work with escaped newlines and leave breadcrumbs
in case we want to make a world where we can check intermediate instantiations
for this kind of breadcrumb.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127221 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 07:59:04 +00:00
John McCall 2792fa5115 objc_gc wants a pointer type, not a function type; give it a more appropriate
diagnostic.  Also, these attributes are commonly written with macros which we
actually pre-define, so instead of expanding the macro location, refer to the
instantiation location and name it using the macro loc.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127219 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 04:17:03 +00:00
Abramo Bagnara fd9c42ed22 Used a nicer cast.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127134 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-06 22:48:24 +00:00
Sebastian Redl 8b5b4099c6 Reinstate r127112, "Propagate new-style exception spec information to ExtProtoInfo.", this time with the missing header.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127118 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-06 10:52:04 +00:00
NAKAMURA Takumi 708a866904 Revert r127112, "Propagate new-style exception spec information to ExtProtoInfo."
It seems missing "clang/Basic/ExceptionSpecificationType.h".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127115 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-06 00:17:36 +00:00
Sebastian Redl 06bfa84588 Propagate new-style exception spec information to ExtProtoInfo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127112 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-05 22:42:26 +00:00
Sebastian Redl 6e5d319b67 Propagate new-style exception spec information to Declarator.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127111 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-05 22:42:13 +00:00
Abramo Bagnara b6ab6c1ca7 Improved MemberPointerType source locations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127085 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-05 14:42:21 +00:00
John McCall 14aa217541 Make AttributedTypes for GC-qualified types and fix some miscellaneous
bugs with such types.  Not sure this is quite how I want the desugaring
and a.k.a. logic to go, but it suffices.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126986 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-04 04:00:19 +00:00
Douglas Gregor 94fdffa4a5 Push nested-name-specifier source-location information into dependent
template specialization types. There are still a few rough edges to
clean up with some of the parser actions dropping
nested-name-specifiers too early.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126776 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-01 20:11:18 +00:00
Douglas Gregor 9e876876af Reinstate the introduction of source-location information for
nested-name-speciciers within elaborated type names, e.g.,
 
  enum clang::NestedNameSpecifier::SpecifierKind

Fixes in this iteration include:

  (1) Compute the type-source range properly for a dependent template
  specialization type that starts with "template template-id ::", as
  in a member access expression

    dep->template f<T>::f()

  This is a latent bug I triggered with this change (because now we're
  checking the computed source ranges for dependent template
  specialization types). But the real problem was...

  (2) Make sure to set the qualifier range on a dependent template
  specialization type appropriately. This will go away once we push
  nested-name-specifier locations into dependent template
  specialization types, but it was the source of the
  valgrind errors on the buildbots.
  



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126765 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-01 18:12:44 +00:00
Douglas Gregor 2786864406 Revert r126748, my second attempt at nested-name-specifier source
location information for elaborated types. *sigh*


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126753 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-01 17:25:47 +00:00
Douglas Gregor fff951371d When digging into a cv-qualified return type that is a pointer type to
diagnose ignored qualifiers on return types, only assume that there is
a pointer chunk if the type is *structurally* a pointer type, not if
it's a typedef of a pointer type. Fixes PR9328/<rdar://problem/9055428>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126751 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-01 17:04:42 +00:00
Douglas Gregor be38c5f5d8 Reinstate r126737, extending the generation of type-source location
information for qualifier type names throughout the parser to address
several problems.

The commit message from r126737:

Push nested-name-specifier source location information into elaborated
name types, e.g., "enum clang::NestedNameSpecifier::SpecifierKind".

Aside from the normal changes, this also required some tweaks to the
parser. Essentially, when we're looking at a type name (via
getTypeName()) specifically for the purpose of creating an annotation
token, we pass down the flag that asks for full type-source location
information to be stored within the returned type. That way, we retain
source-location information involving nested-name-specifiers rather
than trying to reconstruct that information later, long after it's
been lost in the parser.

With this change, test/Index/recursive-cxx-member-calls.cpp is showing
much improved results again, since that code has lots of
nested-name-specifiers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126748 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-01 16:31:39 +00:00
Douglas Gregor 44cd9f9d68 Revert r126737, the most recent nested-name-specifier location change, for buildbot breakage.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126746 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-01 15:34:37 +00:00
Douglas Gregor 239cbb023c Push nested-name-specifier source location information into elaborated
name types, e.g., "enum clang::NestedNameSpecifier::SpecifierKind".

Aside from the normal changes, this also required some tweaks to the
parser. Essentially, when we're looking at a type name (via
getTypeName()) specifically for the purpose of creating an annotation
token, we pass down the flag that asks for full type-source location
information to be stored within the returned type. That way, we retain
source-location information involving nested-name-specifiers rather
than trying to reconstruct that information later, long after it's
been lost in the parser.

With this change, test/Index/recursive-cxx-member-calls.cpp is showing
much improved results again, since that code has lots of
nested-name-specifiers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126737 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-01 03:11:17 +00:00
Douglas Gregor 2494dd024b Push nested-name-specifier source location information into
DependentNameTypeLoc. Teach the recursive AST visitor and libclang how to
walk DependentNameTypeLoc nodes.

Also, teach libclang about TypedefDecl source ranges, so that we get
those. The massive churn in test/Index/recursive-cxx-member-calls.cpp
is a good thing: we're annotating a lot more of this test correctly
now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126729 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-01 01:34:45 +00:00
Douglas Gregor 14aba76042 Teach NestedNameSpecifier to keep track of namespace aliases the same
way it keeps track of namespaces. Previously, we would map from the
namespace alias to its underlying namespace when building a
nested-name-specifier, losing source information in the process.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126358 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-24 02:36:08 +00:00
Chandler Carruth d067c07c6c Fix the behavior of -Wignored-qualifiers on return type qualifiers in
several ways. We now warn for more of the return types, and correctly
locate the ignored ones. Also adds fix-it hints to remove the ignored
qualifiers. Fixes much of PR9058, although not all of it.

Patch by Hans Wennborg, a couple of minor style tweaks from me.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126321 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-23 18:51:59 +00:00
Richard Smith 8110f04b39 In Objective-C, there are no trailing return types, so don't produce diagnostics suggesting they are missing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126174 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-22 01:22:29 +00:00
Richard Smith e7397c6a1b Fix a few auto-related issues:
* 'auto' was being rejected on abstract-declarators with trailing return
types and on typedefs with trailing return types. 'auto' is always
allowed in these cases. This was found while testing the fix for PR 9278.

 * A very poor diagnostic was being issued for auto (f() -> int): "return
type must be 'auto', not 'auto'". This is closely related to PR 9060.

 * Trailing return type handling was happening slightly too late,
resulting in the checks for functions returning arrays and functions
returning functions being missed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126166 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-22 00:36:53 +00:00
Richard Smith ddc83f9255 C++0x's deduced auto is illegal in typedefs.
This actually rules out too much, since it also catches typedefs for pointers to functions with trailing return types:

  typedef auto (*F)() -> int;

Fix for that (and the same issue in all abstract-declarators) to follow shortly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126153 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-21 23:18:00 +00:00
Richard Smith 34b41d939a Implement the C++0x deduced 'auto' feature.
This fixes PR 8738, 9060 and 9132.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126069 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-20 03:19:35 +00:00
Peter Collingbourne 39d3e7a26c OpenCL: semantic analysis support for cl_khr_fp64 extension
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125588 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-15 19:46:23 +00:00
John McCall da263795ab dgregor accidentally killed this assert, but on investigation, it can fire
on invalid code and we don't really care, so kill it harder.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125068 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08 01:59:10 +00:00
Douglas Gregor 8ef6c8cb6c Improve our uniquing of file entries when files are re-saved or are
overridden via remapping. Thus, when we create a "virtual" file in the
file manager, we still stat() the real file that lives behind it so
that we can provide proper uniquing based on inodes. This helps keep
the file manager much more consistent.

To take advantage of this when reparsing files in libclang, we disable
the use of the stat() cache when reparsing or performing code
completion, since the stat() cache is very likely to be out of date in
this use case.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124971 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-05 19:42:43 +00:00
Douglas Gregor 683a81f437 Implement the suggested resolution to core issue 547, extended to also
allow ref-qualifiers on function types used as template type
arguments. GNU actually allows cv-qualifiers on function types in many
places where it shouldn't, so we currently categorize this as a GNU
extension.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124584 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-31 16:09:46 +00:00
Douglas Gregor 944aa60777 Cope with parenthesized function declarators when emitting a
diagnostic about ref-qualifiers where they do not belong.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124344 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-27 01:30:16 +00:00
Douglas Gregor c938c1668b Rvalue references for *this:
- Add ref-qualifiers to the type system; they are part of the
  canonical type. Print & profile ref-qualifiers
  - Translate the ref-qualifier from the Declarator chunk for
    functions to the function type. 
  - Diagnose mis-uses of ref-qualifiers w.r.t. static member
  functions, free functions, constructors, destructors, etc.
  - Add serialization and deserialization of ref-qualifiers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124281 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-26 05:01:58 +00:00
Douglas Gregor 83f51722ed Rvalue references for *this: parse ref-qualifiers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124276 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-26 03:43:54 +00:00
Argyrios Kyrtzidis a4356adfd4 Correct r124242 making sure function chunk that gets diagnosed is really about the block.
Clairvoyance by John!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124264 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-26 01:26:44 +00:00