aboutsummaryrefslogtreecommitdiff
path: root/Parse/ParseDecl.cpp
AgeCommit message (Collapse)Author
2008-03-15Make a major restructuring of the clang tree: introduce a top-levelChris Lattner
lib dir and move all the libraries into it. This follows the main llvm tree, and allows the libraries to be built in parallel. The top level now enforces that all the libs are built before Driver, but we don't care what order the libs are built in. This speeds up parallel builds, particularly incremental ones. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48402 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13improve DeclStmt to be able to store SourceRange info correctly.Chris Lattner
Set the start of DeclStmt range. Right now the end is meaningless though. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48330 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-25convert tabs to spaces, patch by Mike Stump!Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47560 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-21Collect and build and process type attributes on pointers. For Chris Lattner
example, we can now correctly build the type for things like: _AS1 float * _AS2 *B; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47420 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-11Several cleanups surrounding Parser::ParseAsmStatement() and ↵Steve Naroff
Parser::FuzzyParseMicrosoftAsmStatement(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46977 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-11Move policy on unnamed fields (a Microsoft extension) from ↵Steve Naroff
Parser::ParseStructDeclaration() to the driver. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46974 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-11Move Microsoft __declspec hack from the parser to the preprocessor. Since we ↵Steve Naroff
have no plans to actually implement this construct, it is cleaner to limit the change to the preprocessor. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46973 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-10Fix PR1999, by emitting a hard error only if an argument declarator is ↵Chris Lattner
completely missing. Otherwise, it is an implicit int case, which is valid in c90 and invalid elsewhere, but accepted as an extension. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46938 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-07- Add support for fuzzy parsing line-oriented __asm's (yuck).Steve Naroff
- Change handling of __w64 to a built-in macro. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46864 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-07Minor cleanup from yesterday's -fms-extension commit. Move __int* MS ↵Steve Naroff
keywords to predefined macros. This removes some of the MS-madness from Parser::ParseDeclarationSpecifiers(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46852 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-07Implement -fms-extensions. This allows us to fuzzy parse non-standard MS ↵Steve Naroff
constructs used in "windows.h". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46838 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31Fix PR1965: missing diagnostics for parameters that are missingChris Lattner
type specifiers. This required updating some (buggy) tests, and the testcase was previously accidentally committed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46603 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-25Add more support for Apple's "private extern" extension...Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46371 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-04Added a comment, minor refactoring of foreach parsing code per Chris's ↵Fariborz Jahanian
suggestion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45601 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-04Minor changes as suggested by Chris L.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45598 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-03Patch to parse/build AST ObjC2's foreach statement.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45539 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29Don't attribute in file headers anymore. See llvmdev for theChris Lattner
discussion of this change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45410 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-18Add __private_extern__ keyword and recognize it. Added a FIXME to indicate ↵Steve Naroff
there is still work to do. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45135 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12move function to a more logical location, add its grammar productions.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44923 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12simplify some code.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44913 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11Mega-patch: ripped SourceManager out of Diagnostic/DiagnosticClient. NowTed Kremenek
SourceManager is passed by reference, allowing the SourceManager to be associated with a specific translation unit, and not the entire execution of the driver. Modified all users of Diagnostics to comply with this new interface. Integrated SourceManager as a member variable of TargetInfo. TargetInfo will eventually be associated with a single translation unit (just like SourceManager). Made the SourceManager reference in ASTContext private. Provided accessor getSourceManager() for clients to use instead. Modified clients to comply with new interface. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44878 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-15Handle "bool" in all places that touch _Bool. Chris Lattner
This fixes code like "if((bool)x) {}" for example. Patch by Nate Begeman. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44159 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-13Give AST-walk passes a way to access DeclSpec attributes on functions andNate Begeman
variables. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44073 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31More infrastructure to recognize objective-c's type qualifiers (in,inout, etc.)Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43580 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-30More support for rewriting ObjC intefaces. Still some edge cases to handle...Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43493 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-29This commit contains lot's of small tweaks to how we pass around and store ↵Steve Naroff
SourceLocation's for interfaces/protocols/categories/implementations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43475 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-29The callers of ParseStructDeclaration are not expecting it toChris Lattner
eat the terminating ;. Fix one place where it did, allowing this to compile without error: struct x { int a; union { int b; float c; }; int d; }; This reduces diagnostics on PR1750 from 33 to 27. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43437 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-11Patch to create protocol conforming class types.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42856 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-10Remove Scope argument from ObjC actions that either don't need it or can now ↵Steve Naroff
use TUScope. Also improve a recently added comment. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42826 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-09switch some more of the parser over to using Token::is and isNotChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42796 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-05This is the first patch toward supporting protocol conformingFariborz Jahanian
objective-c types. It also removes use of Scope* parameter in getObjCProtocolDecl. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42649 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-29Removed use of hash table for class decls and do a name look up directly.Fariborz Jahanian
There is still an issue if doing ScopedLookup is an overkill and we can just access the decl using the identifier. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42463 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-15Start converting Action methods from Parse-prefix to ActOn-prefix.Steve Naroff
The previous naming scheme was confusing, since it resulted in both the Parser and Action modules having methods with the same name. In addition, the Action module never does any parsing... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41986 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-14Rename Action::ParseRecordBody() to ProcessFieldDecls(), and add a ↵Steve Naroff
visibility argument. Remove Action::ObjcAddVisibilityToIvars(). No need for an extra API when it is trivial to add this info to the previous hook. In general, I want to start migrating away from having Actions prefixed with "Parse" (which is confusing, since the Action API doesn't do any parsing, per se). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41973 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-12Fix the following bug submitted by Ted Kremenek:Steve Naroff
void func() { int xx = xx; // incorrectly diagnosed 'xx' as an undeclared identifier. } This smallish bug resulted in a largish fix. Here are some highlights: - Needed to make sure ParseDeclarator is called *before* parsing any initializer. Removed the "Init" argument to ParseDeclarator. - Added AddInitializerToDecl() to the Action & Sema classes. In Sema, this hook is responsible for validating the initializer and installing it into the respective decl. - Moved several semantic checks from ParseDeclarator() to FinalizeDeclaratorGroup(). Previously, this hook was only responsible for reversing a list. Now it plays a much larger semantic role. All of the above changes ended up simplifying ParseDeclarator(), which is goodness... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41877 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-05Start implementing Actions interface for ObjC classes, instance variables, ↵Steve Naroff
and methods. Lot's of small changes to the parser. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41732 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-28Tweak declaration...Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41542 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-28Implement more thoughful error recovery when dealing with bogus declarator ↵Steve Naroff
types. For example, the following code was resulting in spurious warnings. This was the result of Sema::GetTypeForDeclarator() synthesizing a type to hand back to the caller (in this case, "int []", instead of "struct s[]", which is invalid). struct s; struct s* t (struct s z[]) { // expected-error {{array has incomplete element type}} return z; } Strategy: Flag the error in Declarator/DeclaratorChunk. This info is later stored in the ParmVarDecl. If the decl is referenced, Sema::ParseIdentifierExpr() will check if the type is invalid. If so, it quietly returns "true", without instantiating a DeclRefExpr. This seems to work nicely. If Chris is happy with the approach, I will generalize this to all VarDecls. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41521 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-27C++ allows empty enum list.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41498 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-26Break the assumption that any sort of scope (e.g. a loop scope) can Chris Lattner
hold declarations. Instead, introduce a new "DeclScope" scope type that holds them explicitly. For now, all scopes have this bit, but in the future we can use them to fix some issues Neil noticed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41431 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-25refactor enough of the top-level parsing logic to parse andChris Lattner
ignore 'namespace foo {}' git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41400 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-22With this commit, we now successfully parse "Cocoa.h"!Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41303 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-21Tweak error recovery for missing semicolon after decl. For this:Chris Lattner
void foo() { int x if (x) { } } We now emit: a.c:5:3: error: parse error if (x) { ^ 1 diagnostic generated. instead of: a.c:5:3: error: parse error if (x) { ^ a.c:9:1: error: expected '}' ^ 2 diagnostics generated. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41243 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-20Added Parser::ParseStructDeclaration() as a result of refactoring ↵Steve Naroff
Parser::ParseStructUnionBody(). Motivation: Objective-C can now share this rule. It also makes Parser::ParseStructUnionBody() a bit smaller/cleaner.. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41201 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-09minor cleanupsChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40963 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-09__attribute__ starts a declspec.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40962 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-02Tidy up Parser::ParseTypeofSpecifier()...implement FIXME and minor restructure.Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40713 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-31Tighten up Parser::ParseTypeofSpecifier().Steve Naroff
Add some more tests to typeof.c. Also added a couple of missing "expect" attributes that caused the test to fail. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40656 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-31Add parsing and AST support for GNU "typeof".Steve Naroff
Many small changes to lot's of files. Still some FIXME's, however the basic support is in place. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40631 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-25Fix a couple of bugs, add some new cool stuff.Chris Lattner
1. Fix a todo in Parser::ParseTag, to recover better. On code like that in test/Sema/decl-invalid.c it causes us to return a single error instead of multiple. 2. Fix an error in Sema::ParseDeclarator, where it would crash if the declarator didn't have an identifier. Instead, diagnose the problem. 3. Start adding infrastructure to track the range of locations covered by a declspec or declarator. This is mostly implemented for declspec, but could be improved, it is missing for declarator. Thanks to Neil for pointing out this crash. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40482 91177308-0d34-0410-b5e6-96231b3b80d8