aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ASTContext.cpp
AgeCommit message (Collapse)Author
2014-04-25Introduce an Emscripten C++ ABI.Dan Gohman
Emscripten uses the Itanium C++ ABI for most things, except that it uses ARM C++ ABI pointers to member functions, to avoid the overhead of aligning functions.
2013-05-06Grab-bag of bit-field fixes:John McCall
- References to ObjC bit-field ivars are bit-field lvalues; fixes rdar://13794269, which got me started down this. - Introduce Expr::refersToBitField, switch a couple users to it where semantically important, and comment the difference between this and the existing API. - Discourage Expr::getBitField by making it a bit longer and less general-sounding. - Lock down on const_casts of bit-field gl-values until we hear back from the committee as to whether they're allowed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181252 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-06Add SystemZ supportUlrich Weigand
This patch then adds all the usual platform-specific pieces for SystemZ: driver support, basic target info, register names and constraints, ABI info and vararg support. It also adds new tests to verify pre-defined macros and inline asm, and updates a test for the minimum alignment change. This version of the patch incorporates feedback from reviews by Eric Christopher and John McCall. Thanks to all reviewers! Patch by Richard Sandiford. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181211 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-06Allow targets to define minimum alignment for global variablesUlrich Weigand
This patch adds a new common code feature that allows platform code to request minimum alignment of global symbols. The background for this is that on SystemZ, the most efficient way to load addresses of global symbol is the LOAD ADDRESS RELATIVE LONG (LARL) instruction. This instruction provides PC-relative addressing, but only to *even* addresses. For this reason, existing compilers will guarantee that global symbols are always aligned to at least 2. [ Since symbols would otherwise already use a default alignment based on their type, this will usually only affect global objects of character type or character arrays. ] GCC also allows creating symbols without that extra alignment by using explicit "aligned" attributes (which then need to be used on both definition and each use of the symbol). To enable support for this with Clang, this patch adds a TargetInfo::MinGlobalAlign variable that provides a global minimum for the alignment of every global object (unless overridden via explicit alignment attribute), and adds code to respect this setting. Within this patch, no platform actually sets the value to anything but the default 1, resulting in no change in behaviour on any existing target. This version of the patch incorporates feedback from reviews by Eric Christopher and John McCall. Thanks to all reviewers! Patch by Richard Sandiford. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181210 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-04Reverting r181004 since it has broken test/Sema/wchar.c.Aaron Ballman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181122 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-04Implement most of N3638 (return type deduction for normal functions).Richard Smith
Missing (somewhat ironically) is support for the new deduction rules in lambda functions, plus PCH support for return type patching. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181108 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-03Support __wchar_t in -fms-extensions and -fms-compatibility modes.Hans Wennborg
MSVC provides __wchar_t, either as an alias for the built-in wchar_t type, or as a separate type depending on language (C vs C++) and flags (-fno-wchar). In -fms-extensions, Clang will simply accept __wchar_t as an alias for whatever type is used for wide character literals. In -fms-compatibility, we try to mimic MSVC's behavior by always making __wchar_t a builtin type. This fixes PR15815. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181004 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-02[document parsing]: support c++11 type aliasesFariborz Jahanian
with no comment of their own to inherit the comment of their aliased type. // rdar://13752382 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180924 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-30Don't treat a non-deduced 'auto' type as being type-dependent. Instead, thereRichard Smith
are now two distinct canonical 'AutoType's: one is the undeduced 'auto' placeholder type, and the other is a deduced-but-dependent type. All deduced-to-a-non-dependent-type cases are still non-canonical. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180789 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-26documenttion parsing. Provide a c-index testFariborz Jahanian
and limit comment extraction to public c++ bases. // rdar://13647476 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180646 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-26document parsing. When a sub-class (c++ Objective-C) missing Fariborz Jahanian
a comment, grab the first comment found in its class heirarchy. Also, when a category is mossing a comment, grab comment of its primary class. // rdar://13647476 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180629 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-26Implement C++1y decltype(auto).Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180610 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-17[document parsing]: When tag declaration (but not definition!) Fariborz Jahanian
is part of the decl-specifier-seq of some other declaration, it doesn't get comment. // rdar://12390371 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179722 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-17In ASTContext::getOverriddenMethods, call ↵Argyrios Kyrtzidis
overridden_methods_begin/overridden_methods_end directly. This avoids unnecessary Decl::getASTContext() invocations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179653 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-15Revert "Speed-up ObjCMethodDecl::getOverriddenMethods()."Argyrios Kyrtzidis
This reverts commit r179436. Due to caching, it was possible that we could miss overridden methods that were introduced by categories later on. Along with reverting the commit I also included a test case that would have caught this. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179547 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-13Speed-up ObjCMethodDecl::getOverriddenMethods().Argyrios Kyrtzidis
Use an newly introduce ASTContext::getBaseObjCCategoriesAfterInterface() which caches its results instead of re-calculating the categories multiple times. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179436 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-10Add an option to parse all comments as documentation commentsDmitri Gribenko
Patch by Amin Shali. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179180 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-01Don't eagerly deserialize every templated function (and every static dataRichard Smith
member inside a class template) when loading a PCH file or module. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178496 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-28[ms-cxxabi] Correctly compute the size of member pointersReid Kleckner
Summary: This also relaxes the requirement on Windows that the member pointer class type be a complete type (http://llvm.org/PR12070). We still ask for a complete type to instantiate any templates (MSVC does this), but if that fails we continue as normal, relying on any inheritance attributes on the declaration. Reviewers: rjmccall CC: triton, timurrrr, cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D568 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178283 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-21Further weaken block conversion rules to permit blocks withJohn McCall
enum return type to be converted to blocks with any integer type of the same size. rdar://13463504 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177613 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-15Revert "Remove a pointless assertion."Bob Wilson
This reverts commit r177158. I'm blindly reverting this because it appears to be breaking numerous buildbots. I'll reapply if it doesn't turn out to be the culprit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177165 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-15Remove a pointless assertion.Nico Weber
FindNodeOrInsertPos() is called 10 lines earlier already, and the function early-returns there if the result is != 0. InsertPos isn't recomputed after that check, so this assert is always trivially true. (And it has nothing to do with if T is canonical or not.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177158 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-12Remove a bogus assert so we don't crash inRafael Espindola
namespace { struct X {}; } extern "C" { X b = X(); } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176866 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-08ArrayRef-ize ASTContext::getFunctionType and Sema::BuildFunctionType.Jordan Rose
No (intended) functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176726 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-07Promote atomic type sizes up to a power of two, capped byJohn McCall
MaxAtomicPromoteWidth. Fix a ton of terrible bugs with _Atomic types and (non-intrinsic-mediated) loads and stores thereto. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176658 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-22Streamify getNameForDiagnostic and remove the string versions of ↵Benjamin Kramer
PrintTemplateArgumentList. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175894 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-22Comment parsing: add CommentOptions to allow specifying custom comment block ↵Dmitri Gribenko
commands Add an ability to specify custom documentation block comment commands via a new class CommentOptions. The intention is that this class will hold future customizations for comment parsing, including defining documentation comments with specific numbers of parameters, etc. CommentOptions instance is a member of LangOptions. CommentOptions is controlled by a new command-line parameter -fcomment-block-commands=Foo,Bar,Baz. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175892 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20Include llvm::Optional in clang/Basic/LLVM.hDavid Blaikie
Post-commit CR feedback from Jordan Rose regarding r175594. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175679 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-18Replace TypeLoc llvm::cast support to be well-defined.David Blaikie
The TypeLoc hierarchy used the llvm::cast machinery to perform undefined behavior by casting pointers/references to TypeLoc objects to derived types and then using the derived copy constructors (or even returning pointers to derived types that actually point to the original TypeLoc object). Some context is in this thread: http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056804.html Though it's spread over a few months which can be hard to read in the mail archive. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175462 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-15objective-C: Fixes a compiler crash when encodingFariborz Jahanian
an ivar of type pointer to a typedef'ed object. // rdar://13190095 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175298 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07Add OpenCL samplers as Clang builtin types and check sampler related ↵Guy Benyei
restrictions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174601 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-03Constify ASTContext::getObjContainingInterfaceDmitri Gribenko
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174282 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-31Add support for AArch64 target.Tim Northover
In cooperation with the LLVM patch, this should implement all scalar front-end parts of the C and C++ ABIs for AArch64. This patch excludes the NEON support also reviewed due to an outbreak of batshit insanity in our legal department. That will be committed soon bringing the changes to precisely what has been approved. Further reviews would be gratefully received. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174055 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-27Comment parsing: attach any tag type's documentation to its typedef if latterDmitri Gribenko
does not have one of its own. // rdar://13067629 Original patch (r173586 and r173587) by Fariborz Jahanian, modified by me. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173626 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-27Revert r173586 (and r173587) , "Attach any tag type's documentation to its ↵NAKAMURA Takumi
typedef if" It caused unexpected warnings with @tparam. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173614 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-26Fix comment.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173587 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-26Attach any tag type's documentation to its typedef ifFariborz Jahanian
latter does not have one of its own. // rdar://13067629 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173586 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-26Added ASTContext methods getIntPtrType and getUIntPtrType.Enea Zaffanella
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173581 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25simplify code by removing excessive bracing.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173521 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25Attach enum's documentation to its typedef ifFariborz Jahanian
latter does not have one of its own. // rdar://13067629 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173516 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25The standard ARM C++ ABI dictates that inline functions areJohn McCall
never key functions. We did not implement that rule for the iOS ABI, which was driven by what was implemented in gcc-4.2. However, implement it now for other ARM-based platforms. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173515 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25First pass at abstracting out a class for the target C++ ABI.John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173514 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23Add a new LangOpt NativeHalfType. This option allows for native half/fp16Joey Gouly
operations (as opposed to storage only half/fp16). Also add some semantic checks for OpenCL half types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173254 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-20Implement OpenCL event_t as Clang builtin type, including event_t related ↵Guy Benyei
OpenCL restrictions (OpenCL 1.2 spec 6.9) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172973 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-17In Objective-C ARC, completely ignore ownership qualifiers on theDouglas Gregor
return type of a function by canonicalizing them away. They are useless anyway, and conflict with our rules for template argument deduction and __strong. Fixes <rdar://problem/12367446>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172768 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16Rework the traversal of Objective-C categories and extensions toDouglas Gregor
consider (sub)module visibility. The bulk of this change replaces myriad hand-rolled loops over the linked list of Objective-C categories/extensions attached to an interface declaration with loops using one of the four new category iterator kinds: visible_categories_iterator: Iterates over all visible categories and extensions, hiding any that have their "hidden" bit set. This is by far the most commonly used iterator. known_categories_iterator: Iterates over all categories and extensions, ignoring the "hidden" bit. This tends to be used for redeclaration-like traversals. visible_extensions_iterator: Iterates over all visible extensions, hiding any that have their "hidden" bit set. known_extensions_iterator: Iterates over all extensions, whether they are visible to normal name lookup or not. The effect of this change is that any uses of the visible_ iterators will respect module-import visibility. See the new tests for examples. Note that the old accessors for categories and extensions are gone; there are *Raw() forms for some of them, for those (few) areas of the compiler that have to manipulate the linked list of categories directly. This is generally discouraged. Part two of <rdar://problem/10634711>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172665 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-12Disable caching of visibility.Rafael Espindola
The testcase in pr14929 shows that this is extremely hard to do. If we choose to apply the attribute, that causes the visibility of some decls to change and that can happen really late (during codegen). Current gcc warns and ignores the attribute in this testcase with a warning. This suggest that the correct solution is to find a point in the compilation where we can compute the visibility and * assert it was never computed before * reject any attempts to compute it again in the future (with warnings). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172305 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-12comment parsing: when property accessors don't have commentFariborz Jahanian
of their own (or are syntheszed), use prperty's comment. for them. // rdar://12791315 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172278 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-09Suppress GCC -Wreturn warning.David Blaikie
Modified from a patch by David Greene. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171982 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-08Clear the LV cache when setting the instantiated from link.Rafael Espindola
Fixes pr14835. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171857 91177308-0d34-0410-b5e6-96231b3b80d8