summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse
Commit message (Collapse)AuthorAgeFilesLines
* Add parentheses suggested by gcc.Duncan Sands2010-06-231-2/+2
| | | | llvm-svn: 106668
* improve altivec vector bool/pixel support, patch by Anton YartsevChris Lattner2010-06-231-8/+47
| | | | | | with several tweaks by me. llvm-svn: 106619
* Fix PR7180.Argyrios Kyrtzidis2010-06-221-6/+4
| | | | | | | | | | | For void f( a::b::c ); we would cache the tokens "a::b::" but then we would try to annotate them using the range "a::". Before annotating them with the (invalid) C++ scope spec, set it to the range of "a::b::". llvm-svn: 106536
* When semantic analysis fail to introduce a class or class template,Douglas Gregor2010-06-211-30/+35
| | | | | | | | just skip over the body of the class or class template: it's a semantic disaster that's likely to cause invariants to break. Fixes part of <rdar://problem/8104754>. llvm-svn: 106496
* Cure for Doug's insomnia.Argyrios Kyrtzidis2010-06-191-3/+3
| | | | llvm-svn: 106394
* Implements Sema part of init_priority(priority) attributeFariborz Jahanian2010-06-181-0/+1
| | | | | | (radar 8076356) - wip. llvm-svn: 106322
* Make sure the caching mechanism in Parser::ParseLexedMethodDefs is robust ↵Argyrios Kyrtzidis2010-06-171-4/+16
| | | | | | against the parser reading too few tokens. llvm-svn: 106214
* Make sure parens/braces/brackets are correctly balanced.Argyrios Kyrtzidis2010-06-174-1/+33
| | | | | | | | | | | In a line like: (; the semicolon leaves Parser:ParenCount unbalanced (it's 1 even though we stopped looking for a right paren). This may affect later parsing and result in bad recovery for parsing errors. llvm-svn: 106213
* Per conversation with Doug, remove two assertions in ParseLexedMethodDefs() thatTed Kremenek2010-06-171-5/+3
| | | | | | didn't indicate violated invariants but that we weren't recovering well. llvm-svn: 106195
* Update CMake build for new attribute changes.Alexis Hunt2010-06-171-1/+1
| | | | llvm-svn: 106188
* When parsing cached C++ method declarations/definitions, save theDouglas Gregor2010-06-161-0/+2
| | | | | | | | "previous token" location at the end of the class definition. This eliminates a badly-placed error + Fix-It when the ';' following a class definition is missing. Fixes <rdar://problem/8066414>. llvm-svn: 106175
* Make the "extra ';' inside a struct or union" diagnostic moreDouglas Gregor2010-06-163-1/+3
| | | | | | precise. Fixes PR7336. llvm-svn: 106170
* When we see a 'template' disambiguator that marks the next identifierDouglas Gregor2010-06-162-45/+46
| | | | | | | | | | | (or operator-function-id) as a template, but the context is actually non-dependent or the current instantiation, allow us to use knowledge of what kind of template it is, e.g., type template vs. function template, for further syntactic disambiguation. This allows us to parse properly in the presence of stray "template" keywords, which is necessary in C++0x and it's good recovery in C++98/03. llvm-svn: 106167
* Fix the recently-added warning about 'typename' and 'template'Douglas Gregor2010-06-163-11/+15
| | | | | | | | | disambiguation keywords outside of templates in C++98/03. Previously, the warning would fire when the associated nested-name-specifier was not dependent, but that was a misreading of the C++98/03 standard: now, we complain only when we're outside of any template. llvm-svn: 106161
* Add some missing parentheses, from Anton YartsevDouglas Gregor2010-06-161-1/+1
| | | | llvm-svn: 106101
* Allow an asm label specifier on C++ methods, like GCC does.Chris Lattner2010-06-131-2/+11
| | | | | | Patch by David Majnemer! llvm-svn: 105909
* Makefiles: Set Clang CPP compiler flags in a single location, instead of ↵Daniel Dunbar2010-06-081-2/+0
| | | | | | scattered throughout the project Makefiles. llvm-svn: 105638
* Makefile: Switch Clang Makefiles to always include the top-level Clang Makefile.Daniel Dunbar2010-06-081-2/+2
| | | | | | - This eliminates most dependencies on how Clang is installed relative to LLVM. llvm-svn: 105637
* Added AccessSpecDecl node.Abramo Bagnara2010-06-051-1/+6
| | | | llvm-svn: 105525
* Properly disambiguate between an elaborated-type-specifier and aDouglas Gregor2010-06-041-2/+31
| | | | | | type-parameter within a template parameter list. Found by inspection. llvm-svn: 105462
* Fix compiler warning about to false -> pointer conversion; patch by Dimitry ↵Daniel Dunbar2010-06-021-1/+1
| | | | | | Andric! llvm-svn: 105328
* Minor tweaks on doug's objc recovery patch: the callerChris Lattner2010-05-312-7/+12
| | | | | | | | | | | | of isSimpleObjCMessageExpression checks the language, so change a dynamic check into an assert. isSimpleObjCMessageExpression is expensive, so only do it in the common case when it is likely to matter: when the [ of the postfix expr starts on a new line. This should avoid doing lookahead for every array expression. llvm-svn: 105229
* When we see the a '[' in a postfix expression in Objective-C, performDouglas Gregor2010-05-312-0/+18
| | | | | | | | | | | | | | | | | | | a simple, quick check to determine whether the expression starting with '[' can only be an Objective-C message send. If so, don't parse it as an array subscript expression. This improves recovery for, e.g., [a method1] [a method2] so that we now produce t.m:10:13: error: expected ';' after expression [a method] ^ instead of some mess about expecting ']'. llvm-svn: 105221
* Don't try to parse class template specializations in C. It can onlyDouglas Gregor2010-05-301-3/+1
| | | | | | lead to heartache. Fixes <rdar://problem/8044088>. llvm-svn: 105178
* Improve parser recovery when we try to parse a call expression but theDouglas Gregor2010-05-301-1/+8
| | | | | | | called function itself is invalid (e.g., because of a semantic error referring to that declaration). Fixes <rdar://problem/8044142>. llvm-svn: 105175
* Teach code completion to adjust its completion priorities based on theDouglas Gregor2010-05-303-0/+22
| | | | | | | | | type that we expect to see at a given point in the grammar, e.g., when initializing a variable, returning a result, or calling a function. We don't prune the candidate set at all, just adjust priorities to favor things that should type-check, using an ultra-simplified type system. llvm-svn: 105128
* Empty enum in c is now error to match gcc's behavior.Fariborz Jahanian2010-05-281-1/+1
| | | | | | (radar 8040068). llvm-svn: 105011
* Roll back r104941.John McCall2010-05-281-1/+0
| | | | llvm-svn: 104990
* Add a new attribute on records, __attribute__((adl_invisible)), and defineJohn McCall2010-05-281-0/+1
| | | | | | | | | | | | the x86-64 __va_list_tag with this attribute. The attribute causes the affected type to behave like a fundamental type when considered by ADL. (x86-64 is the only target we currently provide with a struct-based __builtin_va_list) Fixes PR6762. llvm-svn: 104941
* Don't just skip over the entire tag definition if the parser action didn'tJohn McCall2010-05-281-10/+8
| | | | | | | give us a decl back. Makes -cc1 -parse-noop handle a substantially larger amount of the C++ grammar. llvm-svn: 104940
* Make -code-completion-patterns only cover multi-line codeDouglas Gregor2010-05-281-1/+1
| | | | | | | completions. Plus, tweak a few completion patterns to better reflect the language grammar. llvm-svn: 104905
* Implement a code-completion hook for the receiver of an Objective-CDouglas Gregor2010-05-271-0/+7
| | | | | | | message. This completion gives better results than just using the "expression" completion, which is effectively what happened before. llvm-svn: 104895
* Parse/Sema: Add support for '#pragma options align=packed', which, it should beDaniel Dunbar2010-05-271-0/+2
| | | | | | noted, is not the same as __attribute__((packed)). That would be ridiculous! llvm-svn: 104865
* Parse/Sema: Add support for '#pragma options align=native'.Daniel Dunbar2010-05-271-3/+5
| | | | llvm-svn: 104864
* When we've parsed a nested-name-specifier in a member accessDouglas Gregor2010-05-271-0/+2
| | | | | | | expression, "forget" about the object type; only the nested-name-specifier matters for name lookup purposes. Fixes PR7239. llvm-svn: 104834
* Parse: Add support for '#pragma options align'.Daniel Dunbar2010-05-263-2/+67
| | | | | | Also, fix a source location bug with the rparen in #pragma pack. llvm-svn: 104784
* Improve code completion in failure cases in two ways:Douglas Gregor2010-05-257-44/+64
| | | | | | | | | | | 1) Suppress diagnostics as soon as we form the code-completion token, so we don't get any error/warning spew from the early end-of-file. 2) If we consume a code-completion token when we weren't expecting one, go into a code-completion recovery path that produces the best results it can based on the context that the parser is in. llvm-svn: 104585
* improve the fixit for the missing : error when parsing ?:. WhenChris Lattner2010-05-241-1/+22
| | | | | | | | | | | | | | | | | | | | there are already two spaces before the token where the : was expected, put the : in between the spaces. This means we get it right in both of these cases: t.c:2:17: error: expected ':' return a ? b c; ^ : t.c:3:16: error: expected ':' return a ? b c; ^ : In the later case, the diagnostic says to insert ": ", in the former case it says to insert ":" between the spaces. This fixes rdar://8007231 llvm-svn: 104569
* Improve recovery when we see a dependent template name that is missingDouglas Gregor2010-05-212-1/+31
| | | | | | | | | | | | | | | the required "template" keyword, using the same heuristics we do for dependent template names in member access expressions, e.g., test/SemaTemplate/dependent-template-recover.cpp:11:8: error: use 'template' keyword to treat 'getAs' as a dependent template name T::getAs<U>(); ^ template Fixes PR5404. llvm-svn: 104409
* Improve parser recovery when we encounter a dependent template nameDouglas Gregor2010-05-214-8/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that is missing the 'template' keyword, e.g., t->getAs<T>() where getAs is a member of an unknown specialization. C++ requires that we treat "getAs" as a value, but that would fail to parse since T is the name of a type. We would then fail at the '>', since a type cannot be followed by a '>'. This is a very common error for C++ programmers to make, especially since GCC occasionally allows it when it shouldn't (as does Visual C++). So, when we are in this case, we use tentative parsing to see if the tokens starting at "<" can only be parsed as a template argument list. If so, we produce a diagnostic with a fix-it that states that the 'template' keyword is needed: test/SemaTemplate/dependent-template-recover.cpp:5:8: error: 'template' keyword is required to treat 'getAs' as a dependent template name t->getAs<T>(); ^ template This is just a start of this patch; I'd like to apply the same approach to everywhere that a template-id with dependent template name can be parsed. llvm-svn: 104406
* Propagate access specifiers to anonymous union members nested within classes.John McCall2010-05-214-5/+6
| | | | | | Fixes <rdar://problem/7987650>. llvm-svn: 104376
* Improve parser recovery when a switch condition is invalid; fixesDouglas Gregor2010-05-201-3/+4
| | | | | | <rdar://problem/7971948>. llvm-svn: 104291
* Added basic source locations to Elaborated and DependentName types.Abramo Bagnara2010-05-191-1/+1
| | | | llvm-svn: 104169
* Add clang support for IBOutletCollection.Ted Kremenek2010-05-191-0/+1
| | | | llvm-svn: 104135
* Add support for Microsoft's __thiscall, from Steven Watanabe!Douglas Gregor2010-05-183-4/+15
| | | | llvm-svn: 104026
* mutable is a storage class that can follow a class/struct/union definition. ↵Douglas Gregor2010-05-171-0/+1
| | | | | | Fixes PR7153 llvm-svn: 103954
* Improve error recovery in C/ObjC when the first argument of a functionChris Lattner2010-05-141-5/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | declarator is incorrect. Not being a typename causes the parser to dive down into the K&R identifier list handling stuff, which is almost never the right thing to do. Before: r.c:3:17: error: expected ')' void bar(intptr y); ^ r.c:3:9: note: to match this '(' void bar(intptr y); ^ r.c:3:10: error: a parameter list without types is only allowed in a function definition void bar(intptr y); ^ After: r.c:3:10: error: unknown type name 'intptr'; did you mean 'intptr_t'? void bar(intptr y); ^~~~~~ intptr_t r.c:1:13: note: 'intptr_t' declared here typedef int intptr_t; ^ This fixes rdar://7980651 - poor recovery for bad type in the first arg of a C function llvm-svn: 103783
* Refactor ParseFunctionDeclaratorIdentifierList to have the firstChris Lattner2010-05-141-11/+18
| | | | | | | identifier in the identifier list consumed before it is called. No functionality change. llvm-svn: 103781
* Namespaces can only be defined at global or namespace scope. Fixes PR6596.Douglas Gregor2010-05-141-0/+8
| | | | llvm-svn: 103767
* Fixed DISABLE_SMART_POINTERS breakageDouglas Gregor2010-05-061-1/+3
| | | | llvm-svn: 103198
OpenPOWER on IntegriCloud