summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement support for C++11 in-class initialization of non-static data members.Richard Smith2011-06-111-6/+12
| | | | llvm-svn: 132878
* Objective-C doesn't consider the use of incomplete types as methodDouglas Gregor2011-05-271-3/+16
| | | | | | | | | | | | | | parameter types to be ill-formed. However, it relies on the completeness of method parameter types when producing metadata, e.g., for a protocol, leading IR generating to crash in such cases. Since there's no real way to tighten down the semantics of Objective-C here without breaking existing code, do something safe but lame: suppress the generation of metadata when this happens. Fixes <rdar://problem/9123036>. llvm-svn: 132171
* Implement a little bit of cleanup and a lot more of the base workAlexis Hunt2011-05-251-1/+13
| | | | | | | | behind implicit moves. We now correctly identify move constructors and assignment operators and update bits on the record correctly. Generation of implicit moves (declarations or definitions) is not yet supported. llvm-svn: 132080
* Properly align UnaryTransformType when allocating itDouglas Gregor2011-05-251-3/+4
| | | | llvm-svn: 132064
* Implement a new type node, UnaryTransformType, designed to represent aAlexis Hunt2011-05-241-0/+18
| | | | | | | | type that turns one type into another. This is used as the basis to implement __underlying_type properly - with TypeSourceInfo and proper behavior in the face of templates. llvm-svn: 132017
* It's considered poor form to create references to the overloadedDouglas Gregor2011-05-211-0/+3
| | | | | | | function type. Educate template argument deduction thusly, fixing PR9974 / <rdar://problem/9479155>. llvm-svn: 131811
* Reapply the commits that r131401 reverted and add a fix for PR9927.Argyrios Kyrtzidis2011-05-171-23/+164
| | | | llvm-svn: 131446
* Revert 131377, 131369 and 131365.Rafael Espindola2011-05-161-163/+23
| | | | | | 131365 caused PR9927. llvm-svn: 131401
* Fix MSVC build.Argyrios Kyrtzidis2011-05-151-1/+1
| | | | llvm-svn: 131377
* Fix generation of obj-c @encoding for members with zero size.Argyrios Kyrtzidis2011-05-151-25/+33
| | | | | | Also follow gcc in that arrays of elements with zero size are encoded as arrays with zero elements. llvm-svn: 131369
* Create proper Objective-C @encoding for C++ classes; fixes rdar://9357400.Argyrios Kyrtzidis2011-05-141-20/+152
| | | | | | | | | | | | | | | | | | Go through and expand the members of bases into the encoding string (and encode the VTable as well). Unlike gcc which expands virtual bases as many times as they appear in the hierarchy, clang will only expand them once at the end, to reflect the actual layout. Note that there doesn't seem to be a way to indicate in the encoding that packing/alignment of members is different that normal, in which case the encoding will be out-of-sync with the real layout. If the runtime switches to just consider the size of types without taking into account alignment, we could easily make padding explicit in the encoding (e.g. using arrays of chars). The encoding strings would be longer then though. Also encode a flexible array member as array of 0 size, like gcc, not as a pointer. llvm-svn: 131365
* Rename "hasTrivialConstructor" to "hasTrivialDefaultConstructor" andAlexis Hunt2011-05-091-2/+5
| | | | | | | modify the semantics slightly to accomodate default constructors (I hope). llvm-svn: 131087
* Establish a new alignment for an ms_struct bitfield followingFariborz Jahanian2011-05-061-0/+12
| | | | | | a non-bitfield if size of their types differ. llvm-svn: 131023
* Modify some deleted function methods to better reflect reality:Alexis Hunt2011-05-061-1/+1
| | | | | | | | | | | | | | | | | | | | - New isDefined() function checks for deletedness - isThisDeclarationADefinition checks for deletedness - New doesThisDeclarationHaveABody() does what isThisDeclarationADefinition() used to do - The IsDeleted bit is not propagated across redeclarations - isDeleted() now checks the canoncial declaration - New isDeletedAsWritten() does what it says on the tin. - isUserProvided() now correct (thanks Richard!) This fixes the bug that we weren't catching void foo() = delete; void foo() {} as being a redefinition. llvm-svn: 131013
* Implement support for C++0x alias templates.Richard Smith2011-05-051-18/+38
| | | | llvm-svn: 130953
* __alignof attribute on the field must considerFariborz Jahanian2011-05-051-0/+4
| | | | | | packed attribute on the field. //rdar://9217290 llvm-svn: 130948
* More ms_struct bitfield stuff:Fariborz Jahanian2011-05-041-0/+7
| | | | | | | | Adjacent bit fields are packed into the same 1-, 2-, or 4-byte allocation unit if the integral types are the same size. // rdar://8823265. llvm-svn: 130851
* Only the first zero-length bitfield decides alignment ofFariborz Jahanian2011-05-031-1/+2
| | | | | | | the followup data member in an ms_struct struct. // rdar:// 8823265 llvm-svn: 130795
* More rule enforcement of zero bitfields for ms_struct.Fariborz Jahanian2011-05-021-0/+7
| | | | llvm-svn: 130696
* Re-applies the patch first applied way back in r106099, withChandler Carruth2011-05-011-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | accompanying fixes to make it work today. The core of this patch is to provide a link from a TemplateTypeParmType back to the TemplateTypeParmDecl node which declared it. This in turn provides much more precise information about the type, where it came from, and how it functions for AST consumers. To make the patch work almost a year after its first attempt, it needed serialization support, and it now retains the old getName() interface. Finally, it requires us to not attempt to instantiate the type in an unsupported friend decl -- specifically those coming from template friend decls but which refer to a specific type through a dependent name. A cleaner representation of the last item would be to build FriendTemplateDecl nodes for these, storing their template parameters etc, and to perform proper instantation of them like any other template declaration. They can still be flagged as unsupported for the purpose of access checking, etc. This passed an asserts-enabled bootstrap for me, and the reduced test case mentioned in the original review thread no longer causes issues, likely fixed at somewhere amidst the 24k revisions that have elapsed. llvm-svn: 130628
* PR9792: Make sure to use the right definition of wchar_t when the defaultEli Friedman2011-04-301-1/+1
| | | | | | wchar_t is an unsigned type. llvm-svn: 130620
* Enhance clang_getCXTUResourceUsage() to report the amount of memory used by ↵Ted Kremenek2011-04-281-0/+16
| | | | | | ASTContext's side tables. llvm-svn: 130383
* Some refactoring of my ms_struct patch.Fariborz Jahanian2011-04-271-0/+7
| | | | | | // rdar://8823265 related. llvm-svn: 130311
* Gcc pads the size of an array using the alignment of its elements.Argyrios Kyrtzidis2011-04-261-0/+1
| | | | | | | The size of the array may not be aligned according to alignment of its elements if an alignment attribute is specified in a typedef. Fixes rdar://8665729 & http://llvm.org/PR5637. llvm-svn: 130242
* Make yet another placeholder type, this one marking that an expression is a ↵John McCall2011-04-261-0/+3
| | | | | | | | | | | bound member function, i.e. something of the form 'x.f' where 'f' is a non-static member function. Diagnose this in the general case. Some of the new diagnostics are probably worse than the old ones, but we now get this right much more universally, and there's certainly room for improvement in the diagnostics. llvm-svn: 130239
* Give invalid tag types 8-bit size and alignment, rather than 1-bitDouglas Gregor2011-04-201-2/+2
| | | | | | | | alignment, which causes traps further down the line. Fixes <rdar://problem/9109755>, which contains a test case far too large to commit :( llvm-svn: 129861
* Fix a bug in calculation of composite typeFariborz Jahanian2011-04-181-3/+3
| | | | | | | | of conditional expressions of objc pointer types where one type is the immediate base type of the other. // rdar://9296866 llvm-svn: 129718
* Support for C++11 (non-template) alias declarations.Richard Smith2011-04-151-5/+6
| | | | llvm-svn: 129567
* fix a bunch of comment typos found by codespell. Patch byChris Lattner2011-04-151-1/+1
| | | | | | Luis Felipe Strano Moraes! llvm-svn: 129559
* Add support for C++0x's range-based for loops, as specified by the C++11 ↵Richard Smith2011-04-141-0/+16
| | | | | | draft standard (N3291). llvm-svn: 129541
* Fix a regression where the initializer implementsFariborz Jahanian2011-04-121-4/+4
| | | | | | | the initialized's protocol and yet clang warns. objective-c issue, // rdar://9267196 llvm-svn: 129363
* PR8369: make __attribute((regparm(0))) work correctly. Original patch byEli Friedman2011-04-091-0/+3
| | | | | | pageexec@freemail.hu, tweaks by me. llvm-svn: 129206
* Warn for any kind of initialization if initializer does notFariborz Jahanian2011-04-081-4/+41
| | | | | | | implement lhs's protocols. // rdar://9091389. llvm-svn: 129142
* Basic, untested implementation for an "unknown any" type requested by LLDB.John McCall2011-04-071-0/+3
| | | | | | | | | | | | The idea is that you can create a VarDecl with an unknown type, or a FunctionDecl with an unknown return type, and it will still be valid to access that object as long as you explicitly cast it at every use. I'm still going back and forth about how I want to test this effectively, but I wanted to go ahead and provide a skeletal implementation for the LLDB folks' benefit and because it also improves some diagnostic goodness for placeholder expressions. llvm-svn: 129065
* Implement a new 'availability' attribute, that allows one to specifyDouglas Gregor2011-03-231-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | which versions of an OS provide a certain facility. For example, void foo() __attribute__((availability(macosx,introduced=10.2,deprecated=10.4,obsoleted=10.6))); says that the function "foo" was introduced in 10.2, deprecated in 10.4, and completely obsoleted in 10.6. This attribute ties in with the deployment targets (e.g., -mmacosx-version-min=10.1 specifies that we want to deploy back to Mac OS X 10.1). There are several concrete behaviors that this attribute enables, as illustrated with the function foo() above: - If we choose a deployment target >= Mac OS X 10.4, uses of "foo" will result in a deprecation warning, as if we had placed attribute((deprecated)) on it (but with a better diagnostic) - If we choose a deployment target >= Mac OS X 10.6, uses of "foo" will result in an "unavailable" warning (in C)/error (in C++), as if we had placed attribute((unavailable)) on it - If we choose a deployment target prior to 10.2, foo() is weak-imported (if it is a kind of entity that can be weak imported), as if we had placed the weak_import attribute on it. Naturally, there can be multiple availability attributes on a declaration, for different platforms; only the current platform matters when checking availability attributes. The only platforms this attribute currently works for are "ios" and "macosx", since we already have -mxxxx-version-min flags for them and we have experience there with macro tricks translating down to the deprecated/unavailable/weak_import attributes. The end goal is to open this up to other platforms, and even extension to other "platforms" that are really libraries (say, through a #pragma clang define_system), but that hasn't yet been designed and we may want to shake out more issues with this narrower problem first. Addresses <rdar://problem/6690412>. As a drive-by bug-fix, if an entity is both deprecated and unavailable, we only emit the "unavailable" diagnostic. llvm-svn: 128127
* Add support for language-specific address spaces. On top of that,Peter Collingbourne2011-03-181-5/+24
| | | | | | | | | add support for the OpenCL __private, __local, __constant and __global address spaces, as well as the __read_only, _read_write and __write_only image access specifiers. Patch originally by ARM; language-specific address space support by myself. llvm-svn: 127915
* Block return type of the initialized must beFariborz Jahanian2011-03-141-6/+8
| | | | | | | | be more speciaclized than that of the initializer, when matching protocol qualifier list. // rdar:// 9118343. llvm-svn: 127585
* Instead of storing an ASTContext* in FunctionProtoTypes with computed ↵Sebastian Redl2011-03-131-4/+4
| | | | | | noexcept specifiers, unique FunctionProtoTypes with a ContextualFoldingSet, as suggested by John McCall. llvm-svn: 127568
* Propagate the new exception information to FunctionProtoType.Sebastian Redl2011-03-121-5/+11
| | | | | | | | Change the interface to expose the new information and deal with the enormous fallout. Introduce the new ExceptionSpecificationType value EST_DynamicNone to more easily deal with empty throw specifications. Update the tests for noexcept and fix the various bugs uncovered, such as lack of tentative parsing support. llvm-svn: 127537
* Fixed InnerLocStart.Abramo Bagnara2011-03-091-12/+12
| | | | llvm-svn: 127330
* Fixed source range for all DeclaratorDecl's.Abramo Bagnara2011-03-081-6/+10
| | | | llvm-svn: 127225
* Fixed TypedefDecl and TemplateTypeParameter source range.Abramo Bagnara2011-03-061-1/+3
| | | | llvm-svn: 127119
* Reinstate r127112, "Propagate new-style exception spec information to ↵Sebastian Redl2011-03-061-6/+3
| | | | | | ExtProtoInfo.", this time with the missing header. llvm-svn: 127118
* Revert r127112, "Propagate new-style exception spec information to ↵NAKAMURA Takumi2011-03-061-3/+6
| | | | | | | | ExtProtoInfo." It seems missing "clang/Basic/ExceptionSpecificationType.h". llvm-svn: 127115
* Propagate new-style exception spec information to ExtProtoInfo.Sebastian Redl2011-03-051-6/+3
| | | | llvm-svn: 127112
* Eliminate redundant nested-name-specifiers onDouglas Gregor2011-03-031-0/+8
| | | | | | TemplateSpecializationTypes, which also fixes PR9388. llvm-svn: 126946
* Implement -mrtd which sets the StdCall calling convention to be the defaultRoman Divacky2011-03-011-4/+11
| | | | | | one. llvm-svn: 126756
* Push nested-name-specifier source location information intoDouglas Gregor2011-02-281-0/+11
| | | | | | | | CXXDependentScopeMemberExpr, and clean up instantiation of nested-name-specifiers with dependent template specialization types in the process. llvm-svn: 126663
* From Vassil Vassilev:Axel Naumann2011-02-281-4/+0
| | | | | | | | * Add default implementations (no-op) for ExternalASTSource's pure virtual functions. There are valid use cases that can live with these defaults. * Move ExternalASTSource's out of line implementations into separate source file. * Whitespace, forward decl, #include cleanup. llvm-svn: 126648
* When we encounter a dependent template name within aDouglas Gregor2011-02-281-5/+7
| | | | | | | | | | | | nested-name-specifier, e.g., T::template apply<U>:: represent the dependent template name specialization as a DependentTemplateSpecializationType, rather than a TemplateSpecializationType with a dependent TemplateName. llvm-svn: 126593
OpenPOWER on IntegriCloud