summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
Commit message (Collapse)AuthorAgeFilesLines
* 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
* [MS] Improve VPtrInfo field names and doc commentsReid Kleckner2016-07-201-13/+13
| | | | | | | | | 'ReusingBase' was a terrible name. It might actually refer to the most derived class, which is not a base. 'BaseWithVPtr' was also bad, since again, it could refer to the most derived class. It was actually the first base to introduce the vptr, so now it is 'IntroducingObject'. llvm-svn: 276120
* Revert r276069: MSVC bots not happyHubert Tong2016-07-203-35/+12
| | | | llvm-svn: 276074
* Fix r276069: use LLVM_CONSTEXPRHubert Tong2016-07-201-1/+1
| | | | llvm-svn: 276071
* Concepts: Create space for requires-clause in TemplateParameterList; NFCHubert Tong2016-07-203-12/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Space for storing the //constraint-expression// of the //requires-clause// associated with a `TemplateParameterList` is arranged by taking a bit out of the `NumParams` field for the purpose of determining whether there is a //requires-clause// or not, and by adding to the trailing objects tied to the `TemplateParameterList`. An accessor is provided. An appropriate argument is supplied to `TemplateParameterList::Create` at the various call sites. Serialization changes will addressed as the Concepts implementation becomes more solid. Drive-by fix: This change also replaces the custom `FixedSizeTemplateParameterListStorage` implementation with one that follows the interface provided by `llvm::TrailingObjects`. Reviewers: aaron.ballman, faisalv, rsmith Subscribers: cfe-commits, nwilson Differential Revision: https://reviews.llvm.org/D19322 llvm-svn: 276069
* Fix some minor issues found by Coverity.Richard Smith2016-07-182-1/+3
| | | | llvm-svn: 275925
* [NFC] Header cleanupMehdi Amini2016-07-1814-19/+4
| | | | | | | | | | Summary: Removed unused headers, replaced some headers with forward class declarations Patch by: Eugene <claprix@yandex.ru> Differential Revision: https://reviews.llvm.org/D20100 llvm-svn: 275882
* [ObjC] Implement @available in the Parser and ASTErik Pilkington2016-07-166-0/+14
| | | | | | | | | | | | | | | | This patch adds a new AST node: ObjCAvailabilityCheckExpr, and teaches the Parser and Sema to generate it. This node represents an availability check of the form: @available(macos 10.10, *); Which will eventually compile to a runtime check of the host's OS version. This is the first patch of the feature I proposed here: http://lists.llvm.org/pipermail/cfe-dev/2016-July/049851.html Differential Revision: https://reviews.llvm.org/D22171 llvm-svn: 275654
* [AST] Keep track of the left brace source location of a tag decl.Argyrios Kyrtzidis2016-07-152-1/+2
| | | | | | This is useful for source modification tools. There will be a follow-up commit using it. llvm-svn: 275590
* [arcmt/objcmt] Fix ParentMap crash with invalid code.Argyrios Kyrtzidis2016-07-141-0/+2
| | | | | | rdar://22489560 llvm-svn: 275466
* When importing classes and structs with anonymous structs, it is critical thatSean Callanan2016-07-141-9/+25
| | | | | | | | | | | | | | | | | | | | | | | distinct anonymous structs remain distinct despite having similar layout. This is already ensured by distinguishing based on their placement in the parent struct, using the function `findAnonymousStructOrUnionIndex`. The problem is that this function only handles anonymous structs, like ``` class Foo { struct { int a; } } ``` and not untagged structs like ``` class Foo { struct { int a; } var; } ``` Both need to be handled, and this patch fixes that. The test case ensures that this functionality doesn't regress. Thanks to Manman Ren for review. https://reviews.llvm.org/D22270 llvm-svn: 275460
* [OpenMP] Sema and parsing for 'target parallel for simd' pragmaKelvin Li2016-07-143-0/+66
| | | | | | | | This patch is to implement sema and parsing for 'target parallel for simd' pragma. Differential Revision: http://reviews.llvm.org/D22096 llvm-svn: 275365
* P0305R0: Semantic analysis and code generation for C++17 init-statement for ↵Richard Smith2016-07-143-5/+25
| | | | | | | | | | 'if' and 'switch': if (stmt; condition) { ... } Patch by Anton Bikineev! Some minor formatting and comment tweets by me. llvm-svn: 275350
* [OpenMP] Initial implementation of parse+sema for OpenMP clause ↵Carlo Bertolli2016-07-133-0/+32
| | | | | | | | 'is_device_ptr' of target http://reviews.llvm.org/D22070 llvm-svn: 275282
* [OpenMP] Initial implementation of parse+sema for clause use_device_ptr of ↵Carlo Bertolli2016-07-133-0/+32
| | | | | | | | | | | | | | 'target data' http://reviews.llvm.org/D21904 This patch is similar to the implementation of 'private' clause: it adds a list of private pointers to be used within the target data region to store the device pointers returned by the runtime. Please refer to the following document for a full description of what the runtime witll return in this case (page 10 and 11): https://github.com/clang-omp/OffloadingDesign I am happy to answer any question related to the runtime interface to help reviewing this patch. llvm-svn: 275271
* [ItaniumMangle] Correctly mangle BuiltinTemplateDeclsDavid Majnemer2016-07-121-1/+6
| | | | | | | | | | A BuiltinTemplateDecl has no underlying templated decl and as such they cannot be relied upon for mangling. The ItaniumMangler had some bugs here which lead to crashes. This fixes PR28519. llvm-svn: 275190
* [MS ABI] Support throwing/catching __unaligned typesDavid Majnemer2016-07-121-3/+6
| | | | | | | | We need to mark the appropriate bits in ThrowInfo and HandlerType so that the personality routine can correctly handle qualification conversions. llvm-svn: 275154
* Teach -ast-print to print constexpr variables.Vassil Vassilev2016-07-081-3/+10
| | | | | | Patch reviewed by Richard Smith (D22168). llvm-svn: 274930
* Don't crash when printing auto variables.Vassil Vassilev2016-07-081-0/+2
| | | | | | Patch by Axel Naumann! llvm-svn: 274859
* [AST] Use ArrayRef in more interfacesDavid Majnemer2016-07-079-135/+106
| | | | | | | | | ArrayRef is a little better than passing around a pointer/length pair. No functional change is intended. llvm-svn: 274732
* [OpenMP] Sema and parsing for 'distribute simd' pragmaKelvin Li2016-07-063-0/+64
| | | | | | | | Summary: This patch is an implementation of sema and parsing for the OpenMP composite pragma 'distribute simd'. Differential Revision: http://reviews.llvm.org/D22007 llvm-svn: 274604
* [AST] Use ArrayRef in more interfacesDavid Majnemer2016-07-062-120/+85
| | | | | | | | ArrayRef is a little better than passing around a pointer/length pair. No functional change is intended. llvm-svn: 274601
* [ASTMatchers] New forEachOverriden matcher.Clement Courbet2016-07-052-9/+19
| | | | | | Matches methods overridden by the given method. llvm-svn: 274531
* [OpenMP] Sema and parse for 'distribute parallel for simd'Kelvin Li2016-07-053-0/+68
| | | | | | | | Summary: This patch is an implementation of sema and parsing for the OpenMP composite pragma 'distribute parallel for simd'. Differential Revision: http://reviews.llvm.org/D21977 llvm-svn: 274530
* [AST] Use ArrayRef in more interfacesDavid Majnemer2016-07-032-33/+25
| | | | | | | | ArrayRef is a little better than passing around a pointer/length pair. No functional change is intended. llvm-svn: 274475
* [Refactor NFC] Rename the (non-CCE, fold-failure) Diag during constant ↵Faisal Vali2016-07-021-102/+112
| | | | | | | | | | | | expression evaluation as FFDiag. Currently, we have CCEDiags (C++11 core constant expression diags) and Fold failure diagnostics [I don't claim to yet fully understand exactly why we need the difference]. This patch explicitly replaces Info.Diag (whose use always represents a fold failure diag within the file) with Info.FFDiag. This makes it more easily greppable in the file, and just like the name Info.CCEDiag, it gives the reader slight further insight into the nature of the diagnostic (as opposed to Info.Diag). This patch is a preliminary refactoring step in an effort to allow support for compatibility-warnings and extensions (such as constexpr lambda) during constant expression evaluation. All regressions pass. llvm-svn: 274454
* PR28394: For compatibility with c++11 and c++14, if a static constexpr dataRichard Smith2016-07-021-2/+35
| | | | | | | | member is redundantly redeclared outside the class definition in code built in c++17 mode, ensure we emit a non-discardable definition of the data member for c++11 and c++14 compilations to use. llvm-svn: 274416
OpenPOWER on IntegriCloud