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

1112 Коммитов

Автор SHA1 Сообщение Дата
John McCall d226f65006 DeclPtrTy -> Decl *
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111733 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21 09:40:31 +00:00
John McCall 1951085672 Another step in the process of making the parser depend on Sema:
- move DeclSpec &c into the Sema library
  - move ParseAST into the Parse library
Reflect this change in a thousand different includes.
Reflect this change in the link orders.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111667 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-20 18:27:03 +00:00
Sean Hunt cf807c4dfd Generate Attr subclasses with TableGen.
Now all classes derived from Attr are generated from TableGen.
Additionally, Attr* is no longer its own linked list; SmallVectors or
Attr* are used. The accompanying LLVM commit contains the updates to
TableGen necessary for this.

Some other notes about newly-generated attribute classes:

 - The constructor arguments are a SourceLocation and a Context&,
   followed by the attributes arguments in the order that they were
   defined in Attr.td

 - Every argument in Attr.td has an appropriate accessor named getFoo,
   and there are sometimes a few extra ones (such as to get the length
   of a variadic argument).

Additionally, specific_attr_iterator has been introduced, which will
iterate over an AttrVec, but only over attributes of a certain type. It
can be accessed through either Decl::specific_attr_begin/end or
the global functions of the same name.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111455 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 23:23:40 +00:00
Douglas Gregor 2767ce2e21 Emit an error if an array is too large. We're slightly more strict
than GCC 4.2 here when building 32-bit (where GCC will allow
allocation of an array for which we can't get a valid past-the-end
pointer), and emulate its odd behavior in 64-bit where it only allows
63 bits worth of storage in the array. The former is a correctness
issue; the latter is harmless in practice (you wouldn't be able to use
such an array anyway) and helps us pass a GCC DejaGNU test.

Fixes <rdar://problem/8212293>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111338 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 00:39:00 +00:00
Daniel Dunbar 4087f27e54 StringRef'ication of lots stuff, patch by Peter Davies!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111314 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17 22:39:59 +00:00
John McCall 2d7d2d99bc A field of incomplete type is sufficiently disruptive that we should mark
the record invalid.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111211 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16 23:42:35 +00:00
Argyrios Kyrtzidis dd7744d01e Emit diagnostic error when the field of an anonymous struct is non trivial.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111158 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16 17:27:08 +00:00
Argyrios Kyrtzidis 06999f8ff6 Don't warn for the common pattern of disallowing copying:
class S {
  S(const S&); // DO NOT IMPLEMENT
  void operator=(const S&); // DO NOT IMPLEMENT
};

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111100 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-15 10:17:33 +00:00
Argyrios Kyrtzidis bbc6454bb9 Commit improved version of 111026 & 111027.
Unused warnings for functions:
-static functions
-functions in anonymous namespace
-class methods in anonymous namespace
-class method specializations in anonymous namespace
-function specializations in anonymous namespace

Unused warnings for variables:
-static variables
-variables in anonymous namespace
-static data members in anonymous namespace
-static data members specializations in anonymous namespace

