summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprConstant.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* move library-specific diagnostic headers into library private dirs. ReduceChris Lattner2009-01-291-1/+1
| | | | | | redundant #includes. Patch by Anders Johnsen! llvm-svn: 63271
* Add folding for complex mul and fix some major bugs in complex floatDaniel Dunbar2009-01-291-2/+37
| | | | | | | | evaluation (alternate part of real/imag init was being set to 3 not 0 because the wrong APFloat constructor was being called). - Test cases coming once some more support is in. llvm-svn: 63264
* Implement basic _Complex integer constant folding.Daniel Dunbar2009-01-281-33/+67
| | | | | | | - Merged into single ComplexEvaluator, these share too much logic to be worth splitting for float/int (IMHO). Will split on request. llvm-svn: 63248
* Split the single monolithic DiagnosticKinds.def file into oneChris Lattner2009-01-271-1/+1
| | | | | | | | | .def file for each library. This means that adding a diagnostic to sema doesn't require all the other libraries to be rebuilt. Patch by Anders Johnsen! llvm-svn: 63111
* Make the constant folder aware of Eli Friedman2009-01-251-0/+7
| | | | | | | __builtin___CFStringMakeConstantString. (We get into trouble in GenerateStaticBlockVarDecl if the constant folder isn't accurate.) llvm-svn: 62949
* Fix the address of a label to be properly considered and emitted as aEli Friedman2009-01-251-0/+2
| | | | | | constant. llvm-svn: 62948
* Refactor sizeof handling to use constant folding logic for constant Eli Friedman2009-01-241-5/+10
| | | | | | sizeof expressions. llvm-svn: 62941
* add initial support for the gcc "alignof(decl) is the alignment of the declChris Lattner2009-01-241-5/+14
| | | | | | | not the type" semantics. This can definitely be improved, but is better than what we had. llvm-svn: 62939
* Improve handling of alignof. alignof(VLA) now works properly for example.Chris Lattner2009-01-241-13/+50
| | | | llvm-svn: 62932
* Fix invalid evaluation of _Complex float (real & imaginary parts hadDaniel Dunbar2009-01-241-2/+8
| | | | | | | mismatched semantics). - Enforce this in APValue. llvm-svn: 62924
* Support evaluation of vector constant expressions, and codegen of same.Nate Begeman2009-01-181-1/+77
| | | | llvm-svn: 62455
* postpone sizeof objc-class computatin to the clients.Fariborz Jahanian2009-01-161-0/+4
| | | | llvm-svn: 62292
* Fix some unused variable, control reaches end of non-void function,Daniel Dunbar2009-01-151-0/+1
| | | | | | and uninitialized use options. llvm-svn: 62270
* PODness and Type TraitsSebastian Redl2009-01-051-0/+6
| | | | | | | | | | | | | | | Make C++ classes track the POD property (C++ [class]p4) Track the existence of a copy assignment operator. Implicitly declare the copy assignment operator if none is provided. Implement most of the parsing job for the G++ type traits extension. Fully implement the low-hanging fruit of the type traits: __is_pod: Whether a type is a POD. __is_class: Whether a type is a (non-union) class. __is_union: Whether a type is a union. __is_enum: Whether a type is an enum. __is_polymorphic: Whether a type is polymorphic (C++ [class.virtual]p1). llvm-svn: 61746
* Add codegen support for __nullAnders Carlsson2008-12-211-0/+6
| | | | llvm-svn: 61314
* Add support for member references (E1.E2, E1->E2) with C++ semantics,Douglas Gregor2008-12-201-1/+4
| | | | | | | | | | which can refer to static data members, enumerators, and member functions as well as to non-static data members. Implement correct lvalue computation for member references in C++. Compute the result type of non-static data members of reference type properly. llvm-svn: 61294
* Get rid of the old Expr::Evaluate variant.Anders Carlsson2008-12-191-17/+4
| | | | llvm-svn: 61260
* Unifies the name-lookup mechanisms used in various parts of the ASTDouglas Gregor2008-12-111-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and separates lexical name lookup from qualified name lookup. In particular: * Make DeclContext the central data structure for storing and looking up declarations within existing declarations, e.g., members of structs/unions/classes, enumerators in C++0x enums, members of C++ namespaces, and (later) members of Objective-C interfaces/implementations. DeclContext uses a lazily-constructed data structure optimized for fast lookup (array for small contexts, hash table for larger contexts). * Implement C++ qualified name lookup in terms of lookup into DeclContext. * Implement C++ unqualified name lookup in terms of qualified+unqualified name lookup (since unqualified lookup is not purely lexical in C++!) * Limit the use of the chains of declarations stored in IdentifierInfo to those names declared lexically. * Eliminate CXXFieldDecl, collapsing its behavior into FieldDecl. (FieldDecl is now a ScopedDecl). * Make RecordDecl into a DeclContext and eliminates its Members/NumMembers fields (since one can just iterate through the DeclContext to get the fields). llvm-svn: 60878
* Workaround for PR3173. The fix is correct in the sense that if the enum Eli Friedman2008-12-081-0/+3
| | | | | | | | | code were working correctly, it would be a no-op, but it's not really a proper fix. That said, I don't really want to touch the enum code at the moment because I don't understand it very well, and this seems to be a relatively visible regression. llvm-svn: 60680
* This wasn't such a good idea after all as it broke some tests.Anders Carlsson2008-12-051-10/+1
| | | | llvm-svn: 60582
* Handle __builtin___CFStringMakeConstantString in Expr::Evaluate.Anders Carlsson2008-12-051-1/+10
| | | | llvm-svn: 60581
* Generate the correct results for the comma expression. Fixes PR3123.Anders Carlsson2008-12-011-7/+10
| | | | llvm-svn: 60334
* Emit the correct diagnostic when a comma is in an ICE.Anders Carlsson2008-12-011-4/+4
| | | | llvm-svn: 60316
* Change the diagnostics that the evaluator reports to be of type NOTE.Anders Carlsson2008-11-301-11/+10
| | | | llvm-svn: 60301
* Replace the isEvaluated bool with a ShortCircuit int, making it easier to ↵Anders Carlsson2008-11-301-12/+10
| | | | | | handle recursion llvm-svn: 60300
* Pass the expression to the Error and Extension methods.Anders Carlsson2008-11-301-20/+22
| | | | llvm-svn: 60299
* Add a new variant of Evaluate and reimplement the old Evaluate in terms of ↵Anders Carlsson2008-11-301-7/+17
| | | | | | the new. llvm-svn: 60298
* General cleanup, evaluate the RHS of a logical op even if the LHS will give ↵Anders Carlsson2008-11-301-16/+25
| | | | | | us the result. llvm-svn: 60297
* EvalInfo now holds a reference to an EvalResult struct.Anders Carlsson2008-11-301-24/+14
| | | | llvm-svn: 60296
* remove debug-only assertion in the complex float evaluator as it makes some ↵Nuno Lopes2008-11-261-1/+0
| | | | | | real apps crash llvm-svn: 60069
* The address of a variable is only constant if the variable has global storage.Anders Carlsson2008-11-241-1/+9
| | | | llvm-svn: 59939
* Fix bug in the constant evaluator. Fixes PR3115.Anders Carlsson2008-11-241-33/+33
| | | | llvm-svn: 59938
* Return false if we encounter a type we can't handle.Anders Carlsson2008-11-221-1/+2
| | | | llvm-svn: 59889
* Case values must be evaluatedAnders Carlsson2008-11-221-19/+23
| | | | llvm-svn: 59884
* Use Expr::Evaluate for case statements. Fixes PR2525Anders Carlsson2008-11-221-9/+27
| | | | llvm-svn: 59881
* fix folding of '*doubleArray'Nuno Lopes2008-11-191-0/+3
| | | | llvm-svn: 59647
* Address some comments Eli had.Anders Carlsson2008-11-161-11/+6
| | | | llvm-svn: 59430
* use HandleConversionToBool() to check if a given cond is foldable (per Eli's ↵Nuno Lopes2008-11-161-3/+3
| | | | | | comment) llvm-svn: 59429
* More complex float evaluator support.Anders Carlsson2008-11-161-0/+45
| | | | llvm-svn: 59428
OpenPOWER on IntegriCloud