summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaCast.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add a new LangOpt NativeHalfType. This option allows for native half/fp16Joey Gouly2013-01-231-0/+15
| | | | | | | | operations (as opposed to storage only half/fp16). Also add some semantic checks for OpenCL half types. llvm-svn: 173254
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-021-2/+2
| | | | llvm-svn: 171367
* objc: DOn't complain if a (SEL) expression is typecastFariborz Jahanian2012-12-131-0/+2
| | | | | | to (SEL). Fixes // rdar://12859590 llvm-svn: 170058
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-3/+3
| | | | | | | | | | | | | 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
* Implement GCC's -Wint-to-pointer-cast.David Blaikie2012-10-161-0/+20
| | | | | | | | | | | | This implementation doesn't warn on anything that GCC doesn't warn on with the exception of templates specializations (GCC doesn't warn, Clang does). The specific skipped cases (boolean, constant expressions, enums) are open for debate/adjustment if anyone wants to demonstrate that GCC is being overly conservative here. The only really obvious false positive I found was in the Clang regression suite's MPI test - apparently MPI uses specific flag values in pointer constants. (eg: #define FOO (void*)~0) llvm-svn: 166039
* Now that ASTMultiPtr is nothing more than a array reference, make it a ↵Benjamin Kramer2012-08-231-2/+1
| | | | | | | | MutableArrayRef. This required changing all get() calls to data() and using the simpler constructors. llvm-svn: 162501
* Rip out remnants of move semantic emulation and smart pointers in Sema.Benjamin Kramer2012-08-231-3/+3
| | | | | | | These were nops for quite a while and only lead to confusion. ASTMultiPtr now behaves like a proper dumb array reference. llvm-svn: 162475
* c: implement gcc's -Wbad-function-cast which warnsFariborz Jahanian2012-08-171-1/+38
| | | | | | | on unsafe cast of a c-function call. This is a C-only option. llvm-svn: 162109
* objective-C: deprecate casts of ObjC's SELFariborz Jahanian2012-08-161-1/+19
| | | | | | | expressions except to void, void * and their qualified versions. // rdar://12107381 llvm-svn: 162036
* Add correct parenthesis range to CXXConstructExprs insideDaniel Jasper2012-07-161-0/+3
| | | | | | CXXFunctionalCastExprs. llvm-svn: 160252
* Fix Sema and IRGen for atomic compound assignment so it has the right ↵Eli Friedman2012-06-161-5/+1
| | | | | | | | semantics when promotions are involved. (As far as I can tell, this only affects some edge cases.) llvm-svn: 158591
* Detecting illegal instantiations of abstract types when using a ↵Aaron Ballman2012-05-071-1/+3
| | | | | | function-style cast. Fixed PR12658. llvm-svn: 156271
* Move Sema::RequireCompleteType() and Sema::RequireCompleteExprType()Douglas Gregor2012-05-041-6/+6
| | | | | | | | | | | off PartialDiagnostic. PartialDiagnostic is rather heavyweight for something that is in the critical path and is rarely used. So, switch over to an abstract-class-based callback mechanism that delays most of the work until a diagnostic is actually produced. Good for ~11k code size reduction in the compiler and 1% speedup in -fsyntax-only on the code in <rdar://problem/11004361>. llvm-svn: 156176
* PR9546, DR1268: A prvalue cannot be reinterpret_cast to an rvalue referenceRichard Smith2012-04-291-4/+3
| | | | | | type. But a glvalue can be reinterpret_cast to either flavor of reference. llvm-svn: 155789
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-12/+12
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Add clang support for new Objective-C literal syntax for NSDictionary, NSArray,Ted Kremenek2012-03-061-0/+2
| | | | | | | | | | | | | NSNumber, and boolean literals. This includes both Sema and Codegen support. Included is also support for new Objective-C container subscripting. My apologies for the large patch. It was very difficult to break apart. The patch introduces changes to the driver as well to cause clang to link in additional runtime support when needed to support the new language features. Docs are forthcoming to document the implementation and behavior of these features. llvm-svn: 152137
* ArrayRef'ize various functions in the AST/Parser/Sema.Ahmed Charles2012-02-251-1/+1
| | | | llvm-svn: 151447
* Split reinterpret_casts of member pointers out from CK_BitCast; thisJohn McCall2012-02-151-1/+2
| | | | | | | | | | | | | | | | | | | | | is general goodness because representations of member pointers are not always equivalent across member pointer types on all ABIs (even though this isn't really standard-endorsed). Take advantage of the new information to teach IR-generation how to do these reinterprets in constant initializers. Make sure this works when intermingled with hierarchy conversions (although this is not part of our motivating use case). Doing this in the constant-evaluator would probably have been better, but that would require a *lot* of extra structure in the representation of constant member pointers: you'd really have to track an arbitrary chain of hierarchy conversions and reinterpretations in order to get this right. Ultimately, this seems less complex. I also wasn't quite sure how to extend the constant evaluator to handle foldings that we don't actually want to treat as extended constant expressions. llvm-svn: 150551
* Don't route explicit construction via list-initialization through the ↵Sebastian Redl2012-02-131-13/+15
| | | | | | functional cast code path. It sometimes does the wrong thing, produces horrible error messages, and is just unnecessary. llvm-svn: 150408
* Proper initializer list support for new expressions and type construct ↵Sebastian Redl2012-02-121-23/+26
| | | | | | expressions. Array new still missing. llvm-svn: 150346
* Change the way we store initialization kinds so that all direct inits can ↵Sebastian Redl2012-02-121-5/+10
| | | | | | distinguish between list and parens form. This allows us to correctly diagnose the last test cases from litb. llvm-svn: 150343
* C++ 5.2.10p2 has a note that mentions that, subject to all other restrictions,Chad Rosier2012-02-031-12/+21
| | | | | | | | a cast to the same type is allowed so long as it does not cast away constness. Fix for PR11747. Patch by Aaron Ballman. Reviewed by Eli. llvm-svn: 149664
* Remove unreachable code in Clang. (replace with llvm_unreachable where ↵David Blaikie2012-01-171-3/+0
| | | | | | appropriate or when GCC requires it) llvm-svn: 148292
* Some improvements to the handling of C11 atomic types:David Chisnall2012-01-161-0/+5
| | | | | | | | | | | | | | | | | | - 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
* Fix some edge cases with C++ casts and placeholder expressions.Eli Friedman2012-01-121-12/+15
| | | | llvm-svn: 147984
* Revert r145244. It causes us to create broken ASTs with missing type informationRichard Smith2011-11-291-67/+11
| | | | | | | | | | for some cast expressions. Original commit message: Removed useless ImplicitCast nodes in explicit cstyle and static casts llvm-svn: 145447
* Removed useless ImplicitCast nodes in explicit cstyle and static castsNicola Gigante2011-11-281-11/+67
| | | | llvm-svn: 145244
* Fixed a cut&paste error introduced in r141336.Abramo Bagnara2011-11-151-1/+1
| | | | llvm-svn: 144637
* Add missing lvalue-to-rvalue conversion.Eli Friedman2011-10-311-0/+6
| | | | llvm-svn: 143364
* -Wc++98-compat and -Wc++98-compat-pedantic warnings for Sema, part 1.Richard Smith2011-10-181-4/+8
| | | | llvm-svn: 142419
* Teach the ARC compiler to not require __bridge casts whenJohn McCall2011-10-171-44/+50
| | | | | | | passing/receiving CF objects at +0 to/from Objective-C methods or audited C functions. llvm-svn: 142219
* Add a helper function for determining whether an expressionJohn McCall2011-10-171-1/+1
| | | | | | has placeholder type. llvm-svn: 142203
* Catch placeholder types in DefaultLvalueConversionJohn McCall2011-10-111-20/+24
| | | | | | | | | | | and DefaultFunctionArrayLvalueConversion. To prevent significant regression for should-this-be-a-call fixits, and to repair some such regression from the introduction of bound member placeholders, make those placeholder checks try to build calls appropriately. Harden the build-a-call logic while we're at it. llvm-svn: 141738
* Rename SemaCXXCast.cpp to SemaCast.cpp.John McCall2011-10-111-0/+2065
llvm-svn: 141686
OpenPOWER on IntegriCloud