Reveals lots of opportunities for dead code removal in llvm codebase that will
interest my esteemed colleagues.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111086 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-15 01:15:20 +00:00
Argyrios Kyrtzidis 05eac86d54 Revert 111026 & 111027, build breakage.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111036 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13 20:13:06 +00:00
Argyrios Kyrtzidis 30c0dd86f0 The unused warnings extravaganza continues. Warn for:
-static variables
-variables in anonymous namespace (fixes rdar://7794535)
-static data members in anonymous namespace
-static data members specializations in anonymous namespace

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111027 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13 18:42:40 +00:00
Argyrios Kyrtzidis f6d1d43d68 Expand the unused warnings for functions. Warn for:
-static function declarations
-functions in anonymous namespace
-class methods in anonymous namespace
-class method specializations in anonymous namespace
-function specializations in anonymous namespace

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111026 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13 18:42:29 +00:00
Argyrios Kyrtzidis 49b96d1a38 Change Sema's UnusedStaticFuncs to UnusedFileScopedDecls to allow also keeping track of unused file scoped variables.
This is only preparation, currently only static function definitions are tracked, as before.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111025 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13 18:42:17 +00:00
Douglas Gregor e737f5041a Move Sema's headers into include/clang/Sema, renaming a few along the way.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110945 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12 20:07:10 +00:00
John McCall fcadea2556 Fix a crash on invalid when declaring an implicit member of a class with an
invalid destructor.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110891 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12 00:57:17 +00:00
Abramo Bagnara 2577743c56 Added locations and type source info for DeclarationName.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 22:01:17 +00:00
Douglas Gregor deacbdca55 Speculatively revert r110610 " Make ObjCInterfaceDecl redeclarable,
and create separate decl nodes for forward declarations and the
definition," which appears to be causing significant Objective-C
breakage.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110803 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 12:19:30 +00:00
Eli Friedman bf87f2c1c6 Fix redefinition of typedefs of fixable variably-modified array types; should
fix an issue compiling <windows.h>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110651 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-10 03:13:15 +00:00
Sebastian Redl 74c730ad1f - Make ObjCInterfaceDecl redeclarable, and create separate decl nodes for forward declarations and the definition.
- Eagerly create ObjCInterfaceTypes for declarations.
- The two above changes lead to a 0.5% increase in memory use and no speed regression when parsing Cocoa.h. On the other hand, now chained PCH works when there's a forward declaration in one PCH and the interface definition in another.
- Add HandleInterestingDecl to ASTConsumer. PCHReader passes the "interesting" decls it finds to this function instead of HandleTopLevelDecl. The default implementation forwards to HandleTopLevelDecl, but ASTUnit's handler for example ignores them. This fixes a potential crash when lazy loading of PCH data would cause ASTUnit's "top level" declaration collection to change while being iterated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110610 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-09 21:55:28 +00:00
John McCall f871d0cc37 Store inheritance paths after CastExprs instead of inside them.
This takes some trickery since CastExpr has subclasses (and indeed,
is abstract).

Also, smoosh the CastKind into the bitfield from Expr.

Drops two words of storage from Expr in the common case of expressions
which don't need inheritance paths.  Avoids a separate allocation and
another word of overhead in cases needing inheritance paths.  Also has
the advantage of not leaking memory, since destructors for AST nodes are
never run.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110507 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-07 06:22:56 +00:00
Douglas Gregor d945538a36 Make sure that we diagnose attribute((overloadable)) functions without
prototypes. Fixes PR7738.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110443 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06 13:50:58 +00:00
Abramo Bagnara 7c15353cca Template keyword should not be ignored building a QualifiedTemplateName.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110441 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06 12:11:11 +00:00
Douglas Gregor ed328c6129 Diagnose the use of "inline" on block-scope function declarations in
C++, from Andrea Nall!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110439 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06 11:44:10 +00:00
John McCall 9983d2d76c Properly pop out of Objective-C method declarations when they are (ill-formedly)
found within contexts other than the translation unit.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110417 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06 00:46:05 +00:00
Eli Friedman aa8b0d1924 Implement #pragma GCC visibility.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110315 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-05 06:57:20 +00:00
John McCall 15442825bb Only look up an 'operator delete' on the definition of a destructor, not on
a declaration.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110175 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-04 01:04:25 +00:00
John McCall 4204f07fc8 Further adjustments to -Wglobal-constructors; works for references and direct
initializations now.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110063 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-02 21:13:48 +00:00
Argyrios Kyrtzidis 76c38d3854 Read/write in PCH Sema's StdNamespace and StdBadAlloc and use a LazyDeclPtr for them that will deserialize them when needed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110031 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-02 07:14:54 +00:00
John McCall b4b9b15c59 Kill off RequiresGlobalConstructor in favor of isConstantInitializer.
Note some obvious false positives in the test case.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109986 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-01 21:51:45 +00:00
John McCall 626e96e287 Make a first pass at implementing -Wglobal-constructors. I'm worried that this
will end up bizarrely mirroring CGExprConstant, but that might be the hazard of
this feature.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109984 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-01 20:20:59 +00:00
John McCall b567a8b94c Fix indentation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109965 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-01 01:25:24 +00:00
John McCall e46f62cbaa Don't consider all local variables in C++ to mandate scope-checking, just
those with initializers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109964 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-01 01:24:59 +00:00
John McCall b60a77e453 Only run the jump-checker if there's a branch-protected scope *and* there's
a switch or goto somewhere in the function.  Indirect gotos trigger the
jump-checker regardless, because the conditions there are slightly more
elaborate and it's too marginal a case to be worth optimizing.

Turns off the jump-checker in a lot of cases in C++.  rdar://problem/7702918


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109962 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-01 00:26:45 +00:00
Abramo Bagnara 35f9a196ef Fixed typedef inside extern "C".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109865 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-30 16:47:02 +00:00
Douglas Gregor 447234dd45 Allow a looser form of compatibility checking (which ignores
qualifiers) when checking a K&R function definition against a previous
prototype. Fixes <rdar://problem/8193107>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109751 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-29 15:18:02 +00:00
Douglas Gregor 98c2e6248f Don't set out-of-line template specialization/definition information
for AST nodes that aren't actually out-of-line (i.e., require a
nested-name-specifier). Fixes <rdar://problem/8204126>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109704 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-28 23:59:57 +00:00
Dan Gohman 3c46e8db99 Fix namespace polution.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109440 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-26 21:25:24 +00:00
Douglas Gregor ff331c1572 Remove the vast majority of the Destroy methods from the AST library,
since we aren't going to be calling them ever.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109377 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-25 18:17:45 +00:00
Douglas Gregor f178dcab50 Be careful; even though we had a proper name at the beginning of
Sema::ActOnDeclarator doesn't mean that the Decl we ended up creating
has a useful name. <rdar://problem/8229910>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109296 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-24 00:10:38 +00:00
John McCall acb7039ca3 We never want to pop the translation unit DC, so assert if this happens.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109280 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-23 22:45:07 +00:00
Sebastian Redl 906082edf2 Update ImplicitCastExpr to be able to represent an XValue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108807 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-20 04:20:21 +00:00
Douglas Gregor a0ebd60bfd Revert Microsoft-specific override of the "typedef requires a name"
diagnostic. Instead, put it and the "declaration does not declare
anything" warning into -Wmissing-declarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108527 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-16 15:40:40 +00:00
Douglas Gregor 0c99ec6d22 Suppress the "typedef requires a name" warning in Microsoft-extensions mode
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108526 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-16 15:18:19 +00:00
John McCall c9068d7dd9 Treat template parameters as part of the declaration-specifiers for the
purpose of access control.  Fixes PR7644.

