History log of /external/clang/lib/AST/ExprConstant.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
3ea9e33ea25e0c2b12db56418ba3f994eb662c04 08-Apr-2015 Pirama Arumuga Nainar <pirama@google.com> Update aosp/master clang for rebase to r233350

Change-Id: I12d4823f10bc9e445b8b86e7721b71f98d1df442
/external/clang/lib/AST/ExprConstant.cpp
0e2c34f92f00628d48968dfea096d36381f494cb 23-Mar-2015 Stephen Hines <srhines@google.com> Update aosp/master clang for rebase to r230699.

Change-Id: I6a546ab3d4ae37119eebb735e102cca4f80ab520
/external/clang/lib/AST/ExprConstant.cpp
176edba5311f6eff0cad2631449885ddf4fbc9ea 01-Dec-2014 Stephen Hines <srhines@google.com> Update aosp/master Clang for rebase to r222490.

Change-Id: Ic557ac55e97fbf6ee08771c7b7c3594777b0aefd
/external/clang/lib/AST/ExprConstant.cpp
c568f1e98938584c0ef0b12ae5018ff7d90a4072 21-Jul-2014 Stephen Hines <srhines@google.com> Update Clang for rebase to r212749.

This also fixes a small issue with arm_neon.h not being generated always.

Includes a cherry-pick of:
r213450 - fixes mac-specific header issue
r213126 - removes a default -Bsymbolic on Android

Change-Id: I2a790a0f5d3b2aab11de596fc3a74e7cbc99081d
/external/clang/lib/AST/ExprConstant.cpp
6bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89 29-May-2014 Stephen Hines <srhines@google.com> Update Clang for 3.5 rebase (r209713).

Change-Id: I8c9133b0f8f776dc915f270b60f94962e771bc83
/external/clang/lib/AST/ExprConstant.cpp
651f13cea278ec967336033dd032faef0e9fc2ec 24-Apr-2014 Stephen Hines <srhines@google.com> Updated to Clang 3.5a.

Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
/external/clang/lib/AST/ExprConstant.cpp
e21432efa94079aa1a62f7d5ff3b47a92d3c8296 15-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> Modern gcc is happy to constant evaluate __builtin_strlen in various cases
where we didn't. Extend our constant evaluation for __builtin_strlen to handle
any constant array of chars, not just string literals, to match.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194762 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
9aebdc94d819e8a537030efc70567d585382ecf9 07-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR17615: A delegating constructor initializer is a full-expression. Don't
forget to clean up temporaries at the end of it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194213 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
0de7ba67f896a01ac1d99821a5f2b31c5fb7ccb4 06-Nov-2013 Aaron Ballman <aaron@aaronballman.com> Silencing some MSVC warnings about not all control paths returning a value when they actually do.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194156 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
9a9ca98d6463530384aa12685034899c4cc8733d 06-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> More constant evaluation cleanup, and fix an issue where we'd override an
earlier 'non-constant' diagnostic with a later one if the earlier one was from
a side-effect we thought we could evaluate past.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194117 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
0004329758b99d2b92096b353e35c427ebbee622 05-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> Simplify: we don't care why constant evaluation might have failed when we're
checking an expression for constant overflow.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194099 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f490f0eaba5fed6236d8f8a965a2fd98fa41e891 05-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> Refactor constant expression handling and make a couple of tweaks to make it a
bit more robust against future changes. This includes a slight diagnostic
improvement: if we know we're only trying to form a constant expression, take
the first diagnostic which shows the expression is not a constant expression,
rather than preferring the first one which makes the expression unfoldable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194098 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f186c9203278c0804b051e2b10ee2631a4d17274 15-Oct-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add constant evaluation support for __builtin_isinf, __builtin_isfinite,
__builtin_isnan, and __builtin_isnormal. Patch by Karthik Bhat! Tests by me.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192729 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
bf44918562811a1a895aa09f34549f5119d10f8b 22-Sep-2013 Nick Lewycky <nicholas@mxc.ca> Fix comment to match name of variable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191171 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
414a1bdbdaf250e0488589f12865c8961831b65d 18-Sep-2013 Hal Finkel <hfinkel@anl.gov> Add the intrinsic __builtin_convertvector

LLVM supports applying conversion instructions to vectors of the same number of
elements (fptrunc, fptosi, etc.) but there had been no way for a Clang user to
cause such instructions to be generated when using builtin vector types.

C-style casting on vectors is already defined in terms of bitcasts, and so
cannot be used for these conversions as well (without leading to a very
confusing set of semantics). As a result, this adds a __builtin_convertvector
intrinsic (patterned after the OpenCL __builtin_astype intrinsic). This is
intended to aid the creation of vector intrinsic headers that create generic IR
instead of target-dependent intrinsics (in other words, this is a generic
_mm_cvtepi32_ps). As noted in the documentation, the action of
__builtin_convertvector is defined in terms of the action of a C-style cast on
each vector element.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190915 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
69b6515cfa336a2bfc26f5dfd9023ebf143836f3 17-Sep-2013 Eli Friedman <eli.friedman@gmail.com> Fix const-eval of vector init-lists of a vector.

Like any other type, an init list for a vector can have the same type as
the vector itself; handle that case.

<rdar://problem/14990460>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190844 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
1fca547913774c6c547a15414d1a7051c1f446b5 13-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> Part three of PR15721: if we have an invalid CXXDefaultInitExpr, don't crash if
we try to constant-evaluate it. Patch by Karthik Bhat, test by me.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190722 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
812d6bcbd13190e6e5c2c915bf1499038d56b44b 10-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR5683: Issue a warning when subtracting pointers to types of zero size, and
treat such subtractions as being non-constant. Patch by Serge Pavlov! With a
few tweaks by me.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190439 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
4e1a82c14cba135ebd86bcc914fcbbc524d70a61 30-Aug-2013 Eli Friedman <eli.friedman@gmail.com> Adjust clang for change to APFloat::toString.

I changed the diagnostic printing code because it's probably better
to cut off a digit from DBL_MAX than to print something like
1.300000001 when the user wrote 1.3.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189625 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
32b5a1e82f535d43e94332183cd330f4a39b2dbd 22-Aug-2013 Craig Topper <craig.topper@gmail.com> Constify more uses of ASTContext&. No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188991 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
3835a4ef050da466038844274d79f1fc9d77c0f1 06-Aug-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR16755: When initializing or modifying a bitfield member in a constant
expression, truncate the stored value to the size of the bitfield.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187782 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
03ce5f8c68f55405db6001e82bdb18581d0dadce 24-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y: track object lifetime during constexpr evaluation, and don't allow
objects to be used once their lifetimes end. This completes the C++1y
constexpr extensions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187025 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
a5e660188a3c654cf0c88ed1093b28207e870b2b 20-Jul-2013 Eli Friedman <eli.friedman@gmail.com> Make IgnoreParens() look through ChooseExprs.

This is the same way GenericSelectionExpr works, and it's generally a
more consistent approach.

A large part of this patch is devoted to caching the value of the condition
of a ChooseExpr; it's needed to avoid threading an ASTContext into
IgnoreParens().

Fixes <rdar://problem/14438917>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186738 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
5154dce6388e3aaa445467030df7a45ed1211abe 11-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add a __builtin_addressof that performs the same functionality as the built-in
& operator (ignoring any overloaded operator& for the type). The purpose of
this builtin is for use in std::addressof, to allow it to be made constexpr;
the existing implementation technique (reinterpret_cast to some reference type,
take address, reinterpert_cast back) does not permit this because
reinterpret_cast between reference types is not permitted in a constant
expression in C++11 onwards.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186053 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
37a84f653c196aa0b73fad96707175a62dcb6a12 20-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR16377: Allow evaluation of statement expressions in constant evaluation,
why not. Apparently GCC supports this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184396 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
3ed4d1cbaad763c103771bdefb8b986a08f165fc 18-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR14503: Don't assert if a constexpr constructor temploid instantiates to a
constructor that does not initialize all members, and that constructor is used
to initialize a global.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184211 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
3282b84296dba58e811741b63e4429980a98df8b 14-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Emit initializers for static-storage-duration temporaries as constants where
possible.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183967 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
5350ded82a4e93a79c99a322e11360e096e2f852 13-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> More for PR12457: fix handling of __builtin_isinf_sign and test.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183890 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
acaf72adaed7b320fdec8c09f70ec9ac46df3563 13-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Towards PR12457: constant expression evaluation support for __builtin_parity{,l,ll}, __builtin_ffs{,l,ll}, and __builtin_fpclassify.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183889 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
4dbf408ee91a35f7c703ab279e7eaa1803215936 13-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix part of PR12457. Patch by Justin Bogner!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183886 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
7c3e615f01e8f9f587315800fdaf2305ed824568 13-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR12086, PR15117

Introduce CXXStdInitializerListExpr node, representing the implicit
construction of a std::initializer_list<T> object from its underlying array.
The AST representation of such an expression goes from an InitListExpr with a
flag set, to a CXXStdInitializerListExpr containing a MaterializeTemporaryExpr
containing an InitListExpr (possibly wrapped in a CXXBindTemporaryExpr).

This more detailed representation has several advantages, the most important of
which is that the new MaterializeTemporaryExpr allows us to directly model
lifetime extension of the underlying temporary array. Using that, this patch
*drastically* simplifies the IR generation of this construct, provides IR
generation support for nested global initializer_list objects, fixes several
bugs where the destructors for the underlying array would accidentally not get
invoked, and provides constant expression evaluation support for
std::initializer_list objects.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183872 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f69dd33cfc0b1f2a6c88d10951dbd29c4dc806c2 06-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> When a static storage duration temporary appears in a constant expression, it
must be initialized by a constant expression (not just a core constant
expression), because we're going to emit it as a global. Core issue for this is
pending.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183388 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
211c8ddb5b500ed84833751363d0cfe1115f4dd3 05-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Model temporary lifetime-extension explicitly in the AST. Use this model to
handle temporaries which have been lifetime-extended to static storage duration
within constant expressions. This correctly handles nested lifetime extension
(through reference members of aggregates in aggregate initializers) but
non-constant-expression emission hasn't yet been updated to do the same.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183283 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
8a66bf78becf05a24e8251379f3843d1fceb627f 03-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Refactor constant expression evaluation to associate the complete object of a
materialized temporary with the corresponding MaterializeTemporaryExpr. This is
groundwork for providing C++11's guaranteed static initialization for global
references bound to lifetime-extended temporaries (if the initialization is a
constant expression).

In passing, fix a couple of bugs where some evaluation failures didn't trigger
diagnostics, and a rejects-valid where potential constant expression testing
would assume that it knew the dynamic type of *this and would reject programs
which relied on it being some derived type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183093 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
5705f211472f19fc38e58d81365f9261024b3ba3 23-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR14772: Support constant expression evaluation for _Atomic types.
* Treat _Atomic(T) as a literal type if T is a literal type.
* Evaluate expressions of this type properly.
* Fix a lurking bug where we built completely bogus ASTs for converting to
_Atomic types in C++ in some cases, caught by the tests for this change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182541 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
c45c8dd54bc54f9be46546fdf002dc9fe07d1715 16-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Tidy up now that PointerUnion has an operator== that works.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181983 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
7247c88d1e41514a41085f83ebf03dd5220e054a 15-May-2013 David Blaikie <dblaikie@gmail.com> Use only explicit bool conversion operator

The most common (non-buggy) case are where such objects are used as
return expressions in bool-returning functions or as boolean function
arguments. In those cases I've used (& added if necessary) a named
function to provide the equivalent (or sometimes negative, depending on
convenient wording) test.

DiagnosticBuilder kept its implicit conversion operator owing to the
prevalent use of it in return statements.

One bug was found in ExprConstant.cpp involving a comparison of two
PointerUnions (PointerUnion did not previously have an operator==, so
instead both operands were converted to bool & then compared). A test
is included in test/SemaCXX/constant-expression-cxx1y.cpp for the fix
(adding operator== to PointerUnion in LLVM).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181869 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f039e3eb0ffa87aae0e38cec48f367ee179b4de6 14-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Suppress bogus "use of undefined constexpr function" error if the function body
was erroneous and got discarded.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181758 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
1071b9f2d38f8177e54f20412a36450462c19186 13-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Suppress GCC warning for no return after covered switch, and remove some
debugging code from an unreachable codepath.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181731 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
284b3cbfd1cd5b6585437fbb8b95fe136f273efb 12-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y: support for 'switch' statements in constexpr functions. This is somewhat
inefficient; we perform a linear scan of switch labels to find the one matching
the condition, and then walk the body looking for that label. Both parts should
be straightforward to optimize.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181671 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
6391ea2897b595178a8a97e5080f59a6f55ce442 09-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++1y constant initializer rules: in a constant initializer for an
object x, x's subobjects can be constructed by constexpr constructor even if
they are of non-literal type, and can be read and written even though they're
not members of a constexpr object or temporary.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181506 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
e7565635002ce0daaaf4b714cdb472507af462ee 08-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y: Add a step limit to constexpr evaluation, to catch runaway loops.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181388 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
a49a7fe2a7c1881402be25ca9124d3883637198f 08-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y constant expression evaluation: compound assignment support for floating-point and pointer types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181376 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
d20afcbe94f0daed15d040d98d2aa8ef8ed368e4 07-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y constant expression evaluation: support for compound assignments on integers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181287 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
a8942d7686dde6d221a176c502ce857bdc409dab 07-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y: an assignment operator is implicitly 'constexpr' if it would only call 'constexpr' assignment operators for a literal class type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181284 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
dbce2c6771d3d1e8ca42989122a5edf8fb5a93d7 06-May-2013 Hans Wennborg <hans@hanshq.net> Add llvm_unreachable at end of fully covered switch

To pacify GCC warning about control reaching end of non-void function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181197 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
10f6f065456a2cfb6c2ab5dfedefb930e5e52e9d 06-May-2013 John McCall <rjmccall@apple.com> Require the containing type to be complete when we see
__alignof__ of a field.

This problem can only happen in C++11.

Also do some petty optimizations.

rdar://13784901

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181185 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
692eafd2052fb6ca581530d6f3569eea9520a508 06-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y: support range-based for loops in constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181184 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
ce61715606b5f55ccc023720cdf9c1a796b0d526 06-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y: support 'for', 'while', and 'do ... while' in constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181181 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
5528ac9f40ec6cb54e7096908bf2beeed511bce4 06-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y: support for increment and decrement in constant expression evaluation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181173 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
b476a14e9b35ef2448b42b033e1f0cceaa3f2778 05-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Factor out duplication between lvalue-to-rvalue conversions and variable
assignments in constant expressions. No significant functionality changes
(slight improvement to potential constant expression checking).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181170 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
a07a6c3e756d0a6a5baa2cad9d165f79f0fb1b42 01-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR15884: In the 'taking the address of a temporary' extension, materialize the
temporary to an lvalue before taking its address. This removes a weird special
case from the AST representation, and allows the constant expression evaluator
to deal with it without (broken) hacks.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180866 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
888d34566a4de6097896863a2f6660ed1537ddb9 27-Apr-2013 Benjamin Kramer <benny.kra@googlemail.com> Move helper classes into anonymous namespaces.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180642 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
bebf5b1bcfbf591dd3cd80c4aebd6486bb34f41c 26-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y: support simple variable assignments in constexpr functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180603 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
a10b97898ee6339c3110e6ca33f178ff52f05238 22-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y constexpr extensions, round 1: Allow most forms of declaration and
statement in constexpr functions. Everything which doesn't require variable
mutation is also allowed as an extension in C++11. 'void' becomes a literal
type to support constexpr functions which return 'void'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180022 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
99ad35921aa6c1b200b6432c066961f930fce1e1 22-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix array constant expression evaluation bug: we can have different values for
different array elements, even if they're all constructed using the same
default constructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180017 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
c3bf52ced9652f555aa0767bb822ec4c64546212 21-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y: Allow aggregates to have default initializers.

Add a CXXDefaultInitExpr, analogous to CXXDefaultArgExpr, and use it both in
CXXCtorInitializers and in InitListExprs to represent a default initializer.

There's an additional complication here: because the default initializer can
refer to the initialized object via its 'this' pointer, we need to make sure
that 'this' points to the right thing within the evaluation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179958 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
76da55d3a49e1805f51b1ced7c5da5bcd7f759d8 16-Apr-2013 John McCall <rjmccall@apple.com> Basic support for Microsoft property declarations and
references thereto.

Patch by Tong Shen!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179585 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
38afbc7361d861968232defaeaf8e302af75b5ee 13-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> Annotate flavor of TLS variable (statically or dynamically initialized) onto the AST.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179447 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
1fd1e288d0f45b86d191d8f53f569e5143f3a18a 11-Apr-2013 Jordan Rose <jordan_rose@apple.com> Force a load when creating a reference to a temporary copied from a bitfield.

For this source:
const int &ref = someStruct.bitfield;

We used to generate this AST:

DeclStmt [...]
`-VarDecl [...] ref 'const int &'
`-MaterializeTemporaryExpr [...] 'const int' lvalue
`-ImplicitCastExpr [...] 'const int' lvalue <NoOp>
`-MemberExpr [...] 'int' lvalue bitfield .bitfield [...]
`-DeclRefExpr [...] 'struct X' lvalue ParmVar [...] 'someStruct' 'struct X'

Notice the lvalue inside the MaterializeTemporaryExpr, which is very
confusing (and caused an assertion to fire in the analyzer - PR15694).

We now generate this:

DeclStmt [...]
`-VarDecl [...] ref 'const int &'
`-MaterializeTemporaryExpr [...] 'const int' lvalue
`-ImplicitCastExpr [...] 'int' <LValueToRValue>
`-MemberExpr [...] 'int' lvalue bitfield .bitfield [...]
`-DeclRefExpr [...] 'struct X' lvalue ParmVar [...] 'someStruct' 'struct X'

Which makes a lot more sense. This allows us to remove code in both
CodeGen and AST that hacked around this special case.

The commit also makes Clang accept this (legal) C++11 code:

int &&ref = std::move(someStruct).bitfield

PR15694 / <rdar://problem/13600396>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179250 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
a52d278f0fbac83fa26a03948759cce467d8e55b 29-Jan-2013 Joey Gouly <joey.gouly@arm.com> Fix a crash in OpenCL code by using the proper (RHS) bit-width.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173802 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
8f6284750822e2062da583415164467f57cdf214 24-Jan-2013 Fariborz Jahanian <fjahanian@apple.com> removed duplicated comment.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173378 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
ad48a500596d7d678b99c7f94326cfa856c3b49f 24-Jan-2013 Fariborz Jahanian <fjahanian@apple.com> Patch to check for integer overflow. It has been
commented on and approved by Richard Smith.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173377 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
9ec55f24b8f848bb37a9971100cf2fca379d5572 22-Jan-2013 Tim Northover <Tim.Northover@arm.com> Switch to APFloat constructor taking fltSemantics.

This change also makes the serialisation store the required semantics,
fixing an issue where PPC128 was always assumed when re-reading a
128-bit value.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173139 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
e6b9d802fb7b16d93474c4f1c179ab36202e8a8b 20-Jan-2013 Guy Benyei <guy.benyei@intel.com> Implement OpenCL event_t as Clang builtin type, including event_t related OpenCL restrictions (OpenCL 1.2 spec 6.9)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172973 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
cfa88f893915ceb8ae4ce2f17c46c24a4d67502f 12-Jan-2013 Dmitri Gribenko <gribozavr@gmail.com> Remove useless 'llvm::' qualifier from names like StringRef and others that are
brought into 'clang' namespace by clang/Basic/LLVM.h


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172323 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
a18e70b25c85d7e653e642b5e6e58d6063af3d83 10-Jan-2013 Fariborz Jahanian <fjahanian@apple.com> Issue warning when case value is too large to fit
in case condition type. // rdar://11577384.
Test is conditionalized on x86_64-apple triple as
I am not sure if the INT_MAX/LONG_MAX values in the test
will pass this test for other hosts.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172016 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
7a83421776416d6a9044fb03b5b02208b47646c1 07-Jan-2013 David Tweed <david.tweed@arm.com> Scalar shifts in the OpenCL specification (as of v. 1.2) are defined to be
with respect to the lower "left-hand-side bitwidth" bits, even when negative);
see OpenCL spec 6.3j. This patch both implements this behaviour in the code
generator and "constant folding" bits of Sema, and also prevents tests
to detect undefinedness in terms of the weaker C99 or C++ specifications
from being applied.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171755 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
80ad52f327b532bded5c5b0ee38779d841c6cd35 02-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> s/CPlusPlus0x/CPlusPlus11/g


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171367 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
ceb59d91b3a7def4297ec8468621805777741963 28-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> Replace magic numbers in CheckICE with an enum.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171192 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
9b403c555a294530305f40dfee859b73070de542 28-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR14729: Fix typo in CheckICE for BinaryConditionalOperators.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171191 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
a93d0f280693b8418bc88cf7a8c93325f7fcf4c6 01-Dec-2012 Benjamin Kramer <benny.kra@googlemail.com> Include pruning and general cleanup.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169095 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
9be36ab27b874b404099650e0c29bc92f3c7662d 18-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> DR1535: only potentially-evaluated typeid expressions are disallowed in constant
expressions, not *any* typeid on a polymorphic class type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166156 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
d190057934331390ff67ebf51d66186dd5e392f0 06-Oct-2012 Benjamin Kramer <benny.kra@googlemail.com> Expose __builtin_bswap16.

