summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Fix a couples of issues in format strings checking.Jean-Daniel Dupas2012-01-172-79/+100
| | | | | | | PR 10274: format function attribute with the NSString archetype yields no compiler warnings PR 10275: format function attribute isn't checked in Objective-C methods llvm-svn: 148324
* objc: fixes a bug where struct used inside anFariborz Jahanian2012-01-171-1/+2
| | | | | | | | objc class was not being exported to parent decl context resulting in bogus mismatch warning later on. // rdar://10655530 llvm-svn: 148320
* Delay the creation of the built-in Objective-C class 'Protocol' byDouglas Gregor2012-01-171-13/+5
| | | | | | | moving it from a "special type" to a predefined declaration, as we do for id, Class, and SEL. llvm-svn: 148313
* Re-add an over-zealously removed break.David Blaikie2012-01-171-0/+1
| | | | llvm-svn: 148296
* Remove dead comments as per Chandler's feedback to r148292David Blaikie2012-01-171-2/+0
| | | | llvm-svn: 148294
* Remove unreachable code in Clang. (replace with llvm_unreachable where ↵David Blaikie2012-01-1716-92/+47
| | | | | | appropriate or when GCC requires it) llvm-svn: 148292
* Remove unnecessary default cases in switches over enums.David Blaikie2012-01-176-9/+0
| | | | | | This allows -Wswitch-enum to find switches that need updating when these enums are modified. llvm-svn: 148281
* Introduce a CodeCompletionResult::CreateCodeCompletionString() thatArgyrios Kyrtzidis2012-01-172-22/+34
| | | | | | | | does not depend on Sema, it accepts an ASTContext and a Preprocessor. Step towards making clang_getCursorCompletionString not depend on Sema. llvm-svn: 148278
* Introduce a static Sema::MarkDeducedTemplateParameters() that only dependsArgyrios Kyrtzidis2012-01-171-51/+53
| | | | | | | | on an ASTContext. This is a step towards making clang_getCursorCompletionString not depend on Sema. llvm-svn: 148277
* Revert r148271; this requires more thought.Eli Friedman2012-01-171-28/+11
| | | | llvm-svn: 148276
* Change the behavior of the lvalue-to-rvalue conversion for varargs in ↵Eli Friedman2012-01-171-11/+28
| | | | | | | | PotentiallyPotentiallyEvaluated contexts so that we model it in a sane way in most cases, and give up for the edge case which hopefully doesn't matter too much. In preparation for correctly treating sizeof() as a PotentiallyPotentiallyEvaluated context. llvm-svn: 148271
* Use Builtin ID as the return valueAnna Zaks2012-01-171-18/+30
| | | | | | | | | | for FunctionDecl::getMemoryFunctionKind(). This is a follow up on the Chris's review for r148142: We don't want to pollute FunctionDecl with an extra enum. (To make this work, added memcmp and family to the library builtins.) llvm-svn: 148267
* Add support for OpenCL 1.1 logical operations.Tanya Lattner2012-01-161-16/+44
| | | | llvm-svn: 148254
* Add some calls to MarkDeclarationReferenced, towards a point where every ↵Eli Friedman2012-01-162-1/+8
| | | | | | declaration which is used is marked as used. llvm-svn: 148253
* Some improvements to the handling of C11 atomic types:David Chisnall2012-01-163-5/+57
| | | | | | | | | | | | | | | | | | - 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
* Refactor variables unused under non-assert builds.David Blaikie2012-01-161-2/+1
| | | | llvm-svn: 148229
* Pedantic diagnostic correction: in C++, we have integral constant expressions,Richard Smith2012-01-151-9/+8
| | | | | | | | not integer constant expressions. In passing, fix the 'folding is an extension' diagnostic to not claim we're accepting the code, since that's not true in -pedantic-errors mode, and add this diagnostic to -Wgnu. llvm-svn: 148209
* Use a smaller vector than SmallVector.Benjamin Kramer2012-01-142-6/+4
| | | | | | Shrinks OverloadCandidate from 208 to 168 bytes. llvm-svn: 148204
* Clear ImplicitConversionSequence the obvious way which turns out to be less ↵Benjamin Kramer2012-01-141-4/+3
| | | | | | fragile. llvm-svn: 148200
* Give OverloadCandidateSet the responsibility for destroying the implicit ↵Benjamin Kramer2012-01-141-1/+5
| | | | | | conversion sequences so we don't get double frees when the vector reallocates. llvm-svn: 148198
* objc: disallow __block attribute on method params.Fariborz Jahanian2012-01-141-0/+4
| | | | llvm-svn: 148197
* De-virtualize getPreviousDecl() and getMostRecentDecl() when we knowDouglas Gregor2012-01-148-31/+31
| | | | | | | | | | | | we have a redeclarable type, and only use the new virtual versions (getPreviousDeclImpl() and getMostRecentDeclImpl()) when we don't have that type information. This keeps us from penalizing users with strict type information (and is the moral equivalent of a "final" method). Plus, settle on the names getPreviousDecl() and getMostRecentDecl() throughout. llvm-svn: 148187
* Pool allocate ImplicitConversionSequences.Benjamin Kramer2012-01-141-9/+10
| | | | | | | | | | | | | | | | To avoid malloc thrashing give OverloadCandidateSet an inline capacity for conversion sequences. We use the fact that OverloadCandidates never outlive the OverloadCandidateSet and have a fixed amount of conversion sequences. This eliminates the oversized SmallVector from OverloadCandidate shrinking it from 752 to 208 bytes. On the test case from the "Why is CLANG++ so freaking slow" thread on llvmdev this avoids one gig of vector reallocation (including memcpy) which translates into 5-10% speedup on Lion/x86_64. Overload candidate computation is still the biggest malloc contributor when compiling templated c++ code. llvm-svn: 148186
* OverloadCandidateSet: Stop exposing SmallVector internalsBenjamin Kramer2012-01-141-22/+9
| | | | | | | Replace push_back with addCandidate which will let us make use of the fixed size of the conversion sequence vector soon. llvm-svn: 148185
* Introduce Decl::getPreviousDecl() and Decl::getMostRecentDecl(),Douglas Gregor2012-01-141-24/+7
| | | | | | | | virtual functions that provide previous/most recent redeclaration information for any declaration. Use this to eliminate the redundant, less efficient getPreviousDecl() functions. llvm-svn: 148184
* Progress towards making isUsed() reflect whether a declaration is odr-used; ↵Eli Friedman2012-01-132-12/+2
| | | | | | | | don't set isUsed for local variables which are referenced in unevaluated contexts. Make other code use isReferenced() (which basically indicates that a declaration isn't dead) where appropriate. I was forced to change test/SemaCXX/linkage.cpp because we aren't actually modeling extern "C" in the AST the way that testcase expects; we were not printing a warning only because we skipped the relevant check. Someone who actually understands the semantics here should fix that. llvm-svn: 148158
* Convert SemaTemplate*.cpp to pass a callback object to CorrectTypo.Kaelyn Uhrain2012-01-132-15/+31
| | | | | | | | The change to SemaTemplateVariadic.cpp improves the typo correction results in certain situations, while the change to SemaTemplate.cpp does not change existing behavior. llvm-svn: 148155
* Make sure to consider non-DeclContext scopes properly when findingDouglas Gregor2012-01-131-10/+30
| | | | | | | multiple name lookup results in C/Objective-C. Fixes a regression a caused in r147533, found by Enea Zaffanella! llvm-svn: 148154
* Move identification of memory setting and copying functions (memset,Anna Zaks2012-01-131-88/+20
| | | | | | | memcmp, strncmp,..) out of Sema and into FunctionDecl so that the logic could be reused in the analyzer. llvm-svn: 148142
* Convert SemaExprMember.cpp to pass a callback object to CorrectTypo,Kaelyn Uhrain2012-01-131-12/+23
| | | | | | | | | improving the typo correction results in certain situations. This is also the first typo correction callback conversion to affect an existing unit test. :) llvm-svn: 148140
* Refactor for clarity.Richard Smith2012-01-131-18/+24
| | | | llvm-svn: 148135
OpenPOWER on IntegriCloud