summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
Commit message (Collapse)AuthorAgeFilesLines
...
* Closure types have no name (and can't have a typedef name for linkageRichard Smith2017-09-221-7/+8
| | | | | | purposes), so they never formally have linkage. llvm-svn: 313957
* Give external linkage and mangling to lambdas inside inline variables and ↵Richard Smith2017-09-223-54/+68
| | | | | | | | | | | variable templates. This implements the proposed approach in https://github.com/itanium-cxx-abi/cxx-abi/issues/33 This reinstates r313827, reverted in r313856, with a fix for the 'out-of-bounds enumeration value' ubsan error in that change. llvm-svn: 313955
* Clean up some mistreatment of enumerations.Richard Smith2017-09-222-70/+67
| | | | llvm-svn: 313953
* Add support for attribute 'noescape'.Akira Hatanaka2017-09-223-15/+54
| | | | | | | | | | | | | | | | | | | | The attribute informs the compiler that the annotated pointer parameter of a function cannot escape and enables IRGen to attach attribute 'nocapture' to parameters that are annotated with the attribute. That is the only optimization that currently takes advantage of 'noescape', but there are other optimizations that will be added later that improves IRGen for ObjC blocks. This recommits r313722, which was reverted in r313725 because clang couldn't build compiler-rt. It failed to build because there were function declarations that were missing 'noescape'. That has been fixed in r313929. rdar://problem/19886775 Differential Revision: https://reviews.llvm.org/D32210 llvm-svn: 313945
* Extend -ast-dump for CXXRecordDecl to dump the flags from the DefinitionData.Richard Smith2017-09-221-0/+122
| | | | llvm-svn: 313943
* Revert "Give external linkage and mangling to lambdas inside inline ↵Vitaly Buka2017-09-213-25/+7
| | | | | | | | | | variables and variable templates." To fix: runtime error: load of value 15, which is not a valid value for type 'clang::LVComputationKind' This reverts commit r313827. llvm-svn: 313856
* Give external linkage and mangling to lambdas inside inline variables and ↵Richard Smith2017-09-203-7/+25
| | | | | | | | variable templates. This implements the proposed approach in https://github.com/itanium-cxx-abi/cxx-abi/issues/33 llvm-svn: 313827
* [OPENMP] Support for re-declarations when checking captured variables.Alexey Bataev2017-09-201-5/+1
| | | | | | | Need to check for variables re-declarations when checking that the variable was already captured in the captured region. llvm-svn: 313805
* Remove offset size check in nullptr arithmetic handlingAndrew Kaylor2017-09-201-7/+0
| | | | | | Differential Revision: https://reviews.llvm.org/D37042 llvm-svn: 313784
* Implement C++ [basic.link]p8.Richard Smith2017-09-201-5/+7
| | | | | | | | | | | | | | If a function or variable has a type with no linkage (and is not extern "C"), any use of it requires a definition within the same translation unit; the idea is that it is not possible to define the entity elsewhere, so any such use is necessarily an error. There is an exception, though: some types formally have no linkage but nonetheless can be referenced from other translation units (for example, this happens to anonymous structures defined within inline functions). For entities with those types, we suppress the diagnostic except under -pedantic. llvm-svn: 313729
* Revert "Add support for attribute 'noescape'."Akira Hatanaka2017-09-203-54/+15
| | | | | | | | | | This reverts commit r313722. It looks like compiler-rt/lib/tsan/rtl/tsan_libdispatch_mac.cc cannot be compiled because some of the functions declared in the file do not match the ones in the SDK headers (which are annotated with 'noescape'). llvm-svn: 313725
* Add support for attribute 'noescape'.Akira Hatanaka2017-09-203-15/+54
| | | | | | | | | | | | | | | The attribute informs the compiler that the annotated pointer parameter of a function cannot escape and enables IRGen to attach attribute 'nocapture' to parameters that are annotated with the attribute. That is the only optimization that currently takes advantage of 'noescape', but there are other optimizations that will be added later that improves IRGen for ObjC blocks. rdar://problem/19886775 Differential Revision: https://reviews.llvm.org/D32210 llvm-svn: 313722
* Revert "Add support for attribute 'noescape'."Akira Hatanaka2017-09-203-54/+15
| | | | | | | | This reverts r313717. I closed the wrong phabricator review. llvm-svn: 313721
* Add support for attribute 'noescape'.Akira Hatanaka2017-09-203-15/+54
| | | | | | | | | | | | | | | The attribute informs the compiler that the annotated pointer parameter of a function cannot escape and enables IRGen to attach attribute 'nocapture' to parameters that are annotated with the attribute. That is the only optimization that currently takes advantage of 'noescape', but there are other optimizations that will be added later that improves IRGen for ObjC blocks. rdar://problem/19886775 Differential Revision: https://reviews.llvm.org/D32520 llvm-svn: 313720
* Teach clang to tolerate the 'p = nullptr + n' idiom used by glibcAndrew Kaylor2017-09-191-0/+39
| | | | | | Differential Revision: https://reviews.llvm.org/D37042 llvm-svn: 313666
* [Sema] Disallow assigning record lvalues with nested const-qualified fields.Bjorn Pettersson2017-09-192-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: According to C99 6.3.2.1p1, structs and unions with nested const-qualified fields (that is, const-qualified fields declared at some recursive level of the aggregate) are not modifiable lvalues. However, Clang permits assignments of these lvalues. With this patch, we both prohibit the assignment of records with const-qualified fields and emit a best-effort diagnostic. This fixes https://bugs.llvm.org/show_bug.cgi?id=31796 . Committing on behalf of bevinh (Bevin Hansson). Reviewers: rtrieu, rsmith, bjope Reviewed By: bjope Subscribers: Ka-Ka, rogfer01, bjope, fhahn, cfe-commits Differential Revision: https://reviews.llvm.org/D37254 llvm-svn: 313628
* Fix the __interface inheritence rules to work better with IUnknown and IDispatchErich Keane2017-09-151-0/+47
| | | | | | | | | | | | | __interface objects in MSVC are permitted to inherit from __interface types, and interface-like types. Additionally, there are two default interface-like types (IUnknown and IDispatch) that all interface-like types must inherit from. Differential Revision: https://reviews.llvm.org/D37308 llvm-svn: 313364
* Fix broken links to the Itanium CXX ABIVlad Tsyrklevich2017-09-122-2/+2
| | | | llvm-svn: 312986
* Recommit "Add _Float16 as a C/C++ source language type"Sjoerd Meijer2017-09-087-2/+22
| | | | | | | | This is a recommit of r312781; in some build configurations variable names are omitted, so changed the new regression test accordingly. llvm-svn: 312794
* Revert "Add _Float16 as a C/C++ source language type"Sjoerd Meijer2017-09-087-22/+2
| | | | | | | The clang-with-lto-ubuntu bot didn't like the new regression test, revert while I investigate the issue. llvm-svn: 312784
* Add _Float16 as a C/C++ source language typeSjoerd Meijer2017-09-087-2/+22
| | | | | | | | | | | This adds _Float16 as a source language type, which is a 16-bit floating point type defined in C11 extension ISO/IEC TS 18661-3. In follow up patches documentation and more tests will be added. Differential Revision: https://reviews.llvm.org/D33719 llvm-svn: 312781
* Add IDNS_Tag to C++ declarations that conflict with tag declarations.Richard Smith2017-09-071-6/+5
| | | | | | | Fixes some accepts-invalids with tags and other declarations declared in the same scope. llvm-svn: 312743
* Fix off-by-one error in block mangling.Richard Smith2017-09-071-0/+4
| | | | | | This restores the ABI prior to r214699. llvm-svn: 312700
* [modules ts] Ensure that module linkage variables are always emitted and ↵Richard Smith2017-09-071-0/+5
| | | | | | always have their name mangled. llvm-svn: 312684
* [modules ts] Emit global variables in a module interface unit as part of ↵Richard Smith2017-09-061-11/+29
| | | | | | that unit, not in importers. llvm-svn: 312665
* [OPENMP] Fix for PR34445: Reduction initializer segfaults at runtime inAlexey Bataev2017-09-062-0/+22
| | | | | | | | | | move constructor. Previously user-defined reduction initializer was considered as an assignment expression, not as initializer. Fixed this by treating the initializer expression as an initializer. llvm-svn: 312638
* [AST] Add TableGen for StmtDataCollectorsJohannes Altmanninger2017-09-061-141/+0
| | | | | | | | | | | | | | Summary: This adds an option "-gen-clang-data-collectors" to the Clang TableGen that is used to generate StmtDataCollectors.inc. Reviewers: arphaman, teemperor! Subscribers: mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D37383 llvm-svn: 312634
* Always allocate room for a ModuleDecl on the TranslationUnitDecl.Richard Smith2017-09-051-2/+3
| | | | | | Sometimes we create the ASTContext and thus the TranslationUnitDecl before we know the LangOptions. This should fix the asan buildbot failures after r312467. llvm-svn: 312506
* Implement Itanium name mangling support for C++ Modules TS.Richard Smith2017-09-042-11/+84
| | | | | | | | | | | | This follows the scheme agreed with Nathan Sidwell, which can be found here: https://gcc.gnu.org/wiki/cxx-modules?action=AttachFile This will be proposed to the itanium-cxx-abi list once we have some experience with how well it works; the ABI for this TS should be considered unstable until it is part of the Itanium C++ ABI. llvm-svn: 312467
* Revert "Improve constant expression evaluation of arrays of unknown bound."Martin Bohme2017-08-301-59/+26
| | | | | | | | This reverts commit r311970. Breaks internal tests. llvm-svn: 312108
* PR10147: When substituting a template template argument, substitute in the mostRichard Smith2017-08-291-0/+17
| | | | | | | recent (non-friend) declaration to pick up the right set of default template arguments. llvm-svn: 312049
* [ms] Fix vbtable index for covariant overrides of vbase methodsReid Kleckner2017-08-291-4/+6
| | | | | | | | | | | | | | | Overriding a method from a virtual base with a covariant return type consumes a slot from the vftable in the virtual base. This can make it impossible to implement certain diamond inheritance hierarchies, but we have to follow along for compatibility in the simple cases. This patch only affects our vtable dumper and member pointer function mangling, since all other callers of getMethodVFTableLocation seem to recompute VBTableIndex instead of using the one in the method location. Patch by David Majnemer llvm-svn: 312017
* Improve constant expression evaluation of arrays of unknown bound.Richard Smith2017-08-291-26/+59
| | | | | | | | The standard is not clear on how these are supposed to be handled, so we conservatively treat as non-constant any cases whose value is unknown or whose evaluation might result in undefined behavior. llvm-svn: 311970
* [c++2a] P0683R1: Permit default member initializers for bit-fields.Richard Smith2017-08-281-16/+8
| | | | | | | This would be trivial, except that our in-memory and serialized representations for FieldDecls assumed that this can't happen. llvm-svn: 311867
* ObjC++: decorate ObjC interfaces in MSABI properlySaleem Abdulrasool2017-08-231-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | `id` needs to be handled specially since it is a `TypedefType` which is sugar for an `ObjCObjectPointerType` whose pointee is an `ObjCObjectType` with base `BuiltinType::ObjCIdType` and no protocols and the first level of pointer gets it own type implementation. `Class` is similar with the `ObjCClassType` as the base instead. The qualifiers on the base type of the `ObjCObjectType` need to be dropped because the innermost `mangleType` will handle the qualifiers itself. `id` is desugared to `struct objc_object *` which should be encoded as `PAUobjc_object@@`. `Class` is desugared to `struct objc_class *` which should be encoded as `PAUobjc_class@@`. We were previously applying an extra modifier `A` which will be handled during the recursive call. This now properly decorates interface types as well as `Class` and `id`. This corrects the interactions between C++ and ObjC++ for the type specifier decoration. llvm-svn: 311617
* Fix mangling for dependent "type { expr-list }" expressions, and add ↵Richard Smith2017-08-233-1/+45
| | | | | | mangling for designated initializers matching recent cxx-abi-dev discussion. llvm-svn: 311612
* [analyzer] Make StmtDataCollector customizableJohannes Altmanninger2017-08-233-0/+192
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This moves the data collection macro calls for Stmt nodes to lib/AST/StmtDataCollectors.inc Users can subclass ConstStmtVisitor and include StmtDataCollectors.inc to define visitor methods for each Stmt subclass. This makes it also possible to customize the visit methods as exemplified in lib/Analysis/CloneDetection.cpp. Move helper methods for data collection to a new module, AST/DataCollection. Add data collection for DeclRefExpr, MemberExpr and some literals. Reviewers: arphaman, teemperor! Subscribers: mgorny, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D36664 llvm-svn: 311569
* [ODRHash] Diagnose differing template parameters.Richard Trieu2017-08-231-1/+54
| | | | llvm-svn: 311519
* [ODRHash] Move into anonymous namespace. NFC.Benjamin Kramer2017-08-201-0/+4
| | | | llvm-svn: 311286
* PR34161: support evaluation of 'void()' expressions in C++14 onwards.Richard Smith2017-08-171-0/+2
| | | | llvm-svn: 311115
* Print enum constant values using the original source formattingAlex Lorenz2017-08-172-18/+44
| | | | | | | | if possible when creating "Declaration" nodes in XML comments rdar://14765746 llvm-svn: 311085
* Fix undefined behavior that is caused by not always initializing a bool.Daniel Jasper2017-08-171-0/+1
| | | | | | | The fix in r310994 is incomplete, as moveFromAndCancel can set the pointer without initializing OldIsSpeculativelyEvaluating. llvm-svn: 311070
* Fix a UBSan failure where this boolean was copied when uninitialized.Chandler Carruth2017-08-161-1/+1
| | | | | | | | | When r310905 moved the pointer and bool out of a PointerIntPair, it made them end up uninitialized and caused UBSan failures when copying the uninitialized boolean. However, making the pointer be null should avoid the reference to the boolean entirely. llvm-svn: 310994
* PR19668, PR23034: Fix handling of move constructors and deleted copyRichard Smith2017-08-162-4/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | constructors when deciding whether classes should be passed indirectly. This fixes ABI differences between Clang and GCC: * Previously, Clang ignored the move constructor when making this determination. It now takes the move constructor into account, per https://github.com/itanium-cxx-abi/cxx-abi/pull/17 (this change may seem recent, but the ABI change was agreed on the Itanium C++ ABI list a long time ago). * Previously, Clang's behavior when the copy constructor was deleted was unstable -- depending on whether the lazy declaration of the copy constructor had been triggered, you might get different behavior. We now eagerly declare the copy constructor whenever its deletedness is unclear, and ignore deleted copy/move constructors when looking for a trivial such constructor. This also fixes an ABI difference between Clang and MSVC: * If the copy constructor would be implicitly deleted (but has not been lazily declared yet), for instance because the class has an rvalue reference member, we would pass it directly. We now pass such a class indirectly, matching MSVC. Based on a patch by Vassil Vassilev, which was based on a patch by Bernd Schmidt, which was based on a patch by Reid Kleckner! This is a re-commit of r310401, which was reverted in r310464 due to ARM failures (which should now be fixed). llvm-svn: 310983
* Allow the target field of a CK_ToUnion to be more easily recovered.John McCall2017-08-151-0/+20
| | | | llvm-svn: 310963
* [OpenCL] Support variable memory scope in atomic builtinsYaxun Liu2017-08-151-17/+16
| | | | | | Differential Revision: https://reviews.llvm.org/D36580 llvm-svn: 310924
* [OpenCL] Allow targets to select address space per typeSven van Haastregt2017-08-151-20/+9
| | | | | | | | | | | | | Generalize getOpenCLImageAddrSpace into getOpenCLTypeAddrSpace, such that targets can select the address space per type. No functional changes intended. Initial patch by Simon Perretta. Differential Revision: https://reviews.llvm.org/D33989 llvm-svn: 310911
* Avoid PointerIntPair of constexpr EvalInfo structsReid Kleckner2017-08-151-13/+11
| | | | | | | | | | | | | | They are stack allocated, so their alignment is not to be trusted. 32-bit MSVC only guarantees 4 byte stack alignment, even though alignof would tell you otherwise. I tried fixing this with __declspec align, but that apparently upsets GCC. Hopefully this version will satisfy all compilers. See PR32018 for some info about the mingw issues. Should supercede https://reviews.llvm.org/D34873 llvm-svn: 310905
* PR34163: Don't cache an incorrect key function for a class if queried betweenRichard Smith2017-08-121-2/+3
| | | | | | | | | | | the class becoming complete and its inline methods being parsed. This replaces the hack of using the "late parsed template" flag to track member functions with bodies we've not parsed yet; instead we now use the "will have body" flag, which carries the desired implication that the function declaration *is* a definition, and that we've just not parsed its body yet. llvm-svn: 310776
* PR33489: A function-style cast to a deduced class template specialization ↵Richard Smith2017-08-111-1/+3
| | | | | | type is type-dependent if it can't be resolved due to a type-dependent argument. llvm-svn: 310691
OpenPOWER on IntegriCloud