GCC has always supported this on PowerPC and 4.8 supports it on all platforms,
so it's a good idea to expose it in clang too. LLVM supports this on all targets.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165362 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
7b2f93c8b63f59d429731aaf16d14f0cd32f98c8 03-Oct-2012 Benjamin Kramer <benny.kra@googlemail.com> CodeGen: Fix a silly typo when emitting subs of block addresses.

Part of PR14005.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165117 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
01cad02220180b9646525295f502c00c64a172d0 01-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix treatment of case which came up on std-proposals@: 'void' is permitted in core constant expressions, despite not being a literal type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164968 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
70d38f3179251bb3e7253a52bf54f8fa2314590a 28-Sep-2012 Richard Smith <richard-llvm@metafoo.co.uk> Allow __builtin_bswap32/64 in constant expressions, like gcc does. Patch by Tijl Coosemans!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164841 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
9a4db032ecd991626d236a502e770126db32bd31 12-Sep-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR13811: Add a FunctionParmPackExpr node to handle references to function
parameter packs where the reference is not being expanded but the pack has
been. Previously, Clang would segfault in such cases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163672 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
a6c66cedc022c9e5d45a937d6b8cff491a6bf81b 31-Aug-2012 Eli Friedman <eli.friedman@gmail.com> Change the representation of builtin functions in the AST
(__builtin_* etc.) so that it isn't possible to take their address.
Specifically, introduce a new type to represent a reference to a builtin
function, and a new cast kind to convert it to a function pointer in the
operand of a call. Fixes PR13195.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162962 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
48def65d1cfbd020c5d4a7e542a00d63808c6060 29-Aug-2012 Hans Wennborg <hans@hanshq.net> Move TLS check from LValueExprEvaluator::VisitVarDecl to
CheckLValueConstantExpression.

Richard pointed out that using the address of a TLS variable is ok in a
core C++11 constant expression, as long as it isn't part of the eventual
result of constant expression evaluation. Having the check in
CheckLValueConstantExpression accomplishes this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162850 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
29f431b3e310ae6bd367dccf5a2794ad1cac9592 29-Aug-2012 Hans Wennborg <hans@hanshq.net> Fix r162835 as per Richard's comments.

VisitVarDecl should return Error(E), and we should test that the address
of a TLS var can't be used as a constexpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162837 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
ae7a66f44edebe14d0499d790e91e3ef57e1f70e 29-Aug-2012 Hans Wennborg <hans@hanshq.net> The address of a TLS var is not compile-time constant (PR13720)

This makes Clang produce an error for code such as:

__thread int x;
int *p = &x;

The lvalue of a thread-local variable cannot be evaluated at compile
time.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162835 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
890f0f1612b0028b8b16730ae7ed07e295600c76 23-Aug-2012 Ted Kremenek <kremenek@apple.com> Change a bunch of cases where we do "getAs<...>->doSomething()" to
"castAs<...>->doSomething()". The analyzer was flagging these
as potential null dereferences, which is technically true. The
invariants appear to be that these casts should never fail, so
let's use castAs<> instead and avoid a runtime check.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162468 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
0d729105ecb50a7e3cbe6e57c29149edfa5cf05a 13-Aug-2012 Richard Smith <richard-llvm@metafoo.co.uk> Factor out computation of whether a typeid's expression is potentially
evaluated into a CXXTypeid member function. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161779 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
8ae4ec28451a16a57718286da3e476fc2f495c3f 07-Aug-2012 Richard Smith <richard-llvm@metafoo.co.uk> Teach Expr::HasSideEffects about all the Expr types, and fix a bug where it
was mistakenly classifying dynamic_casts which might throw as having no side
effects.

Switch it from a visitor to a switch, so it is kept up-to-date as future Expr
nodes are added. Move it from ExprConstant.cpp to Expr.cpp, since it's not
really related to constant expression evaluation.

Since we use HasSideEffect to determine whether to emit an unused global with
internal linkage, this has the effect of suppressing emission of globals in
some cases.

I've left many of the Objective-C cases conservatively assuming that the
expression has side-effects. I'll leave it to someone with better knowledge
of Objective-C than mine to improve them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161388 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
b34eb0c6f0ea24047ad2439825b4f6348e380315 04-Aug-2012 Fariborz Jahanian <fjahanian@apple.com> objective-C string literal has no side-effect,
resulting in issuance of unused static variable
warning now. // rdar://10777111


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161291 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
381767fcfe2fdf53727099d95b23b0c9e6a9aa6c 20-Jul-2012 Nico Weber <nicolasweber@gmx.de> Let Expr::HasSideEffects() return false for NULL, bool literals, this, and nullptr.

Fixes PR13413, -Wunused-private-field now warns on unused fields initialized to NULL.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160541 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
26dc97cbeba8ced19972a259720a71aefa01ef43 17-Jul-2012 Eli Friedman <eli.friedman@gmail.com> Don't treat overflow in floating-point conversions as a hard error in constant evaluation. <rdar://problem/11874571>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160394 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f195f2cacf149286232d66578fad3370efa5f567 13-Jul-2012 Nuno Lopes <nunoplopes@sapo.pt> add support for conditional expressions in Expr::HasSideEffects()
This fixes a bug in __builtin_object_size() codegen

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160191 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
a4334dffde250c22c339a974a7131914fe723180 11-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix crash when constant-evaluating a CXXConstructExpr representing
value-initialization for an array of class type with a trivial default
constructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160024 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
de31aa7f0ef71f5c162372e319cbc03c0924f074 08-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR13290: Constant-evaluation support for CXXConstructExprs which construct a
multidimensional array of class type. Also, preserve zero-initialization when
evaluating an initializer list for an array, in case the initializers refer to
later elements (which have preceding zero-initialization).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159904 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
4622fe85ab214d54297f978ee2cc31c021051e69 26-Jun-2012 Richard Smith <richard-llvm@metafoo.co.uk> Remove typedef which is unused after r159189.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159224 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
e92b1f4917bfb669a09d220dc979fc3676df4da8 26-Jun-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix lifetime issue for backing APValue of OpaqueValueExpr in recursive
constexpr function evaluation, and corresponding ASan / valgrind issue in
tests, by storing the corresponding value with the relevant stack frame. This
also prevents re-evaluation of the source of the underlying OpaqueValueExpr,
which makes a major performance difference for certain contrived code (see
testcase update).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159189 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f6172aee547241427e6dabdd0bd6fcaf1c046689 25-Jun-2012 Eli Friedman <eli.friedman@gmail.com> Use std::map instead of llvm::DenseMap because we rely on the stability of references to values in these maps. PR13197.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159161 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
581deb3da481053c4993c7600f97acf7768caac5 06-Jun-2012 David Blaikie <dblaikie@gmail.com> Revert Decl's iterators back to pointer value_type rather than reference value_type

In addition, I've made the pointer and reference typedef 'void' rather than T*
just so they can't get misused. I would've omitted them entirely but
std::distance likes them to be there even if it doesn't use them.

This rolls back r155808 and r155869.

Review by Doug Gregor incorporating feedback from Chandler Carruth.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158104 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
c6794850a570a91c5f224b6f0293db9f560f4213 23-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> If the first argument of __builtin_object_size can be folded to a constant
pointer, but such folding encounters side-effects, ignore the side-effects
rather than performing them at runtime: CodeGen generates wrong code for
__builtin_object_size in that case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157310 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
8d59deec807ed53efcd07855199cdc9c979f447f 01-May-2012 John McCall <rjmccall@apple.com> My first effort to do this more subtly failed, so elaborately
test for an invalid declaration at every single place in the
constant evaluator that's about to request a struct layout.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155868 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
262bc18e32500558af7cb0afa205b34bd37bafed 30-Apr-2012 David Blaikie <dblaikie@gmail.com> Remove the ref/value inconsistency in filter_decl_iterator.

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)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155808 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
1de9d7de172379d6af75fd11dda2a713e4f36f62 26-Apr-2012 John McCall <rjmccall@apple.com> Fix a crash-on-invalid where the constant evaluator would try to
evaluate certain expressions involving invalidly-defined classes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155645 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
eb382ec1507cf2c8c12d7443d0b67c076223aec6 19-Apr-2012 Patrick Beard <pcbeard@mac.com> Implements boxed expressions for Objective-C. <rdar://problem/10194391>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155082 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
2850376184b7e7aa81b5034ba44b001f8c55e07a 16-Apr-2012 Eli Friedman <eli.friedman@gmail.com> Per Richard's comments on r154794, add the checks necessary to handle constant-folding relational comparisons safely in case the user is using -fwrapv or equivalent.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154849 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
a31698842e9893559d58a7bf1a987f2ae90bea0b 16-Apr-2012 Eli Friedman <eli.friedman@gmail.com> Make constant evaluation for pointer comparisons work correctly for some uncommon cases. <rdar://problem/10962435>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154794 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
e275a1845b9e32bd3034f2593dee1780855c8fd6 16-Apr-2012 Francois Pichet <pichet2000@gmail.com> The result of the Microsoft __uuidof operator must be considered a global lvalue during constant expression evaluation.
Otherwise we would get this error in C++11 mode (because of a recent change):
error: non-type template argument of type 'const _GUID *' is not a constant expression

For code like:
template <const GUID* g = &__uuidof(struct_with_uuid)>
class COM_CLASS { };


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154790 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
fe587201feaebc69e6d18858bea85c77926b6ecf 15-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR12226: don't generate wrong code if a braced string literal is used to
initialize an array of unsigned char. Outside C++11 mode, this bug was benign,
and just resulted in us emitting a constant which was double the required
length, padded with 0s. In C++11, it resulted in us generating an array whose
first element was something like i8 ptrtoint ([n x i8]* @str to i8).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154756 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
2c39d71bb7cefdfe6116fa52454f3b3dc5abd517 13-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement the missing pieces needed to support libstdc++4.7's <atomic>:
__atomic_test_and_set, __atomic_clear, plus a pile of undocumented __GCC_*
predefined macros.

Implement library fallback for __atomic_is_lock_free and
__c11_atomic_is_lock_free, and implement __atomic_always_lock_free.

Contrary to their documentation, GCC's __atomic_fetch_add family don't
multiply the operand by sizeof(T) when operating on a pointer type.
libstdc++ relies on this quirk. Remove this handling for all but the
__c11_atomic_fetch_add and __c11_atomic_fetch_sub builtins.

Contrary to their documentation, __atomic_test_and_set and __atomic_clear
take a first argument of type 'volatile void *', not 'void *' or 'bool *',
and __atomic_is_lock_free and __atomic_always_lock_free have an argument
of type 'const volatile void *', not 'void *'.

With this change, libstdc++4.7's <atomic> passes libc++'s atomic test suite,
except for a couple of libstdc++ bugs and some cases where libc++'s test
suite tests for properties which implementations have latitude to vary.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154640 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
fafbf06732746f3ceca21d452d77b144ba8652ae 11-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Provide, and document, a set of __c11_atomic_* intrinsics to implement C11's
<stdatomic.h> header.

In passing, fix LanguageExtensions to note that C11 and C++11 are no longer
"upcoming standards" but are now actually standardized.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154513 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
49149fe0d2be06ce1ceed1e9d2548a0b75a59c47 08-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Don't forget to evaluate the subexpression in a null pointer cast. If we're
converting from std::nullptr_t, the subexpression might have side-effects.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154278 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
d2008e2c80d6c9282044ec873a937a17a0f33579 07-Apr-2012 Douglas Gregor <dgregor@apple.com> Implement support for null non-type template arguments for non-type
template parameters of pointer, pointer-to-member, or nullptr_t
type in C++11. Fixes PR9700 / <rdar://problem/11193097>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154219 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
9293fff58aa0198fa7a6bb504169bcac01dbbff7 22-Mar-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Simplify DataRecursiveIntBinOpEvaluator::VisitBinOp() a bit and make sure we don't
evaluate RHS if LHS could not be evaluated and keepEvaluatingAfterFailure() is false.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153235 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
b778305e95f9977e6710f2b04830ecc36398ab5e 22-Mar-2012 Richard Trieu <rtrieu@google.com> Change the binary operator data recursive evaluator to not stop at the first
non-constant value encountered. This allows the evaluator to deduce that
expressions like (x < 5 || true) is equal to true. Previously, it would visit
x and determined that the entire expression is could not evaluated to a
constant.

This fixes PR12318.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153226 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
cc2f77a7dbc5fb58fe188d55fbfb074e80fe5663 15-Mar-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [Sema] Introduce a data recursive evaluator specific to binary operators.

This allows us to handle extreme cases of chained binary operators without causing stack
overflow.
The binary operators that are handled with the data recursive evaluator are
comma, logical, or operators that have operands with integral or enumeration type.

Part of rdar://10941790.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152819 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
649dfbc389671d0c852ead5953da630d675a5d43 15-Mar-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Remove hacky temporary fix of r151585.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152818 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
5cfc7d85fe13f144c9a8b264d6de9d38dfebc383 15-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Unrevert r152761 (reverted in r152772) with a fix for the issue which was
breaking bootstrap. No test yet: it's quite hard to tickle the failure case.
The specific testcase for this wouldn't be useful for testing anything more
general than a reintroduction of this precise bug in any case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152775 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
7267839dc2fe8ec16445081c3b740ffda5ead217 15-Mar-2012 Daniel Dunbar <daniel@zuster.org> Revert r152761 "Minor optimization to constant evaluation: don't bother
computing expr source...", it breaks bootstrap.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152772 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
d75fb492f7616046797bfe5353e9478d8e25628e 15-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Minor optimization to constant evaluation: don't bother computing expr source
locations for diagnostics we're not going to emit, and don't track the subobject
designator outside C++11 (since we're not going to use it anyway).

This seems to give about a 0.5% speedup on 403.gcc/combine.c, but the results
were sufficiently noisy that I can't reject the null hypothesis.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152761 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
4b1f684416980ef6f1a7cb9e6af9c4fa4a164617 13-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Allow vectors to be constructed from constexpr function arguments in
constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152665 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
4e4d08403ca5cfd4d558fa2936215d3a4e5a528d 11-Mar-2012 David Blaikie <dblaikie@gmail.com> Unify naming of LangOptions variable/get function across the Clang stack (Lex to AST).

The member variable is always "LangOpts" and the member function is always "getLangOpts".

Reviewed by Chris Lattner

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152536 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
8e55ed1ad3acf9c7f8424aa7d326b3b2c18e943b 11-Mar-2012 Douglas Gregor <dgregor@apple.com> Add a missing 'template' keyword.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152526 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f4b88a45902af1802a1cb42ba48b1c474474f228 10-Mar-2012 John McCall <rjmccall@apple.com> Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr to
track whether the referenced declaration comes from an enclosing
local context. I'm amenable to suggestions about the exact meaning
of this bit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152491 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
0069b84c2aa7cc39263e85997b7cb1ed0b132ccd 10-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Assign APValues by swapping from a temporary. Removes a bunch of unnecessary
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152455 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
3d13c5a1e72ed8f8be9c083791d30643d1b1ec43 09-Mar-2012 Daniel Dunbar <daniel@zuster.org> [AST] Reduce Decl::getASTContext() calls.
- This function is not at all free; pass it around along some hot paths instead
of recomputing it deep inside various VarDecl methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152363 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
9fcce65e7e1307b5b8da9be13e4092d6bb94dc1d 07-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> AST representation for user-defined literals, plus just enough of semantic
analysis to make the AST representation testable. They are represented by a
new UserDefinedLiteral AST node, which is a sugared CallExpr. All semantic
properties, including full CodeGen support, are achieved for free by this
representation.

UserDefinedLiterals can never be dependent, so no custom instantiation
behavior is required. They are mangled as if they were direct calls to the
underlying literal operator. This matches g++'s apparent behavior (but not its
actual mangling, which is broken for literal-operator-ids).

User-defined *string* literals are now fully-operational, but the semantic
analysis is quite hacky and needs more work. No other forms of user-defined
literal are created yet, but the AST support for them is present.

This patch committed after midnight because we had already hit the quota for
new kinds of literal yesterday.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152211 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
485ea8e8ea6fd0ab406f10795e35087ee9a07689 07-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> The constant folder's diagnosic mechanism is irrelevant for C; don't bother
producing a C-only diagnostic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152181 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
ebcb57a8d298862c65043e88b2429591ab3c58d3 06-Mar-2012 Ted Kremenek <kremenek@apple.com> Add clang support for new Objective-C literal syntax for NSDictionary, NSArray,
NSNumber, and boolean literals. This includes both Sema and Codegen support.
Included is also support for new Objective-C container subscripting.

My apologies for the large patch. It was very difficult to break apart.
The patch introduces changes to the driver as well to cause clang to link
in additional runtime support when needed to support the new language features.

Docs are forthcoming to document the implementation and behavior of these features.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152137 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
1aa0be86358002fe876e5a4a00c3038c96be28ee 03-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: Remove APValue/CCValue distinction. It is no longer useful given the
resolution of core issue 1454.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151991 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
b2c60b04a597cc5ba4154837cf8e0a155a376fd7 01-Mar-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Move llvm/ADT/SaveAndRestore.h -> llvm/Support/SaveAndRestore.h.

Needs llvm update.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151829 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
c1b66e6003262b284937b542aa159a0c79619ff4 28-Feb-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> When evaluating integer expressions include a check for sub-expressions
depth and error if we exceed a max value, to make sure we avoid a stack overflow.

This is a hacky temporary fix. rdar://10913206.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151585 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
d411a4b23077b29e19c9371bbb19b054a374d922 27-Feb-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Revert testing code I committed by mistake in r151464.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151548 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
2fa975c94027c6565cb112ffcf93c05b22922c0e 26-Feb-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Revert r151460 as it is not enough to address the issue.

Original log:
When evaluating integer expressions handle logical operators outside
VisitBinaryOperator() to reduce stack pressure for source with huge number
of logical operators.

Fixes rdar://10913206.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151464 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
8ed20910d8b5c35d28c5cbe7e9170d40837192dd 25-Feb-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> When evaluating integer expressions handle logical operators outside
VisitBinaryOperator() to reduce stack pressure for source with huge number
of logical operators.

Fixes rdar://10913206.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151460 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
359c89df5479810c9d4784fc0b6ab592eb136777 24-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> When checking whether a reference to a variable is an ICE, look at the type of
the declaration, not at the type of the DeclRefExpr, since within a lambda the
DeclRefExpr can be more const than the declaration is.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151399 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f6cfe8ba2b4d98c20181568e449edf0b60904b03 24-Feb-2012 Douglas Gregor <dgregor@apple.com> Remove some trivial uses of hasTrivialCopyConstructor() and
hasTrivialMoveConstructor().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151354 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
4ca8ac2e61c37ddadf37024af86f3e1019af8532 24-Feb-2012 Douglas Gregor <dgregor@apple.com> Implement a new type trait __is_trivially_constructible(T, Args...)
that provides the behavior of the C++11 library trait
std::is_trivially_constructible<T, Args...>, which can't be
implemented purely as a library.

Since __is_trivially_constructible can have zero or more arguments, I
needed to add Yet Another Type Trait Expression Class, this one
handling arbitrary arguments. The next step will be to migrate
UnaryTypeTrait and BinaryTypeTrait over to this new, more general
TypeTrait class.

Fixes the Clang side of <rdar://problem/10895483> / PR12038.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151352 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
ac1303eca6cbe3e623fb5ec6fe7ec184ef4b0dfa 22-Feb-2012 Douglas Gregor <dgregor@apple.com> Generate an AST for the conversion from a lambda closure type to a
block pointer that returns a block literal which captures (by copy)
the lambda closure itself. Some aspects of the block literal are left
unspecified, namely the capture variable (which doesn't actually
exist) and the body (which will be filled in by IRgen because it can't
be written as an AST).

Because we're switching to this model, this patch also eliminates
tracking the copy-initialization expression for the block capture of
the conversion function, since that information is now embedded in the
synthesized block literal. -1 side tables FTW.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151131 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
51e47df5a57430f1b691b04258e663cce68aef9d 21-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Fix a crash in the diangostic code in EvalConstant. PR12043.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151100 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
24fe798fffc1748d8bce1321af42981c3719cb85 19-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Refuse to compile global std::initializer_lists instead of doing completely the wrong thing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150928 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
86024013d4c3728122c58fa07a2a67e6c15837ef 18-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement constant expression support for __real__ and __imag__ on lvalue
complex numbers. Treat complex numbers as arrays of the corresponding component
type, in order to make std::complex behave properly if implemented in terms of
_Complex T.

