summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* Simple hack to do unreachable code analysis on template patterns.David Blaikie2012-01-241-5/+4
| | | | llvm-svn: 148774
* Rename Sema::isNullExpr() -> Sema::isSentinelNullExpr() which is more ↵Argyrios Kyrtzidis2012-01-241-2/+2
| | | | | | descriptive. llvm-svn: 148772
* objective-c: Ignore with warning forward class declaration whose nameFariborz Jahanian2012-01-241-5/+10
| | | | | | matches a typedef declaring an object type. // rdar://10733000 llvm-svn: 148760
* Minor fixups for auto deduction of initializer lists.Sebastian Redl2012-01-236-20/+24
| | | | | | | | Fix some review comments. Add a test for deduction when std::initializer_list isn't available yet. Fix redundant error messages. This fixes and outstanding FIXME too. llvm-svn: 148735
* Introduce Sema::isNullExpr() that contains the checks thatArgyrios Kyrtzidis2012-01-231-11/+19
| | | | | | Sema::DiagnoseSentinelCalls() does. llvm-svn: 148722
* In CorrectTypo, use the cached correction as a starting point instead.Kaelyn Uhrain2012-01-231-30/+44
| | | | | | | | | | | | | | | | | Previously, for unqualified lookups, a positive cache hit is used as the only non-keyword correction and a negative cache hit immediately returns an empty TypoCorrection. With the new callback objects, this behavior causes false negatives by not accounting for the fact that callback objects alter the set of potential/allowed corrections. The new behavior is to seed the set of corrections with the cached correction (for positive hits) to estabilishing a baseline edit distance. Negative cache hits are only stored or used when either no callback object is provided or when it returns true for a call to ValidateCandidate with an empty TypoCorrection (i.e. when ValidateCandidate does not seem to be doing any checking of the TypoCorrection, such as when an instance of the base callback class is used solely to specify the set of keywords to be accepted). llvm-svn: 148720
* Handle pseudo-object expressions (and any other placeholderDouglas Gregor2012-01-231-3/+7
| | | | | | | expression) when code-completing member access expressions. Fixes <rdar://problem/10717172>. llvm-svn: 148703
* Downgrade C++11 narrowing conversion errors to warnings default-mappedDouglas Gregor2012-01-231-9/+15
| | | | | | | | | to an error, so that users can turn them off if necessary. Note that this does *not* change the behavior of in a SFINAE context, where we still flag an error even if the warning is disabled. This matches GCC's behavior. llvm-svn: 148701
* Add a source range to the ms path. Spotted by David Blaikie.Nico Weber2012-01-231-1/+1
| | | | llvm-svn: 148683
* In microsoft mode, downgrade pseudo-destructors on void from error to warning.Nico Weber2012-01-231-2/+5
| | | | | | This matches cl.exe's behavior and fixes PR11791. llvm-svn: 148682
* Implement -Wswitch-enum correctly.David Blaikie2012-01-231-10/+10
| | | | | | | | Clang previously implemented -Wswitch-enum the same as -Wswitch. This patch corrects the behavior to match GCC's. The critical/only difference being that -Wswitch-enum is not silenced by the presence of a default case in the switch. llvm-svn: 148679
* Eli says this should check MicrosoftMode instead.Nico Weber2012-01-231-3/+3
| | | | | | Also change a || that I accidentally changed to && back to ||. llvm-svn: 148677
* In ms mode, a move assignment operator shouldn't mark a copy ctor as deleted.Nico Weber2012-01-231-11/+15
| | | | | | | | | | | | | MSVC2010's pair class has a move assignment operator but no explicit copy constructor, which makes it unusable without this change. For symmetry, let move copy constructors not mark the default assignment operator as deleted either. Both changes match cl.exe's behavior. Fixes pr11826. Also update the standard excerpt to point to the right paragraph. llvm-svn: 148675
* Make sure the AST correctly represents lvalue-to-rvalue conversions where ↵Eli Friedman2012-01-234-9/+21
| | | | | | appropriate. llvm-svn: 148673
* Fix -Wswitch to warn about out of bounds enum cases even when there's a defaultDavid Blaikie2012-01-221-32/+28
| | | | | | | | | For consistency with GCC & reasonable sanity. The FIXME suggests that the original author was perhaps using the default check for some other purpose, not realizing the more obvious limitation/false-negatives it creates, but this doesn't seem to produce any regressions & fixes the included test. llvm-svn: 148649
* In Microsoft Mode, disable the C++11 strict integral conversion rules for ↵Francois Pichet2012-01-211-1/+2
| | | | | | enumerator that were introduced with r148439. Otherwise MSVC headers won't compile in C++ 11 mode. llvm-svn: 148642
* Add -Wswitch-enum-redundant-default.David Blaikie2012-01-211-2/+8
| | | | | | | | | | | | | | | | | | | This warning acts as the complement to the main -Wswitch-enum warning (which warns whenever a switch over enum without a default doesn't cover all values of the enum) & has been an an-doc coding convention in LLVM and Clang in my experience. The purpose is to ensure there's never a "dead" default in a switch-over-enum because this would hide future -Wswitch-enum errors. The name warning has a separate flag name so it can be disabled but it's grouped under -Wswitch-enum & is on-by-default because of this. The existing violations of this rule in test cases have had the warning disabled & I've added a specific test for the new behavior (many negative cases already exist in the same test file - and none regressed - so I didn't add more). Reviewed by Ted Kremenek ( http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120116/051690.html ) llvm-svn: 148640
* Remove redundant argument.Rafael Espindola2012-01-211-2/+2
| | | | llvm-svn: 148628
* Fix some comments relating to ExpressionEvaluationContexts. Get rid of a ↵Eli Friedman2012-01-213-15/+10
| | | | | | couple of uses of ConstantEvaluated which don't make sense. llvm-svn: 148624
* Add obvious missing call to MarkDeclarationReferenced.Eli Friedman2012-01-211-0/+1
| | | | llvm-svn: 148611
* Make clang's AST model sizeof and typeof with potentially-evaluated operands ↵Eli Friedman2012-01-212-2/+18
| | | | | | correctly, similar to what we already do with typeid. llvm-svn: 148610
* Fix the code completion string for variadic macros with more than oneDouglas Gregor2012-01-211-32/+21
| | | | | | | argument, which was broken and very ugly (and even had a test case to make *sure* it was broken and ugly). Fixes <rdar://problem/10609117>. llvm-svn: 148606
* Delayed template instantiation of late-parsed attributes.DeLesley Hutchins2012-01-202-6/+42
| | | | llvm-svn: 148595
* Instantiate dependent attributes when instantiating templates.DeLesley Hutchins2012-01-204-11/+15
| | | | llvm-svn: 148592
* More dead code removal (using -Wunreachable-code)David Blaikie2012-01-205-20/+8
| | | | llvm-svn: 148577
* Replace a dubious use of SmallVectorImpl with a proper copy.Benjamin Kramer2012-01-201-3/+4
| | | | llvm-svn: 148549
* Localize variable, remove unused assignment.Benjamin Kramer2012-01-201-5/+1
| | | | | | Found by the clang static analyzer. llvm-svn: 148544
* Remove unused variables.Benjamin Kramer2012-01-202-4/+1
| | | | | | Found by clang's own static analyzer. llvm-svn: 148542
* Remove PotentiallyPotentiallyEvaluated, and replace it with a much simpler ↵Eli Friedman2012-01-205-165/+71
| | | | | | and less error-prone way of handling the relevant cases. Towards marking of whether a declaration is used more accurately. llvm-svn: 148522
* An instantiation of a constexpr static data member in a class template isRichard Smith2012-01-191-0/+1
| | | | | | constexpr. llvm-svn: 148505
* A few style changes.Tanya Lattner2012-01-191-6/+3
| | | | | | | Change CheckVectorLogicalOperands to pass params by ref. Add another test case. llvm-svn: 148452
* Remove the now-unused CorrectTypoContext enum.Kaelyn Uhrain2012-01-191-72/+1
| | | | llvm-svn: 148441
* constexpr: converted constant expression handling for enumerator values, caseRichard Smith2012-01-185-69/+318
| | | | | | | | | | values and non-type template arguments of integral and enumeration types. This change causes some legal C++98 code to no longer compile in C++11 mode, by enforcing the C++11 rule that narrowing integral conversions are not permitted in the final implicit conversion sequence for the above cases. llvm-svn: 148439
* Convert SemaDecl.cpp to pass callback objects to CorrectTypo.Kaelyn Uhrain2012-01-181-47/+82
| | | | | | | | | | | | Includes tests highlighting the cases where accuracy has improved (there is one call that does no filtering beyond selecting the set of allowed keywords, and one call that only triggers for ObjC code for which a test by someone who knows ObjC would be welcome). Also fixes a small typo in one of the suggestion messages, and drops a malformed "expected-note" for a suggestion that did not occur even when the malformed note was committed as r145930. llvm-svn: 148420
* objc: deprecate direct usage of 'isa' of objc objectsFariborz Jahanian2012-01-181-2/+4
| | | | | | | in favor of usage of api's intended for. // rdar://8290002 llvm-svn: 148404
* Fix char literal types in CSeth Cantrell2012-01-181-8/+6
| | | | | | | | L'x' is actually wchar_t support C11 u and U char literals llvm-svn: 148390
* Convert DiagnoseEmptyLookup to use correction callbacks.Kaelyn Uhrain2012-01-183-6/+12
| | | | | | | | | | | | No new unit tests yet as there is no behavioral change (except for slightly more specific filtering in Sema::ActOnStartOfLambdaDefinition). Tests will be added as the code paths are traced in greater depth to determine how to improve the results--there are at least one or two known bugs that require those improvements. This commit lays the groundwork for those changes. llvm-svn: 148382
* Move narrowing conversion detection code from SemaInit to SemaOverload, readyRichard Smith2012-01-182-180/+236
| | | | | | | | | | | | | for it to be used in converted constant expression checking, and fix a couple of issues: - Conversion operators implicitly invoked prior to the narrowing conversion were not being correctly handled when determining whether a constant value was narrowed. - For conversions from floating-point to integral types, the diagnostic text incorrectly always claimed that the source expression was not a constant expression. llvm-svn: 148381
* Make PotentiallyPotentiallyEvaluated contexts work correctly when ↵Eli Friedman2012-01-181-15/+44
| | | | | | referencing a class field from outside an instance method. llvm-svn: 148376
* The value of a case statement is a potentially evaluated context. Found by ↵Eli Friedman2012-01-181-2/+2
| | | | | | inspection. llvm-svn: 148373
* Fix a couple issues where we didn't correctly delay diagnostics in ↵Eli Friedman2012-01-182-10/+81
| | | | | | PotentiallyPotentiallyEvaluated contexts. In preparation for making sizeof() PotentiallyPotentiallyEvaluated. llvm-svn: 148367
* objc-arc: when 'assign' attribute is unspecified,Fariborz Jahanian2012-01-171-4/+24
| | | | | | | | rely on property's type for its life-time to avoid bogus warning with -Warc-unsafe-retained-assign. // rdar://10694932 llvm-svn: 148355
* Add Sema::isInitListConstructor. This will be needed for upcoming work.Sebastian Redl2012-01-171-0/+17
| | | | llvm-svn: 148354
* Auto deduction support for std::initializer_list, including for-range ↵Sebastian Redl2012-01-174-13/+85
| | | | | | | | support. This means you can now write: for (int i : {1, 4, 512, 23, 251}) {} llvm-svn: 148353
* Template argument deduction for std::initializer_list arguments from ↵Sebastian Redl2012-01-172-23/+72
| | | | | | initializer lists. llvm-svn: 148352
* Rename the first of 11 DeduceTemplateArguments overloads.Sebastian Redl2012-01-171-114/+117
| | | | | | | | | | | | | | | There are 5 functions of this name in Sema, and 6 more static helpers in SemaTemplateDeduction.cpp. The Sema functions have jobs like "deduce for function call", "deduce for taking the address", etc. The static helpers have jobs like "deduce by comparing two types", "deduce by comparing two lists of types", "deduce by comparing two template arguments", etc. The fact that they all are called the same and only differ in two of their 6 or more arguments makes the code using them very hard to read. Here I rename the one function that concerns me most at the moment, but as a matter of cleanup, the others will eventually be renamed as well. llvm-svn: 148351
* Basic overloading support for std::initializer_list.Sebastian Redl2012-01-171-3/+29
| | | | llvm-svn: 148350
* Sema support for initialization of std::initializer_list from initializer lists.Sebastian Redl2012-01-171-3/+108
| | | | | | This does not yet support CodeGen. llvm-svn: 148349
* Add Sema::isStdInitializerList, which will be necessary for the upcoming ↵Sebastian Redl2012-01-172-1/+54
| | | | | | operations. llvm-svn: 148348
* Correctly resolve an overload set passed to an overloaded operator=. PR11784.Eli Friedman2012-01-171-0/+3
| | | | llvm-svn: 148335
OpenPOWER on IntegriCloud