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

1405 Коммитов

Автор SHA1 Сообщение Дата
Anders Carlsson 3242ee01d4 Remove unused parameter from ActOnDeclarator.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134377 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-04 16:28:17 +00:00
Nick Lewycky 25af091c55 Fix a typo, remove a tab, canonicalize some spacing. No functional change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134305 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-02 02:05:12 +00:00
Richard Trieu 304e233921 Fix for PR7410. Allow functions in a derived class that improperly overwrite a virtual function in the base class to be inserted into the derived class function list to prevent extra errors every time the derived class is used.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134251 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-01 20:02:53 +00:00
Richard Smith c89edf5aaa Fix AST representations of alias-declarations which define tag types. Inside classes, the tag types need to have an associated access specifier, and inside function definitions, they need to be included in the declarations of the DeclStmt. These issues manifested as assertions during template instantiation, and also in a WIP constexpr patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134250 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-01 19:46:12 +00:00
Douglas Gregor e12a11f26b When redeclaring a local extern in the same scope, make sure that we
replace the existing declaration appropriately. Patch by Jordy Rose,
fixes PR10013 / <rdar://problem/9584157>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134097 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-29 21:22:02 +00:00
Douglas Gregor d8bba9c152 Add support for C++ namespace-aware typo correction, e.g., correcting
vector<int>

to

  std::vector<int>

Patch by Kaelyn Uhrain, with minor tweaks + PCH support from me. Fixes
PR5776/<rdar://problem/8652971>.

Thanks Kaelyn!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134007 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 16:20:02 +00:00
Argyrios Kyrtzidis d3880f8458 Centralize all checks for a C++ tag definition inside a typename in
Sema::GetTypeForDeclarator and remove its 'OwnedDecl' out parameter.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133986 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 03:01:18 +00:00
Argyrios Kyrtzidis 3215398dc9 Centralize the check for a tag definition in a Declarator::PrototypeContext inside GetTypeForDeclarator.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133985 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 03:01:15 +00:00
Argyrios Kyrtzidis b8b0313e84 Rename objc_lifetime -> objc_ownership, and modify diagnostics to talk about 'ownership', not 'lifetime'.
rdar://9477613.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133779 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-24 00:08:59 +00:00
Fariborz Jahanian c3ca14d137 Remove multiple use of weak_import attribute on
same declaration. Templatize dropAttr for general use.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133724 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-23 17:50:10 +00:00
Fariborz Jahanian 8785d115eb Remove weak_import attribute on new declaration.
// rdar://9538608


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133721 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-23 16:18:44 +00:00
Fariborz Jahanian d543130a30 Issue warning if weak_import attribute is added to an already
declared variable and ignore it. // rdar://9538608


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133654 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-22 22:08:50 +00:00
Fariborz Jahanian ab27d6ea7b llvm-gcc treats a tentative definition with a previous
(or follow up) extern declaration with weak_import as 
an actual definition. make clang follows this behavior. 
// rdar://9538608
llvm-gcc treats an extern declaration with weak_import


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133450 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-20 17:50:03 +00:00
Douglas Gregor 0f9dc86a14 When an explicit specialization has a storage specifier, error if that
storage specifier is different from the storage specifier on the
template. If that storage specifier is the same, then we only warn.

Thanks to John for the prodding.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133236 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-17 05:09:08 +00:00
Douglas Gregor 51d7cdd4bf Downgrade the error complaining about presence of a storage class
specifier on an explicit specialization to a warning, since neither
EDG nor GCC diagnose this code as ill-formed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133232 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-17 03:41:35 +00:00
John McCall f85e193739 Automatic Reference Counting.
Language-design credit goes to a lot of people, but I particularly want
to single out Blaine Garst and Patrick Beard for their contributions.

Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself,
in no particular order.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133103 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-15 23:02:42 +00:00
Douglas Gregor b30cd4a09b Don't add redundant FormatAttr, ConstAttr, or NoThrowAttr attributes,
either imlicitly (for builtins) or explicitly (due to multiple
specification of the same attributes). Fixes <rdar://problem/9612060>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133045 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-15 05:45:11 +00:00
Chris Lattner 24c38e1ff0 fix rdar://9204520 - Accept int(0.85 * 10) as an initializer in a class member
as an extension.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132980 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-14 05:46:29 +00:00
Eli Friedman eca3ed7490 Make __gnu_inline__ functions in gnu99 mode work the same way as inline functions in gnu89 mode in terms of redefinitions.
rdar://9559708 .



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132953 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-13 23:56:42 +00:00
Richard Smith c2cdd5354a Don't assert on initialized typedef declarations in classes:
struct {
    typedef int A = 0;
  };

