summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaChecking.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Port memory barriers intrinsics to AArch64Yi Kong2014-07-171-1/+12
| | | | | | | | | | | | | Memory barrier __builtin_arm_[dmb, dsb, isb] intrinsics are required to implement their corresponding ACLE and MSVC intrinsics. This patch ports ARM dmb, dsb, isb intrinsic to AArch64. Requires LLVM r213247. Differential Revision: http://reviews.llvm.org/D4521 llvm-svn: 213250
* Consolidate header inclusion diagnosticsAlp Toker2014-07-111-3/+4
| | | | | | | Make argument orders match, unify diagnostic IDs and reword the message to be a little less saccharine. llvm-svn: 212845
* [ARM] Implement ISB memory barrier intrinsicYi Kong2014-07-031-3/+4
| | | | | | | Adds support for __builtin_arm_isb. Also corrects DSB and ISB instructions modelling by adding has-side-effects property. llvm-svn: 212277
* ARM: add support for v8 ldaex/stlex builtins.Tim Northover2014-07-021-4/+14
| | | | | | | | | | | | | | ARMv8 adds (to both AArch32 and AArch64) acquiring and releasing variants of the exclusive operations, in line with the C++11 memory model. This adds support for two new intrinsics to expose them to C & C++ developers directly: __builtin_arm_ldaex and __builtin_arm_stlex, in direct analogy with the versions with no implicit barrier. rdar://problem/15885451 llvm-svn: 212175
* Prevent Clang from crashing on template code.Richard Trieu2014-07-021-1/+8
| | | | | | | | | | Fixes PR20110, where Clang hits an assertion failure when it expects that the sub-expression of a bit cast to pointer to also be a pointer, but gets a value instead. Differential Revision: http://reviews.llvm.org/D4280 llvm-svn: 212160
* Extend -Wtautological-undefined-compare and -Wundefined-bool-conversion toRichard Trieu2014-06-281-12/+46
| | | | | | | trigger on taking the address of a reference that is returned from a function call. llvm-svn: 211989
* Extend -Wdynamic-class-memaccess to records containing dynamic classesReid Kleckner2014-06-271-12/+33
| | | | | | | | | | Reviewers: rtrieu Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4325 llvm-svn: 211972
* Convert an llvm_unreachable in an 'else' block to a removal of the 'if' and ↵Craig Topper2014-06-181-3/+3
| | | | | | an assertion of its condition. Suggestion from David Blaikie. llvm-svn: 211142
* Replace some assert(0)'s with llvm_unreachable.Craig Topper2014-06-181-1/+1
| | | | llvm-svn: 211139
* Hide the concept of diagnostic levels from lex, parse and semaAlp Toker2014-06-151-12/+6
| | | | | | | | | | | | | | | | The compilation pipeline doesn't actually need to know about the high-level concept of diagnostic mappings, and hiding the final computed level presents several simplifications and other potential benefits. The only exceptions are opportunistic checks to see whether expensive code paths can be avoided for diagnostics that are guaranteed to be ignored at a certain SourceLocation. This commit formalizes that invariant by introducing and using DiagnosticsEngine::isIgnored() in place of individual level checks throughout lex, parse and sema. llvm-svn: 211005
* Objective-C ARC. Blocks that strongly capture themselvesFariborz Jahanian2014-06-121-3/+20
| | | | | | | | | | | to call themselves will get the warning: "Capturing <itself> strongly in this block is likely to lead to a retain cycle". Cut down on the amount of noise by noticing that user at some point sets the captured variable to null in order to release it (and break the cycle). // rdar://16944538 llvm-svn: 210823
* Removing an "if (this == nullptr)" check from two print methods. The conditionRichard Trieu2014-06-091-0/+2
| | | | | | | will never be true in a well-defined context. The checking for null pointers has been moved into the caller logic so it does not rely on undefined behavior. llvm-svn: 210498
* Add -Wtautological-undefined-compare and -Wundefined-bool-conversion warningsRichard Trieu2014-06-061-2/+14
| | | | | | to detect underfined behavior involving pointers. llvm-svn: 210372
* Add __builtin_operator_new and __builtin_operator_delete, which act like callsRichard Smith2014-06-031-1/+15
| | | | | | | to the normal non-placement ::operator new and ::operator delete, but allow optimizations like new-expressions and delete-expressions do. llvm-svn: 210137
* Format strings: check against an enum's underlying type.Jordan Rose2014-05-311-11/+18
| | | | | | | | | | | | | This allows us to be more careful when dealing with enums whose fixed underlying type requires special handling in a format string, like NSInteger. A refinement of r163266 from a year and a half ago, which added the special handling for NSInteger and friends in the first place. <rdar://problem/16616623> llvm-svn: 209966
* Refactoring. Remove Owned method from Sema.Nikola Smiljanic2014-05-291-9/+8
| | | | llvm-svn: 209812
* Refactoring. Remove release and take methods from ActionResult. Rename ↵Nikola Smiljanic2014-05-291-7/+7
| | | | | | takeAs to getAs. llvm-svn: 209800
* [C++11] Use 'nullptr'. Sema edition.Craig Topper2014-05-261-54/+55
| | | | llvm-svn: 209613
* AArch64/ARM64: rename ARM64 components to AArch64Tim Northover2014-05-241-7/+7
| | | | | | This keeps Clang consistent with backend naming conventions. llvm-svn: 209579
* AArch64/ARM64: update Clang after AArch64 removal.Tim Northover2014-05-241-13/+2
| | | | | | | | | | | A few (mostly CodeGen) parts of Clang were tightly coupled to the AArch64 backend. Now that it's gone, they will not even compile. I've also deduplicated RUN lines in many of the AArch64 tests. This might improve "make check-all" time noticably: some of those NEON tests were monsters. llvm-svn: 209578
* Tweak diagnostic wording for init list narrowingAlp Toker2014-05-171-2/+2
| | | | | | | | | The conventional form is '<action> to silence this warning'. Also call the diagnostic an 'issue' rather than a 'message' because the latter term is more widely used with reference to message expressions. llvm-svn: 209052
* Fix a bunch of mislayered clang/Lex includes from SemaAlp Toker2014-05-031-20/+14
| | | | llvm-svn: 207896
* Updated the attribute tablegen emitter for variadic arguments to emit a ↵Aaron Ballman2014-05-021-5/+2
| | | | | | range accessor in addition to the iterators. Updated code using iterators to use range-based for loops. llvm-svn: 207837
* [ARM64] Add arm64_be where it was accidentally missed from a bunch of ↵James Molloy2014-04-301-0/+1
| | | | | | | | | if-conditions. I think this is the last commit for ARM64 big endian in clang. This commit makes arm_neon.h compile correctly. llvm-svn: 207624
* Sema: Factor out argument range checks for builtin functionsRichard Sandiford2014-04-161-109/+19
| | | | | | No behavioural change intended. llvm-svn: 206364
* Make -Wabsolute-value C++-aware.Richard Trieu2014-04-151-43/+104
| | | | | | | | Warn on std::abs() with unsigned argument. Suggest std::abs as replacement for the C absolute value functions. Suggest C++ headers if the specific std::abs overload is not found. llvm-svn: 206340
* Revert r205646 (keeping the test in its modified form) asFariborz Jahanian2014-04-071-10/+1
| | | | | | it is subsumed by r205521. llvm-svn: 205718
* Vector [Sema]. Vector "splats" which are truncated should have a warningFariborz Jahanian2014-04-041-1/+10
| | | | | | with -Wconversion. // rdar://16502418 llvm-svn: 205646
* Extend -Wtautological-constant-out-of-range-compare to handle boolean valuesRichard Trieu2014-04-041-74/+167
| | | | | | | | | | | | | | | better. This warning will now trigger on the following conditionals: bool b; int i; if (b > 1) {} // always false if (0 <= (i > 5)) {} // always true if (-1 > b) {} // always false Patch by Per Viberg. llvm-svn: 205608
* Improved semantics for implicit scalar -> extvector conversions.Stephen Canon2014-04-031-0/+2
| | | | llvm-svn: 205521
* ARM64: initial clang support commit.Tim Northover2014-03-291-12/+40
| | | | | | | | | | | This adds Clang support for the ARM64 backend. There are definitely still some rough edges, so please bring up any issues you see with this patch. As with the LLVM commit though, we think it'll be more useful for merging with AArch64 from within the tree. llvm-svn: 205100
* Add ARM big endian Target (armeb, thumbeb)Christian Pirker2014-03-281-0/+2
| | | | | | Reviewed at http://llvm-reviews.chandlerc.com/D3096 llvm-svn: 205008
* -fms-extensions: Add __va_start builtin, which is used for x64Reid Kleckner2014-03-261-0/+1
| | | | | | | | | | The main difference between __va_start and __builtin_va_start is that the address of the va_list has already been taken, and the va_list is always a char*. __va_end and __va_arg are not needed. llvm-svn: 204821
* remove a bunch of unused private methodsNuno Lopes2014-03-231-3/+0
| | | | | | | | | | | | | | | | | | found with a smarter version of -Wunused-member-function that I'm playwing with. Appologies in advance if I removed someone's WIP code. ARCMigrate/TransProperties.cpp | 8 ----- AST/MicrosoftMangle.cpp | 1 Analysis/AnalysisDeclContext.cpp | 5 --- Analysis/LiveVariables.cpp | 14 ---------- Index/USRGeneration.cpp | 10 ------- Sema/Sema.cpp | 33 +++++++++++++++++++++--- Sema/SemaChecking.cpp | 3 -- Sema/SemaDecl.cpp | 20 ++------------ StaticAnalyzer/Checkers/GenericTaintChecker.cpp | 1 9 files changed, 34 insertions(+), 61 deletions(-) llvm-svn: 204561
* scanf format checking: include the buffer length in the fix-it for %s.Jordan Rose2014-03-201-2/+3
| | | | | | Patch by Zach Davis! llvm-svn: 204300
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-121-21/+22
| | | | | | class. llvm-svn: 203640
* Sema: demote invalid atomic ordering message to warning.Tim Northover2014-03-111-3/+3
| | | | | | | | | | | | | | Someone could write: if (0) { __c11_atomic_load(ptr, memory_order_release); } or the equivalent, which is perfectly valid, so we shouldn't outright reject invalid orderings on purely static grounds. rdar://problem/16242991 llvm-svn: 203564
* Sema: produce error when invalid ordering is passed to atomic builtinTim Northover2014-03-111-1/+37
| | | | | | | | | This is a conservative check, because it's valid for the expression to be non-constant, and in cases like that we just don't know whether it's valid. rdar://problem/16242991 llvm-svn: 203561
* [C++11] Replacing DeclBase iterators specific_attr_begin() and ↵Aaron Ballman2014-03-101-20/+6
| | | | | | specific_attr_end() with iterator_range specific_attrs(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203474
* Remove trailing whitespace.Bob Wilson2014-03-091-1/+1
| | | | llvm-svn: 203422
* [C++11] Replacing RecordDecl iterators field_begin() and field_end() with ↵Aaron Ballman2014-03-081-9/+4
| | | | | | iterator_range fields(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203355
* Zap another dead 'break' statement.Ted Kremenek2014-03-071-1/+0
| | | | llvm-svn: 203282
* Suppress diagnostics during name lookup for absolute value type.Richard Trieu2014-03-061-0/+1
| | | | llvm-svn: 203061
* Move private classes into anonymous namespaces.Benjamin Kramer2014-03-011-1/+1
| | | | llvm-svn: 202595
* Add a -Wclass-varargs to warn on objects of any class type being passed ↵Richard Smith2014-02-281-6/+21
| | | | | | | | | | | | through an ellipsis. Since C++11 relaxed the rules on this, we allow a lot more bad code through silently, such as: const char *format = "%s"; std::experimental::string_view view = "foo"; printf(format, view); In this case, not only warn about a class type being used here, but also suggest that calling c_str() might be a good idea. llvm-svn: 202461
* PR16074, implement warnings to catch pointer to boolean true and pointer toRichard Trieu2014-02-261-29/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | null comparison when the pointer is known to be non-null. This catches the array to pointer decay, function to pointer decay and address of variables. This does not catch address of function since this has been previously used to silence a warning. Pointer to bool conversion is under -Wbool-conversion. Pointer to null comparison is under -Wtautological-pointer-compare, a sub-group of -Wtautological-compare. void foo() { int arr[5]; int x; // warn on these conditionals if (foo); if (arr); if (&x); if (foo == null); if (arr == null); if (&x == null); if (&foo); // no warning } llvm-svn: 202216
* Add -Wabsolute-value, warnings about absolute value functions.Richard Trieu2014-02-261-0/+325
| | | | | | | | | | | | | | | | | | The warnings fall into three groups. 1) Using an absolute value function of the wrong type, for instance, using the int absolute value function when the argument is a floating point type. 2) Using the improper sized absolute value function, for instance, using abs when the argument is a long long. llabs should be used instead. From these two cases, an implicit conversion will occur which may cause unexpected behavior. Where possible, suggest the proper absolute value function to use, and which header to include if the function is not available. 3) Taking the absolute value of an unsigned value. In addition to this warning, suggest to remove the function call. This usually indicates a logic error since the programmer assumed negative values would have been possible. llvm-svn: 202211
* Add AArch64 big endian Target (aarch64_be)Christian Pirker2014-02-251-0/+1
| | | | llvm-svn: 202151
* [AArch64] Change int64_t from 'long long int' to 'long int' for AArch64 target.Kevin Qin2014-02-241-2/+6
| | | | | | | | | | Most 64-bit targets define int64_t as long int, and AArch64 should make same definition to follow LP64 model. In GNU tool chain, int64_t is defined as long int for 64-bit target. So to get consistent with GNU, it's better Changing int64_t from 'long long int' to 'long int', otherwise clang will get different name mangling suffix compared with g++. llvm-svn: 202004
* Sema: Simplify away one-iteration loops.Benjamin Kramer2014-02-231-14/+5
| | | | | | No functionality change. llvm-svn: 201981
OpenPOWER on IntegriCloud