summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaChecking.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Switched FormatAttr to using an IdentifierArgument instead of a ↵Aaron Ballman2013-09-031-1/+1
| | | | | | StringArgument since that is a more accurate modeling. llvm-svn: 189851
* Adjust clang for change to APFloat::toString.Eli Friedman2013-08-291-1/+9
| | | | | | | | 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. llvm-svn: 189625
* Use pop_back_val() instead of both back() and pop_back().Robert Wilhelm2013-08-231-2/+1
| | | | | | No functionality change intended. llvm-svn: 189112
* Split isFromMainFile into two functions.Eli Friedman2013-08-221-1/+1
| | | | | | | | | Basically, isInMainFile considers line markers, and isWrittenInMainFile doesn't. Distinguishing between the two is useful when dealing with files which are preprocessed files or rewritten with -frewrite-includes (so we don't, for example, print useless warnings). llvm-svn: 188968
* Omit llvm:: before SmallVector and SmallVectorImpl. We have using directive ↵Robert Wilhelm2013-08-101-13/+12
| | | | | | in include/clang/Basic/LLVM.h. llvm-svn: 188138
* Put back a microoptimization with a comment to make it more obvious.Benjamin Kramer2013-08-091-2/+5
| | | | llvm-svn: 188063
* Remove unused variable. No functionality change.Benjamin Kramer2013-08-081-8/+6
| | | | llvm-svn: 187975
* Implement C++'s restrictions on the type of an expression passed to a varargRichard Smith2013-08-051-73/+124
| | | | | | | | | | | | | function: it can't be 'void' and it can't be an initializer list. We give a hard error for these rather than treating them as undefined behavior (we can and probably should do the same for non-POD types in C++11, but as of this change we don't). Slightly rework the checking of variadic arguments in a function with a format attribute to ensure that certain kinds of format string problem (non-literal string, too many/too few arguments, ...) don't suppress this error. llvm-svn: 187735
* Add support for passing -1 to __builtin_shufflevector to signify an ↵Craig Topper2013-08-031-0/+4
| | | | | | undefined element value to match IR capabilities. llvm-svn: 187694
* Fix indentation. No functional change.Craig Topper2013-08-021-1/+1
| | | | llvm-svn: 187644
* AArch64: initial NEON supportTim Northover2013-08-011-0/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Patch by Ana Pazos - Completed implementation of instruction formats: AdvSIMD three same AdvSIMD modified immediate AdvSIMD scalar pairwise - Completed implementation of instruction classes (some of the instructions in these classes belong to yet unfinished instruction formats): Vector Arithmetic Vector Immediate Vector Pairwise Arithmetic - Initial implementation of instruction formats: AdvSIMD scalar two-reg misc AdvSIMD scalar three same - Intial implementation of instruction class: Scalar Arithmetic - Initial clang changes to support arm v8 intrinsics. Note: no clang changes for scalar intrinsics function name mangling yet. - Comprehensive test cases for added instructions To verify auto codegen, encoding, decoding, diagnosis, intrinsics. llvm-svn: 187568
* Return ExprError if both arguments to the mask form of ↵Craig Topper2013-07-291-13/+13
| | | | | | | | __builtin_shufflvector don't have the same number of elements or the mask isn't an integer vector. Previously a diagnostic was issued, but the code went ahead and built the ShuffleVectorExpr. While I'm here also simplify a couple lines by wrapping the return ExprError around the Diag calls. llvm-svn: 187344
* Fix up formatting. No functional change.Craig Topper2013-07-281-6/+6
| | | | llvm-svn: 187334
* Remove trailing whitespace.Craig Topper2013-07-191-5/+4
| | | | llvm-svn: 186652
* ARM: implement low-level intrinsics for the atomic exclusive operations.Tim Northover2013-07-161-0/+108
| | | | | | | | | | | | This adds three overloaded intrinsics to Clang: T __builtin_arm_ldrex(const volatile T *addr) int __builtin_arm_strex(T val, volatile T *addr) void __builtin_arm_clrex() The intent is that these do what users would expect when given most sensible types. Currently, "sensible" translates to ints, floats and pointers. llvm-svn: 186394
* Add a __builtin_addressof that performs the same functionality as the built-inRichard Smith2013-07-111-0/+20
| | | | | | | | | | | & 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. llvm-svn: 186053
* Fix Sema for compares with _Atomic vars.Eli Friedman2013-07-081-16/+19
| | | | | | | | | | | | | | | | Use UsualArithmeticConversions unconditionally in analysis of comparisons and conditional operators: the method performs the usual arithmetic conversions if both sides are arithmetic, and usual unary conversions if they are not. This is just a cleanup for conditional operators; for comparisons, it fixes the issue that we would try to check isArithmetic() on an atomic type. Also, fix GetExprRange() in SemaChecking.cpp so it deals with variables of atomic type correctly. Fixes PR15537. llvm-svn: 185857
* Remove some useless declarations (found by scan-build)Sylvestre Ledru2013-07-061-2/+1
| | | | llvm-svn: 185752
* Teach -Wunsequenced that the side-effects of a function evaluation are sequencedRichard Smith2013-06-301-4/+21
| | | | | | | | | before the value computation of the result. In C, this is implied by there being a sequence point after their evaluation, and in C++, it's implied by the side-effects being sequenced before the expressions and statements in the function body. llvm-svn: 185282
* PR16467: Teach -Wunsequenced that in C11 (unlike C++11), an assignment'sRichard Smith2013-06-261-5/+15
| | | | | | | | side-effect is not sequenced before its value computation. Also fix a mishandling of ?: expressions where the condition is constant that was exposed by the tests for this. llvm-svn: 185035
* [Sema] Call CheckParmForFunctionDef on ObjC method parametersReid Kleckner2013-06-241-1/+2
| | | | | | | CheckParmForFunctionDef performs standard checks for type completeness and other things like a destructor check for the MSVC++ ABI. llvm-svn: 184740
* Extend -Wnon-pod-varargs to more cases, such as function pointers as returnRichard Trieu2013-06-221-15/+37
| | | | | | types and function pointer arrays. llvm-svn: 184616
* Provide suggested no-arg calls for overloaded member functions missing callsDavid Blaikie2013-06-211-1/+1
| | | | | | Reviewed by Richard Smith. llvm-svn: 184612
* [ms-cxxabi] Destroy temporary record arguments in the calleeReid Kleckner2013-06-211-0/+9
| | | | | | | | | | | | | | | | | | Itanium destroys them in the caller at the end of the full expression, but MSVC destroys them in the callee. This is further complicated by the need to emit EH-only destructor cleanups in the caller. This should help clang compile MSVC's debug iterators more correctly. There is still an outstanding issue in PR5064 of a memcpy emitted by the LLVM backend, which is not correct for C++ records. Fixes PR16226. Reviewers: rjmccall Differential Revision: http://llvm-reviews.chandlerc.com/D929 llvm-svn: 184543
* Add back a condition accidentially removed in r184470.Richard Trieu2013-06-201-1/+1
| | | | llvm-svn: 184496
* Avoid repeatedly evaluating subexpressions when checking for unsequencedRichard Smith2013-06-201-7/+37
| | | | | | | operations in the case where evaluating a subexpression fails. No functionality change, but test/Sema/many-logical-ops.c gets ~100x faster with this change. llvm-svn: 184489
* Extend -Wnon-pod-varargs to check calls made from function pointers.Richard Trieu2013-06-201-5/+11
| | | | llvm-svn: 184470
* Correctly compute the index of the first string format argument when decidingEli Friedman2013-06-181-1/+1
| | | | | | whether to emit a -Wformat-security warning. <rdar://problem/14178260>. llvm-svn: 184214
* Revert "Properly consider the range of enum for range comparisons in C mode"David Majnemer2013-06-071-14/+11
| | | | | | The approach r183084 took was wrong, back it out. llvm-svn: 183575
* Properly consider the range of enum for range comparisons in C modeDavid Majnemer2013-06-021-11/+14
| | | | | | | | | In some cases, clang applies the C++ rules for computing the range of a value when said value is an enum. Instead, apply C semantics when in C mode. llvm-svn: 183084
* Patch to issue error when target of MacOS and iOS Fariborz Jahanian2013-05-281-3/+11
| | | | | | | does not support large load/store of atomic objects. // rdar://13973577 llvm-svn: 182781
* Warn on va_start() when called with a reference parameter.Nico Weber2013-05-241-0/+14
| | | | | | | | | http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1905.pdf 18.7p3 explicitly calls this (and some other things) out as undefined. Also move 2 other existing warnings behind the new -Wvarargs flag. llvm-svn: 182694
* Objective-C: More cases of -Wsign-conversion notFariborz Jahanian2013-05-151-3/+5
| | | | | | | working on new Objective-C array subscripting syntax. // rdar://13855682 llvm-svn: 181940
* Objective-C: patch to issue the conversionFariborz Jahanian2013-05-151-1/+7
| | | | | | | warning when property-dot syntax is used with -Wsign-conversion. // rdar://13855394 llvm-svn: 181914
* Grab-bag of bit-field fixes:John McCall2013-05-061-2/+2
| | | | | | | | | | | | | | - References to ObjC bit-field ivars are bit-field lvalues; fixes rdar://13794269, which got me started down this. - Introduce Expr::refersToBitField, switch a couple users to it where semantically important, and comment the difference between this and the existing API. - Discourage Expr::getBitField by making it a bit longer and less general-sounding. - Lock down on const_casts of bit-field gl-values until we hear back from the committee as to whether they're allowed. llvm-svn: 181252
* ArrayRef'ize Sema::CheckObjCMethodCallDmitri Gribenko2013-05-051-3/+2
| | | | | | Patch by Robert Wilhelm. llvm-svn: 181164
* Replace ArrayRef<T>() with None, now that we have an implicit ArrayRef ↵Dmitri Gribenko2013-05-051-2/+2
| | | | | | | | constructor from None Patch by Robert Wilhelm. llvm-svn: 181139
* c language: diagnose use of "[*]" on any array dimensionFariborz Jahanian2013-04-291-1/+3
| | | | | | | | in the parameter of a function definition. Currently, it crashes in irgen if it is on other than the 1st dimension. // rdar://13705391 llvm-svn: 180732
* Handle "typeof" in Objective-C format string checking. This previously crashed.Ted Kremenek2013-04-101-0/+4
| | | | | | | | Yes, this came from actual code. Fixes <rdar://problem/13557053>. llvm-svn: 179155
* Revert r178273 as it broke the Linux bootstrap due to false positivesTimur Iskhodzhanov2013-03-291-119/+16
| | | | llvm-svn: 178320
* Implemented a warning when an input several bitwise operations areSam Panzer2013-03-281-16/+119
| | | | | | | | | | | likely be implicitly truncated: * All forms of Bitwise-and, bitwise-or, and integer multiplication. * The assignment form of integer addition, subtraction, and exclusive-or * The RHS of the comma operator * The LHS of left shifts. llvm-svn: 178273
* For printf checking, handle nested typedefs for darwin-specific checking.Ted Kremenek2013-03-251-1/+5
| | | | | | Fixes <rdar://problem/13491605>. llvm-svn: 177931
* Simplify print logic, per feedback from Jordan Rose.Ted Kremenek2013-03-151-1/+1
| | | | llvm-svn: 177193
* Enhance -Wtautological-constant-out-of-range-compare to include the name of ↵Ted Kremenek2013-03-151-2/+15
| | | | | | | | the enum constant. This is QoI. Fixes <rdar://problem/13076064>. llvm-svn: 177190
* c: perform integer overflow check on all binaryFariborz Jahanian2013-03-151-12/+1
| | | | | | operations. // rdar://13423975 llvm-svn: 177181
* c: Also chek for integer overflow for '%' operator.Fariborz Jahanian2013-03-151-2/+10
| | | | llvm-svn: 177163
* c: add the missing binary operatory when checkingFariborz Jahanian2013-03-151-1/+1
| | | | | | for integer overflow. // rdar://13423975 llvm-svn: 177162
* Add TagDecl::hasNameForLinkage(), which is true if the tagJohn McCall2013-03-091-4/+2
| | | | | | is non-anonymous or is defined in a typedef of itself. llvm-svn: 176742
* Fix typos: [Dd]iagnosic -> [Dd]iagnosticStefanus Du Toit2013-03-011-1/+1
| | | | | | These all appear in comments or (ironically) diagnostics output. llvm-svn: 176383
* Include llvm::Optional in clang/Basic/LLVM.hDavid Blaikie2013-02-201-3/+3
| | | | | | Post-commit CR feedback from Jordan Rose regarding r175594. llvm-svn: 175679
OpenPOWER on IntegriCloud