summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [modules] Remove some redundant work when building a lookup table for a ↵Richard Smith2015-03-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | DeclContext. When we need to build the lookup table for a DeclContext, we used to pull in all lexical declarations for the context; instead, just build a lookup table for the local lexical declarations. We previously didn't guarantee that the imported declarations would be in the returned map, but in some cases we'd happen to put them all in there regardless. Now we're even lazier about this. This unnecessary work was papering over some other bugs: - LookupVisibleDecls would use the DC for name lookups in the TU in C, and this was not guaranteed to find all imported names (generally, the DC for the TU in C is not a reliable place to perform lookups). We now use an identifier-based lookup mechanism for this. - We didn't actually load in the list of eagerly-deserialized declarations when importing a module (so external definitions in a module wouldn't be emitted by users of those modules unless they happened to be deserialized by the user of the module). llvm-svn: 232793
* Don't crash-on-valid when an inline function is friend of class templateDavid Majnemer2015-03-201-1/+1
| | | | | | | | | We assumed that the most recent declaration of an inline function would also be inline. However, a more recent declaration can come from a friend declaration in a class template that is instantiated at the definition of the function. llvm-svn: 232786
* Sort ObjCProtocolDecls with array_pod_sort.Benjamin Kramer2015-03-141-5/+5
| | | | | | The predicate is essentially a string comparison. NFC. llvm-svn: 232264
* MS ABI: Implement __GetExceptionInfo for std::make_exception_ptrDavid Majnemer2015-03-131-0/+3
| | | | | | | | | std::make_exception_ptr calls std::__GetExceptionInfo in order to figure out how to properly copy the exception object. Differential Revision: http://reviews.llvm.org/D8280 llvm-svn: 232188
* MS ABI: Implement copy-ctor closures, finish implementing throwDavid Majnemer2015-03-111-0/+12
| | | | | | | | | | | | | | | This adds support for copy-constructor closures. These are generated when the C++ runtime has to call a copy-constructor with a particular calling convention or with default arguments substituted in to the call. Because the runtime has no mechanism to call the function with a different calling convention or know-how to evaluate the default arguments at run-time, we create a thunk which will do all the appropriate work and package it in a way the runtime can use. Differential Revision: http://reviews.llvm.org/D8225 llvm-svn: 231952
* Replace Sema's map of locally-scoped extern "C" declarations with a DeclContextRichard Smith2015-03-071-1/+9
| | | | | | | | | | of extern "C" declarations. This is simpler and vastly more efficient for modules builds (we no longer need to load *all* extern "C" declarations to determine if we have a redeclaration). No functionality change intended. llvm-svn: 231538
* MS ABI: Insert copy-constructors into the CatchableTypeDavid Majnemer2015-03-061-0/+13
| | | | | | | | | | | | | | | | Find all unambiguous public classes of the exception object's class type and reference all of their copy constructors. Yes, this is not conforming but it is necessary in order to implement their ABI. This is because the copy constructor is actually referenced by the metadata describing which catch handlers are eligible to handle the exception object. N.B. This doesn't yet handle the copy constructor closure case yet, that work is ongoing. Differential Revision: http://reviews.llvm.org/D8101 llvm-svn: 231499
* Sema: Properly initialize the thrown exception objectDavid Majnemer2015-03-031-0/+13
| | | | | | | We would create the exception object with the wrong qualifiers, ensuring that the wrong copy constructor would get called. llvm-svn: 231049
* Change representation of member function pointers for MIPS targetsZoran Jovanovic2015-02-181-0/+2
| | | | | | Differential Revision: http://reviews.llvm.org/D7148 llvm-svn: 229680
* Allow to specify multiple -fsanitize-blacklist= arguments.Alexey Samsonov2015-02-041-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Allow user to provide multiple blacklists by passing several -fsanitize-blacklist= options. These options now don't override default blacklist from Clang resource directory, which is always applied (which fixes PR22431). -fno-sanitize-blacklist option now disables all blacklists that were specified earlier in the command line (including the default one). This change depends on http://reviews.llvm.org/D7367. Test Plan: regression test suite Reviewers: timurrrr Subscribers: cfe-commits, kcc, pcc Differential Revision: http://reviews.llvm.org/D7368 llvm-svn: 228156
* AST: Hoist RT->getDecl() into a variableDavid Majnemer2015-02-031-2/+3
| | | | llvm-svn: 227953
* MS ABI: Records with required alignment can't have common linkageDavid Majnemer2015-02-031-0/+1
| | | | | | This fixes PR22441. llvm-svn: 227950
* AST: Don't ignore alignas on EnumDecls when calculating alignmentDavid Majnemer2015-01-211-2/+12
| | | | | | | | | | | | | | | | | | | | | | We didn't consider any alignment attributes on an EnumDecl when calculating alignment. While we are here, ignore alignment specifications on typedef types if one is used as the underlying type. Otherwise, weird things happen: enum Y : int; Y y; typedef int __attribute__((aligned(64))) u; enum Y : u {}; What is the alignment of 'Y'? It would be more consistent with the overall design of enums with fixed underlying types to consider the underlying type's UnqualifiedDesugaredType. This fixes PR22279. llvm-svn: 226653
* Re-apply "r226548 - Introduce SPIR calling conventions" reverted in r226558.Alexander Kornienko2015-01-201-1/+3
| | | | | | | | | | | | | | | | | | | | | | | The test was fixed after a discussion with the revision author: the check pattern was made more flexible as the "%call" part is not what we actually want to check strictly there. The original patch description: === Introduce SPIR calling conventions. This implements Section 3.7 from the SPIR 1.2 spec: SPIR kernels should use "spir_kernel" calling convention. Non-kernel functions use "spir_func" calling convention. All other calling conventions are disallowed. The patch works only for OpenCL source. Any other uses will need to ensure that kernels are assigned the spir_kernel calling convention correctly. === llvm-svn: 226561
* Reverting r226548 as one of the tests fails in some configurations.Alexander Kornienko2015-01-201-3/+1
| | | | | | | | | | | | | | | | | | | | | | Here's the fail log from our internal setup: === .../tools/clang/clang -cc1 -internal-isystem .../tools/clang/staging/include -nostdsysteminc .../tools/clang/test/CodeGenOpenCL/spir-calling-conv.cl -triple spir-unknown-unknown -emit-llvm -o - FileCheck .../tools/clang/test/CodeGenOpenCL/spir-calling-conv.cl .../tools/clang/test/CodeGenOpenCL/spir-calling-conv.cl:11:12: error: expected string not found in input // CHECK: %call = tail call spir_func i32 @get_dummy_id(i32 0) ^ <stdin>:6:52: note: scanning from here define spir_kernel void @foo(i32 addrspace(1)* %A) #0 { ^ <stdin>:7:2: note: possible intended match here %1 = tail call spir_func i32 @get_dummy_id(i32 0) #2 ^ === Here's a failure on a public CI server: http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_check/1183/ llvm-svn: 226558
* Introduce SPIR calling conventions.Sameer Sahasrabuddhe2015-01-201-1/+3
| | | | | | | | | | | | | | This implements Section 3.7 from the SPIR 1.2 spec: SPIR kernels should use "spir_kernel" calling convention. Non-kernel functions use "spir_func" calling convention. All other calling conventions are disallowed. The patch works only for OpenCL source. Any other uses will need to ensure that kernels are assigned the spir_kernel calling convention correctly. llvm-svn: 226548
* Fix some copypasta typos in asserts.Sean Silva2015-01-161-2/+2
| | | | | | | | Fixes PR22236 Patch by Nicolas Brunie! <nicolas.brunie@kalray.eu> llvm-svn: 226328
* AST: Ensure implicit records have default visibilityDavid Majnemer2015-01-151-0/+2
| | | | | | | | | | | | | | | Types composed with certain implicit record types would have their RTTI marked as hidden because the implicit record type didn't have any visibility. This manifests itself as triggering false positives from tools like clang's -fsantize=function feature. The RTTI for a function type's return type wouldn't match if the return type was an implicit record type. Patch by Stephan Bergmann! llvm-svn: 226148
* 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
OpenPOWER on IntegriCloud