Apparently libstdc++'s std::complex is implemented this way, and we were
rejecting a member like this:

constexpr double real() { return __real__ val; }

because it was marked constexpr but unable to produce a constant expression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150895 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
b78ae9716576399145786b93f687943f8b197170 18-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix a problem in the GCC testsuite, exposed by r150557. Compound literals
are represented as prvalues in C++; don't be fooled into thinking they're
global lvalues.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150870 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f3908f2ae111b1b12ade2524dda71c669ed6f121 17-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Make sure all remaining parts of the constant evaluator are aware that an array
can be represented by an LValue, and use that to simplify the code a little.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150789 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
ce582fe2a7aad8b14b3636ad9cac0a3b8bbb219b 17-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR12012: Fix a regression in r150419 where we would try (and fail) to
zero-initialize class types with virtual bases when constant-evaluating an
initializer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150770 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
74e1ad93fa8d6347549bcb10279fdf1fbc775321 16-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr tidyups:
* Fix bug when determining whether && / || are potential constant expressions
* Try harder when determining whether ?: is a potential constant expression
* Produce a diagnostic on sizeof(VLA) to provide a better source location


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150657 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
83587db1bda97f45d2b5a4189e584e2a18be511a 15-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement DR1454. This allows all intermediate results in constant expressions
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150557 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
4d4e5c1ae83f4510caa486b3ad19de13048f9f04 15-Feb-2012 John McCall <rjmccall@apple.com> Split reinterpret_casts of member pointers out from CK_BitCast; this
is general goodness because representations of member pointers are
not always equivalent across member pointer types on all ABIs
(even though this isn't really standard-endorsed).

Take advantage of the new information to teach IR-generation how
to do these reinterprets in constant initializers. Make sure this
works when intermingled with hierarchy conversions (although
this is not part of our motivating use case). Doing this in the
constant-evaluator would probably have been better, but that would
require a *lot* of extra structure in the representation of
constant member pointers: you'd really have to track an arbitrary
chain of hierarchy conversions and reinterpretations in order to
get this right. Ultimately, this seems less complex. I also
wasn't quite sure how to extend the constant evaluator to handle
foldings that we don't actually want to treat as extended
constant expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150551 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
26f2cac83eeb4317738d74b9e567d3d58aa04ed9 14-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: evaluation support for nullptr comparisons.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150521 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
70488e201ccd94d4bb1ef0868cc13cca2b7d4ff6 14-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Pending clear answer from WG21 on whether core issue 903 is intended to apply to
C++11 or just C++17, restrict the set of null pointer constants in C++11 mode
back to those which were considered null in C++98.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150510 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
7ca4850a3e3530fa6c93b64b740446e32c97f992 13-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Deal with a horrible C++11 special case. If a non-literal type has a constexpr
constructor, and that constructor is used to initialize an object of static
storage duration such that all members and bases are initialized by constant
expressions, constant initialization is performed. In this case, the object
can still have a non-trivial destructor, and if it does, we must emit a dynamic
initializer which performs no initialization and instead simply registers that
destructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150419 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
86c3ae46250cdcc57778c27826060779a92f3815 13-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Update constexpr implementation to match CWG's chosen approach for core issues
1358, 1360, 1452 and 1453.
- Instantiations of constexpr functions are always constexpr. This removes the
need for separate declaration/definition checking, which is now gone.
- This makes it possible for a constexpr function to be virtual, if they are
only dependently virtual. Virtual calls to such functions are not constant
expressions.
- Likewise, it's now possible for a literal type to have virtual base classes.
A constexpr constructor for such a type cannot actually produce a constant
expression, though, so add a special-case diagnostic for a constructor call
to such a type rather than trying to evaluate it.
- Classes with trivial default constructors (for which value initialization can
produce a fully-initialized value) are considered literal types.
- Classes with volatile members are not literal types.
- constexpr constructors can be members of non-literal types. We do not yet use
static initialization for global objects constructed in this way.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150359 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
864b1cf13b288c5099911e1265431ffdcac060a4 10-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Update to new resolution for DR1458. When taking the address of an object of
incomplete class type which has an overloaded operator&, it's now just
unspecified whether the overloaded operator or the builtin is used.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150234 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
b4e5e286a5cd156247720b1eb204abaa8e09568d 09-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> CWG issue 1405: mutable members are allowed in literal types, but can't undergo
lvalue-to-rvalue conversions in constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150145 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
2fd5983e0da447291a651a347c206aee37a1de5f 08-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement DR1458: Taking the address of an object of incomplete class type is
not a constant expression, because we can't tell whether the complete class type
will have an overloaded operator&.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150066 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
925d8e7c0f18e03dc4bc634b3c6c1ec09373d993 08-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement the agreed resolution to DR1457: a signed left shift of a 1 bit into
the sign bit doesn't have undefined behavior, but a signed left shift of a 1 bit
out of the sign bit still does. As promised to Howard :)

The suppression of the potential constant expression checking in system headers
is also removed, since the problem it was working around is gone.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150059 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
d7a3e2c5f61cd4893f95b69a424fe4def3aa0f69 07-Feb-2012 Benjamin Kramer <benny.kra@googlemail.com> Revert my patches which removed Diagnostic.h includes by moving some operator overloads out of line.

This seems to negatively affect compile time onsome ObjC tests
(which use a lot of partial diagnostics I assume). I have to come
up with a way to keep them inline without including Diagnostic.h
everywhere. Now adding a new diagnostic requires a full rebuild
of e.g. the static analyzer which doesn't even use those diagnostics.

This reverts commit 6496bd10dc3a6d5e3266348f08b6e35f8184bc99.
This reverts commit 7af19b817ba964ac560b50c1ed6183235f699789.
This reverts commit fdd15602a42bbe26185978ef1e17019f6d969aa7.
This reverts commit 00bd44d5677783527d7517c1ffe45e4d75a0f56f.
This reverts commit ef9b60ffed980864a8db26ad30344be429e58ff5.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150006 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
01d08018b7cf5ce1601707cfd7a84d22015fc04e 07-Feb-2012 Douglas Gregor <dgregor@apple.com> Introduce basic ASTs for lambda expressions. This covers:
- Capturing variables by-reference and by-copy within a lambda
- The representation of lambda captures
- The creation of the non-static data members in the lambda class
that store the captured variables
- The initialization of the non-static data members from the
captured variables
- Pretty-printing lambda expressions

There are a number of FIXMEs, both explicit and implied, including:
- Creating a field for a capture of 'this'
- Improved diagnostics for initialization failures when capturing
variables by copy
- Dealing with temporaries created during said initialization
- Template instantiation
- AST (de-)serialization
- Binding and returning the lambda expression; turning it into a
proper temporary
- Lots and lots of semantic constraints
- Parameter pack captures


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149977 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
9ec7197796a2730d54ae7f632553b5311b2ba3b5 05-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: Fix implementation of DR1311: check for volatile qualifiers in
lvalue-to-rvalue conversions on the source type of the conversion, not the
target type (which has them removed for non-class types).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149796 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
00bd44d5677783527d7517c1ffe45e4d75a0f56f 04-Feb-2012 Benjamin Kramer <benny.kra@googlemail.com> Move various diagnostic operator<< overloads out of line and remove includes of Diagnostic.h.

Fix all the files that depended on transitive includes of Diagnostic.h.
With this patch in place changing a diagnostic no longer requires a full rebuild of the StaticAnalyzer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149781 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
5ba73e1af8ef519161bd40063dc325457e21676a 04-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr:
The recent support for potential constant expressions exposed a bug in the
implementation of libstdc++4.6, where numeric_limits<int>::min() is defined
as (int)1 << 31, which isn't a constant expression. Disable the 'constexpr
function never produces a constant expression' error inside system headers
to compensate.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149729 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f15fda02e9c8c82b4a716618f4010b9af8bff796 02-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr:
* support the gcc __builtin_constant_p() ? ... : ... folding hack in C++11
* check for unspecified values in pointer comparisons and pointer subtractions


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149578 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
15efc4d597a47e6ba5794d4fd8d561bf6947233c 01-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: check for overflow in pointer subtraction.

This is a mess. According to the C++11 standard, pointer subtraction only has
undefined behavior if the difference of the array indices does not fit into a
ptrdiff_t.

However, common implementations effectively perform a char* subtraction first,
and then divide the result by the element size, which can cause overflows in
some cases. Those cases are not considered to be undefined behavior by this
change; perhaps they should be.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149490 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
7b48a2986345480241f3b8209f71bb21b0530b4f 01-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: overflow checking for integral and floating-point arithmetic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149473 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
b04035a7b1a3c9b93cea72ae56dd2ea6e787bae9 01-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: require 'this' to point to an object in a constexpr method call.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149467 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
b02e4629f78a0c0c0adf9d66b644e5932a781c7e 01-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: add support for comparisons of pointer-to-members.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149463 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
3df61308ddfbdba0897b762a129b5a38750c87d0 01-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: Treat INT_MIN % -1 as undefined behavior in C++11. Technically, it
isn't, but this is just a (reported) defect in the wording.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149448 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
82f28583b8e81ae9b61635a0652f6a45623df16d 31-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: the result of a relational operator between pointers to void is
unspecified unless the pointers are equal; therefore, such a comparison is not
a constant expression unless the pointers are equal.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149366 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
789f9b6be5df6e5151ac35e68416cdf550db1196 31-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: catch a collection of integral undefined behaviors:
-INT_MIN and INT_MIN / -1
Shift by a negative or too large quantity
Left shift of negative value
Overflow in left shift



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149344 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
395f1c08ff720be7df6535a86df14b6d36a2d57a 31-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: remove integral conversion overflow checking introduced in r149286.
As Eli points out, this is implementation-defined, and the way we define it
makes this fine.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149327 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f72fccf533bca206af8e75d041c29db99e6a7f2c 30-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: disallow signed integer overflow in integral conversions in constant
expressions in C++11.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149286 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
745f5147e065900267c85a5568785a1991d4838f 27-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: Implement the [dcl.constexpr]p5 check for whether a constexpr
function definition can produce a constant expression. This also provides the
last few checks for [dcl.constexpr]p3 and [dcl.constexpr]p4.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149108 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
5fe31228c883040cf016cfc71ad4bfeba462602e 26-Jan-2012 NAKAMURA Takumi <geek4civic@gmail.com> AST/ExprConstant.cpp: Silence a warning on ms cl.exe. "bool" does not prefer to be compared to integer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149059 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f2e4cd760a5836ee8941d1b9be6b2e2c2dde23e6 26-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: evaluate (bool)&x as true when x is a local variable or a temporary.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149045 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
d9b02e726262e4009dda830998bb934172ac0020 25-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: add support for anonymous struct and union members in literal types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148987 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
3026348bd4c13a0f83b59839f64065e0fcbea253 20-Jan-2012 David Blaikie <dblaikie@gmail.com> More dead code removal (using -Wunreachable-code)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148577 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
4c3fc9b38d3723f73e4ded594cebf38c76f91d93 18-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> Move narrowing conversion detection code from SemaInit to SemaOverload, ready
for it to be used in converted constant expression checking, and fix a couple
of issues:
- Conversion operators implicitly invoked prior to the narrowing conversion
were not being correctly handled when determining whether a constant value
was narrowed.
- For conversions from floating-point to integral types, the diagnostic text
incorrectly always claimed that the source expression was not a constant
expression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148381 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
40b993a826728214c869ee4fbc9d296a2e1e1f71 18-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> A call to strlen is not a constant expression, even if we're treating it as a
builtin.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148374 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
7d580a4e9e47dffc3c17aa2b957ac57ca3c4e451 17-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> Enable constant evaluation of implicit calls to constexpr conversion operators.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148333 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
7a7ee3033e44b45630981355460ef89efa0bdcc4 16-Jan-2012 David Chisnall <csdavec@swan.ac.uk> Some improvements to the handling of C11 atomic types:

- Add atomic-to/from-nonatomic cast types
- Emit atomic operations for arithmetic on atomic types
- Emit non-atomic stores for initialisation of atomic types, but atomic stores and loads for every other store / load
- Add a __atomic_init() intrinsic which does a non-atomic store to an _Atomic() type. This is needed for the corresponding C11 stdatomic.h function.
- Enables the relevant __has_feature() checks. The feature isn't 100% complete yet, but it's done enough that we want people testing it.

Still to do:

- Make the arithmetic operations on atomic types (e.g. Atomic(int) foo = 1; foo++;) use the correct LLVM intrinsic if one exists, not a loop with a cmpxchg.
- Add a signal fence builtin
- Properly set the fenv state in atomic operations on floating point values
- Correctly handle things like _Atomic(_Complex double) which are too large for an atomic cmpxchg on some platforms (this requires working out what 'correctly' means in this context)
- Fix the many remaining corner cases



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148242 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
28c1ce789322ab99f9b5887015d63ec5f088957a 15-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: casts to void* are allowed in constant expressions, don't set the
designator invalid. (Since we can't read the value of such a pointer, this only
affects the quality of diagnostics.)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148208 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
2d6a5670465cb3f1d811695a9f23e372508240d2 14-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr irgen: Add irgen support for APValue::Struct, APValue::Union,
APValue::Array and APValue::MemberPointer. All APValue values can now be emitted
as constants.

Add new CGCXXABI entry point for emitting an APValue MemberPointer. The other
entrypoints dealing with constant member pointers are no longer necessary and
will be removed in a later change.

Switch codegen from using EvaluateAsRValue/EvaluateAsLValue to
VarDecl::evaluateValue. This performs caching and deals with the nasty cases in
C++11 where a non-const object's initializer can refer indirectly to
previously-initialized fields within the same object.

Building the intermediate APValue object incurs a measurable performance hit on
pathological testcases with huge initializer lists, so we continue to build IR
directly from the Expr nodes for array and record types outside of C++11.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148178 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f6c17a439f3320ac620639a3ee66dbdabb93810c 14-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Fix a silly mistake in ComplexExprEvaluator::ZeroInitialization. <rdar://problem/10691092>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148157 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
ec789163a42a7be654ac34aadb750b508954d53c 12-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: initialization of a union from an empty initializer-list should
zero-initialize the first union member. Also fix a bug where initializing an
array of types compatible with wchar_t from a wide string literal failed in C,
and fortify the C++ tests in this area. This part can't be tested without a code
change to enable array evaluation in C (where an existing test fails).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148035 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
61e616206413d1779c7545c7a8ad1ce1129ad9c1 12-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> Allow constant-folding of references which were formed in a manner not permitted
in a constant expression, for compatibility with g++.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148020 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
7ead5c7b6fd48cf549e55b4db499c26ecf88ae75 10-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Implement the missing pieces of Evaluate for _Complex types. With that complete, remove some code from CGExprConstant which is no longer necessary. While I'm here, a couple minor tweaks to _Complex-in-C++. (Specifically, make _Complex types literal types, and don't warn for _Complex int.)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147840 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
610a60c0e68e34db5a5247d6102e58f37510fef8 10-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR11724: Implement evaluation for constexpr defaulted trivial union copy/move
constructors. These are a special case whose behavior cannot be modeled as a
user-written constructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147839 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
b4e85ed51905fc94378d7b4ff62b06e0d08042b7 06-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> C++11 generalized constant expressions: implement checking and diagnostics for
pointer-arithmetic-related undefined behavior and unspecified results. We
continue to fold such values, but now notice they aren't constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147659 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
5930a4c5224eea3b0558655f7f8c9ea027ef573e 06-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Address Richard's review comments on r147561 (Evaluate support for address-of-label differences).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147631 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
65639284118d54ddf2e51a05d2ffccda567fe246 05-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Add an APValue representation for the difference between two 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147561 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
71523d6c41e1599fc42f420d02dd2895fd8f65d4 04-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Get rid of an unnecessary check; the AST for init-lists is the same independent of whether we're in C++11 mode.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147503 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
3edd5a99332dd8ec94a545476dc3c9ed50dec78f 04-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Support constant evaluation for OpenCL nested vector literals. Patch by Anton Lokhmotov.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147496 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
51201882382fb40c9456a06c7f93d6ddd4a57712 30-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Unrevert r147271, reverted in r147361.

Also temporarily remove the assumption from IR gen that we can emit IR for every
constant we can fold, since it isn't currently true in C++11, to fix PR11676.

Original comment from r147271:

constexpr: perform zero-initialization prior to / instead of performing a
constructor call when appropriate. Thanks to Eli for spotting this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147384 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f8c2a33b6e47c494b83e68f02f4ee67ca8fd8e3b 30-Dec-2011 Rafael Espindola <rafael.espindola@gmail.com> Revert r147271. This fixes PR11676.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147362 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
80d4b55db94db2172a04617d1a80feca6bbcea5c 28-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Small refactoring and simplification of constant evaluation and some of its
clients. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147318 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
47d2145675099893d702be4bc06bd9f26d8ddd13 27-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: support for evaluation and codegen of typeid constants.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147290 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
eba05b2e396e1474f7bd6e8e8e1bd7752effef4d 25-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: perform zero-initialization prior to / instead of performing a
constructor call when appropriate. Thanks to Eli for spotting this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147271 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
e6a24e83e71f361c7b7de82cf24ee6f5ddc7f1c2 22-Dec-2011 Eli Friedman <eli.friedman@gmail.com> Add support for bitcasts to vector type in Evaluate.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147137 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
6180245e9f63d2927b185ec251fb75aba30f1cac 22-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> PR11614: Mark defaulted special constructors as constexpr if their implicit
definition would satisfy the constexpr requirements.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147128 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
974c5f93d0ce4f0699a6f0a4402f6b367da495e3 22-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> PR11637: implement special-case constant evaluation for char arrays initialized
by string literals.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147120 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
aa5d533427d803e52ee42b250ffd6645ef5ccb0f 21-Dec-2011 Matt Beaumont-Gay <matthewbg@google.com> Cast enumerators from different anonymous enums to unsigned, to appease gcc

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147067 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
7098cbd601ad915aed22d4b5850da99359f25bf3 21-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: diagnostic improvements for invalid lvalue-to-rvalue conversions in
constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147035 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
bc6abe93a5d6b1305411f8b6f54c2caa686ddc69 19-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Evaluation support for ExprWithCleanups. We won't evaluate any expression which
actually requires non-trivial cleanups, so no cleanups need to be performed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146916 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
af2c7a194592401394233b7cbcdd3cfd0a7a38dd 19-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Improve r146813 (for PR11595) to give an appropriate diagnostic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146915 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
099e7f647ccda915513f2b2ec53352dc756082d3 19-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> constexpr handling improvements. Produce detailed diagnostics when a 'constexpr'
variable is initialized by a non-constant expression, and pass in the variable
being declared so that earlier-initialized fields' values can be used.

Rearrange VarDecl init evaluation to make this possible, and in so doing fix a
long-standing issue in our C++ constant expression handling, where we would
mishandle cases like:

extern const int a;
const int n = a;
const int a = 5;
int arr[n];

Here, n is not initialized by a constant expression, so can't be used in an ICE,
even though the initialization expression would be an ICE if it appeared later
in the TU. This requires computing whether the initializer is an ICE eagerly,
and saving that information in PCH files.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146856 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
2116b144cf07f2574d20517187eb8863645376eb 18-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> PR11604: don't allow floating-literal-to-integer casts in ICEs if the (truncated)
floating literal value does not fit into the destination type. Such casts have
undefined behavior at translation time; treating them as non-ICE matches the
behavior of modern gcc versions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146842 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f59ff8c777379bd54137853a58c58b72fb869152 17-Dec-2011 Eli Friedman <eli.friedman@gmail.com> Add a missing check before trying to evaluate a temporary. PR11595.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146813 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
08d6e032a2a0a8656d12b3b7b93942987bb12eb7 16-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> C++11 constexpr: Add note stacks containing backtraces if constant evaluation
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146749 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
c1c5f27c64dfc3332d53ad30e44d626e4f9afac3 13-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Add checks and diagnostics for many of the cases which C++11 considers to not
be constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146479 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
4cd9b8f7fb2cebf614e6e2bc766fad27ffd2e9de 12-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Clean up diagnostic wording for disallowed casts in C++11 constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146395 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
c216a01c96d83bd9a90e214af64913e93d39aacc 12-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++11 constant expression cast restrictions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146371 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
d5093420308784e31071c8cd723a58d74159f393 12-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Fix some not-yet-used diagnostic code in a template, which gcc spotted and clang
did not!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146366 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
dd1f29b6d686899bfd033f26e16cb1621e5549e8 12-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Prepare constant expression infrastructure for the generation of richer
diagnostics. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146365 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
ee19f43bf8973bfcccb7329e32a4198641767949 10-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Add a fast path to the constant evaluator for integer literals. This speeds up
compilation of some translation units of SPEC's 445.gobmk by ~4%, and does not
seem to cause a measurable slowdown in other cases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146306 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f48fdb0937e67f691393f9ffdf75653e5128ea13 09-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> C++11 constant expressions: Don't use CheckICE in C++11; instead, determine
whether an expression is a (core) constant expression as a side-effect of
evaluation. This takes us from accepting far too few expressions as ICEs to
accepting slightly too many -- fixes for the remaining cases are coming next.

