summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/Sema.h
Commit message (Collapse)AuthorAgeFilesLines
* Add a warning to catch a bug recently caught by code review, like this:Chris Lattner2010-07-131-1/+1
| | | | | | | | | | | t2.c:2:12: warning: use of logical && with constant operand; switch to bitwise & or remove constant [-Wlogical-bitwise-confusion] return x && 4; ^ ~ wording improvement suggestions are welcome. llvm-svn: 108260
* 80 column issues.Chris Lattner2010-07-131-7/+9
| | | | llvm-svn: 108257
* Downgrade the "when type is in parentheses, array cannot have dynamicDouglas Gregor2010-07-131-2/+2
| | | | | | | | | | | | size" error for code like new (int [size]) to a warning, add a Fix-It to remove the parentheses, and make this diagnostic work properly when it occurs in a template instantiation. <rdar://problem/8018245>. llvm-svn: 108242
* Fix PR7600, and correctly convert the result of an atomic builtin to theChandler Carruth2010-07-091-1/+1
| | | | | | | | | expected value type. This is necessary as the builtin is internally represented as only operating on integral types. Also, add a FIXME to add support for floating point value types. llvm-svn: 108002
* Instantiation of block literal expressions. wip.Fariborz Jahanian2010-07-091-1/+1
| | | | llvm-svn: 108000
* Support code completion for parameter names in Objective-C methodDouglas Gregor2010-07-081-0/+1
| | | | | | declarations. llvm-svn: 107933
* Introduce a new code-completion point prior to an identifier in theDouglas Gregor2010-07-081-0/+6
| | | | | | | | | | | | selector of an Objective-C method declaration, e.g., given - (int)first:(int)x second:(int)y; this code completion point triggers at the location of "second". It will provide completions that fill out the method declaration for any known method, anywhere in the translation unit. llvm-svn: 107929
* Fix multiple emission of the this-> fixit for each instantiation by fixing theNick Lewycky2010-07-061-0/+7
| | | | | | AST during the instantiation. Fixes PR7417! llvm-svn: 107690
* Introduce a new routine, LookupConstructors(), and use it for allDouglas Gregor2010-07-021-0/+1
| | | | | | constructor-name lookup. llvm-svn: 107536
* Lazily declare the implicitly-declared destructor in a C++ class.Douglas Gregor2010-07-021-0/+4
| | | | llvm-svn: 107510
* Move the "current scope" state from the Parser into Action. ThisDouglas Gregor2010-07-021-15/+8
| | | | | | | | | | | | | | allows Sema some limited access to the current scope, which we only use in one way: when Sema is performing some kind of declaration that is not directly driven by the parser (e.g., due to template instantiatio or lazy declaration of a member), we can find the Scope associated with a DeclContext, if that DeclContext is still in the process of being parsed. Use this to make the implicit declaration of special member functions in a C++ class more "scope-less", rather than using the NULL Scope hack. llvm-svn: 107491
* Add a new routine Sema::LookupDestructor and make all destructor-lookup ↵Douglas Gregor2010-07-011-1/+2
| | | | | | calls use that routine llvm-svn: 107444
* Move the implicit declaration of a default constructor into a separateDouglas Gregor2010-07-011-0/+12
| | | | | | routine; no functionality change. llvm-svn: 107434
* Move the implicit declaration of a constructor out to a separateDouglas Gregor2010-07-011-1/+13
| | | | | | method. No functionality change. llvm-svn: 107415
* Move declaration of a class's implicit copy constructor into aDouglas Gregor2010-07-011-0/+12
| | | | | | | separate function. Aside from making the loops infinitely faster, no functionality change. llvm-svn: 107407
* Move the implicit declaration of a class's copy-assignment operatorDouglas Gregor2010-07-011-1/+13
| | | | | | into a separate routine. No functionality change. llvm-svn: 107402
* Reinstate fix for PR7526, which was failing because, now that weDouglas Gregor2010-07-011-1/+1
| | | | | | | | | | | | | | | aren't dropping all exception specifications on destructors, the exception specifications on implicitly-declared destructors were detected as being wrong (which they were). Introduce logic to provide a proper exception-specification for implicitly-declared destructors. This also fixes PR6972. Note that the other implicitly-declared special member functions also need to get exception-specifications. I'll deal with that in a subsequent commit. llvm-svn: 107385
* Revert r107374, which broke bootstrap.Douglas Gregor2010-07-011-1/+1
| | | | llvm-svn: 107378
* When building the type of a destructor, make sure to keep theDouglas Gregor2010-07-011-1/+1
| | | | | | exception specification. Fixes PR7526. llvm-svn: 107374
* Implement C++ DR481, which clarifies that the scope of templateDouglas Gregor2010-07-011-13/+9
| | | | | | | | | | | | | | | | | parameters starts at the end of the template-parameter rather than at the point where the template parameter name is encounted. For example, given: typedef unsigned char T; template<typename T = T> struct X0 { }; The "T" in the default argument refers to the typedef of "unsigned char", rather than referring to the newly-introduced template type parameter 'T'. Addresses <rdar://problem/8122812>. llvm-svn: 107354
* Implement C++ DR299, which allows an implicit conversion from a classDouglas Gregor2010-06-301-1/+2
| | | | | | | | | | | type to an integral or enumeration type in the size of an array new expression, e.g., new int[ConvertibleToInt(10)]; This is a GNU and C++0x extension. llvm-svn: 107229
* Factor the conversion from a switch condition to an integral orDouglas Gregor2010-06-291-0/+9
| | | | | | | | enumeration type out into a separate, reusable routine. The only functionality change here is that we recover a little more aggressively from ill-formed switch conditions. llvm-svn: 107222
* This patch fixes a bug whereby, clang skipped Fariborz Jahanian2010-06-291-9/+2
| | | | | | | | | unimplemented property warning for properties coming from class's conformin protocol. It also simplifies the algorithm in the process. Fixes radar 8035776. llvm-svn: 107174
* Allow a using directive to refer to the implicitly-defined namespaceDouglas Gregor2010-06-291-0/+1
| | | | | | | | "std", with a warning, to improve GCC compatibility. Fixes PR7517. As a drive-by, add typo correction for using directives. llvm-svn: 107172
* Partial fix for PR7267 based on comments by John McCall on an earlier patch.Chandler Carruth2010-06-281-0/+6
| | | | | | | | | | | | | | | | | | This is more targeted, as it simply provides toggle actions for the parser to turn access checking on and off. We then use these to suppress access checking only while we parse the template-id (included scope specifier) of an explicit instantiation and explicit specialization of a class template. The specialization behavior is an extension, as it seems likely a defect that the standard did not exempt them as it does explicit instantiations. This allows the very common practice of specializing trait classes to work for private, internal types. This doesn't address instantiating or specializing function templates, although those apparently already partially work. The naming and style for the Action layer isn't my favorite, comments and suggestions would be appreciated there. llvm-svn: 106993
* Implement dependent alignment attribute support. This is a bit gross given theChandler Carruth2010-06-251-0/+3
| | | | | | | | | | | | | current attribute system, but it is enough to handle class templates which specify parts of their alignment in terms of their template parameters. This also replaces the attributes test in SemaTemplate with one that actually tests working attributes instead of broken ones. I plan to add more tests here for non-dependent attributes in a subsequent patch. Thanks to John for walking me through some of this. =D llvm-svn: 106818
* When we see a 'template' disambiguator that marks the next identifierDouglas Gregor2010-06-161-6/+7
| | | | | | | | | | | (or operator-function-id) as a template, but the context is actually non-dependent or the current instantiation, allow us to use knowledge of what kind of template it is, e.g., type template vs. function template, for further syntactic disambiguation. This allows us to parse properly in the presence of stray "template" keywords, which is necessary in C++0x and it's good recovery in C++98/03. llvm-svn: 106167
* Fix the recently-added warning about 'typename' and 'template'Douglas Gregor2010-06-161-5/+10
| | | | | | | | | disambiguation keywords outside of templates in C++98/03. Previously, the warning would fire when the associated nested-name-specifier was not dependent, but that was a misreading of the C++98/03 standard: now, we complain only when we're outside of any template. llvm-svn: 106161
* Fix a point of semantics with using declaration hiding: method templatesJohn McCall2010-06-161-4/+7
| | | | | | | | | | | | | | | | | introduced by using decls are hidden even if their template parameter lists or return types differ from the "overriding" declaration. Propagate using shadow declarations around more effectively when looking up template-ids. Reperform lookup for template-ids in member expressions so that access control is properly set up. Fix some number of latent bugs involving template-ids with totally invalid base types. You can only actually get these with a scope specifier, since otherwise the template-id won't parse as a template-id. Fixes PR7384. llvm-svn: 106093
* Tweak our handling of the notion of a standard conversion sequenceDouglas Gregor2010-06-091-2/+0
| | | | | | | | | | | | | being a subsequence of another standard conversion sequence. Instead of requiring exact type equality for the second conversion step, require type *similarity*, which is type equality with cv-qualifiers removed at all levels. This appears to match the behavior of EDG and VC++ (albeit not GCC), and feels more intuitive. Big thanks to John for the line of reasoning that supports this change: since cv-qualifiers are orthogonal to the second conversion step, we should ignore them in the type comparison. llvm-svn: 105678
* Since the enum values for each arch's builtins overlap, it is not ↵Nate Begeman2010-06-081-0/+3
| | | | | | appropriate to check them when compiling or other archs. Fixes a problem where compiling for NEON would use x86 sema rules. llvm-svn: 105593
* PR7245: Make binding a reference to a temporary without a usable copyJeffrey Yasskin2010-06-071-1/+2
| | | | | | constructor into an extension warning into the error that C++98 requires. llvm-svn: 105529
* Simplify the methods for creating a pointer, reference, member-pointer,John McCall2010-06-051-4/+8
| | | | | | | or block-pointer type by removing the qualifiers parameter. Introduce a method to perform semantic checking when adding qualifiers to a type. llvm-svn: 105526
* Added AccessSpecDecl node.Abramo Bagnara2010-06-051-0/+4
| | | | llvm-svn: 105525
* Alter the interface of GetTypeForDeclarator to return a TypeSourceInfo*.John McCall2010-06-041-3/+2
| | | | | | This is never null, but the associated type might be. llvm-svn: 105503
* Remember type source information for Objective C property declarations.John McCall2010-06-041-2/+3
| | | | llvm-svn: 105484
* Preserve more information from a block's original function declarator, if oneJohn McCall2010-06-041-7/+8
| | | | | | | was given. Remove some unnecessary accounting from BlockScopeInfo. Handle typedef'ed function types until such time as we decide not. llvm-svn: 105478
* Restructure how we interpret block-literal declarators. Correctly handleJohn McCall2010-06-041-0/+3
| | | | | | | the case where we pick up block arguments from a typedef. Save the block signature as it was written, and preserve same through PCH. llvm-svn: 105466
* More refactoring.John McCall2010-06-041-0/+7
| | | | llvm-svn: 105458
* Teach code completion to adjust its completion priorities based on theDouglas Gregor2010-05-301-0/+5
| | | | | | | | | type that we expect to see at a given point in the grammar, e.g., when initializing a variable, returning a result, or calling a function. We don't prune the candidate set at all, just adjust priorities to favor things that should type-check, using an ultra-simplified type system. llvm-svn: 105128
* A more minimal fix for PR6762.John McCall2010-05-281-0/+4
| | | | llvm-svn: 104991
* Implement a code-completion hook for the receiver of an Objective-CDouglas Gregor2010-05-271-1/+1
| | | | | | | message. This completion gives better results than just using the "expression" completion, which is effectively what happened before. llvm-svn: 104895
* Sema: Replace getPragmaPackAlignment with AddAlignmentAttributesForRecord, whichDaniel Dunbar2010-05-271-3/+3
| | | | | | exposes less details. llvm-svn: 104797
* Sema: Support for #pragma options align={reset,natural}. '#pragma options align'Daniel Dunbar2010-05-271-0/+5
| | | | | | shares the stack with '#pragma pack', who knew!? llvm-svn: 104786
* Improve parser recovery when we encounter a dependent template nameDouglas Gregor2010-05-211-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that is missing the 'template' keyword, e.g., t->getAs<T>() where getAs is a member of an unknown specialization. C++ requires that we treat "getAs" as a value, but that would fail to parse since T is the name of a type. We would then fail at the '>', since a type cannot be followed by a '>'. This is a very common error for C++ programmers to make, especially since GCC occasionally allows it when it shouldn't (as does Visual C++). So, when we are in this case, we use tentative parsing to see if the tokens starting at "<" can only be parsed as a template argument list. If so, we produce a diagnostic with a fix-it that states that the 'template' keyword is needed: test/SemaTemplate/dependent-template-recover.cpp:5:8: error: 'template' keyword is required to treat 'getAs' as a dependent template name t->getAs<T>(); ^ template This is just a start of this patch; I'd like to apply the same approach to everywhere that a template-id with dependent template name can be parsed. llvm-svn: 104406
* Propagate access specifiers to anonymous union members nested within classes.John McCall2010-05-211-3/+3
| | | | | | Fixes <rdar://problem/7987650>. llvm-svn: 104376
* Added basic source locations to Elaborated and DependentName types.Abramo Bagnara2010-05-191-1/+3
| | | | llvm-svn: 104169
* Fix a GCC warning about inline functions not being defined. Until r104081, onlyChandler Carruth2010-05-191-3/+3
| | | | | | | | | the same .cpp file as provided the definitions referenced these functions, hiding the issue. However, they are clearly no longer inline. Let me know if there is a reason to move their definitions to the header and make them truly inline. llvm-svn: 104104
* Teach CursorVisitor about duplicate ObjCPropertyDecls that can arise because ↵Ted Kremenek2010-05-181-1/+2
| | | | | | | | | | of a current design limitation in how we handle Objective-C class extensions. This was causing the CursorVisitor to essentially visit an @property twice (once in the @interface, the other in the class extension). Fixes <rdar://problem/7410145>. llvm-svn: 104055
* Tweak typo-correction logic a bit regarding "super", so that weDouglas Gregor2010-05-181-1/+2
| | | | | | | | | consider "super" as a candidate whenever we're parsing an expression within an Objective-C method in an interface that has a superclass. At some point, we'd like to give "super" a little edge over non-local names; that will come later. llvm-svn: 104022
OpenPOWER on IntegriCloud