summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
Commit message (Collapse)AuthorAgeFilesLines
...
* ObjectiveC: Refactor applyObjCProtocolQualifiers.Manman Ren2016-09-131-0/+70
| | | | | | | | | | | | | | To construct the canonical type of ObjCTypeParamType, we need to apply qualifiers on ObjCObjectPointerType. The updated applyObjCProtocolQualifiers handles this case by merging the protocol lists, constructing a new ObjCObjectType, then a new ObjCObjectPointerType. rdar://24619481 rdar://25060179 Differential Revision: http://reviews.llvm.org/D24059 llvm-svn: 281353
* Add a class ObjCProtocolQualifiers to wrap APIs for ObjC protocol list.Manman Ren2016-09-131-6/+3
| | | | | | | | | | | | | | | Now ObjCObjectType extends from ObjCProtocolQualifiers. We save number of protocols in ObjCProtocolQualifiers. This is in preparation of adding a new type class ObjCTypeParamType that can take protocol qualifiers. rdar://24619481 rdar://25060179 Differential Revision: http://reviews.llvm.org/D23078 llvm-svn: 281351
* [Sema] Fix PR30346: relax __builtin_object_size checks.George Burgess IV2016-09-121-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes us act more conservatively when trying to determine the objectsize for an array at the end of an object. This is in response to code like the following: ``` struct sockaddr { /* snip */ char sa_data[14]; }; void foo(const char *s) { size_t slen = strlen(s) + 1; size_t added_len = slen <= 14 ? 0 : slen - 14; struct sockaddr *sa = malloc(sizeof(struct sockaddr) + added_len); strcpy(sa->sa_data, s); // ... } ``` `__builtin_object_size(sa->sa_data, 1)` would return 14, when there could be more than 14 bytes at `sa->sa_data`. Code like this is apparently not uncommon. FreeBSD's manual even explicitly mentions this pattern: https://www.freebsd.org/doc/en/books/developers-handbook/sockets-essential-functions.html (section 7.5.1.1.2). In light of this, we now just give up on any array at the end of an object if we can't find the object's initial allocation. I lack numbers for how much more conservative we actually become as a result of this change, so I chose the fix that would make us as compatible with GCC as possible. If we want to be more aggressive, I'm happy to consider some kind of whitelist or something instead. llvm-svn: 281277
* Modules: revert r280728.Manman Ren2016-09-091-6/+4
| | | | | | | In post-commit review, Richard suggested a better way to fix this. rdar://27926200 llvm-svn: 281078
* C++ Modules TS: Add parsing and some semantic analysis support forRichard Smith2016-09-082-5/+22
| | | | | | | export-declarations. These don't yet have an effect on name visibility; we still export everything by default. llvm-svn: 280999
* Modules: Fix an assertion in DeclContext::buildLookup.Manman Ren2016-09-061-4/+6
| | | | | | | | | | When calling getMostRecentDecl, we can pull in more definitions from a module. We call getPrimaryContext afterwards to make sure that we buildLookup on a primary context. rdar://27926200 llvm-svn: 280728
* AST: improve layout of SimpleTypoCorrectorSaleem Abdulrasool2016-08-281-6/+5
| | | | | | | | | Add the "explicit" specifier to the single-argument constructor of SimpleTypoCorrector. Reorder the fields to remove excessive padding (8 bytes). Patch by Alexander Shaposhnikov! llvm-svn: 279946
* [Sema][Comments] Add support for TypeAliasTemplateBruno Cardoso Lopes2016-08-251-0/+14
| | | | | | | | | | | | | | | | Emit proper diagnostics when -Wdocumentation is used with constructs such as: template<typename T> using fn = int(T aaa, int ccc); Previously clang wouldn't recognize the function and complain with 'comment that is not attached to a function declaration'. Differential Revision: https://reviews.llvm.org/D23860 rdar://problem/27300695 llvm-svn: 279754
* Remove a pointless LLVM_CONSTEXPR. NFC.George Burgess IV2016-08-251-1/+1
| | | | llvm-svn: 279702
* Lazily load the ContextDecl for a lambda's DefinitionData, to fix aRichard Smith2016-08-251-0/+6
| | | | | | | deserialization cycle caused by the ContextDecl recursively importing members of the lambda's closure type. llvm-svn: 279694
* [Sema][Comments] Factor out function type loc logic. NFCIBruno Cardoso Lopes2016-08-251-64/+64
| | | | | | This is in prepatation for @param TypeAliasTemplate support. llvm-svn: 279691
* [Sema][Comments] Support @param with c++ 'using' keywordBruno Cardoso Lopes2016-08-241-6/+6
| | | | | | | | | | | | | Give appropriate warnings with -Wdocumentation for @param comments that refer to function aliases defined with 'using'. Very similar to typedef's behavior. This does not add support for TypeAliasTemplateDecl yet. Differential Revision: https://reviews.llvm.org/D23783 rdar://problem/27300695 llvm-svn: 279662
* [AST] Remove unused function, to silence a GCC7 warning.Davide Italiano2016-08-221-4/+0
| | | | llvm-svn: 279479
* Revert r279351 and r279357 due to bot failuresManman Ren2016-08-201-3/+6
| | | | llvm-svn: 279358
* [NFC] Add a class ObjCProtocolQualifiers to wrap APIs for ObjC protocol list.Manman Ren2016-08-201-6/+3
| | | | | | | | | | | | | This is in preparation of adding a new type class ObjCTypeParamType that can take protocol qualifiers. ObjCProtocolQualifiers will be shared between ObjCObjectType and ObjCTypeParamType. rdar://24619481 rdar://25060179 Differential Revision: http://reviews.llvm.org/D23078 llvm-svn: 279351
* Revert "[OpenMP] Sema and parsing for 'teams distribute simd’ pragma"Diana Picus2016-08-183-63/+0
| | | | | | | | | | | | | | | | | This reverts commit r279003 as it breaks some of our buildbots (e.g. clang-cmake-aarch64-quick, clang-x86_64-linux-selfhost-modules). The error is in OpenMP/teams_distribute_simd_ast_print.cpp: clang: /home/buildslave/buildslave/clang-cmake-aarch64-quick/llvm/include/llvm/ADT/DenseMap.h:527: bool llvm::DenseMapBase<DerivedT, KeyT, ValueT, KeyInfoT, BucketT>::LookupBucketFor(const LookupKeyT&, const BucketT*&) const [with LookupKeyT = clang::Stmt*; DerivedT = llvm::DenseMap<clang::Stmt*, long unsigned int>; KeyT = clang::Stmt*; ValueT = long unsigned int; KeyInfoT = llvm::DenseMapInfo<clang::Stmt*>; BucketT = llvm::detail::DenseMapPair<clang::Stmt*, long unsigned int>]: Assertion `!KeyInfoT::isEqual(Val, EmptyKey) && !KeyInfoT::isEqual(Val, TombstoneKey) && "Empty/Tombstone value shouldn't be inserted into map!"' failed. llvm-svn: 279045
* [OpenMP] Sema and parsing for 'teams distribute simd’ pragmaKelvin Li2016-08-173-0/+63
| | | | | | | | | | This patch is to implement sema and parsing for 'teams distribute simd’ pragma. This patch is originated by Carlo Bertolli. Differential Revision: https://reviews.llvm.org/D23528 llvm-svn: 279003
* [CodeGen][ObjC] Fix infinite recursion in getObjCEncodingForTypeImpl.Akira Hatanaka2016-08-171-12/+14
| | | | | | | | | | Check that ExpandStructures is true before visiting the list of ivars. rdar://problem/27135221 Differential revision: https://reviews.llvm.org/D22929 llvm-svn: 278956
* Simplify condition. (NFC)Adrian Prantl2016-08-171-7/+8
| | | | llvm-svn: 278946
* Debug info: Mark noreturn functions with DIFlagNoReturn.Adrian Prantl2016-08-171-3/+7
| | | | | | | | | | | This affects functions with the C++11 [[ noreturn ]] and C11 _Noreturn specifiers. Patch by Victor Leschuk! https://reviews.llvm.org/D23168 llvm-svn: 278942
* [ObjC] Warn on unguarded use of partial declarationErik Pilkington2016-08-161-0/+4
| | | | | | | | | | | | | | This commit adds a traversal of the AST after Sema of a function that diagnoses unguarded references to declarations that are partially available (based on availability attributes). This traversal is only done when we would otherwise emit -Wpartial-availability. This commit is part of a feature I proposed here: http://lists.llvm.org/pipermail/cfe-dev/2016-July/049851.html Differential revision: https://reviews.llvm.org/D23003 llvm-svn: 278826
* PR28978: If we need overload resolution for the move constructor of anRichard Smith2016-08-161-0/+11
| | | | | | | | anonymous union member of a class, we need overload resolution for the move constructor of the class itself too; we can't rely on Sema to do the right thing for us for anonymous union types. llvm-svn: 278763
* Objective-C diagnostics: isObjCNSObjectType should check through AttributedType.Manman Ren2016-08-151-3/+11
| | | | | | | | | | | | For the following example: typedef __attribute__((NSObject)) CGColorRef ColorAttrRef; @property (strong, nullable) ColorAttrRef color; The property type should be ObjC NSObject type and the compiler should not emit error: property with 'retain (or strong)' attribute must be of object type rdar://problem/27747154 llvm-svn: 278742
* Add the notion of deferred diagnostics.Justin Lebar2016-08-151-0/+14
| | | | | | | | | | | | | | | | | | | Summary: This patch lets you create diagnostics that are emitted if and only if a particular FunctionDecl is codegen'ed. This is necessary for CUDA, where some constructs -- e.g. calls from host+device functions to host functions when compiling for device -- are allowed to appear in semantically-correct programs, but only if they're never codegen'ed. Reviewers: rnk Subscribers: cfe-commits, tra Differential Revision: https://reviews.llvm.org/D23241 llvm-svn: 278735
* P0217R3: code generation support for decomposition declarations.Richard Smith2016-08-153-12/+39
| | | | llvm-svn: 278642
* Explicitly generate a reference variable to hold the initializer for aRichard Smith2016-08-142-84/+50
| | | | | | | | tuple-like decomposition declaration. This significantly simplifies the semantics of BindingDecls for AST consumers (they can now always be evalated at the point of use). llvm-svn: 278640
* P0217R3: serialization/deserialization support for c++17 decomposition ↵Richard Smith2016-08-121-2/+3
| | | | | | declarations. llvm-svn: 278460
* Remove unused and undesirable reference from BindingDecl to DecompositionDecl.Richard Smith2016-08-121-3/+2
| | | | llvm-svn: 278448
* P0217R3: Constant expression evaluation for decomposition declarations.Richard Smith2016-08-122-2/+65
| | | | llvm-svn: 278447
* P0217R3: Perform semantic checks and initialization for the bindings in aRichard Smith2016-08-115-2/+38
| | | | | | | decomposition declaration for arrays, aggregate-like structs, tuple-like types, and (as an extension) for complex and vector types. llvm-svn: 278435
* Reapply [Sema] Add sizeof diagnostics for bzeroBruno Cardoso Lopes2016-08-101-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | Reapply r277787. For memset (and others) we can get diagnostics like: struct stat { int x; }; void foo(struct stat *stamps) { bzero(stamps, sizeof(stamps)); memset(stamps, 0, sizeof(stamps)); } t.c:7:28: warning: 'memset' call operates on objects of type 'struct stat' while the size is based on a different type 'struct stat *' [-Wsizeof-pointer-memaccess] memset(stamps, 0, sizeof(stamps)); ~~~~~~ ^~~~~~ t.c:7:28: note: did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)? memset(stamps, 0, sizeof(stamps)); ^~~~~~ This patch implements the same class of warnings for bzero. Differential Revision: https://reviews.llvm.org/D22525 rdar://problem/18963514 llvm-svn: 278264
* Fix typos from r277797 and unused variable from r277889.Richard Trieu2016-08-061-4/+4
| | | | llvm-svn: 277900
* Revert "[Sema] Add sizeof diagnostics for bzero"Bruno Cardoso Lopes2016-08-051-6/+0
| | | | | | This reverts commit r277787, which caused PR28870. llvm-svn: 277830
* [OpenMP] Sema and parsing for 'teams distribute' pragmaKelvin Li2016-08-053-0/+62
| | | | | | | | This patch is to implement sema and parsing for 'teams distribute' pragma. Differential Revision: https://reviews.llvm.org/D23189 llvm-svn: 277818
* Fix crash in template type diffing.Richard Trieu2016-08-051-0/+6
| | | | | | | | | When the type being diffed is a type alias, and the orginal type is not a templated type, then there will be no unsugared TemplateSpecializationType. When this happens, exit early from the constructor. Also add assertions to the other iterator accessor to prevent the iterator from being used. llvm-svn: 277797
* [Sema] Add sizeof diagnostics for bzeroBruno Cardoso Lopes2016-08-041-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | For memset (and others) we can get diagnostics like: struct stat { int x; }; void foo(struct stat *stamps) { bzero(stamps, sizeof(stamps)); memset(stamps, 0, sizeof(stamps)); } t.c:7:28: warning: 'memset' call operates on objects of type 'struct stat' while the size is based on a different type 'struct stat *' [-Wsizeof-pointer-memaccess] memset(stamps, 0, sizeof(stamps)); ~~~~~~ ^~~~~~ t.c:7:28: note: did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)? memset(stamps, 0, sizeof(stamps)); ^~~~~~ This patch implements the same class of warnings for bzero. Differential Revision: https://reviews.llvm.org/D22525 rdar://problem/18963514 llvm-svn: 277787
* [OpenCL] Fix size of image typeYaxun Liu2016-08-031-4/+8
| | | | | | | | | | The size of image type is reported incorrectly as size of a pointer to address space 0, which causes error when casting image type to pointers by __builtin_astype. The fix is to get image address space from TargetInfo then report the size accordingly. Differential Revision: https://reviews.llvm.org/D22927 llvm-svn: 277647
* Reapply r276069 with workaround for MSVC 2013Hubert Tong2016-07-303-12/+35
| | | | llvm-svn: 277286
* Reapply r277058: "[ObjC] Consider availability of context when emitting ↵Erik Pilkington2016-07-291-12/+14
| | | | | | availability warnings" llvm-svn: 277175
* [ASTMatcher] Add templateName matcher.Haojian Wu2016-07-291-0/+3
| | | | | | | | | | Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D22963 llvm-svn: 277155
* Revert "[ObjC] Consider availability of context when emitting availability ↵Erik Pilkington2016-07-281-14/+12
| | | | | | | | | | warnings" Reverting r277058, while I fugure out why it broke internal bots. This reverts commit e514ffa8b657416c6784bbe6da9f5de19365103d. llvm-svn: 277070
* [ObjC] Consider availability of context when emitting availability warningsErik Pilkington2016-07-281-12/+14
| | | | | | | | | | This means that a function marked with an availability attribute can safely refer to a declaration that is greater than the deployment target, but less then or equal to the context availability without -Wpartial-availability firing. Differential revision: https://reviews.llvm.org/D22697 llvm-svn: 277058
* [OpenCL] Generate opaque type for sampler_t and function call for the ↵Yaxun Liu2016-07-283-5/+10
| | | | | | | | | | | | | | | | initializer Currently Clang use int32 to represent sampler_t, which have been a source of issue for some backends, because in some backends sampler_t cannot be represented by int32. They have to depend on kernel argument metadata and use IPA to find the sampler arguments and global variables and transform them to target specific sampler type. This patch uses opaque pointer type opencl.sampler_t* for sampler_t. For each use of file-scope sampler variable, it generates a function call of __translate_sampler_initializer. For each initialization of function-scope sampler variable, it generates a function call of __translate_sampler_initializer. Each builtin library can implement its own __translate_sampler_initializer(). Since the real sampler type tends to be architecture dependent, allowing it to be initialized by a library function simplifies backend design. A typical implementation of __translate_sampler_initializer could be a table lookup of real sampler literal values. Since its argument is always a literal, the returned pointer is known at compile time and easily optimized to finally become some literal values directly put into image read instructions. This patch is partially based on Alexey Sotkin's work in Khronos Clang (https://github.com/KhronosGroup/SPIR/commit/3d4eec61623502fc306e8c67c9868be2b136e42b). Differential Revision: https://reviews.llvm.org/D21567 llvm-svn: 277024
* [OpenMP] Code generation for the is_device_ptr clauseSamuel Antao2016-07-281-13/+44
| | | | | | | | | | | | Summary: This patch adds support for the is_device_ptr clause. It expands SEMA to use the mappable expression logic that can only be tested with code generation in place and check conflicts with other data sharing related clauses using the mappable expressions infrastructure. Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev Subscribers: caomhin, cfe-commits Differential Revision: https://reviews.llvm.org/D22788 llvm-svn: 276978
* [OpenMP] Codegen for use_device_ptr clause.Samuel Antao2016-07-281-13/+57
| | | | | | | | | | | | Summary: This patch adds support for the use_device_ptr clause. It includes changes in SEMA that could not be tested without codegen, namely, the use of the first private logic and mappable expressions support. Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev Subscribers: caomhin, cfe-commits Differential Revision: https://reviews.llvm.org/D22691 llvm-svn: 276977
* P0217R3: Parsing support and framework for AST representation of C++1zRichard Smith2016-07-224-2/+65
| | | | | | | | | | | decomposition declarations. There are a couple of things in the wording that seem strange here: decomposition declarations are permitted at namespace scope (which we partially support here) and they are permitted as the declaration in a template (which we reject). llvm-svn: 276492
* Add .rgba syntax extension to ext_vector_type typesPirama Arumuga Nainar2016-07-221-2/+5
| | | | | | | | | | | | | | | | | | Summary: This patch enables .rgba accessors to ext_vector_type types and adds tests for syntax validation and code generation. 'a' and 'b' can appear either in the point access mode or the numeric access mode (for indices 10 and 11). To disambiguate between the two usages, the accessor type is explicitly passed to relevant methods. Reviewers: rsmith Subscribers: Anastasia, bader, srhines, cfe-commits Differential Revision: http://reviews.llvm.org/D20602 llvm-svn: 276455
* [OpenMP] Sema and parsing for 'target simd' pragmaKelvin Li2016-07-203-0/+51
| | | | | | | | This patch is to implement sema and parsing for 'target simd' pragma. Differential Revision: https://reviews.llvm.org/D22479 llvm-svn: 276203
* Fix memory leak introduced in r276159.Richard Smith2016-07-201-0/+3
| | | | llvm-svn: 276188
* [modules] Don't emit initializers for VarDecls within a module eagerly wheneverRichard Smith2016-07-201-0/+63
| | | | | | | | | | | | we first touch any part of that module. Instead, defer them until the first time that module is (transitively) imported. The initializer step for a module then recursively initializes modules that its own headers imported. For example, this avoids running the <iostream> global initializer in programs that don't actually use iostreams, but do use other parts of the standard library. llvm-svn: 276159
OpenPOWER on IntegriCloud