The diagnostics produced when an expression is found to be non-constant are
currently quite poor (with generic wording but reasonable source locations),
and will be improved in subsequent commits.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146289 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
42786839cff1ccbe4d883b81d01846c5d774ffc6 09-Dec-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> In ExprEvaluatorBase::VisitOpaqueValueExpr() add a sanity check to avoid
infinite recursion due to bad OpaqueValueExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146237 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
e052d46f4db91f9ba572859ffc984e85cbf5d5ff 09-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Replace the implementation of __builtin_constant_p (which was based on the GCC
documentation) with one based on what GCC's __builtin_constant_p is actually
intended to do (discovered by asking a friendly GCC developer).

In particular, an expression which folds to a pointer is now only considered to
be a "constant" by this builtin if it refers to the first character in a string
literal.

This fixes a rather subtle wrong-code issue when building with glibc. Given:

const char cs[4] = "abcd";
int f(const char *p) { return strncmp(p, cs, 4); }

... the macro magic for strncmp produces a (potentially crashing) call to
strlen(cs), because it expands to an expression starting with:

__builtin_constant_p(cs) && strlen(cs) < 4 ? /* ... */

Under the secret true meaning of __builtin_constant_p, this is guaranteed to be
safe!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146236 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
aa9c3503867bc52e1f61c4da676116db1b1cdf01 07-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> When folding the size of a global scope VLA to a constant, require the array
bound to not have side effects(!). Add constant-folding support for expressions
of void type, to ensure that we can still fold ((void)0, 1) as an array bound.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146000 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
d62ca370b03b8c6ad58002d3399383baf744e32b 06-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Move vector bitcast handling in constant expressions from the expression
evaluator into constant initializer handling / IRGen. The practical consequence
of this is that the bitcast now lives in the constant's definition, rather than
in its uses.

The code in the constant expression evaluator was producing vectors of the wrong
type and size (and possibly of the wrong value for a big-endian int-to-vector
bitcast). We were getting away with this only because we don't yet support
constant-folding of any expressions which inspect vector values.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145981 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
0dd7a25e8d679de1dc0ce788222d6dee0e879885 05-Dec-2011 Lang Hames <lhames@gmail.com> Make isWeakDecl available as a method on ValueDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145845 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
c18c42345636e2866fed75c7e434fb659d747672 21-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Add driver arguments -ftemplate-depth=N and -fconstexpr-depth=N, with the same
semantics and defaults as the corresponding g++ arguments. The historical g++
argument -ftemplate-depth-N is kept for compatibility, but modern g++ versions
no longer document that option.

Add -cc1 argument -fconstexpr-depth N to implement the corresponding
functionality.

The -ftemplate-depth=N part of this fixes PR9890.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145045 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
e24f5fc8c763f1b5536b8d70dd510ca959db3a80 17-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation: add support for evaluation of member pointers
and base-to-derived casts, and add proper handling of temporaries.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144926 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
2ad226bdc847df6b6b6e4f832856478ab63bb3dc 16-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> PR11391: Don't try to evaluate the LHS of a _Complex assignment as an rvalue.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144799 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
b755a9da095d2f2f04444797f1e1a9511693815b 16-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Fix PR11385: A pointer constant expression which has been cast via an integer is
not safely derived. Don't allow lvalue-to-rvalue conversions on the result of
dereferencing such a pointer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144783 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
1bf9a9e6a5bdc0de7939908855dcddf46b661800 12-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Represent an APValue based on a Decl as that Decl, rather than a DeclRefExpr
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144468 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f64699e8db3946e21b5f4a0421cbc58a3e439599 11-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evalation: const_cast support.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144382 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
cd99b072e8b32075da6233cbf14ea58a5c82de4f 11-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Reduce the constexpr stack pressure somewhat. Hopefully this will be enough to
please the buildbots.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144375 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
59efe266b804330f4c1f3a1b0ff783e67dd90378 11-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation: support for constexpr member functions. This
reinstates r144273; a combination of r144333's fix for NoOp rvalue-to-lvalue
casts and some corresponding changes here resolve the regression which that
caused.

