summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* 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
* PR11754: Reject non-static constexpr member functions in classes with virtualRichard Smith2012-01-131-17/+19
| | | | | | base classes. llvm-svn: 148094
* constexpr is allowed on static member functions of non-literal classes. Per ↵Eli Friedman2012-01-131-1/+1
| | | | | | report on cfe-dev. llvm-svn: 148090
* A few minor improvements to error recovery trying to access member of a ↵Eli Friedman2012-01-131-7/+5
| | | | | | function. In particular, this restores the cool error recovery for the example from http://blog.llvm.org/2010/04/amazing-feats-of-clang-error-recovery.html , which regressed a few months back. llvm-svn: 148089
* Don't crash while trying to diagnose a function declared at block scope with anRichard Smith2012-01-132-3/+6
| | | | | | incomplete return type. llvm-svn: 148088
* Fix up the calls to CorrectTypo in Sema*ObjC.cpp to use callbackKaelyn Uhrain2012-01-132-48/+81
| | | | | | | objects, and add a basic CorrectionCandidateCallback template class to simplify the fixups. llvm-svn: 148085
* Improve 0-argument -Wvexing-parse diagnostic by adding notes with fix-its:Richard Smith2012-01-123-35/+67
| | | | | | | | | | | | | | | | | | | | | | | - If the declarator is at the start of a line, and the previous line contained another declarator and ended with a comma, then that comma was probably a typo for a semicolon: int n = 0, m = 1, l = 2, // k = 5; myImportantFunctionCall(); // oops! - If removing the parentheses would correctly initialize the object, then produce a note suggesting that fix. - Otherwise, if there is a simple initializer we can suggest which performs value-initialization, then provide a note suggesting a correction to that initializer. Sema::Declarator now tracks the location of the comma prior to the declarator in the declaration, if there is one, to facilitate providing the note. The code to determine an appropriate initializer from the -Wuninitialized warning has been factored out to allow use in both that and -Wvexing-parse. llvm-svn: 148072
* Convert SemaCXXScopeSpec.cpp to pass a callback object to CorrectTypo,Kaelyn Uhrain2012-01-121-3/+22
| | | | | | improvng the typo correction results in certain situations. llvm-svn: 148052
* objc: do not warn when converting to a const id qualfied by itsFariborz Jahanian2012-01-121-1/+3
| | | | | | list of protools. // rdar://10669694 llvm-svn: 148051
* Convert SemaInit.cpp to pass a callback object to CorrectTypo.Kaelyn Uhrain2012-01-121-7/+25
| | | | | | | And once again improve the typo correction results in certain situations just by moving the existing checks on the correction. llvm-svn: 148037
* In Objective-C++, actually compute the base type of a member accessDouglas Gregor2012-01-122-12/+23
| | | | | | | | expression for an Objective-C object or pointer type, so that we don't attempt to treat the member name as a template. Fixes <rdar://problem/10672501>. llvm-svn: 148028
* Add IsImplicit field in ObjCMessageExpr that is true when the messageArgyrios Kyrtzidis2012-01-122-36/+57
| | | | | | | | | | 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
* Fix some edge cases with C++ casts and placeholder expressions.Eli Friedman2012-01-121-12/+15
| | | | llvm-svn: 147984
* objective-c: fixes a regression in looking up namesFariborz Jahanian2012-01-121-2/+5
| | | | | | | in class extensions and categories by recent refactoring of objc class ASTs. // rdar://1066654 llvm-svn: 147982
* Improve the diagnostic when trying to redefine a typedef with aDouglas Gregor2012-01-111-1/+12
| | | | | | variably-modified type. llvm-svn: 147973
* Fix the caching in CorrectTypo so that other non-keyword identifiersKaelyn Uhrain2012-01-112-2/+4
| | | | | | | | | | | | | | are still added if the cached correction fails validation. Also fix a copy-and-paste error in a comment from my previous commit. Finally, add an example of the benefit the typo correction callback adds to TryNamespaceTypoCorrection--which happens to also tickle the above caching problem, as the only way a non-namespace Decl would be added to the possible corrections is if it was cached as the correction for a previous instance of the same typo where the typo was corrected to a non-namespace via a different code path. llvm-svn: 147968
* minor refactoring to improve compile-time performance.Fariborz Jahanian2012-01-111-2/+2
| | | | llvm-svn: 147963
* Add initial callback object support to Sema::CorrectTypo.Kaelyn Uhrain2012-01-112-103/+182
| | | | | | | | | Also includes two examples of the callback: a wrapper/replacement for the CorrectTypoContext enum, and a conversion of the two calls to CorrectTypo in SemaDeclCXX.cpp (one of which provides verifiable improvement to the typo correction, as demonstrated in the added test). llvm-svn: 147962
* objc-arc: evaluate 'readonly' property with no knownFariborz Jahanian2012-01-111-6/+55
| | | | | | | life-time to that of its backing 'ivar's lifetime. // rdar://10558871 llvm-svn: 147956
* C11 allows typedefs to be redefined. Implement this in C11 mode, andDouglas Gregor2012-01-111-4/+2
| | | | | | | downgrade the default-error warning to an ExtWarn in C90/99. <rdar://problem/10668057> llvm-svn: 147925
* Start refactoring code for capturing variables and 'this' so that it is ↵Eli Friedman2012-01-114-57/+57
| | | | | | shared between lambda expressions and block literals. llvm-svn: 147917
OpenPOWER on IntegriCloud