According to the C++11 standard, this is not ill-formed, but does not have any ascribed meaning. We can't reasonably accept it, so treat it as ill-formed.

Also switch C++ from an incorrect 'fields can only be initialized in constructors' diagnostic for this case to C's 'illegal initializer (only variables can be initialized)'



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132890 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-12 11:43:46 +00:00
Richard Smith 7a614d8380 Implement support for C++11 in-class initialization of non-static data members.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132878 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-11 17:19:42 +00:00
Douglas Gregor 926df6cfab Implement Objective-C Related Result Type semantics.
Related result types apply Cocoa conventions to the type of message
sends and property accesses to Objective-C methods that are known to
always return objects whose type is the same as the type of the
receiving class (or a subclass thereof), such as +alloc and
-init. This tightens up static type safety for Objective-C, so that we
now diagnose mistakes like this:

t.m:4:10: warning: incompatible pointer types initializing 'NSSet *'
with an
      expression of type 'NSArray *' [-Wincompatible-pointer-types]
  NSSet *array = [[NSArray alloc] init];
         ^       ~~~~~~~~~~~~~~~~~~~~~~
/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:72:1:
note: 
      instance method 'init' is assumed to return an instance of its
      receiver
      type ('NSArray *')
- (id)init;
^

It also means that we get decent type inference when writing code in
Objective-C++0x:

  auto array = [[NSMutableArray alloc] initWithObjects:@"one",  @"two",nil];
  //    ^ now infers NSMutableArray* rather than id




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132868 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-11 01:09:30 +00:00
Richard Trieu bbf34c0243 Made changes to how 'struct'/'class' mismatches are handled in -Wmismatched-tags.
- Removed fix-it hints from template instaniations since changes to the
templates are rarely helpful.
- Changed the caret in template instaniations from the class/struct name to the
class/struct keyword, matching the other warnings.
- Do not offer fix-it hints when multiple declarations disagree.  Warnings are
still given.
- Once a definition is found, offer a fix-it hint to all previous declarations
with wrong tag.
- Declarations that disagree with a previous definition will get a fix-it hint
to change the declaration.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132831 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-10 03:11:26 +00:00
Fariborz Jahanian 175df89a97 More coherent diagnostic when a stack variable is
declared __weak objc-gc mode.  // rdar://9666091.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132731 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-07 20:15:46 +00:00
Douglas Gregor 89b9f10cca Diagnose the condition in C++ [temp.expl.spec]p16 that prohibits
specializing a member of an unspecialized template, and recover from
such errors without crashing. Fixes PR10024 / <rdar://problem/9509761>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132677 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-06 15:22:55 +00:00
Francois Pichet ab01add382 Revert r132544. Accidental commit. I got confused with the Tortoise SVN menu.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132546 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-03 13:59:45 +00:00
Francois Pichet 696df647c2 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132544 91177308-0d34-0410-b5e6-96231b3b80d8 2011-06-03 13:51:55 +00:00
Francois Pichet 3f0556d8fb Correctly revert r131347: function explicit specialization at class scope.
I'll try to implement this functionality again soon.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132536 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-03 07:35:49 +00:00
Rafael Espindola fb3f4aad04 Implement -fgnu89-inline. Fixes PR10041.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132460 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-02 16:13:27 +00:00
Francois Pichet b474603632 Microsoft friend acting as a forward declaration; try#2. Now only 2 lines.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132387 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-01 04:14:20 +00:00
Francois Pichet 5aecb786a3 Revert 132332 (Microsoft friend as a forward declaration), John McCall pointed out a better/simpler way to do it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132369 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-31 22:36:05 +00:00
Francois Pichet fa6e63a06b Recreate the DeclContext before adding the implicit friend forward declaration. This should fix the asserting buildbot.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132333 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-31 12:44:46 +00:00
Francois Pichet 8adc227de9 For compatibility with MSVC, a friend declaration also act as a forward declaration if the tag name is not already declared. The tag name is declared in the next outermost non record scope.
Example:

class A {
  friend class B;
  B* b;
};
B* global_b;


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132332 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-31 11:44:00 +00:00
Douglas Gregor f61103ef33 Clean up my changes to jump-diagnostic handling for local variables of
class type (or array thereof), eliminating some redundant checks
(thanks Eli!) and adding some tests where the behavior differs in
C++98/03 vs. C++0x.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132218 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-27 21:28:00 +00:00
Sean Hunt 9ae60d54e4 Implement a new warning for when adding a default argument to a method
makes it into a special member function. This is very bad and can lead
to all sorts of nastiness including implicit member functions violating
the One Definition Rule. This should probably be made ill-formed in a
later version of the standard, but for now we'll just warn.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132104 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-26 01:26:05 +00:00
Sean Hunt 8271317491 Update our diagnostics to properly account for move operations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132096 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-25 23:16:36 +00:00
Sean Hunt ffe37fdda5 Implement a little bit of cleanup and a lot more of the base work
behind implicit moves. We now correctly identify move constructors and
assignment operators and update bits on the record correctly. Generation
of implicit moves (declarations or definitions) is not yet supported.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132080 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-25 20:50:04 +00:00
Sean Hunt ca63c20034 Implement a new type node, UnaryTransformType, designed to represent a
type that turns one type into another. This is used as the basis to
implement __underlying_type properly - with TypeSourceInfo and proper
behavior in the face of templates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132017 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-24 22:41:36 +00:00
Douglas Gregor 63fe6814f3 Implement the initial part of C++0x [expr.const]p2, which specifies
that the unevaluated subexpressions of &&, ||, and ? : are not
considered when determining whether the expression is a constant
expression. Also, turn the "used in its own initializer" warning into
a runtime-behavior warning, so that it doesn't fire when a variable is
used as part of an unevaluated subexpression of its own initializer.

Fixes PR9999.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131968 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-24 16:02:01 +00:00
Douglas Gregor e885e188b2 Diagnose the presence of storage-class-specifiers on explicit
instantiations and specializations. Fixes <rdar://problem/9126453> and PR8700.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131802 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-21 18:53:30 +00:00
Douglas Gregor 4337dc7760 Teach Sema::ActOnUninitializedDecl() not to try to interpret when one
should use a constructor to default-initialize a
variable. InitializationSequence knows the rules for default
initialization, better. Fixes <rdar://problem/8501008>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131796 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-21 17:52:48 +00:00
Douglas Gregor 575a1c9dc8 Introduce Type::isSignedIntegerOrEnumerationType() and
Type::isUnsignedIntegerOrEnumerationType(), which are like
Type::isSignedIntegerType() and Type::isUnsignedIntegerType() but also
consider the underlying type of a C++0x scoped enumeration type.

Audited all callers to the existing functions, switching those that
need to also handle scoped enumeration types (e.g., those that deal
with constant values) over to the new functions. Fixes PR9923 /
<rdar://problem/9447851>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131735 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-20 16:38:50 +00:00
Sebastian Redl a0448264c7 Fix PR9941 for out-of-line template destructors too.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131722 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-20 05:57:18 +00:00
Sebastian Redl 42bef03a0f Fix PR9941 again, this time for templates.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131640 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-19 16:25:27 +00:00
Sean Hunt db5d44b775 Implement __underlying_type for libc++.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131633 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-19 05:37:45 +00:00
Sebastian Redl 0ee33912f8 Reapply r121528, fixing PR9941 by delaying the exception specification check for destructors until the class is complete and destructors have been adjusted.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131632 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-19 05:13:44 +00:00
Sean Hunt 1d78032167 Revert r121528 as it breaks a simple testcase, which leads to, among
other things, libcxx not building.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131573 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-18 20:57:11 +00:00
Sebastian Redl 0320a1d7b3 Implement implicit exception specifications of destructors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131528 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-18 05:20:56 +00:00
Sean Hunt cf34e757b9 Implement the new C++0x rules for non-trivial things in unions so that
my defaulted constructor tests stop yelling at me about them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131432 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-16 22:41:40 +00:00
Francois Pichet e1e96a6201 Revert 131347. It asserts if the specialization in within a class template:
template<class U> 
struct X1 {
  template<class T> void f(T*);
  template<> void f(int*) { } 
};

Won't be so simple. I need to think more about it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131362 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-14 19:17:07 +00:00