This patch also adds support for some additional forms of member function call,
along with additional testing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144369 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
6142ca7790aa09a6e13592b70f142cc4bbcadcae 10-Nov-2011 Devang Patel <dpatel@apple.com> Revert r144273. It causes clang self-host build failure.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144296 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
6c95787b25c72a1c2421e349ef3459912362714a 10-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation: support for constexpr member functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144273 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
180f47959a066795cc0f409433023af448bb0328 10-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation: support for evaluation of structs and unions of
literal types, as well as derived-to-base casts for lvalues and
derived-to-virtual-base casts.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144265 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
1445bbacf4c8de5f208ff4ccb302424a4d9e233e 10-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Temporary fix for a performance problem Eli spotted. The APValue representation
is currently too inefficient to allow us to use it for array initializers, but
fortunately we usually don't yet need to evaluate such initializers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144260 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
3d75ca836205856077c18e30e9447accbd85f751 09-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation: support for default arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144156 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
db1822c6de43ff4aa5fa00234bf8222f6f4816e8 08-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Fix a cluster of related issues involving value-dependence and constant
expression evaluation:
- When folding a non-value-dependent expression, we may try to use the
initializer of a value-dependent variable. If that happens, give up.
- In C++98, actually check that a const, non-volatile DeclRefExpr inside an ICE
is of integral or enumeration type (a reference isn't OK!)
- In C++11, DeclRefExprs for objects of const literal type initialized with
value-dependent expressions are themselves value-dependent.
- So are references initialized with value-dependent expressions (though this
case is missing from the C++11 standard, along with many others).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144056 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
cc5d4f637cdf83adc174b96d2bfe27cef1cf0f36 07-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation: support for arrays.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143922 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
7864435ef2bce200224120bd1df3aed98ea5b99a 07-Nov-2011 John McCall <rjmccall@apple.com> Rip out CK_GetObjCProperty.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143910 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
9a17a680c74ef661bf3d864029adf7e74d9cb5b8 07-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation: preserve subobject designator when flattening a
core constant value down to an APValue.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143909 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
cd689927139d3ab52c0c088521633c661bd2d807 07-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Allow constexpr variables' initializers to be folded in C++11 mode. This
partially undoes the revert in r143491, but does not introduce any new instances
of the underlying issue (which is not yet fixed) in code which does not use
the 'constexpr' keyword.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143905 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
4b9c2d235fb9449e249d74f48ecfec601650de93 06-Nov-2011 John McCall <rjmccall@apple.com> Change the AST representation of operations on Objective-C
property references to use a new PseudoObjectExpr
expression which pairs a syntactic form of the expression
with a set of semantic expressions implementing it.
This should significantly reduce the complexity required
elsewhere in the compiler to deal with these kinds of
expressions (e.g. IR generation's special l-value kind,
the static analyzer's Message abstraction), at the lower
cost of specifically dealing with the odd AST structure
of these expressions. It should also greatly simplify
efforts to implement similar language features in the
future, most notably Managed C++'s properties and indexed
properties.

Most of the effort here is in dealing with the various
clients of the AST. I've gone ahead and simplified the
ObjC rewriter's use of properties; other clients, like
IR-gen and the static analyzer, have all the old
complexity *and* all the new complexity, at least
temporarily. Many thanks to Ted for writing and advising
on the necessary changes to the static analyzer.

I've xfailed a small diagnostics regression in the static
analyzer at Ted's request.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143867 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
92d3dda09f72b700e15b7b652a7bb47718989994 04-Nov-2011 Benjamin Kramer <benny.kra@googlemail.com> Remove unused variables.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143696 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
69c2c50498dadfa6bb99baba52187e3cfa0ac78a 04-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation: refactor to start the groundwork for coping with
initializations which refer indirectly to elements of the object being
initialized.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143680 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
0a3bdb646ee0318667f4cebec6792d2548fb9950 04-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation: track the manner in which an lvalue was written,
to allow us to implement the C++11 rule that a non-active union member can't be
read, and use it to implement subobject access for string literals.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143677 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
74f4634781cee06e28eb741bda5d0f936fdd1948 04-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation: although we don't know whether a literal will
be at the same address as another object, we do know it won't alias a null
pointer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143674 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
65ac598c7ba7e36f2ad611f2bb39cc957053be5d 01-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> When constant-folding, don't look at the initializer of a global const variable
if it's marked as weak: that definition may not end up being used.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143496 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
344d78d6a669fb324f89937fc0739f97670f4700 01-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Temporarily disable lvalue-to-rvalue conversions on const pointers while an
apparent miscompile triggered by this is investigated. This is essentially a
revert of r143298.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143491 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
177dce777596e68d111d6d3e6046f3ddfc96bd07 01-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++11 'constexpr calls must return constant expressions' rule, and
perform the code simplifications this rule allows.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143463 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
c45061bd0c0fdad4df8eea7e9e5af186d11427e5 31-Oct-2011 Eli Friedman <eli.friedman@gmail.com> Some minor comment changes in constant-folding comparisons.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143391 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
ffbda40a1fb7169591dc01771f3511178a2f727c 31-Oct-2011 Eli Friedman <eli.friedman@gmail.com> Don't try to fold comparisons between the address of an object and an arbitrary integer constant. Fixes regression from r143334.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143374 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
6a7c94af983717e2c2d6aebe42cb4737c1c7b9e6 31-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Refactoring and test for r143360. Support for array rvalue to pointer decay is
needed for C++11, and will follow later.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143363 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
aa97b53175ef138144f69dbc7fda6870c5740226 31-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Temporary fix for assert while evaluating array-to-pointer decay on array
rvalue. Test and better fix to follow.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143360 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
bd552efbeff3a64a1c400d2bba18f13f84abd8ab 31-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> C++11 generalized constant expression handling: evaluation support for
materialized temporaries.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143335 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
9e36b533af1b2fa9f32c4372c4081abdd86f47e0 31-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> C++11 generalized constant expressions: evaluate equality comparisons between
arbitrary pointers, if those pointers don't point to weak objects or literals.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143334 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
625b80755b603d28f36fb4212c81484d87ad08d3 31-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> C++11 generalized constant expressions: support pointer comparisons where the
result is not unspecified.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143329 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
7993e8a2a26bf408c2a6d45f24fffa12db336b2b 31-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Fix assert on constant expression evaluation of floating point increment.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143320 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
342f1f8b0a402c5a7f8c5055db7f60a7808f1687 30-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Don't crash if a GCC binary conditional is used in a constant expression on an
integer-cast pointer value.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143299 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
b78c0b66481a59dbef7ac2a454e4f89448909749 29-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> constexpr evaluation: allow lvalue-to-rvalue conversion on any literal type, not
just integers and floating point types. Since we don't support evaluating class
types or performing lvalue-to-rvalue conversions on array elements yet, this
just means pointer types right now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143298 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
47a1eed1cdd36edbefc318f29be6c0f3212b0c41 29-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> constexpr function substitution:
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143296 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
51f4708c00110940ca3f337961915f2ca1668375 29-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Rename Expr::Evaluate to Expr::EvaluateAsRValue to make it clear that it will
implicitly perform an lvalue-to-rvalue conversion if used on an lvalue
expression. Also improve the documentation of Expr::Evaluate* to indicate which
of them will accept expressions with side-effects.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143263 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
ee591a90c2e26c1ba33a4befb364a1c35fb2c311 29-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Fix assertion in constant expression evaluation. The LHS of a floating-point
binary operator isn't an rvalue if it's an assignment operator.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143250 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
d0dcceae2a8ca0e37b5dd471a704de8583d49c95 29-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Initial support for C++11 constexpr function invocation substitution. Using
constexpr function arguments outside of their function (passing or returning
them by reference) does not work correctly yet.

Calling constexpr function templates does not work yet, since the bodies are not
instantiated until the end of the translation unit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143234 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
c49bd11f96c2378969822f1f1b814ffa8f2bfee4 28-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Reinstate r142844 (reverted in r142872) now that lvalue-to-rvalue conversions
are present in all the necessary places:

In constant expression evaluation, evaluate lvalues as lvalues and rvalues as
rvalues. Remove special case for caching reference initialization and fix a
cyclic initialization crash in the process.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143204 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
98326ede499696f85d9f7bc1fbc7a628fc22f1ec 25-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Clean up, as suggested by John.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142884 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
436c8898cd1c93c5bacd3fcc4ac586bc5cd77062 25-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Revert r142844, it broke selfhost. The problem appears to be a missing
lvalue-to-rvalue conversion on the LHS operand of '->'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142872 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
05830143fa8c70b8bc46c96b93018455d8a2ca92 25-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Add explanatory comments for ICE checking in C99 mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142866 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
41bf4f38348561a0f12c10d34f1673cd19a6eb04 24-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation: evaluate lvalues as lvalues, and rvalues as
rvalues, as C++11 constant evaluation semantics require. DeclRefs referring to
references can now use the normal initialization-caching codepath, which
incidentally fixes a crash in cyclic initialization of references.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142844 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
8327fad71da34492d82c532f42a58cb4baff81a3 24-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation: factor out handling of ignored values.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142835 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
32cb47174304bc7ec11478b9497c4e10f48273d9 24-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> In accordance with the C89, C99 and C++98 standards, ICEs can only contain
floating-point literals if they are the immediate operands of casts.
ImplicitCastExpr is not a cast in the language-standards sense.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142832 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
03f96110bc2c2c773e06a42982b17a03dd2e5379 24-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation: factor out VarDecl initializer evaluation and
caching.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142812 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
07fc657e3077531805b0e2dbf8f8964d48daa38b 22-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Refactor vector constant expression evaluation to return bool like all the other
const expression evaluation subclasses, and remove some APValue copying and
malloc traffic in the process.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142733 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
454b57ac42c9ce0bed9b7a99c2ed5a18fbcd286b 17-Oct-2011 Eli Friedman <eli.friedman@gmail.com> Initial implementation of __atomic_is_lock_free. The input is the size of an atomic type rather than an atomic type itself just to save some implementation pain; I can change that if it seems worthwhile.

I think this is the last hook needed for <atomic> besides defines for ATOMIC_CHAR_LOCK_FREE and friends.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142281 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
1e12c59e8f9bb76c23628c4e0d0a1dfced0b1fa0 16-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Split apart the state accumulated during constant expression evaluation and the
end result. Use this split to propagate state information and diagnostics
through more of constant expression evaluation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142159 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f10d9171ac24380ca94c71847a9270a05b791cef 11-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation: refactor value initialization and scalar list initialization into base class.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141717 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
276b061970939293f1abaf694bd3ef05b2cbda79 11-Oct-2011 Eli Friedman <eli.friedman@gmail.com> Initial implementation of __atomic_* (everything except __atomic_is_lock_free).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141632 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
db924224b51b153f24fbe492102d4edebcbbb7f4 11-Oct-2011 Eli Friedman <eli.friedman@gmail.com> Extend lvalue evaluation in ExprConstant.cpp to handle CK_LValueBitCast (which is completely trivial). PR8836.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141604 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
a6b8b2c09610b8bc4330e948ece8b940c2386406 10-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation refactoring:
- Remodel Expr::EvaluateAsInt to behave like the other EvaluateAs* functions,
and add Expr::EvaluateKnownConstInt to capture the current fold-or-assert
behaviour.
- Factor out evaluation of bitfield bit widths.
- Fix a few places which would evaluate an expression twice: once to determine
whether it is a constant expression, then again to get the value.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141561 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
eea0e817c609c662f3fef61bb257fddf1ae8f7b7 29-Sep-2011 Eli Friedman <eli.friedman@gmail.com> PR11040: CheckICE should not allow an lvalue bitcast as part of an integer constant expression.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140812 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
620b9338dce31ace41f2f1fa491def3043412568 27-Sep-2011 Peter Collingbourne <peter@pcc.me.uk> Constant evaluation for pointer CXXScalarValueInitExpr

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140613 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
cea8d966f826554f0679595e9371e314e8dbc1cf 24-Sep-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Treat list-initialization of scalars as a first-class citizen in C++11.
Allow empty initializer lists for scalars, which mean value-initialization.
Constant evaluation for single-element and empty initializer lists for scalars.
Codegen for empty initializer lists for scalars.
Test case comes in next commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140459 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
eb2d1f1c88836bd5382e5d7aa8f6b85148a88b27 23-Sep-2011 David Blaikie <dblaikie@gmail.com> Removing a bunch of dead returns/breaks after llvm_unreachables.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140407 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
b219cfc4d75f0a03630b7c4509ef791b7e97b2c8 23-Sep-2011 David Blaikie <dblaikie@gmail.com> Switch assert(0/false) llvm_unreachable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140367 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
33e56f3273457bfa22c7c50bc46cf5a18216863d 10-Sep-2011 John McCall <rjmccall@apple.com> Rename the ARC cast kinds to start with "ARC".



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139466 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
dc05b11c67331016473fbc7909827b1b89c9616b 10-Sep-2011 John McCall <rjmccall@apple.com> When converting a block pointer to an Objective-C pointer type, extend
the lifetime of the block by copying it to the heap, or else we'll get
a dangling reference because the code working with the non-block-typed
object will not know it needs to copy.

There is some danger here, e.g. with assigning a block literal to an
unsafe variable, but, well, it's an unsafe variable.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139451 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
1d9b3b25f7ac0d0195bba6b507a684fe5e7943ee 09-Sep-2011 John McCall <rjmccall@apple.com> Give conversions of block pointers to ObjC pointers a different cast kind
than conversions of C pointers to ObjC pointers. In order to ensure that
we've caught every case, add asserts to CastExpr that strictly determine
which cast kind is used for which kind of bit cast.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139352 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
bcfd1f55bfbb3e5944cd5e03d07b343e280838c4 02-Sep-2011 Douglas Gregor <dgregor@apple.com> Extend the ASTContext constructor to delay the initialization of
builtin types (When requested). This is another step toward making
ASTUnit build the ASTContext as needed when loading an AST file,
rather than doing so after the fact. No actual functionality change (yet).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138985 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
0124839d7fb3d846795190ba2ccf3951f27784fe 22-Aug-2011 Chandler Carruth <chandlerc@gmail.com> Fix a crash-on-valid that has been here for a very long time:

const int &x = x;

This crashed by inifinetly recursing within the lvalue evaluation
routine. I've added a (somewhat) braindead way of preventing this
recursion. If folks have better suggestions for how to avoid it I'm all
ears.

That said, we have some work to do. This doesn't trigger a single
warning for uninitialized, self-initialized or otherwise completely
wrong code. In some senses, the crash was almost better.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138239 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
9f1210c3280104417a4ad30f0a00825ac8fa718a 26-Jul-2011 Chad Rosier <mcrosier@apple.com> After further discussion it has been determined that alignof should report
the preferred alignment. Thus, revert r135934, r135935, and r135940.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136062 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
822f54a7ba3eca643104623e8048be20a3391b19 25-Jul-2011 Chad Rosier <mcrosier@apple.com> Allow target to specify about using minimum alignment vs preferred. Takes care of
FIXME: Override "preferred align" for double and long long for ARM apcs-gnu ABI.
Also part of rdar://9802874

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135940 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
5f9e272e632e951b1efe824cd16acb4d96077930 23-Jul-2011 Chris Lattner <sabre@nondot.org> remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135852 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
3e1ef7849845a9e7bf79156bbb8a2c26d77a1d2e 15-Jul-2011 Jeffrey Yasskin <jyasskin@google.com> Use the new APFloat::convertToInt(APSInt) function to simplify uses of
convertToInt(integerParts*) and make them more reliable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135279 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
91a5755ad73c5dc1dfb167e448fdd74e75a6df56 15-Jul-2011 John McCall <rjmccall@apple.com> Create a new expression node, SubstNonTypeTemplateParmExpr,
to represent a fully-substituted non-type template parameter.
This should improve source fidelity, as well as being generically
useful for diagnostics and such.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135243 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
7e5e5f4cc36fe50f46ad76dca7a266434c94f475 07-Jul-2011 John McCall <rjmccall@apple.com> In ARC, reclaim all return values of retainable type, not just those
where we have an immediate need of a retained value.

As an exception, don't do this when the call is made as the immediate
operand of a __bridge retain. This is more in the way of a workaround
than an actual guarantee, so it's acceptable to be brittle here.

rdar://problem/9504800



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134605 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
82905749d5c8d8b4edec11de754a73349cb96603 07-Jul-2011 Eli Friedman <eli.friedman@gmail.com> Zap a couple unnecessary loops.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134578 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
973c4fc0b0a88f9cea273b16f2082788a6e57d74 02-Jul-2011 Abramo Bagnara <abramo.bagnara@gmail.com> Rewritten fix in r134139 to conform evaluation result to original evaluation context.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134320 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
bfbdcd861a4364bfc21a9e5047bdbd56812d6693 30-Jun-2011 Abramo Bagnara <abramo.bagnara@gmail.com> Fixed enum constant evaluation assertions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134139 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
03e80030515c800d1ab44125b9052dfffd1bd04c 21-Jun-2011 Douglas Gregor <dgregor@apple.com> Introduce a new AST node describing reference binding to temporaries.

MaterializeTemporaryExpr captures a reference binding to a temporary
value, making explicit that the temporary value (a prvalue) needs to
be materialized into memory so that its address can be used. The
intended AST invariant here is that a reference will always bind to a
glvalue, and MaterializeTemporaryExpr will be used to convert prvalues
into glvalues for that binding to happen. For example, given

const int& r = 1.0;

The initializer of "r" will be a MaterializeTemporaryExpr whose
subexpression is an implicit conversion from the double literal "1.0"
to an integer value.

IR generation benefits most from this new node, since it was
previously guessing (badly) when to materialize temporaries for the
purposes of reference binding. There are likely more refactoring and
cleanups we could perform there, but the introduction of
MaterializeTemporaryExpr fixes PR9565, a case where IR generation
would effectively bind a const reference directly to a bitfield in a
struct. Addresses <rdar://problem/9552231>.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133521 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f85e193739c953358c865005855253af4f68a497 16-Jun-2011 John McCall <rjmccall@apple.com> Automatic Reference Counting.

Language-design credit goes to a lot of people, but I particularly want
to single out Blaine Garst and Patrick Beard for their contributions.

Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself,
in no particular order.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133103 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
61eee0ca33b29e102f11bab77c8b74cc00e2392b 04-Jun-2011 Tanya Lattner <tonic@nondot.org> Add support for builtin astype:
__builtin_astype(): Used to reinterpreted as another data type of the same size using for both scalar and vector data types.
Added test case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132612 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
63fe6814f339df30b8463b39995947cbdf920e48 24-May-2011 Douglas Gregor <dgregor@apple.com> Implement the initial part of C++0x [expr.const]p2, which specifies
that the unevaluated subexpressions of &&, ||, and ? : are not
considered when determining whether the expression is a constant
expression. Also, turn the "used in its own initializer" warning into
a runtime-behavior warning, so that it doesn't fire when a variable is
used as part of an unevaluated subexpression of its own initializer.

Fixes PR9999.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131968 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
575a1c9dc8dc5b4977194993e289f9eda7295c39 20-May-2011 Douglas Gregor <dgregor@apple.com> Introduce Type::isSignedIntegerOrEnumerationType() and
Type::isUnsignedIntegerOrEnumerationType(), which are like
Type::isSignedIntegerType() and Type::isUnsignedIntegerType() but also
consider the underlying type of a C++0x scoped enumeration type.

Audited all callers to the existing functions, switching those that
need to also handle scoped enumeration types (e.g., those that deal
with constant values) over to the new functions. Fixes PR9923 /
<rdar://problem/9447851>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131735 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
8cad3046be06ea73ff8892d947697a21d7a440d3 13-May-2011 Peter Collingbourne <peter@pcc.me.uk> Refactoring of constant expression evaluator

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131281 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
21ff2e516b0e0bc8c1dbf965cb3d44bac3c64330 28-Apr-2011 John Wiegley <johnw@boostpro.com> Implementation of Embarcadero array type traits

Patch authored by John Wiegley.

These are array type traits used for parsing code that employs certain
features of the Embarcadero C++ compiler: __array_rank(T) and
__array_extent(T, Dim).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130351 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
552622067dc45013d240f73952fece703f5e63bd 25-Apr-2011 John Wiegley <johnw@boostpro.com> t/clang/expr-traits

Patch authored by David Abrahams.

These two expression traits (__is_lvalue_expr, __is_rvalue_expr) are used for
parsing code that employs certain features of the Embarcadero C++ compiler.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130122 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
4423ac0282acb8ba801eb05b38712438dc0c1e3e 21-Apr-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> For

double data[20000000] = {0};

we would blow out the memory by creating 20M Exprs to fill out the initializer.

To fix this, if the initializer list initializes an array with more elements than
there are initializers in the list, have InitListExpr store a single 'ArrayFiller' expression
that specifies an expression to be used for value initialization of the rest of the elements.

Fixes rdar://9275920.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129896 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
b92ae0e31126e5630d7022f2d6abe7eed2e17746 16-Apr-2011 Tanya Lattner <tonic@nondot.org> Fix bug in vector initializer when initializing a vector with another vector.
Add test case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129617 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f111d935722ed488144600cea5ed03a6b5069e8f 15-Apr-2011 Peter Collingbourne <peter@pcc.me.uk> C1X: implement generic selections

As an extension, generic selection support has been added for all
supported languages. The syntax is the same as for C1X.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129554 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
755d8497e39071aa24acc173ff07083e3256b8f8 12-Apr-2011 John McCall <rjmccall@apple.com> After some discussion with Doug, we decided that it made a lot more sense
for __unknown_anytype resolution to destructively modify the AST. So that's
what it does now, which significantly simplifies some of the implementation.
Normal member calls work pretty cleanly now, and I added support for
propagating unknown-ness through &.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129331 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
379b5155b4566f63679e1da6b0ceb5fdfa2aec6d 11-Apr-2011 John McCall <rjmccall@apple.com> More __unknown_anytype work.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129269 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
575b374fdbfc2c2224fd3047ac11ffc4b8db9ae5 11-Apr-2011 Anders Carlsson <andersca@mac.com> Remove CK_DynamicToNull.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129265 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
7d99bc37e77157523e3bfbc6c077842b74e6690f 10-Apr-2011 Anders Carlsson <andersca@mac.com> As a first step towards fixing PR9641, add a CK_DynamicToNull cast kind which
represents a dynamic cast where we know that the result is always null.

For example:

struct A {
virtual ~A();
};
struct B final : A { };
struct C { };

bool f(B* b) {
return dynamic_cast<C*>(b);
}



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129256 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
1de4d4e8cb2e9c88809fea8092bc6e835a5473d2 07-Apr-2011 John McCall <rjmccall@apple.com> Basic, untested implementation for an "unknown any" type requested by LLDB.
The idea is that you can create a VarDecl with an unknown type, or a
FunctionDecl with an unknown return type, and it will still be valid to
access that object as long as you explicitly cast it at every use. I'm
still going back and forth about how I want to test this effectively, but
I wanted to go ahead and provide a skeletal implementation for the LLDB
folks' benefit and because it also improves some diagnostic goodness for
placeholder expressions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129065 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
e50c297f92914ca996deb8b597624193273b62e4 25-Mar-2011 Eli Friedman <eli.friedman@gmail.com> Silly mistake in integer constant folding cleanup.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128297 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
0254e70b189a2400648d1cc53e279cc3786186e8 25-Mar-2011 Anders Carlsson <andersca@mac.com> Fix some clang warnings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128272 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
2a523eec6a31955be876625819b89e8dc5def707 25-Mar-2011 Eli Friedman <eli.friedman@gmail.com> Switch constant evaluation of float casts over to cast kinds.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128251 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
46a523285928aa07bf14803178dc04616ac85994 25-Mar-2011 Eli Friedman <eli.friedman@gmail.com> Cleanup integral and vector constant evaluation of casts to use cast kinds.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128250 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
0a0d2b179085a52c10402feebeb6db8b4d96a140 23-Mar-2011 Douglas Gregor <dgregor@apple.com> Implement a new 'availability' attribute, that allows one to specify
which versions of an OS provide a certain facility. For example,

void foo()
__attribute__((availability(macosx,introduced=10.2,deprecated=10.4,obsoleted=10.6)));

says that the function "foo" was introduced in 10.2, deprecated in
10.4, and completely obsoleted in 10.6. This attribute ties in with
the deployment targets (e.g., -mmacosx-version-min=10.1 specifies that
we want to deploy back to Mac OS X 10.1). There are several concrete
behaviors that this attribute enables, as illustrated with the
function foo() above:

- If we choose a deployment target >= Mac OS X 10.4, uses of "foo"
will result in a deprecation warning, as if we had placed
attribute((deprecated)) on it (but with a better diagnostic)
- If we choose a deployment target >= Mac OS X 10.6, uses of "foo"
will result in an "unavailable" warning (in C)/error (in C++), as
if we had placed attribute((unavailable)) on it
- If we choose a deployment target prior to 10.2, foo() is
weak-imported (if it is a kind of entity that can be weak
imported), as if we had placed the weak_import attribute on it.

Naturally, there can be multiple availability attributes on a
declaration, for different platforms; only the current platform
matters when checking availability attributes.

The only platforms this attribute currently works for are "ios" and
"macosx", since we already have -mxxxx-version-min flags for them and we
have experience there with macro tricks translating down to the
deprecated/unavailable/weak_import attributes. The end goal is to open
this up to other platforms, and even extension to other "platforms"
that are really libraries (say, through a #pragma clang
define_system), but that hasn't yet been designed and we may want to
shake out more issues with this narrower problem first.

Addresses <rdar://problem/6690412>.

As a drive-by bug-fix, if an entity is both deprecated and
unavailable, we only emit the "unavailable" diagnostic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128127 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f4e3cfbe8abd124be6341ef5d714819b4fbd9082 11-Mar-2011 Peter Collingbourne <peter@pcc.me.uk> Add support for the OpenCL vec_step operator, by generalising and
extending the existing support for sizeof and alignof. Original
patch by Guy Benyei.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127475 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
4f3bc8f7aa90b72832b03bee9201c98f4bb6b4d1 11-Mar-2011 Ken Dyck <kd@kendyck.com> Overload IntExprEvaluator::Success() with a function that takes a CharUnits
parameter to tidy up the places where the expression is a size.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127454 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
c54061a679d8db4169438b2f97f81e3f443c6a25 04-Mar-2011 Benjamin Kramer <benny.kra@googlemail.com> Move private structs into anonymous namespaces.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126997 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
3b332ab132fa85c83833d74d400f6e126f52fbd2 26-Feb-2011 John McCall <rjmccall@apple.com> Don't crash during constant-evaluation of 1/(1/0). PR9262.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126541 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
56ca35d396d8692c384c785f9aeebcf22563fe1e 17-Feb-2011 John McCall <rjmccall@apple.com> Change the representation of GNU ?: expressions to use a different expression
class and to bind the shared value using OpaqueValueExpr. This fixes an
unnoticed problem with deserialization of these expressions where the
deserialized form would lose the vital pointer-equality trait; or rather,
it fixes it because this patch also does the right thing for deserializing
OVEs.

Change OVEs to not be a "temporary object" in the sense that copy elision is
permitted.

This new representation is not totally unawkward to work with, but I think
that's really part and parcel with the semantics we're modelling here. In
particular, it's much easier to fix things like the copy elision bug and to
make the CFG look right.

I've tried to update the analyzer to deal with this in at least some
obvious cases, and I think we get a much better CFG out, but the printing
of OpaqueValueExprs probably needs some work.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125744 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
e08ce650a2b02410eddd1f60a4aa6b3d4be71e73 09-Feb-2011 Peter Collingbourne <peter@pcc.me.uk> AST, Sema, Serialization: add CUDAKernelCallExpr and related semantic actions

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125217 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
63c00d7f35fa060c0a446c9df3a4402d9c7757fe 09-Feb-2011 John McCall <rjmccall@apple.com> Remove vtables from the Stmt hierarchy; this was pretty easy as
there were only three virtual methods of any significance.

The primary way to grab child iterators now is with
Stmt::child_range children();
Stmt::const_child_range children() const;
where a child_range is just a std::pair of iterators suitable for
being llvm::tie'd to some locals. I've left the old child_begin()
and child_end() accessors in place, but it's probably a substantial
penalty to grab the iterators individually now, since the
switch-based dispatch is kindof inherently slower than vtable
dispatch. Grabbing them together is probably a slight win over the
status quo, although of course we could've achieved that with vtables, too.

I also reclassified SwitchCase (correctly) as an abstract Stmt
class, which (as the first such class that wasn't an Expr subclass)
required some fiddling in a few places.

There are somewhat gross metaprogramming hooks in place to ensure
that new statements/expressions continue to implement
getSourceRange() and children(). I had to work around a recent clang
bug; dgregor actually fixed it already, but I didn't want to
introduce a selfhosting dependency on ToT.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125183 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
469a1eb996e1cb0be54f9b210f836afbddcbb2cc 02-Feb-2011 John McCall <rjmccall@apple.com> An insomniac stab at making block declarations list the variables they close
on, as well as more reliably limiting invalid references to locals from
nested scopes.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124721 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
7c7f820d70c925b29290a8563b59615816a827fc 26-Jan-2011 Ken Dyck <kd@kendyck.com> Use RecordLayout::getBaseClassOffset() where CharUnits are needed instead of
converting getBaseClassOffsetInBits() to CharUnits.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124274 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
ba4f5d5754c8291690d01ca9581926673d69b24c 20-Jan-2011 John McCall <rjmccall@apple.com> Fix the computation of alignment for fields of packed+aligned structs.
Part of the fix for PR8413.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123904 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
fb1e3bc29b667f4275e1d5a43d64ec173f4f9a7d 18-Jan-2011 Ken Dyck <ken.dyck@onsemi.com> Replace calls to CharUnits::fromQuantity() with ones
ASTContext::toCharUnitsFromBits() when converting from bit sizes to char units.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123715 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
c7793c73ba8a343de3f2552d984851985a46f159 15-Jan-2011 Douglas Gregor <dgregor@apple.com> Introduce a new expression kind, SubstNonTypeTemplateParmPackExpr,
that captures the substitution of a non-type template argument pack
for a non-type template parameter pack within a pack expansion that
cannot be fully expanded. This follows the approach taken by
SubstTemplateTypeParmPackType.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123506 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
4e26caa0365347eb63d483df29cdf86ca084510c 14-Jan-2011 Ken Dyck <ken.dyck@onsemi.com> Replace a literal '8' with getCharWidth().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123421 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
4ba2a17694148e16eaa8d3917f657ffcd3667be4 12-Jan-2011 Jay Foad <jay.foad@gmail.com> PR3558: mark "logically const" accessor methods in ASTContext as const,
and mark the fields they use as mutable. This allows us to remove a few
const_casts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123314 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
ee8aff06f6a96214731de17b2cb6df407c6c1820 04-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement the sizeof...(pack) expression to compute the length of a
parameter pack.

Note that we're missing proper libclang support for the new
SizeOfPackExpr expression node.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122813 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
be230c36e32142cbdcdbe9c97511d097beeecbab 03-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement support for pack expansions whose pattern is a non-type
template argument (described by an expression, of course). For
example:

template<int...> struct int_tuple { };

template<int ...Values>
struct square {
typedef int_tuple<(Values*Values)...> type;
};

It also lays the foundation for pack expansions in an initializer-list.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122751 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
c6ed729f669044f5072a49d79041f455d971ece3 23-Dec-2010 Jeffrey Yasskin <jyasskin@google.com> Change all self assignments X=X to (void)X, so that we can turn on a
new gcc warning that complains on self-assignments and
self-initializations. Fix one bug found by the warning, in which one
clang::OverloadCandidate constructor failed to initialize its
FunctionTemplate member.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122459 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
8786da77984e81d48e0e1b2bd339809b1efc19f3 14-Dec-2010 John McCall <rjmccall@apple.com> Rewrite ComplexExprEvaluator::VisitCastExpr to use cast kinds, and fix
the basic casting logic to insert intermediate casts and preserve the
exact complex-cast design. Fixes a crash in the test suite.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121776 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
96fc8e4086df323c49f17cac594db1d2f066a2e9 11-Dec-2010 Abramo Bagnara <abramo.bagnara@gmail.com> Improved complex constants evaluation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121616 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f187237d916afa97c491ac32fe98be7d335c5b63 08-Dec-2010 Francois Pichet <pichet2000@gmail.com> Remove the TypesCompatibleExprClass AST node. Merge its functionality into BinaryTypeTraitExpr.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121298 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
9f71a8f4c7a182a5236da9e747d57cc1d1bd24c2 07-Dec-2010 Jay Foad <jay.foad@gmail.com> PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() and
zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method
trunc(), to be const and to return a new value instead of modifying the
object in place.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121121 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
6ad6f2848d7652ab2991286eb48be440d3493b28 07-Dec-2010 Francois Pichet <pichet2000@gmail.com> Type traits intrinsic implementation: __is_base_of(T, U)
New AST node introduced: BinaryTypeTraitExpr; to be reused for more intrinsics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121074 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
4765fa05b5652fcc4356371c2f481d0ea9a1b007 06-Dec-2010 John McCall <rjmccall@apple.com> Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoretical
reason this is limited to C++, and it's certainly not limited to temporaries.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120996 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
12f78a6741a4cb3d904340f8d3d2714568b50e7a 02-Dec-2010 John McCall <rjmccall@apple.com> Simplify the ASTs by consolidating ObjCImplicitGetterSetterExpr and ObjCPropertyRefExpr
into the latter.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120643 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
e2b768877b77fa4e00171ee6e6443722e0f3d111 16-Nov-2010 John McCall <rjmccall@apple.com> Kill CK_Unknown and flesh out the documentation for the existing CastKinds.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119331 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
7cd7d1ad33fdf49eef83942e8855fe20d95aa1b9 16-Nov-2010 John McCall <rjmccall@apple.com> Add a new expression kind, OpaqueValueExpr, which is useful for
certain internal type-checking procedures as well as for representing
certain implicitly-generated operations. Uses to follow.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119289 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f3ea8cfe6b1c2ef0702efe130561e9e66708d799 14-Nov-2010 John McCall <rjmccall@apple.com> Add a few more complex-related cast kinds that arise due to arbitrary
implicit conversions; the last batch was specific to promotions.
I think this is the full set we need. I do think dividing the cast
kinds into floating and integral is probably a good idea.

Annotate a *lot* more C casts with useful cast kinds.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119036 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
2bb5d00fcf71a7b4d478d478be778fff0494aff6 13-Nov-2010 John McCall <rjmccall@apple.com> Introduce five new cast kinds for various conversions into and
between complex types.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118994 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
404cd1669c3ba138a9ae0a619bd689cce5aae271 13-Nov-2010 John McCall <rjmccall@apple.com> Introduce a null-to-pointer implicit cast kind.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118966 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
091f23f1d6d4bcffd6641cda72a6831e08c02ea7 09-Nov-2010 John McCall <rjmccall@apple.com> Split out -Wconversion warnings about constant precision into their
own subcategory, -Wconstant-conversion, which is on by default.

Tweak the constant folder to give better results in the invalid
case of a negative shift amount.

Implements rdar://problem/6792488



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118636 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
a14f5979572aa25c03d24750ee4724d2031d4ede 01-Nov-2010 Anders Carlsson <andersca@mac.com> Rename getBaseClassOffset to getBaseClassOffsetInBits and introduce a getBaseClassOffset which returns the offset in CharUnits. Do the same thing for getVBaseClassOffset.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117881 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
5c5a764fcd256df6f6cfbce5cdd2a2dfb2c45e95 31-Oct-2010 Anders Carlsson <andersca@mac.com> Teach the constant expr evaluator about derived-to-base casts when no virtual bases are involved. Fixes PR5974.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117868 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
96e93660124c8028a4c3bcc038ab0cdd18cd7ab2 31-Oct-2010 Anders Carlsson <andersca@mac.com> Don't try to evaluate the LHS or RHS of a member pointer binary operation. Fixes PR8507.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117850 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
8ac2d449820fd0df00fcbde5bf82165c1f49854d 14-Oct-2010 Fariborz Jahanian <fjahanian@apple.com> Eliminate usage of ObjCSuperExpr used for
'super' as receiver of property or a setter/getter
methods. //rdar: //8525788



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116483 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
189d6ef40eff11b83b2cda941d5ed89a5cef09b2 09-Oct-2010 John McCall <rjmccall@apple.com> Permit constant evaluation of const floating-point variables with
constant initializers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116138 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
0dfd848fa4c9664852ba8c929a8bd3fce93ddca2 13-Sep-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Eagerly evaluate type traits in Sema instead of lazily in AST. They actually need Sema access to be correct, fixes coming up.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113782 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
295995c9c3196416372c9cd35d9cedb6da37bd3d 10-Sep-2010 Sebastian Redl <sebastian.redl@getdesigned.at> First version of a testcase, plus fixes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113624 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
2e156225a29407a50dd19041aa5750171ad44ea3 10-Sep-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Define and implement CXXNoexceptExpr. Create it in Sema.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113623 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
5726d405e71f11feaaf0c8f518abe26e909537a4 10-Sep-2010 Douglas Gregor <dgregor@apple.com> Support strlen() and __builtin_strlen() as constant expressions with
the call argument is a string literal. Fixes
<rdar://problem/8413477>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113580 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
9be88403e965cc49af76c9d33d818781d44b333e 09-Sep-2010 Francois Pichet <pichet2000@gmail.com> Fix warnings caused by new CXXUuidofExprClass enumerator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113444 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
fdac7d4f8b94c5005b6f5d21b44548aa182e16ef 06-Sep-2010 Eli Friedman <eli.friedman@gmail.com> Get rid of unnecessary return.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113132 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
a7dedf7004e8ac3f947d6817370b2778fa648c2b 06-Sep-2010 Eli Friedman <eli.friedman@gmail.com> PR7242: Make sure to use a different context for evaluating constant
initializers, so the result of the evaluation doesn't leak through
inconsistently. Also, don't evaluate references to variables with
initializers with side-effects.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113128 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
e2ca6d4a2f41876930fbd304caa706452d2569d8 02-Sep-2010 Douglas Gregor <dgregor@apple.com> Eliminate CXXBindReferenceExpr, which was used in a ton of
well-intentioned but completely unused code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112868 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
6cf750298d3621d8a10a6dd07fcee8e274b9d94d 30-Aug-2010 Sean Hunt <scshunt@csclub.uwaterloo.ca> Revert my user-defined literal commits - r1124{58,60,67} pending
some issues being sorted out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112493 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
0016d519b831859526b79405cdae4c64c73731c8 29-Aug-2010 Sean Hunt <scshunt@csclub.uwaterloo.ca> Implement C++0x user-defined string literals.

The extra data stored on user-defined literal Tokens is stored in extra
allocated memory, which is managed by the PreprocessorLexer because there isn't
a better place to put it that makes sure it gets deallocated, but only after
it's used up. My testing has shown no significant slowdown as a result, but
independent testing would be appreciated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112458 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
2de56d1d0c3a504ad1529de2677628bdfbb95cd4 25-Aug-2010 John McCall <rjmccall@apple.com> GCC didn't care for my attempt at API compatibility, so brute-force everything
to the new constants.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112047 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
b2dc7f59fe4c762cba73badc3bbc6f356fcd7b5b 17-Aug-2010 Eli Friedman <eli.friedman@gmail.com> Move a bunch of code out of the ComplexExprEvaluator class definition;
no functionality change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111207 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
43efa31fe601bb7c3f132f02246dc3c903d9f361 14-Aug-2010 Eli Friedman <eli.friedman@gmail.com> PR7884: Fix the implementations of __real__ and __imag__ on real floats.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111080 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
de7e66256b1bdfcf6526994825a8c8fced52a31c 13-Aug-2010 Eli Friedman <eli.friedman@gmail.com> Zap unused UnaryOperator::OffsetOf.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110996 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
1357869bc5983cdfbc986db1f3d18265bb34cb0e 05-Aug-2010 Eli Friedman <eli.friedman@gmail.com> Get rid of isObjectType; when C++ says "object type", it generally
just means "not a function type", not "not a function type or void". This
changes behavior slightly, but generally in a way which accepts more code.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110303 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
3c46e8db99196179b30e7ac5c20c4efd5f3926d7 26-Jul-2010 Dan Gohman <gohman@apple.com> Fix namespace polution.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109440 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
e39a3894513349908cdb3beba2614e53cb288e6c 14-Jul-2010 Douglas Gregor <dgregor@apple.com> Introduce a new cast kind for an "lvalue bitcast", which handles
reinterpret_casts (possibly indirectly via C-style/functional casts)
on values, e.g.,

int i;
reinterpret_cast<short&>(i);

The IR generated for this is essentially the same as for

*reinterpret_cast<short*>(&i).

Fixes PR6437, PR7593, and PR7344.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108294 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
ed8abf18329df67b0abcbb3a10458bd8c1d2a595 08-Jul-2010 Douglas Gregor <dgregor@apple.com> Reinstate the fix for PR7556. A silly use of isTrivial() was
suppressing copies of objects with trivial copy constructors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107857 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
84745677f64863e025a6733cb29d0b94bc3a6ae2 08-Jul-2010 Douglas Gregor <dgregor@apple.com> Revert r107828 and r107827, the fix for PR7556, which seems to be
breaking bootstrap on Linux.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107837 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
016a4a90c8e75d59de731fa3aa98f0a55656e66c 08-Jul-2010 Douglas Gregor <dgregor@apple.com> Rename CXXZeroInitValueExpr to CXXScalarValueInitExpr, to reflect its
newly-narrowed scope. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107828 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
0f2b692bb10be35fdc60d0a72a847bdd73124670 07-Jul-2010 John McCall <rjmccall@apple.com> Don't consider casted non-global pointers to be evaluatable.
Fixes rdar://problem/8154689



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107755 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
2ade35e2cfd554e49d35a52047cea98a82787af9 16-Jun-2010 Douglas Gregor <dgregor@apple.com> Introduce Type::isIntegralOrEnumerationType(), to cover those places
in C++ that involve both integral and enumeration types. Convert all
of the callers to Type::isIntegralType() that are meant to work with
both integral and enumeration types over to
Type::isIntegralOrEnumerationType(), to prepare to eliminate
enumeration types as integral types.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106071 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
a7d6c221558fa8117aa1d1fd41cf0046c5c9fade 11-Jun-2010 John McCall <rjmccall@apple.com> Fix the constant evaluator for AltiVec-style vector literals so that the
vector is filled with the given constant; we were just initializing the
first element.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105824 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
761c94e3bffef0fcb8b4bbf202fd5ee73db134f3 16-May-2010 Chandler Carruth <chandlerc@gmail.com> When constant folding reference variables with an initializer to the
initializer, don't fold paramters. Their initializers are just default
arguments which can be overridden. This fixes some spectacular regressions due
to more things making it into the constant folding.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103904 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
e17a6436b429e4b18a5e157061fb13bbc677b3b0 14-May-2010 Abramo Bagnara <abramo.bagnara@gmail.com> Added Expr::EvaluateAsAnyLValue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103780 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
42c8f87eb60958170c46767273bf93e6c96125bf 11-May-2010 John McCall <rjmccall@apple.com> Refactor the constant-evaluator so that it only supports a single form
of constant-evaluation. Formerly you could control whether it accepted
local l-values or not; now it always evaluates local l-values in the core
routines, but filters them out where consumed by the top-level routines.
This will make it much easier to cache evaluability.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103444 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
abd3a857ace59100305790545d1baae5877b8945 08-May-2010 John McCall <rjmccall@apple.com> The FP constant evaluator was missing a few cases of unary operators that return floats
but whose operand isn't a float: specifically, __real__ and __imag__. Instead
of filtering these out, just implement them.

Fixes <rdar://problem/7958272>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103307 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
3554283157190e67918fad4221a5e6faf9317362 07-May-2010 John McCall <rjmccall@apple.com> Make that null-dereference fix a little clearer by rearranging some code.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103298 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
ce87e6d501e4c924f246d2ebf82d780690589351 07-May-2010 John McCall <rjmccall@apple.com> Fix a potential null dereference in the pointer-to-bool evaluator; caught by
Eli Friedman.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103297 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
efdb83e26f9a1fd2566afe54461216cd84814d42 07-May-2010 John McCall <rjmccall@apple.com> Change the pointer / lvalue constant evaluators to build into a target reference
and return a bool.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103296 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f4cf1a18d09d57b757b3cb47eab36c1457091ef7 07-May-2010 John McCall <rjmccall@apple.com> Change the complex constant evaluator to return a bool instead of an APValue.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103268 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
a7d3c04fcfe9d4af2f7758f46aef26b1a8f8ac09 07-May-2010 Rafael Espindola <rafael.espindola@gmail.com> Fix PR4386 by implementing gcc's old behaviour (4.2) when initializing
variables with a comparison of a function pointer with 0.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103253 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
7db7acbbb84b82d0522266a50ebabc3a52a9e5d1 07-May-2010 John McCall <rjmccall@apple.com> Change Evaluate* in the constant evaluator to enforce being given an argument of
the right type. It turns out that the code was already doing this.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103238 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
d905f5ad540c415d1a21b4f8b7bd715bfb7bb920 07-May-2010 John McCall <rjmccall@apple.com> Move CheckICE and isIntegerConstantExpr to ExprConstant.cpp because it seemed
like a good idea at the time.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103237 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
fc39dc4c7886723310419b1869cf651ca55b7af4 29-Apr-2010 Mon P Wang <wangmp@apple.com> A not equal for an unordered relation should return true as specified in IEEE-754, e.g.,
NAN != NAN ? 1 : 0 should return 1. Also fix the case for complex.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102598 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
cc8a5d5f90bbbbcb46f342117b851b7e07ec34f1 29-Apr-2010 Douglas Gregor <dgregor@apple.com> Teach __builtin_offsetof to compute the offsets of members of base
classes, since we only warn (not error) on offsetof() for non-POD
types. We store the base path within the OffsetOfExpr itself, then
evaluate the offsets within the constant evaluator.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102571 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
8ecdb65716cd7914ffb2eeee993fa9039fcd31e8 29-Apr-2010 Douglas Gregor <dgregor@apple.com> Completely reimplement __builtin_offsetof, based on a patch by Roberto
Amadini.

This change introduces a new expression node type, OffsetOfExpr, that
describes __builtin_offsetof. Previously, __builtin_offsetof was
implemented using a unary operator whose subexpression involved
various synthesized array-subscript and member-reference expressions,
which was ugly and made it very hard to instantiate as a
template. OffsetOfExpr represents the AST more faithfully, with proper
type source information and a more compact representation.

OffsetOfExpr also has support for dependent __builtin_offsetof
expressions; it can be value-dependent, but will never be
type-dependent (like sizeof or alignof). This commit introduces
template instantiation for __builtin_offsetof as well.

There are two major caveats to this patch:

1) CodeGen cannot handle the case where __builtin_offsetof is not a
constant expression, so it produces an error. So, to avoid
regressing in C, we retain the old UnaryOperator-based
__builtin_offsetof implementation in C while using the shiny new
OffsetOfExpr implementation in C++. The old implementation can go
away once we have proper CodeGen support for this case, which we
expect won't cause much trouble in C++.

2) __builtin_offsetof doesn't work well with non-POD class types,
particularly when the designated field is found within a base
class. I will address this in a subsequent patch.

Fixes PR5880 and a bunch of assertions when building Boost.Python
tests.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102542 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
fb87b89fc9eb103e19fb8e4b925c23f0bd091b99 26-Apr-2010 Douglas Gregor <dgregor@apple.com> Introduce Type::isStructureOrClassType(), which does the obvious
thing. Audit all uses of Type::isStructure(), changing those calls to
isStructureOrClassType() as needed (which is alsmost
everywhere). Fixes the remaining failure in Boost.Utility/Swap.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102386 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
4992bdde387c5f033bb450a716eaabc0fda52688 20-Apr-2010 Chris Lattner <sabre@nondot.org> remove some extraneous qualifiers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101912 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
363ff23cfddb51abe4ee4212a6dd3c9b534fcc8b 13-Apr-2010 Chris Lattner <sabre@nondot.org> Teach HasSideEffect about InitListExprs. Not having
this caused us to codegen dead globals like this:

struct foo { int a; int b; };

static struct foo fooarray[] = {
{1, 2},
{4},
};



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101150 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
e0cdb4edd8f265d0fd22d178d03c597dd201cda2 20-Mar-2010 Daniel Dunbar <daniel@zuster.org> Evaluate: Fix a subtle bug in the pointer evaluator in which we would do an
expression computation in the wrong bit-width, and end up generating a totally
bogus array reference (_g0+8589934546).
- This showed up on Prolangs/cdecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99042 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
db7b72a82a6834680ccf1eeb51dc57e6d935c655 28-Feb-2010 John McCall <rjmccall@apple.com> Support constant-evaluation of __builtin_nans* as well as the correct constant
evaluation of __builtin_nan*. Most of the work to make this work is in LLVM.

Fixes <rdar://problem/7696712> and part of PR 5255.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97383 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
c4a2638b5ef3e2d35d872614ceb655a7a22c58be 13-Feb-2010 Eli Friedman <eli.friedman@gmail.com> Fix for PR6274: teach constant folding to evaluate __builtin_expect.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96054 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f6b6025a4e26bb0295a57e0efece73253038f278 03-Feb-2010 Anders Carlsson <andersca@mac.com> Don't try to fold DeclRefExprs that point to ParmVarDecls. This had the side-effect of always folding the expression to the default argument of the parameter. For example:

void f(int a = 10) {
return a;
}

would always return 10, regardless of the passed in argument.

This fixes another 600 test failures. We're now down to only 137 failures!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95262 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
31310a21fb2a9f13950f864f681c86080b05d5b2 01-Feb-2010 Sebastian Redl <sebastian.redl@getdesigned.at> In C++, an initializer on a variable doesn't necessarily mean it's the definition. With that in mind, rename getDefinition to getAnyInitializer (to distinguish it from getInit) and reimplement it in terms of isThisDeclarationADefinition. Update all code to use this new function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94999 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
8b752f10c394b140f9ef89e049cbad1a7676fc25 27-Jan-2010 Ken Dyck <ken.dyck@onsemi.com> Change the return type of ASTContext::getDeclAlignInBytes() to CharUnits and,
now that the "InBytes" part of the name is implied by the return type, rename
it to getDeclAlign().



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94681 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
0d13f6fdbdd6f06e2449b8834dda53334abd399a 23-Jan-2010 David Chisnall <csdavec@swan.ac.uk> Created __builtin___NSStringMakeConstantString() builtin, which generates constant Objective-C strings.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94274 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
b2aaf51ed73a4774322a39a0dd59d0fe7e3258c0 19-Jan-2010 Eric Christopher <echristo@apple.com> Update and move around comments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93942 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
a73058324197b7bdfd19307965954f626e26199d 15-Jan-2010 Ken Dyck <ken.dyck@onsemi.com> Convert the type of the LValue offset variable in APValue to CharUnits, moving
the LValue-related methods of APValue out of line to avoid header file leaching.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93512 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
199c3d6cd16aebbb9c7f0d42af9d922c9628bf70 11-Jan-2010 Ken Dyck <ken.dyck@onsemi.com> Roll out ASTContext::getTypeSizeInChars(), replacing instances of
"ASTContext::getTypeSize() / 8". Replace [u]int64_t variables with CharUnits
ones as appropriate.

Also rename RawType, fromRaw(), and getRaw() in CharUnits to QuantityType,
fromQuantity(), and getQuantity() for clarity.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93153 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
cd7a445c6b46c5585580dfb652300c8483c0cb6b 06-Jan-2010 John McCall <rjmccall@apple.com> Add Expr::EvaluateAsBooleanCondition(), which does unprincipled folding to
try to evaluate an expression as a constant boolean condition. This has
the same intended semantics as used in folding conditional operators.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92805 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
3f27b384801de26ce7efaa395699b42719372f24 03-Jan-2010 Benjamin Kramer <benny.kra@googlemail.com> __builtin_object_size(ptr, type) returns -1 for type = {0,1} if there are any side-effects.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92453 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
09a8a0e6ec1252cad52666e9dbb21002b9c80f38 27-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Fix PointerExprEvaluator::VisitCastExpr so it doesn't misfold C++ casts which
it doesn't know how to fold, like derived-to-base casts.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92173 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
54d76db0aa7107597cac0b80d8e138a37e6d1de9 25-Dec-2009 Benjamin Kramer <benny.kra@googlemail.com> Remove some dead variables clang-analyzer found.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92162 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
fee667f35e64751baa7fefe70b4e7bab06c8cd86 23-Dec-2009 Eric Christopher <echristo@apple.com> Update for the intrinsic changes in llvm: the object size intrinsic
only takes a boolean second argument now. Update tests accordingly.
Currently the builtin still accepts the full range for compatibility.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91983 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
330358056acf05445273f4f4004dfd283a2ecc4d 11-Dec-2009 Benjamin Kramer <benny.kra@googlemail.com> Use StringRef.getAsInteger instead of temporary string + strtol. No intended functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91118 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
29a7f3342c3c6dd15d914c61ae22246c36d51ce7 10-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Clean up enum constants so that they're finally sane. Fixes PR3173 and a
recently introduced crash.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91070 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
67f85fcdab64f36233a7211f963ed1cccffcbfb8 04-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Fix for PR5447: teach Evaluate to deal with floating-point conditionals.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90521 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
c013118155077cf8bdaef743c5dbce760114eed3 03-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Add recursion guards to ice-checking and evaluation for declrefs, so we
don't infinitely recurse for cases we can't evaluate.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90480 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
770b4a8834670e9427d3ce5a1a8472eb86f45fd2 28-Nov-2009 Benjamin Kramer <benny.kra@googlemail.com> Remove VISIBILITY_HIDDEN from lib/AST.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90043 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
043097507f99b1156bfd8bad41e7d5166ae4b9b6 24-Nov-2009 Eli Friedman <eli.friedman@gmail.com> Teach Evaluate to handle member expressions referring to enum constants and
static member constants. No significant visible difference at the moment
because it conservatively assumes the base has side effects. I'm planning to
use this for CodeGen.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89738 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
5d484e8cf710207010720589d89602233de61d01 23-Nov-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Intercept sizeof and alignof references before they get into ASTContext methods. This fixes a crash when writing sizeof(Incomplete&), and lets ASTContext's methods do the right thing for CodeGen, which fixes PR5590.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89668 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
7f92f0362ef2cf218bc19bb83e1a97dd254b5527 16-Nov-2009 Eli Friedman <eli.friedman@gmail.com> Add constant evaluation for comma operator with floating-point operand. Fixes
PR5449.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88885 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
393c247fe025ccb5f914e37e948192ea86faef8c 05-Nov-2009 Fariborz Jahanian <fjahanian@apple.com> Added support for static variables which require
initialization before main. Fixes pr5396.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86145 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
df317bf71653eeb235da8337b1e8e790f9653aa4 04-Nov-2009 Mike Stump <mrs@apple.com> Refine volatile handling, specifically, we must have the canonical
type to look at the volatile specifier. I found these all from just
hand auditing the code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85967 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
cf184655319cf7a5b811067cff9d26a5741fd161 03-Nov-2009 Chris Lattner <sabre@nondot.org> silence a warning.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85931 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
cf3293eaeb3853d12cff47e648bbe835004e929f 01-Nov-2009 Douglas Gregor <dgregor@apple.com> When determining whether a reference to a static data member is an
integral constant expression, make sure to find where the initializer
was provided---inside or outside the class definition---since that can
affect whether we have an integral constant expression (and, we need
to see the initializer itself).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85741 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
3f0147e161df4725ff15fbb731f4f727afcc229f 30-Oct-2009 Mike Stump <mrs@apple.com> Fix one more bug with __builtin_object_size.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85538 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
980ca220848d27ef55ef4c2d37423461a8ed0da3 29-Oct-2009 Mike Stump <mrs@apple.com> Fix some issues Daniel pointed out.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85526 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
d8ee95fd4fb8fb00ad999dffad5fa1613c68a113 29-Oct-2009 Chris Lattner <sabre@nondot.org> optimize out some ifdefs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85453 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
d9becd1846e2c72bf6ad283faa1b048f33dd3afe 29-Oct-2009 Chris Lattner <sabre@nondot.org> Implement clang support for indirect branch and address of label
using the new LLVM support for this. This is temporarily hiding
behind horrible and ugly #ifdefs until the time when the optimizer
is stable (hopefully a week or so). Until then, lets make it "opt in" :)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85446 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
460d138c19be357414e4ab56ec880e5451f95cb4 28-Oct-2009 Mike Stump <mrs@apple.com> Refine __builtin_object_size. Don't try and get a size for things
that don't have sizes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85435 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
c4c9045dabfc0f0d37dea1b3eb2992654d5b2db1 27-Oct-2009 Mike Stump <mrs@apple.com> __builtin_object_size refinements. Ensure we handle expressions with
side-effects up front, as when we switch to the llvm intrinsic call
for __builtin_object_size later, it will have two evaluations.

