summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* ArrayRef'ize Sema::FinalizeDeclaratorGroup, Sema::BuildDeclaratorGroup andRafael Espindola2013-07-094-31/+29
| | | | | | | | Sema::ActOnDocumentableDecls. Patch by Robert Wilhelm. llvm-svn: 185931
* Fix recovery for missing * in objc property.Eli Friedman2013-07-091-2/+10
| | | | | | <rdar://problem/14354144> llvm-svn: 185897
* Fix crash typo-correcting dependent member func.Eli Friedman2013-07-081-1/+1
| | | | | | PR16561. llvm-svn: 185887
* Attempt typo correction for function calls with the wrong number of arguments.Kaelyn Uhrain2013-07-081-4/+98
| | | | | | | | | | | | | | | Combined with typo correction's new ability to apply global/absolute nested name specifiers to possible corrections, cases such as in PR12287 where the desired function is being shadowed by a lexically closer function with the same name but a different number of parameters will now include a FixIt. On a side note, since the test for this change caused test/SemaCXX/typo-correction.cpp to exceed the typo correction limit for a single file, I've included a test case for exceeding the limit and added some comments to both the original and part two of typo-correction.cpp warning future editors of the files about the limit. llvm-svn: 185881
* Make a couple of useful typo correction callbacks more widely available.Kaelyn Uhrain2013-07-082-62/+40
| | | | llvm-svn: 185880
* Fix Sema for compares with _Atomic vars.Eli Friedman2013-07-082-41/+25
| | | | | | | | | | | | | | | | Use UsualArithmeticConversions unconditionally in analysis of comparisons and conditional operators: the method performs the usual arithmetic conversions if both sides are arithmetic, and usual unary conversions if they are not. This is just a cleanup for conditional operators; for comparisons, it fixes the issue that we would try to check isArithmetic() on an atomic type. Also, fix GetExprRange() in SemaChecking.cpp so it deals with variables of atomic type correctly. Fixes PR15537. llvm-svn: 185857
* Introduce a typedef for the type of NewlyDeducedPacks to avoid repeating the ↵Craig Topper2013-07-081-20/+19
| | | | | | small size of the inner SmallVector. llvm-svn: 185789
* Remove 'else' after 'return'Craig Topper2013-07-081-1/+1
| | | | llvm-svn: 185787
* Function argument formatting fixes. No functional change.Craig Topper2013-07-081-6/+6
| | | | llvm-svn: 185786
* Function argument formatting fixes.Craig Topper2013-07-081-17/+19
| | | | llvm-svn: 185785
* Use SmallVectorImpl::reverse_iterator instead of SmallVector to avoid ↵Craig Topper2013-07-081-2/+2
| | | | | | specifying the vector size. llvm-svn: 185784
* Sema: Do not merge new decls with invalid, old declsDavid Majnemer2013-07-071-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Sema::MergeFunctionDecl attempts merging two decls even if the old decl is invalid. This can lead to interesting circumstances where we successfully merge the decls but the result makes no sense. Take the following for example: template <typename T> int main(void); int main(void); Sema will not consider these to be overloads of the same name because main can't be overloaded, which means that this must be a redeclaration. In this case the templated decl is compatible with the non-templated decl allowing the Sema::CheckFunctionDeclaration machinery to move on and do bizarre things like setting the previous decl of a non-templated decl to a templated decl! The way I see it, we should just bail from MergeFunctionDecl if the old decl is invalid. This fixes PR16531. llvm-svn: 185779
* Objective-C: Warn when fast enumeration variable isn't used.Fariborz Jahanian2013-07-061-3/+0
| | | | | | // rdar://14182680. llvm-svn: 185762
* Remove some useless declarations (found by scan-build)Sylvestre Ledru2013-07-062-3/+1
| | | | llvm-svn: 185752
* Sema: Fix a crash when main is redeclared as a function-template.David Majnemer2013-07-061-8/+8
| | | | | | | | | | This boils down to us sending invalid function decls to CheckFunctionDeclaration becauswe we did not consider that CheckMain could cause the decl to be invalid. Instead, interogate the new decl's main-validity and *then* send it over to get CheckFunctionDeclaration'd if it was still valid after calling CheckMain. llvm-svn: 185745
* Use SmallVectorImpl& for function arguments instead of SmallVector.Craig Topper2013-07-053-10/+10
| | | | llvm-svn: 185715
* Objective-C: diagnose when synthesizing an ivar ofFariborz Jahanian2013-07-051-1/+7
| | | | | | abstract class type. // rdar://14261999 llvm-svn: 185710
* Sema: Call IgnoreParens fewer times in CheckAddressOfOperandDavid Majnemer2013-07-051-4/+4
| | | | llvm-svn: 185684
* Add typedefs for Densemaps containing SmallVectors to avoid repeating the ↵Craig Topper2013-07-052-2/+2
| | | | | | SmallVector size when creating iterators for the DenseMap. llvm-svn: 185682
* Add a space between closing template '>' to unbreak build.Craig Topper2013-07-041-1/+1
| | | | llvm-svn: 185611
* Use SmallVectorImpl instead of SmallVector for iterators and references to ↵Craig Topper2013-07-047-21/+21
| | | | | | avoid specifying the vector size unnecessarily. llvm-svn: 185610
* Part of PR15673: If a function template has a default argument in whichRichard Smith2013-07-042-5/+14
| | | | | | | | | substitution failed, report that as a substitution failure rather than pretending that there was no default argument. The test cases in PR15673 have exposed some pre-existing poor diagnostics here. llvm-svn: 185604
* Improve -Wlogical-not-parentheses to catch when the not is applied to an enum.Richard Trieu2013-07-041-1/+1
| | | | llvm-svn: 185602
* Check LongDoubleFormat instead of just Width as this is PowerPC specific.Roman Divacky2013-07-031-1/+2
| | | | llvm-svn: 185584
* "bool" should be a context-sensitive keyword in Altivec mode.Bill Schmidt2013-07-031-0/+14
| | | | | | | | | | | | | | | | | PR16456 reported that Clang implements a hybrid between AltiVec's "Keyword and Predefine Method" and its "Context Sensitive Keyword Method," where "bool" is always a keyword, but "vector" and "pixel" are context-sensitive keywords. This isn't permitted by the AltiVec spec. For consistency with gcc, this patch implements the Context Sensitive Keyword Method for bool, and stops treating true and false as keywords in Altivec mode. The patch removes KEYALTIVEC as a trigger for defining these keywords in include/clang/Basic/TokenKinds.def, and adds logic for "vector bool" that mirrors the existing logic for "vector pixel." The test case is taken from the bug report. llvm-svn: 185580
* Add support for TF/TC modes available on eg. PowerPC64.Roman Divacky2013-07-031-5/+8
| | | | llvm-svn: 185578
* Allow typo correction to try removing nested name specifiers.Kaelyn Uhrain2013-07-027-31/+72
| | | | | | | | | | | | | | | | | The removal is tried by retrying the failed lookup of a correction candidate with either the MemberContext or SS (CXXScopeSpecifier) or both set to NULL if they weren't already. If the candidate identifier is then looked up successfully, make a note in the candidate that the SourceRange should include any existing nested name specifier even if the candidate isn't adding a different one (i.e. the candidate has a NULL NestedNameSpecifier). Also tweak the diagnostic messages to differentiate between a suggestion that just replaces the identifer but leaves the existing nested name specifier intact and one that replaces the entire qualified identifier, in cases where the suggested replacement is unqualified. llvm-svn: 185487
* Look for corrections in enclosing namespaces that require a global ↵Kaelyn Uhrain2013-07-021-13/+13
| | | | | | | | | | | | | | NestedNameSpecifier. CorrectTypo will now see and consider those corrections that are effectively shadowed by other declarations in a closer context when resolved via an unqualified lookup. This involves adding any parent namespaces to the set of namespaces as fully-qualified name specifiers, and also adding potential corrections that passed name lookup but were rejected by the given CorrectionCandidateCallback into the set of failed corrections that should be tried with the set of namespace specifiers. llvm-svn: 185486
* Fix to PR15826 - clang hits assert in clang::ASTContext::getASTRecordLayout.Serge Pavlov2013-07-021-1/+2
| | | | llvm-svn: 185446
* Suppress "control reaches end of non-void function" warning when compiling ↵Andy Gibbs2013-07-021-0/+2
| | | | | | with gcc. llvm-svn: 185439
* Fix mangling for block literals.Eli Friedman2013-07-012-74/+86
| | | | | | | | | | | | | | | Blocks, like lambdas, can be written in contexts which are required to be treated as the same under ODR. Unlike lambdas, it isn't possible to actually take the address of a block, so the mangling of the block itself doesn't matter. However, objects like static variables inside a block do need to be mangled in a consistent way. There are basically three components here. One, block literals need a consistent numbering. Two, objects/types inside a block literal need to be mangled using it. Three, objects/types inside a block literal need to have their linkage computed correctly. llvm-svn: 185372
* Put helper class in anonymous namespace.Craig Topper2013-07-011-0/+4
| | | | llvm-svn: 185305
* PR16502: Fix a dumb bug where we might look past the last initializer in anRichard Smith2013-07-011-0/+2
| | | | | | InitListExpr. llvm-svn: 185304
* Teach -Wunsequenced that the side-effects of a function evaluation are sequencedRichard Smith2013-06-301-4/+21
| | | | | | | | | before the value computation of the result. In C, this is implied by there being a sequence point after their evaluation, and in C++, it's implied by the side-effects being sequenced before the expressions and statements in the function body. llvm-svn: 185282
* Reinstate r185229, reverted in r185256, with a tweak: further ignore theRichard Smith2013-06-302-90/+199
| | | | | | | | | | | | | | | | | | | | | | | standard's rule that an extern "C" declaration conflicts with any entity in the global scope with the same name. Now we only care if the global scope entity is a variable declaration (and so might have the same mangled name as the extern "C" declaration). This has been reported as a standard defect. Original commit message: PR7927, PR16247: Reimplement handling of matching extern "C" declarations across scopes. When we declare an extern "C" name that is not a redeclaration of an entity in the same scope, check whether it redeclares some extern "C" entity from another scope, and if not, check whether it conflicts with a (non-extern-"C") entity in the translation unit. When we declare a name in the translation unit that is not a redeclaration, check whether it conflicts with any extern "C" entities (possibly from other scopes). llvm-svn: 185281
* Compress pairs. No functionality change.Benjamin Kramer2013-06-292-13/+13
| | | | llvm-svn: 185264
* Revert r185229 as it breaks compilation of <windows.h>Timur Iskhodzhanov2013-06-292-194/+90
| | | | llvm-svn: 185256
* PR7927, PR16247: Reimplement handling of matching extern "C" declarationsRichard Smith2013-06-282-90/+194
| | | | | | | | | | | | | | | across scopes. When we declare an extern "C" name that is not a redeclaration of an entity in the same scope, check whether it redeclares some extern "C" entity from another scope, and if not, check whether it conflicts with a (non-extern-"C") entity in the translation unit. When we declare a name in the translation unit that is not a redeclaration, check whether it conflicts with any extern "C" entities (possibly from other scopes). llvm-svn: 185229
* Fix error recovery with in-class initializer.Eli Friedman2013-06-281-1/+6
| | | | | | | | Previously, for a field with an invalid in-class initializer, we would create a CXXDefaultInitExpr referring to a null Expr*. This is not a good idea. llvm-svn: 185216
* Fix line endings.Eli Friedman2013-06-281-20/+20
| | | | llvm-svn: 185215
* Switch Decl instantiation to DeclNodes.inc.Eli Friedman2013-06-271-2/+41
| | | | | | | | | This replaces a long list of declarations for visitor functions with a list generated from DeclNodes.inc. Nothing really interesting came out of it; we had comprehensive coverage anyway (excluding FriendTemplateDecls). llvm-svn: 185118
* Fix nested lifetime extension when a std::initializer_list member isRichard Smith2013-06-271-3/+5
| | | | | | initialized during aggregate initialization of the surrounding structure. llvm-svn: 185117
* Ensure that debugger calls to signature-less functions default toJohn McCall2013-06-271-3/+42
| | | | | | | | | | | | | | | | | | | | | passing arguments in the fixed style. We have an abstraction for deciding this, but it's (1) deep in IR-generation, (2) necessarily tied to exact argument lists, and (3) triggered by unprototyped function types, which we can't legitimately make in C++ mode. So this solution, wherein Sema rewrites the function type to an exact prototype but leaves the variadic bit enabled so as to request x86-64-like platforms to pass the extra variadic info, is very much a hack, but it's one that works in practice on the platforms that LLDB will support in the medium term --- the only place we know of where it's a problem is instance methods in Windows, where variadic functions are implicitly cdecl. We may have a more abstracted base on which to build a solution by then. rdar://13731520 llvm-svn: 185112
* Remove unnecessary check.Eli Friedman2013-06-271-1/+1
| | | | llvm-svn: 185108
* Under -fms-extensions, only inject a friend tag name when we didn't see a ↵Douglas Gregor2013-06-271-3/+7
| | | | | | | | | | | | | | tag with that name in an enclosing scope. r177473 made us correctly consider only those declarations in the enclosing namespace scope when looking for a friend declaration. Under ms-extensions mode, where we do some level of friend injection, this meant that we were introducing a new tag type into a different scope than what Microsoft actually does. Address this by only doing the friend injection when we didn't see any tag with that name in any outer scope. Fixes <rdar://problem/14250378>. llvm-svn: 185100
* A bit of program simplification from r185056Larisse Voufo2013-06-272-4/+2
| | | | llvm-svn: 185058
* Fix a conversion to incomplete type bug -- The error message now ↵Larisse Voufo2013-06-272-7/+18
| | | | | | specifically states that the type is incomplete and points to the forward declaration of the incomplete type. llvm-svn: 185056
* Delete dead code.Eli Friedman2013-06-272-130/+1
| | | | llvm-svn: 185053
* PR16467: Teach -Wunsequenced that in C11 (unlike C++11), an assignment'sRichard Smith2013-06-261-5/+15
| | | | | | | | side-effect is not sequenced before its value computation. Also fix a mishandling of ?: expressions where the condition is constant that was exposed by the tests for this. llvm-svn: 185035
* ObjectiveC: diagnose duplicate declaration ofFariborz Jahanian2013-06-261-0/+13
| | | | | | | private ivars in class extensions and class @implementation. // rdar://14278560 llvm-svn: 185025
OpenPOWER on IntegriCloud