summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* ArrayRefize CXXTryStmt.Nico Weber2012-12-291-1/+1
| | | | llvm-svn: 171239
* ArrayRefize a CompoundStmt constructor.Nico Weber2012-12-293-6/+7
| | | | llvm-svn: 171238
* Reject overloading of two static extern C functions.Rafael Espindola2012-12-282-29/+11
| | | | | | | | This patch moves hasCLanguageLinkage to be VarDecl and FunctionDecl methods so that they can be used from SemaOverload.cpp and then fixes the logic in Sema::IsOverload. llvm-svn: 171193
* Improve diagnostic wording for when an implicitly-deleted special memberRichard Smith2012-12-282-15/+6
| | | | | | function is selected by overload resolution. llvm-svn: 171190
* Implement dcl.link paragraph 5.Rafael Espindola2012-12-271-0/+40
| | | | | | | The language linkage of redeclarations must match. GCC was already reporting an error for this. llvm-svn: 171139
* Fix a regression from the previous commit.Rafael Espindola2012-12-261-1/+5
| | | | | | | Template instantiation can set the canonical decl to used after subsequent decls have been chained, so we have to check that too. llvm-svn: 171088
* Use the most recent redecl to decide if it is needed.Rafael Espindola2012-12-261-1/+1
| | | | | | This fixes pr14691, which I think is a regression from r168519. llvm-svn: 171077
* Fix for PR12222.Erik Verbruggen2012-12-252-7/+13
| | | | | | | | Changed getLocStart() and getLocEnd() to be required for Stmts, and make getSourceRange() optional. The default implementation for getSourceRange() is build the range by calling getLocStart() and getLocEnd(). llvm-svn: 171067
* Add intel_ocl_bicc calling convention as a function attribute to clang. The ↵Guy Benyei2012-12-252-1/+9
| | | | | | calling convention is already implemented in LLVM. llvm-svn: 171056
* Add 171048 back but invalidate the cache of all redeclarations when settingRafael Espindola2012-12-253-6/+20
| | | | | | | | | | | | | | | | | | the body of a functions. The problem was that hasBody looks at the entire chain and causes problems to -fvisibility-inlines-hidden if the cache was not invalidated. Original message: Cache visibility of decls. This unifies the linkage and visibility caching. I first implemented this when working on pr13844, but the previous fixes removed the performance advantage of this one. This is still a step in the right direction for making linkage and visibility cheap to use. llvm-svn: 171053
* Revert r171048, "Cache visibility of decls."NAKAMURA Takumi2012-12-253-20/+6
| | | | | | It broke stage2. llvm-svn: 171050
* Cache visibility of decls.Rafael Espindola2012-12-253-6/+20
| | | | | | | | | | | This unifies the linkage and visibility caching. I first implemented this when working on pr13844, but the previous fixes removed the performance advantage of this one. This is still a step in the right direction for making linkage and visibility cheap to use. llvm-svn: 171048
* Move a declaration closer to its use. No functionality change.Nico Weber2012-12-231-2/+2
| | | | llvm-svn: 170992
* PR14695: Fix assert from bad cast<>. Not every namespace is a NamespaceDecl; ↵Richard Smith2012-12-221-5/+12
| | | | | | it might instead be a TranslationUnitDecl. llvm-svn: 170976
* Add back -Wduplicate-enum which I mistakenly removed.Ted Kremenek2012-12-221-0/+178
| | | | | | | | | | | | This was removed with -Wunique-enum, which is still removed. The corresponding thread on cfe-comments for that warning is here: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-September/024224.html If we get specific user feedback for -Wduplicate-enum we can evaluate whether or not to keep it. llvm-svn: 170974
* Tweak Sema::CheckLiteralKind() to also include block literalsTed Kremenek2012-12-212-11/+9
| | | | | | | This simplifies some diagnostic logic in checkUnsafeAssignLiteral(), hopefully making it less error prone. llvm-svn: 170945
* Add comments back that were accidentally removed in r170933.Chad Rosier2012-12-211-0/+2
| | | | llvm-svn: 170938
* Remove unused arguments and rename to conform to coding standards.Chad Rosier2012-12-211-8/+3
| | | | llvm-svn: 170933
* Change checkUnsafeAssignLiteral() to use the new Sema::CheckLiteralKind().Ted Kremenek2012-12-212-25/+16
| | | | | | | | | | Along the way, fix a bug in CheckLiteralKind(), previously in diagnoseObjCLiteralComparison, where we didn't ignore parentheses in boxed expressions for purpose of classification. In other words, both @42 and @(42) should be classified as numeric literals. llvm-svn: 170931
* Hoist logic for classifying Objective-C literals into Sema (proper) for use ↵Ted Kremenek2012-12-211-52/+45
| | | | | | | | with other diagnostics. No immediate (intended) functionality change. llvm-svn: 170930
* Use descriptive enum instead of raw integers for checkUnsafeAssignLiteral().Ted Kremenek2012-12-211-7/+9
| | | | llvm-svn: 170920
* Sink call to checkUnsafeAssignLiteral() into checkUnsafeAssignObject().Ted Kremenek2012-12-211-23/+22
| | | | llvm-svn: 170919
* Remove duplicate includes.Roman Divacky2012-12-213-4/+0
| | | | llvm-svn: 170903
* Fix regression in r170489: when instantiating a direct initializer which is aRichard Smith2012-12-212-7/+22
| | | | | | | | CXXScalarValueInitExpr (or an ImplicitValueInitExpr), strip it back down to an empty pair of parentheses so that the initialization code can tell that we're performing value-initialization. llvm-svn: 170867
* Extend checkUnsafeAssigns() to also handle assigning an object literal to a ↵Ted Kremenek2012-12-211-0/+39
| | | | | | | | | | weak reference. Thanks to Jordan Rose and John McCall for their sage code review. Fixes <rdar://problem/12569201>. llvm-svn: 170864
* Refactor checkUnsafeAssigns() to avoid code duplication with while loop.Ted Kremenek2012-12-211-16/+22
| | | | | | | | This is just a minor bit of refactoring, but it is nice cleanup for the subsequent patch that adds warning support for assigning literals to weak variables. llvm-svn: 170863
* Don't eagerly emit a global static merged with a local extern.Rafael Espindola2012-12-211-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | When we are visiting the extern declaration of 'i' in static int i = 99; int foo() { extern int i; return i; } We should not try to handle it as if it was an function static. That is, we must consider the written storage class. Fixing this then exposes that the assert in EmitGlobalVarDeclLValue and the if leading to its call are not completely accurate. They were passing before because the second decl was marked as having external storage. I changed them to check the linkage, which I find easier to understand. Last but not least, there is something strange going on with cuda and opencl. My guess is that the linkage computation for these languages needs to be audited, but I didn't want to change that in this patch so I just updated the storage classes to keep the current behavior. Thanks to Reed Kotler for reporting this. llvm-svn: 170827
* Revert "Warn if a __weak variable is initialized with an Objective-C object ↵Ted Kremenek2012-12-201-18/+1
| | | | | | | | literal." Per code feedback, I want to see if there is a more general way to do this. llvm-svn: 170777
* Warn if a __weak variable is initialized with an Objective-C object literal.Ted Kremenek2012-12-201-1/+18
| | | | | | | | | Such variables may immediately become nil or may have unpredictable behavior. Fixes <rdar://problem/12569201>. llvm-svn: 170763
* Revert r170500. It over-zealously converted *ALL* things named Attributes, ↵Bill Wendling2012-12-208-147/+147
| | | | | | which is wrong here. llvm-svn: 170721
* objective-C: Don't warn of unimplemented property of protocols in Fariborz Jahanian2012-12-191-4/+15
| | | | | | | category, when those properties will be implemented in category's primary class or one of its super classes. // rdar://12568064 llvm-svn: 170573
* Rename the 'Attributes' class to 'Attribute'. It's going to represent a ↵Bill Wendling2012-12-198-147/+147
| | | | | | single attribute in the future. llvm-svn: 170500
* Fix assertion failure in self-host (and probably bogus template instantiationRichard Smith2012-12-191-4/+0
| | | | | | | | too). When instantiating a direct-initializer, if we find it has zero arguments, produce an empty ParenListExpr rather than returning a null expression. llvm-svn: 170490
* PR13470: Ensure that copy-list-initialization isntantiates asRichard Smith2012-12-196-103/+113
| | | | | | | | | | | | copy-list-initialization (and doesn't add an additional copy step): Fill in the ListInitialization bit when creating a CXXConstructExpr. Use it when instantiating initializers in order to correctly handle instantiation of copy-list-initialization. Teach TreeTransform that function arguments are initializations, and so need this special treatment too. Finally, remove some hacks which were working around SubstInitializer's shortcomings. llvm-svn: 170489
* Change DeclContextLookup(Const)Result to (Mutable)ArrayRef<NamedDecl*>, as ↵David Blaikie2012-12-1912-97/+98
| | | | | | | | | | | | | | | per review discussion in r170365 This does limit these typedefs to being sequences, but no current usage requires them to be contiguous (we could expand this to a more general iterator pair range concept at some point). Also, it'd be nice if SmallVector were constructible directly from an ArrayRef but this is a bit tricky since ArrayRef depends on SmallVectorBaseImpl for the inverse conversion. (& generalizing over all range-like things, while nice, would require some nontrivial SFINAE I haven't thought about yet) llvm-svn: 170482
* Re-commit r170428 changes with Linux style file endings.Guy Benyei2012-12-183-0/+42
| | | | | | Add OpenCL images as clang builtin types. llvm-svn: 170432
* Revert changes from r170428, as I accidentally changed the line endings of ↵Guy Benyei2012-12-183-42/+0
| | | | | | these files to Windows style. llvm-svn: 170431
* Add OpenCL images as clang builtin types.Guy Benyei2012-12-183-0/+42
| | | | llvm-svn: 170428
* Merge storage classes even when contexts don't match.Rafael Espindola2012-12-181-2/+1
| | | | | | | | This fixes the storage class of extern decls that are merged with file level statics. The patch also fixes the linkage computation so that they are considered internal. llvm-svn: 170406
* The underlying type for an enum should be an integer type, not another enum.Eli Friedman2012-12-181-1/+5
| | | | | | | | (This change only affects ObjC.) <rdar://problem/12857117>. llvm-svn: 170402
* When warning about a missing prototype because a function declaration is ↵Anders Carlsson2012-12-181-2/+19
| | | | | | missing 'void', insert a fixit to add the void. llvm-svn: 170399
* IdentifierResolver: Remove an unnecessary include and an unused parameter.Nico Weber2012-12-172-4/+2
| | | | llvm-svn: 170297
* Have Sema::ActOnStartOfFunctionDef return the declaration that was passed it.Argyrios Kyrtzidis2012-12-141-2/+2
| | | | | | | | | | | | | | | | | | | | This fixes the missing warning here: struct S { template <typename T> void meth() { char arr[3]; arr[4] = 0; // warning: array index 4 is past the end of the array } }; template <typename T> void func() { char arr[3]; arr[4] = 0; // no warning } llvm-svn: 170180
* Remove code from Sema::ActOnStartOfFunctionTemplateDef that duplicates whatArgyrios Kyrtzidis2012-12-141-7/+1
| | | | | | Sema::ActOnStartOfFunctionDef is already doing. llvm-svn: 170179
* Using CanQualType::getAs<ArrayType> is unsafe; fix the code currently using it,Eli Friedman2012-12-131-10/+8
| | | | | | and make sure additional uses don't get introduced. <rdar://problem/12858424>. llvm-svn: 170081
* objc: DOn't complain if a (SEL) expression is typecastFariborz Jahanian2012-12-131-0/+2
| | | | | | to (SEL). Fixes // rdar://12859590 llvm-svn: 170058
* Add missing check for error return from DefaultLvalueConversion. Fixes ↵Eli Friedman2012-12-131-0/+2
| | | | | | <rdar://problem/12857416>. llvm-svn: 170056
* [objc] For the ARC error that is emitted when a synthesized property ↵Argyrios Kyrtzidis2012-12-121-3/+5
| | | | | | | | | | | | | | | implementation has inconsistent ownership with the backing ivar, point the error location to the ivar. Pointing to the ivar (instead of the @synthesize) is better since this is where a fix is needed. Also provide the location of @synthesize via a note. This also fixes the problem where an auto-synthesized property would emit an error without any location. llvm-svn: 170039
* Speeds up parsing of global declarations in cases where the warningManuel Klimek2012-12-121-1/+4
| | | | | | | | | | is switched of by about 0.8% (tested with int i<N>). Additionally, this puts computing the diagnostic class into the hot path more when parsing, in preparation for upcoming optimizations in this area. llvm-svn: 169976
* Don't complain about incomplete implementations for methods that areDouglas Gregor2012-12-111-1/+10
| | | | | | unavailable due to availability attributes. <rdar://problem/12798237> llvm-svn: 169903
OpenPOWER on IntegriCloud