summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Patch should implement packed enums - PR4098. Credit to Anders Johnsen.Edward O'Callaghan2009-08-081-5/+6
| | | | llvm-svn: 78471
* First pass at friend semantics.John McCall2009-08-061-2/+9
| | | | llvm-svn: 78274
* Refactor methods on DeclSpec to take a diagnostic& parameter, and reflect thisJohn McCall2009-08-031-92/+130
| | | | | | | | elsewhere. Very slightly decouples DeclSpec users from knowing the exact diagnostics to report, and makes it easier to provide different diagnostics in some places. llvm-svn: 77990
* Rename Action::TagKind to Action::TagUseKind, which removes both a misnomerJohn McCall2009-07-311-5/+5
| | | | | | and a name collision. llvm-svn: 77658
* sp.John McCall2009-07-311-1/+1
| | | | llvm-svn: 77656
* Clean up the ActOnTag action, so that there is only a single entryDouglas Gregor2009-07-231-0/+1
| | | | | | | | | point that covers templates and non-templates. This should eliminate the flood of warnings I introduced yesterday. Removed the ActOnClassTemplate action, which is no longer used. llvm-svn: 76881
* Issue a more descriptive diagnostics when mis-declaringFariborz Jahanian2009-07-201-2/+2
| | | | | | a destructor. llvm-svn: 76436
* Basic support for C++0x unicode types. Support for literals will follow in ↵Alisdair Meredith2009-07-141-0/+19
| | | | | | an incremental patch llvm-svn: 75622
* Pass the right brace SourceLocation from the Parser to the TagDecls.Argyrios Kyrtzidis2009-07-141-2/+2
| | | | llvm-svn: 75591
* Implement more of C++0x 'auto'. A variable with an auto type specifier must ↵Anders Carlsson2009-07-111-1/+3
| | | | | | have an initializer. Also, move some tests around to match the C++0x draft better. llvm-svn: 75322
* Parsing fix for out-of-line constructors, from Piotr RakDouglas Gregor2009-07-061-2/+4
| | | | llvm-svn: 74833
* Keep track of the Expr used to describe the size of an array type,Douglas Gregor2009-07-061-4/+6
| | | | | | from Enea Zaffanella! llvm-svn: 74831
* Fix: <rdar://problem/7021553> clang -fsyntax-only crashes (in ↵Ted Kremenek2009-06-301-4/+4
| | | | | | | | | ParseDeclarationSpecifiers ... from ParseObjCTypeName) Another case where we should use SmallVector::data() instead of taking the address of element 0 of a SmallVector when the SmallVector has no elements. llvm-svn: 74556
* Fix test.Anders Carlsson2009-06-261-0/+7
| | | | llvm-svn: 74358
* Implement enough of the 'auto' keyword so we can claim to support N2546.Anders Carlsson2009-06-261-1/+4
| | | | llvm-svn: 74307
* OpenCL 1.0 support: attributesNate Begeman2009-06-261-2/+25
| | | | llvm-svn: 74280
* Parse the C++0x decltype specifier.Anders Carlsson2009-06-241-0/+10
| | | | llvm-svn: 74086
* Start propagating template parameter lists to the right places toDouglas Gregor2009-06-231-2/+9
| | | | | | | handle function templates. There's no actual code for function templates yet, but at least we complain about typedef templates. llvm-svn: 74021
* Implement implicit instantiation of the member functions of a class templateDouglas Gregor2009-06-221-1/+1
| | | | | | | specialization. At present, all implicit instantiations occur at the end of the translation unit. llvm-svn: 73915
* Keep track of when declarations are "used" according to C andDouglas Gregor2009-06-191-2/+6
| | | | | | | | | | | | C++. This logic is required to trigger implicit instantiation of function templates and member functions of class templates, which will be implemented separately. This commit includes support for -Wunused-parameter, printing warnings for named parameters that are not used within a function/Objective-C method/block. Fixes <rdar://problem/6505209>. llvm-svn: 73797
* Implement correct name lookup inside an initializer of a C++ class static ↵Argyrios Kyrtzidis2009-06-171-0/+7
| | | | | | | | data member. Fixes "test/CXX/basic/basic.lookup/basic.lookup.unqual/p13.cpp" test case. llvm-svn: 73652
* It's an error to use a function declared in a class definition as a default ↵Anders Carlsson2009-06-121-1/+2
| | | | | | argument before the function has been declared. llvm-svn: 73234
* Add more parser support for Microsoft extensions.Eli Friedman2009-06-081-23/+48
| | | | llvm-svn: 73101
* Add real parsing for __declspec. It doesn't make much of a difference Eli Friedman2009-06-081-11/+43
| | | | | | at the moment because we ignore the result. llvm-svn: 73056
* Disallow exception specs on typedefs.Sebastian Redl2009-05-311-3/+8
| | | | llvm-svn: 72664
* AddInitializerToDecl needs to take a full expression.Anders Carlsson2009-05-301-1/+1
| | | | llvm-svn: 72640
* Reject incomplete types in exception specs.Sebastian Redl2009-05-291-18/+24
| | | | llvm-svn: 72580
* If a declarator group declares a type, make sure to add that declaration Eli Friedman2009-05-291-1/+2
| | | | | | to the DeclGroup. llvm-svn: 72559
* When we parse a tag specifier, keep track of whether that tagDouglas Gregor2009-05-281-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | specifier resulted in the creation of a new TagDecl node, which happens either when the tag specifier was a definition or when the tag specifier was the first declaration of that tag type. This information has several uses, the first of which is implemented in this commit: 1) In C++, one is not allowed to define tag types within a type specifier (e.g., static_cast<struct S { int x; } *>(0) is ill-formed) or within the result or parameter types of a function. We now diagnose this. 2) We can extend DeclGroups to contain information about any tags that are declared/defined within the declaration specifiers of a variable, e.g., struct Point { int x, y, z; } p; This will help improve AST printing and template instantiation, among other things. 3) For C99, we can keep track of whether a tag type is defined within the type of a parameter, to properly cope with cases like, e.g., int bar(struct T2 { int x; } y) { struct T2 z; } We can also do similar things wherever there is a type specifier, e.g., to keep track of where the definition of S occurs in this legal C99 code: (struct S { int x, y; } *)0 llvm-svn: 72555
* Refactor the common code of 'ParseTypeofSpecifier' and ↵Argyrios Kyrtzidis2009-05-221-38/+22
| | | | | | | | 'ParseSizeofAlignofExpression' into a new 'ParseExprAfterTypeofSizeofAlignof' method. llvm-svn: 72256
* Parse typeof-specifier the same way as sizeof/alignof are parsed.Argyrios Kyrtzidis2009-05-221-48/+39
| | | | | | | | -Makes typeof consistent with sizeof/alignof -Fixes a bug when '>' is in a typeof expression, inside a template type param: A<typeof(x>1)> a; llvm-svn: 72255
* Merge the ASTVector and ASTOwningVector templates, since they offeredDouglas Gregor2009-05-211-1/+0
| | | | | | | | redundant functionality. The result (ASTOwningVector) lives in clang/Parse/Ownership.h and is used by both the parser and semantic analysis. No intended functionality change. llvm-svn: 72214
* Use v.data() instead of &v[0] when SmallVector v might be empty.Jay Foad2009-05-211-5/+5
| | | | llvm-svn: 72210
* Implement a FIXME, we now pass in the locations of the braces for enums.Mike Stump2009-05-161-3/+3
| | | | llvm-svn: 71930
* Implement parsing for explicit instantiations of class templates, e.g.,Douglas Gregor2009-05-121-17/+11
| | | | | | | | | template class X<int>; This also cleans up the propagation of template information through declaration parsing, which is used to improve some diagnostics. llvm-svn: 71608
* Refactor the parsing of declarations so that template declarations canDouglas Gregor2009-05-121-68/+89
| | | | | | | | | | parse just a single declaration and provide a reasonable diagnostic when the "only one declarator per template declaration" rule is violated. This eliminates some ugly, ugly hackery where we used to require thatn the layout of a DeclGroup of a single element be the same as the layout of a single declaration. llvm-svn: 71596
* Add parsing of friend specifiers.Anders Carlsson2009-05-061-0/+7
| | | | llvm-svn: 71067
* Rework the way we handle constructor decls to be less hacky and fix PR3948 ↵Anders Carlsson2009-04-301-10/+11
| | | | | | completely. llvm-svn: 70516
* Just because a declaration has the same name as its containing class doesn't ↵Anders Carlsson2009-04-291-10/+10
| | | | | | mean that it's a constructor. Fixes rdar://problem/6815988. llvm-svn: 70436
* Have the parser communicate the exception specification to the action.Sebastian Redl2009-04-291-6/+31
| | | | llvm-svn: 70389
* This is a pretty big cleanup for how invalid decl/type are handle.Chris Lattner2009-04-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This gets rid of a bunch of random InvalidDecl bools in sema, changing us to use the following approach: 1. When analyzing a declspec or declarator, if an error is found, we set a bit in Declarator saying that it is invalid. 2. Once the Decl is created by sema, we immediately set the isInvalid bit on it from what is in the declarator. From this point on, sema consistently looks at and sets the bit on the decl. This gives a very clear separation of concerns and simplifies a bunch of code. In addition to this, this patch makes these changes: 1. it renames DeclSpec::getInvalidType() -> isInvalidType(). 2. various "merge" functions no longer return bools: they just set the invalid bit on the dest decl if invalid. 3. The ActOnTypedefDeclarator/ActOnFunctionDeclarator/ActOnVariableDeclarator methods now set invalid on the decl returned instead of returning an invalid bit byref. 4. In SemaType, refering to a typedef that was invalid now propagates the bit into the resultant type. Stuff declared with the invalid typedef will now be marked invalid. 5. Various methods like CheckVariableDeclaration now return void and set the invalid bit on the decl they check. There are a few minor changes to tests with this, but the only major bad result is test/SemaCXX/constructor-recovery.cpp. I'll take a look at this next. llvm-svn: 70020
* fix the sizeof error recovery issue (sizeof-interface.m:attributeRuns)Chris Lattner2009-04-241-0/+1
| | | | | | | | by correctly propagating the fact that the type was invalid up to the attributeRuns decl, then returning an ExprError when attributeRuns is formed (like we do for normal declrefexprs). llvm-svn: 69998
* Fixup codegen for write barriers for block variables. Radar 6786715Mike Stump2009-04-211-1/+1
| | | | llvm-svn: 69642
* Make the implicit-int handling error recovery stuff handle C++Chris Lattner2009-04-141-20/+34
| | | | | | | | | | | | | | | | | | | nested name specifiers. Now we emit stuff like: t.cpp:8:13: error: unknown type name 'X' static foo::X P; ~~~~ ^ instead of: t.cpp:8:16: error: invalid token after top level declarator static foo::X P; ^ This is inspired by a really awful error message I got from g++ when I misspelt diag::kind as diag::Kind. llvm-svn: 69086
* refactor "implicit int error recovery" code out of Chris Lattner2009-04-141-62/+83
| | | | | | | ParseDeclarationSpecifiers into its own function, no functionality change. llvm-svn: 69083
* Fix a regression in a previous patch that broke implicit Chris Lattner2009-04-141-2/+4
| | | | | | int in a bitfield. Shantonu found this in a gcc testsuite file. llvm-svn: 69074
* fix a comment typo Sebastian noticed.Chris Lattner2009-04-121-1/+1
| | | | llvm-svn: 68921
* add support for handling C++'0x unified initializer syntaxChris Lattner2009-04-121-2/+2
| | | | | | to isValidAfterIdentifierInDeclarator, as suggested by Sebastian. llvm-svn: 68920
* Fix some C++ error recovery problems in init declarator parsingChris Lattner2009-04-121-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that I noticed working on other things. Instead of emitting: t2.cc:1:8: error: use of undeclared identifier 'g' int x(*g); ^ t2.cc:1:10: error: expected ')' int x(*g); ^ t2.cc:1:6: note: to match this '(' int x(*g); ^ We now only emit: t2.cc:1:7: warning: type specifier missing, defaults to 'int' int x(*g); ^ Note that the example in SemaCXX/nested-name-spec.cpp:f4 is still not great, we now produce both of: void f4(undef::C); // expected-error {{use of undeclared identifier 'undef'}} \ expected-error {{variable has incomplete type 'void'}} The second diagnostic should be silenced by something getting marked invalid. I don't plan to fix this though. llvm-svn: 68919
* mark the declspec as invalid when we recover instead of forcing to int,Chris Lattner2009-04-121-3/+3
| | | | | | this allows downstream diags to be properly silenced. llvm-svn: 68917
OpenPOWER on IntegriCloud