summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* objective-C arg: provide fixit support whenFariborz Jahanian2013-02-221-8/+12
| | | | | | | c++'s named cast need be replaced for bridge casting. // rdar://12788838 llvm-svn: 175923
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-1/+1
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Fix for PR12222.Erik Verbruggen2012-12-251-16/+22
| | | | | | | | Changed getLocStart() and getLocEnd() to be required for Stmts, and make getSourceRange() optional. The default implementation for getSourceRange() is build the range by calling getLocStart() and getLocEnd(). llvm-svn: 171067
* PR13470: Ensure that copy-list-initialization isntantiates asRichard Smith2012-12-191-1/+3
| | | | | | | | | | | | copy-list-initialization (and doesn't add an additional copy step): Fill in the ListInitialization bit when creating a CXXConstructExpr. Use it when instantiating initializers in order to correctly handle instantiation of copy-list-initialization. Teach TreeTransform that function arguments are initializations, and so need this special treatment too. Finally, remove some hacks which were working around SubstInitializer's shortcomings. llvm-svn: 170489
* Change DeclContextLookup(Const)Result to (Mutable)ArrayRef<NamedDecl*>, as ↵David Blaikie2012-12-191-3/+3
| | | | | | | | | | | | | | | per review discussion in r170365 This does limit these typedefs to being sequences, but no current usage requires them to be contiguous (we could expand this to a more general iterator pair range concept at some point). Also, it'd be nice if SmallVector were constructible directly from an ArrayRef but this is a bit tricky since ArrayRef depends on SmallVectorBaseImpl for the inverse conversion. (& generalizing over all range-like things, while nice, would require some nontrivial SFINAE I haven't thought about yet) llvm-svn: 170482
* Pull the Attr iteration parts out of Attr.h, so including DeclBase.h doesn't ↵Benjamin Kramer2012-12-011-1/+2
| | | | | | | | | pull in all the generated Attr code. Required to pull some functions out of line, but this shouldn't have a perf impact. No functionality change. llvm-svn: 169092
* Fix a source range regression in C++ new expressions with call initializers.David Blaikie2012-11-081-0/+8
| | | | | | Introduced in r167507, discovered in review by Abramo Bagnara. llvm-svn: 167597
* PR13552: Fix the end location of a CXXNewExpr.David Blaikie2012-11-071-14/+2
| | | | | | | | | Spent longer than reasonable looking for a nice way to test this & decided to give up for now. Open to suggestions/requests. Richard Smith suggested adding something to ASTMatchers but it wasn't readily apparent how to test this with that. llvm-svn: 167507
* DR1442: In a range-based for statement, namespace 'std' is not an associatedRichard Smith2012-10-181-1/+1
| | | | | | namespace. llvm-svn: 166194
* Add codegen support for __uuidof().Nico Weber2012-10-111-0/+20
| | | | llvm-svn: 165710
* PR13811: Add a FunctionParmPackExpr node to handle references to functionRichard Smith2012-09-121-0/+28
| | | | | | | parameter packs where the reference is not being expanded but the pack has been. Previously, Clang would segfault in such cases. llvm-svn: 163672
* Push ArrayRef through the Expr hierarchy.Benjamin Kramer2012-08-241-21/+17
| | | | | | No functionality change. llvm-svn: 162552
* Switch some realignment calculations over to llvm::RoundUpToAlignment.Richard Smith2012-08-211-2/+1
| | | | llvm-svn: 162297
* Fix alignment of array of VarDecl* following array of unsigned in LambdaExpr.Richard Smith2012-08-211-3/+7
| | | | llvm-svn: 162255
* PR13570: When an unresolved overloaded call appeared in a dependent context, weRichard Smith2012-08-131-0/+1
| | | | | | | forgot to set it as being instantiation-dependent as well as being type- and value-dependent. llvm-svn: 161791
* Factor out computation of whether a typeid's expression is potentiallyRichard Smith2012-08-131-0/+15
| | | | | | evaluated into a CXXTypeid member function. No functionality change. llvm-svn: 161779
* Provide isConst/Volatile on CXXMethodDecl.David Blaikie2012-08-101-1/+1
| | | | | | | | | This also provides isConst/Volatile/Restrict on FunctionTypes to coalesce the implementation with other callers (& update those other callers). Patch contributed by Sam Panzer (panzer@google.com). llvm-svn: 161647
* Enhance getImplicitObjectArgument to look through ->*.Jordan Rose2012-08-031-2/+5
| | | | | | | This only applies in the case where ->* is not overloaded, since it specifically looks for BinaryOperator and not CXXOperatorCallExpr. llvm-svn: 161275
* PR12057: Allow variadic template pack expansions to cross lambda boundaries.Richard Smith2012-07-251-4/+6
| | | | | | | | | | Rather than adding a ContainsUnexpandedParameterPack bit to essentially every AST node, we tunnel the bit directly up to the surrounding lambda expression when we reach a context where an unexpanded pack can not normally appear. Thus any statement or declaration within a lambda can now potentially contain an unexpanded parameter pack. llvm-svn: 160705
* The delete argument should not be converted to void*.Abramo Bagnara2012-07-091-7/+0
| | | | llvm-svn: 159961
* Drop the ASTContext.h include from DeclFriend.h and DeclTemplate.h.Benjamin Kramer2012-07-041-0/+1
| | | | llvm-svn: 159723
* Do not crash when we dynamic cast a final type to void*.Alexis Hunt2012-06-191-0/+3
| | | | llvm-svn: 158763
* Revert r158700 and dependent patches r158716, r158717, and r158731.Jakob Stoklund Olesen2012-06-191-0/+3
| | | | | | | | The original r158700 caused crashes in the gcc test suite, g++.abi/vtable3a.C among others. It also caused failures in the libc++ test suite. llvm-svn: 158749
* Improve the specification of spellings in Attr.td.Alexis Hunt2012-06-191-3/+0
| | | | | | | | | | | | | | | | | Note that this is mostly a structural patch that handles the change from the old spelling style to the new one. One consequence of this is that all AT_foo_bar enum values have changed to not be based off of the first spelling, but rather off of the class name, so they are now AT_FooBar and the like (a straw poll on IRC showed support for this). Apologies for code churn. Most attributes have GNU spellings as a temporary solution until everything else is sorted out (such as a Keyword spelling, which I intend to add if someone else doesn't beat me to it). This is definitely a WIP. I've also killed BaseCheckAttr since it was unused, and I had to go through every attribute anyway. llvm-svn: 158700
* Correctly constify clang::CXXMemberCallExpr::getRecordDecl()David Blaikie2012-05-031-1/+1
| | | | llvm-svn: 156074
* Utilize getLocStart()/getLocEnd() on my recent change.Argyrios Kyrtzidis2012-05-011-9/+6
| | | | llvm-svn: 155952
* Store the source range of a CXXOperatorCallExpr in the Expr object instead ofArgyrios Kyrtzidis2012-04-301-2/+2
| | | | | | | | | | | | | | | calculating it recursively. boost::assign::tuple_list_of uses the trick of chaining call operator expressions in order to declare a "list of tuples", e.g: std::vector<tuple> v = boost::assign::tuple_list_of(1, "foo")(2, "bar")(3, "qqq"); Due to CXXOperatorCallExpr calculating its source range recursively we would get significant slowdowns with a large number of chained call operator expressions and the potential for stack overflow. rdar://11350116 llvm-svn: 155848
* Move the computation of the lambda mangling information (manglingDouglas Gregor2012-04-041-12/+3
| | | | | | | | | | number + context) to the point where we initially start defining the lambda, so that the linkage won't change when that information is made available. Fixes the assertion in <rdar://problem/11182962>. Plus, actually mangle the context of lambdas properly. llvm-svn: 154029
* AST representation for user-defined literals, plus just enough of semanticRichard Smith2012-03-071-0/+33
| | | | | | | | | | | | | | | | | | | | | analysis to make the AST representation testable. They are represented by a new UserDefinedLiteral AST node, which is a sugared CallExpr. All semantic properties, including full CodeGen support, are achieved for free by this representation. UserDefinedLiterals can never be dependent, so no custom instantiation behavior is required. They are mangled as if they were direct calls to the underlying literal operator. This matches g++'s apparent behavior (but not its actual mangling, which is broken for literal-operator-ids). User-defined *string* literals are now fully-operational, but the semantic analysis is quite hacky and needs more work. No other forms of user-defined literal are created yet, but the AST support for them is present. This patch committed after midnight because we had already hit the quota for new kinds of literal yesterday. llvm-svn: 152211
* Reorder members to save padding.Benjamin Kramer2012-02-261-4/+4
| | | | | | | | There's more potential here, but these Exprs aren't used that often so I don't feel like doing heroic bit packing right now. -8 bytes on every class changed (x86_64). llvm-svn: 151501
* Implement a new type trait __is_trivially_constructible(T, Args...)Douglas Gregor2012-02-241-1/+47
| | | | | | | | | | | | | | | | that provides the behavior of the C++11 library trait std::is_trivially_constructible<T, Args...>, which can't be implemented purely as a library. Since __is_trivially_constructible can have zero or more arguments, I needed to add Yet Another Type Trait Expression Class, this one handling arbitrary arguments. The next step will be to migrate UnaryTypeTrait and BinaryTypeTrait over to this new, more general TypeTrait class. Fixes the Clang side of <rdar://problem/10895483> / PR12038. llvm-svn: 151352
* Implement non-internal linkage for lambda closure types that need aDouglas Gregor2012-02-211-1/+4
| | | | | | | | | stable mangling, since these lambdas can end up in multiple translation units. Sema is responsible for deciding when this is the case, because it's already responsible for choosing the mangling number. llvm-svn: 151029
* Implement name mangling for lambda expressions that occur within theDouglas Gregor2012-02-211-3/+6
| | | | | | | | | | | | | | | | default arguments of function parameters. This simple-sounding task is complicated greatly by two issues: (1) Default arguments aren't actually a real context, so we need to maintain extra state within lambda expressions to track when a lambda was actually in a default argument. (2) At the time that we parse a default argument, the FunctionDecl doesn't exist yet, so lambda closure types end up in the enclosing context. It's not clear that we ever want to change that, so instead we introduce the notion of the "effective" context of a declaration for the purposes of name mangling. llvm-svn: 151011
* Basic support for name mangling of C++11 lambda expressions. BecauseDouglas Gregor2012-02-201-3/+6
| | | | | | | | | | | | | | | name mangling in the Itanium C++ ABI for lambda expressions is so dependent on context, we encode the number used to encode each lambda as part of the lambda closure type, and maintain this value within Sema. Note that there are a several pieces still missing: - We still get the linkage of lambda expressions wrong - We aren't properly numbering or mangling lambda expressions that occur in default function arguments or in data member initializers. - We aren't (de-)serializing the lambda numbering tables llvm-svn: 150982
* Pacify gcc's -Wreturn-typeMatt Beaumont-Gay2012-02-161-0/+1
| | | | llvm-svn: 150731
* Revert "Revert "Make CXXNewExpr contain only a single initialier, and not ↵Sebastian Redl2012-02-161-31/+38
| | | | | | | | hold the used constructor itself."" This reintroduces commit r150682 with a fix for the Bullet benchmark crash. llvm-svn: 150685
* Revert "Make CXXNewExpr contain only a single initialier, and not hold the ↵Sebastian Redl2012-02-161-38/+31
| | | | | | | | | | used constructor itself." It leads to a compiler crash in the Bullet benchmark. This reverts commit r12014. llvm-svn: 150684
* Make CXXNewExpr contain only a single initialier, and not hold the used ↵Sebastian Redl2012-02-161-31/+38
| | | | | | | | | | constructor itself. Holding the constructor directly makes no sense when list-initialized arrays come into play. The constructor is now held in a CXXConstructExpr, if construction is what is done. The new design can also distinguish properly between list-initialization and direct-initialization, as well as implicit default-initialization constructors and explicit value-initialization constructors. Finally, doing it this way removes redundance from the AST because CXXNewExpr doesn't try to handle both the allocation and the initialization responsibilities. This breaks the static analysis of new expressions. I've filed PR12014 to track this. llvm-svn: 150682
* Implement AST (de-)serialization for lambda expressions.Douglas Gregor2012-02-141-0/+17
| | | | llvm-svn: 150491
* Introduce support for template instantiation of lambdaDouglas Gregor2012-02-131-2/+5
| | | | | | | | | | | | | | | | | | expressions. This is mostly a simple refact, splitting the main "start a lambda expression" function into smaller chunks that are driven either from the parser (Sema::ActOnLambdaExpr) or during AST transformation (TreeTransform::TransformLambdaExpr). A few minor interesting points: - Added new entry points for TreeTransform, so that we can explicitly establish the link between the lambda closure type in the template and the lambda closure type in the instantiation. - Added a bit into LambdaExpr specifying whether it had an explicit result type or not. We should have had this anyway. This code is 'lightly' tested. llvm-svn: 150417
* Sink variable into assertMatt Beaumont-Gay2012-02-131-2/+2
| | | | llvm-svn: 150407
* Split the storage of lambda information between the LambdaExpr and theDouglas Gregor2012-02-131-41/+52
| | | | | | | | | | | | CXXRecordDecl in a way that actually makes some sense: - LambdaExpr contains all of the information for initializing the lambda object, including the capture initializers and associated array index variables. - CXXRecordDecl's LambdaDefinitionData contains the captures, which are needed to understand the captured variable references in the body of the lambda. llvm-svn: 150401
* Keep track of the set of array index variables we use when weDouglas Gregor2012-02-131-1/+20
| | | | | | | synthesize a by-copy captured array in a lambda. This information will be needed by IR generation. llvm-svn: 150396
* Don't allocate unused storage for captures/capture initializers in lambda ↵Douglas Gregor2012-02-131-6/+3
| | | | | | expressions llvm-svn: 150394
* Move the storage of lambda captures and capture initializers fromDouglas Gregor2012-02-131-19/+56
| | | | | | | | LambdaExpr over to the CXXRecordDecl. This allows us to eliminate the back-link from the closure type to the LambdaExpr, which will simplify and lazify AST deserialization. llvm-svn: 150393
* Represent C++ direct initializers as ParenListExprs before semantic analysisSebastian Redl2012-02-111-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | instead of having a special-purpose function. - ActOnCXXDirectInitializer, which was mostly duplication of AddInitializerToDecl (leading e.g. to PR10620, which Eli fixed a few days ago), is dropped completely. - MultiInitializer, which was an ugly hack I added, is dropped again. - We now have the infrastructure in place to distinguish between int x = {1}; int x({1}); int x{1}; -- VarDecl now has getInitStyle(), which indicates which of the above was used. -- CXXConstructExpr now has a flag to indicate that it represents list- initialization, although this is not yet used. - InstantiateInitializer was renamed to SubstInitializer and simplified. - ActOnParenOrParenListExpr has been replaced by ActOnParenListExpr, which always produces a ParenListExpr. Placed that so far failed to convert that back to a ParenExpr containing comma operators have been fixed. I'm pretty sure I could have made a crashing test case before this. The end result is a (I hope) considerably cleaner design of initializers. More importantly, the fact that I can now distinguish between the various initialization kinds means that I can get the tricky generalized initializer test cases Johannes Schaub supplied to work. (This is not yet done.) This commit passed self-host, with the resulting compiler passing the tests. I hope it doesn't break more complicated code. It's a pretty big change, but one that I feel is necessary. llvm-svn: 150318
* Introduce basic ASTs for lambda expressions. This covers:Douglas Gregor2012-02-071-0/+107
| | | | | | | | | | | | | | | | | | | | | | | | - Capturing variables by-reference and by-copy within a lambda - The representation of lambda captures - The creation of the non-static data members in the lambda class that store the captured variables - The initialization of the non-static data members from the captured variables - Pretty-printing lambda expressions There are a number of FIXMEs, both explicit and implied, including: - Creating a field for a capture of 'this' - Improved diagnostics for initialization failures when capturing variables by copy - Dealing with temporaries created during said initialization - Template instantiation - AST (de-)serialization - Binding and returning the lambda expression; turning it into a proper temporary - Lots and lots of semantic constraints - Parameter pack captures llvm-svn: 149977
* Fixed instantiation of DependentScopeDeclRefExpr.Abramo Bagnara2012-02-061-5/+7
| | | | llvm-svn: 149868
* Added source location for the template keyword in AST template-id expressions.Abramo Bagnara2012-01-271-52/+77
| | | | llvm-svn: 149127
* Unweaken vtables as per ↵David Blaikie2011-12-201-1/+1
| | | | | | http://llvm.org/docs/CodingStandards.html#ll_virtual_anch llvm-svn: 146959
OpenPOWER on IntegriCloud