We also finish off the intrinsic version of the code so we can just
turn it on once llvm has the intrinsic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85324 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
660e6f79a138a30a437c02142f23e7ef4eb21b2e 27-Oct-2009 Mike Stump <mrs@apple.com> __builtin_object_size refinements. Also handle stack based objects. WIP.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85174 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
06bc9bcc705e5fee714d4b00c3c3c9f01715c195 26-Oct-2009 Mike Stump <mrs@apple.com> __builtin_object_size refinements. When we run out of object, be sure
to clamp at 0 bytes left. WIP.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85157 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
4fc8758077ced5cdc11f30a5ed07e9af71d5787a 26-Oct-2009 Mike Stump <mrs@apple.com> Be sure to zero-extend. And refactor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85140 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
64eda9e50b593f935c95bd1edc98c4bfda03f601 26-Oct-2009 Mike Stump <mrs@apple.com> __builtin_object_size refinements. WIP.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85136 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
26bc220377705292a0519a71d3ea3aef68fcfec6 03-Oct-2009 Anders Carlsson <andersca@mac.com> Ignore No-op casts when evaluating lvalue expressions. Fixes PR5122.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83267 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
0953e767ff7817f97b3ab20896b229891eeff45b 24-Sep-2009 John McCall <rjmccall@apple.com> Refactor the representation of qualifiers to bring ExtQualType out of the
Type hierarchy. Demote 'volatile' to extended-qualifier status. Audit our
use of qualifiers and fix a few places that weren't dealing with qualifiers
quite right; many more remain.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82705 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
21fb98ee003e992b0c4e204d98a19e0ef544cae3 23-Sep-2009 Chris Lattner <sabre@nondot.org> implement support for __builtin_eh_return_data_regno on x86-32 and x86-64.
This implements PR5034 and rdar://6836445.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82614 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
183700f494ec9b6701b6efe82bcb25f4c79ba561 22-Sep-2009 John McCall <rjmccall@apple.com> Change all the Type::getAsFoo() methods to specializations of Type::getAs().
Several of the existing methods were identical to their respective
specializations, and so have been removed entirely. Several more 'leaf'
optimizations were introduced.

