summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Rename getResultLoc() tooAlp Toker2014-01-251-2/+2
| | | | | | | | 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-251-47/+48
| | | | | | | | | | | | | | | 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
* Allow clang to compile the "extern" storage class in OpenCL 1.2. Pekka Jaaskelainen2014-01-231-1/+1
| | | | | | Patch from Fraser Cormack! llvm-svn: 199906
* Introduce and use Decl::getAsFunction() to simplify templated function checksAlp Toker2014-01-221-36/+14
| | | | | | | | | | | | | | Lift the getFunctionDecl() utility out of the parser into a general Decl::getAsFunction() and use it to simplify other parts of the implementation. Reduce isFunctionOrFunctionTemplate() to a simple type check that works the same was as the other is* functions and move unwrapping of shadowed decls to callers so it doesn't get run twice. Shuffle around canSkipFunctionBody() to reduce virtual dispatch on ASTConsumer. There's no need to query when we already know the body can't be skipped. llvm-svn: 199794
* Enforce restrictions that 'main' is not allowed to be deleted, or to be used byRichard Smith2014-01-221-2/+5
| | | | | | | | the program, in C++. (We allow the latter as an extension, since we've always permitted it, and GCC does the same, and our supported C++ ABIs don't do anything special in main.) llvm-svn: 199782
* Delay attribute checking until auto types are deducedNico Rieck2014-01-211-1/+6
| | | | | | | | | Checking in ActOnVariableDeclarator computes and caches the linkage using the non-deduced auto type which defaults to external linkage. Depending on how the auto type is deduced linkage can change and conflict with the cached linkage, hitting asserts. llvm-svn: 199774
* Rename FunctionProtoType accessors from 'arguments' to 'parameters'Alp Toker2014-01-201-20/+19
| | | | | | | | | | | | | | | | | Fix a perennial source of confusion in the clang type system: Declarations and function prototypes have parameters to which arguments are supplied, so calling these 'arguments' was a stretch even in C mode, let alone C++ where default arguments, templates and overloading make the distinction important to get right. Readability win across the board, especially in the casting, ADL and overloading implementations which make a lot more sense at a glance now. Will keep an eye on the builders and update dependent projects shortly. No functional change. llvm-svn: 199686
* Exposed a declarative way to specify that an attribute can be duplicated ↵Aaron Ballman2014-01-201-29/+2
| | | | | | when merging attributes on a declaration. This replaces some hard-coded functionality from Sema. llvm-svn: 199677
* Restrict redeclaration of tags introduced by using decls to MSVCCompatAlp Toker2014-01-181-2/+3
| | | | | | | This limits the facility added in r199490 while we seek clarification on the standard. llvm-svn: 199531
* Permit redeclaration of tags introduced by using declsAlp Toker2014-01-171-2/+3
| | | | | | | This valid construct appears in MSVC headers where it's used to provide a definition for the '::type_info' compiler builtin type. llvm-svn: 199490
* Clean up variable template handling a bit, and correct the behavior of nameRichard Smith2014-01-161-117/+84
| | | | | | lookup when declaring a variable template specialization. llvm-svn: 199438
* Distinguish between attributes explicitly written at the request of the ↵Aaron Ballman2014-01-161-27/+31
| | | | | | | | user, and attributes implicitly generated to assist in bookkeeping by the compiler. This is done so by table generating a CreateImplicit method for each attribute. Additionally, remove the optional nature of the spelling list index when creating attributes. This is supported by table generating a Spelling enumeration when the spellings for an attribute are distinct enough to warrant it. llvm-svn: 199378
* Fix for PR9812: warn about bool instead of _Bool.Erik Verbruggen2014-01-151-7/+9
| | | | llvm-svn: 199311
* Rename language option MicrosoftMode to MSVCCompatAlp Toker2014-01-141-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | There's been long-standing confusion over the role of these two options. This commit makes the necessary changes to differentiate them clearly, following up from r198936. MicrosoftExt (aka. fms-extensions): Enable largely unobjectionable Microsoft language extensions to ease portability. This mode, also supported by gcc, is used for building software like FreeBSD and Linux kernel extensions that share code with Windows drivers. MSVCCompat (aka. -fms-compatibility, formerly MicrosoftMode): Turn on a special mode supporting 'heinous' extensions for drop-in compatibility with the Microsoft Visual C++ product. Standards-compilant C and C++ code isn't guaranteed to work in this mode. Implies MicrosoftExt. Note that full -fms-compatibility mode is currently enabled by default on the Windows target, which may need tuning to serve as a reasonable default. See cfe-commits for the full discourse, thread 'r198497 - Move MS predefined type_info out of InitializePredefinedMacros' No change in behaviour. llvm-svn: 199209
* Fix "regression" caused by updating our notion of POD to better match the C++11Richard Smith2014-01-111-3/+8
| | | | | | | | rules: instead of requiring flexible array members to be POD, require them to be trivially-destructible. This seems to be the only constraint that actually matters here (and even then, it's questionable whether this matters). llvm-svn: 198983
* Have attribute 'objc_precise_lifetime' suppress -Wunused.Ted Kremenek2014-01-091-1/+2
| | | | | | | | | | Fixes <rdar://problem/15596883> In ARC, __attribute__((objc_precise_lifetime)) guarantees that the object stored in it will survive to the end of the variable's formal lifetime. It is therefore useful even if it completely unused. llvm-svn: 198888
* PR18400: ignore cv-qualifiers on the underlying type of an enumeration.Richard Smith2014-01-081-1/+1
| | | | llvm-svn: 198723
* PR18234: Mark a tag definition as invalid early if it appears in aRichard Smith2014-01-081-1/+13
| | | | | | | | type-specifier in C++. Some checks will assert in this case otherwise (in particular, the access specifier may be missing if this happens inside a class definition, due to a violation of an AST invariant). llvm-svn: 198721
* Highlight the previous underlying enum type when diagnosing a mismatchAlp Toker2014-01-061-1/+3
| | | | | | | | | | | | | | enum-scoped.cpp:93:6: error: enumeration redeclared with different underlying type 'short' (was 'int') enum Redeclare6 : short; ^ enum-scoped.cpp:92:6: note: previous declaration is here enum Redeclare6 : int; ^ ~~~ The redeclaration source range is still missing but this is a step forward, potentially edging towards a FixIt. llvm-svn: 198601
* Diagnose enum redeclarations properlyAlp Toker2014-01-061-3/+3
| | | | | | | | | | | | | | | | | | In all three checks, the note indicates a previous declaration and never a 'use'. Before: enum-scoped.cpp:92:6: note: previous use is here enum Redeclare6 : int; ^ After: enum-scoped.cpp:92:6: note: previous declaration is here enum Redeclare6 : int; ^ llvm-svn: 198600
* [OpenCL] Produce an error if an address space is used on the returnJoey Gouly2014-01-061-0/+13
| | | | | | type of a function. llvm-svn: 198597
* Fix 'declartion' typosAlp Toker2014-01-051-2/+2
| | | | llvm-svn: 198549
* [objc] Refactor and improve functionality for the -Wunused-property-ivar ↵Argyrios Kyrtzidis2014-01-031-1/+0
| | | | | | | | | | | | | | warning. - Remove the additions to ObjCMethodDecl & ObjCIVarDecl that were getting de/serialized and consolidate all functionality for the checking for this warning in Sema::DiagnoseUnusedBackingIvarInAccessor - Don't check immediately after the method body is finished, check when the @implementation is finished. This is so we can see if the ivar was referenced by any other method, even if the method was defined after the accessor. - Don't silence the warning if any method is called from the accessor silence it if the accessor delegates to another method via self. rdar://15727325 llvm-svn: 198432
* Removing an unneeded typecast. getScopeRep() already returns a ↵Aaron Ballman2014-01-031-1/+1
| | | | | | NestedNameSpecifier. llvm-svn: 198419
* [OpenCL] Variables in the constant address space must be initialized.Joey Gouly2014-01-031-0/+10
| | | | llvm-svn: 198417
* It turns out the problem was a bit more wide-spread. Removing a lot of ↵Aaron Ballman2014-01-031-1/+1
| | | | | | | | unneeded typecasts. getScopeRep() already returns a NestedNameSpecifier. No functional changes intended. llvm-svn: 198414
* Removing some more unnecessary manual quotes from diagnostics. Updated the ↵Aaron Ballman2014-01-031-1/+1
| | | | | | related test case to ensure correctness. llvm-svn: 198412
* Removing some more unnecessary manual quotes from diagnostics.Aaron Ballman2014-01-031-2/+2
| | | | llvm-svn: 198395
* Removed an unnecessary %select from the alignas diagnostics. The attribute ↵Aaron Ballman2014-01-021-4/+4
| | | | | | already knows how it was spelled. llvm-svn: 198375
* Removing some manual quotes from this diagnostic, since the AST diagnostics ↵Aaron Ballman2014-01-021-1/+1
| | | | | | engine knows how to handle NamedDecl objects. llvm-svn: 198365
* Teach the diagnostics engine about the Attr type to make reporting on ↵Aaron Ballman2013-12-261-3/+3
| | | | | | semantic attributes easier (and not require hard-coded strings). This requires a getSpelling() function on the Attr class, which is table-driven. Updates a handful of cases where a hard-coded string was being used to test the functionality out. Updating associated test cases for the improved quoting. llvm-svn: 198055
* Removed a string literal for an attribute name, which means the attribute ↵Aaron Ballman2013-12-261-1/+1
| | | | | | name will be quoted in the diagnostic. Manually added some quotes to a diagnostic for consistency. Updated the test cases as appropriate. llvm-svn: 198054
* Don't mark record decls invalid when one of its methods is invalid, PR18284.Nico Weber2013-12-211-6/+1
| | | | | | | | | | | | | | | Without this patch, record decls with invalid out-of-line method delcs would sometimes be marked invalid, but not always. With this patch, they are consistently never marked invalid. (The code to do this was added in http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20100809/033154.html , but the test from that revision is still passing.) As far as I can tell, this was the only place where a class was marked invalid after its definition was complete. llvm-svn: 197848
* Switched code from using hasAttr followed by getAttr to simply call getAttr ↵Aaron Ballman2013-12-191-10/+9
| | | | | | | | directly and check the resulting value. No functional changes intended. llvm-svn: 197678
* Replacing calls to getAttr with calls to hasAttr for clarity. No functional ↵Aaron Ballman2013-12-191-12/+12
| | | | | | change intended -- this only replaces Boolean uses of getAttr. llvm-svn: 197648
* [ms-cxxabi] Don't do destructor check on declarations if the dtor is deletedHans Wennborg2013-12-171-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | We would previously emit redundant diagnostics for the following code: struct S { virtual ~S() = delete; void operator delete(void*, int); void operator delete(void*, double); } s; First we would check on ~S() and error about the ambigous delete functions, and then we would error about using the deleted destructor. If the destructor is deleted, there's no need to check it. Also, move the check from Sema::ActOnFields to CheckCompleteCXXClass. These are run at almost the same time, called from ActOnFinishCXXMemberSpecification. However, CHeckCompleteCXXClass may mark a defaulted destructor as deleted, and if that's the case we don't want to check it. Differential Revision: http://llvm-reviews.chandlerc.com/D2421 llvm-svn: 197509
* Revert "Maybe add new warning for shadowing simple tag types"Kaelyn Uhrain2013-12-161-7/+1
| | | | | | | | | This reverts commit 2b43f500cfea10a8c59c986dcfc24fd08eecc77d. This was accidentally committed because I failed to notice my client wasn't clean prior to submitting a fix for a crasher. llvm-svn: 197410
* Maybe add new warning for shadowing simple tag typesKaelyn Uhrain2013-12-161-1/+7
| | | | llvm-svn: 197408
* [ms-abi] Fixing bitfields sema arror for ms-modeWarren Hunt2013-12-121-1/+2
| | | | | | | | The check for bitfields that are longer than their base type needed to be checked in microsoft mode (cl.exe does not support the C++ extnetion for bitfields longer than their type). llvm-svn: 197186
* Suppress -Wshadow / -Wold-style-cast expanded from system header macrosAlp Toker2013-12-121-0/+2
| | | | | | | | Thanks to Jonathan Sauer for providing initial test cases. Fixes PR16093 and PR18147. llvm-svn: 197150
* Implement DR1460: fix handling of default initializers in unions; don't allowRichard Smith2013-12-101-9/+51
| | | | | | | | | more than one such initializer in a union, make mem-initializers override default initializers for other union members, handle anonymous unions with anonymous struct members better. Fix a couple of semi-related bugs exposed by the tests for same. llvm-svn: 196892
* Fix a tranche of comment, test and doc typosAlp Toker2013-12-051-2/+2
| | | | llvm-svn: 196510
* Implement DR482: namespace members can be redeclared with a qualified nameRichard Smith2013-12-051-20/+19
| | | | | | | | | | within their namespace, and such a redeclaration isn't required to be a definition any more. Update DR status page to say Clang 3.4 instead of SVN and add new Clang 3.5 category (but keep Clang 3.4 yellow for now). llvm-svn: 196481
* Correct hyphenations in comments and assert messagesAlp Toker2013-12-051-2/+2
| | | | | | | This patch tries to avoid unrelated changes other than fixing a few hyphen-related ambiguities in nearby lines. llvm-svn: 196466
* Per [dcl.meaning]p1, a name in an inline namespace can be redeclared using aRichard Smith2013-12-051-19/+19
| | | | | | | name from the enclosing namespace set if the name is specified as a qualified-id. llvm-svn: 196464
* Fix for PR18052 - Lambdas within NSDMI's and default arguments in Nested ↵Faisal Vali2013-12-041-1/+10
| | | | | | | | | | | | | | | | | | | | | | classes. Clang currently croaks on the following: struct X1 { struct X2 { int L = ([] (int i) { return i; })(2); }; }; asserting that the containing lexical context of the lambda is not Sema's cur context, when pushing the lambda's decl context on. This occurs because (prior to this patch) getContainingDC always returns the non-nested class for functions at class scope (even for inline member functions of nested classes (to account for delayed parsing of their bodies)). The patch addresses this by having getContainingDC always return the lexical DC for a lambda's call operator. Link to the bug: http://llvm.org/bugs/show_bug.cgi?id=18052 Link to Richard Smith's feedback on phabricator: http://llvm-reviews.chandlerc.com/D2331 Thanks! llvm-svn: 196423
* [objc] Emit warning when the implementation of a secondary initializer calls onArgyrios Kyrtzidis2013-12-031-0/+4
| | | | | | | | | | | super another initializer and when the implementation does not delegate to another initializer via a call on 'self'. A secondary initializer is an initializer method not marked as a designated initializer within a class that has at least one initializer marked as a designated initializer. llvm-svn: 196318
* [objc] Emit warnings when the implementation of a designated initializer ↵Argyrios Kyrtzidis2013-12-031-2/+2
| | | | | | | | calls on super an initializer that is not a designated one or any initializer on self. llvm-svn: 196317
* [objc] Emit a warning when the implementation of a designated initializer ↵Argyrios Kyrtzidis2013-12-031-0/+12
| | | | | | | | does not chain to an init method that is a designated initializer for the superclass. llvm-svn: 196316
OpenPOWER on IntegriCloud