summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Test for virtual instead of pure here. It has the exact same effect, and JohnNick Lewycky2013-02-051-1/+1
| | | | | | claims it will improve performance. llvm-svn: 174341
* PR15095: Use more correct source locations for the InitListExpr we fake up forRichard Smith2013-02-051-3/+8
| | | | | | vector initialization. Patch by John Stratton! llvm-svn: 174339
* Add some missing diagnostics for C++11 narrowing conversions.Richard Smith2013-02-051-2/+3
| | | | llvm-svn: 174337
* PR15132: Replace "address expression must be an lvalue or a functionRichard Smith2013-02-021-6/+7
| | | | | | | | | | | | | | designator" diagnostic with more correct and more human-friendly "cannot take address of rvalue of type 'T'". For the case of & &T::f, provide a custom diagnostic, rather than unhelpfully saying "cannot take address of rvalue of type '<overloaded function type>'". For the case of &array_temporary, treat it just like a class temporary (including allowing it as an extension); the existing diagnostic wording for the class temporary case works fine. llvm-svn: 174262
* This patch makes "&Cls::purevfn" not an odr use. This isn't what the standardNick Lewycky2013-02-021-15/+28
| | | | | | | | | says, but that's a defect (to be filed). "Cls::purevfn()" is still an odr use. Also fixes a bug that caused us to not mark the function referenced just because we didn't want to mark it odr used. llvm-svn: 174242
* objc: Provide correct fixit instruction when two mismatchedFariborz Jahanian2013-02-011-2/+3
| | | | | | nsstringis are compared without. // rdar://12716301 llvm-svn: 174214
* Fix PR14881 by implementing conversion rules between int and complex int.Bill Schmidt2013-02-011-54/+68
| | | | | | | | | | | | | | Prior to the patch, Clang does not properly promote types when a complex integer operand is combined with an integer via a binary operator, or when one is assigned to the other in either order. This patch detects when promotion is needed (and permissible) and generates the necessary code. The test assmes no target has the same size operands for "char" and "long long," and that no target performs arithmetic on char operands without extending them to a larger format first. If there are any targets for which this is not the case, they should be XFAILed. llvm-svn: 174181
* Add a new -Wundefined-inline warning for inline functions which are used but notNick Lewycky2013-02-011-4/+8
| | | | | | defined. Fixes PR14993! llvm-svn: 174158
* Fix grammar in comment.Nick Lewycky2013-01-311-1/+1
| | | | llvm-svn: 174033
* Fix ODR-use of a MemberExpr to check before marking a pure function used. RemoveNick Lewycky2013-01-311-2/+12
| | | | | | a workaround for this bug from the -Wundefined-internals warning. llvm-svn: 174020
* Hoist retrieval of Expr* into caller. No functionality change.Ted Kremenek2013-01-301-6/+6
| | | | | | Just makes the code a little cleaner, and easier to reason about. llvm-svn: 173953
* Also promote fp16 types to double when they're anonymous variadic arguments.Tim Northover2013-01-301-4/+8
| | | | | | | | __fp16 isn't covered by the standard, but this resolves the oddity that float gets promoted when passed variadically, but not the smaller type. This is required by the AArch64 ABI, and a sane action elsewhere. llvm-svn: 173918
* Micro cleanup: use an array of const char, rather than an array of char, as theRichard Smith2013-01-231-1/+1
| | | | | | | type of the string literal implicitly used for a raw user-defined literal call. No test; this has no semantic impact. llvm-svn: 173309
* Add a new LangOpt NativeHalfType. This option allows for native half/fp16Joey Gouly2013-01-231-4/+17
| | | | | | | | operations (as opposed to storage only half/fp16). Also add some semantic checks for OpenCL half types. llvm-svn: 173254
* Add -Wunsequenced (with compatibility alias -Wsequence-point) to warn onRichard Smith2013-01-171-1/+1
| | | | | | | expressions which have undefined behavior due to multiple unsequenced modifications or an unsequenced modification and use of a variable. llvm-svn: 172690
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-1/+1
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* put back diagnostics when flexible members are capturedFariborz Jahanian2013-01-091-1/+4
| | | | | | in lambdas. llvm-svn: 171921
* Fix typo (again).Fariborz Jahanian2013-01-081-1/+1
| | | | llvm-svn: 171917
* Remove lambda from my last patch.Fariborz Jahanian2013-01-081-4/+1
| | | | llvm-svn: 171915
* Fixes typo in comment.Fariborz Jahanian2013-01-081-1/+1
| | | | llvm-svn: 171913
* objectiveC blocks: It is impractical to capture Fariborz Jahanian2013-01-081-1/+16
| | | | | | | | struct variables with flexiable array members in blocks (and lambdas). Issue error instead of crashing in IRGen. // rdar://12655829 llvm-svn: 171912
* Move loop variable update.Rafael Espindola2013-01-081-2/+1
| | | | | | Thanks to Dmitri Gribenko for the suggestion. llvm-svn: 171889
* Mark all subsequent decls used.Rafael Espindola2013-01-081-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | In the source static void f(); static void f(); template<typename T> static void g() { f(); } static void f() { } void h() { g<int>(); } the call to f refers to the second decl, but it is only marked used at the end of the translation unit during instantiation, after the third f decl has been linked in. With this patch we mark all subsequent decls used, so that it is easy to check if a symbol is used or not. llvm-svn: 171888
* Don't warn about undefined varargs argument behavior in unreachable code.Ted Kremenek2013-01-081-5/+5
| | | | | | Fixes <rdar://problem/12322000>. llvm-svn: 171831
* Scalar shifts in the OpenCL specification (as of v. 1.2) are defined to beDavid Tweed2013-01-071-0/+5
| | | | | | | | | | 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
* s/CXX0X/CXX11/g, except for __GNU_EXPERIMENTAL_CXX0X__, and update a few ↵Richard Smith2013-01-021-1/+1
| | | | | | nearby 'C++0x' comments. llvm-svn: 171372
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-021-9/+9
| | | | llvm-svn: 171367
* Improve diagnostic wording for when an implicitly-deleted special memberRichard Smith2012-12-281-6/+0
| | | | | | function is selected by overload resolution. llvm-svn: 171190
* Tweak Sema::CheckLiteralKind() to also include block literalsTed Kremenek2012-12-211-0/+3
| | | | | | | This simplifies some diagnostic logic in checkUnsafeAssignLiteral(), hopefully making it less error prone. llvm-svn: 170945
* Change checkUnsafeAssignLiteral() to use the new Sema::CheckLiteralKind().Ted Kremenek2012-12-211-1/+1
| | | | | | | | | | Along the way, fix a bug in CheckLiteralKind(), previously in diagnoseObjCLiteralComparison, where we didn't ignore parentheses in boxed expressions for purpose of classification. In other words, both @42 and @(42) should be classified as numeric literals. llvm-svn: 170931
* Hoist logic for classifying Objective-C literals into Sema (proper) for use ↵Ted Kremenek2012-12-211-52/+45
| | | | | | | | with other diagnostics. No immediate (intended) functionality change. llvm-svn: 170930
* Remove duplicate includes.Roman Divacky2012-12-211-1/+0
| | | | llvm-svn: 170903
* Fix regression in r170489: when instantiating a direct initializer which is aRichard Smith2012-12-211-1/+0
| | | | | | | | CXXScalarValueInitExpr (or an ImplicitValueInitExpr), strip it back down to an empty pair of parentheses so that the initialization code can tell that we're performing value-initialization. llvm-svn: 170867
* Sema: Don't emit a warning when __func__ is used in a lambda outside of a ↵Benjamin Kramer2012-12-061-2/+8
| | | | | | | | function. Fixes PR14518. llvm-svn: 169510
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-8/+8
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Fix the determination of whether a capture refers to an enclosingDouglas Gregor2012-12-011-3/+4
| | | | | | scope when dealing with nested blocks. Fixes <rdar://problem/12778708>. llvm-svn: 169065
* Merge function types in C.Rafael Espindola2012-11-291-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Among other differences, GCC accepts typedef int IA[]; typedef int A10[10]; static A10 *f(void); static IA *f(void); void g(void) { (void)sizeof(*f()); } but clang used to reject it with: invalid application of 'sizeof' to an incomplete type 'IA' (aka 'int []') The intention of c99's 6.2.7 seems to be that we should use the composite type and accept as gcc does. Doing the type merging required some extra fixes: * Use the type from the function type in initializations, even if an parameter is available. * Fix the merging of the noreturn attribute in function types. * Make CodeGen handle the fact that an parameter type can be different from the corresponding type in the function type. llvm-svn: 168895
* Reject uses of __int128 on platforms that don't support it. Also move the uglyRichard Smith2012-11-291-2/+6
| | | | | | | 'getPointerWidth(0) >= 64' test to be a method on TargetInfo, ready to be properly cleaned up. llvm-svn: 168856
* objective-C arc: load of a __weak object happens via call toFariborz Jahanian2012-11-271-0/+6
| | | | | | | | | | | objc_loadWeak. This retains and autorelease the weakly-refereced object. This hidden autorelease sometimes makes __weak variable alive even after the weak reference is erased, because the object is still referenced by an autorelease pool. This patch overcomes this behavior by loading a weak object via call to objc_loadWeakRetained(), followng it by objc_release at appropriate place, thereby removing the hidden autorelease. // rdar://10849570 llvm-svn: 168740
* A step towards sorting out handling of triviality of special members in C++11.Richard Smith2012-11-161-6/+6
| | | | | | | | | | | | | | Separate out the notions of 'has a trivial special member' and 'has a non-trivial special member', and use them appropriately. These are not opposites of one another (there might be no special member, or in C++11 there might be a trivial one and a non-trivial one). The CXXRecordDecl predicates continue to produce incorrect results, but do so in fewer cases now, and they document the cases where they might be wrong. No functionality changes are intended here (they will come when the predicates start producing the right answers...). llvm-svn: 168119
* Fix DiagnoseBitwisePrecedence so it doesn't cast "-1" to the typeEli Friedman2012-11-151-24/+16
| | | | | | | | | BinaryOperator::Opcode. This is bad form, and the behavior of the static_cast in this case is unspecified according to the standard. Fixes a warning that showed up from r167992 on self-host. llvm-svn: 168010
* s/tranform/transform/Benjamin Kramer2012-11-141-3/+3
| | | | llvm-svn: 167929
* Accept and pass arguments to __unknown_anytype in argumentJohn McCall2012-11-141-0/+16
| | | | | | | | | | | | | | | | | | | | | positions of Objective-C methods. It is possible to recover a lot of type information about Objective-C methods from the reflective metadata for their implementations. This information is not rich when it comes to struct types, however, and it is not possible to produce a type in the debugger's round-tripped AST which will really do anything useful during type-checking. Therefore we allow __unknown_anytype in these positions, which essentially disables type-checking for that argument. We infer the parameter type to be the unqualified type of the argument expression unless that expression is an explicit cast, in which case it becomes the type-as-written of that cast. rdar://problem/12565338 llvm-svn: 167896
* -Wobjc-literal-compare: look through implicit casts.Jordan Rose2012-11-091-1/+2
| | | | | | | | | This warning was failing to fire under ARC because of the implicit lifetime casts added around the object literal expression. <rdar://problem/11300873>, again. llvm-svn: 167648
* PR11851 (and duplicates): Whenever a constexpr function is referenced,Richard Smith2012-11-071-9/+38
| | | | | | | | | instantiate it if it can be instantiated and implicitly define it if it can be implicitly defined. This matches g++'s approach. Remove some cases from SemaOverload which were marking functions as referenced when just planning how overload resolution would proceed; such cases are not actually references. llvm-svn: 167514
* When rebuilding a DependentScopeDeclRefExpr, perform a lookup into the scopeRichard Smith2012-10-231-2/+6
| | | | | | even if it's dependent, in case it now names a member of the current instantiation. llvm-svn: 166496
* Unrevert r166268, reverted in r166272, with a fix for the issue which NickRichard Smith2012-10-211-2/+12
| | | | | | | | | | | | | | | | | | | | | found: if an overloaded operator& is present before a template definition, the expression &T::foo is represented as a CXXOperatorCallExpr, not as a UnaryOperator, so we didn't notice that it's permitted to reference a non-static data member of an unrelated class. While investigating this, I discovered another problem in this area: we are treating template default arguments as unevaluated contexts during substitution, resulting in performing incorrect checks for uses of non-static data members in C++11. That is not fixed by this patch (I'll look into this soon; it's related to the failure to correctly instantiate constexpr function templates), but was resulting in this bug not firing in C++11 mode (except with -Wc++98-compat). Original message: PR14124: When performing template instantiation of a qualified-id outside of a class, diagnose if the qualified-id instantiates to a non-static class member. llvm-svn: 166385
* Fix __builtin_va_arg assertion failure in ARM AAPCS.Logan Chien2012-10-201-0/+10
| | | | llvm-svn: 166369
* DR1472: A reference isn't odr-used if it has preceding initialization,Richard Smith2012-10-201-9/+10
| | | | | | | | | initialized by a reference constant expression. Our odr-use modeling still needs work here: we don't yet implement the 'set of potential results of an expression' DR. llvm-svn: 166361
* Clarify wording of -Wshift-op-parentheses.David Blaikie2012-10-191-5/+5
| | | | | | Suggestion from Matt Beaumont-Gay reviewing r165283. llvm-svn: 166296
OpenPOWER on IntegriCloud