summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Expr.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Pacify gcc's -Wreturn-type.Matt Beaumont-Gay2012-01-311-0/+1
| | | | | | | A separate unreachable message will make it easier to debug if either of the unreachables is reached. llvm-svn: 149402
* Clean up switch in Expr::CanThrow. No functional change.Eli Friedman2012-01-311-22/+75
| | | | llvm-svn: 149321
* Added source location for the template keyword in AST template-id expressions.Abramo Bagnara2012-01-271-21/+36
| | | | llvm-svn: 149127
* More dead code removal (using -Wunreachable-code)David Blaikie2012-01-201-7/+4
| | | | llvm-svn: 148577
* Remove unnecessary default cases in switches over enums.David Blaikie2012-01-171-1/+1
| | | | | | This allows -Wswitch-enum to find switches that need updating when these enums are modified. llvm-svn: 148281
* Some improvements to the handling of C11 atomic types:David Chisnall2012-01-161-0/+18
| | | | | | | | | | | | | | | | | | - Add atomic-to/from-nonatomic cast types - Emit atomic operations for arithmetic on atomic types - Emit non-atomic stores for initialisation of atomic types, but atomic stores and loads for every other store / load - Add a __atomic_init() intrinsic which does a non-atomic store to an _Atomic() type. This is needed for the corresponding C11 stdatomic.h function. - Enables the relevant __has_feature() checks. The feature isn't 100% complete yet, but it's done enough that we want people testing it. Still to do: - Make the arithmetic operations on atomic types (e.g. Atomic(int) foo = 1; foo++;) use the correct LLVM intrinsic if one exists, not a loop with a cmpxchg. - Add a signal fence builtin - Properly set the fenv state in atomic operations on floating point values - Correctly handle things like _Atomic(_Complex double) which are too large for an atomic cmpxchg on some platforms (this requires working out what 'correctly' means in this context) - Fix the many remaining corner cases llvm-svn: 148242
* If an ObjCMessageExpr is implicit, there are no source locations for theArgyrios Kyrtzidis2012-01-121-3/+5
| | | | | | | | selector identifiers. It was difficult to form a test case for it unfortunately. llvm-svn: 148053
* Add IsImplicit field in ObjCMessageExpr that is true when the messageArgyrios Kyrtzidis2012-01-121-19/+45
| | | | | | | | | | was constructed, e.g. for a property access. This allows the selector identifier locations machinery for ObjCMessageExpr to function correctly, in that there are not real locations to handle/report for such a message. llvm-svn: 148013
* Add field IsIEEE in FloatingLiteral to distinguish between different 128-bitAkira Hatanaka2012-01-101-1/+1
| | | | | | floating point formats. llvm-svn: 147887
* Revert r147664; it's breaking clang regression tests.Eli Friedman2012-01-061-2/+2
| | | | llvm-svn: 147681
* Silence GCC warnings.Jakub Staszak2012-01-061-2/+2
| | | | llvm-svn: 147664
* Add an APValue representation for the difference between two ↵Eli Friedman2012-01-041-27/+0
| | | | | | | | | | address-of-label expressions. Add support to Evaluate and CGExprConstant for generating/handling them. Remove the special-case for such differences in Expr::isConstantInitializer. With that done, remove a bunch of buggy code from CGExprConstant for handling scalar expressions which is no longer necessary. Fixes PR11705. llvm-svn: 147561
* Fix a case where Expr::isConstantInitializer would return true for an ↵Eli Friedman2011-12-211-9/+22
| | | | | | expression we can't support. In a slightly amusing twist, the case in question was already in the clang regression tests marked as a valid construct. <rdar://problem/10020074> llvm-svn: 147026
* Teach isConstantInitializer that numeric literals are constants, rather thanRichard Smith2011-12-091-0/+2
| | | | | | | having it evaluate them. No change in functionality, but a speed up of about 5% on some translation units in SPEC 445.gobmk. llvm-svn: 146248
* Move vector bitcast handling in constant expressions from the expressionRichard Smith2011-12-061-9/+13
| | | | | | | | | | | | | evaluator into constant initializer handling / IRGen. The practical consequence of this is that the bitcast now lives in the constant's definition, rather than in its uses. The code in the constant expression evaluator was producing vectors of the wrong type and size (and possibly of the wrong value for a big-endian int-to-vector bitcast). We were getting away with this only because we don't yet support constant-folding of any expressions which inspect vector values. llvm-svn: 145981
* Constant expression evaluation: support for evaluation of structs and unions ofRichard Smith2011-11-101-10/+15
| | | | | | | literal types, as well as derived-to-base casts for lvalues and derived-to-virtual-base casts. llvm-svn: 144265
* Fix a cluster of related issues involving value-dependence and constantRichard Smith2011-11-081-8/+15
| | | | | | | | | | | | | | expression evaluation: - When folding a non-value-dependent expression, we may try to use the initializer of a value-dependent variable. If that happens, give up. - In C++98, actually check that a const, non-volatile DeclRefExpr inside an ICE is of integral or enumeration type (a reference isn't OK!) - In C++11, DeclRefExprs for objects of const literal type initialized with value-dependent expressions are themselves value-dependent. - So are references initialized with value-dependent expressions (though this case is missing from the C++11 standard, along with many others). llvm-svn: 144056
* Rip out CK_GetObjCProperty.John McCall2011-11-071-3/+0
| | | | llvm-svn: 143910
* Change the AST representation of operations on Objective-CJohn McCall2011-11-061-0/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | property references to use a new PseudoObjectExpr expression which pairs a syntactic form of the expression with a set of semantic expressions implementing it. This should significantly reduce the complexity required elsewhere in the compiler to deal with these kinds of expressions (e.g. IR generation's special l-value kind, the static analyzer's Message abstraction), at the lower cost of specifically dealing with the odd AST structure of these expressions. It should also greatly simplify efforts to implement similar language features in the future, most notably Managed C++'s properties and indexed properties. Most of the effort here is in dealing with the various clients of the AST. I've gone ahead and simplified the ObjC rewriter's use of properties; other clients, like IR-gen and the static analyzer, have all the old complexity *and* all the new complexity, at least temporarily. Many thanks to Ted for writing and advising on the necessary changes to the static analyzer. I've xfailed a small diagnostics regression in the static analyzer at Ted's request. llvm-svn: 143867
* Fix the representation of wide strings in the AST and IR so that it uses the ↵Eli Friedman2011-11-011-13/+62
| | | | | | | | | | native representation of integers for the elements. This fixes a bunch of nastiness involving treating wide strings as a series of bytes. Patch by Seth Cantrell. llvm-svn: 143417
* Don't try to set the "array filler" in a InitListExpr twice.Argyrios Kyrtzidis2011-10-211-0/+1
| | | | llvm-svn: 142695
* Macro metaprogramming for builtin types.John McCall2011-10-181-1/+1
| | | | llvm-svn: 142420
* Add template instantiation support for AtomicExpr.Eli Friedman2011-10-141-0/+21
| | | | llvm-svn: 142012
* Change operator<< for raw_ostream and NamedDecl to take a reference instead ↵Benjamin Kramer2011-10-141-1/+1
| | | | | | | | of a pointer. Passing a pointer was a bad idea as it collides with the overload for void*. llvm-svn: 141971
* Initial implementation of __atomic_* (everything except __atomic_is_lock_free).Eli Friedman2011-10-111-0/+1
| | | | llvm-svn: 141632
* Constant expression evaluation refactoring:Richard Smith2011-10-101-1/+1
| | | | | | | | | | | - Remodel Expr::EvaluateAsInt to behave like the other EvaluateAs* functions, and add Expr::EvaluateKnownConstInt to capture the current fold-or-assert behaviour. - Factor out evaluation of bitfield bit widths. - Fix a few places which would evaluate an expression twice: once to determine whether it is a constant expression, then again to get the value. llvm-svn: 141561
* Another case of HadMultipleCandidates being used uninitialized.Benjamin Kramer2011-10-101-1/+2
| | | | llvm-svn: 141532
* Move field in ObjCMessageExpr to avoid padding.Argyrios Kyrtzidis2011-10-031-6/+6
| | | | llvm-svn: 140988
* Allow getting all source locations of selector identifiers in a ObjCMessageExpr.Argyrios Kyrtzidis2011-10-031-43/+62
| | | | | | | | | | | | | Instead of always storing all source locations for the selector identifiers we check whether all the identifiers are in a "standard" position; "standard" position is -Immediately before the arguments: [foo first:1 second:2] -With a space between the arguments: [foo first: 1 second: 2] -For nullary selectors, immediately before ']': [foo release] In such cases we infer the locations instead of storing them. llvm-svn: 140987
* ArrayRef'ize ObjCMessageExprArgyrios Kyrtzidis2011-10-031-19/+19
| | | | llvm-svn: 140986
* Add an assertion that we don't overflow the bitfield ObjCMessageExpr::NumArgs.Argyrios Kyrtzidis2011-10-031-3/+6
| | | | llvm-svn: 140985
* Pass all the locations of the selector identifiers for a message expression ↵Argyrios Kyrtzidis2011-10-031-7/+9
| | | | | | | | from the parser. They are not kept in the AST yet. llvm-svn: 140982
* Removing a bunch of dead returns/breaks after llvm_unreachables.David Blaikie2011-09-231-2/+0
| | | | llvm-svn: 140407
* objc-gc: Fix a corner case where clang fails to generate GC Fariborz Jahanian2011-09-231-1/+8
| | | | | | write barrier with captured pointer to object. // rdar://10150823 llvm-svn: 140399
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-4/+4
| | | | llvm-svn: 140367
* Don't use TemplateArgumentListInfo inside AST nodes because it may leak.Argyrios Kyrtzidis2011-09-221-51/+0
| | | | | | Use ASTTemplateArgumentListInfo instead. llvm-svn: 140331
* Rename ExplicitTemplateArgumentList -> ASTTemplateArgumentListInfo, no ↵Argyrios Kyrtzidis2011-09-221-9/+9
| | | | | | functionality change. llvm-svn: 140330
* Fix a QoI bug with overloaded operators inside macros.Matt Beaumont-Gay2011-09-191-1/+4
| | | | | | | | We were failing to set source locations and ranges in isUnusedResultAWarning for CXXOperatorCallExprs, leading to an "expression result unused" warning with absolutely no context if the expression was inside a macro. llvm-svn: 140036
* In general, don't look through explicit casts when tryingJohn McCall2011-09-131-1/+1
| | | | | | | | | to find the called declaration. Explicit casts can radically change the semantics of a call, and it's no longer really a builtin call any more than it would be a builtin call if you stored the function pointer into a variable and called that. llvm-svn: 139659
* Rename the ARC cast kinds to start with "ARC".John McCall2011-09-101-12/+12
| | | | llvm-svn: 139466
* When converting a block pointer to an Objective-C pointer type, extendJohn McCall2011-09-101-0/+3
| | | | | | | | | | | the lifetime of the block by copying it to the heap, or else we'll get a dangling reference because the code working with the non-block-typed object will not know it needs to copy. There is some danger here, e.g. with assigning a block literal to an unsafe variable, but, well, it's an unsafe variable. llvm-svn: 139451
* Give conversions of block pointers to ObjC pointers a different cast kindJohn McCall2011-09-091-2/+91
| | | | | | | | than conversions of C pointers to ObjC pointers. In order to ensure that we've caught every case, add asserts to CastExpr that strictly determine which cast kind is used for which kind of bit cast. llvm-svn: 139352
* Look through SubstNonTypeTemplateParmExpr nodes in the variousDouglas Gregor2011-09-081-1/+20
| | | | | | Expr::Ignore* methods that also look through implicit casts. llvm-svn: 139303
* When extracting the callee declaration from a call expression, be sureDouglas Gregor2011-09-061-0/+6
| | | | | | | | | | to look through SubstNonTypeTemplateParmExprs. Then, update the IR generation of CallExprs to actually use CallExpr::getCalleeDecl() rather than attempting to mimick its behavior (badly). Fixes <rdar://problem/10063539>. llvm-svn: 139185
* Whitelist operator== and operator!= as valid for unused value warnings,Chandler Carruth2011-08-171-1/+14
| | | | | | | | even when overloaded and user-defined. These operators are both more valuable to warn on (due to likely typos) and extremely unlikely to be reasonable for use to trigger side-effects. llvm-svn: 137823
* Add support for C++0x unicode string and character literals, from Craig Topper!Douglas Gregor2011-07-271-5/+4
| | | | llvm-svn: 136210
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-9/+9
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Silliness with commas, as reported at http://blog.regehr.org/archives/558 . ↵Eli Friedman2011-07-131-1/+5
| | | | | | As it turns out, this is my fault for not noticing this was an issue when I was looking at this a long time ago. :( llvm-svn: 135026
* In ARC, reclaim all return values of retainable type, not just thoseJohn McCall2011-07-071-0/+2
| | | | | | | | | | | | where we have an immediate need of a retained value. As an exception, don't do this when the call is made as the immediate operand of a __bridge retain. This is more in the way of a workaround than an actual guarantee, so it's acceptable to be brittle here. rdar://problem/9504800 llvm-svn: 134605
* Introduce the notion of instantiation dependence into Clang's AST. ADouglas Gregor2011-07-011-31/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | type/expression/template argument/etc. is instantiation-dependent if it somehow involves a template parameter, even if it doesn't meet the requirements for the more common kinds of dependence (dependent type, type-dependent expression, value-dependent expression). When we see an instantiation-dependent type, we know we always need to perform substitution into that instantiation-dependent type. This keeps us from short-circuiting evaluation in places where we shouldn't, and lets us properly implement C++0x [temp.type]p2. In theory, this would also allow us to properly mangle instantiation-dependent-but-not-dependent decltype types per the Itanium C++ ABI, but we aren't quite there because we still mangle based on the canonical type in cases like, e.g., template<unsigned> struct A { }; template<typename T> void f(A<sizeof(sizeof(decltype(T() + T())))>) { } template void f<int>(A<sizeof(sizeof(int))>); and therefore get the wrong answer. llvm-svn: 134225
OpenPOWER on IntegriCloud