summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
Commit message (Collapse)AuthorAgeFilesLines
* Add class-specific operator new to Decl hierarchy. This guarantees that DeclsRichard Smith2013-11-227-375/+284
| | | | | | | | | | | | | 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
* Test commit for the user "kromanova" to verify commit access. I removed ↵Ekaterina Romanova2013-11-211-1/+1
| | | | | | "UNSUPPORTED" comment because unsigned __int128 type is in fact supported. llvm-svn: 195378
* Revert "Add new attribute 'objc_suppress_protocol' to suppress protocol ↵Ted Kremenek2013-11-211-22/+4
| | | | | | | | | | | conformance for a class." After implementing this patch, a few concerns about the language feature itself emerged in my head that I had previously not considered. I want to resolve those design concerns first before having a half-designed language feature in the tree. llvm-svn: 195328
* Add new attribute 'objc_suppress_protocol' to suppress protocol conformance ↵Ted Kremenek2013-11-211-4/+22
| | | | | | | | | | | | | | | | | | | | | | | for a class. The idea is to allow a class to stipulate that its methods (and those of its parents) cannot be used for protocol conformance in a subclass. A subclass is then explicitly required to re-implement those methods of they are present in the class marked with this attribute. Currently the attribute can only be applied to an @interface, and not a category or class extension. This is by design. Unlike protocol conformance, where a category can add explicit conformance of a protocol to class, this anti-conformance really needs to be observed uniformly by all clients of the class. That's because the absence of the attribute implies more permissive checking of protocol conformance. This unfortunately required changing method lookup in ObjCInterfaceDecl to take an optional protocol parameter. This should not slow down method lookup in most cases, and is just used for protocol conformance. llvm-svn: 195323
* ObjectiveC ARC. Better checking of toll free briding Fariborz Jahanian2013-11-201-11/+9
| | | | | | | from qualified-id objects to CF types with objc_bridge annotation. // rdar://15454846 llvm-svn: 195264
* ObjectiveC ARC. validate toll free bridge castingFariborz Jahanian2013-11-201-0/+58
| | | | | | | to or from 'id' and qualified-id types. // rdar://15454846 llvm-svn: 195178
* Add a mangler entry point for TBAA rather than using RTTI directlyReid Kleckner2013-11-192-0/+14
| | | | | | | | | | | | | | | | | | | | Summary: RTTI is not yet implemented for the Microsoft C++ ABI and isn't expected soon. We could easily add the mangling, but the error is what prevents us from silently miscompiling code that expects RTTI. Instead, add a new mangleTypeName entry point that simply forwards to mangleName or mangleType to produce a string that isn't part of the ABI. Itanium can continue to use RTTI names to avoid unecessary test breakage. This also seems like the right design. The fact that TBAA names happen to be RTTI names is now an implementation detail of the mangler, rather than part of TBAA. Differential Revision: http://llvm-reviews.chandlerc.com/D2153 llvm-svn: 195168
* Microsoft Record Layout: zero sized base after base with vbtbl fixWarren Hunt2013-11-191-0/+11
| | | | | | | | | | Microsoft adds an extra byte of padding before laying out zero sized non-virtual bases if the non-virtual base before it contains a vbptr. This patch adds the same behavior to clang. Differential Revision: http://llvm-reviews.chandlerc.com/D2106 llvm-svn: 195158
* Fix the problem that the arm_neon.h can't be used in a cpp file. Also fix a ↵Hao Liu2013-11-171-3/+3
| | | | | | minor bug with poly64 name mangling. llvm-svn: 194952
* [-cxx-abi microsoft] Emit thunks for pointers to virtual member functionsHans Wennborg2013-11-151-0/+15
| | | | | | | | | | | | | | | | Instead of storing the vtable offset directly in the function pointer and doing a branch to check for virtualness at each call site, the MS ABI generates a thunk for calling the function at a specific vtable offset, and puts that in the function pointer. This patch adds support for emitting such thunks. However, it doesn't support pointers to virtual member functions that are variadic, have an incomplete aggregate return type or parameter, or are overriding a function in a virtual base class. Differential Revision: http://llvm-reviews.chandlerc.com/D2104 llvm-svn: 194827
* Modern gcc is happy to constant evaluate __builtin_strlen in various casesRichard Smith2013-11-151-17/+42
| | | | | | | where we didn't. Extend our constant evaluation for __builtin_strlen to handle any constant array of chars, not just string literals, to match. llvm-svn: 194762
* DR408: If a static data member of incomplete array type is declared in a classRichard Smith2013-11-141-0/+3
| | | | | | | | | | template, that member has a dependent type (even if we can see the definition of the member of the primary template), because the array size could change in a member specialization. Patch by Karthik Bhat! llvm-svn: 194740
* [OpenCL] Make sure we put string literals in the constant address space.Joey Gouly2013-11-141-0/+2
| | | | llvm-svn: 194717
* Added warning on structures/unions that are empty or contain onlySerge Pavlov2013-11-142-19/+22
| | | | | | | | | | 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
* No functional change. Renaming a variable in RecordLayoutBuilder and Warren Hunt2013-11-132-12/+15
| | | | | | | | improving comments to make documentation more accurate. Differential Revision:http://llvm-reviews.chandlerc.com/D2172 llvm-svn: 194609
* XCore target requires preferred alignment.Robert Lytton2013-11-121-0/+4
| | | | | | | | The xcore llvm backend does not handle 8 byte alignment viz: "%BadAlignment = alloca i64, align 8" So getPreferredTypeAlign() must never overalign. llvm-svn: 194462
* -fms-compatibility: Use C++98 null pointer constant rulesReid Kleckner2013-11-121-2/+8
| | | | | | Patch by Will Wilson! llvm-svn: 194441
* Avoid double StringMap lookups. No functionality change.Benjamin Kramer2013-11-101-5/+3
| | | | llvm-svn: 194355
* CommentSema: Factor code better. No functionality change.Benjamin Kramer2013-11-101-44/+28
| | | | llvm-svn: 194354
* Make -fdump-vtable-layouts print to stdout, not stderrReid Kleckner2013-11-081-3/+3
| | | | | | | | | | | | | This makes it consistent with -fdump-record-layouts, which was moved to outs() in r186219. My reasoning for going with stdout is that when one of these options is present, the layouts are really a program output, and shouldn't be interleaved with diagnostics, which are on stderr. Reviewers: timurrrr Differential Revision: http://llvm-reviews.chandlerc.com/D2127 llvm-svn: 194279
* Thread the info about vbptr sharing through ASTRecordLayoutTimur Iskhodzhanov2013-11-083-28/+14
| | | | | | Reviewed at http://llvm-reviews.chandlerc.com/D2120 llvm-svn: 194256
* PR17615: A delegating constructor initializer is a full-expression. Don'tRichard Smith2013-11-071-2/+5
| | | | | | forget to clean up temporaries at the end of it. llvm-svn: 194213
* Minor refinement of VTableBuilder.h: fix wrong indentation, rename a struct ↵Timur Iskhodzhanov2013-11-071-2/+2
| | | | | | field with a more appropriate name llvm-svn: 194202
* [-fms-extensions] Add support for __FUNCDNAME__David Majnemer2013-11-063-0/+29
| | | | | | | | | | | | | | | | Summary: Similar to __FUNCTION__, MSVC exposes the name of the enclosing mangled function name via __FUNCDNAME__. This implementation is very naive and unoptimized, it is expected that __FUNCDNAME__ would be used rarely in practice. Reviewers: rnk, rsmith, thakis CC: cfe-commits, silvas Differential Revision: http://llvm-reviews.chandlerc.com/D2109 llvm-svn: 194181
* Silencing some MSVC warnings about not all control paths returning a value ↵Aaron Ballman2013-11-061-0/+2
| | | | | | when they actually do. llvm-svn: 194156
* Fix PR17738 - add support for vtordisp thunks when using -cxx-abi microsoftTimur Iskhodzhanov2013-11-063-41/+146
| | | | llvm-svn: 194132
* More constant evaluation cleanup, and fix an issue where we'd override anRichard Smith2013-11-061-22/+25
| | | | | | | earlier 'non-constant' diagnostic with a later one if the earlier one was from a side-effect we thought we could evaluate past. llvm-svn: 194117
* Microsoft adds weird padding before virtual bases if the last field was a ↵Warren Hunt2013-11-061-0/+9
| | | | | | | | | | bitfield This patch adds the same behavior to clang. Differential Revision: http://llvm-reviews.chandlerc.com/D2103 llvm-svn: 194115
* Introduce DynTypedNode::print, dump and getSourceRange.Peter Collingbourne2013-11-061-0/+47
| | | | | | | | | These functions can generally be applied to multiple kinds of AST node, so it makes sense to add them to DynTypedNode. Differential Revision: http://llvm-reviews.chandlerc.com/D2096 llvm-svn: 194113
* Simplify: we don't care why constant evaluation might have failed when we'reRichard Smith2013-11-051-6/+3
| | | | | | checking an expression for constant overflow. llvm-svn: 194099
* Refactor constant expression handling and make a couple of tweaks to make it aRichard Smith2013-11-051-64/+156
| | | | | | | | | bit more robust against future changes. This includes a slight diagnostic improvement: if we know we're only trying to form a constant expression, take the first diagnostic which shows the expression is not a constant expression, rather than preferring the first one which makes the expression unfoldable. llvm-svn: 194098
* Fix vbtable indices when a class shares the vbptr with a non-virtual baseTimur Iskhodzhanov2013-11-051-38/+80
| | | | llvm-svn: 194082
* 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
* Implement final resolution of DR1402: implicitly-declared move operators thatRichard Smith2013-11-042-4/+0
| | | | | | | | | | | would be deleted are still declared, but are ignored by overload resolution. Also, don't delete such members if a subobject has no corresponding move operation and a non-trivial copy. This causes us to implicitly declare move operations in more cases, but risks move-assigning virtual bases multiple times in some circumstances (a warning for that is to follow). llvm-svn: 193969
* Sema: Do not allow overloading between methods based on restrictDavid Majnemer2013-11-031-1/+6
| | | | | | | | | | | | | | | | If the sole distinction between two declarations is that one has a __restrict qualifier then we should not consider it to be an overload. Instead, we will consider it as an incompatible redeclaration which is similar to how MSVC, ICC and GCC would handle it. This fixes PR17786. N.B. We must not mangle in __restrict into method qualifiers becase we don't allow overloading between such declarations anymore. To do otherwise would be a violation of the Itanium ABI. llvm-svn: 193964
* OS X 10.9+ and iOS 7+ support load/store of big atomic objects.Bob Wilson2013-11-021-0/+4
| | | | | | | | rdar://13973577 Patch by Fariborz Jahanian. llvm-svn: 193935
* Improves compatibility with cl.exe when laying out array fieldsWarren Hunt2013-11-012-21/+9
| | | | | | | | | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D2090 Clang was "improperly" over-aligning arrays with sizes are not a multiple of their alignment. This behavior was removed in microsoft 32 bit mode. In addition, after examination of ASTContext::getTypeInfoImpl, a redundant code block in MicrosoftRecordLayoutBuilder::getAdjustedFieldInfo was deleted. llvm-svn: 193898
* 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
* Make thunk this/return adjustment ABI-specific. Also, fix the return ↵Timur Iskhodzhanov2013-10-302-56/+46
| | | | | | | | adjustment when using -cxx-abi microsoft Reviewed at http://llvm-reviews.chandlerc.com/D2026 llvm-svn: 193679
* Fix an assertion when handling a custom case of virtual inheritance; also ↵Timur Iskhodzhanov2013-10-291-24/+2
| | | | | | reduce code duplication llvm-svn: 193610
* ObjectiveC: under -Wunused-property-ivar warn if property'sFariborz Jahanian2013-10-253-4/+8
| | | | | | | backing warning is not used in one of its accessor methods. // rdar://14989999 llvm-svn: 193439
* Remove dead variables.Benjamin Kramer2013-10-251-11/+2
| | | | llvm-svn: 193395
* Remove dead recursive function.Benjamin Kramer2013-10-241-22/+0
| | | | llvm-svn: 193313
* Implements 64 bit microsoft record layout and adds lit tests to cover Warren Hunt2013-10-231-388/+70
| | | | | | | | | it. Also removes all of the microsoft C++ ABI related code from the itanium layout builder. Differential Revision: http://llvm-reviews.chandlerc.com/D2003 llvm-svn: 193290
* AST: Mangle fields in anonymous structs/unionsDavid Majnemer2013-10-232-4/+6
| | | | | | | | | | | | | 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
* Refactor out the circular reference to LambdaExpr in CXXRecordDecl.Faisal Vali2013-10-231-5/+9
| | | | | | | | | | | | | | | | | A prior commit of this patch was reverted because it was within the blamelist's purview of a failing test. The failure of that test has been addressed here: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20131021/091546.html. Therefore I am recommitting this patch (all tests pass on windows, except for the usual modules & index suspects that never pass on my box). Some background: Both Doug and Richard had asked me in Chicago to remove the circular reference in CXXRecordDecl to LambdaExpr by factoring out and storing the needed information from LambdaExpr directly into CXXRecordDecl. In addition, I have added an IsGenericLambda flag - this makes life a little easier when we implement capturing, and are Sema-analyzing the body of a lambda (and the calloperator hasn't been wired to the closure class yet). Any inner lambdas can have potential captures that could require walking up the scope chain and checking if any generic lambdas are capture-ready. This 'bit' makes some of that checking easier. No change in functionality. This patch was approved by Doug with minor modifications (comments were cleaned up, and all data members were converted from bool/enum to unsigned, as requested): http://llvm-reviews.chandlerc.com/D1856 Thanks! llvm-svn: 193246
* Revert r193223 and r193216.Rafael Espindola2013-10-231-9/+5
| | | | | | | | | | They were causing CodeGenCXX/mangle-exprs.cpp to fail. Revert "Remove the circular reference to LambdaExpr in CXXRecordDecl." Revert "Again: Teach TreeTransform and family how to transform generic lambdas nested within templates and themselves." llvm-svn: 193226
* Remove the circular reference to LambdaExpr in CXXRecordDecl.Faisal Vali2013-10-231-5/+9
| | | | | | | | | | | | | | | Both Doug and Richard had asked me to remove the circular reference in CXXRecordDecl to LambdaExpr by factoring out and storing the needed information from LambdaExpr directly into CXXRecordDecl. No change in functionality. In addition, I have added an IsGenericLambda flag - this makes life a little easier when we implement capturing, and are Sema-analyzing the body of a lambda (and the calloperator hasn't been wired to the closure class yet). Any inner lambdas can have potential captures that could require walking up the scope chain and checking if any generic lambdas are capture-ready. This 'bit' makes some of that checking easier. This patch was approved by Doug with minor modifications (comments were cleaned up, and all data members were converted from bool/enum to unsigned, as requested): http://llvm-reviews.chandlerc.com/D1856 Thanks! llvm-svn: 193223
* Teach AST dumper to dump the containing module and hidden flag for declarations.Richard Smith2013-10-221-0/+7
| | | | llvm-svn: 193210
* 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
OpenPOWER on IntegriCloud