summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprConstant.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Improve __builtin_nanf support; we now can deal with them as constants.Mike Stump2009-05-301-3/+14
| | | | llvm-svn: 72607
* Fix up constant expression handling to deal with the address Eli Friedman2009-05-271-3/+12
| | | | | | of a reference correctly. llvm-svn: 72463
* When evaluating a VarDecl as a constant or determining whether it isDouglas Gregor2009-05-261-2/+11
| | | | | | | | an integral constant expression, maintain a cache of the value and the is-an-ICE flag within the VarDecl itself. This eliminates exponential-time behavior of the Fibonacci template metaprogram. llvm-svn: 72428
* Implement C++0x nullptr.Sebastian Redl2009-05-101-1/+3
| | | | llvm-svn: 71405
* Remove an unneeded special case.Daniel Dunbar2009-05-031-10/+1
| | | | llvm-svn: 70689
* Properly compute the alignment of typedefs that make use of theDouglas Gregor2009-04-301-24/+3
| | | | | | | | | | | | | | "aligned" attribute. Previously, we were skipping over these attributes when we jumped directly to the canonical type. Now, ASTContext::getTypeInfo walks through typedefs and other "non-canonical" types manually, looking for "aligned" attributes on typedefs. As part of this change, I moved the GNU-specific logic (such as determining the alignment of void or of a function pointer) out of the expression evaluator and into ASTContext::getTypeInfo. llvm-svn: 70497
* Minor simplification; also silences gcc warning.Eli Friedman2009-04-291-1/+1
| | | | llvm-svn: 70406
* PR4097: add logic to Evaluate to handle pointer equality comparisons.Eli Friedman2009-04-281-7/+16
| | | | llvm-svn: 70317
* Add handling for complex->int, int->complex float, and float->complex Eli Friedman2009-04-221-14/+38
| | | | | | | int. Note that constant int->complex float and float->complex int casts were being miscompiled. llvm-svn: 69821
* Use an ASTRecordLayout to compute the sizeof an interface, notDaniel Dunbar2009-04-211-7/+7
| | | | | | | | | addRecordToClass. - Among other things, this fixes a crash when applying sizeof to an interface with synthesized ivars, although things still aren't "correct" here. llvm-svn: 69675
* Fix <rdar://problem/6765383> clang-6: clang does not appear to support ↵Steve Naroff2009-04-161-0/+10
| | | | | | declaring a static Block 'const'. llvm-svn: 69306
* Add Expr::EvaluateAsLValue which will (believe it or not) try to evaluate an ↵Anders Carlsson2009-04-101-0/+6
| | | | | | Expr as an LValue. llvm-svn: 68763
* Propagate the ASTContext to various AST traversal and lookup functions.Douglas Gregor2009-04-091-2/+2
| | | | | | No functionality change (really). llvm-svn: 68726
* Slight generalization for Evaluate with const variables.Eli Friedman2009-03-301-2/+2
| | | | llvm-svn: 68075
* Fix PR3868 by making Evaluate handle cases like "(long)&a + 4".Eli Friedman2009-03-241-6/+27
| | | | llvm-svn: 67593
* Minor Evaluate cleanup; add some boilerplate implementations to Eli Friedman2009-03-231-29/+26
| | | | | | Evaluate for __extension__ and __builtin_choose_expr. llvm-svn: 67506
* Minor enhancements to Evaluate.Eli Friedman2009-03-231-13/+25
| | | | llvm-svn: 67503
* Almost complete implementation of rvalue references. One bug, and a few ↵Sebastian Redl2009-03-161-0/+1
| | | | | | unclear areas. Maybe Doug can shed some light on some of the fixmes. llvm-svn: 67059
* Minor cleanup for choose expressions: add a helper that returns the Eli Friedman2009-03-041-9/+3
| | | | | | chosen sub-expression, rather than just evaluating the condition. llvm-svn: 66018
* Fix obvious shortcoming in the implementations of Evaluate for Eli Friedman2009-02-281-3/+19
| | | | | | integer __real__ and __imag__. Not sure how I missed this. llvm-svn: 65677
* Change the AST generated for offsetof a bit so that it looks like a Eli Friedman2009-02-271-2/+10
| | | | | | | | normal expression, and change Evaluate and IRGen to evaluate it like a normal expression. This simplifies the code significantly, and fixes PR3396. llvm-svn: 65622
* Some minor improvements to Evaluate.Eli Friedman2009-02-271-3/+23
| | | | llvm-svn: 65613
* Add Type::hasPointerRepresentation predicate.Daniel Dunbar2009-02-261-8/+2
| | | | | | | | | - For types whose native representation is a pointer. - Use to replace ExprConstant.cpp:HasPointerEvalType, CodeGenFunction::isObjCPointerType. llvm-svn: 65569
* Remove short-circuit evaluation and the extension warnings. I'm Eli Friedman2009-02-261-43/+6
| | | | | | | | | pretty sure we want to keep constant expression verification outside of Evaluate. Because of that, the short-circuit evaluation doesn't generally make sense, and the comma warning doesn't make sense in its current form. llvm-svn: 65525
* first wave of fixes for @encode sema support. This is part of PR3648.Chris Lattner2009-02-241-0/+1
| | | | | | | The big difference here is that (like string literal) @encode has array type, not pointer type. llvm-svn: 65391
* Revert http://llvm.org/viewvc/llvm-project?view=rev&revision=65244.Steve Naroff2009-02-231-2/+1
| | | | | | Remove support for "Class<P>". Will be making this an error. llvm-svn: 65332
* A few small improvements to Evaluate for stuff I noted in FIXMEs.Eli Friedman2009-02-231-17/+88
| | | | llvm-svn: 65305
* A bit of Evaluate cleanup. Also, a full audit of what's missing that Eli Friedman2009-02-221-22/+33
| | | | | | someone would reasonably expect Evaluate to handle for C/ObjC. llvm-svn: 65284
* Enhance Evaluate to handle ObjC qualified id and class types; as far as Eli Friedman2009-02-221-4/+9
| | | | | | | | I know, these follow the exact same rules as pointers, so I just made them use the same codepath. Someone more familiar with ObjC should double-check this, though. llvm-svn: 65261
* Fix for PR3433: map __alignof__ to preferred alignment. (This was Eli Friedman2009-02-221-1/+1
| | | | | | partially done in r65258.) llvm-svn: 65260
* Evaluation of unary deref could call integer evaluator on non-integralDaniel Dunbar2009-02-211-0/+7
| | | | | | | expr; hilarity ensued. - PR3640. llvm-svn: 65234
* Handle constant int -> ptr casts of lvalue results.Daniel Dunbar2009-02-201-8/+17
| | | | | | - PR3463 (again). llvm-svn: 65133
* Add support for * (unary dereference) operator to ExprConstant.Eli Friedman2009-02-201-0/+9
| | | | llvm-svn: 65105
* ExprConstant handling for a couple more cases of pointer-to-int casts Eli Friedman2009-02-201-3/+18
| | | | | | from the testsuite. llvm-svn: 65098
* Extend Evaluate() to fold (int) <pointer type>.Daniel Dunbar2009-02-191-4/+11
| | | | | | | | | | - PR3463, PR3398, <rdar://problem/6553401> crash on relocatable symbol addresses as constants in static locals. - There are many more scenarious we could handle (like arithmetic on such an int) but this is the main use case. llvm-svn: 65074
* Simplify, no functionality change.Daniel Dunbar2009-02-191-6/+6
| | | | llvm-svn: 65073
* Add enough checking to ensure that non-constant block literals don'tMike Stump2009-02-191-1/+5
| | | | | | | appear to be constant. I'll probably redo this and throw it all away later once we have codegen for BlockDeclRefExprs. llvm-svn: 65070
* Change IntExprEvaluator to operate on an APValue not an APSInt.Daniel Dunbar2009-02-191-37/+55
| | | | | | - Prep for handling lvalues, no intended functionality change. llvm-svn: 65063
* Add another IntExprEvaluator::Success overload to suck up remained ofDaniel Dunbar2009-02-191-43/+49
| | | | | | | | | | | | | | | | | | manual setting of the Result. - Idiom now enforces that result will always have correct width and type; this exposed three new bugs: o Enum constant decl value can have different width than type (PR3173). o EvaluateInteger should not run an IntExprEvaluator over non-integral expressions. o FloatExprEvaluate was not handling casts correctly (it was evaluating the cast in the IntExprEvaluator!). llvm-svn: 65053
* Add IntExprEvaluator::Success method.Daniel Dunbar2009-02-191-174/+77
| | | | | | | | | | | - Handles assignment to Result with appropriate type. - Simplifies & encapsulates most direct handling of the Result value; prep for allowing IntExprEvaluator to deal with LValue APValues. - No intended functionality change. llvm-svn: 65038
* Handle the GNU void* and function pointer arithmetic extensions for constant ↵Anders Carlsson2009-02-191-1/+7
| | | | | | expressions as well. llvm-svn: 65013
* More codegen for blocks. The type of block literals should be better.Mike Stump2009-02-191-0/+1
| | | | | | The size calculation is improved. llvm-svn: 64994
* Codegen for int (^bp)(int) = 0;Mike Stump2009-02-181-2/+4
| | | | llvm-svn: 64951
* Rename UnaryTypeTraitExpr::Evaluate to EvaluateTrait to not collideDaniel Dunbar2009-02-171-1/+1
| | | | | | with Expr::Evaluate(). llvm-svn: 64850
* Eek! getDeclAlign sometimes returned alignment in bits.Daniel Dunbar2009-02-171-2/+2
| | | | | | | | | | | - Renamed to getDeclAlignInBytes since most other query functions work in bits. - Fun to track down as isIntegerConstantExpr was getting it right, but Evaluate() was getting it wrong. Maybe we should assert they compute the same thing when they succeed? llvm-svn: 64828
* Renamed ASQualType to ExtQualType to reflect its moreFariborz Jahanian2009-02-171-2/+2
| | | | | | | general use; as for, objc2's gc type attributes. No change in functionality. llvm-svn: 64778
* Add hook to add attributes to function declarations that we knowDouglas Gregor2009-02-141-3/+4
| | | | | | | | | | | | | | | | about, whether they are builtins or not. Use this to add the appropriate "format" attribute to NSLog, NSLogv, asprintf, and vasprintf, and to translate builtin attributes (from Builtins.def) into actual attributes on the function declaration. Use the "printf" format attribute on function declarations to determine whether we should do format string checking, rather than looking at an ad hoc list of builtins and "known" function names. Be a bit more careful about when we consider a function a "builtin" in C++. llvm-svn: 64561
* Teach the constant evaluator about C++ const integral variables.Sebastian Redl2009-02-081-1/+10
| | | | llvm-svn: 64086
* Evaluate ==,!= for complex types.Daniel Dunbar2009-01-291-0/+44
| | | | llvm-svn: 63280
* Evaluate casts to complex.Daniel Dunbar2009-01-291-30/+103
| | | | | | | | | - Lift (int,float) -> (int,float) conversion into separate routines. - Fix handling of, e.g., char -> _Complex int, which was producing a _Complex char value instead. llvm-svn: 63278
OpenPOWER on IntegriCloud