summaryrefslogtreecommitdiffstats
path: root/clang/Sema/Sema.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Make a major restructuring of the clang tree: introduce a top-levelChris Lattner2008-03-151-222/+0
| | | | | | | | | | 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. llvm-svn: 48402
* move the ASTContext argument to be first in the argument list of Chris Lattner2008-03-151-12/+14
| | | | | | all Create methods. llvm-svn: 48398
* start switching decls over to using an allocator controlled by ASTContext. Chris Lattner2008-03-151-15/+17
| | | | | | | | | | Right now only some ctors are switched over. I need to switch them all over so I can change the dtor over. This lets us experiment with region allocation and other things in the future. llvm-svn: 48390
* Move the initialization of SEL/objc_selector from Sema::Sema() to ↵Steve Naroff2008-02-241-13/+16
| | | | | | | | Sema::ActOnTranslationUnitScope() and make sure the type/struct get inserted into the translation unit scope. Bug submitted by David Chisnall (thanks!). llvm-svn: 47538
* avoid making implicit casts that just remove typedefs.Chris Lattner2008-02-131-1/+1
| | | | llvm-svn: 47074
* pass the astconsumer into Sema's ctor, clean up some stuff in Chris Lattner2008-02-061-34/+35
| | | | | | | Sema::ActOnTranslationUnitScope. The various ObjC pieces at the top of Sema.cpp should be moved into SemaObjC or something. llvm-svn: 46787
* Move promoteExprToType from being a static method in SemaExpr.cpp to beingChris Lattner2008-01-161-0/+13
| | | | | | | | | | a method named ImpCastExprToType in Sema. Use this method to insert implicit casts for case statements from their operand type to the condition type of the switch. This fixes a crash on test/CodeGen/statements.c, reported by Eli Friedman. llvm-svn: 46083
* Substituted all instances of the string "Objc" for "ObjC". This fixesTed Kremenek2008-01-071-17/+17
| | | | | | | some naming inconsistencies in the names of classes pertaining to Objective-C support in clang. llvm-svn: 45715
* Limit type of foreach's element and collection to be a pointer to Fariborz Jahanian2008-01-071-1/+1
| | | | | | objc object type. llvm-svn: 45709
* Patch to add semantics check for ObjC2's foreacn statement.Fariborz Jahanian2008-01-041-0/+14
| | | | llvm-svn: 45561
* generalize some of the conversion warnings.Chris Lattner2008-01-031-0/+8
| | | | llvm-svn: 45560
* Don't attribute in file headers anymore. See llvmdev for theChris Lattner2007-12-291-2/+2
| | | | | | discussion of this change. llvm-svn: 45410
* TargetInfo no longer includes a reference to SourceManager.Ted Kremenek2007-12-121-13/+9
| | | | | | | | | | | | | | | Moved all clients of Diagnostics to use FullSourceLoc instead of SourceLocation. Added many utility methods to FullSourceLoc to provide shorthand for: FullLoc.getManager().someMethod(FullLoc.getLocation()); instead we have: FullLoc.someMethod(); Modified TextDiagnostics (and related classes) to use this short-hand. llvm-svn: 44957
* Mega-patch: ripped SourceManager out of Diagnostic/DiagnosticClient. NowTed Kremenek2007-12-111-9/+13
| | | | | | | | | | | | | | | | | | 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. llvm-svn: 44878
* Patch to implement "Protocol" as a built-in type declared asFariborz Jahanian2007-12-071-20/+11
| | | | | | "@class Protocol;" llvm-svn: 44670
* Initialize CurMethodDecl to 0.Anders Carlsson2007-11-301-1/+1
| | | | llvm-svn: 44463
* Yesterday, I simplified how we stream top-level decls.Steve Naroff2007-11-291-2/+2
| | | | | | | After a discussion with Ted, we both came to the conclusion that adding a "HandleTopLevelDeclaration" hook to ASConsumer is far more elegant. The default implementation of HandleTopLevelDeclaration will be responsible for iterating over the ScopedDecl (which has a chain of the decls:-). TODO: Once Ted adds HandleTopLevelDeclaration, make sure TagDecls are chainged appropriately... llvm-svn: 44445
* Several fixes/simplifications surrounding how we stream top-level decl AST's.Steve Naroff2007-11-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following code... typedef struct cssm_data {} CSSM_DATA, *CSSM_DATA_PTR; struct Y { int A; }; struct X { int A; } D; struct X E, F; ...now produces the following output... > ../../Debug/bin/clang xx.c -ast-print Read top-level tag decl: 'cssm_data' typedef struct cssm_data CSSM_DATA; typedef struct cssm_data *CSSM_DATA_PTR; Read top-level tag decl: 'Y' Read top-level tag decl: 'X' Read top-level variable decl: 'D' Read top-level variable decl: 'E' Read top-level variable decl: 'F' ...which is much more accurate than the previous -ast-print output... typedef struct cssm_data CSSM_DATA; typedef struct cssm_data CSSM_DATA; Read top-level variable decl: 'D' Read top-level variable decl: 'E' Read top-level variable decl: 'E' llvm-svn: 44421
* Implement a more sensible strategy for ObjC built-in types (addressing a ↵Steve Naroff2007-10-311-59/+52
| | | | | | | | | | | | long standing FIXME in Sema::GetObjcIdType()). This removes several gross hacks to work around the previous "lazy" behavior. Two notes: - MinimalActions still needs to be taught about the built-in types (This breaks one of the -noop test cases). I started this, then added a FIXME. - I didn't convert Sema::GetObjcProtoType() yet. llvm-svn: 43567
* Encode Class, SEL and Objective-C objects.Anders Carlsson2007-10-311-0/+19
| | | | llvm-svn: 43540
* minor tweaksChris Lattner2007-10-301-10/+11
| | | | llvm-svn: 43515
* Implementation of AST for @protocol expression.Fariborz Jahanian2007-10-171-0/+18
| | | | llvm-svn: 43075
* Patch to implement AST generation for objective-c's @selector expression.Fariborz Jahanian2007-10-161-0/+17
| | | | llvm-svn: 43038
* Added ASTContext::setObjcIdType/getObjcIdType(), set by Sema.Steve Naroff2007-10-151-4/+4
| | | | | | Also noticed ASTContext::BuiltinVaListType wasn't being initialized to the null type (so I set it). llvm-svn: 42983
* Refinements to Sema::GetObjcIdType()...Steve Naroff2007-10-101-7/+15
| | | | | | | | | - Cache the typedef, not the type (avoids importing AST/Type.h). - Emit an error if "id" cannot be found. - Comment the routine and add a FIXME to reconsider how we emulate GCC's new fangled behavior. This isn't a priority for now, since almost no code depends on having "id" built-in. - Add a test. llvm-svn: 42845
* - Make sure default return/argument types (for methods) default to "id".Steve Naroff2007-10-101-0/+17
| | | | | | | - Cache the "id" type in Sema...initialize ObjcIdType and TUScope (oops). - Fix ActOnInstanceMessage to allow for "id" type receivers...still work to do (next). llvm-svn: 42842
* Make sure methods with no return type default to "id".Steve Naroff2007-10-091-0/+4
| | | | | | | | | | This fixes a crasher in Sema::MatchTwoMethodDeclarations(), identified by selector-overload.m (just added). Added Action::ActOnTranslationUnitScope() and renamed Action::PopScope to ActOnPopScope. Added a Translation Unit Scope instance variable to Sema (will be very useful to ObjC-related actions, since ObjC declarations are always file-scoped). llvm-svn: 42817
* add actions for deleting expr/stmt nodes.Chris Lattner2007-08-311-0/+7
| | | | llvm-svn: 41635
* Moved id_asprintf before id_vsnprintf in the enum used for indexingTed Kremenek2007-08-101-1/+1
| | | | | | | KnownFunctionIDs. This allows us to test for a printf-like function that accepts a va_arg argument using a range comparison. llvm-svn: 41006
* initial support for checking format strings, patch by Ted Kremenek:Chris Lattner2007-08-101-0/+16
| | | | | | "I've coded up some support in clang to flag warnings for non-constant format strings used in calls to printf-like functions (all the functions listed in "man fprintf"). Non-constant format strings are a source of many security exploits in C/C++ programs, and I believe are currently detected by gcc using the flag -Wformat-nonliteral." llvm-svn: 41003
* Finally bite the bullet and make the major change: split the clang namespaceChris Lattner2007-06-151-1/+0
| | | | | | | | | | | | | out of the llvm namespace. This makes the clang namespace be a sibling of llvm instead of being a child. The good thing about this is that it makes many things unambiguous. The bad things is that many things in the llvm namespace (notably data structures like smallvector) now require an llvm:: qualifier. IMO, libsystem and libsupport should be split out of llvm into their own namespace in the future, which will fix this issue. llvm-svn: 39659
* Bug #:Steve Naroff2007-05-181-4/+34
| | | | | | | | | | | | | | | | | | | | Submitted by: Reviewed by: An important, but truly mind numbing change. Added 6 flavors of Sema::Diag() that take 1 or two SourceRanges. Considered adding 3 flavors (using default args), however this wasn't as clear. Removed 2 flavors of Sema::Diag() that took LexerToken's (they weren't used). Changed all the typechecking routines to pass the appropriate range(s). Hacked the diagnostic machinery and driver to acccommodate the new data. What's left? A FIXME in clang.c to use the ranges. Chris offered to do the honors:-) Which includes taking us to the end of an identifier:-) llvm-svn: 39456
* Remove the Sema::Diag helper that takes a type. Convert clients to useChris Lattner2007-05-161-6/+0
| | | | | | the version that takes a string. llvm-svn: 39450
* Rename type::getAsString to getAsStringInternal. Add a newChris Lattner2007-05-161-2/+1
| | | | | | | QualType::getAsString() that returns a string, which is much easier for clients to use. Convert clients to use it. llvm-svn: 39449
* Add helper to emit two strings for a diagnostic.Chris Lattner2007-05-161-3/+21
| | | | llvm-svn: 39448
* Bug #:Steve Naroff2007-05-131-1/+0
| | | | | | | | | | | Submitted by: Reviewed by: Two bug fixes to CheckIncrementDecrementOperand: - removed "constantOne" usage and simply use Context.IntTy. - fix the last constraint check...the lvalue test needs to be on the expression, not the type! (duh). llvm-svn: 39442
* Bug #:Steve Naroff2007-05-071-0/+1
| | | | | | | | | | | | | | | | Submitted by: Reviewed by: - Unified CheckSimpleAssignmentOperands/CheckCompoundAssignmentOperands into one function, named CheckAssignmentOperands. One less function to maintain. - Converted the unary check functions (ParseUnaryOp and friends) to have the same API as their binary counterparts. - Implemented CheckIndirectionOperand (was stubbed). While testing, noticed that Expr::isModifiableLvalue was incomplete (fixed and referenced draft). - Added constantOne instance variable to Sema. - Removed CheckArithmeticOperand (the code was so simple that it is now part of ParseUnaryOp). The name wasn't great anyway:-) llvm-svn: 39435
* Bug #:Steve Naroff2007-04-051-1/+1
| | | | | | | | | | | | Submitted by: Reviewed by: -Changed the name of TypeRef to QualType. Many diffs. -Changed the QualType constructor to require Quals be passed. This makes the code a bit more verbose, however will make the code easier to work on. Given the complexity of types, this should help spot bogosities. -Changed the Expr constructor to require a QualType. Same motivation. llvm-svn: 39395
* Bug #:Steve Naroff2007-03-301-0/+7
| | | | | | | | | | | | | | | | | | Submitted by: Reviewed by: Implement ++/-- typechecking for pre/post unary expressions. This includes: - added isLvalue, isModifiableLvalue (on TypeRef, Type, and RecordType). - added isRealType, isRealFloatingType, isComplexType. - hacked Diag to take a TypeRef (I was sick of writing the 2 line "setup":-) In addition, this will likely lead to less bugs...I already had written code that was doing a getAsString on "Type" (which is wrong...since it doesn't include any qualifiers). - Changed UnaryOperator to take a TypeRef...pass it the right stuff. - Removed redundant ternary expressions in several predicates. - A couple diagnostics. llvm-svn: 39369
* Bug #:Steve Naroff2007-03-231-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Submitted by: Reviewed by: Type Checking...round 2. This checkin "breaks" parsing carbon.h. I imagine that this will be true for the next week or so. Nevertheless, this round of changes includes the following: - Hacked various Expr classes to pass the appropriate TypeRef. Still have a few more classes to touch. - Implement type checking for ParseArraySubscriptExpr and ParseMemberReferenceExpr. - Added a debug hook to derive the class name for Stmt/Expr nodes. Currently a linear search...could easily optimize if important. - Changed the name of TaggedType->TagType. Now we have TagType and TagDecl (which are easier to remember). - Fixed a bug in StringLiteral conversion I did a couple weeks ago. hadError was not initialized (oops). - changed Sema::Diag to return true. This streamlines the type checking code considerably. - Added many diagnositics. This should be it! llvm-svn: 39361
* Bug #:Steve Naroff2007-03-061-0/+4
| | | | | | | | | | | | | | | Submitted by: Reviewed by: More code to parse numeric constants. This checkin includes: - Feedback from Chris. - Support for parsing floating point constants. - Moved the code to "Sema". Changed API in Action. - More/better error diagnostics. At this point, the parsing support should be largely complete. Next step is to work on filling in sensible values (in IntegerLiteral/FloatLiteral). llvm-svn: 39349
* Go back to having the clang driver create ASTContext explicitly, passingSteve Naroff2007-02-281-8/+2
| | | | | | | | | it to Sema/ASTStreamer (separating the lifetime of ASTContext from the lifetime of Sema). One day it might be useful to consider creating a context object implicitly if one isn't provided (using default arguments in Sema's constructor). At this point, adding this convenience isn't necessary. llvm-svn: 39346
* Make Sema's use of the preprocessor explicit (rather than assumeSteve Naroff2007-02-281-2/+11
| | | | | | | | | | | | | | | | the prerocessor will be available via ASTContext). - Removed the public data member "PP" in ASTContext. - Changed ASTContext's contructor to take TargetInfo/IdentifierTable explicitly. - Implicitly create an ASTContext in Sema's constructor. This simplifies the clients job (and makes ASTContext more private). --As a side effect, added a "PrintStats" hook to Sema. To support this level of encapsulation, ASTContext is always dynamically allocated (by Sema). Previously, ASTContext was being allocated on the stack. I don't believe this should be a performance issue (since ASTContext is fairly course grain and tied to the lifetime of Sema currently). llvm-svn: 39345
* Add support for C90 implicitly defined functions, e.g.:Chris Lattner2006-11-201-1/+3
| | | | | | | | int A() { return X(); } llvm-svn: 39194
* introduce a new ASTContext class to hold long-lived ast nodes.Chris Lattner2006-11-101-6/+3
| | | | llvm-svn: 39161
* move the rest of the expr sema to SemaExpr.cpp and the decl processing stuffChris Lattner2006-11-101-230/+0
| | | | | | to SemaDecl.cpp llvm-svn: 39159
* move semantic analysis of break/continue out of the parser into the sema class.Chris Lattner2006-11-101-0/+9
| | | | llvm-svn: 39157
* move semantic analysis of statements to it's own file.Chris Lattner2006-11-101-91/+0
| | | | llvm-svn: 39156
* split semantic analysis of expressions out to its own fileChris Lattner2006-11-101-220/+0
| | | | llvm-svn: 39155
* move ASTBuilder.h/cpp to be a private Sema.h/cpp files, not part of theChris Lattner2006-11-101-4/+4
| | | | | | interface exported by libast. llvm-svn: 39154
OpenPOWER on IntegriCloud