summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Expr.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Add support for C++'s "type-specifier ( expression-list )" expression:Argyrios Kyrtzidis2008-08-221-2/+5
| | | | | | | | | | -The Parser calls a new "ActOnCXXTypeConstructExpr" action. -Sema, depending on the type and expressions number: -If the type is a class, it will treat it as a class constructor. [TODO] -If there's only one expression (i.e. "int(0.5)" ), creates a new "CXXFunctionalCastExpr" Expr node -If there are no expressions (i.e "int()" ), creates a new "CXXZeroInitValueExpr" Expr node. llvm-svn: 55177
* Add ExplicitCastExpr to replace the current CastExpr, and have ↵Argyrios Kyrtzidis2008-08-181-28/+8
| | | | | | | | | | | ImplicitCastExpr and ExplicitCastExpr derive from a common base class (CastExpr): Expr -> CastExpr -> ExplicitCastExpr -> ImplicitCastExpr llvm-svn: 54955
* Update some isIntegerConstantExpr uses to useDaniel Dunbar2008-08-131-8/+2
| | | | | | getIntegerConstantExprValue where appropriate. llvm-svn: 54771
* More #include cleaningDaniel Dunbar2008-08-111-3/+0
| | | | | | | | | | | - Kill unnecessary #includes in .cpp files. This is an automatic sweep so some things removed are actually used, but happen to be included by a previous header. I tried to get rid of the obvious examples and this was the easiest way to trim the #includes in one fell swoop. - We now return to regularly scheduled development. llvm-svn: 54632
* More #include cleaningDaniel Dunbar2008-08-111-0/+2
| | | | | | | | - Drop {Decl.h,DeclObjC.h,IdentifierTable.h} from Expr.h - Moved Sema::getCurMethodDecl() out of line (dependent on ObjCMethodDecl via dyn_cast). llvm-svn: 54629
* More #include cleaningDaniel Dunbar2008-08-111-0/+1
| | | | | | | | - Drop Expr.h,RecordLayout.h from ASTContext.h (for DeclBase.h and SourceLocation.h) - Move ASTContext constructor into implementation llvm-svn: 54627
* Cleanup ObjCSuperRefExpr (remove last usage and AST node:-).Steve Naroff2008-08-101-4/+0
| | | | llvm-svn: 54617
* rename PreDefinedExpr -> PredefinedExprChris Lattner2008-08-101-7/+7
| | | | llvm-svn: 54605
* Remove the ICE pointer cast hack; the issue this was working around is Eli Friedman2008-08-091-5/+0
| | | | | | now fixed in an alternate way. llvm-svn: 54598
* Finally fix PR2189. This makes a fairly invasive but important change toChris Lattner2008-08-041-4/+7
| | | | | | | | | | move getAsArrayType into ASTContext instead of being a method on type. This is required because getAsArrayType(const AT), where AT is a typedef for "int[10]" needs to return ArrayType(const int, 10). Fixing this greatly simplifies getArrayDecayedType, which is a good sign. llvm-svn: 54317
* convert more code to use ASTContext to get canonical types insteadChris Lattner2008-07-261-10/+10
| | | | | | of doing it directly. This is required for PR2189. llvm-svn: 54102
* fix some problems handling stmtexprs with labels (PR2374), and Chris Lattner2008-07-261-4/+12
| | | | | | improve 'expression unused' diagnostics for stmtexprs. llvm-svn: 54098
* fix 80 col violation.Chris Lattner2008-07-251-3/+3
| | | | llvm-svn: 54075
* Add support for __extension__ as an lvalue. rdar://6097308Chris Lattner2008-07-251-1/+2
| | | | llvm-svn: 54033
* Added UnaryOperator::isPrefix().Ted Kremenek2008-07-231-0/+10
| | | | llvm-svn: 53963
* revert my bogus attempt to fix the comment. sorry for the noise.Nuno Lopes2008-07-081-1/+1
| | | | llvm-svn: 53248
* fix CheckForConstantInitializer() for Compound LiteralsNuno Lopes2008-07-071-1/+1
| | | | | | also fix the correspondent test (it was expecting more errors than it should. please confirm my fix is correct (at least gcc agrees with me) llvm-svn: 53174
* Shuffle things around in preparation for integrating Eli's constant evaluator.Anders Carlsson2008-07-031-0/+1
| | | | llvm-svn: 53074
* Add Sema support for C++ classes.Argyrios Kyrtzidis2008-07-011-1/+3
| | | | llvm-svn: 52956
* ObjCMessageExpr objects that represent messages to class methods now can ↵Ted Kremenek2008-06-241-1/+35
| | | | | | contain the ObjCInterfaceDecl* of the target class if it was available when the ObjCMessageExpr object was constructed. The original interfaces of the class has been preserved (requiring no functionality changes from clients), but now a "getClasSInfo" method returns both the ObjCInterfaceDecl* and IdentifierInfo* of the target class. llvm-svn: 52676
* Change self/_cmd to be instances of ImplicitParamDecl instead of ParmVarDecl.Chris Lattner2008-06-171-2/+4
| | | | | | Patch by David Chisnall! llvm-svn: 52422
* This patch is motivated by numerous strict-aliasing warnings when compilingTed Kremenek2008-06-171-109/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | clang as a Release build. The big change is that all AST nodes (subclasses of Stmt) whose children are Expr* store their children as Stmt* or arrays of Stmt*. This is to remove strict-aliasing warnings when using StmtIterator. None of the interfaces of any of the classes have changed (except those with arg_iterators, see below), as the accessor methods introduce the needed casts (via cast<>). While this extra casting may seem cumbersome, it actually adds some important sanity checks throughout the codebase, as clients using StmtIterator can potentially overwrite children that are expected to be Expr* with Stmt* (that aren't Expr*). The casts provide extra sanity checks that are operational in debug builds to catch invariant violations such as these. For classes that have arg_iterators (e.g., CallExpr), the definition of arg_iterator has been replaced. Instead of it being Expr**, it is an actual class (called ExprIterator) that wraps a Stmt**, and provides the necessary operators for iteration. The nice thing about this class is that it also uses cast<> to type-checking, which introduces extra sanity checks throughout the codebase that are useful for debugging. A few of the CodeGen functions that use arg_iterator (especially from OverloadExpr) have been modified to take begin and end iterators instead of a base Expr** and the number of arguments. This matches more with the abstraction of iteration. This still needs to be cleaned up a little bit, as clients expect that ExprIterator is a RandomAccessIterator (which we may or may not wish to allow for efficiency of representation). This is a fairly large patch. It passes the tests (except CodeGen/bitfield.c, which was already broken) on both a Debug and Release build, but it should obviously be reviewed. llvm-svn: 52378
* Fix ast dumping to work with long double literals, e.g. we dump:Chris Lattner2008-06-071-0/+10
| | | | | | | | | | | | | long double X() { return 1.0L; } as: long double X() (CompoundStmt 0xb06a00 <t.c:2:17, col:32> (ReturnStmt 0xb068d0 <col:19, col:26> (FloatingLiteral 0xb02cf0 <col:26> 'long double' 1.000000))) llvm-svn: 52080
* Put back my temporary hack until Eli addresses this in a more complete fashion.Steve Naroff2008-06-031-0/+5
| | | | llvm-svn: 51920
* Re-fix r51907 in a way which doesn't affect valid code. This essentially Eli Friedman2008-06-031-5/+0
| | | | | | | | | | | | | moves the check for the invalid construct to a point where it doesn't affect other uses of isIntegerConstantExpr, and we can warn properly when the extension is used. This makes it a bit more complicated, but it's a lot cleaner. Steve, please tell me if this check is sufficient to handle the relevant system header. I know it's enough to handle the testcase, but I don't know what exactly the original looks like. llvm-svn: 51918
* Change Expr::isIntegerConstantExpr() to allow for pointer types (for GCC ↵Steve Naroff2008-06-031-0/+5
| | | | | | | | compatibility). Note FIXME. Fix <rdar://problem/5977870> clang on xcode: error: arrays with static storage duration must have constant integer length llvm-svn: 51907
* Fix <rdar://problem/5979875> clang on xcode: error: use of undeclared ↵Steve Naroff2008-06-021-1/+5
| | | | | | identifier 'super' llvm-svn: 51888
* Teach Expr::isLvalue() about ObjC properties. For now, all properties are ↵Steve Naroff2008-05-301-0/+2
| | | | | | writable. Added a FIXME for another day. llvm-svn: 51800
* Add basic support for properties references (a missing feature).Steve Naroff2008-05-301-0/+9
| | | | | | While it is far from complete, it does fix the following <rdar://problem/5967199> clang on xcode: error: member reference is not to a structure or union llvm-svn: 51719
* - Move ObjC Expresssion AST's from Expr.h => ExprObjC.hSteve Naroff2008-05-291-1/+1
| | | | | | - #include ExprObjC.h in many places llvm-svn: 51703
* Assume statement expressions have side effects; this gets rid of a lot Eli Friedman2008-05-271-2/+5
| | | | | | of extra warnings in the Python source. llvm-svn: 51594
* Move getAccessedFieldNo out of lib/AST/Expr.cpp intoDan Gohman2008-05-221-10/+0
| | | | | | | | | lib/CodeGen/CGExpr.cpp and to change include/clang/AST/Attr.h to use its own enum for visibility types instead of using llvm::GlobalValue::VisibilityTypes. These changes eliminate dependencies in the AST library on LLVM's VMCore library. llvm-svn: 51398
* Remove the unneeded #include of VMCore header "llvm/DerivedTypes.h".Dan Gohman2008-05-211-1/+0
| | | | llvm-svn: 51392
* Make the unused expression warning a bit less aggressive (found in PHP Eli Friedman2008-05-191-0/+4
| | | | | | code). llvm-svn: 51276
* Minor cleanup to isBuiltinConstantExpr.Eli Friedman2008-05-161-7/+2
| | | | llvm-svn: 51188
* Removed bogus "return true" in Expr::isConstantExpr that returned true for allTed Kremenek2008-05-151-1/+0
| | | | | | | | | | expressions. This appears to be a regression introduced in r51113 that caused many test cases to fail (there is still a test case in the Analysis directory that is failing): http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080512/005706.html llvm-svn: 51164
* Implementation of __builtin_shufflevector, a portable builtin capable of Eli Friedman2008-05-141-0/+9
| | | | | | | | | expressing the full flexibility of the LLVM shufflevector instruction. The expected immediate usage is in *mmintrin.h, so that they don't depend on the mess of gcc-inherited (and not completely implemented) shuffle builtins. llvm-svn: 51113
* Remove AST dependency on VMCore by switching ExtVectorElementExpr off Constant.Nate Begeman2008-05-131-4/+3
| | | | llvm-svn: 51068
* Extend vector member references to include {.hi, .lo, .e, .o} which return aNate Begeman2008-05-091-30/+39
| | | | | | | | | | | | | vector of the same element type and half the width, with the high, low, even, and odd elements respectively. Allow member references to member references, so that .hi.hi gives you the high quarter of a vector. This is fairly convenient syntax for some insert/extract operations. Remove some unnecessary methods/types in the ExtVectorElementExpr class. llvm-svn: 50892
* Fixup InitListExpr::child_begin/end. Thanks to Ted for catching the regression.Steve Naroff2008-05-071-2/+4
| | | | llvm-svn: 50816
* Fix off-by-one error.Steve Naroff2008-05-071-1/+1
| | | | llvm-svn: 50815
* Fixed bug in ObjCIVarExpr: the child iterator now iterates over the Base ↵Ted Kremenek2008-05-021-2/+7
| | | | | | expression. llvm-svn: 50585
* Use pointer swizziling to unify in ObjCMessageExpr the receiver and ↵Ted Kremenek2008-05-011-6/+5
| | | | | | | | classname "fields". This saves us a pointer. Implemented serialization for ObjCMessageExpr. llvm-svn: 50528
* Extend InitListExpr API/IMPL to support arbitrary add/remove (in support of ↵Steve Naroff2008-05-011-7/+4
| | | | | | the initializer rewrite I am doing). llvm-svn: 50511
* OCUVector -> ExtVector, shorthand for extended vector, per feedback from Chris.Nate Begeman2008-04-181-14/+14
| | | | llvm-svn: 49942
* 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-0/+15
| | | | | | | | interaction for function parameters, fixing PR2046. Patch by Doug Gregor! llvm-svn: 49369
* PR1963: Address of function is a constant expressionSeo Sanghyeon2008-04-041-0/+2
| | | | llvm-svn: 49212
* Make a major restructuring of the clang tree: introduce a top-levelChris Lattner2008-03-151-0/+1391
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
OpenPOWER on IntegriCloud