I can't actually find anything directly justifying this, but it seems obvious.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108521 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-16 08:13:16 +00:00
Chandler Carruth b21fc4a4c1 Butcher a perfectly reasonable diagnostic to pacify old versions of SWIG.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108505 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-16 04:32:28 +00:00
Ted Kremenek bee05c1206 Add builtin definition for scanf, including extending the builtin encoding to
represent builtins that have the "scanf" attribution (via the format attribute) just
like we do with printf functions.  Follow-up work is needed to add similar support
for fscanf et al.

This is to support format-string checking for scanf functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108499 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-16 02:11:15 +00:00
Douglas Gregor 0167f3c255 When there are extra or missing template parameter lists in a template
definition, we're likely going to end up breaking the invariants of
the template system, e.g., that the depths of template parameter lists
match up with the nesting template of the template. So, make sure we
mark such ill-formed declarations as invalid or don't even build them
at all.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108372 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-14 23:14:12 +00:00
Douglas Gregor aef01998af Diagnose typedef of an operator name. Fixes PR7462
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108233 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 06:37:01 +00:00
Douglas Gregor a131d0fc0a Complain when an unnamed enumeration has no enumerations (in
C++). Fixes PR7466.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108231 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 06:24:26 +00:00
Sebastian Redl f9ea1f392a Produce an error on encountering a pointer or reference to a qualified function type. Fixes PR7470.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108209 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 23:11:43 +00:00