The getAsFoo() methods which imposed extra conditions, like
getAsObjCInterfacePointerType(), have been left in place.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82501 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
c1eb14a66fdd955aff3f957a5843295f27952bdd 15-Sep-2009 Anders Carlsson <andersca@mac.com> Codegen support for nullptr from C++0x.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81835 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
b2f295c8050fb8c141bf2cf38eed0a56e99d0092 13-Sep-2009 Eli Friedman <eli.friedman@gmail.com> Add utility to evaluate lvalues which are an offset relative to a stack
location. Patch by Enea Zaffanella.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81672 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
1eb4433ac451dc16f4133a88af2d002ac26c58ef 09-Sep-2009 Mike Stump <mrs@apple.com> Remove tabs, and whitespace cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
d933a0198f3ccce9c73bf2951625315b911d37bf 29-Aug-2009 Eli Friedman <eli.friedman@gmail.com> Get rid of mostly-unused, buggy method.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80432 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
6217b80b7a1379b74cced1c076338262c3c980b3 29-Jul-2009 Ted Kremenek <kremenek@apple.com> Change uses of:
Type::getAsReferenceType() -> Type::getAs<ReferenceType>()
Type::getAsRecordType() -> Type::getAs<RecordType>()
Type::getAsPointerType() -> Type::getAs<PointerType>()
Type::getAsBlockPointerType() -> Type::getAs<BlockPointerType>()
Type::getAsLValueReferenceType() -> Type::getAs<LValueReferenceType>()
Type::getAsRValueReferenceType() -> Type::getAs<RValueReferenceType>()
Type::getAsMemberPointerType() -> Type::getAs<MemberPointerType>()
Type::getAsReferenceType() -> Type::getAs<ReferenceType>()
Type::getAsTagType() -> Type::getAs<TagType>()

And remove Type::getAsReferenceType(), etc.

This change is similar to one I made a couple weeks ago, but that was partly
reverted pending some additional design discussion. With Doug's pending smart
pointer changes for Types, it seemed natural to take this approach.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77510 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
5e03f9ea8174ae588c5e69ec6b5ef4c68f8fd766 24-Jul-2009 Douglas Gregor <dgregor@apple.com> This patch fixes the implementations of the __has_trivial_destructor
and __has_trivial_constructor builtin pseudo-functions and
additionally implements __has_trivial_copy and __has_trivial_assign,
from John McCall!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76916 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
19cc4abea06a9b49e0e16a50d335c064cd723572 18-Jul-2009 Anders Carlsson <andersca@mac.com> Revert r75641.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76327 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
35366a67baa970c287c714c957cf78a4131cf60d 17-Jul-2009 Ted Kremenek <kremenek@apple.com> Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methods
until Doug Gregor's Type smart pointer code lands (or more discussion occurs).
These methods just call the new Type::getAs<XXX> methods, so we still have
reduced implementation redundancy. Having explicit getAsXXXType() methods makes
it easier to set breakpoints in the debugger.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76193 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
5cad1f74469d4d8b4fc51fe53a7837778aeb6107 17-Jul-2009 Ted Kremenek <kremenek@apple.com> Replaced Type::getAsLValueReferenceType(), Type::getAsRValueReferenceType(), Type::getAsMemberPointerType(), Type::getAsTagType(), and Type::getAsRecordType() with their Type::getAs<XXX> equivalents.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76139 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
1a1a6e2bd4c5aefd7fd643cf25915f9623a02e59 16-Jul-2009 Ted Kremenek <kremenek@apple.com> Add member template 'Type::getAs<T>', which converts a Type* to a respective T*.
This method is intended to eventually replace the individual
Type::getAsXXXType<> methods.

The motivation behind this change is twofold:

1) Reduce redundant implementations of Type::getAsXXXType() methods. Most of
them are basically copy-and-paste.

2) By centralizing the implementation of the getAs<Type> logic we can more
smoothly move over to Doug Gregor's proposed canonical type smart pointer
scheme.

Along with this patch:

a) Removed 'Type::getAsPointerType()'; now clients use getAs<PointerType>.
b) Removed 'Type::getAsBlockPointerTypE()'; now clients use getAs<BlockPointerType>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76098 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
3d598a5ab3c8aabce0a03a2f5dea65eee643e5ac 14-Jul-2009 Anders Carlsson <andersca@mac.com> Rename RecordLayout.h to ASTRecordLayout.h

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75641 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
14108da7f7fc059772711e4ffee1322a27b152a7 11-Jul-2009 Steve Naroff <snaroff@apple.com> This patch includes a conceptually simple, but very intrusive/pervasive change.

The idea is to segregate Objective-C "object" pointers from general C pointers (utilizing the recently added ObjCObjectPointerType). The fun starts in Sema::GetTypeForDeclarator(), where "SomeInterface *" is now represented by a single AST node (rather than a PointerType whose Pointee is an ObjCInterfaceType). Since a significant amount of code assumed ObjC object pointers where based on C pointers/structs, this patch is very tedious. It should also explain why it is hard to accomplish this in smaller, self-contained patches.

This patch does most of the "heavy lifting" related to moving from PointerType->ObjCObjectPointerType. It doesn't include all potential "cleanups". The good news is additional cleanups can be done later (some are noted in the code). This patch is so large that I didn't want to include any changes that are purely aesthetic.

By making the ObjC types truly built-in, they are much easier to work with (and require fewer "hacks"). For example, there is no need for ASTContext::isObjCIdStructType() or ASTContext::isObjCClassStructType()! We believe this change (and the follow-up cleanups) will pay dividends over time.

Given the amount of code change, I do expect some fallout from this change (though it does pass all of the clang tests). If you notice any problems, please let us know asap! Thanks.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75314 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
d906dc7605b2d6352e16c27a5d3fb5f1a1b44ac8 01-Jul-2009 Daniel Dunbar <daniel@zuster.org> Fix thinko in r74506, test condition for floats was inverted.
- Refactored slightly to make control flow more obvious.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74637 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
c0b8b19bd8056d6b5d831623a0825cce150f4507 01-Jul-2009 Nate Begeman <natebegeman@mac.com> Implement Eli's feedback for vecto constant expressions;

For ExtVectorType, initializer is splatted to all elements.
For VectorType, initializer is bitcast to vector type.

Verified that for VectorType, output is identical to gcc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74600 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
17945a0f64fe03ff6ec0c2146005a87636e3ac12 30-Jun-2009 Argyrios Kyrtzidis <akyrtzi@gmail.com> De-ASTContext-ify DeclContext.

Remove ASTContext parameter from DeclContext's methods. This change cascaded down to other Decl's methods and changes to call sites started "escalating".
Timings using pre-tokenized "cocoa.h" showed only a ~1% increase in time run between and after this commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74506 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
e8c9e9218f215ec6089f12b076c7b9d310fd5194 26-Jun-2009 Nate Begeman <natebegeman@mac.com> OpenCL 1.0 Support:
Add support for scalar to vector and partially initialized vector constant initializers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74299 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
5bc86103767c2abcbfdd6518e0ccbbbb6aa59e0f 14-Jun-2009 Eli Friedman <eli.friedman@gmail.com> PR4351: Add constant evaluation for constructs like "foo == NULL", where
foo has a constant address.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73321 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
1b63e4f732dbc73d90abf886b4d21f8e3a165f6d 14-Jun-2009 Chris Lattner <sabre@nondot.org> Sink the BuiltinInfo object from ASTContext into the
preprocessor and initialize it early in clang-cc. This
ensures that __has_builtin works in all modes, not just
when ASTContext is around.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73319 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
ce1bca73aef9bbf6359ab8420278203dda81a054 04-Jun-2009 Eli Friedman <eli.friedman@gmail.com> Minor simplification.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72887 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
147bd641dd264fde2fc5a0074f30eace71016ea9 04-Jun-2009 Eli Friedman <eli.friedman@gmail.com> PR4326: Handle constant evaluation for void* pointer subtraction
correctly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72886 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
2be586108bb401019647791feca19ea03fd477ce 30-May-2009 Eli Friedman <eli.friedman@gmail.com> Some small fixes for fields of reference type.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72636 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
7462b39a9bccaf4392687831036713f09f9c0681 30-May-2009 Mike Stump <mrs@apple.com> Cleqnup ideas from Chris, thanks.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72621 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
4572baba9d18c275968ac113fd73b0e3c77cccb8 30-May-2009 Mike Stump <mrs@apple.com> Improve __builtin_nanf support; we now can deal with them as constants.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72607 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
50c39ea4858265f3f5f42a0c624557ce2281936b 27-May-2009 Eli Friedman <eli.friedman@gmail.com> Fix up constant expression handling to deal with the address
of a reference correctly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72463 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
78d1583d0b36b7d6d8d10234cdc19ab94adf765a 26-May-2009 Douglas Gregor <dgregor@apple.com> When evaluating a VarDecl as a constant or determining whether it is
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72428 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
6e8ed16ffef02b82995a90bdcf10ffff7d63839a 10-May-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Implement C++0x nullptr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71405 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
24cbfb96f09318f59dc73eaaf4909a79788ec5ac 03-May-2009 Daniel Dunbar <daniel@zuster.org> Remove an unneeded special case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70689 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
18857644059c45da6776f1a288eec7b4cf3a844a 30-Apr-2009 Douglas Gregor <dgregor@apple.com> Properly compute the alignment of typedefs that make use of the
"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.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70497 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
267c0ab1b9a15768f3f15abbfc40ce344751c78b 29-Apr-2009 Eli Friedman <eli.friedman@gmail.com> Minor simplification; also silences gcc warning.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70406 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
ad02d7debd03ff275ac8ea27891a4ecccdb78068 28-Apr-2009 Eli Friedman <eli.friedman@gmail.com> PR4097: add logic to Evaluate to handle pointer equality comparisons.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70317 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
1725f683432715e5afe34d476024bd6f16eac3fc 22-Apr-2009 Eli Friedman <eli.friedman@gmail.com> Add handling for complex->int, int->complex float, and float->complex
int. Note that constant int->complex float and float->complex int casts
were being miscompiled.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69821 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
ff89666e8d143b52f2bb5d2c3a108125d523abb7 21-Apr-2009 Daniel Dunbar <daniel@zuster.org> Use an ASTRecordLayout to compute the sizeof an interface, not
addRecordToClass.
- Among other things, this fixes a crash when applying sizeof to an
interface with synthesized ivars, although things still aren't
"correct" here.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69675 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
3aaa482ea5b8d20b705f6ac8573b539be88d273a 16-Apr-2009 Steve Naroff <snaroff@apple.com> Fix <rdar://problem/6765383> clang-6: clang does not appear to support declaring a static Block 'const'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69306 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
1b78276a75a5a0f496a82429c1ff9604d622a76d 10-Apr-2009 Anders Carlsson <andersca@mac.com> Add Expr::EvaluateAsLValue which will (believe it or not) try to evaluate an Expr as an LValue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68763 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
6ab3524f72a6e64aa04973fa9433b5559abb3525 09-Apr-2009 Douglas Gregor <dgregor@apple.com> Propagate the ASTContext to various AST traversal and lookup functions.
No functionality change (really).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68726 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
e1646da3bb0fe97b372e5fe8cefc537b22048fc4 31-Mar-2009 Eli Friedman <eli.friedman@gmail.com> Slight generalization for Evaluate with const variables.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68075 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
42edd0d32a729d2735a6fb152ba6bf349bf0a169 24-Mar-2009 Eli Friedman <eli.friedman@gmail.com> Fix PR3868 by making Evaluate handle cases like "(long)&a + 4".



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67593 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
ba98d6bb414861965a1f22628494ea046785ecd4 23-Mar-2009 Eli Friedman <eli.friedman@gmail.com> Minor Evaluate cleanup; add some boilerplate implementations to
Evaluate for __extension__ and __builtin_choose_expr.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67506 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
a1f47c447a919c6a05c63801cb6a52c4c288e2cc 23-Mar-2009 Eli Friedman <eli.friedman@gmail.com> Minor enhancements to Evaluate.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67503 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
7c80bd64032e610c0dbd74fc0ef6ea334447f2fd 17-Mar-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Almost complete implementation of rvalue references. One bug, and a few unclear areas. Maybe Doug can shed some light on some of the fixmes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67059 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
7976932a1c256d447316ffac58e9821417725e34 04-Mar-2009 Eli Friedman <eli.friedman@gmail.com> Minor cleanup for choose expressions: add a helper that returns the
chosen sub-expression, rather than just evaluating the condition.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66018 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
722c717cd833e410ca6e7976d78baea16995e0c4 28-Feb-2009 Eli Friedman <eli.friedman@gmail.com> Fix obvious shortcoming in the implementations of Evaluate for
integer __real__ and __imag__. Not sure how I missed this.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65677 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
35183aca180a2b9b2c637cd625a40a7e147d6a32 27-Feb-2009 Eli Friedman <eli.friedman@gmail.com> Change the AST generated for offsetof a bit so that it looks like a
normal expression, and change Evaluate and IRGen to evaluate it like a
normal expression. This simplifies the code significantly, and fixes
PR3396.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65622 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
664a104ba0b8f47b8908ec6af694d9646adba1fc 27-Feb-2009 Eli Friedman <eli.friedman@gmail.com> Some minor improvements to Evaluate.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65613 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
8958891f5fa1e593c4519a36b3df427ee019d70b 26-Feb-2009 Daniel Dunbar <daniel@zuster.org> Add Type::hasPointerRepresentation predicate.
- For types whose native representation is a pointer.

- Use to replace ExprConstant.cpp:HasPointerEvalType,
CodeGenFunction::isObjCPointerType.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65569 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
33ef1456a19779fb15c51aea362bd9c7cb4087f3 26-Feb-2009 Eli Friedman <eli.friedman@gmail.com> Remove short-circuit evaluation and the extension warnings. I'm
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65525 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
eaf2bb89eb2aad3b80673de30febe52df43c10ec 24-Feb-2009 Chris Lattner <sabre@nondot.org> first wave of fixes for @encode sema support. This is part of PR3648.

The big difference here is that (like string literal) @encode has
array type, not pointer type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65391 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
d461777e23204fe8c480302d8ff76f5847605da6 23-Feb-2009 Steve Naroff <snaroff@apple.com> Revert http://llvm.org/viewvc/llvm-project?view=rev&revision=65244.

