summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* Make sure that vtables referenced from delay-parsed templates get referenced.Nico Weber2014-08-151-12/+15
| | | | | | | | | | | | | | This fixes PR20671, see the bug for details. In short, ActOnTranslationUnit() calls DefineUsedVTables() and only then PerformPendingInstantiations(). But PerformPendingInstantiations() is what does delayed template parsing, so vtables only references from late-parsed templates weren't marked used. As a fix, move the SavePendingInstantiationsAndVTableUsesRAII in PerformPendingInstantiations() up above the delayed template parsing code. That way, vtables referenced from templates end up in the RAII object, and the call to DefineUsedVTables() in PerformPendingInstantiations() marks them used. llvm-svn: 215786
* Add a RAII class for saving and restoring instantiations and uses. No ↵Nico Weber2014-08-151-39/+18
| | | | | | behavior change. llvm-svn: 215780
* Objective-C. Do not warn if user is using property-dox syntax to name aFariborz Jahanian2014-08-151-1/+5
| | | | | | | user provided setter name (as declared in @property attribute declaration). rdar://18022762 llvm-svn: 215736
* Const-correctness, return-after-else, and formatting updates. NFC.Aaron Ballman2014-08-151-12/+10
| | | | llvm-svn: 215706
* Limit our MSVC compat hack for nested names from dependent basesReid Kleckner2014-08-141-2/+7
| | | | | | | | | | | | | | | | | | | | Previously, any undeclared unqualified id starting a nested name specifier in a dependent context would have its lookup retried during template instantiation. Now we limit that retry hack to methods of a class with dependent bases. Free function templates in particular are no longer affected by this hack. Also, diagnose this as a Microsoft extension. This has the downside that template authors may see this warning *and* an error during instantiation time about this identifier. Fixing that will probably require formalizing some kind of "delayed" identifier, instead of our ad-hoc solutions of forming dependent AST nodes when lookup fails. Based on a patch by Kim Gräsman! Differential Revision: http://reviews.llvm.org/D4854 llvm-svn: 215683
* Thread safety analysis: add -Wthread-safety-verbose flag, which adds ↵DeLesley Hutchins2014-08-141-12/+60
| | | | | | additional notes that are helpful when compiling statistics on thread safety warnings. llvm-svn: 215677
* Sema: Permit nullptr template args in MSVC compat modeDavid Majnemer2014-08-141-1/+1
| | | | | | This fixes a regression I caused back in r211766. llvm-svn: 215609
* Objective-C. Handle case of multiple class methodsFariborz Jahanian2014-08-131-1/+5
| | | | | | found in global pool as well. rdar://16808765 llvm-svn: 215603
* Objective-C. Minor refactoring of my last patch.Fariborz Jahanian2014-08-132-8/+9
| | | | | | // rdar://16808765 llvm-svn: 215581
* Objective-C. This patch is to resolve the method used in methodFariborz Jahanian2014-08-133-0/+97
| | | | | | | expression to the best method found in global method pools. This is wip. // rdar://16808765 llvm-svn: 215577
* AArch64: Prefetch intrinsicYi Kong2014-08-131-0/+7
| | | | llvm-svn: 215569
* ARM: Prefetch intrinsicsYi Kong2014-08-131-0/+5
| | | | llvm-svn: 215568
* Header guard canonicalization, clang part.Benjamin Kramer2014-08-132-5/+5
| | | | | | Modifications made by clang-tidy with minor tweaks. llvm-svn: 215557
* Objective-C [qoi]. Patch to not do Fix-It for fixingFariborz Jahanian2014-08-121-3/+6
| | | | | | | | | a messaging expression except in the simple case of a unary selector. We cannot reliably provide such a fixit due to numerous reasons where a matching selector could not be found. rdar://15756038 llvm-svn: 215480
* Improve -Wuninitialized to catch const classes being used in their own copyRichard Trieu2014-08-122-6/+21
| | | | | | constructors. llvm-svn: 215471
* Allow @synchronized to contextually convert a C++ object to an ObjC object ↵Jordan Rose2014-08-121-3/+18
| | | | | | | | pointer. Patch by Grant Paul! llvm-svn: 215453
* Reject varargs '...' in function prototype if there are more parameters afterRichard Smith2014-08-111-0/+14
| | | | | | | | | | | it. Diagnose with recovery if it appears after a function parameter that was obviously supposed to be a parameter pack. Otherwise, warn if it immediately follows a function parameter pack, because the user most likely didn't intend to write a parameter pack followed by a C-style varargs ellipsis. This warning can be syntactically disabled by using ", ..." instead of "...". llvm-svn: 215408
* Sema: Properly perform lookup when acting on fields for desig initsDavid Majnemer2014-08-111-88/+35
| | | | | | | | | | | | | | | | | | | | Clang used a custom implementation of lookup when handling designated initializers. The custom code was not particularly optimized and relied on standard lookup for typo-correction anyway. This custom code has to go, it doesn't properly support MSVC-style anonymous structs embedded inside other records; replace it with the typo-correction path. This has the side effect of speeding up semantic handling of the fields for a designated initializer while simplifying the code at the same time. This fixes PR20573. Differential Revision: http://reviews.llvm.org/D4839 llvm-svn: 215372
* Sema: Handle declspecs without declarators in records properly in C modeDavid Majnemer2014-08-111-16/+28
| | | | | | | | | | | | | | | | | | | | | We had two bugs: - We wouldn't properly warn when a struct/union/enum was mentioned inside of a record definition if no declarator was provided. We should have mentioned that this declaration declares nothing. - We didn't properly support Microsoft's extension where certain declspecs without declarators would act as anonymous structs/unions. * We completely ignored the case where such a declspec could be a union. * We didn't properly handle the case where a record was defined inside another record: struct X { int a; struct Y { int b; }; }; llvm-svn: 215347
* [modules] When considering merging a newly-declared typedef into an importedRichard Smith2014-08-101-1/+38
| | | | | | | | | one, perform the import if the types match even if the imported declaration is hidden. Otherwise, NamedDecl::declarationReplaces will drop one of the name lookup entries, making the typedef effectively inaccessible from one of the modules that declared it. llvm-svn: 215306
* Extend tautological pointer compare and pointer to bool conversion warnings toRichard Trieu2014-08-081-1/+21
| | | | | | | | | | | | | | | macro arguments. Previously, these warnings skipped any code in a macro expansion. Preform an additional check and warn when the expression and context locations are both in the macro argument. The most obvious case not caught is passing a pointer directly to a macro, i.e 'assert(&array)' but 'assert(&array && "valid array")' is caught. This is because macro arguments are not typed and the conversion happens inside the macro. llvm-svn: 215251
* Objective-C [qoi]. Issue warning and fixit if property-dot syntaxFariborz Jahanian2014-08-081-0/+12
| | | | | | | use mis-cased property name (which is currently accepted silently due to the way property setters are named). rdar://17911746 llvm-svn: 215250
* Objective-C. Minor refactoring of my previous patch.Fariborz Jahanian2014-08-081-36/+29
| | | | | | rdar://17554063 llvm-svn: 215235
* Objective-C ARC. Use of non-retain/autorelease APIFariborz Jahanian2014-08-082-6/+36
| | | | | | | for building Objective-C array literals in ARC mode. rdar://17554063 llvm-svn: 215232
* MS ABI: Don't force bases to have an inheritance modelDavid Majnemer2014-08-082-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, assigning an inheritance model to a derived class would trigger further assiginments to the various bases of the class. This was done to fix a bug where we couldn't handle an implicit base-to-derived conversion for pointers-to-members when the conversion was ambiguous at an earlier point. However, this is not how the MS scheme works. Instead, assign inheritance models to *just* the class which owns to declaration we ended up referencing. N.B. This result is surprising in many ways. It means that it is possible for a base to have a "larger" inheritance model than it's derived classes. It also means that bases in the conversion path do not get assigned a model. struct A { void f(); void f(int); }; struct B : A {}; struct C : B {}; void f() { void (C::*x)() = &A::f; } We can only begin to assign an inheritance model *after* we've seen the address-of but *before* we've done the implicit conversion the more derived pointer-to-member type. After that point, both 'A' and 'C' will have an inheritance model but 'B' will not. Surprising, right? llvm-svn: 215174
* MS ABI: Handle member function pointers returning a member data pointerDavid Majnemer2014-08-071-0/+4
| | | | | | | | | MSVC doesn't decide what the inheritance model for a returned member pointer *until* a call expression returns it. This fixes PR20017. llvm-svn: 215164
* Objective-C arc. Switch the Objective-C dictionary literal in ARC modeFariborz Jahanian2014-08-071-6/+9
| | | | | | | to use non-retain/autorelease API variants of ObjC objects. wip. rdar://17554063 llvm-svn: 215146
* Update the context location of the condition of a conditional operator to theRichard Trieu2014-08-071-1/+1
| | | | | | | question mark instead of the context of the conditional operator. The condition does not need the context of the conditional operator at all. llvm-svn: 215048
* Objective-C ARC. More code for Objective-C'sFariborz Jahanian2014-08-062-3/+29
| | | | | | new APIs for literals. nfc. wip. rdar://17554063 llvm-svn: 215043
* Objective-C ARC. Adding declarations for Objective-C'sFariborz Jahanian2014-08-061-0/+3
| | | | | | new APIs for literals. nfc. wip. rdar://17554063 llvm-svn: 214993
* Objective-C ARC. First patch toward generating new APIsFariborz Jahanian2014-08-061-2/+2
| | | | | | | for Objective-C's array and dictionary literals. rdar://17554063. This is wip. llvm-svn: 214983
* Thread Safety Analysis: add a -Wthread-safety-negative flag that warns wheneverDeLesley Hutchins2014-08-041-0/+9
| | | | | | | a mutex is acquired, but corresponding mutex is not provably not-held. This is based on the earlier negative requirements patch. llvm-svn: 214789
* Don't drop dllimport from qualified friend redeclarations (PR20512)Hans Wennborg2014-08-041-4/+8
| | | | | | | | | | This matches MSVC's logic, which seems to be that when the friend declaration is qualified, it cannot be a declaration of a new symbol and so the dll linkage doesn't change. Differential Revision: http://reviews.llvm.org/D4764 llvm-svn: 214774
* Fix crash when accessing a property of an invalid interfaceOlivier Goffart2014-08-041-12/+10
| | | | llvm-svn: 214735
* Fix crash when assiging to a property with an invalid typeOlivier Goffart2014-08-041-1/+6
| | | | | | | | | | This is a regression from clang 3.4 Set the result to ExprError and returns true, rather than simply returns false because errors have been reported already and returning false show a confusing error llvm-svn: 214734
* Highlight the offending function parameter when the format argument refers ↵Aaron Ballman2014-08-041-5/+6
| | | | | | to an invalid function parameter type. llvm-svn: 214723
* Highlight the offending function parameter when the format_arg argument ↵Aaron Ballman2014-08-041-6/+4
| | | | | | refers to an invalid function parameter type. llvm-svn: 214722
* PR11778: Fix the rejects-valid half of this bug. We still produce the sameRichard Smith2014-08-041-63/+46
| | | | | | | poorly-worded warning for a case value that is not a possible value of the switched-on expression. llvm-svn: 214678
* Dropping some else-after-returns. No functional changes intended.Aaron Ballman2014-08-011-7/+7
| | | | llvm-svn: 214526
* Replacing some more complex logic with a helper function call to ↵Aaron Ballman2014-08-012-18/+8
| | | | | | ObjCMethod::getReturnTypeSourceRange. No functional changes intended. llvm-svn: 214511
* Improving diagnostic source ranges for the nonnull attribute. Now it ↵Aaron Ballman2014-08-011-9/+31
| | | | | | highlights the attribute and the faulty nonpointer type when possible. llvm-svn: 214507
* [modules] Maintain an AST invariant across module load/save: if any declarationRichard Smith2014-07-311-7/+10
| | | | | | | | | | | | | | | of a function has a resolved exception specification, then all declarations of the function do. We should probably improve the AST representation to make this implicit (perhaps only store the exception specification on the canonical declaration), but this fixes things for now. The testcase for this (which used to assert) also exposes the actual bug I was trying to reduce here: we sometimes fail to emit the body of an imported special member function definition. Fix for that to follow. llvm-svn: 214458
* Factor out exception specification information fromRichard Smith2014-07-317-81/+64
| | | | | | | | FunctionProtoType::ExtProtoInfo. Most of the users of these fields don't care about the other ExtProtoInfo bits and just want to talk about the exception specification. llvm-svn: 214450
* Implemented a diagnostic to handle multiple, distinct ownership_return ↵Aaron Ballman2014-07-311-2/+15
| | | | | | attributes on the same declaration. This removes a FIXME from the code. llvm-svn: 214436
* Add a state variable to the loop hint attribute.Tyler Nowicki2014-07-311-58/+46
| | | | | | | | | | This patch is necessary to support constant expressions which replaces the integer value in the loop hint attribute with an expression. The integer value was also storing the pragma’s state for options like vectorize(enable/disable) and the pragma unroll and nounroll directive. The state variable is introduced to hold the state of those options/pragmas. This moves the validation of the state (keywords) from SemaStmtAttr handler to the loop hint annotation token handler. Resubmit with changes to try to fix the build-bot issue. Reviewed by Aaron Ballman llvm-svn: 214432
* Local extern redeclarations of dllimport variables stay dllimport even if ↵Hans Wennborg2014-07-311-2/+3
| | | | | | they don't specify the attribute llvm-svn: 214425
* Removing an outdated FIXME. No functional changes.Aaron Ballman2014-07-311-4/+0
| | | | llvm-svn: 214411
* Obective-C. Patch to fix the incorrect ObjcMessageExpr argument source ranges, Fariborz Jahanian2014-07-311-1/+1
| | | | | | | when arguments are structures or classes. PR16392. patch by Karlis Senko llvm-svn: 214409
* Delay check for prototype on __fastcall functions until after MergeFunctionDecl.Nico Weber2014-07-312-17/+18
| | | | | | | In C, it is only known after merging decls if a function with 0 arguments has a prototype. Fixes PR20386, see that for more notes. llvm-svn: 214408
* Automate attribute argument count semantic checking when there are variadic ↵Aaron Ballman2014-07-312-67/+51
| | | | | | | | or optional arguments present. With this, the only time you should have to manually check attribute argument counts is when HasCustomParsing is set to true, or when you have variadic arguments that aren't really variadic (like ownership_holds and friends). Updating the diagnostics in the launch_bounds test since they have been improved in that case. Adding a test for nonnull since it has little test coverage, but has truly variadic arguments. llvm-svn: 214407
OpenPOWER on IntegriCloud