summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Add an Extension warning for applying unary * to an operand of type 'void*' inRichard Smith2014-05-071-4/+13
| | | | | | | C++. This seems like a pointless (and indeed harmful) restriction to me, so I've suggested removing it to -core and disabled this diagnostic by default. llvm-svn: 208254
* Wrap a few lines at 80 columns, change a confusing indent. No behavior change.Nico Weber2014-05-031-8/+7
| | | | llvm-svn: 207921
* Fix a bunch of mislayered clang/Lex includes from SemaAlp Toker2014-05-031-2/+2
| | | | llvm-svn: 207896
* AST: Mangle reference temporaries reliablyDavid Majnemer2014-05-011-1/+1
| | | | | | | | | | | | | | | Summary: Previously, we would generate a single name for all reference temporaries and allow LLVM to rename them for us. Instead, number the reference temporaries as we build them in Sema. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3554 llvm-svn: 207776
* Objective-C. Improve diagnosis of bridging types.Fariborz Jahanian2014-04-291-0/+2
| | | | | | // rdar://16737117 llvm-svn: 207542
* [SemaCXX] Silence -Wconstant-logical-operand if the operand is a 0/1 from a ↵Argyrios Kyrtzidis2014-04-281-1/+2
| | | | | | | | | | | macro. Libraries specify enabled/disabled features using macro defs of 0/1, in such cases the -Wconstant-logical-operand is noise. rdar://15410291 llvm-svn: 207386
* [Sema] Adjust Sema::getCurBlock()/getCurLambda() to take into account that ↵Argyrios Kyrtzidis2014-04-261-1/+1
| | | | | | | | | | | we may have switch CurContext due to class template instantiation. Fixes crash of the included test case. rdar://16527205 llvm-svn: 207325
* Initial implementation of -modules-earch-all option, for searching for ↵John Thompson2014-04-231-2/+3
| | | | | | symbols in non-imported modules. llvm-svn: 206977
* Implement [over.match.oper]p3 properly, by filtering the non-candidates outRichard Smith2014-04-171-2/+3
| | | | | | | when building the candidate set, rather than trying to contort name lookup into handling this. llvm-svn: 206436
* Add support for MSVC's __FUNCSIG__Reid Kleckner2014-04-081-0/+1
| | | | | | | | | | | It is very similar to GCC's __PRETTY_FUNCTION__, except it prints the calling convention. Reviewers: majnemer Differential Revision: http://reviews.llvm.org/D3311 llvm-svn: 205780
* Try harder about not suggesting methods as corrections when theyKaelyn Takata2014-04-041-23/+16
| | | | | | | | obviously won't work. Specifically, don't suggest methods (static or not) from unrelated classes when the expression is a method call through a specific object. llvm-svn: 205653
* Improved semantics for implicit scalar -> extvector conversions.Stephen Canon2014-04-031-29/+34
| | | | llvm-svn: 205521
* -fms-compatibility: Only form implicit member exprs for unqualified idsReid Kleckner2014-03-251-5/+5
| | | | | | | | | If there are any scope specifiers, then a base class must be named or the symbol isn't from a base class. Fixes PR19233. llvm-svn: 204753
* [C++11] Replacing FunctionProtoType iterators param_type_begin() and ↵Aaron Ballman2014-03-171-7/+3
| | | | | | param_type_end() with iterator_range param_types(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 204045
* Add two missing entries to the C++11 support page. Bump one relevant diagnosticRichard Smith2014-03-141-1/+1
| | | | | | | | (for an integer too large for any signed type) from Warning to ExtWarn -- it's ill-formed in C++11 and C99 onwards, and UB during translation in C89 and C++98. Add diagnostic groups for two relevant diagnostics. llvm-svn: 203974
* [C++11] Replacing BlockDecl iterators capture_begin() and capture_end() with ↵Aaron Ballman2014-03-141-4/+2
| | | | | | iterator_range captures(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203958
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-121-19/+19
| | | | | | class. llvm-svn: 203640
* [C++11] Replacing RecordDecl iterators field_begin() and field_end() with ↵Aaron Ballman2014-03-081-6/+4
| | | | | | iterator_range fields(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203355
* Renaming the chains() ranged iterator to chain() per suggestion by Richard ↵Aaron Ballman2014-03-071-1/+1
| | | | | | Smith. llvm-svn: 203262
* [C++11] Replacing IndirectFieldDecl iterators chain_begin() and chain_end() ↵Aaron Ballman2014-03-071-5/+3
| | | | | | with iterator_range chains(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203261
* [C++11] Replacing BlockDecl iterators param_begin() and param_end() with ↵Aaron Ballman2014-03-071-6/+5
| | | | | | iterator_range params(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203250
* [C++11] Replacing iterators redecls_begin() and redecls_end() with ↵Aaron Ballman2014-03-061-6/+3
| | | | | | iterator_range redecls(). Updating all of the usages of the iterators with range-based for loops, which allows the begin/end forms to be removed entirely. llvm-svn: 203179
* C. Compare vector sizes using their raw element size instead ofFariborz Jahanian2014-03-061-42/+45
| | | | | | | | getTypeSize (which rounds up sizes) in order to issue diagnostics when casting to mismatched vector sizes; instead of crashing in IRGen. // rdar:// 16196902. Reviewed offline by John McCall. llvm-svn: 203175
* [C++11] Work around an incompatibility between llvm::tie and std::tie.Benjamin Kramer2014-03-021-2/+4
| | | | llvm-svn: 202643
* [C++11] Replace llvm::tie with std::tie.Benjamin Kramer2014-03-021-2/+2
| | | | llvm-svn: 202639
* Add a -Wclass-varargs to warn on objects of any class type being passed ↵Richard Smith2014-02-281-4/+10
| | | | | | | | | | | | 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-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* OpenCL: fix for the restriction on pointers to functions.Pekka Jaaskelainen2014-02-201-3/+33
| | | | | | Patch from Anastasia Stulova! llvm-svn: 201788
* Tighten lax vector-conversion rules and enforce them consistently.John McCall2014-02-041-97/+114
| | | | | | | | | | | | | | | | | | | | When a lax conversion featured a vector and a non-vector, we were only requiring the non-vector to be a scalar type, but really it needs to be a real type (i.e. integral or real floating); it is not reasonable to allow a pointer, member pointer, or complex type here. r198474 required lax conversions to match in "data size", i.e. element size * element count, forbidding matches that happen only because a vector is rounded up to the nearest power of two in size. Unfortunately, the erroneous logic was repeated in several different places; unify them to use the new condition, so that it triggers for arbitrary conversions and not just those performed as part of binary operator checking. rdar://15931426 llvm-svn: 200810
* Tidy up and reduce some comment redundancy.Richard Smith2014-02-031-34/+29
| | | | llvm-svn: 200723
* Apply the typo correction replacement location fix from r191450 to theKaelyn Uhrain2014-01-281-3/+5
| | | | | | | | case when correcting for too many arguments (r191450 had only fixed the problem for when there were too few arguments). Also fix the underlining for both cases. llvm-svn: 200268
* Rename getResultLoc() tooAlp Toker2014-01-251-1/+1
| | | | | | | | Follow up to r200082. Spotted by Dmitri llvm-svn: 200105
* Rename getResultType() on function and method declarations to getReturnType()Alp Toker2014-01-251-18/+17
| | | | | | | | | | | | | | | A return type is the declared or deduced part of the function type specified in the declaration. A result type is the (potentially adjusted) type of the value of an expression that calls the function. Rule of thumb: * Declarations have return types and parameters. * Expressions have result types and arguments. llvm-svn: 200082
* Enforce restrictions that 'main' is not allowed to be deleted, or to be used byRichard Smith2014-01-221-1/+6
| | | | | | | | the program, in C++. (We allow the latter as an extension, since we've always permitted it, and GCC does the same, and our supported C++ ABIs don't do anything special in main.) llvm-svn: 199782
* Fix regression in r197623: only diagnose a by-copy capture of an incompleteRichard Smith2014-01-211-12/+12
| | | | | | type if the capture is, actually, by copy. llvm-svn: 199772
* Update FunctionTypeLoc and related names to match r199686Alp Toker2014-01-211-51/+45
| | | | llvm-svn: 199699
* Rename FunctionProtoType accessors from 'arguments' to 'parameters'Alp Toker2014-01-201-18/+18
| | | | | | | | | | | | | | | | | Fix a perennial source of confusion in the clang type system: Declarations and function prototypes have parameters to which arguments are supplied, so calling these 'arguments' was a stretch even in C mode, let alone C++ where default arguments, templates and overloading make the distinction important to get right. Readability win across the board, especially in the casting, ADL and overloading implementations which make a lot more sense at a glance now. Will keep an eye on the builders and update dependent projects shortly. No functional change. llvm-svn: 199686
* PR18551: accepts invalid strong enum to bool when operator! is usedAlp Toker2014-01-201-1/+1
| | | | llvm-svn: 199627
* Revert "Revert r199416, "MS ABI: Improve selection of an inheritance model""David Majnemer2014-01-171-4/+12
| | | | | | | | | | This reverts commit r199475 (which reverted r199416) with fixes for the breakages. We wouldn't lock an inheritance model if we saw a pointer-to-member formed as a result of the address-of operator. llvm-svn: 199482
* Rename language option MicrosoftMode to MSVCCompatAlp Toker2014-01-141-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | There's been long-standing confusion over the role of these two options. This commit makes the necessary changes to differentiate them clearly, following up from r198936. MicrosoftExt (aka. fms-extensions): Enable largely unobjectionable Microsoft language extensions to ease portability. This mode, also supported by gcc, is used for building software like FreeBSD and Linux kernel extensions that share code with Windows drivers. MSVCCompat (aka. -fms-compatibility, formerly MicrosoftMode): Turn on a special mode supporting 'heinous' extensions for drop-in compatibility with the Microsoft Visual C++ product. Standards-compilant C and C++ code isn't guaranteed to work in this mode. Implies MicrosoftExt. Note that full -fms-compatibility mode is currently enabled by default on the Windows target, which may need tuning to serve as a reasonable default. See cfe-commits for the full discourse, thread 'r198497 - Move MS predefined type_info out of InitializePredefinedMacros' No change in behaviour. llvm-svn: 199209
* Add a new attribute 'enable_if' which can be used to control overload ↵Nick Lewycky2014-01-111-0/+15
| | | | | | resolution based on the values of the function arguments at the call site. llvm-svn: 198996
* In areVectorOperandsLaxBitCastable() allow bitcast between a vector and scalar.Argyrios Kyrtzidis2014-01-091-8/+16
| | | | | | rdar://15779837. llvm-svn: 198856
* For areVectorOperandsLaxBitCastable(), only return false if both opearands ↵Argyrios Kyrtzidis2014-01-071-14/+18
| | | | | | | | | | are vector types and add a diagnostic when the operand is a vector and non-scalar value. rdar://15722301 llvm-svn: 198680
* [Sema] When checking if a bitcast is appropriate between vector types, take intoArgyrios Kyrtzidis2014-01-041-2/+37
| | | | | | | | | | | consideration the num-of-elements*width-of-element width. Disallow casts when such width is not equal between the vector types otherwise we may end up with an invalid LLVM bitcast. rdar://15722308. llvm-svn: 198474
* [objc] Refactor and improve functionality for the -Wunused-property-ivar ↵Argyrios Kyrtzidis2014-01-031-9/+1
| | | | | | | | | | | | | | warning. - Remove the additions to ObjCMethodDecl & ObjCIVarDecl that were getting de/serialized and consolidate all functionality for the checking for this warning in Sema::DiagnoseUnusedBackingIvarInAccessor - Don't check immediately after the method body is finished, check when the @implementation is finished. This is so we can see if the ivar was referenced by any other method, even if the method was defined after the accessor. - Don't silence the warning if any method is called from the accessor silence it if the accessor delegates to another method via self. rdar://15727325 llvm-svn: 198432
* Eliminate UnaryTypeTraitExprAlp Toker2014-01-011-1/+1
| | | | | | | | | | | | | Remove UnaryTypeTraitExpr and switch all remaining type trait related handling over to TypeTraitExpr. The UTT/BTT/TT enum prefix and evaluation code is retained pending further cleanup. This is part of the ongoing work to unify type traits following the removal of BinaryTypeTraitExpr in r197273. llvm-svn: 198271
* [OpenCL] Produce an error, instead of a warning, for sizeof(void) in OpenCL.Joey Gouly2013-12-311-2/+5
| | | | | | Patch by joey.gouly@arm.com llvm-svn: 198264
* Replacing calls to getAttr with calls to hasAttr for clarity. No functional ↵Aaron Ballman2013-12-191-1/+1
| | | | | | change intended -- this only replaces Boolean uses of getAttr. llvm-svn: 197648
* Implemented delayed processing of 'unavailable' checking, just like with ↵Ted Kremenek2013-12-181-25/+9
| | | | | | | | | | | | | | | | | | | | | | | | | 'deprecated'. Fixes <rdar://problem/15584219> and <rdar://problem/12241361>. This change looks large, but all it does is reuse and consolidate the delayed diagnostic logic for deprecation warnings with unavailability warnings. By doing so, it showed various inconsistencies between the diagnostics, which were close, but not consistent. It also revealed some missing "note:"'s in the deprecated diagnostics that were showing up in the unavailable diagnostics, etc. This change also changes the wording of the core deprecation diagnostics. Instead of saying "function has been explicitly marked deprecated" we now saw "'X' has been been explicitly marked deprecated". It turns out providing a bit more context is useful, and often we got the actual term wrong or it was not very precise (e.g., "function" instead of "destructor"). By just saying the name of the thing that is deprecated/deleted/unavailable we define this issue away. This diagnostic can likely be further wordsmithed to be shorter. llvm-svn: 197627
* Require the type of a by-copy capture to be complete before creating its field.Douglas Gregor2013-12-181-0/+9
| | | | | | | | | | | | The problem here is more serious than the fix implies. Adding a field to a class updates the triviality bits for the class (among other things). Failing to require a complete type before adding the field meant that these updates don't happen in the well-formed case where the capture is an uninstantiated class template specialization, leading the lambda itself to be treated as having a trivial copy constructor when it shouldn't. Fixes <rdar://problem/15560464>. llvm-svn: 197623
OpenPOWER on IntegriCloud