Remove support for "Class<P>". Will be making this an error.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65332 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
91110ee24e3475e0a3a38938c7b98439b5cf0b0e 23-Feb-2009 Eli Friedman <eli.friedman@gmail.com> A few small improvements to Evaluate for stuff I noted in FIXMEs.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65305 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
2217c87bdc5ab357046a5453bdb06f469c41024e 22-Feb-2009 Eli Friedman <eli.friedman@gmail.com> A bit of Evaluate cleanup. Also, a full audit of what's missing that
someone would reasonably expect Evaluate to handle for C/ObjC.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65284 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
4bdf08770e75a068de2430e21a43b381aeb13b95 22-Feb-2009 Eli Friedman <eli.friedman@gmail.com> Enhance Evaluate to handle ObjC qualified id and class types; as far as
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65261 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
c508203a278f6a9238fff46ae1f025b4b402b233 22-Feb-2009 Eli Friedman <eli.friedman@gmail.com> Fix for PR3433: map __alignof__ to preferred alignment. (This was
partially done in r65258.)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65260 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
4fff4819a913c65ae23cfd389bc47c61919e4e1f 21-Feb-2009 Daniel Dunbar <daniel@zuster.org> Evaluation of unary deref could call integer evaluator on non-integral
expr; hilarity ensued.
- PR3640.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65234 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
69ab26a8623141f35e86817cfc6e0fbe7639a40f 20-Feb-2009 Daniel Dunbar <daniel@zuster.org> Handle constant int -> ptr casts of lvalue results.
- PR3463 (again).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65133 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
e8761c8fe2ee6b628104a0885f49fd3c21c08a4f 20-Feb-2009 Eli Friedman <eli.friedman@gmail.com> Add support for * (unary dereference) operator to ExprConstant.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65105 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
be26570e3faa009bdcefedfaf04473e518940520 20-Feb-2009 Eli Friedman <eli.friedman@gmail.com> ExprConstant handling for a couple more cases of pointer-to-int casts
from the testsuite.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65098 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
dd2116462ae311043986ae8b7fba27e68c1b2e66 19-Feb-2009 Daniel Dunbar <daniel@zuster.org> Extend Evaluate() to fold (int) <pointer type>.
- 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65074 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
b92dac8bc2f6f73919825f9af693a8a7e89ae1d4 19-Feb-2009 Daniel Dunbar <daniel@zuster.org> Simplify, no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65073 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
b83d287bc7f47d36fb0751a481e2ef9308b37252 19-Feb-2009 Mike Stump <mrs@apple.com> Add enough checking to ensure that non-constant block literals don't
appear to be constant. I'll probably redo this and throw it all away
later once we have codegen for BlockDeclRefExprs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65070 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
30c37f4d2ee5811e85f692c22fb67d74ddc88079 19-Feb-2009 Daniel Dunbar <daniel@zuster.org> Change IntExprEvaluator to operate on an APValue not an APSInt.
- Prep for handling lvalues, no intended functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65063 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
3f7d995390009fede92b333a040da80e1ce90997 19-Feb-2009 Daniel Dunbar <daniel@zuster.org> Add another IntExprEvaluator::Success overload to suck up remained of
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!).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65053 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
131eb438d8c216b2e2a4f8fa8158ea88b787dc14 19-Feb-2009 Daniel Dunbar <daniel@zuster.org> Add IntExprEvaluator::Success method.
- 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65038 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
4d4c50dd8b4db191c38782414665fb7608315a36 19-Feb-2009 Anders Carlsson <andersca@mac.com> Handle the GNU void* and function pointer arithmetic extensions for constant expressions as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65013 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
bd65cac8de63d108a681035782a71d42954b03ab 19-Feb-2009 Mike Stump <mrs@apple.com> More codegen for blocks. The type of block literals should be better.
The size calculation is improved.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64994 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
ca2f3fdeedc4e4beea4f7572d6d975188d0bb5ef 18-Feb-2009 Mike Stump <mrs@apple.com> Codegen for int (^bp)(int) = 0;


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64951 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
c87a282e7b80c055088fc51bdbe8fc73da64d4f8 18-Feb-2009 Daniel Dunbar <daniel@zuster.org> Rename UnaryTypeTraitExpr::Evaluate to EvaluateTrait to not collide
with Expr::Evaluate().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64850 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
b7d0844c887a72064b624dc6df12cbe1441f69d0 17-Feb-2009 Daniel Dunbar <daniel@zuster.org> Eek! getDeclAlign sometimes returned alignment in bits.
- 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?


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64828 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f11284ac87daa613bc7b30db9f54bd716d123222 17-Feb-2009 Fariborz Jahanian <fjahanian@apple.com> Renamed ASQualType to ExtQualType to reflect its more
general use; as for, objc2's gc type attributes. No
change in functionality.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64778 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
3c385e5f8d9008fff18597ca302be19fa86e51f6 14-Feb-2009 Douglas Gregor <dgregor@apple.com> Add hook to add attributes to function declarations that we know
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++.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64561 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
b2bc62bd35129f09d0746ef6a5ef4dc392b6d6e1 08-Feb-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Teach the constant evaluator about C++ const integral variables.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64086 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
4087e24f73d05d96ac2d259679751d054d3ddfbc 29-Jan-2009 Daniel Dunbar <daniel@zuster.org> Evaluate ==,!= for complex types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63280 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
a2cfd34952204c9a160fe1a5da5ba2f231df891d 29-Jan-2009 Daniel Dunbar <daniel@zuster.org> Evaluate casts to complex.
- 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63278 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
500d3297d2a21edeac4d46cbcbe21bc2352c2a28 29-Jan-2009 Chris Lattner <sabre@nondot.org> move library-specific diagnostic headers into library private dirs. Reduce
redundant #includes. Patch by Anders Johnsen!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63271 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
3f2798757c9ee353e207e18115e2e966432a4bee 29-Jan-2009 Daniel Dunbar <daniel@zuster.org> Add folding for complex mul and fix some major bugs in complex float
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63264 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
a5fd07bbc5e4bae542c06643da3fbfe4967a9379 28-Jan-2009 Daniel Dunbar <daniel@zuster.org> Implement basic _Complex integer constant folding.
- Merged into single ComplexEvaluator, these share too much logic to
be worth splitting for float/int (IMHO). Will split on request.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63248 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
20c6b3b85e186cd52d5d99489132d71d498159eb 27-Jan-2009 Chris Lattner <sabre@nondot.org> Split the single monolithic DiagnosticKinds.def file into one
.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!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63111 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
3941b18b8e441c8c466efecd557de60b9a32d10b 25-Jan-2009 Eli Friedman <eli.friedman@gmail.com> Make the constant folder aware of
__builtin___CFStringMakeConstantString. (We get into trouble in
GenerateStaticBlockVarDecl if the constant folder isn't accurate.)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62949 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f01158941ba4560c63150032073bb231ce38999e 25-Jan-2009 Eli Friedman <eli.friedman@gmail.com> Fix the address of a label to be properly considered and emitted as a
constant.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62948 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f2da9dfef96dc11b7b5effb1d02cb427b2d71599 24-Jan-2009 Eli Friedman <eli.friedman@gmail.com> Refactor sizeof handling to use constant folding logic for constant
sizeof expressions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62941 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
af707ab8fbb9451e8febb8d766f6c043628125c4 24-Jan-2009 Chris Lattner <sabre@nondot.org> add initial support for the gcc "alignof(decl) is the alignment of the decl
not the type" semantics. This can definitely be improved, but is better than
what we had.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62939 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
e9feb475d72ba50dc29cec62a8c47cae721065eb 24-Jan-2009 Chris Lattner <sabre@nondot.org> Improve handling of alignof. alignof(VLA) now works properly for example.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62932 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
8f826f0e0c90b05ab04e84c29157d2e965713288 24-Jan-2009 Daniel Dunbar <daniel@zuster.org> Fix invalid evaluation of _Complex float (real & imaginary parts had
mismatched semantics).
- Enforce this in APValue.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62924 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
59b5da6d853b4368b984700315adf7b37de05764 18-Jan-2009 Nate Begeman <natebegeman@mac.com> Support evaluation of vector constant expressions, and codegen of same.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62455 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
67303c1c78345c53abbf19516170f5bd79b0534d 16-Jan-2009 Fariborz Jahanian <fjahanian@apple.com> postpone sizeof objc-class computatin to the clients.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62292 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f185319f25efd6094870f287030270fad26085ba 15-Jan-2009 Daniel Dunbar <daniel@zuster.org> Fix some unused variable, control reaches end of non-void function,
and uninitialized use options.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62270 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
64b45f7e0d3167f040841ac2920aead7f080730d 05-Jan-2009 Sebastian Redl <sebastian.redl@getdesigned.at> PODness and Type Traits

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).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61746 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
3f70456b8adb0405ef2a47d51f9fc2d5937ae8ae 21-Dec-2008 Anders Carlsson <andersca@mac.com> Add codegen support for __null

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61314 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
86f194083504938df72135b5b66bf0c5cafd9498 21-Dec-2008 Douglas Gregor <dgregor@apple.com> Add support for member references (E1.E2, E1->E2) with C++ semantics,
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61294 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
1c0cfd4599e816cfd7a8f348286bf0ad79652ffc 19-Dec-2008 Anders Carlsson <andersca@mac.com> Get rid of the old Expr::Evaluate variant.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61260 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
44b4321feab46299d3f5cfd404680884752a0fcf 11-Dec-2008 Douglas Gregor <dgregor@apple.com> Unifies the name-lookup mechanisms used in various parts of the AST
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).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60878 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
e9a0f43927041e2bcc89140c338dfae207ad3c3b 08-Dec-2008 Eli Friedman <eli.friedman@gmail.com> Workaround for PR3173. The fix is correct in the sense that if the enum
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60680 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
d407a7619904c81d38b41a9ee850de413105084b 05-Dec-2008 Anders Carlsson <andersca@mac.com> This wasn't such a good idea after all as it broke some tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60582 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
b3fee0f06422074f5c62144b727434562815c691 05-Dec-2008 Anders Carlsson <andersca@mac.com> Handle __builtin___CFStringMakeConstantString in Expr::Evaluate.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60581 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
4fdfb0965b396f2778091f7e6c051d17ff9791ba 01-Dec-2008 Anders Carlsson <andersca@mac.com> Generate the correct results for the comma expression. Fixes PR3123.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60334 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
027f62ec1860f4ab0c91bd863b238938880b8102 01-Dec-2008 Anders Carlsson <andersca@mac.com> Emit the correct diagnostic when a comma is in an ICE.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60316 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
0e8acbbba71ec6acd5dceb4fcbce63e463e1b755 30-Nov-2008 Anders Carlsson <andersca@mac.com> Change the diagnostics that the evaluator reports to be of type NOTE.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60301 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f0c1e4b679e15c26bffb5892e35985bf3c52f77a 30-Nov-2008 Anders Carlsson <andersca@mac.com> Replace the isEvaluated bool with a ShortCircuit int, making it easier to handle recursion

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60300 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
82206e267ce6cc709797127616f64672d255b310 30-Nov-2008 Anders Carlsson <andersca@mac.com> Pass the expression to the Error and Extension methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60299 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
5b45d4ef1ea3f04ec863daf8aa29be6c6e021750 30-Nov-2008 Anders Carlsson <andersca@mac.com> Add a new variant of Evaluate and reimplement the old Evaluate in terms of the new.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60298 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
fcb4d09531abbf2a5cf398c2f946fb3bc2875f64 30-Nov-2008 Anders Carlsson <andersca@mac.com> General cleanup, evaluate the RHS of a logical op even if the LHS will give us the result.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60297 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
54da0496616cb898596cfd5fae1f824098bd8435 30-Nov-2008 Anders Carlsson <andersca@mac.com> EvalInfo now holds a reference to an EvalResult struct.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60296 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
cfe257198c3ace5dfa79365be8cfc55c3e400d4e 26-Nov-2008 Nuno Lopes <nunoplopes@sapo.pt> remove debug-only assertion in the complex float evaluator as it makes some real apps crash

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60069 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
35873c49adad211ff466e34342a52665742794f5 24-Nov-2008 Anders Carlsson <andersca@mac.com> The address of a variable is only constant if the variable has global storage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59939 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
4bbc0e05a714d4ee4918a92a4a7049dd6ef33ad0 24-Nov-2008 Anders Carlsson <andersca@mac.com> Fix bug in the constant evaluator. Fixes PR3115.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59938 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
9d4c157baaada8945671dc98363a40ed00cbd824 22-Nov-2008 Anders Carlsson <andersca@mac.com> Return false if we encounter a type we can't handle.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59889 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
6dde0d5dc09f45f4d9508c964703e36fef1a0198 22-Nov-2008 Anders Carlsson <andersca@mac.com> Case values must be evaluated

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59884 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
51fe996231b1d7199f76e4005ff4c943d5deeecd 22-Nov-2008 Anders Carlsson <andersca@mac.com> Use Expr::Evaluate for case statements. Fixes PR2525

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59881 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
a468d34bed16861f25aff6c8354f4e75d3358c1a 19-Nov-2008 Nuno Lopes <nunoplopes@sapo.pt> fix folding of '*doubleArray'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59647 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
529569e68d10b0fd3750fd2124faf742249b846b 16-Nov-2008 Anders Carlsson <andersca@mac.com> Address some comments Eli had.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59430 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
a25bd55e63b9ab26ca69390533356aaae7f1a40e 16-Nov-2008 Nuno Lopes <nunoplopes@sapo.pt> use HandleConversionToBool() to check if a given cond is foldable (per Eli's comment)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59429 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
ccc3fce5697e33f005990f9795e1c7cb8b4559ec 16-Nov-2008 Anders Carlsson <andersca@mac.com> More complex float evaluator support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59428 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
6ee7aa154e8bbb21a21254293410b944f78b0bfe 16-Nov-2008 Chris Lattner <sabre@nondot.org> rename Expr::tryEvaluate to Expr::Evaluate.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59426 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
9ad16aebc0e840a5e7d425da72eb6cbe25e4b58c 16-Nov-2008 Anders Carlsson <andersca@mac.com> Add very limited support for evaluating complex floats.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59425 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f9ef0c675b12ab53fdd6c4e3e7226d066d293e99 16-Nov-2008 Nuno Lopes <nunoplopes@sapo.pt> fix folding of comma if given a non-constant operand.
Eli please take a look, as I'm not sure if this gets the extension warning in the right place

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59422 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
ca7c2eaca35edac066ab7cec15f7ecebbb3731d8 16-Nov-2008 Nuno Lopes <nunoplopes@sapo.pt> make IntExprEvaluator fold the ?: operator

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59421 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
3068d117951a8df54bae9db039b56201ab10962b 16-Nov-2008 Anders Carlsson <andersca@mac.com> More work on the constant evaluator. Eli, it would be great if you could have a look at this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59420 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
286f85e791dda3634fee7f6c67f0ed92296c028f 16-Nov-2008 Anders Carlsson <andersca@mac.com> Add the ability to evaluate comparison operators with floating point numbers as operands.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59408 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
a6afa768aa7bd3102a2807aa720917e4a1771e4e 13-Nov-2008 Eli Friedman <eli.friedman@gmail.com> Fix for crash issues with comma operators with a void first operand, and
some more bullet-proofing/enhancements for tryEvaluate. This shouldn't
cause any behavior changes except for handling cases where we were
crashing before and being able to evaluate a few more cases in tryEvaluate.

This should settle the minor mess surrounding r59196.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59224 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
b11e77836dd0867955c5abf32baf1c3e6c7f81e1 13-Nov-2008 Eli Friedman <eli.friedman@gmail.com> Backout of r59196, plus a new ICE test. Sorry if this is a
little rude; I figure it's cleaner to just back this out now so
it doesn't get forgotten or mixed up with other checkins.

The modification to isICE is simply wrong; I've added a test that the
change to isICE breaks.

I'm pretty sure the modification to tryEvaluate is also wrong.
At the very least, there's some serious miscommunication going on here,
as this is going in exactly the opposite direction of r59105. My
understanding is that tryEvaluate is not supposed to care about side
effects. That said, a lot of the clients to tryEvaluate are
expecting it to enforce a no-side-effects policy, so we probably need
another method that provides that guarantee.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59212 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
dd2b12a0329fee69ac2c26c2a3a355fb722e1e54 13-Nov-2008 Daniel Dunbar <daniel@zuster.org> Fix bug in constant evaluation exposed by 176.gcc.
- Evaluation of , operator used bogus assumption that LHS could be
evaluated as an integral expression even though its type is
unspecified.

This change is making isICE very permissive of the LHS in non-evaluated
contexts because it is not clear what predicate we would use to reject
code here. The standard didn't offer me any guidance; opinions?


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59196 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
8a7b7c6d4c96ace3667204bed4a48bad91b7c0f0 12-Nov-2008 Daniel Dunbar <daniel@zuster.org> Disable some debug prints.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59174 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
4efaa276bc0ce8f7baf6138ead11915f3e3e58d9 12-Nov-2008 Eli Friedman <eli.friedman@gmail.com> Some additions to tryEvaluate I've had sitting around for a while.
This pushes it a lot closer to being able to deal with most of the stuff
CodeGen's constant expression evaluator knows how to deal with. This
also fixes PR3003.

The test could possibly use some improvement, but this'll work for now.
Test 6 is inspired by PR3003; the other tests are mostly just designed
to exercise the new code. The reason for the funny structure of the
tests is that type fixing for arrays inside of structs is the only place
in Sema that calls tryEvaluate, at least for the moment.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59125 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
32fea9d18cc3658a1b01df5ca6f2ac302625c61d 12-Nov-2008 Chris Lattner <sabre@nondot.org> fix a crash analyzing constants in 176.gcc/expr.c with my next patch. It was
crashing because we errors are ignored in subexpressions that are not evaluated,
but we still evaluate the result of parents. This would cause an assertion
because the erroneous subexpr didn't have its result value set to the right type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59110 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
c8cc9ccc7b87a7ed1749b074f6b670bcec49abc1 12-Nov-2008 Chris Lattner <sabre@nondot.org> Teach the aggressive constant folder to fold X && 0 -> 0 and X || 1 -> 1


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59105 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
0518999d3adcc289997bd974dce90cc97f5c1c44 11-Nov-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Introduce a single AST node SizeOfAlignOfExpr for all sizeof and alignof expressions, both of values and types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59057 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
ac620decb68aad1a2cf6c0c191b56d78981d9aaa 24-Oct-2008 Daniel Dunbar <daniel@zuster.org> PR2919: __builtin_types_compatible_p strips CRV qualifiers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58079 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
5db4b3f3ed9f769d5b02c1d1ccc52bfd71fb9afb 16-Oct-2008 Daniel Dunbar <daniel@zuster.org> Teach tryEvaluate that fabs, copysign, and unary +/- are constants for
floats.
- With testcase, which also has some other things GCC folds but we
don't commented out in it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57624 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
7cbed03c00e246682e5292785d01e1c120ce54bd 14-Oct-2008 Daniel Dunbar <daniel@zuster.org> Fix test suite regression, getFloatTypeSemantics shouldn't be called
on non-float types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57477 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
ee5a700af3fe9ae1a639c271f093f40677dddc04 10-Oct-2008 Dale Johannesen <dalej@apple.com> Adjust calls to APFloat conversion for new interface.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57332 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
7cecee8da98e86cf7118d15a0f198b98956089a7 06-Oct-2008 Chris Lattner <sabre@nondot.org> ExprConstant should not abort when it sees a pointer constant that isn't.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57162 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
45b6b9d080ac56917337d73d8f1cd6374b27b05d 06-Oct-2008 Chris Lattner <sabre@nondot.org> Add a Expr::isEvaluatable method, eliminate isBuiltinConstantExpr
which is checking for something that can be inconsistent with
what we can constant fold.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57159 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
a4d55d89c8076b402bb168e3edeef0c2cd2a78c3 06-Oct-2008 Chris Lattner <sabre@nondot.org> Move folding of __builtin_classify_type out of the CallExpr
interface into the constant folding interface.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57158 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
9e62171a25e3a08fb5c49fb370f83faf5ae786f5 06-Oct-2008 Chris Lattner <sabre@nondot.org> Move handling of __builtin_nan("") out of CGBuiltin.cpp into ExprConstant.cpp



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57157 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
34a74ab81600a40c6324fd76adb724b803dfaf91 06-Oct-2008 Chris Lattner <sabre@nondot.org> Teach FloatExprEvaluator to evaluate __builtin_huge_val and inf.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57154 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
019f4e858e78587f2241ff1a76c747d7bcd7578c 06-Oct-2008 Chris Lattner <sabre@nondot.org> Add a comment that describes tryEvaluate. Make tryEvaluate fold
__builtin_constant_p properly, and add some scaffolding for
FloatExprEvaluator to eventually handle huge_val and inf.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57152 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
d8bfe7f25a695ca947effbccdf9ecbe3e018e221 22-Aug-2008 Eli Friedman <eli.friedman@gmail.com> Initial implementation of floats in Expr::tryEvaluate; this doesn't
implement some things, like unary operators and casts, but it's enough
to fix PR2703 as filed.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55155 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
0835a3cdeefe714b4959d31127ea155e56393125 19-Aug-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add ExplicitCastExpr to replace the current CastExpr, and have ImplicitCastExpr and ExplicitCastExpr derive from a common base class (CastExpr):

Expr
-> CastExpr
-> ExplicitCastExpr
-> ImplicitCastExpr

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54955 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
acc5f3e42334525bf28c86471551f83dfce222d5 11-Aug-2008 Daniel Dunbar <daniel@zuster.org> More #include cleaning
- 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54632 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
165a70fd0b75a4f23456531824e1b76a9f1c4f9c 10-Aug-2008 Anders Carlsson <andersca@mac.com> Remove the old evaluator code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54615 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
2eb0ddc1baaee173ea0dccf2a4edef48638b902d 10-Aug-2008 Eli Friedman <eli.friedman@gmail.com> Turn on the new constant expression evaluator; it isn't
anywhere near complete, but I don't know of any issues, and it can
handle enough to allow removing the I-C-E pointer cast hack.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54597 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
d9f4bcda18bfbf79341edd9d381d4b6a3cffe655 27-Jul-2008 Eli Friedman <eli.friedman@gmail.com> Minor tweak plus a couple of FIXMEs.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54119 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
732b2236ae4a4f11e7642677cebbd169c07ea877 12-Jul-2008 Chris Lattner <sabre@nondot.org> expand casts to handle what isIntegerConstantExpr handles.
Casts from pointers remain a problem. :)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53501 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
4c4867e140327fa3b56306fa03c64c8e6a7c95ef 12-Jul-2008 Chris Lattner <sabre@nondot.org> Add support for __builtin_type_compatible_p, enums, etc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53500 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
54176fdb044312b4b77c3da6682d3575b3728d30 12-Jul-2008 Chris Lattner <sabre@nondot.org> start remembering diagnostics for various cases, add some missing
code. Switch to Eli's getIntWidth method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53499 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
87eae5ecf94e38baa20d9a327b8f73f8bdc72436 12-Jul-2008 Chris Lattner <sabre@nondot.org> Provide a structure for passing down 'is evaluated' and passing up
diagnosic+loc info for i-c-e evaluation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53490 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
75a4881047deeb3a300ff9293dc6ba8570048bb5 12-Jul-2008 Chris Lattner <sabre@nondot.org> simplify some code a bit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53477 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
fcee0019b76f9f368f2b3d6d4048a98232593f29 11-Jul-2008 Chris Lattner <sabre@nondot.org> share code between sizeof(expr) and sizeof(type)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53475 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
ac7cb603979a0e5a6a216ccbd20eee7647c96b54 11-Jul-2008 Chris Lattner <sabre@nondot.org> implement support for __extension__, make sure the result of a
comparison has the right width.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53469 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
7a76778e218da57a3b10c80066a0a938f28987b6 11-Jul-2008 Chris Lattner <sabre@nondot.org> add a new getIntTypeSizeInBits method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53468 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
cf0f51d10f01065bd7bc3ffe77e18c30dcbdbea3 11-Jul-2008 Chris Lattner <sabre@nondot.org> rename "SInt" methods to "Int" in APValue.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53467 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
b542afe02d317411d53b3541946f9f2a8f509a11 11-Jul-2008 Chris Lattner <sabre@nondot.org> make the new evaluator avoid conversions APValue<->APSInt in some cases.
Add some accessors to APValue.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53465 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
f5eeb055ecbadbc25c83df0867cdada2c2559dcf 11-Jul-2008 Chris Lattner <sabre@nondot.org> rearrange some code, no functionality changes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53463 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
559e56b3a201316ae0b7e7389879a8054f6a3a82 08-Jul-2008 Anders Carlsson <andersca@mac.com> Fix small bug. The evaluator now works well enough to pass all tests

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53238 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
650c92fdcc27a950a8a848ecab6a74e6f5e80788 08-Jul-2008 Anders Carlsson <andersca@mac.com> More constant expression work.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53235 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
a25ae3d68d84d2b89907f998df6a396549589da5 08-Jul-2008 Anders Carlsson <andersca@mac.com> Move out some methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53234 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
2bad1687fe6f00e10767a691a33b070b151902b6 08-Jul-2008 Anders Carlsson <andersca@mac.com> More work.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53233 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
0fe52e1bcaa69ba127f1bda036f057fec1f478de 08-Jul-2008 Seo Sanghyeon <sanxiyn@gmail.com> Compilation fix

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53222 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
06a3675627e3b3c47b49c689c8e404a33144194a 08-Jul-2008 Anders Carlsson <andersca@mac.com> Port more of Eli's evaluator over. This makes the int evaluator handle binary and unary operators.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53221 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
c754aa62643e66ab967ca32ae8b0b3fc419bba25 08-Jul-2008 Anders Carlsson <andersca@mac.com> Commit beginnings of int evaluator. Currently not used.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53219 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp
c44eec6dd29ee9415cbd38a35deff4c8b67abb6a 03-Jul-2008 Anders Carlsson <andersca@mac.com> Shuffle things around in preparation for integrating Eli's constant evaluator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53074 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/AST/ExprConstant.cpp