llvm-project/clang/lib
Gauthier Harnisch 83c7b61052 [clang] Add storage for APValue in ConstantExpr
Summary:
When using ConstantExpr we often need the result of the expression to be kept in the AST. Currently this is done on a by the node that needs the result and has been done multiple times for enumerator, for constexpr variables... . This patch adds to ConstantExpr the ability to store the result of evaluating the expression. no functional changes expected.

Changes:
 - Add trailling object to ConstantExpr that can hold an APValue or an uint64_t. the uint64_t is here because most ConstantExpr yield integral values so there is an optimized layout for integral values.
 - Add basic* serialization support for the trailing result.
 - Move conversion functions from an enum to a fltSemantics from clang::FloatingLiteral to llvm::APFloatBase. this change is to make it usable for serializing APValues.
 - Add basic* Import support for the trailing result.
 - ConstantExpr created in CheckConvertedConstantExpression now stores the result in the ConstantExpr Node.
 - Adapt AST dump to print the result when present.

basic* : None, Indeterminate, Int, Float, FixedPoint, ComplexInt, ComplexFloat,
the result is not yet used anywhere but for -ast-dump.

Reviewers: rsmith, martong, shafik

Reviewed By: rsmith

Subscribers: rnkovacs, hiraditya, dexonsmith, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D62399

llvm-svn: 363493
2019-06-15 10:24:47 +00:00
..
ARCMigrate [PlistSupport] Produce a newline to end plist output files 2019-06-10 22:30:57 +00:00
AST [clang] Add storage for APValue in ConstantExpr 2019-06-15 10:24:47 +00:00
ASTMatchers Added AST matcher for ignoring elidable constructors 2019-06-13 13:48:24 +00:00
Analysis [analyzer] ProgramPoint: more explicit printJson() 2019-06-12 18:24:02 +00:00
Basic [Targets] Move soft-float-abi filtering to `initFeatureMap` 2019-06-14 00:35:17 +00:00
CodeGen [CodeGen][ObjC] Annotate retain-agnostic ObjC globals with attribute 2019-06-14 22:06:28 +00:00
CrossTU [ASTImporter] Use llvm::Expected and Error in the importer API 2019-05-15 10:29:48 +00:00
Driver Add --print-supported-cpus flag for clang. 2019-06-14 21:42:21 +00:00
Edit Range-style std::find{,_if} -> llvm::find{,_if}. NFC 2019-03-31 08:48:19 +00:00
Format clang-format: better handle namespace macros 2019-06-06 20:06:23 +00:00
Frontend Add --print-supported-cpus flag for clang. 2019-06-14 21:42:21 +00:00
FrontendTool Add clang source minimizer that reduces source to directives 2019-06-03 22:59:17 +00:00
Headers [PowerPC] [Clang] Port SSE2 intrinsics to PowerPC 2019-06-12 05:25:40 +00:00
Index [Index] Compute correct symbol kind for variable templates 2019-05-29 17:49:30 +00:00
Lex [clang][HeaderSearch] Consider all path separators equal 2019-06-06 18:49:16 +00:00
Parse [C++20] add Basic consteval specifier 2019-06-14 08:56:20 +00:00
Rewrite [analyzer] [NFC] PathDiagnostic: Create PathDiagnosticPopUpPiece 2019-05-29 19:21:59 +00:00
Sema [clang] Add storage for APValue in ConstantExpr 2019-06-15 10:24:47 +00:00
Serialization [clang] Add storage for APValue in ConstantExpr 2019-06-15 10:24:47 +00:00
StaticAnalyzer [analyzer] ReturnVisitor: Bypass everything to see inlined calls 2019-06-15 10:05:49 +00:00
Tooling [LibTooling] Add `before` and `after` selectors for selecting point-ranges relative to nodes. 2019-05-29 12:40:36 +00:00
CMakeLists.txt Add Cross Translation Unit support library 2017-09-22 11:11:01 +00:00