summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Basic support for name mangling of C++11 lambda expressions. BecauseDouglas Gregor2012-02-201-0/+7
| | | | | | | | | | | | | | | 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
* Within the body of a lambda expression, decltype((x)) for anDouglas Gregor2012-02-121-34/+3
| | | | | | | | | | | | | | | | 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
* Track whether a function type has a trailing return type as type sugar. Use thisRichard Smith2012-02-101-1/+4
| | | | | | | | | | | 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
* Revise the SplitQualType interface to make it its own thing instead ofJohn McCall2012-02-081-24/+24
| | | | | | | | | | | | | | 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
* Revert my patches which removed Diagnostic.h includes by moving some ↵Benjamin Kramer2012-02-071-7/+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
* 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-061-0/+1
| | | | | | process removed some naming ambiguities. llvm-svn: 149870
* Basic: import SmallString<> into clang namespaceDylan Noblesmith2012-02-051-1/+1
| | | | | | | (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
* Move various diagnostic operator<< overloads out of line and remove includes ↵Benjamin Kramer2012-02-041-0/+1
| | | | | | | | | 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
* When a pack expansion occurs in the template argument list of an aliasDouglas Gregor2012-02-031-12/+20
| | | | | | | | 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
* objc: 'id' and block pointer compare in mergeTypes isFariborz Jahanian2012-01-261-3/+6
| | | | | | made symmetrical. // rdar://10734265 llvm-svn: 149065
* objc: allow block pointer matching 'id' type whenFariborz Jahanian2012-01-261-1/+5
| | | | | | | they show up as argument types of two block pointers. // rdar://10734265 llvm-svn: 149007
* Add ability to specifiy 'restrict' on parameters of builtins, and correct ↵Ted Kremenek2012-01-201-0/+3
| | | | | | this oversight for scanf functions. llvm-svn: 148573
* Delay the creation of the built-in Objective-C class 'Protocol' byDouglas Gregor2012-01-171-5/+14
| | | | | | | moving it from a "special type" to a predefined declaration, as we do for id, Class, and SEL. llvm-svn: 148313
* Remove unreachable code in Clang. (replace with llvm_unreachable where ↵David Blaikie2012-01-171-8/+6
| | | | | | appropriate or when GCC requires it) llvm-svn: 148292
* Remove unnecessary default cases in switches over enums.David Blaikie2012-01-171-2/+3
| | | | | | This allows -Wswitch-enum to find switches that need updating when these enums are modified. llvm-svn: 148281
* De-virtualize getPreviousDecl() and getMostRecentDecl() when we knowDouglas Gregor2012-01-141-5/+5
| | | | | | | | | | | | we have a redeclarable type, and only use the new virtual versions (getPreviousDeclImpl() and getMostRecentDeclImpl()) when we don't have that type information. This keeps us from penalizing users with strict type information (and is the moral equivalent of a "final" method). Plus, settle on the names getPreviousDecl() and getMostRecentDecl() throughout. llvm-svn: 148187
* Fix canonicalization of protocol-qualified typesDouglas Gregor2012-01-021-1/+9
| | | | llvm-svn: 147421
* Use declaresSameEntity() when comparing ObjCProtocolDecls, andDouglas Gregor2012-01-011-5/+5
| | | | | | | getCanonicalDecl() when putting ObjCProtocolDecls into a set. This is groundwork for making ObjCProtocolDecl redeclarable. llvm-svn: 147406
* If there is a definition of an ObjCInterfaceDecl, make it the Decl returned ↵Douglas Gregor2011-12-161-0/+4
| | | | | | from the corresponding ObjCInterfaceType llvm-svn: 146740
* Fix chaining of ObjCInterfaceDecl redeclarationsDouglas Gregor2011-12-161-2/+8
| | | | llvm-svn: 146722
* Replace all comparisons between ObjCInterfaceDecl pointers with callsDouglas Gregor2011-12-151-1/+1
| | | | | | | | to declaresSameEntity(), as a baby step toward tracking forward declarations of Objective-C classes precisely. Part of <rdar://problem/10583531>. llvm-svn: 146618
* Added an assertion about overflow in sizeof evaluation. This does not solve ↵Abramo Bagnara2011-12-131-1/+3
| | | | | | the underlying structural issue that is waiting for a proper solution. llvm-svn: 146482
* Keep track of all of the import declarations that are parsed orDouglas Gregor2011-12-031-1/+15
| | | | | | | implicitly generated in a translation unit. Modules will need this information to identify the actual imports that occurred. llvm-svn: 145734
* Add bigger method type encodings to protocol objects. <rdar://problem/10492418>Bob Wilson2011-11-301-13/+63
| | | | | | | | | | | | | | | | | | The new metadata are method @encode strings with additional data. 1. Each Objective-C object is marked with its class name and protocol names. The same is done for property @encode already. 2. Each block object is marked with its function prototype's @encoding. For example, a method parameter that is a block object that itself returns void and takes an int would look like: @?<v@?i> These new method @encode strings are stored in a single array pointed to by structs protocol_t and objc_protocol_ext. Patch provided by Greg Parker! llvm-svn: 145469
* Fix the signature of the getcontext builtin. Patch by Dimitry Andric.Rafael Espindola2011-11-131-2/+12
| | | | llvm-svn: 144505
* Correcting grammar.David Blaikie2011-11-061-1/+1
| | | | llvm-svn: 143894
* [libclang] For a class extension, give it a unique USR but for any property ↵Argyrios Kyrtzidis2011-11-011-0/+11
| | | | | | | | | | or ivar it contains give it a USR based on its semantic context, which is the interface. This follows what we already did for objc methods. rdar://10371669 llvm-svn: 143464
* Teach format string analysis that "%zu" means size_t.Hans Wennborg2011-10-271-1/+11
| | | | | | | | The code had it backwards, thinking size_t was signed, and using that for "%zd". Also let the analysis get the types for (u)intmax_t while we are at it. llvm-svn: 143099
* Correctly perform integral promotions on wchar_t/char16_t/char32_t in C++. ↵Eli Friedman2011-10-261-12/+28
| | | | | | <rdar://problem/10309088>. llvm-svn: 143019
* Restore r142914 and r142915, now with missing file and apparentJohn McCall2011-10-251-0/+3
| | | | | | GCC compiler workaround. llvm-svn: 142931
* Revert r142914 and r142915, due to possibly missing file.NAKAMURA Takumi2011-10-251-3/+0
| | | | | | r142914: "Introduce a placeholder type for "pseudo object"" r142915: "Pull the pseudo-object stuff into its own file." llvm-svn: 142921
* Introduce a placeholder type for "pseudo object"John McCall2011-10-251-0/+3
| | | | | | | | | | | | | | | expressions: expressions which refer to a logical rather than a physical l-value, where the logical object is actually accessed via custom getter/setter code. A subsequent patch will generalize the AST for these so that arbitrary "implementing" sub-expressions can be provided. Right now the only client is ObjC properties, but this should be generalizable to similar language features, e.g. Managed C++'s __property methods. llvm-svn: 142914
* Add a new placeholder type to represent "unbridged"John McCall2011-10-171-0/+3
| | | | | | | | casts in ARC. No semantic analysis yet. llvm-svn: 142208
* Provide half floating point support as a storage only type.Anton Korobeynikov2011-10-141-1/+10
| | | | | | Lack of half FP was a regression compared to llvm-gcc. llvm-svn: 142016
* Misc fixes for atomics. Biggest fix is doing alignment correctly for ↵Eli Friedman2011-10-141-3/+15
| | | | | | _Atomic types. llvm-svn: 142002
* Constant expression evaluation refactoring:Richard Smith2011-10-101-14/+11
| | | | | | | | | | | - Remodel Expr::EvaluateAsInt to behave like the other EvaluateAs* functions, and add Expr::EvaluateKnownConstInt to capture the current fold-or-assert behaviour. - Factor out evaluation of bitfield bit widths. - Fix a few places which would evaluate an expression twice: once to determine whether it is a constant expression, then again to get the value. llvm-svn: 141561
* Support for C1x _Atomic specifier (see testcase). This is primarily being ↵Eli Friedman2011-10-061-0/+57
| | | | | | | | committed at the moment to help support C++0x <atomic>, but it should be a solid base for implementing the full specification of C1x _Atomic. Thanks to Jeffrey Yasskin for the thorough review! llvm-svn: 141330
* Use a sidetable in ASTContext for ParmVarDecls whose index exceeds the 8 ↵Ted Kremenek2011-10-061-0/+11
| | | | | | bits reserved for that value in VarDecl. Fixes PR 10538. llvm-svn: 141273
* c: assignment/init of a function pointer whose function(s)Fariborz Jahanian2011-10-051-5/+5
| | | | | | | | return to one which does not return (has noreturn attribute) should warn as it is an unsafe assignment. // rdar://10095762 c++ already handles this. This is the c version. llvm-svn: 141141
* Allow getting all source locations of selector identifiers in a ObjCMethodDecl.Argyrios Kyrtzidis2011-10-031-3/+3
| | | | | | | | | | | | | Instead of always storing all source locations for the selector identifiers we check whether all the identifiers are in a "standard" position; "standard" position is -Immediately before the arguments: -(id)first:(int)x second:(int)y; -With a space between the arguments: -(id)first: (int)x second: (int)y; -For nullary selectors, immediately before ';': -(void)release; In such cases we infer the locations instead of storing them. llvm-svn: 140989
* Add support for alignment-specifiers in C1X and C++11, removePeter Collingbourne2011-09-291-1/+1
| | | | | | | support for the C++0x draft [[align]] attribute and add the C1X standard header file stdalign.h llvm-svn: 140796
* objc arc: Diagnose block pointer type mismatch whenFariborz Jahanian2011-09-281-0/+25
| | | | | | | | some arguments types are ns_consumed and some otherwise matching types are not. This is objc side of // rdar://10187884 llvm-svn: 140729
* Only print _Bool as 'bool' when 'bool' is defined as an object-likeDouglas Gregor2011-09-271-6/+0
| | | | | | macro whose only replacement token is '_Bool'. llvm-svn: 140656
* When 'bool' is not a built-in type but is defined as a macro, printDouglas Gregor2011-09-271-3/+9
| | | | | | | 'bool' rather than '_Bool' within types, to make things a bit more readable. Fixes <rdar://problem/10063263>. llvm-svn: 140650
OpenPOWER on IntegriCloud