summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add support for parsing and representing C++ constructor declarations.Douglas Gregor2008-10-311-2/+33
| | | | | | | | | | | | | | | Notes: - Constructors are never found by name lookup, so they'll never get pushed into any scope. Instead, they are stored as an OverloadedFunctionDecl in CXXRecordDecl for easy overloading. - There's a new action isCurrentClassName that determines whether an identifier is the name of the innermost class currently being defined; we use this to identify the declarator-id grammar rule that refers to a type-name. - MinimalAction does *not* support parsing constructors. - We now handle virtual and explicit function specifiers. llvm-svn: 58499
* Implement initialization of a reference (C++ [dcl.init.ref]) as partDouglas Gregor2008-10-291-0/+2
| | | | | | | | | | | | | | | | | | | of copy initialization. Other pieces of the puzzle: - Try/Perform-ImplicitConversion now handles implicit conversions that don't involve references. - Try/Perform-CopyInitialization uses CheckSingleAssignmentConstraints for C. PerformCopyInitialization is now used for all argument passing and returning values from a function. - Diagnose errors with declaring references and const values without an initializer. (Uses a new Action callback, ActOnUninitializedDecl). We do not yet have implicit conversion sequences for reference binding, which means that we don't have any overloading support for reference parameters yet. llvm-svn: 58353
* -Add support for cv-qualifiers after function declarators.Argyrios Kyrtzidis2008-10-241-10/+32
| | | | | | -Add withConst/withVolatile/withRestrict methods to QualType class, that return the QualType plus the respective qualifier. llvm-svn: 58120
* implement a couple fixme's by implementing __extension__ properly.Chris Lattner2008-10-201-4/+6
| | | | llvm-svn: 57806
* Support attributes in *yet another* place. Is there any place you Chris Lattner2008-10-201-0/+11
| | | | | | can't stick an attributes? llvm-svn: 57795
* Fix a parser bug where we let attributes interfere with our disambiguationChris Lattner2008-10-201-20/+70
| | | | | | | | | | | | | | | | | | | of whether a '(' was a grouping paren or the start of a function declarator. This is PR2796. Now we eat the attribute before deciding whether the paren is grouping or not, then apply it to the resultant decl or to the first argument as needed. One somewhat surprising aspect of this is that attributes interact with implicit int in cases like this: void a(x, y) // k&r style function void b(__attribute__(()) x, y); // function with two implicit int arguments void c(x, __attribute__(()) y); // error, can't have attr in identifier list. Fun stuff. llvm-svn: 57790
* Remove an implemented fixme, only treat < as a type specifierChris Lattner2008-10-201-3/+4
| | | | | | when ObjC is turned on. llvm-svn: 57787
* Just do a diagIfAmbiguous -> warnIfAmbiguous rename.Argyrios Kyrtzidis2008-10-171-2/+2
| | | | | | No functionality change. llvm-svn: 57746
* Issue a warning when there's an ambiguous function declarator (that could be ↵Argyrios Kyrtzidis2008-10-151-1/+4
| | | | | | | | a direct initializer for a variable defition). Idea originated from here: http://thread.gmane.org/gmane.comp.gcc.devel/101524 llvm-svn: 57609
* In ParseParenDeclarator match "D.setGroupingParens(true);" with another ↵Argyrios Kyrtzidis2008-10-071-0/+3
| | | | | | | | | setGroupingParens call after the ')' is parsed. Fixes this bug: int (x)(0); // error, expected function declarator where the '(0)' initializer is llvm-svn: 57241
* Implement support for C++ direct initializers in declarations, e.g. "int x(1);".Argyrios Kyrtzidis2008-10-061-0/+34
| | | | | | | | | | | | | | | This is how this kind of initializers appear in the AST: -The Init expression of the VarDecl is a functional type construction (of the VarDecl's type). -The new VarDecl::hasCXXDirectInitializer() returns true. e.g, for "int x(1);": -VarDecl 'x' has Init with expression "int(1)" (CXXFunctionalCastExpr). -hasCXXDirectInitializer() of VarDecl 'x' returns true. A major benefit is that clients that don't particularly care about which exactly form was the initializer can handle both cases without special case code. Note that codegening works now for "int x(1);" without any changes to CodeGen. llvm-svn: 57178
* Allow variadic arguments without named ones for C++, e.g. "void(...);"Argyrios Kyrtzidis2008-10-061-1/+2
| | | | llvm-svn: 57143
* Handle ambiguities between expressions and type-ids that occur inside ↵Argyrios Kyrtzidis2008-10-051-1/+1
| | | | | | | | | parentheses, e.g.: sizeof(int()) -> "int()" is type-id sizeof(int()+1) -> "int()+1" is expression. llvm-svn: 57131
* Remove a FIXME.Daniel Dunbar2008-10-031-1/+1
| | | | llvm-svn: 57015
* Pass postfix attributes to ActOnFields.Daniel Dunbar2008-10-031-4/+5
| | | | llvm-svn: 56992
* Fix http://llvm.org/bugs/show_bug.cgi?id=2816.Steve Naroff2008-09-221-6/+6
| | | | llvm-svn: 56433
* Fold Parser::ParseTag into Parser::ParseEnumSpecifier, as suggested in this ↵Argyrios Kyrtzidis2008-09-111-48/+39
| | | | | | | | post: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-September/002721.html llvm-svn: 56081
* Support "typeof unary-expression" (GNU C++ extension).Argyrios Kyrtzidis2008-09-051-4/+22
| | | | llvm-svn: 55833
* Fix Parser::ParseDeclaratorInternal(): add langopts test when recognizing ↵Steve Naroff2008-08-281-2/+2
| | | | | | blocks. llvm-svn: 55468
* First wave of changes to support "blocks" (an extension to C).Steve Naroff2008-08-271-7/+12
| | | | | | This commit adds the declaration syntax (and associated type). llvm-svn: 55417
* Set the SourceRange ending of DeclSpec, when Parser::ParseTypeofSpecifier ↵Argyrios Kyrtzidis2008-08-161-0/+1
| | | | | | finishes. llvm-svn: 54840
* More #include cleaningDaniel Dunbar2008-08-111-0/+1
| | | | | | | - Drop Diagnostic.h from DeclSpec.h, move utility Diag methods into implementation .cpp llvm-svn: 54626
* Implement support for the 'wchar_t' C++ type.Argyrios Kyrtzidis2008-08-091-0/+6
| | | | llvm-svn: 54585
* Move AsmLabel into Declarator instead of just a parameter toDaniel Dunbar2008-08-051-4/+4
| | | | | | ActOnDeclarator. llvm-svn: 54353
* Add more Parser/Sema support for GCC asm-label extension.Daniel Dunbar2008-08-051-5/+11
| | | | | | | | | | | | | - ActOnDeclarator now takes an additional parameter which is the AsmLabel if used. Its unfortunate that this bubbles up this high, but we cannot just lump it in as an attribute without mistakenly *accepting* it as an attribute. - The actual asm-label itself is, however, encoded as an AsmLabelAttr on the FunctionDecl. - Slightly improved parser error recovery on malformed asm-labels. - CodeGen support still missing... llvm-svn: 54339
* Wherever a type is used/returned from the Action module, use TypeTy instead ↵Argyrios Kyrtzidis2008-08-011-1/+1
| | | | | | | | of DeclTy or void. No functionality change. llvm-svn: 54265
* pull protocol resolution out into ActOnStartProtocolInterface.Chris Lattner2008-07-261-11/+2
| | | | | | | This temporarily duplicates ParseObjCProtocolReferences, but it will be removed in the future. llvm-svn: 54092
* simplify some code.Chris Lattner2008-07-261-2/+2
| | | | llvm-svn: 54091
* < only starts a declspec in objc mode.Chris Lattner2008-07-261-2/+3
| | | | llvm-svn: 54089
* remove fixed fixmeChris Lattner2008-07-261-1/+0
| | | | llvm-svn: 54088
* make DeclSpec manage its own protocol qualifier list memory instead of havingChris Lattner2008-07-261-8/+6
| | | | | | clients allocate the memory and it delete it. llvm-svn: 54087
* Fix hte next wave of problems with protocol qualified ID:Chris Lattner2008-07-261-38/+54
| | | | | | | | 1) reject stuff like "id<foo> short" and "<foo> short". 2) set the declspec range correctly 3) only parse protocol qualifiers when in objc mode. llvm-svn: 54086
* improve handling of the horrible GCC objc extension that treats "<foo>" Chris Lattner2008-07-261-7/+15
| | | | | | | | like "id<foo>". This 1) fixes an infinite loop in the parser on things like "short<foo>" 2) emits a warning about this bogus construct and 3) changes the testcase to be substantially reduced. llvm-svn: 54082
* minor cleanup to the actions interface to pass around SmallVectorImpl insteadChris Lattner2008-07-211-2/+5
| | | | | | | | | | | | | | | | | | | | | | of a specific smallvector size. Fix protocol lists to pass down proper location info, so we get diagnostics like this: t.m:3:35: error: cannot find protocol definition for 'NSCopying', referenced by 'NSWhatever' @interface NSWhatever : NSObject <NSCopying> ^ instead of this: t.m:3:44: error: cannot find protocol definition for 'NSCopying', referenced by 'NSWhatever' @interface NSWhatever : NSObject <NSCopying> ^ Add a new IdentifierLocPair typedef which is just a pair<IdentifierInfo*, SourceLocation> llvm-svn: 53883
* add parser and sema support for the funny ObjC '@defs' thing.Chris Lattner2008-06-211-13/+34
| | | | | | Patch by David Chisnall! llvm-svn: 52586
* Support "<p>" as a short-hand for "id<p>". Here's a comment from GCC (the ↵Steve Naroff2008-06-051-1/+21
| | | | | | | | | | only documentation I could find on it). /* Make "<SomeProtocol>" equivalent to "id <SomeProtocol>" - nisse@lysator.liu.se. */ This commit adds the parser magic. The type associated with <p> is still incorrect. Will discuss with Chris. llvm-svn: 51972
* -Implement proper name lookup for namespaces.Argyrios Kyrtzidis2008-05-091-1/+2
| | | | | | | -identifierResolver exposes an iterator interface to get all decls through the scope chain. -The semantic staff (checking IdentifierNamespace and Doug's checking for shadowed tags were moved out of IdentifierResolver and back into Sema. IdentifierResolver just gives an iterator for all reachable decls of an identifier. llvm-svn: 50923
* This patch adds very basic support for parsing and type-checking classDouglas Gregor2008-04-131-38/+2
| | | | | | | | | | | inheritance in C++. It'll parse the base-specifier list, e.g., class D : public B1, virtual public B2 { }; and do some of the simpler semantic checks (B1 and B2 are classes; they aren't unions or incomplete types, etc). llvm-svn: 49623
* This patch is just the easy part of the class names patch, whichChris Lattner2008-04-131-5/+11
| | | | | | | | | | | | | | | | allows the parsing of "class" in addition to "struct" and "union" to declare a record. So this patch allows: class C { }; class C c1; But it does not contain the lookup bits, so this won't work yet: C c2; Patch by Doug Gregor! llvm-svn: 49613
* Default argument cleanups and minor improvements, patch byChris Lattner2008-04-121-7/+0
| | | | | | Doug Gregor! llvm-svn: 49598
* Patch for:Fariborz Jahanian2008-04-101-1/+1
| | | | | | | | 1) objc ivar processing is split out of ActOnField into its own ActOnIvar method. 2) the new objc ivar action takes visibility info directly, eliminating AllVisibilities in ParseObjCClassInstanceVariables. llvm-svn: 49506
* reduce the amount of 'C++ magic' this code depends on :)Chris Lattner2008-04-101-2/+2
| | | | llvm-svn: 49489
* refactor Parser::ParseStructDeclaration to return a vector of uninterpreted Chris Lattner2008-04-101-20/+30
| | | | | | | | | | | | | | declarators. This allows the clients (C structs, objc classes, objc properties, [future] C++ classes) etc, to do custom processing before invoking an action. This has two benefits in the short term: 1) objc ivar processing should be split out of ActOnField into its own ActOn method. 2) the new objc ivar action can take visibility info directly, eliminating AllVisibilities in ParseObjCClassInstanceVariables. 3) objc properties can pass their own special sauce down to sema as well. llvm-svn: 49468
* Simplify lifetime of location object.Chris Lattner2008-04-101-6/+6
| | | | llvm-svn: 49467
* Several improvements from Doug Gregor related to defaultChris Lattner2008-04-101-1/+2
| | | | | | argument handling. I'll fix up the c89 (void) thing next. llvm-svn: 49459
* Add support for C++ default arguments, and rework Parse-Sema Chris Lattner2008-04-081-18/+34
| | | | | | | | interaction for function parameters, fixing PR2046. Patch by Doug Gregor! llvm-svn: 49369
* move a semantic check out of the parser into sema.Chris Lattner2008-04-061-13/+0
| | | | llvm-svn: 49273
* now that identifier list parsing is split out, simplify handling ofChris Lattner2008-04-061-111/+102
| | | | | | normal typed argument lists. llvm-svn: 49272
* reject 'int test(x, x) int x; {}'Chris Lattner2008-04-061-0/+1
| | | | llvm-svn: 49271
* reject 'typedef int y; int test(x, y)'.Chris Lattner2008-04-061-1/+5
| | | | llvm-svn: 49270
OpenPOWER on IntegriCloud