summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/APValue.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [ExprConstant] Use an AST node and a version number as a key to createAkira Hatanaka2018-04-101-17/+62
| | | | | | | | | | | | | | | an APValue and retrieve it from map Temporaries. The version number is needed when a single AST node is visited multiple times and is used to create APValues that are required to be distinct from each other (for example, MaterializeTemporaryExprs in default arguments and VarDecls in loops). rdar://problem/36505742 Differential Revision: https://reviews.llvm.org/D42776 llvm-svn: 329671
* Re-commit r289252 and r289285, and fix PR31374Yaxun Liu2016-12-151-4/+13
| | | | llvm-svn: 289787
* Revert 289252 (and follow-up 289285), it caused PR31374Nico Weber2016-12-141-13/+4
| | | | llvm-svn: 289713
* Replace APFloatBase static fltSemantics data members with getter functionsStephan Bergmann2016-12-141-1/+1
| | | | | | | | | | | | | At least the plugin used by the LibreOffice build (<https://wiki.documentfoundation.org/Development/Clang_plugins>) indirectly uses those members (through inline functions in LLVM/Clang include files in turn using them), but they are not exported by utils/extract_symbols.py on Windows, and accessing data across DLL/EXE boundaries on Windows is generally problematic. Differential Revision: https://reviews.llvm.org/D26671 llvm-svn: 289647
* Add support for non-zero null pointer for C and OpenCLYaxun Liu2016-12-091-4/+13
| | | | | | | | | | | | | | | | | | In amdgcn target, null pointers in global, constant, and generic address space take value 0 but null pointers in private and local address space take value -1. Currently LLVM assumes all null pointers take value 0, which results in incorrectly translated IR. To workaround this issue, instead of emit null pointers in local and private address space, a null pointer in generic address space is emitted and casted to local and private address space. Tentative definition of global variables with non-zero initializer will have weak linkage instead of common linkage since common linkage requires zero initializer and does not have explicit section to hold the non-zero value. Virtual member functions getNullPointer and performAddrSpaceCast are added to TargetCodeGenInfo which by default returns ConstantPointerNull and emitting addrspacecast instruction. A virtual member function getNullPointerValue is added to TargetInfo which by default returns 0. Each target can override these virtual functions to get target specific null pointer and the null pointer value for specific address space, and perform specific translations for addrspacecast. Wrapper functions getNullPointer is added to CodegenModule and getTargetNullPointerValue is added to ASTContext to facilitate getting the target specific null pointers and their values. This change has no effect on other targets except amdgcn target. Other targets can provide support of non-zero null pointer in a similar way. This change only provides support for non-zero null pointer for C and OpenCL. Supporting for other languages will be added later incrementally. Differential Revision: https://reviews.llvm.org/D26196 llvm-svn: 289252
* [NFC] Header cleanupMehdi Amini2016-07-181-2/+0
| | | | | | | | | | Summary: Removed unused headers, replaced some headers with forward class declarations Patch by: Eugene <claprix@yandex.ru> Differential Revision: https://reviews.llvm.org/D20100 llvm-svn: 275882
* Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith ↵Yaron Keren2016-01-291-1/+1
| | | | | | r259192 post commit comment. llvm-svn: 259232
* Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or ↵Craig Topper2014-08-271-2/+2
| | | | | | just letting them be implicitly created. llvm-svn: 216528
* Removing an "if (this == nullptr)" check from two print methods. The conditionRichard Trieu2014-06-091-1/+6
| | | | | | | will never be true in a well-defined context. The checking for null pointers has been moved into the caller logic so it does not rely on undefined behavior. llvm-svn: 210498
* [C++11] Use 'nullptr'. AST edition.Craig Topper2014-05-121-4/+5
| | | | llvm-svn: 208517
* Make some assertions on constant expressions static.Benjamin Kramer2014-03-151-1/+1
| | | | llvm-svn: 204012
* [C++11] Replacing RecordDecl iterators field_begin() and field_end() with ↵Aaron Ballman2014-03-081-2/+1
| | | | | | iterator_range fields(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203355
* Reapply r198845, reverted in r198849, with a fix to make it valid C++98, notRichard Smith2014-01-101-35/+39
| | | | | | | | | | | just valid C++11 =) Original commit message: PR18427: Use an appropriately-aligned buffer in APValue, to avoid a crash on SPARC, where uint64_t apparently requires higher alignment than void*. llvm-svn: 198903
* Revert "PR18427: Use an appropriately-aligned buffer in APValue, to avoid a ↵Argyrios Kyrtzidis2014-01-091-40/+34
| | | | | | | | | crash on" It broke building. This reverts commit r198845. llvm-svn: 198849
* PR18427: Use an appropriately-aligned buffer in APValue, to avoid a crash onRichard Smith2014-01-091-34/+40
| | | | | | SPARC, where uint64_t apparently requires higher alignment than void*. llvm-svn: 198845
* Pacify compilers that think you can drop off a fully covered switch.Benjamin Kramer2013-06-031-0/+1
| | | | llvm-svn: 183155
* Fix memory leak for APValues that do memory allocation.Manuel Klimek2013-06-031-0/+33
| | | | | | | | | This patch ensures that APValues are deallocated with the ASTContext by registering a deallocation function for APValues to the ASTContext. Original version of the patch by James Dennett. llvm-svn: 183101
* Don't crash while printing APValues that are lvalues casted to aDouglas Gregor2013-01-291-0/+2
| | | | | | decidedly non-reference, non-pointer type. Fixes <rdar://problem/13090123>. llvm-svn: 173747
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-1/+1
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Store SourceManager pointer on PrintingPolicy in the case where we're dumping,Richard Smith2012-08-161-3/+2
| | | | | | | | | and remove ASTContext reference (which was frequently bound to a dereferenced null pointer) from the recursive lump of printPretty functions. In so doing, fix (at least) one case where we intended to use the 'dump' mode, but that failed because a null ASTContext reference had been passed in. llvm-svn: 162011
* Remove the ref/value inconsistency in filter_decl_iterator.David Blaikie2012-04-301-3/+3
| | | | | | | | | | | | | filter_decl_iterator had a weird mismatch where both op* and op-> returned T* making it difficult to generalize this filtering behavior into a reusable library of any kind. This change errs on the side of value, making op-> return T* and op* return T&. (reviewed by Richard Smith) llvm-svn: 155808
* Teach APValue printer to print boolean 0 and 1 as 'false' and 'true'. Fix upRichard Smith2012-03-231-1/+4
| | | | | | some calling code to actually pass in a non-null type, to avoid a crash. llvm-svn: 153358
* Assign APValues by swapping from a temporary. Removes a bunch of unnecessaryRichard Smith2012-03-101-42/+47
| | | | | | | | copy-construction, which Daniel Dunbar reports as giving a 0.75% speedup on 403.gcc/combine.c. The performance differences on my constexpr torture tests are below the noise floor. llvm-svn: 152455
* [AST] APValue: Split the fast path of MakeUninit to be inline.Daniel Dunbar2012-03-081-1/+1
| | | | | | | - This change seems to be a tiny loss on 403.gcc/combine.c (.2%), but I think it is the right thing to do. llvm-svn: 152330
* Implement DR1454. This allows all intermediate results in constant expressionsRichard Smith2012-02-151-4/+15
| | | | | | | | | | | | to be core constant expressions (including pointers and references to temporaries), and makes constexpr calculations Turing-complete. A Turing machine simulator is included as a testcase. This opens up the possibilty of removing CCValue entirely, and removing some copies from the constant evaluator in the process, but that cleanup is not part of this change. llvm-svn: 150557
* Add an APValue representation for the difference between two ↵Eli Friedman2012-01-041-1/+16
| | | | | | | | | | address-of-label expressions. Add support to Evaluate and CGExprConstant for generating/handling them. Remove the special-case for such differences in Expr::isConstantInitializer. With that done, remove a bunch of buggy code from CGExprConstant for handling scalar expressions which is no longer necessary. Fixes PR11705. llvm-svn: 147561
* Add missing flush call. This is an attempt to fix a broken Windows buildbot.Eli Friedman2011-12-161-0/+1
| | | | llvm-svn: 146760
* C++11 constexpr: Add note stacks containing backtraces if constant evaluationRichard Smith2011-12-161-57/+192
| | | | | | | | | | fails within a call to a constexpr function. Add -fconstexpr-backtrace-limit argument to driver and frontend, to control the maximum number of notes so produced (default 10). Fix APValue printing to be able to pretty-print all APValue types, and move the testing for this functionality from a unittest to a -verify test now that it's visible in clang's output. llvm-svn: 146749
* Constant expression evaluation: add support for evaluation of member pointersRichard Smith2011-11-171-16/+105
| | | | | | and base-to-derived casts, and add proper handling of temporaries. llvm-svn: 144926
* Represent an APValue based on a Decl as that Decl, rather than a DeclRefExprRichard Smith2011-11-121-9/+4
| | | | | | | | or MemberExpr which refers to it. As a side-effect, MemberExprs which refer to static member functions and static data members are now emitted as constant expressions. llvm-svn: 144468
* Constant expression evaluation: support for evaluation of structs and unions ofRichard Smith2011-11-101-12/+78
| | | | | | | literal types, as well as derived-to-base casts for lvalues and derived-to-virtual-base casts. llvm-svn: 144265
* Constant expression evaluation: support for arrays.Richard Smith2011-11-071-2/+43
| | | | llvm-svn: 143922
* Fix 32-bit build bots and remove some casting-away-const warnings.Richard Smith2011-11-071-2/+6
| | | | llvm-svn: 143914
* Constant expression evaluation: preserve subobject designator when flattening aRichard Smith2011-11-071-8/+63
| | | | | | core constant value down to an APValue. llvm-svn: 143909
* constexpr function substitution:Richard Smith2011-10-291-4/+3
| | | | | | | | Track the function invocation where an lvalue referring to a constexpr function parameter originated from, and use it to substitute the correct argument and to determine whether such an argument's lifetime has ended. llvm-svn: 143296
* Fix missing includes for llvm_unreachableDavid Blaikie2011-09-231-0/+1
| | | | llvm-svn: 140368
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-2/+2
| | | | llvm-svn: 140367
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-2/+2
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Define DiagnosticBuilder<<APValue so it's easy to include APValues inJeffrey Yasskin2011-07-181-0/+45
| | | | | | diagnostics. llvm-svn: 135398
* Refactoring of constant expression evaluatorPeter Collingbourne2011-05-131-4/+4
| | | | | | | | | This introduces a generic base class for the expression evaluator classes, which handles a few common expression types which were previously handled separately in each class. Also, the expression evaluator now uses ConstStmtVisitor. llvm-svn: 131281
* Fix -Wcast-qual warnings.Dan Gohman2010-04-191-1/+2
| | | | llvm-svn: 101786
* Convert the type of the LValue offset variable in APValue to CharUnits, movingKen Dyck2010-01-151-0/+33
| | | | | | the LValue-related methods of APValue out of line to avoid header file leaching. llvm-svn: 93512
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-1/+1
| | | | llvm-svn: 81346
* Make sure to access APValue's data via a char array (rather thanDouglas Gregor2009-09-081-7/+7
| | | | | | | | through an array of void*), so that we don't run afoul of the strict-aliasing rules in C++ 3.10p15. Unfortunately, GCC 4.4 still complains about this code. llvm-svn: 81251
* Remove some now-unneeded calls to llvm::errs().flush().Daniel Dunbar2009-03-101-1/+0
| | | | llvm-svn: 66555
* Support evaluation of vector constant expressions, and codegen of same.Nate Begeman2009-01-181-1/+3
| | | | llvm-svn: 62455
* Add support for vectors to APValue. Vector constant evaluator and tests coming.Nate Begeman2009-01-181-0/+10
| | | | llvm-svn: 62438
* add dump and print methods, add operator<< for APValue.Chris Lattner2008-11-161-0/+97
llvm-svn: 59411
OpenPOWER on IntegriCloud