| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
| |
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.
llvm-svn: 171755
|
|
|
|
| |
llvm-svn: 171367
|
|
|
|
| |
llvm-svn: 171192
|
|
|
|
| |
llvm-svn: 171191
|
|
|
|
| |
llvm-svn: 169095
|
|
|
|
|
|
| |
expressions, not *any* typeid on a polymorphic class type.
llvm-svn: 166156
|
|
|
|
|
|
|
| |
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.
llvm-svn: 165362
|
|
|
|
|
|
| |
Part of PR14005.
llvm-svn: 165117
|
|
|
|
|
|
| |
in core constant expressions, despite not being a literal type.
llvm-svn: 164968
|
|
|
|
|
|
| |
Tijl Coosemans!
llvm-svn: 164841
|
|
|
|
|
|
|
| |
parameter packs where the reference is not being expanded but the pack has
been. Previously, Clang would segfault in such cases.
llvm-svn: 163672
|
|
|
|
|
|
|
|
|
| |
(__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.
llvm-svn: 162962
|
|
|
|
|
|
|
|
|
|
|
| |
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.
llvm-svn: 162850
|
|
|
|
|
|
|
| |
VisitVarDecl should return Error(E), and we should test that the address
of a TLS var can't be used as a constexpr.
llvm-svn: 162837
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
llvm-svn: 162835
|
|
|
|
|
|
|
|
|
| |
"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.
llvm-svn: 162468
|
|
|
|
|
|
| |
evaluated into a CXXTypeid member function. No functionality change.
llvm-svn: 161779
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
llvm-svn: 161388
|
|
|
|
|
|
|
| |
resulting in issuance of unused static variable
warning now. // rdar://10777111
llvm-svn: 161291
|
|
|
|
|
|
|
|
| |
nullptr.
Fixes PR13413, -Wunused-private-field now warns on unused fields initialized to NULL.
llvm-svn: 160541
|
|
|
|
|
|
| |
constant evaluation. <rdar://problem/11874571>.
llvm-svn: 160394
|
|
|
|
|
|
| |
This fixes a bug in __builtin_object_size() codegen
llvm-svn: 160191
|
|
|
|
|
|
|
| |
value-initialization for an array of class type with a trivial default
constructor.
llvm-svn: 160024
|
|
|
|
|
|
|
|
| |
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).
llvm-svn: 159904
|
|
|
|
| |
llvm-svn: 159224
|
|
|
|
|
|
|
|
|
|
| |
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).
llvm-svn: 159189
|
|
|
|
|
|
| |
references to values in these maps. PR13197.
llvm-svn: 159161
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
llvm-svn: 158104
|
|
|
|
|
|
|
|
| |
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.
llvm-svn: 157310
|
|
|
|
|
|
|
| |
test for an invalid declaration at every single place in the
constant evaluator that's about to request a struct layout.
llvm-svn: 155868
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
filter_decl_iterator had a weird mismatch where both op* and op-> returned T*
making it difficult to generalize this filtering behavior into a reusable
library of any kind.
This change errs on the side of value, making op-> return T* and op* return
T&.
(reviewed by Richard Smith)
llvm-svn: 155808
|
|
|
|
|
|
| |
evaluate certain expressions involving invalidly-defined classes.
llvm-svn: 155645
|
|
|
|
| |
llvm-svn: 155082
|
|
|
|
|
|
| |
constant-folding relational comparisons safely in case the user is using -fwrapv or equivalent.
llvm-svn: 154849
|
|
|
|
|
|
| |
uncommon cases. <rdar://problem/10962435>.
llvm-svn: 154794
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 { };
llvm-svn: 154790
|
|
|
|
|
|
|
|
|
| |
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).
llvm-svn: 154756
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
__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.
llvm-svn: 154640
|
|
|
|
|
|
|
|
|
| |
<stdatomic.h> header.
In passing, fix LanguageExtensions to note that C11 and C++11 are no longer
"upcoming standards" but are now actually standardized.
llvm-svn: 154513
|
|
|
|
|
|
| |
converting from std::nullptr_t, the subexpression might have side-effects.
llvm-svn: 154278
|
|
|
|
|
|
|
| |
template parameters of pointer, pointer-to-member, or nullptr_t
type in C++11. Fixes PR9700 / <rdar://problem/11193097>.
llvm-svn: 154219
|
|
|
|
|
|
|
|
| |
don't
evaluate RHS if LHS could not be evaluated and keepEvaluatingAfterFailure() is false.
llvm-svn: 153235
|
|
|
|
|
|
|
|
|
|
|
| |
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.
llvm-svn: 153226
|
|
|
|
|
|
|
|
|
|
|
| |
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.
llvm-svn: 152819
|
|
|
|
| |
llvm-svn: 152818
|
|
|
|
|
|
|
|
| |
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.
llvm-svn: 152775
|
|
|
|
|
|
| |
computing expr source...", it breaks bootstrap.
llvm-svn: 152772
|
|
|
|
|
|
|
|
|
|
| |
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.
llvm-svn: 152761
|
|
|
|
|
|
| |
constant expressions.
llvm-svn: 152665
|
|
|
|
|
|
|
|
|
|
| |
(Lex to AST).
The member variable is always "LangOpts" and the member function is always "getLangOpts".
Reviewed by Chris Lattner
llvm-svn: 152536
|