summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Do placeholder conversions on array bounds in both declarators andJohn McCall2012-01-112-4/+14
| | | | | | new-expressions. llvm-svn: 147900
* When something goes wrong in type-checking a namespace definition, make the ↵Douglas Gregor2012-01-101-1/+5
| | | | | | namespace declaration invalid llvm-svn: 147882
* objc-arc: fixes a crash when trying to find out retaining cycleFariborz Jahanian2012-01-101-4/+12
| | | | | | ownership of property sent to 'super'. // rdar://10640891 llvm-svn: 147868
* Remove a set, but unused variable. Found with GCC's warning.Chandler Carruth2012-01-101-4/+1
| | | | llvm-svn: 147864
* Implement the missing pieces of Evaluate for _Complex types. With that ↵Eli Friedman2012-01-101-1/+2
| | | | | | complete, remove some code from CGExprConstant which is no longer necessary. While I'm here, a couple minor tweaks to _Complex-in-C++. (Specifically, make _Complex types literal types, and don't warn for _Complex int.) llvm-svn: 147840
* Per John's comment, it makes sense to ask isLambda on any CXXRecordDecl; ↵Eli Friedman2012-01-101-1/+0
| | | | | | make sure that's safe. Get rid of a check which is now unnecessary in Sema::getFunctionLevelDeclContext(). llvm-svn: 147837
* Update C++11 scoped enumeration support to match the final proposal:Richard Smith2012-01-103-3/+15
| | | | | | | | - reject definitions of enums within friend declarations - require 'enum', not 'enum class', for non-declaring references to scoped enumerations llvm-svn: 147824
* objc++: patch for IRgen for atomic properties ofFariborz Jahanian2012-01-101-2/+6
| | | | | | | c++ objects with non-trivial assignment/copy functions. Also, one additional sema check. // rdar://6137845 llvm-svn: 147817
* Don't crash with -Wlarge-by-value-copy and a dependent type. PR11726.Eli Friedman2012-01-091-2/+2
| | | | llvm-svn: 147812
* Fix "note" of a duplicate explicit instantiation definition following a ↵Nico Weber2012-01-091-9/+20
| | | | | | specialization. llvm-svn: 147798
* Always allow redefinition of typedefs when modules are enabled. ThisDouglas Gregor2012-01-091-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | is important because it's fairly common for headers (especially system headers) to want to provide only those typedefs needed for that particular header, based on some guard macro, e.g., #ifndef _SIZE_T #define _SIZE_T typedef long size_t; #endif which is repeated in a number of headers. The guard macro protects against duplicate definitions. However, this means that only the first occurrence of this pattern actually defines size_t, so the submodule corresponding to this header has the only visible definition. If a user then imports a different submodule from the same module, size_t will be known but not visible, and therefore cannot be used. By allowing redefinition of typedefs, each header that wants to define size_t can do so independently, so it will be available in the corresponding submodules. llvm-svn: 147775
* Made unknown builtin diagnostic remappable.Abramo Bagnara2012-01-091-1/+1
| | | | llvm-svn: 147774
* Fixed TypeofExpr AST and code generation.Abramo Bagnara2012-01-071-19/+0
| | | | llvm-svn: 147730
* Switch NamespaceDecl from its own hand-rolled redeclaration chain overDouglas Gregor2012-01-072-86/+76
| | | | | | | | | | | | to Redeclarable<NamespaceDecl>, so that we benefit from the improveed redeclaration deserialization and merging logic provided by Redeclarable<T>. Otherwise, no functionality change. As a drive-by fix, collapse the "inline" bit into the low bit of the original namespace/anonymous namespace, saving 8 bytes per NamespaceDecl on x86_64. llvm-svn: 147729
* More lambda work: semantic analysis of capturing 'this'. It's a bit ↵Eli Friedman2012-01-076-35/+88
| | | | | | complicated, but we have to be careful about when exactly captures are marked given PotentiallyPotentiallyEvaluated contexts. (Actually, it's not 100% correct yet, but it's close enough for the moment.) llvm-svn: 147723
* Lambdas: semantic analysis of explicit captures.Eli Friedman2012-01-071-5/+78
| | | | | | This patch (and some of my other commits related to lambdas) is heavily based off of John Freeman's work-in-progress patches. llvm-svn: 147706
OpenPOWER on IntegriCloud