| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For memset (and others) we can get diagnostics like:
struct stat { int x; };
void foo(struct stat *stamps) {
bzero(stamps, sizeof(stamps));
memset(stamps, 0, sizeof(stamps));
}
t.c:7:28: warning: 'memset' call operates on objects of type 'struct stat' while the size is based on a different type 'struct stat *' [-Wsizeof-pointer-memaccess]
memset(stamps, 0, sizeof(stamps));
~~~~~~ ^~~~~~
t.c:7:28: note: did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?
memset(stamps, 0, sizeof(stamps));
^~~~~~
This patch implements the same class of warnings for bzero.
Differential Revision: https://reviews.llvm.org/D22525
rdar://problem/18963514
llvm-svn: 277787
|
|
|
|
|
|
| |
Thanks to Simon Pilgrim for catching the mistake.
llvm-svn: 276564
|
|
|
|
|
|
|
|
|
|
| |
target throw an error if used on 32-bit target.
If these builtins are allowed to go through on a 32-bit target they will fire assertions in the backend.
Fixes PR28635.
llvm-svn: 276250
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In atomic builtins, we assumed that the LValue conversion on the first
argument would succeed. So, we would crash given code like:
```
void ovl(char);
void ovl(int);
__atomic_store_n(ovl, 0, 0);
```
This patch makes us not assume that said conversion is successful. :)
llvm-svn: 276232
|
|
|
|
|
|
|
|
|
|
| |
Summary: Removed unused headers, replaced some headers with forward class declarations
Patch by: Eugene <claprix@yandex.ru>
Differential Revision: https://reviews.llvm.org/D20100
llvm-svn: 275882
|
|
|
|
|
|
| |
This change has triggered unexpected failures.
llvm-svn: 275462
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch implements PR#22821.
Taking the address of a packed member is dangerous since the reduced
alignment of the pointee is lost. This can lead to memory alignment
faults in some architectures if the pointer value is dereferenced.
This change adds a new warning to clang emitted when taking the address
of a packed member. A packed member is either a field/data member
declared as attribute((packed)) or belonging to a struct/class
declared as such. The associated flag is -Waddress-of-packed-member.
Conversions (either implicit or via a valid casting) to pointer types
with lower or equal alignment requirements (e.g. void* or char*)
silence the warning.
This change also adds a new error diagnostic when the user attempts to
bind a reference to a packed member, regardless of the alignment.
Differential Revision: https://reviews.llvm.org/D20561
llvm-svn: 275417
|
|
|
|
|
|
| |
__builtin_shufflevector.
llvm-svn: 275018
|
|
|
|
|
|
| |
and don't have custom handling in CGBuiltins.cpp either.
llvm-svn: 274825
|
|
|
|
|
|
| |
different allocation units otherwise.
llvm-svn: 274654
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
s6.13.17.
- Added new Builtins: enqueue_kernel, get_kernel_work_group_size
and get_kernel_preferred_work_group_size_multiple.
These Builtins use custom check to diagnose parameters of the passed Blocks
i. e. variable number of 'local void*' type params, and check different
overloads specified in Table 6.31 of OpenCL v2.0.
- IR is generated as an internal library call for each OpenCL Builtin,
reusing ObjC Block implementation.
Review: http://reviews.llvm.org/D20249
llvm-svn: 274540
|
|
|
|
|
|
| |
unused in r274492 and r274502.
llvm-svn: 274516
|
|
|
|
|
|
|
|
|
|
| |
Currently we only have OpenCL 2.0 Builtins i.e. pipes or address space conversions.
They have to be added only in the version 2.0 compilation mode to make the identifiers
available for use in the other versions.
Review: http://reviews.llvm.org/D20249
llvm-svn: 274509
|
|
|
|
|
|
| |
native IR.
llvm-svn: 274425
|
|
|
|
|
|
| |
Differential Revision: http://reviews.llvm.org/D21836
llvm-svn: 274224
|
|
|
|
|
|
| |
No functional change is intended, just a small refactoring.
llvm-svn: 273650
|
|
|
|
|
|
| |
No functional change is intended, just a small refactoring.
llvm-svn: 273647
|
|
|
|
|
|
|
| |
No functional change is intended, this should just clean things up a
little.
llvm-svn: 273522
|
|
|
|
|
|
| |
No functionality change intended.
llvm-svn: 272789
|
|
|
|
|
|
| |
checked against null.
llvm-svn: 272755
|
|
|
|
|
|
| |
__builtin_shufflevector and __builtin_ia32_select.
llvm-svn: 272467
|
|
|
|
|
|
| |
directly with __builtin_shufflevector and __builtin_ia32_select. Also improve the formatting of the AVX2 version.
llvm-svn: 272452
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
OpenCL builtin functions to_{global|local|private} accepts argument of pointer type to arbitrary pointee type, and return a pointer to the same pointee type in different addr space, i.e.
global gentype *to_global(gentype *p);
It is not desirable to declare it as
global void *to_global(void *);
in opencl header file since it misses diagnostics.
This patch implements these builtin functions as Clang builtin functions. In the builtin def file they are defined to have signature void*(void*). When handling call expressions, their declarations are re-written to have correct parameter type and return type corresponding to the call argument.
In codegen call to addr void *to_addr(void*) is generated with addrcasts or bitcasts to facilitate implementation in builtin library.
Differential Revision: http://reviews.llvm.org/D19932
llvm-svn: 270261
|
|
|
|
|
|
|
|
| |
builtin_shufflevector form that it doesn't support. Remove CodeGen support for the same form since it could never have been used due to the missing support in Sema.
I couldn't find any documentation that this form existed either. Nor is there documentation for one of the remaining two forms, but there is a testcase that uses it.
llvm-svn: 269879
|
|
|
|
|
|
| |
This time allow -128 to 255 for builtins that use a char type immediate."
llvm-svn: 269878
|
|
|
|
|
|
| |
This reverts commit r269619.
llvm-svn: 269765
|
|
|
|
| |
llvm-svn: 269619
|
|
|
|
|
|
|
|
| |
undefined behavior, such as a parameter declared with the register keyword in C, or a parameter of a type that undergoes default argument promotion.
This helps cover some more of the CERT secure coding rule EXP58-CPP. Pass an object of the correct type to va_start (https://www.securecoding.cert.org/confluence/display/cplusplus/EXP58-CPP.+Pass+an+object+of+the+correct+type+to+va_start).
llvm-svn: 267338
|
|
|
|
|
|
|
| |
Remove the floating point to bool conversion warnings. Some of these
conversions will be caught by -Wliteral-conversion and -Wfloat-conversion
llvm-svn: 267234
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Restructure the implict floating point to integer conversions so that
interesting sub-groups are under different flags. Breakdown of warnings:
No warning:
Exact conversions from floating point to integer:
int x = 10.0;
int x = 1e10;
-Wliteral-conversion - Floating point literal to integer with rounding:
int x = 5.5;
int x = -3.4;
-Wfloat-conversion - All conversions not covered by the above two:
int x = GetFloat();
int x = 5.5 + 3.5;
-Wfloat-zero-conversion - The expression converted has a non-zero floating
point value that gets converted to a zero integer value, excluded the cases
falling under -Wliteral-conversion. Subset of -Wfloat-conversion.
int x = 1.0 / 2.0;
-Wfloat-overflow-conversion - The floating point value is outside the range
of the integer type, exluding cases from -Wliteral conversion. Subset of
-Wfloat-conversion.
char x = 500;
char x = -1000;
-Wfloat-bool-conversion - Any conversion of a floating point type to bool.
Subset of -Wfloat-conversion.
if (GetFloat()) {}
bool x = 5.0;
-Wfloat-bool-constant-conversion - Conversion of a compile time evaluatable
floating point value to bool. Subset of -Wfloat-bool-conversion.
bool x = 1.0;
bool x = 4.0 / 20.0;
Also add EvaluateAsFloat to Sema, which is similar to EvaluateAsInt, but for
floating point values.
llvm-svn: 267054
|
|
|
|
| |
llvm-svn: 266644
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This makes the C11 / C++11 *ABI* atomic ordering accessible from LLVM,
as discussed in http://reviews.llvm.org/D18200#inline-151433
This re-applies r266574 which I had reverted in r266575.
Depends on http://reviews.llvm.org/D18875
Original review: http://reviews.llvm.org/D18876
llvm-svn: 266641
|
|
|
|
|
|
|
|
| |
This reverts commit b0495df9eae2824bee830cc4c94f5441f0d4cbc9.
Same as for the corresponding LLVM revert, an assert seems to fire.
llvm-svn: 266575
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Depends on http://reviews.llvm.org/D18875
This makes the C11 / C++11 *ABI* atomic ordering accessible from LLVM, as discussed in http://reviews.llvm.org/D18200#inline-151433
Reviewers: jyknight, reames
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D18876
llvm-svn: 266574
|
|
|
|
|
|
|
|
| |
Although all the registers are actually 32-bits, I think we have to assume the
high 32-bits could be RES0 (the ARM ARM is unclear). If so, reading as a 32-bit
register can require extra zero extension operations.
llvm-svn: 266212
|
|
|
|
|
|
|
|
|
| |
This warning sometimes will infinitely recurse on CXXRecordDecl's from
ill-formed recursive classes that have fields of themselves. Skip processing
these classes to prevent this from happening.
Fixes https://llvm.org/bugs/show_bug.cgi?id=27142
llvm-svn: 264991
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
__atomic_load's allows it's first argument to be a pointer to a const type. However the second argument is an output parameter and must be a pointer to non-const.
This patch fixes the signature of __atomic_load generated by clang so that it respects the above requirements.
Reviewers: rsmith, majnemer
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D13420
llvm-svn: 264967
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
1. Diag should be output if types are not the same.
2. Should compare using canonical type.
3. Refine the diag to be more clear.
Reviewers: yaxunl, Anastasia
Subscribers: MatsPetersson, pekka.jaaskelainen, cfe-commits
Differential Revision: http://reviews.llvm.org/D17955
llvm-svn: 264825
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Improve invalid format string specifier handling by printing out
invalid specifiers characters with \x, \u and \U. Previously clang
would print gargabe whenever the character is unprintable.
Example, before:
NSLog(@"%\u25B9"); => warning: invalid conversion specifier ' [-Wformat-invalid-specifier]
after:
NSLog(@"%\u25B9"); => warning: invalid conversion specifier '\u25b9' [-Wformat-invalid-specifier]
Differential Revision: http://reviews.llvm.org/D18296
rdar://problem/24672159
llvm-svn: 264752
|
|
|
|
|
|
|
|
| |
r263299 added a fixit for the -Wformat-security warning, but that runs
into complications with our guideline that error recovery should be done
as-if the fixit had been applied. Putting the fixit on a note avoids that.
llvm-svn: 263584
|
|
|
|
| |
llvm-svn: 263299
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Refine the type builtin support as the request with
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160201/148637.html
Reviewers: pekka.jaaskelainen, Anastasia, yaxunl
Subscribers: rsmith, cfe-commits
Differential Revision: http://reviews.llvm.org/D16876
llvm-svn: 262692
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
The printf/scanf format checker is a little over-zealous in handling the conditional operator. This patch reduces work by not checking code-paths that are never used and reduces false positives regarding uncovered arguments, for example in the code fragment:
printf(minimal ? "%i\n" : "%i: %s\n", code, msg);
Reviewers: rtrieu
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D15636
llvm-svn: 262025
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
OpenCL access qualifiers are now not only used for image types, refine it to avoid misleading,
Add semacheck for OpenCL access qualifier as well as test caees.
Reviewers: pekka.jaaskelainen, Anastasia, aaron.ballman
Subscribers: aaron.ballman, cfe-commits
Differential Revision: http://reviews.llvm.org/D16040
llvm-svn: 261961
|
|
|
|
|
|
|
| |
No functionality change. Change at the request of Richard Trieu, see
http://reviews.llvm.org/D15636#357858.
llvm-svn: 261522
|
|
|
|
|
|
| |
Cleanup for upcoming Clang warning -Wcomma. No functionality change intended.
llvm-svn: 261271
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the case that the array indexing itself is within a type dependent context,
bail out of the evaluation. We would previously try to symbolically evaluate
the expression which would then try to evaluate a non-address expression as an
address, triggering an assertion in Asserts builds.
We only need to consider the array subscript expression itself as in the case
that the base itself being type dependent is handled appropriately in EvalAddr.
Resolves PR26599.
llvm-svn: 260867
|
|
|
|
|
|
|
| |
Propagate const throughout these methods as they are non-mutating analyzers of
state. NFC.
llvm-svn: 260864
|
|
|
|
|
|
|
|
|
|
| |
When a null constant is used in a macro, walk through the macro stack to
determine where the null constant is written and where the context is located.
Only warn if both locations are within the same macro expansion. This helps
function-like macros which involve pointers be treated as if they were
functions.
llvm-svn: 260776
|
|
|
|
|
|
|
|
| |
minor fixes.
Differential revision: http://reviews.llvm.org/D17218
llvm-svn: 260757
|