summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
* If an instantiation of a template is required to be a complete type, checkRichard Smith2014-05-071-1/+6
| | | | | | | whether the definition of the template is visible rather than checking whether the instantiated definition happens to be in an imported module. llvm-svn: 208150
* Make module self-import an errorBen Langmuir2014-05-051-0/+7
| | | | | | | | Ideally, importing Foo.a from Foo.b would "do the right thing", but until it does, this patch makes it an error rather than allow it to silently be ignored. llvm-svn: 207948
* Minor cleanups, no behavior change.Nico Weber2014-05-031-11/+9
| | | | | | | | | | * Fixes a "return" that was indented at the same level as the continuation from the previous line * Wrap several lines to 80 columns * Remove an if check that was always true * Move a variable declaration slightly closer to its use llvm-svn: 207922
* Fix a bunch of mislayered clang/Lex includes from SemaAlp Toker2014-05-031-19/+19
| | | | llvm-svn: 207896
* Rewrite NRVO determination. Track NRVO candidates on the parser Scope and ↵Nick Lewycky2014-05-031-17/+8
| | | | | | | | apply the NRVO candidate flag to all possible NRVO candidates here, and remove the flags in computeNRVO or upon template instantiation. A variable now has NRVO applied if and only if every return statement in that scope returns that variable. This is nearly optimal. Performs NRVO roughly 7% more often in a bootstrap build of clang. Patch co-authored by Richard Smith. llvm-svn: 207890
* __thread: Move constant init check to CheckCompleteVariableDeclarationReid Kleckner2014-04-301-21/+20
| | | | | | | | | | We were emitting dynamic initializers for __thread variables if there was no explicit initializer, as in this test case: struct S { S(); }; __thread S s; llvm-svn: 207675
* -Wunused-parameter: Don't fire on defaulted or deleted functionsReid Kleckner2014-04-301-1/+3
| | | | | | | | Patch by Dinesh Dwivedi! Differential Revision: http://reviews.llvm.org/D3376 llvm-svn: 207672
* CodeGen: Fix linkage of reference temporariesDavid Majnemer2014-04-281-1/+2
| | | | | | | | | | | | | | | Summary: A reference temporary should inherit the linkage of the variable it initializes. Otherwise, we may hit cases where a reference temporary wouldn't have the same value in all translation units. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3515 llvm-svn: 207451
* PR19558: don't produce an "unused variable" warning for a variable template ↵Richard Smith2014-04-251-1/+2
| | | | | | partial specialization. llvm-svn: 207260
* Initial implementation of -modules-earch-all option, for searching for ↵John Thompson2014-04-231-6/+9
| | | | | | symbols in non-imported modules. llvm-svn: 206977
* Nitpicky refactoring -- use of nullptr and auto, made a bit more ↵Aaron Ballman2014-04-171-12/+12
| | | | | | const-correct. No functional changes intended. llvm-svn: 206491
* Refactor all the checking for missing 'template<>'s when a declaration has aRichard Smith2014-04-171-43/+24
| | | | | | template-id after its scope specifier into a single place. llvm-svn: 206442
* Don't emit an ExtWarn on declarations of variable template specializations;Richard Smith2014-04-171-6/+6
| | | | | | | we'll already have issued the relevant diagnostic when we saw the declaration of the primary template. llvm-svn: 206441
* [objc] -[NSObject init] is documented to not do anything, don't warn if ↵Argyrios Kyrtzidis2014-04-161-2/+14
| | | | | | | | subclasses do not call [super init] on their initializers. Part of rdar://16568441 llvm-svn: 206410
* Fix a comment to match the implementationAlp Toker2014-04-151-1/+1
| | | | llvm-svn: 206298
* Allow address space qualifiers on OpenCL array parametersFraser Cormack2014-04-151-2/+6
| | | | llvm-svn: 206275
* Improve error recovery around colon.Serge Pavlov2014-04-131-4/+3
| | | | | | | | | | Parse of nested name spacifier is modified so that it properly recovers if colon is mistyped as double colon in case statement. This patch fixes PR15133. Differential Revision: http://llvm-reviews.chandlerc.com/D2870 llvm-svn: 206135
* [MS-ABI] Add support for #pragma section and related pragmasWarren Hunt2014-04-081-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for the msvc pragmas section, bss_seg, code_seg, const_seg and data_seg as well as support for __declspec(allocate()). Additionally it corrects semantics and adds diagnostics for __attribute__((section())) and the interaction between the attribute and the msvc pragmas and declspec. In general conflicts should now be well diganosed within and among these features. In supporting the pragmas new machinery for uniform lexing for msvc pragmas was introduced. The new machinery always lexes the entire pragma and stores it on an annotation token. The parser is responsible for parsing the pragma when the handling the annotation token. There is a known outstanding bug in this implementation in C mode. Because these attributes and pragmas apply _only_ to definitions, we process them at the time we detect a definition. Due to tentative definitions in C, we end up processing the definition late. This means that in C mode, everything that ends up in a BSS section will end up in the _last_ BSS section rather than the one that was live at the time of tentative definition, even if that turns out to be the point of actual definition. This issue is not known to impact anything as of yet because we are not aware of a clear use or use case for #pragma bss_seg but should be fixed at some point. Differential Revision=http://reviews.llvm.org/D3065#inline-16241 llvm-svn: 205810
* Fix clang-tidy warning (argument comments don't match parameter names).Richard Smith2014-04-071-3/+3
| | | | llvm-svn: 205715
* PR19305: Don't issue -Wunused-variable warnings on variable templates. It's notRichard Smith2014-04-021-2/+4
| | | | | | | | | | | meaningful to odr-use the VarDecl inside a variable template. (Separately, it'd be nice to track referenced-ness for templates, and warn on unused ones, but that's really a distinct issue...) Move a test that generates and tests a warning-suppressing error out to its own test file, so it doesn't have weird effects on the other tests in the same file. llvm-svn: 205448
* Sema: Require external linkage for dll attributesNico Rieck2014-03-311-0/+16
| | | | llvm-svn: 205198
* Sema: Check dll attributes on redeclarationsNico Rieck2014-03-311-11/+62
| | | | | | | A redeclaration may not add dllimport or dllexport attributes. dllexport is sticky and can be omitted on redeclarations while dllimport cannot. llvm-svn: 205197
* Enforce the restriction that a parameter to a kernel functionDavid Tweed2014-03-271-2/+15
| | | | | | | | | cannot be a pointer to the private address space (as clarified in the OpenCL 1.2 specification). Patch by Fraser Cormack! llvm-svn: 204941
* PR19252: Fix crash if alignas is used with an auto-typed variable. Don't checkRichard Smith2014-03-271-4/+3
| | | | | | the type of the variable until it's known. llvm-svn: 204887
* Treat dllimport globals without explicit storage class as externNico Rieck2014-03-231-0/+38
| | | | | | | dllimport implies a definition which means the 'extern' keyword is optional when declaring imported variables. llvm-svn: 204576
* [C++11] Replacing Scope iterators decl_begin() and decl_end() with ↵Aaron Ballman2014-03-171-3/+1
| | | | | | iterator_range decls(). Updating all of the usages of the iterators with range-based for loops, and removing the no-longer-needed iterator versions. llvm-svn: 204052
* [C++11] Replacing FunctionProtoType iterators param_type_begin() and ↵Aaron Ballman2014-03-171-16/+7
| | | | | | param_type_end() with iterator_range param_types(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 204045
* Objective-C. Redo turning off designated initialization warnings onFariborz Jahanian2014-03-141-5/+10
| | | | | | | | 'init' methods which are unavailable. Subclasses of NSObject have to implement such methods as a common pattern to prevent user's own implementation. // rdar://16305460 llvm-svn: 203984
* [C++11] Removing the found_decls_begin() and found_decls_end() APIs and ↵Aaron Ballman2014-03-141-3/+2
| | | | | | replacing with a range-only found_decls() API. llvm-svn: 203975
* [C++11] Replacing ObjCInterfaceDecl iterators known_extensions_begin() and ↵Aaron Ballman2014-03-131-4/+1
| | | | | | known_extensions_end() with iterator_range known_extensions(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203857
* [C++11] Replacing CXXRecordDecl iterators capture_begin() and capture_end() ↵Aaron Ballman2014-03-131-10/+9
| | | | | | with iterator_range captures(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203817
* [C++11] Replacing CXXRecordDecl iterators bases_begin() and bases_end() with ↵Aaron Ballman2014-03-131-3/+2
| | | | | | iterator_range bases(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203803
* Fix crash if delayed template parsing meets an erroneous trailing return type.Richard Smith2014-03-121-0/+24
| | | | | | | Based on a patch and test by Stephan Tolksdorf! Refactoring and fixing adjacent brokenness by me. llvm-svn: 203733
* DR1346: a parenthesized braced-init-list cannot be used as the initializer whenRichard Smith2014-03-121-0/+5
| | | | | | performing auto type deduction. llvm-svn: 203683
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-121-2/+2
| | | | | | class. llvm-svn: 203640
* [C++11] Replacing DeclBase iterators specific_attr_begin() and ↵Aaron Ballman2014-03-101-27/+15
| | | | | | specific_attr_end() with iterator_range specific_attrs(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203474
* [C++11] Replacing Decl iterators attr_begin() and attr_end() with ↵Aaron Ballman2014-03-081-9/+6
| | | | | | | | iterator_range attrs(). Updating all of the usages of the iterators with range-based for loops. This is a reapplication of r203236 with modifications to the definition of attrs() and following the new style guidelines on auto usage. llvm-svn: 203362
* [C++11] Replacing RecordDecl iterators field_begin() and field_end() with ↵Aaron Ballman2014-03-081-3/+1
| | | | | | iterator_range fields(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203355
* [C++11] Replacing EnumDecl iterators enumerator_begin() and enumerator_end() ↵Aaron Ballman2014-03-081-4/+3
| | | | | | with iterator_range enumerators(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203353
* [C++11] Replacing DeclBase iterators decls_begin() and decls_end() with ↵Aaron Ballman2014-03-071-30/+22
| | | | | | iterator_range decls(). The same is true for the noload versions of these APIs. Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203278
* Renaming the chains() ranged iterator to chain() per suggestion by Richard ↵Aaron Ballman2014-03-071-1/+1
| | | | | | Smith. llvm-svn: 203262
* [C++11] Replacing IndirectFieldDecl iterators chain_begin() and chain_end() ↵Aaron Ballman2014-03-071-3/+2
| | | | | | with iterator_range chains(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203261
* [C++11] Replacing FunctionDecl iterators param_begin() and param_end() with ↵Aaron Ballman2014-03-071-6/+2
| | | | | | iterator_range params(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203248
* Fully reverting r203236 -- it seems the only bots that are happy are the ↵Aaron Ballman2014-03-071-6/+9
| | | | | | MSVC bots. llvm-svn: 203237
* [C++11] Replacing iterators attr_begin() and attr_end() with iterator_range ↵Aaron Ballman2014-03-071-9/+6
| | | | | | attrs(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203236
* [C++11] Replacing iterators redecls_begin() and redecls_end() with ↵Aaron Ballman2014-03-061-6/+3
| | | | | | iterator_range redecls(). Updating all of the usages of the iterators with range-based for loops, which allows the begin/end forms to be removed entirely. llvm-svn: 203179
* Tests for DR370-380.Richard Smith2014-03-051-2/+2
| | | | | | | Also promote a couple of Warnings on ill-formed code found by this testing to ExtWarns. llvm-svn: 203021
* AST: Remove layering violation with SemaDavid Majnemer2014-03-051-4/+8
| | | | | | Scope lives in Sema and cannot be used in AST. Shuffle things around. llvm-svn: 202993
* [-cxx-abi microsoft] Implement local manglings accuratelyDavid Majnemer2014-03-051-6/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The MSVC ABI appears to mangle the lexical scope into the names of statics. Specifically, a counter is incremented whenever a scope is entered where things can be declared in such a way that an ambiguity can arise. For example, a class scope inside of a class scope doesn't do anything interesting because the nested class cannot collide with another nested class. There are problems with this scheme: - It is unreliable. The counter is only incremented when a previously never encountered scope is entered. There are cases where this will cause ambiguity amongst declarations that have the same name where one was introduced in a deep scope while the other was introduced right after in the previous lexical scope. - It is wasteful. Statements like: {{{{{{{ static int foo = a; }}}}}}} will make the mangling of "foo" larger than it need be because the scope counter has been incremented many times. Because of these problems, and practical implementation concerns. We choose not to implement this scheme if the local static or local type isn't visible. The mangling of these declarations will look very similar but the numbering will make far more sense, this scheme is lifted from the Itanium ABI implementation. Reviewers: rsmith, doug.gregor, rnk, eli.friedman, cdavis5x Reviewed By: rnk CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2953 llvm-svn: 202951
* Add [extern_c] attribute for modules, allowing a C module to be imported ↵Richard Smith2014-03-021-1/+35
| | | | | | within an extern "C" block in C++ code. llvm-svn: 202615
OpenPOWER on IntegriCloud