summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse
Commit message (Collapse)AuthorAgeFilesLines
* Refactor how we collect attributes during parsing, and add slots for attributesJohn McCall2010-12-249-401/+308
| | | | | | | on array and function declarators. This is pretty far from complete, and I'll revisit it later if someone doesn't beat me to it. llvm-svn: 122535
* Improve the diagnostic and recovery for missing colons after 'case'Douglas Gregor2010-12-231-12/+16
| | | | | | | | | | | | | | | and 'default' statements, including a Fix-It to add the colon: test/Parser/switch-recovery.cpp:13:12: error: expected ':' after 'case' case 17 // expected-error{{expected ':' after 'case'}} ^ : test/Parser/switch-recovery.cpp:16:12: error: expected ':' after 'default' default // expected-error{{expected ':' after 'default'}} ^ : llvm-svn: 122522
* Implement parsing of function parameter packs and non-type templateDouglas Gregor2010-12-232-5/+27
| | | | | | | | | | | | parameter packs (C++0x [dcl.fct]p13), including disambiguation between unnamed function parameter packs and varargs (C++0x [dcl.fct]p14) for cases like void f(T...) where T may or may not contain unexpanded parameter packs. llvm-svn: 122520
* Fix a major inconsistency in the representation of Objective-CDouglas Gregor2010-12-211-9/+4
| | | | | | | | | | | | | | | | | | | | classes, categories, protocols, and class extensions, where the methods and properties of these entities would be inserted into the DeclContext in an ordering that doesn't necessarily reflect source order. The culprits were Sema::ActOnMethodDeclaration(), which did not perform the insertion of the just-created method declaration into the DeclContext for these Objective-C entities, and Sema::ActOnAtEnd(), which inserted all method declarations at the *end* of the DeclContext. With this fix in hand, clean up the code-completion actions for property setters/getters that worked around this brokenness in the AST. Fixes <rdar://problem/8062781>, where this problem manifested as poor token-annotation information, but this would have struck again in many other places. llvm-svn: 122347
* Extend the parser to support pack expansions within exceptionDouglas Gregor2010-12-201-2/+13
| | | | | | | specifications. We can't yet instantiate them, however, since I tripped over PR8835. llvm-svn: 122292
* Introduce a new type, PackExpansionType, to capture types that areDouglas Gregor2010-12-201-0/+5
| | | | | | | | | | | | | | | | | | | | pack expansions, e.g. given template<typename... Types> struct tuple; template<typename... Types> struct tuple_of_refs { typedef tuple<Types&...> types; }; the type of the "types" typedef is a PackExpansionType whose pattern is Types&. This commit introduces support for creating pack expansions for template type arguments, as above, but not for any other kind of pack expansion, nor for any form of instantiation. llvm-svn: 122223
* Warn when synthesizing a property which isFariborz Jahanian2010-12-171-0/+2
| | | | | | | implicitly atomic under -Wimplicit-atomic-properties flag. // rdar://8774580 llvm-svn: 122095
* fix typoChris Lattner2010-12-171-1/+1
| | | | llvm-svn: 122041
* Added ParenType type node.Abramo Bagnara2010-12-104-14/+9
| | | | llvm-svn: 121488
* Remove the TypesCompatibleExprClass AST node. Merge its functionality into ↵Francois Pichet2010-12-082-21/+3
| | | | | | BinaryTypeTraitExpr. llvm-svn: 121298
* Handle parameter attributes when tentative parsing for function/variable ↵Argyrios Kyrtzidis2010-12-081-4/+9
| | | | | | | | disambiguation. Fixes rdar://8739801. llvm-svn: 121228
* Fix enumerator not handled in switch warnings.Francois Pichet2010-12-071-2/+2
| | | | llvm-svn: 121084
* Type traits intrinsic implementation: __is_base_of(T, U)Francois Pichet2010-12-072-1/+48
| | | | | | New AST node introduced: BinaryTypeTraitExpr; to be reused for more intrinsics. llvm-svn: 121074
* Although we currently have explicit lvalue-to-rvalue conversions, they'reJohn McCall2010-12-041-3/+9
| | | | | | | | | | | | | | | | | | | not actually frequently used, because ImpCastExprToType only creates a node if the types differ. So explicitly create an ICE in the lvalue-to-rvalue conversion code in DefaultFunctionArrayLvalueConversion() as well as several other new places, and consistently deal with the consequences throughout the compiler. In addition, introduce a new cast kind for loading an ObjCProperty l-value, and make sure we emit those nodes whenever an ObjCProperty l-value appears that's not on the LHS of an assignment operator. This breaks a couple of rewriter tests, which I've x-failed until future development occurs on the rewriter. Ted Kremenek kindly contributed the analyzer workarounds in this patch. llvm-svn: 120890
* Added struct/class syntactic info for c++0x scoped enum.Abramo Bagnara2010-12-032-5/+8
| | | | llvm-svn: 120828
* Fixed source range for MS asm statement.Abramo Bagnara2010-12-021-4/+7
| | | | llvm-svn: 120724
* Not content to implement just "extern" explicit templateDouglas Gregor2010-12-011-4/+30
| | | | | | | | | instantiations, GCC also supports "inline" and "static" explicit template instantiations. Parse and warn about such constructs, but don't implement the semantics of either "inline" or "static". They don't seem to be widely used. llvm-svn: 120599
* After parsing a ':' in an enum-specifier within class context,Douglas Gregor2010-12-012-4/+160
| | | | | | | | | | disambiguate between an expression (for a bit-field width) and a type (for a fixed underlying type). Since the disambiguation can be expensive (due to tentative parsing), we perform a simplistic disambiguation based on one-token lookahead before going into the full-blown tentative parsing. Based on a patch by Daniel Wallin. llvm-svn: 120582
* Remove the other FIXME I added. This is covered by the Index test and not ↵Nico Weber2010-11-221-2/+0
| | | | | | testable via -ast-dump. llvm-svn: 119971
* Remove one I just added, add a more focused test for why the current code is ↵Nico Weber2010-11-221-2/+0
| | | | | | correct. llvm-svn: 119969
* Try to get the bots green after r119966.Nico Weber2010-11-222-4/+7
| | | | llvm-svn: 119968
* Fix the source range of CXXNewExprs. Fixes http://llvm.org/pr8661.Nico Weber2010-11-223-7/+10
| | | | llvm-svn: 119966
* Revert r119838 "Don't warn for empty 'if' body if there is a macro that ↵Argyrios Kyrtzidis2010-11-201-15/+7
| | | | | | | | | | expands to nothing" and use a better and more general approach, where NullStmt has a flag to indicate whether it was preceded by an empty macro. Thanks to Abramo Bagnara for the hint! llvm-svn: 119887
* Don't warn for empty 'if' body if there is a macro that expands to nothing, e.g:Argyrios Kyrtzidis2010-11-191-3/+13
| | | | | | | | | if (condition) CALL(0); // empty macro but don't warn for empty body. Fixes rdar://8436021. llvm-svn: 119838
* When parsing something that looks like an ill-formedDouglas Gregor2010-11-192-8/+8
| | | | | | | | protocol-qualifier list without a leading type (e.g., <#blah#>), don't complain about it being an archaic protocol-qualifier list unless it actually parses as one. llvm-svn: 119805
* Refactoring.Argyrios Kyrtzidis2010-11-191-2/+1
| | | | | | Move ErrorTrap from clang/Sema to clang/Basic as DiagnosticErrorTrap and use it in Scope. llvm-svn: 119763
* Refactoring of Diagnostic class.Argyrios Kyrtzidis2010-11-181-1/+1
| | | | | | | | | | | -Move the stuff of Diagnostic related to creating/querying diagnostic IDs into a new DiagnosticIDs class. -DiagnosticIDs can be shared among multiple Diagnostics for multiple translation units. -The rest of the state in Diagnostic object is considered related and tied to one translation unit. -Have Diagnostic point to the SourceManager that is related with. Diagnostic can now accept just a SourceLocation instead of a FullSourceLoc. -Reflect the changes to various interfaces. llvm-svn: 119730
* In some situations, TemplateArgumentLoc wasn't setting TypeSourceLoc (seeCraig Silverstein2010-11-181-1/+1
| | | | | | | | | http://llvm.org/bugs/show_bug.cgi?id=8558). This patch fixes it. Thanks to rjmccall for all the coaching! Approved by rjmccall llvm-svn: 119697
* For an Objective-C @synthesize statement, e.g.,Douglas Gregor2010-11-171-3/+4
| | | | | | | | | @synthesize foo = _foo; keep track of the location of the ivar ("_foo"). Teach libclang to visit the ivar as a member reference. llvm-svn: 119447
* Emit a specific diagnostic when typedefing C++ bool, mirroring gcc.Argyrios Kyrtzidis2010-11-161-2/+10
| | | | | | Fixes rdar://8365458 llvm-svn: 119359
* Region-allocate all AttributeList objects from a factory object instead of ↵Ted Kremenek2010-11-104-113/+84
| | | | | | | | | | | | | | | | | | | | | | | | manually managing them using new/delete and OwningPtrs. After memory profiling Clang, I witnessed periodic leaks of these objects; digging deeper into the code, it was clear that our management of these objects was a mess. The ownership rules were murky at best, and not always followed. Worse, there are plenty of error paths where we could screw up. This patch introduces AttributeList::Factory, which is a factory class that creates AttributeList objects and then blows them away all at once. While conceptually simple, most of the changes in this patch just have to do with migrating over to the new interface. Most of the changes have resulted in some nice simplifications. This new strategy currently holds on to all AttributeList objects during the lifetime of the Parser object. This is easily tunable. If we desire to have more bound the lifetime of AttributeList objects more precisely, we can have the AttributeList::Factory object (in Parser) push/pop its underlying allocator as we enter/leave key methods in the Parser. This means that we get simple memory management while still having the ability to finely control memory use if necessary. Note that because AttributeList objects are now BumpPtrAllocated, we may reduce malloc() traffic in many large files with attributes. This fixes the leak reported in: <rdar://problem/8650003> llvm-svn: 118675
* Diagnose attempst to template using declarations and using directives.John McCall2010-11-103-17/+65
| | | | | | Recover from the latter and fail early for the former. Fixes PR8022. llvm-svn: 118669
* Issues good diagnostic when @end is missing.Fariborz Jahanian2010-11-091-0/+1
| | | | | | // rdar://8283484 llvm-svn: 118629
* tidy upChris Lattner2010-11-091-5/+5
| | | | llvm-svn: 118626
* fix PR8380, a crash on invalid due to an illogical DeclSpec SourceRange ↵Chris Lattner2010-11-092-1/+1
| | | | | | being constructed. llvm-svn: 118625
* Make this error less specific but also less likely to cause confusion. FixesNick Lewycky2010-11-031-1/+1
| | | | | | PR7702. llvm-svn: 118181
* Properly handle temporaries that are created in a AsmStmt.Argyrios Kyrtzidis2010-11-021-1/+1
| | | | | | Previously the temporaries would get destroyed before the asm call. llvm-svn: 118001
* Diagnose a coherant message when @interfaceFariborz Jahanian2010-11-021-1/+6
| | | | | | | does not terminate with @end. // rdar: //7824372 llvm-svn: 117991
* Clean up temporaries created by an asm statement. Fixes rdar://8540491Argyrios Kyrtzidis2010-11-011-0/+1
| | | | llvm-svn: 117961
* Parse attributes on enumerators and instantiate attributes on enum decls.John McCall2010-10-221-1/+6
| | | | llvm-svn: 117182
* Teach the C++ simple-type-specifier parser and tentative parses aboutDouglas Gregor2010-10-214-66/+118
| | | | | | protocol-qualified types such as id<Protocol>. llvm-svn: 117081
* Diagnose the declaration of template template parameters thatDouglas Gregor2010-10-211-1/+1
| | | | | | | | themselves have no template parameters. This is actually a restriction due to the grammar of template template parameters, but we choose to diagnose it in Sema to provide better recovery. llvm-svn: 117032
* Tag references shouldn't ever get template parameter lists.John McCall2010-10-191-4/+9
| | | | | | Fixes rdar://problem/8568507 llvm-svn: 116843
* Redirect templated friend class decls to a new Sema callback andJohn McCall2010-10-191-3/+14
| | | | | | | construct an unsupported friend when there's a friend with a templated scope specifier. Fixes a consistency crash, rdar://problem/8540527 llvm-svn: 116786
* Provide code completion for types after the '^' that starts a blockDouglas Gregor2010-10-181-0/+5
| | | | | | literal. llvm-svn: 116754
* When we are missing the ',' or '>' to terminate a template parameterDouglas Gregor2010-10-151-1/+1
| | | | | | list, complain about it! Fixes PR7053. llvm-svn: 116551
* Parse default arguments within member functions in source order, fromDouglas Gregor2010-10-122-143/+167
| | | | | | Manuel Klimek! Fixes PR7715. llvm-svn: 116311
* Fix spelling error.Cameron Esfahani2010-10-121-1/+1
| | | | llvm-svn: 116283
* Add parsing support for Microsoft attributes. MS attributes will just be ↵Francois Pichet2010-10-114-0/+36
| | | | | | skipped and not inserted into the AST for now. llvm-svn: 116203
* Implement C++0x scoped enumerations, from Daniel Wallin! (and tweaked aDouglas Gregor2010-10-082-2/+43
| | | | | | bit by me). llvm-svn: 116122
OpenPOWER on IntegriCloud