summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Document that GetTypeForDeclarator() cannot return a null type.Nico Weber2015-01-041-1/+1
| | | | | | | | | | | | | Also add a few asserts for this. The existing code assumes this in a bunch of places already (see e.g. the assert at the top of ParseTypedefDecl(), and there are many unchecked calls on the result of GetTypeForDeclarator()), and from looking through the code this should always be true from what I can tell. This allows removing ASTContext::getNullTypeSourceInfo() too as that's now unused. No behavior change intended. llvm-svn: 225125
* [OpenCL] Generic address space has been added in OpenCL v2.0.Anastasia Stulova2014-11-261-3/+4
| | | | | | | | | | To support it in the frontend, the following has been added: - generic address space type attribute; - documentation for the OpenCL address space attributes; - parsing of __generic(generic) keyword; - test code for the parser and diagnostics. llvm-svn: 222831
* PR21437, final part of DR1330: delay-parsing of exception-specifications. ThisRichard Smith2014-11-131-0/+56
| | | | | | | is a re-commit of Doug's r154844 (modernized and updated to fit into current Clang). llvm-svn: 221918
* [OPENMP] Codegen for threadprivate variablesAlexey Bataev2014-11-111-1/+3
| | | | | | | | | For all threadprivate variables which have constructor/destructor emit call to void __kmpc_threadprivate_register(ident_t * <Current Location>, void *<Original Global Addr>, kmpc_ctor <Constructor>, kmpc_cctor NULL, kmpc_dtor <Destructor>); In expressions all references to such variables are replaced by calls to void *__kmpc_threadprivate_cached(ident_t *<Current Location>, kmp_int32 <Current Thread Id>, void *<Original Global Addr>, size_t <Size of Data>, void ***<Pointer to autogenerated cache – array of private copies of threadprivate variable>); Test test/OpenMP/threadprivate_codegen.cpp checks that codegen is correct. Also it checks that codegen is correct after serialization/deserialization and one of passes verifies debug info. Differential Revision: http://reviews.llvm.org/D4002 llvm-svn: 221663
* [Sanitizer] Refactor sanitizer options in LangOptions.Alexey Samsonov2014-11-111-1/+1
| | | | | | | | | | | | | | | | | | Get rid of ugly SanitizerOptions class thrust into LangOptions: * Make SanitizeAddressFieldPadding a regular language option, and rely on default behavior to initialize/reset it. * Make SanitizerBlacklistFile a regular member LangOptions. * Introduce the helper class "SanitizerSet" to represent the set of enabled sanitizers and make it a member of LangOptions. It is exactly the entity we want to cache and modify in CodeGenFunction, for instance. We'd also be able to reuse SanitizerSet in CodeGenOptions for storing the set of recoverable sanitizers, and in the Driver to represent the set of sanitizers turned on/off by the commandline flags. No functionality change. llvm-svn: 221653
* Rename TemplateArgument::getTypeForDecl to getParamTypeForDecl for clarityDavid Blaikie2014-10-171-1/+1
| | | | | | Code review feedback from Richard Smith on r219900. llvm-svn: 220060
* Teach SanitizerBlacklist to blacklist by SourceLocation. NFC.Alexey Samsonov2014-10-161-1/+1
| | | | llvm-svn: 219993
* PR21246: DebugInfo: Emit the appropriate type (cv qualifiers, ↵David Blaikie2014-10-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | reference-ness, etc) for non-type template parameters Plumb through the full QualType of the TemplateArgument::Declaration, as it's insufficient to only know whether the type is a reference or pointer (that was necessary for mangling, but insufficient for debug info). This shouldn't increase the size of TemplateArgument as TemplateArgument::Integer is still longer by another 32 bits. Several bits of code were testing that the reference-ness of the parameters matched, but this seemed to be insufficient (various other features of the type could've mismatched and wouldn't've been caught) and unnecessary, at least insofar as removing those tests didn't cause anything to fail. (Richard - perchaps you can hypothesize why any of these checks might need to test reference-ness of the parameters (& explain why reference-ness is part of the mangling - I would've figured that for the reference-ness to be different, a prior template argument would have to be different). I'd be happy to add them in/beef them up and add test cases if there's a reason for them) llvm-svn: 219900
* Move SanitizerBlacklist object from CodeGenModule to ASTContext.Alexey Samsonov2014-10-151-27/+20
| | | | | | | | Soon we'll need to have access to blacklist before the CodeGen phase (see http://reviews.llvm.org/D5687), so parse and construct the blacklist earlier. llvm-svn: 219857
* Objective-C [Sema]. Fixes a bug in comparing qualifiedFariborz Jahanian2014-10-131-48/+30
| | | | | | | | Objective-C pointer types. In this case, checker incorrectly claims incompatible pointer types if redundant protocol conformance is specified. rdar://18491222 llvm-svn: 219630
* Return a reference instead of vector copy for parentmap queries.Benjamin Kramer2014-10-041-6/+5
| | | | | | | The map is immutable until the whole ASTContext dies. While there movify a couple of copies in ASTMatchFinder away. NFC. llvm-svn: 219062
* -ms-extensions: Implement __super scope specifier (PR13236).Nikola Smiljanic2014-09-261-1/+2
| | | | | | | | | We build a NestedNameSpecifier that records the CXXRecordDecl in which __super appeared. Name lookup is performed in all base classes of the recorded CXXRecordDecl. Use of __super is allowed only inside class and member function scope. llvm-svn: 218484
* Fix handling of preincrement on bit-fields. This gives a bit-field in C++, butRichard Smith2014-09-241-7/+23
| | | | | | | | | | | we were failing to find that bit-field when performing integer promotions. This brings us closer to following the standard, and closer to GCC. In C, this change is technically a regression: we get bit-field promotions completely wrong in C, promoting cases that are categorically not bit-field designators. This change makes us do so slightly more consistently, though. llvm-svn: 218428
* Use range based for loops to avoid needing to re-mention SmallPtrSet size.Craig Topper2014-08-251-5/+3
| | | | llvm-svn: 216370
* Objective-C. Warn when @encode'ing provides an incompleteFariborz Jahanian2014-08-221-26/+39
| | | | | | | | type encoding because in certain cases, such as for vector types, because we still haven't designed encoding for them. rdar://9255564 llvm-svn: 216301
* Range'ify some for loops over RecordDecl::fields()Hans Wennborg2014-08-211-4/+3
| | | | | | No functionality change. llvm-svn: 216183
* AST: Propagate 'AlignIsRequired' though many levels of typedefsDavid Majnemer2014-08-041-1/+3
| | | | | | | A typedef of a typedef should have AlignIsRequired if *either* typedef has an AlignAttr attached to it. llvm-svn: 214698
* Factor out exception specification information fromRichard Smith2014-07-311-8/+7
| | | | | | | | FunctionProtoType::ExtProtoInfo. Most of the users of these fields don't care about the other ExtProtoInfo bits and just want to talk about the exception specification. llvm-svn: 214450
* AST: Simplify some codeDavid Majnemer2014-07-301-6/+7
| | | | | | | | | | Iterator invalidation issues already force us to do one lookup and one insert. Don't use the particular bit-pattern of the 'Align' field to determine whether or not we have already inserted into the TypeInfo DenseMap; instead ask for an iterator to the TypeInfo entry. llvm-svn: 214293
* Simplify the code.Rafael Espindola2014-07-301-7/+6
| | | | | | Thanks to David Balkie for the suggestion. llvm-svn: 214286
* Fix a use after free bug.Rafael Espindola2014-07-301-5/+8
| | | | llvm-svn: 214281
* MS ABI: Consider alignment attributes on typedefs for layoutDavid Majnemer2014-07-301-39/+42
| | | | | | | | | | | | | | | | | | | The MS ABI has a notion of 'required alignment' for fields; this alignment supercedes pragma pack directives. MSVC takes into account alignment attributes on typedefs when determining whether or not a field has a certain required alignment. Do the same in clang by tracking whether or not we saw such an attribute when calculating the type's bitwidth and alignment. This fixes PR20418. Reviewers: rnk Differential Revision: http://reviews.llvm.org/D4714 llvm-svn: 214274
* MS compatibility: always emit dllexported in-class initialized static data ↵Hans Wennborg2014-07-171-1/+14
| | | | | | | | | | | | | | members (PR20140) This makes us emit dllexported in-class initialized static data members (which are treated as definitions in MSVC), even when they're not referenced. It also makes their special linkage reflected in the GVA linkage instead of getting massaged in CodeGen. Differential Revision: http://reviews.llvm.org/D4563 llvm-svn: 213304
* Added the pack_elements range accessor. Refactoring some for loops to use ↵Aaron Ballman2014-07-151-5/+3
| | | | | | range-based for loops instead. No functional changes intended. llvm-svn: 213095
* Cleanup. No functionality change.Richard Smith2014-07-101-2/+2
| | | | llvm-svn: 212667
* ASTContext: Factor 'getObjCEncodingForPropertyType' as its own method.Joe Groff2014-07-071-3/+11
| | | | | | | It is useful to get the property encoding for an ObjC type without a full ObjCPropertyDecl. llvm-svn: 212496
* Do not store duplicate parents when memoization data is available.Samuel Benzaquen2014-06-131-14/+25
| | | | | | | | | | | | | | Summary: Do not store duplicate parents when memoization data is available. This does not solve the duplication problem, but ameliorates it. Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D4124 llvm-svn: 210902
* CodeGen: Correct linkage of thread_local for OS XDavid Majnemer2014-06-111-8/+0
| | | | | | | | | | | | | The backing store of thread local variables is internal for OS X and all accesses must go through the thread wrapper. However, individual TUs may have inlined through the thread wrapper. To fix this, give the thread wrapper functions WeakAnyLinkage. This prevents them from getting inlined into call-sites. This fixes PR19989. llvm-svn: 210632
* Teach __alignof__ to look through arrays before performing theRichard Smith2014-06-101-9/+1
| | | | | | | preferred-alignment transformations. Corrects alignof(T[]) to return alignof(T) in all cases, as required by relevant standards. llvm-svn: 210609
* Related to PR19992: when the GNU alignof-expression extension is applied to anRichard Smith2014-06-101-3/+8
| | | | | | | expression of array-of-unknown-bound type, don't try to complete the array bound, and return the alignment of the element type rather than 1. llvm-svn: 210608
* Delay lookup of simple default template arguments under -fms-compatibilityReid Kleckner2014-06-061-2/+0
| | | | | | | | | | | | | | | | | | MSVC delays parsing of default arguments until instantiation. If the default argument is never used, it is never parsed. We don't model this. Instead, if lookup of a type name fails in a template argument context, we form a DependentNameType, which will be looked up at instantiation time. This fixes errors about 'CControlWinTraits' in atlwin.h. Reviewers: rsmith Differential Revision: http://reviews.llvm.org/D3995 llvm-svn: 210382
* Cleanup, and always create a DecltypeType for a decltype expression, ratherRichard Smith2014-06-051-21/+16
| | | | | | | than omitting it the first time we see a decltype type with a particular expression. llvm-svn: 210283
* Make the parent-map use significantly less memory.Manuel Klimek2014-05-211-3/+37
| | | | | | | | | | | On test files I ran this on, memory consumption overall went down from 2.5G to 2G, without performance regressions. I also investigated making DynTypedNode by itself smaller (by pulling out pointers for everything that doesn't fit in 8 bytes). This led to another 200-300MB saved, but also introduced a significant regression in performance due to the memory management overhead. llvm-svn: 209297
* Make global named registers internal variablesRenato Golin2014-05-211-0/+3
| | | | llvm-svn: 209289
* If a declaration is loaded, and then a module import adds a redeclaration, thenRichard Smith2014-05-161-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ensure that querying the first declaration for its most recent declaration checks for redeclarations from the imported module. This works as follows: * The 'most recent' pointer on a canonical declaration grows a pointer to the external AST source and a generation number (space- and time-optimized for the case where there is no external source). * Each time the 'most recent' pointer is queried, if it has an external source, we check whether it's up to date, and update it if not. * The ancillary data stored on the canonical declaration is allocated lazily to avoid filling it in for declarations that end up being non-canonical. We'll still perform a redundant (ASTContext) allocation if someone asks for the most recent declaration from a decl before setPreviousDecl is called, but such cases are probably all bugs, and are now easy to find. Some finessing is still in order here -- in particular, we use a very general mechanism for handling the DefinitionData pointer on CXXRecordData, and a more targeted approach would be more compact. Also, the MayHaveOutOfDateDef mechanism should now be expunged, since it was addressing only a corner of the full problem space here. That's not covered by this patch. Early performance benchmarks show that this makes no measurable difference to Clang performance without modules enabled (and fixes a major correctness issue with modules enabled). I'll revert if a full performance comparison shows any problems. llvm-svn: 209046
* Allow dllimport/dllexport on inline functions and adjust the linkage.Hans Wennborg2014-05-151-5/+33
| | | | | | | | This is a step towards handling these attributes on classes (PR11170). Differential Revision: http://reviews.llvm.org/D3772 llvm-svn: 208925
* AST: Remove dead-code/update reference to standardDavid Majnemer2014-05-151-11/+8
| | | | | | | | | | | GetGVALinkageForFunction handles TSK_ExplicitInstantiationDeclaration twice, remove the redundant code trying to handle it again. While we are here, update the reference we make to the standard. It seems like another paragraph was added causing this text to get renumbered. llvm-svn: 208850
* Drop AST's version of ARMCXXABI, it doesn't differ from the Itanium baseJoerg Sonnenberger2014-05-131-3/+2
| | | | | | class. llvm-svn: 208687
* [C++11] Use 'nullptr'. AST edition.Craig Topper2014-05-121-161/+161
| | | | llvm-svn: 208517
* Eliminate ASTContext's DelayInitialization flagAlp Toker2014-05-031-11/+2
| | | | | | | | | Having various possible states of initialization following construction doesn't add value here. Also remove the unused size_reserve parameter. llvm-svn: 207897
* CodeGen: Fix linkage of reference temporariesDavid Majnemer2014-04-281-12/+40
| | | | | | | | | | | | | | | Summary: A reference temporary should inherit the linkage of the variable it initializes. Otherwise, we may hit cases where a reference temporary wouldn't have the same value in all translation units. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3515 llvm-svn: 207451
* [Index/DocComments] When cloning a full comment, pick the template ↵Argyrios Kyrtzidis2014-04-271-0/+2
| | | | | | | | | | parameters from the original FullComment, if the parameters are not already set (e.g. because it is a typedef). Fixes crash of rdar://16128173 llvm-svn: 207382
* AST: Respect alignment attributes on typedef'd arraysJustin Bogner2014-04-151-1/+3
| | | | | | | | | When instantiating an array that has an alignment attribute on it, we were looking through the array type and only considering the element type for the resulting alignment. We need to make sure we take the array's requirements into account too. llvm-svn: 206317
* Objective-C arc [Sema]. Allow bridge cast of a qualified-id expressionFariborz Jahanian2014-04-041-2/+18
| | | | | | | when bridged Objective-C type conforms to the protocols in CF types's Objective-C class. // rdar://16393330 llvm-svn: 205659
* CodeGen: Emit some functions as weak_odr under -fms-compatibilityDavid Majnemer2014-04-021-3/+9
| | | | | | | | | | | | | | | | | | | Summary: MSVC always emits inline functions marked with the extern storage class specifier. The result is something similar to the opposite of __attribute__((gnu_inline)). This extension is also available in C. This fixes PR19264. Reviewers: rnk, rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3207 llvm-svn: 205485
* Objective-C [IRGen]. Add encoding for 'weak' attribute of aFariborz Jahanian2014-04-021-0/+2
| | | | | | 'readonly' property. // rdar://16136439 llvm-svn: 205477
* ARM64: initial clang support commit.Tim Northover2014-03-291-0/+2
| | | | | | | | | | | This adds Clang support for the ARM64 backend. There are definitely still some rough edges, so please bring up any issues you see with this patch. As with the LLVM commit though, we think it'll be more useful for merging with AArch64 from within the tree. llvm-svn: 205100
* Comment parsing: attach comments to enums declared using the NS_ENUM macroDmitri Gribenko2014-03-271-5/+17
| | | | | | Previously we would only attach comments to the typedef. llvm-svn: 204942
* Comment parsing: when comment ranges are deserialized from multiple modules,Dmitri Gribenko2014-03-271-0/+7
| | | | | | | | | correctly order comments in SourceManager::isBeforeInTranslationUnit() order Unfortunately, this is not as simple as it was implemented previously, and actually requires doing a merge sort. llvm-svn: 204936
* [C++11] Replacing ObjCObjectPointerType iterators qual_begin() and ↵Aaron Ballman2014-03-171-47/+20
| | | | | | qual_end() with iterator_range quals(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 204048
OpenPOWER on IntegriCloud