summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* MS ABI: Fix inheritance model calculation in CRTPDavid Majnemer2014-06-131-0/+3
| | | | | | | | | | | | | | | | | CRTP-like patterns involve a class which inherits from another class using itself as a template parameter. However, the base class itself may try to create a pointer-to-member which involves the derived class. This is problematic because we may not have finished parsing the most derived classes' base specifiers yet. It turns out that MSVC simply uses the unspecified inheritance model instead of doing anything fancy. This fixes PR19987. llvm-svn: 210886
* Recover from missing 'typename' in sizeof(T::InnerType)Reid Kleckner2014-06-124-37/+99
| | | | | | | | | | | | | | | | | | | | | | Summary: 'sizeof' is a UnaryExprOrTypeTrait, and it can contain either a type or an expression. This change threads a RecoveryTSI parameter through the layers between TransformUnaryExprOrTypeTrait the point at which we look up the type. If lookup finds a single type result after instantiation, we now build TypeSourceInfo for it just like a normal transformation would. This fixes the last error in the hello world ATL app that I've been working with, and it now links and runs with clang. Please try it and file bugs! Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4108 llvm-svn: 210855
* Check the access of operator delete from the destructor contextReid Kleckner2014-06-121-1/+3
| | | | | | | | | | | | Previously we would do the access check from the context of MarkVTableUsed. Also update this test to C++11, since that is typically used with the MS C++ ABI. Fixes PR20005. llvm-svn: 210850
* Objective-C ARC. Blocks that strongly capture themselvesFariborz Jahanian2014-06-121-3/+20
| | | | | | | | | | | to call themselves will get the warning: "Capturing <itself> strongly in this block is likely to lead to a retain cycle". Cut down on the amount of noise by noticing that user at some point sets the captured variable to null in order to release it (and break the cycle). // rdar://16944538 llvm-svn: 210823
* MS ABI: Fix forming pointers to members of a base classReid Kleckner2014-06-121-30/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously we would calculate the inheritance model of a class when requiring a pointer to member type of that class to be complete. The inheritance model is used to figure out how many fields are used by the member pointer. However, once we require a pointer to member of a derived class type to be complete, we can form pointers to members of bases without calculating the inheritance model for those bases. This was causing crashes on this simple test case: struct A { void f(); void f(int); }; struct B : public A {}; void g() { void (B::*a)() = &B::f; } Now we calculate the inheritance models of all base classes when completing a member pointer type. Fixes PR2007. llvm-svn: 210813
* Objective-C. Use isObjCRetainableType in my lastFariborz Jahanian2014-06-121-5/+3
| | | | | | patch. NFC. llvm-svn: 210795
* Explicitly initialize all fields to avoid -Wmissing-field-initializers warning.Eli Bendersky2014-06-121-5/+6
| | | | llvm-svn: 210791
* PR19966: don't crash/assert when __underlying_type is applied to an incompleteRichard Smith2014-06-121-1/+12
| | | | | | | enumeration type. I've also filed a LWG issue pointing out that this should be ill-formed. llvm-svn: 210723
* Don't inherit dllimport to inline move assignment operatorsHans Wennborg2014-06-111-2/+15
| | | | | | | | | | | | | | Current MSVC versions don't have move assignment operators, so we can't rely on them being available in the dll. If we have the definition, we can just use that directly. This breaks pointer equality, but should work fine otherwise. When there is an MSVC version that supports move assignment, we can key this off the -fmsc-ver option. http://reviews.llvm.org/D4105 llvm-svn: 210715
* Don't slice SemaDiagnosticBuilderReid Kleckner2014-06-111-3/+2
| | | | | | | I wasn't able to figure out how to emit this diagnostic from a SFINAE context, so I don't have a test. llvm-svn: 210713
* Fix the VS2012 build.Hans Wennborg2014-06-111-5/+7
| | | | | | It didn't handle the in-class member initializer and compound literal. llvm-svn: 210707
* Objective-C. Accept '__attribute__((__ns_returns_retained__))' Fariborz Jahanian2014-06-111-1/+12
| | | | | | | for function/methods returning block in MRR mode as well. // rdar://17259812 llvm-svn: 210706
* Objective-C. More tests for both bridging attributes andFariborz Jahanian2014-06-111-1/+1
| | | | | | | a fix to make it work when CFStructs have no definition. // rdar://17238954. llvm-svn: 210690
* Add some comments to TypoCorrectionConsumer.Kaelyn Takata2014-06-111-26/+49
| | | | | | | | | | | Also move the constructor for NamespaceSpecifierSet out of line to improve the class' readability. I meant to do these two things while cleaning up the previous TypoCorrectionConsumer changes and have them folded into those changes. No functionality changed. llvm-svn: 210686
* Sink SpecifierInfo into the only class that uses it.Kaelyn Takata2014-06-111-18/+13
| | | | | | | | | | | | | SpecifierInfo is not used outside of NamespaceSpecifierSet except indirectly through NamespaceSpecifierSet's iterator, so clean up the code a bit by moving SpecifierInfo into NamespaceSpecifierSet. Also drop SpecifierInfo's trivial yet verbose constructor since brace initiialization is sufficient in the only two places the constructor was being explicitly called. No functionality changed. llvm-svn: 210672
* Make a couple of helper classes private to TypoCorrectionConsumer.Kaelyn Takata2014-06-111-81/+87
| | | | | | | | | | | The SpecifierInfo and NamespaceSpecifierSet are now only used by TypoCorrectionConsumer, so treat them as the implementation details of TypoCorrectionConsumer that they are. Also make NamespaceSpecifierSet's method names more style guide compliant. No functionality changed. llvm-svn: 210671
* Clean up the TypoCorrectionConsumer's interface a bit.Kaelyn Takata2014-06-111-37/+26
| | | | | | No functionality changed. llvm-svn: 210670
* Move TypoCorrection filtering into the TypoCorrectionConsumer and make it ↵Kaelyn Takata2014-06-111-257/+253
| | | | | | | | | | | | incremental. The only external/visible functional change that fell out of this refactoring is that there was one less case where the typo caching and/or counting didn't work properly. The result is that a test case had to be moved from typo-correction.cpp to typo-correction-pt2.cpp to avoid the hard-coded limit on per file/TU typo correction attempts. llvm-svn: 210669
* Move a few classes to be before TypoCorrectionConsumer.Kaelyn Takata2014-06-111-129/+134
| | | | | | | | | | | This is in preparation for moving TypoCorrection filtering into the TypoCorrectionConsumer, to separate out some of the purely mechanical churn. It also makes some of the method names in NamespaceSpecifierSet be more style guide compliant. No functionality changed. llvm-svn: 210668
* Add loop unroll pragma supportEli Bendersky2014-06-111-53/+60
| | | | | | | | http://reviews.llvm.org/D4089 Patch by Mark Heffernan. llvm-svn: 210667
* Objective-C. Patch to handle bridge attribute warningsFariborz Jahanian2014-06-111-29/+80
| | | | | | | | correctly when both NSAttributedString and NSMutableAttributedString are specified on the same CFStruct via different typedefs. // rdar://17238954 llvm-svn: 210660
* Allow lookup into dependent bases in more places under -fms-compatibilityReid Kleckner2014-06-111-22/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently allow unqualified lookup for instance methods but not static methods because we can't recover with a semantic 'this->' insertion. ATL headers have static methods that do unqualified lookup into dependent base classes. The pattern looks like: template <typename T> struct Foo : T { static int *getBarFromT() { return Bar; } }; Now we recover as if the user had written: template <typename T> struct Foo : T { static int *getBarFromT() { return Foo::Bar; } }; ... which will eventually look up Bar in T at instantiation time. Now we emit a diagnostic in both cases, and delay lookup in other contexts where 'this' is available and refers to a class with dependent bases. Reviewed by: rsmith Differential Revision: http://reviews.llvm.org/D4079 llvm-svn: 210611
* Related to PR19992: when the GNU alignof-expression extension is applied to anRichard Smith2014-06-101-4/+15
| | | | | | | expression of array-of-unknown-bound type, don't try to complete the array bound, and return the alignment of the element type rather than 1. llvm-svn: 210608
* Recover from missing typenames on template args for MSVC compatibilityReid Kleckner2014-06-102-10/+45
| | | | | | | | | | | | | While matching a non-type template argument against a known template type parameter we now modify the AST's TemplateArgumentLoc to assume the user wrote typename. Under -fms-compatibility, we downgrade our diagnostic from an error to an extwarn. Reviewed by: rsmith Differential Revision: http://reviews.llvm.org/D4049 llvm-svn: 210607
* PR19992: alignof is permitted on an array of unknown bound.Richard Smith2014-06-101-19/+16
| | | | llvm-svn: 210585
* Remove a redundant conditional when caching typo failures.Kaelyn Takata2014-06-101-6/+5
| | | | | | No functionality change. llvm-svn: 210583
* Objective-C. Don't ignore availability attribute whenFariborz Jahanian2014-06-101-1/+4
| | | | | | | doing Objective-C subscript access. // rdar://16842487 PR19682. llvm-svn: 210565
* Don't inherit dll attributes to deleted methods (PR19988)Hans Wennborg2014-06-101-3/+2
| | | | | | | | | | | | | We would previously end up with an error when instantiating the following template: template <typename> struct __declspec(dllimport) S { void foo() = delete; }; S<int> s; error: attribute 'dllimport' cannot be applied to a deleted function llvm-svn: 210550
* Improve checking for dynamic initializers of dllimport fields in template ↵Hans Wennborg2014-06-101-8/+8
| | | | | | | | | instantiation We would previously assert if the initializer was dependent. I also think that checking isConstantInitializer is more correct here than checkInitIsICE. llvm-svn: 210505
* Reduce indentation in ActOnIdExpression, NFCReid Kleckner2014-06-091-51/+48
| | | | llvm-svn: 210499
* Removing an "if (this == nullptr)" check from two print methods. The conditionRichard Trieu2014-06-093-0/+5
| | | | | | | will never be true in a well-defined context. The checking for null pointers has been moved into the caller logic so it does not rely on undefined behavior. llvm-svn: 210498
* Objective-C. Consider block pointer as NSObject as well as conforming toFariborz Jahanian2014-06-091-2/+33
| | | | | | | 'NSCopying' protocol when diagnosing block to ObjC pointer conversion. // rdar://16739120 llvm-svn: 210491
* Allow definition of dllimport static fields in partial specializations (PR19956)Hans Wennborg2014-06-091-2/+4
| | | | | | This expands the logic from r210141 to cover partial specializations too. llvm-svn: 210484
* [C++11] Use 'nullptr'.Craig Topper2014-06-093-9/+9
| | | | llvm-svn: 210448
* Don't include llvm/MC/MCParser throughout all of SemaAlp Toker2014-06-081-1/+2
| | | | | | Requires LLVM r210417. llvm-svn: 210418
* Avoid dubious IdentifierInfo::getNameStart() usesAlp Toker2014-06-072-5/+3
| | | | | | | | These cases in particular were incurring an extra strlen() when we already knew the length. They appear to be leftovers from when the interfaces worked with C strings that have continued to compile due to the implicit StringRef ctor. llvm-svn: 210403
* Delay lookup of simple default template arguments under -fms-compatibilityReid Kleckner2014-06-061-0/+44
| | | | | | | | | | | | | | | | | | MSVC delays parsing of default arguments until instantiation. If the default argument is never used, it is never parsed. We don't model this. Instead, if lookup of a type name fails in a template argument context, we form a DependentNameType, which will be looked up at instantiation time. This fixes errors about 'CControlWinTraits' in atlwin.h. Reviewers: rsmith Differential Revision: http://reviews.llvm.org/D3995 llvm-svn: 210382
* Add -Wtautological-undefined-compare and -Wundefined-bool-conversion warningsRichard Trieu2014-06-061-2/+14
| | | | | | to detect underfined behavior involving pointers. llvm-svn: 210372
* Fix DOS-style newlines.Eli Bendersky2014-06-061-181/+181
| | | | | | | | | A previous patch r210330 (and possibly another) introduced DOS-style newlines into a UNIX newline formatted file. Patch by Mark Heffernan (http://reviews.llvm.org/D4046) llvm-svn: 210369
* Retain an expression pack expansion when the parameter pack expansion code asksRichard Smith2014-06-061-2/+27
| | | | | | us to. llvm-svn: 210355
* PR14841: If partial substitution of explicitly-specified template argumentsRichard Smith2014-06-061-0/+11
| | | | | | | | results in a template having too many arguments, but all the trailing arguments are packs, that's OK if we have a partial pack substitution: the trailing pack expansions may end up empty. llvm-svn: 210350
* Replacing r210333 with an improved solution; we should never reach this code ↵Aaron Ballman2014-06-061-2/+3
| | | | | | with any other loop hint options. llvm-svn: 210338
* Quieting a false-positive which was causing the sanitizer bots to go red.Aaron Ballman2014-06-061-1/+1
| | | | llvm-svn: 210333
* Adding a new #pragma for the vectorize and interleave optimization hints.Aaron Ballman2014-06-061-25/+180
| | | | | | Patch thanks to Tyler Nowicki! llvm-svn: 210330
* Fix typosAlp Toker2014-06-062-2/+2
| | | | llvm-svn: 210328
* PR11306 - Variadic template fix-it suggestion. Recover from misplaced or ↵Nikola Smiljanic2014-06-061-3/+4
| | | | | | redundant ellipsis in parameter pack. llvm-svn: 210304
* Add pointer types to global named registerRenato Golin2014-06-051-0/+4
| | | | | | | | | | This patch adds support for pointer types in global named registers variables. It'll be lowered as a pair of read/write_register and inttoptr/ptrtoint calls. Also adds some early checks on types on SemaDecl to avoid the assert. Tests changed accordingly. (PR19837) llvm-svn: 210274
* Don't dynamically initialize dllimport vars (PR19933)Hans Wennborg2014-06-041-0/+6
| | | | | | | | They should be initialized when they're exported. Differential Revision: http://reviews.llvm.org/D4020 llvm-svn: 210217
* [OPENMP] Parsing/Sema for OMPLasprivateClause.Alexander Musman2014-06-042-4/+206
| | | | | | Parsing this clause, allowing it on directive ‘omp simd’ and semantic checks. llvm-svn: 210184
* [OPENMP] Small comment and reformatting fixes.Alexander Musman2014-06-042-79/+68
| | | | | | | | | Fix post-commit review comments by Carlo Bertolli for commit r209660 - OMP collapse clause. Re-formatted TransformOMP* functions in TreeTransform.h with clang-format. llvm-svn: 210169
OpenPOWER on IntegriCloud