summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* MS ABI: Add support for #pragma pointers_to_membersDavid Majnemer2014-02-105-11/+55
| | | | | | | | | | | | | | | | | | | Introduce a notion of a 'current representation method' for pointers-to-members. When starting out, this is set to 'best case' (representation method is chosen by examining the class, selecting the smallest representation that would work given the class definition or lack thereof). This pragma allows the translation unit to dictate exactly what representation to use, similar to how the inheritance model keywords operate. N.B. PCH support is forthcoming. Differential Revision: http://llvm-reviews.chandlerc.com/D2723 llvm-svn: 201105
* Sema: Remove useless MSStructPragmaOn update in Sema::~SemaDavid Majnemer2014-02-101-1/+0
| | | | | | No functional change, this code was just superfluous. llvm-svn: 201099
* PR18685: Ignore class template specializations as potentialKaelyn Uhrain2014-02-091-0/+7
| | | | | | | nested-name-specifiers for typos unless the typo already has a nested-name-specifier that is a template specialization. llvm-svn: 201056
* Clarify comment. Remove braces from single-statement block.David Blaikie2014-02-091-4/+4
| | | | llvm-svn: 201040
* Improve diagnostic for using non-class/namespace/scoped enum in a nested ↵David Blaikie2014-02-091-14/+17
| | | | | | | | | | | | | | | name specifier. Rather than simply saying "X is not a class or namespace", clarify what X is by providing the aka type in the case where X is a type, or pointing to the named declaration if there's an unambiguous one to refer to. In the ambiguous case, the ambiguities are already enumerated (though could be clarified by describing what kind of entities they are) Included a few FIXMEs in tests where some further improvements could be made. llvm-svn: 201038
* PR16519, PR18009: When checking a partial specialization for uses of its ownRichard Smith2014-02-091-31/+94
| | | | | | | | | | template parameters, don't look for parameters of outer templates. If a problem is found in a default template argument, point the diagnostic at the partial specialization (with a note pointing at the default argument) instead of pointing it at the default argument and leaving it unclear which partial specialization os problematic. llvm-svn: 201031
* Move the -fms-compatibility using decl check after real access checkingReid Kleckner2014-02-081-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This avoids false positives from -Wmicrosoft when name lookup would normally succeed in standard C++. This triggered on a common CRTP pattern in clang, where a derived class would have a private using decl to pull in members of a dependent base: class Verifier : InstVisitor<Verifier> { private: using InstVisitor<Verifier>::visit; ... void anything() { visit(); // warned here } }; Real access checks pass here because we're in the context of the Verifier, but the -Wmicrosoft extension was just looking for the private access specifier. Reviewers: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2679 llvm-svn: 201019
* PR18581: Attempt to complete the type in a VLA declaration before checkingRichard Smith2014-02-081-0/+1
| | | | | | whether it's POD. llvm-svn: 201018
* Fix lifetime issue causing buildbot failures.Richard Smith2014-02-081-2/+2
| | | | llvm-svn: 201012
* PR16638, DR1552: the exception specification on an implicitly-declaredRichard Smith2014-02-071-3/+6
| | | | | | | | | | | 'operator delete' or 'operator delete[]' is an explicit exception specification. Therefore we should diagnose 'void operator delete(void*)' instead of 'void operator delete(void*) noexcept'. This diagnostic remains an ExtWarn, since in practice people don't always include the exception specification in such a declaration. llvm-svn: 201002
* Fold together two repeated identical 'if's.Richard Smith2014-02-071-7/+5
| | | | llvm-svn: 201000
* Objective-C. Revert patch r193003 for furtherFariborz Jahanian2014-02-071-21/+0
| | | | | | internal discussions. // rdar://16006401 llvm-svn: 200986
* MS ABI: Don't be so hasty to judge an inheritance modelDavid Majnemer2014-02-072-10/+17
| | | | | | | | If we are in the middle of defining the class, don't attempt to validate previously annotated declarations. We may not have seen base specifiers or virtual method declarations yet. llvm-svn: 200959
* Temporary fix for PR18473: Don't try to evaluate the initializer for aRichard Smith2014-02-061-7/+6
| | | | | | | | | | | | type-dependent variable, even if the initializer isn't value-dependent. This happens for ParenListExprs composed of non-value-dependent subexpressions, for instance. We should really give ParenListExprs (and InitListExprs) the type of the initialized entity if they're used to represent a dependent initialization (and if so, set them to be type-, value- and instantiation-dependent). llvm-svn: 200954
* PR18128: a lambda capture-default is not permitted for a non-local lambdaRichard Smith2014-02-061-1/+18
| | | | | | expression. llvm-svn: 200948
* MS ABI: Tweak pointer-to-member mangling/inheritance model selectionDavid Majnemer2014-02-062-0/+7
| | | | | | | | | | | | Properly determine the inheritance model when dealing with nullptr: - If a nullptr template argument is being checked against pointer-to-member parameter, nail down an inheritance model. N.B. We will chose an inheritance model even if we won't ultimately choose the template to instantiate! Cooky, right? - Null pointer-to-datamembers have a virtual base table offset of -1, not zero. Previously, we chose an offset of 0. llvm-svn: 200920
* Allow transformation of VariableArray to ConstantArray.Serge Pavlov2014-02-061-1/+3
| | | | | | | | | | | | | | | | | In the following code: struct A { static const int sz; }; template<class T> void f() { T arr[A::sz]; } the array 'arr' is represented as a variable size array in the template. If 'A::sz' gets value below in the translation unit, the array in instantiation can turn into constant size array. This change fixes PR18633. Differential Revision: http://llvm-reviews.chandlerc.com/D2688 llvm-svn: 200899
* DR101, PR12770: If a function is declared in the same context as aRichard Smith2014-02-062-13/+29
| | | | | | | | using-declaration, and they declare the same function (either because the using-declaration is in the same namespace as the declaration it imports, or because they're both extern "C"), they do not conflict. llvm-svn: 200897
* Don't consider records with a NULL identifier as a name for typo correction.Kaelyn Uhrain2014-02-051-1/+1
| | | | | | | | | Because in C++, "anonymous" doesn't mean "nameless" for records. In other words, RecordDecl::isAnonymousStructOrUnion only returns true if the record lacks a name *and* is not used as the type in an object's declaration. llvm-svn: 200868
* Don't mark decls with mismatching exception specs invalid in MS mode (PR18683)Hans Wennborg2014-02-051-7/+15
| | | | | | | | | We accept these with a warning in MS mode, but we would previously mark them invalid, causing us not to emit code for them. Differential Revision: http://llvm-reviews.chandlerc.com/D2681 llvm-svn: 200815
* Tighten lax vector-conversion rules and enforce them consistently.John McCall2014-02-042-103/+119
| | | | | | | | | | | | | | | | | | | | When a lax conversion featured a vector and a non-vector, we were only requiring the non-vector to be a scalar type, but really it needs to be a real type (i.e. integral or real floating); it is not reasonable to allow a pointer, member pointer, or complex type here. r198474 required lax conversions to match in "data size", i.e. element size * element count, forbidding matches that happen only because a vector is rounded up to the nearest power of two in size. Unfortunately, the erroneous logic was repeated in several different places; unify them to use the new condition, so that it triggers for arbitrary conversions and not just those performed as part of binary operator checking. rdar://15931426 llvm-svn: 200810
* Add implicit declarations of allocation functions when looking them up forRichard Smith2014-02-044-38/+44
| | | | | | | | redeclaration, not just when looking them up for a use -- we need the implicit declaration to appropriately check various properties of them (notably, whether they're deleted). llvm-svn: 200729
* Tidy up and reduce some comment redundancy.Richard Smith2014-02-031-34/+29
| | | | llvm-svn: 200723
* Fix a -Wmicrosoft warning about an unrepresentable enum valueReid Kleckner2014-02-031-1/+1
| | | | | | In MSVC, enums are always signed unless you explicitly specify the type. llvm-svn: 200719
* PR17846, PR17848: don't build a VarTemplateSpecializationDecl for a use of aRichard Smith2014-02-031-4/+7
| | | | | | variable template until we know what the template arguments actually are. llvm-svn: 200714
* Fix typo 'uusal'.Richard Smith2014-02-031-2/+2
| | | | llvm-svn: 200681
* Implement DR329. We already did the right thing here in C++98 mode, but r104014Richard Smith2014-02-031-47/+31
| | | | | | (which implemented the DR) was disabled in C++11. llvm-svn: 200673
* Sema: Reject templates in all extern "C" contexts.Benjamin Kramer2014-02-021-5/+6
| | | | | | | Otherwise we'd accept them if the LinkageDecl was not the direct parent DeclContext. PR17968. llvm-svn: 200641
* [Sema] Follow-up on r200521 for the -Wnon-literal-null-conversion warning ↵Argyrios Kyrtzidis2014-02-021-15/+1
| | | | | | and revert its behavior for C++. llvm-svn: 200622
* [Sema] For -Wnon-literal-null-conversion warning, look through integer ↵Argyrios Kyrtzidis2014-01-311-1/+15
| | | | | | | | | | casts, which are used by some projects in their null macro. rdar://15925483 llvm-svn: 200521
* [OPENMP] Bug fixes in threadprivate declaration and data sharing attributes ↵Alexey Bataev2014-01-311-34/+53
| | | | | | processing. (http://llvm-reviews.chandlerc.com/D2451) llvm-svn: 200513
* PR14995: Allow a dependent type as the second parameter of operator++ andRichard Smith2014-01-301-4/+3
| | | | | | | operator--, since it might instantiate as 'int' (or, if it's a pack, it might instantiate as an empty pack). llvm-svn: 200496
* Don't produce a 'returning reference to local' warning if a lambda returns aRichard Smith2014-01-301-0/+8
| | | | | | | reference (or pointer) to a variable from the closure object or from the surrounding function scope. llvm-svn: 200494
* Diagnose typedef names for linkage purposes that would changeJohn McCall2014-01-301-0/+21
| | | | | | | | | | | | | | a previously-computed linkage as an unsupportable error condition. Per discussion on cfe-commits, this appears to be a difficult-to-resolve flaw in our implementation approach; we may pursue this as a language defect, but for now it's better to diagnose it as unsupported than to produce inconsistent results (or assertions). Anything that we can do to limit how often this diagnostic fires, such as the changes in r200380, is probably for the best, though. llvm-svn: 200438
* Sema: Diagnose improper application of inheritance keywordsDavid Majnemer2014-01-292-2/+76
| | | | | | | | | | | We would previously allow inappropriate inheritance keywords to appear on class declarations. We would also allow inheritance keywords on templates which were not fully specialized; this was divergent from MSVC. Differential Revision: http://llvm-reviews.chandlerc.com/D2585 llvm-svn: 200423
* Short-circuit a couple of queries (and avoid corruptingJohn McCall2014-01-291-1/+7
| | | | | | | | | | | | | | the linkage cache) when type-checking static local variables. There's a very deep problem here where the linkage of a declaration can suddenly massively change as soon as it's given a typedef name; these fixes, while optimizations in their own right, are really just targeted workarounds. rdar://15928125 llvm-svn: 200380
* A new conversion warning for when an Objective-C object literal is implicitlyRichard Trieu2014-01-281-0/+7
| | | | | | | | | cast into a boolean true value. This warning will catch code like: if (@0) {} if (@"foo") {} llvm-svn: 200356
* Objective-C. Fixes a bug where "new" family attributeFariborz Jahanian2014-01-281-1/+2
| | | | | | | was not being overridden in the category method implementation resulting in bogus warning. // rdar://15919775 llvm-svn: 200342
* Relaxing the alignment requirements for fields in a transparent_union. Emits ↵Aaron Ballman2014-01-281-1/+6
| | | | | | | | the diagnostic only when subsequent alignments are more strict than the alignment required by the first field. Fixes PR15134 llvm-svn: 200277
* Apply the typo correction replacement location fix from r191450 to theKaelyn Uhrain2014-01-281-3/+5
| | | | | | | | case when correcting for too many arguments (r191450 had only fixed the problem for when there were too few arguments). Also fix the underlining for both cases. llvm-svn: 200268
* ObjectiveC. Fixes a bug in recognition of an ivarFariborz Jahanian2014-01-271-9/+8
| | | | | | | backing a property resulting in bogus warning. // rdar://15890251 llvm-svn: 200254
* Add a new attribute meta-spelling called "GCC" -- it widens into being a GNU ↵Aaron Ballman2014-01-271-3/+3
| | | | | | | | spelling, and a CXX11 spelling with the namespace "gnu". It also sets a bit on the spelling certifying that it is known to GCC. From this, we can warn about the extension appropriately. As a consequence, the FunctionDefinition functionality is completely removed. Replacing the functionality from r199676, which didn't solve the problem as elegantly. llvm-svn: 200252
* ObjectiveC. When introducing a new property declaration in Fariborz Jahanian2014-01-271-0/+12
| | | | | | | | parimary class and in mrr mode, assume property's default memory attribute (assign) and to prevent a bogus warning. // rdar://15859862 llvm-svn: 200238
* PR17052 / DR1560 (+DR1550): In a conditional expression between a glvalue and aRichard Smith2014-01-272-43/+30
| | | | | | | throw-expression, the result is also a glvalue and isn't unnecessarily coerced to a prvalue. llvm-svn: 200189
* Rename getResultLoc() tooAlp Toker2014-01-257-11/+11
| | | | | | | | Follow up to r200082. Spotted by Dmitri llvm-svn: 200105
* PR18530: Don't assert when performing error recovery after a missing ↵Richard Smith2014-01-251-12/+7
| | | | | | 'template<>' on a variable template explicit specialization. llvm-svn: 200099
* Rename getResultType() on function and method declarations to getReturnType()Alp Toker2014-01-2525-374/+342
| | | | | | | | | | | | | | | A return type is the declared or deduced part of the function type specified in the declaration. A result type is the (potentially adjusted) type of the value of an expression that calls the function. Rule of thumb: * Declarations have return types and parameters. * Expressions have result types and arguments. llvm-svn: 200082
* Broaden -Wstring-conversion to catch string literals in logical or expressions.Richard Trieu2014-01-251-5/+6
| | | | | | | | | | | | Previously, string literals were ignored in all logical expressions. This reduces it to only ignore in logical and expressions. assert(0 && "error"); // No warning assert(0 || "error"); // Warn Fixes PR17565 llvm-svn: 200056
* Adds a getSemanticSpelling function to semantic attribute subclasses which ↵Aaron Ballman2014-01-241-0/+5
| | | | | | have a meaningful semantic spelling. Adds a sibling function to parsed attribtues (via AttributeList) for getting the semantic spelling, if one were to exist. This can be used for cleaner code that deals directly with the semantic spellings (such as the MSInheritance attribute). llvm-svn: 200041
* Added missing StandardConversionSequence initializationIsmail Pazarbasi2014-01-241-0/+1
| | | | | | | This is the second msan failure where UserDefinedConversion does not initialize its `Before` member as identity conversion. llvm-svn: 199997
OpenPOWER on IntegriCloud