summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
Commit message (Collapse)AuthorAgeFilesLines
* 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-132-92/+53
| | | | | | | | | | | | 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-132-2/+40
| | | | | | | 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-132-30/+98
| | | | | | | | 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
* Update constexpr implementation to match CWG's chosen approach for core issuesRichard Smith2012-02-132-4/+17
| | | | | | | | | | | | | | | | | | | | 1358, 1360, 1452 and 1453. - Instantiations of constexpr functions are always constexpr. This removes the need for separate declaration/definition checking, which is now gone. - This makes it possible for a constexpr function to be virtual, if they are only dependently virtual. Virtual calls to such functions are not constant expressions. - Likewise, it's now possible for a literal type to have virtual base classes. A constexpr constructor for such a type cannot actually produce a constant expression, though, so add a special-case diagnostic for a constructor call to such a type rather than trying to evaluate it. - Classes with trivial default constructors (for which value initialization can produce a fully-initialized value) are considered literal types. - Classes with volatile members are not literal types. - constexpr constructors can be members of non-literal types. We do not yet use static initialization for global objects constructed in this way. llvm-svn: 150359
* Within the body of a lambda expression, decltype((x)) for anDouglas Gregor2012-02-122-35/+8
| | | | | | | | | | | | | | | | id-expression 'x' will compute the type based on the assumption that 'x' will be captured, even if it isn't captured, per C++11 [expr.prim.lambda]p18. There are two related refactors that go into implementing this: 1) Split out the check that determines whether we should capture a particular variable reference, along with the computation of the type of the field, from the actual act of capturing the variable. 2) Always compute the result of decltype() within Sema, rather than AST, because the decltype() computation is now context-sensitive. llvm-svn: 150347
* Represent C++ direct initializers as ParenListExprs before semantic analysisSebastian Redl2012-02-114-16/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* const-qualify CXXRecordDecl::getCaptureFields.Eli Friedman2012-02-111-1/+1
| | | | llvm-svn: 150284
* Track whether a function type has a trailing return type as type sugar. Use thisRichard Smith2012-02-103-7/+17
| | | | | | | | | | | to pretty-print such function types better, and to fix a case where we were not instantiating templates in lexical order. In passing, move the Variadic bit from Type's bitfields to FunctionProtoType to get the Type bitfields down to 32 bits. Also ensure that we always substitute the return type of a function when substituting explicitly-specified arguments, since that can cause us to bail out with a SFINAE error before we hit a hard error in parameter substitution. llvm-svn: 150241
* Extend CXXRecordDecl with a function that determines the mapping fromDouglas Gregor2012-02-101-0/+29
| | | | | | | the variables captured by a lambda to the fields that store the captured values. To be used in IRgen. llvm-svn: 150235
* Update to new resolution for DR1458. When taking the address of an object ofRichard Smith2012-02-101-12/+0
| | | | | | | incomplete class type which has an overloaded operator&, it's now just unspecified whether the overloaded operator or the builtin is used. llvm-svn: 150234
* objc: If a method is not implemented in the category implementation butFariborz Jahanian2012-02-091-15/+17
| | | | | | | | has been declared in its primary class, superclass, or in one of their protocols, no need to issue unimplemented method. // rdar://10823023 llvm-svn: 150206
* CWG issue 1405: mutable members are allowed in literal types, but can't undergoRichard Smith2012-02-092-5/+8
| | | | | | lvalue-to-rvalue conversions in constant expressions. llvm-svn: 150145
* [PCH] Avoid using Decl::setAttrs() and Decl::setLexicalDeclContext() from ↵Argyrios Kyrtzidis2012-02-091-6/+15
| | | | | | | | | the ASTReaderDecl directly; they internally call Decl::getASTContext() which may crash if a declaration context parent is still deserializing. llvm-svn: 150137
* Implement DR1458: Taking the address of an object of incomplete class type isRichard Smith2012-02-081-0/+12
| | | | | | | not a constant expression, because we can't tell whether the complete class type will have an overloaded operator&. llvm-svn: 150066
* Implement the agreed resolution to DR1457: a signed left shift of a 1 bit intoRichard Smith2012-02-081-4/+3
| | | | | | | | | | the sign bit doesn't have undefined behavior, but a signed left shift of a 1 bit out of the sign bit still does. As promised to Howard :) The suppression of the potential constant expression checking in system headers is also removed, since the problem it was working around is gone. llvm-svn: 150059
* Revise the SplitQualType interface to make it its own thing instead ofJohn McCall2012-02-084-47/+48
| | | | | | | | | | | | | | a typedef of std::pair. This slightly improves type-safety, but mostly makes code using it clearer to read as well as making it possible to add methods to the type. Add such a method for efficiently single-step desugaring a split type. Add a method to single-step desugaring a locally-unqualified type. Implement both the SplitQualType and QualType methods in terms of that. Also, fix a typo ("ObjCGLifetime"). llvm-svn: 150028
* If a struct needs to be laid out, and it has notSean Callanan2012-02-081-0/+4
| | | | | | | | been completed yet, then complete it if possible. This fixes some assertion failures encountered by LLDB. llvm-svn: 150020
* Revert my patches which removed Diagnostic.h includes by moving some ↵Benjamin Kramer2012-02-078-68/+0
| | | | | | | | | | | | | | | | | | operator overloads out of line. This seems to negatively affect compile time onsome ObjC tests (which use a lot of partial diagnostics I assume). I have to come up with a way to keep them inline without including Diagnostic.h everywhere. Now adding a new diagnostic requires a full rebuild of e.g. the static analyzer which doesn't even use those diagnostics. This reverts commit 6496bd10dc3a6d5e3266348f08b6e35f8184bc99. This reverts commit 7af19b817ba964ac560b50c1ed6183235f699789. This reverts commit fdd15602a42bbe26185978ef1e17019f6d969aa7. This reverts commit 00bd44d5677783527d7517c1ffe45e4d75a0f56f. This reverts commit ef9b60ffed980864a8db26ad30344be429e58ff5. llvm-svn: 150006
* Print NamedDecls directly to a raw_ostream where possible.Benjamin Kramer2012-02-075-9/+8
| | | | llvm-svn: 149982
* Switch the ObjC*Decl raw_stream overloads to take a reference, for ↵Benjamin Kramer2012-02-073-6/+6
| | | | | | consistency with NamedDecls. llvm-svn: 149981
* Introduce basic ASTs for lambda expressions. This covers:Douglas Gregor2012-02-078-27/+260
| | | | | | | | | | | | | | | | | | | | | | | | - 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
* Make FunctionDecl::doesDeclarationForceExternallyVisibleDefinition use the ↵Eli Friedman2012-02-071-26/+68
| | | | | | same logic as FunctionDecl::isInlineDefinitionExternallyVisible to figure out whether to emit a definition. Based on work by Anton Yartsev. llvm-svn: 149963
* Added source location for the template keyword in ↵Abramo Bagnara2012-02-061-3/+3
| | | | | | | | | | DependentTemplateSpecializationTypeLoc nodes (DTSTLoc). The new info is propagated to TSTLoc on template instantiation, getting rid of 3 FIXMEs in TreeTransform.h and another one Parser.cpp. Simplified code in TypeSpecLocFiller visitor methods for DTSTLoc and DependentNameTypeLoc by removing what now seems to be dead code (adding corresponding assertions). llvm-svn: 149923
* Fix the result of VarDecl::checkInitIsICE so it is consistently accurate in ↵Eli Friedman2012-02-061-1/+1
| | | | | | C++11 mode. PR11928. llvm-svn: 149908
* Removed redundant location info from ElaboratedTypeLoc / DependentNameLoc / ↵Abramo Bagnara2012-02-061-2/+2
| | | | | | DependentTSTLoc. Uniformed names referencing elaborated keyword. No intended functionality changes. llvm-svn: 149889
* objc: fixes a problem in block type comparison involvingFariborz Jahanian2012-02-061-2/+4
| | | | | | | | enums with underlying type explicitly specified (feature which is on by default in objective-c). // rdar://10798770 llvm-svn: 149888
* Added location for template keyword in TemplateSpecializationTypeLoc. In the ↵Abramo Bagnara2012-02-062-2/+3
| | | | | | process removed some naming ambiguities. llvm-svn: 149870
* Fixed instantiation of DependentScopeDeclRefExpr.Abramo Bagnara2012-02-061-5/+7
| | | | llvm-svn: 149868
* Implement name mangling for scalar value initialization. Reported on IRC by Xeo.Richard Smith2012-02-061-1/+6
| | | | llvm-svn: 149854
* Move operator overload out of line. Calling operator<< on a forward declared ↵Benjamin Kramer2012-02-051-0/+6
| | | | | | type doesn't seem to work on MSVC. llvm-svn: 149819
* Basic: import SmallString<> into clang namespaceDylan Noblesmith2012-02-057-15/+15
| | | | | | | (I was going to fix the TODO about DenseMap too, but that would break self-host right now. See PR11922.) llvm-svn: 149799
* Basic: import OwningPtr<> into clang namespaceDylan Noblesmith2012-02-051-1/+1
| | | | llvm-svn: 149798
* constexpr: Fix implementation of DR1311: check for volatile qualifiers inRichard Smith2012-02-051-2/+5
| | | | | | | lvalue-to-rvalue conversions on the source type of the conversion, not the target type (which has them removed for non-class types). llvm-svn: 149796
* Move a method from IdentifierTable.h out of line and remove the SmallString ↵Benjamin Kramer2012-02-043-7/+7
| | | | | | | | include. Fix all the transitive include users. llvm-svn: 149783
* Move various diagnostic operator<< overloads out of line and remove includes ↵Benjamin Kramer2012-02-048-0/+56
| | | | | | | | | of Diagnostic.h. Fix all the files that depended on transitive includes of Diagnostic.h. With this patch in place changing a diagnostic no longer requires a full rebuild of the StaticAnalyzer. llvm-svn: 149781
* Move Storage and StorageAllocator out of the PartialDiagnostic class so we ↵Benjamin Kramer2012-02-041-0/+6
| | | | | | | | | can forward declare them. Let ASTContext allocate the storage in its BumpPtrAllocator. This will help us remove ASTContext's depedency on PartialDiagnostic.h soon. llvm-svn: 149780
* constexpr:Richard Smith2012-02-041-1/+2
| | | | | | | | | | The recent support for potential constant expressions exposed a bug in the implementation of libstdc++4.6, where numeric_limits<int>::min() is defined as (int)1 << 31, which isn't a constant expression. Disable the 'constexpr function never produces a constant expression' error inside system headers to compensate. llvm-svn: 149729
* When a pack expansion occurs in the template argument list of an aliasDouglas Gregor2012-02-032-22/+22
| | | | | | | | template without a corresponding parameter pack, don't immediately substitute the alias template. This is under discussion in the C++ committee, and may become ill-formed, but for now we match GCC. llvm-svn: 149697
* Move isSentinelNullExpr() from Sema to ASTContext to make it more widelyArgyrios Kyrtzidis2012-02-031-0/+18
| | | | | | available. llvm-svn: 149675
* r149587 revertedAnton Yartsev2012-02-021-3/+1
| | | | llvm-svn: 149594
* Fix for PR10657 (http://llvm.org/bugs/show_bug.cgi?id=10657)Anton Yartsev2012-02-021-1/+3
| | | | | | extern inline case considered llvm-svn: 149587
* constexpr:Richard Smith2012-02-022-15/+166
| | | | | | | * support the gcc __builtin_constant_p() ? ... : ... folding hack in C++11 * check for unspecified values in pointer comparisons and pointer subtractions llvm-svn: 149578
* Make sure that imported definitions get completed before we addDouglas Gregor2012-02-011-31/+100
| | | | | | | anything into the corresponding DeclContext. Co-hacked with Sean; fixes <rdar://problem/10768928>. llvm-svn: 149535
* Add a new compiler warning, which flags anti-patterns used as the sizeAnna Zaks2012-02-011-0/+7
| | | | | | | | | | | argument in strncat. The warning is ignored by default since it needs more qualification. TODO: The warning message and the note are messy when strncat is a builtin due to the macro expansion. llvm-svn: 149524
* constexpr: check for overflow in pointer subtraction.Richard Smith2012-02-011-6/+23
| | | | | | | | | | | | | This is a mess. According to the C++11 standard, pointer subtraction only has undefined behavior if the difference of the array indices does not fit into a ptrdiff_t. However, common implementations effectively perform a char* subtraction first, and then divide the result by the element size, which can cause overflows in some cases. Those cases are not considered to be undefined behavior by this change; perhaps they should be. llvm-svn: 149490
* Remove redundant checks in CXXRecordDecl::isCLike(), as suggested by Sebastian.Argyrios Kyrtzidis2012-02-011-5/+1
| | | | llvm-svn: 149476
* constexpr: overflow checking for integral and floating-point arithmetic.Richard Smith2012-02-011-7/+38
| | | | llvm-svn: 149473
* constexpr: require 'this' to point to an object in a constexpr method call.Richard Smith2012-02-011-1/+5
| | | | llvm-svn: 149467
OpenPOWER on IntegriCloud