summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Decl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Add support for __declspec(thread) under -fms-extensionsReid Kleckner2014-05-011-0/+15
| | | | | | | | Reviewers: rsmith Differential Revision: http://reviews.llvm.org/D3551 llvm-svn: 207734
* AST: Fix visibility calculation for VarTemplateSpecializationDeclDavid Majnemer2014-04-291-0/+4
| | | | | | | | | | | | It is possible that a variable template specialization might not have a VisibilityAttr attached to it while the template that it specializes does, in fact, have one. We should consider the template in such cases. This fixes PR19597. llvm-svn: 207498
* Suppress unused variable warningReid Kleckner2014-04-231-1/+3
| | | | llvm-svn: 207039
* Make TypeDecl much less friendly.Richard Smith2014-04-231-2/+2
| | | | llvm-svn: 207007
* AST: Cleanup/simplify some LV calculation codeDavid Majnemer2014-04-231-20/+16
| | | | | | No functional change. llvm-svn: 206943
* Teach getTemplateInstantiationPattern to deal with generic lambdas.Faisal Vali2014-04-031-2/+23
| | | | | | | | | | | | | No functionality change. When determining the pattern for instantiating a generic lambda call operator specialization - we must not go drilling down for the 'prototype' (i.e. as written) pattern - rather we must use our partially transformed pattern (whose DeclRefExprs are wired correctly to any enclosing lambda's decls that should be mapped correctly in a local instantiation scope) that is the templated pattern of the specialization's primary template (even though the primary template might be instantiated from a 'prototype' member-template). Previously, the drilling down was haltted by marking the instantiated-from primary template as a member-specialization (incorrectly). This prompted Richard to remark (http://llvm-reviews.chandlerc.com/D1784?id=4687#inline-10272) "It's a bit nasty to (essentially) set this bit incorrectly. Can you put the check into getTemplateInstantiationPattern instead?" In my reckless youth, I chose to ignore that comment. With the passage of time, I have come to learn the value of bowing to the will of the angry Gods ;) llvm-svn: 205543
* CodeGen: Emit some functions as weak_odr under -fms-compatibilityDavid Majnemer2014-04-021-1/+39
| | | | | | | | | | | | | | | | | | | Summary: MSVC always emits inline functions marked with the extern storage class specifier. The result is something similar to the opposite of __attribute__((gnu_inline)). This extension is also available in C. This fixes PR19264. Reviewers: rnk, rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3207 llvm-svn: 205485
* Render anonymous entities as '(anonymous <thing>)' (and lambdas as '(lambda ↵David Blaikie2014-04-021-3/+3
| | | | | | | | | | | | at ... )') For namespaces, this is consistent with mangling and GCC's debug info behavior. For structs, GCC uses <anonymous struct> but we prefer consistency between all anonymous entities but don't want to confuse them with template arguments, etc, so we'll just go with parens in all cases. llvm-svn: 205398
* Simplify FunctionDecl::getMinRequiredArguments().Richard Smith2014-04-011-26/+6
| | | | llvm-svn: 205351
* Don't fold together the name lookup entries for two declarations if they areRichard Smith2014-03-171-4/+10
| | | | | | declared in different namespaces in the same inline namespace set. llvm-svn: 204082
* Make some assertions on constant expressions static.Benjamin Kramer2014-03-151-2/+4
| | | | llvm-svn: 204012
* [C++11] Replacing BlockDecl iterators capture_begin() and capture_end() with ↵Aaron Ballman2014-03-141-3/+2
| | | | | | iterator_range captures(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203958
* [C++11] Replacing DeclBase iterators specific_attr_begin() and ↵Aaron Ballman2014-03-101-5/+2
| | | | | | 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-2/+2
| | | | | | | | 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] Replace LLVM-style type traits with C++11 standard ones.Benjamin Kramer2014-03-071-3/+1
| | | | | | No functionality change. llvm-svn: 203241
* Fully reverting r203236 -- it seems the only bots that are happy are the ↵Aaron Ballman2014-03-071-2/+2
| | | | | | MSVC bots. llvm-svn: 203237
* [C++11] Replacing iterators attr_begin() and attr_end() with iterator_range ↵Aaron Ballman2014-03-071-2/+2
| | | | | | 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-41/+28
| | | | | | 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
* Exclude invalid old decl from mismatching linkage assertionIsmail Pazarbasi2014-03-061-3/+2
| | | | | | | | This patch fixes PR18964. In linkage computation, assertion fails when an old invalid declaration's linkage mismatches with the current decl's one. llvm-svn: 203168
* [C++11] Replace llvm::tie with std::tie.Benjamin Kramer2014-03-021-1/+1
| | | | llvm-svn: 202639
* PR18839: 'extern "C++"' also adds an implicit 'extern', not just 'extern "C"'.Richard Smith2014-02-171-4/+4
| | | | llvm-svn: 201537
* Report a correct end location for nameless parameters.Benjamin Kramer2014-02-021-1/+3
| | | | | | | | | | | | | | | Ranges before: void test(void (*)(int), int, float); ~~~~~~~~~~~~~ ~~~~ ~~~~~~ Ranges after: void test(void (*)(int), int, float); ~~~~~~~~~~~~~ ~~~ ~~~~~ This does not change the actual location of the ParmVarDecl, it still points to the location where the name would be. PR17970. llvm-svn: 200640
* Introduce and use Decl::getAsFunction() to simplify templated function checksAlp Toker2014-01-221-12/+4
| | | | | | | | | | | | | | 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
* Rename FunctionProtoType accessors from 'arguments' to 'parameters'Alp Toker2014-01-201-7/+8
| | | | | | | | | | | | | | | | | 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
* PR18544: don't assert that 'operator new' is not declared inside a namespace;Richard Smith2014-01-191-4/+9
| | | | | | such an assert will fail in invalid code that does so! llvm-svn: 199617
* RP18408: If a member template is used as a template template argument, it doesRichard Smith2014-01-081-1/+8
| | | | | | not cause the template specialization to have no linkage. llvm-svn: 198726
* Highlight the previous underlying enum type when diagnosing a mismatchAlp Toker2014-01-061-0/+6
| | | | | | | | | | | | | | 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
* Removed one of the string versions of getQualifiedNameAsString, and switched ↵Aaron Ballman2014-01-031-5/+1
| | | | | | over to using printQualifiedName where possible. No functional changes intended. llvm-svn: 198433
* Replacing calls to getAttr with calls to hasAttr for clarity. No functional ↵Aaron Ballman2013-12-191-1/+1
| | | | | | change intended -- this only replaces Boolean uses of getAttr. llvm-svn: 197648
* Fix pr18174.Rafael Espindola2013-12-081-1/+1
| | | | | | | | | | | | | | | Clang outputs LLVM one top level decl at a time. This combined with the visibility computation code looking for the newest NamespaceDecl would cause it to produce different results for nested namespaces. The two options for producing consistent results are * Delay codegen of anything inside a namespace until the end of the file. * Don't look for the newest NamespaceDecl. This patch implements the second option. This matches the gcc behavior too. llvm-svn: 196712
* Add an AdjustedType sugar node for adjusting calling conventionsReid Kleckner2013-12-051-5/+2
| | | | | | | | | | | | | | | | Summary: In general, this type node can be used to represent any type adjustment that occurs implicitly without losing type sugar. The immediate use of this is to adjust the calling conventions of member function pointer types without breaking template instantiation. Fixes PR17996. Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D2332 llvm-svn: 196451
* Don't call getMostRecentDecl when we know we have it.Rafael Espindola2013-11-261-11/+22
| | | | | | On a Release build this takes the testcase in pr18055 from 0m3.892s to 0m1.452s. llvm-svn: 195768
* Add class-specific operator new to Decl hierarchy. This guarantees that DeclsRichard Smith2013-11-221-92/+66
| | | | | | | | | | | | | can't accidentally be allocated the wrong way (missing prefix data for decls from AST files, for instance) and simplifies the CreateDeserialized functions a little. An extra DeclContext* parameter to the not-from-AST-file operator new allows us to ensure that we don't accidentally call the wrong one when deserializing (when we don't have a DeclContext), allows some extra checks, and prepares for some planned modules-related changes to Decl allocation. No functionality change intended. llvm-svn: 195426
* Added warning on structures/unions that are empty or contain onlySerge Pavlov2013-11-141-19/+4
| | | | | | | | | | bit fields of zero size. Warnings are generated in C++ mode and if only such type is defined inside extern "C" block. The patch fixed PR5065. Differential Revision: http://llvm-reviews.chandlerc.com/D2151 llvm-svn: 194653
* C++1y sized deallocation: if we have a use, but not a definition, of a sizedRichard Smith2013-11-051-1/+33
| | | | | | | | | | | | | deallocation function (and the corresponding unsized deallocation function has been declared), emit a weak discardable definition of the function that forwards to the corresponding unsized deallocation. This allows a C++ standard library implementation to provide both a sized and an unsized deallocation function, where the unsized one does not just call the sized one, for instance by putting both in the same object file within an archive. llvm-svn: 194055
* Wraps lazily generated builtins in an extern "C" contextWarren Hunt2013-11-011-22/+17
| | | | | | | | | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D2082 Adds a lang_c LinkageSpecDecl to lazily generated builtins. This enforces correct behavior for builtins in a variety of cases without special treatment elsewhere within the compiler (special treatment is removed by the patch). It also allows for C++ overloads of builtin functions, which Microsoft uses in their headers e.g. _InterlockedExchangeAdd is an extern C builtin for the long type but an inline wrapper for int type. llvm-svn: 193896
* AST: Mangle fields in anonymous structs/unionsDavid Majnemer2013-10-231-4/+4
| | | | | | | | | | | | | The Itanium mangler couldn't cope with mangling an IndirectFieldDecl. Instead, mangle the field the IndirectFieldDecl refers to. Further, give IndirectFieldDecl no linkage just like FieldDecl. N.B. Decl.cpp:getLVForNamespaceScopeDecl tried to calculate linkage for data members of anonymous structs/unions. However, this seems impossible so turn it into an assertion. llvm-svn: 193269
* Treat aliases as definitions.Rafael Espindola2013-10-221-1/+5
| | | | | | | | | | | | | | This fixes pr17639. Before this patch clang would consider void foo(void) __attribute((alias("__foo"))); a declaration. It now correctly handles it as a definition. Initial patch by Alp Toker. I added support for variables. llvm-svn: 193200
* Simplify some implementations of get*Decl.Rafael Espindola2013-10-191-1/+1
| | | | | | | | | | * NamedDecl and CXXMethodDecl were missing getMostRecentDecl. * The const version can just forward to the non const. * getMostRecentDecl can use cast instead of cast_or_null. This then removes some casts from the callers. llvm-svn: 193039
* Simplify FunctionDecl::getBody.Rafael Espindola2013-10-191-9/+5
| | | | llvm-svn: 193025
* Rename some functions for consistency.Rafael Espindola2013-10-171-17/+11
| | | | | | Every other function in Redeclarable.h was using Decl instead of Declaration. llvm-svn: 192900
* Fix linkage calculation of auto member functions returning lambdasFaisal Vali2013-10-081-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | As described by Richard in https://groups.google.com/a/isocpp.org/d/msg/std-discussion/S1kmj0wF5-g/fb6agEYoL2IJ we should allow: template<typename S> struct A { template<typename T> static auto default_lambda() { return [](const T&) { return 42; }; } template<class U = decltype(default_lambda<S>())> U func(U u = default_lambda<S>()) { return u; } }; int run2 = A<double>{}.func()(3.14); int run3 = A<char>{}.func()('a'); This patch allows the code using the same trickery that was used to allow the code in non-member functions at namespace scope. Please see http://llvm-reviews.chandlerc.com/D1844 for richard's approval. llvm-svn: 192166
* When merging class definitions across modules in C++, merge together fields.Richard Smith2013-10-071-1/+9
| | | | | | | | | This change doesn't go all the way to making fields redeclarable; instead, it makes them 'mergeable', which means we can find the canonical declaration, but not much else (and for a declaration that's not from a module, the canonical declaration is always that declaration). llvm-svn: 192092
* Fix computation of linkage within nested lambdas.Faisal Vali2013-10-011-3/+31
| | | | | | | | | | When nested C++11 lambdas are used in NSDMI's - this patch prevents infinite recursion by computing the linkage of any nested lambda by determining the linkage of the outermost enclosing lambda (which might inherit its linkage from its parent). See http://llvm-reviews.chandlerc.com/D1783 for Doug's approval. [On a related note, I need this patch so as to pass tests of transformations of nested lambdas returned from member functions] llvm-svn: 191727
* Revert the linkage fix.Faisal Vali2013-09-291-31/+5
| | | | | | I got a bunch of buildbot failures that i don't understand - sorry. llvm-svn: 191647
* Fix computation of linkage within nested lambdas.Faisal Vali2013-09-291-5/+31
| | | | | | | | | | When nested lambdas are used in NSDMI's - this prevents infinite recursion. See http://llvm-reviews.chandlerc.com/D1783 for Doug's approval regarding the code, and then request for some tests. [On a related note, I need this patch so as to pass tests of transformations of nested lambdas returned from member functions] llvm-svn: 191645
* Implement C++1y sized deallocation (n3778). This is not enabled by -std=c++1y;Richard Smith2013-09-291-1/+4
| | | | | | | instead, it's enabled by the -cc1 flag -fsized-deallocation, until we sort out the backward-compatibility issues. llvm-svn: 191629
* Variable templates: handle instantiation of static data member templatesRichard Smith2013-09-271-12/+40
| | | | | | appropriately, especially when they appear within class templates. llvm-svn: 191548
* Revert "Revert "[-cxx-abi microsoft] Mangle local TagDecls appropriately""David Majnemer2013-09-171-4/+4
| | | | | | This reverts commit r190895 which reverted r190892. llvm-svn: 190904
* Revert "[-cxx-abi microsoft] Mangle local TagDecls appropriately"David Majnemer2013-09-171-4/+4
| | | | | | This reverts commit r190892. llvm-svn: 190895
OpenPOWER on IntegriCloud