summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
Commit message (Collapse)AuthorAgeFilesLines
...
* [OpenMP50] Add parallel master construct, by Chi Chun Chen.cchen2019-12-043-0/+35
| | | | | | | | | | | | Reviewers: ABataev, jdoerfert Reviewed By: ABataev Subscribers: jholewinski, guansong, arphaman, jfb, cfe-commits, sandoval, dreachem Tags: #clang Differential Revision: https://reviews.llvm.org/D70726
* Reapply af57dbf12e54 "Add support for options -frounding-math, ↵Melanie Blower2019-12-041-0/+1
| | | | | | | | | | ftrapping-math, -ffp-model=, and -ffp-exception-behavior=" Patch was reverted because https://bugs.llvm.org/show_bug.cgi?id=44048 The original patch is modified to set the strictfp IR attribute explicitly in CodeGen instead of as a side effect of IRBuilder Differential Revision: https://reviews.llvm.org/D62731
* [Clang] Define Fuchsia C++ABIPetr Hosek2019-12-031-0/+2
| | | | | | | Currently, it is a modified version of the Itanium ABI, with the only change being that constructors and destructors return 'this'. Differential Revision: https://reviews.llvm.org/D70575
* Fix warning on unused variable. NFC.Michael Liao2019-12-031-1/+1
|
* Reapply "Fix crash on switch conditions of non-integer types in templates"Elizabeth Andrews2019-12-031-0/+9
| | | | | | | | | | | | | | | | | | | | This patch reapplies commit 759948467ea. Patch was reverted due to a clang-tidy test fail on Windows. The test has been modified. There are no additional code changes. Patch was tested with ninja check-all on Windows and Linux. Summary of code changes: Clang currently crashes for switch statements inside a template when the condition is a non-integer field member because contextual implicit conversion is skipped when parsing the condition. This conversion is however later checked in an assert when the case statement is handled. The conversion is skipped when parsing the condition because the field member is set as type-dependent based on its containing class. This patch sets the type dependency based on the field's type instead. This patch fixes Bug 40982.
* Differentiate between the presumed and actual file when dumping the AST to JSONAaron Ballman2019-12-031-3/+10
| | | | | | | | | | Currently, when dumping the AST to JSON, the presumed file is what is included when dumping a source location. This patch changes the behavior to instead dump the actual file, and only dump a presumed file name when it differs from the actual file. This also corrects an issue with the test script generator that would prevent it from working on Windows due to file permissions issues.
* Add FunctionDecl::getParameterSourceRange()Nicolas Manichon2019-12-033-2/+25
| | | | | This source range covers the list of parameters of the function declaration, including the ellipsis for a variadic function.
* [clang][modules] Add support for merging lifetime-extended temporariesTyker2019-12-021-0/+11
| | | | | | | | | | | | | | Summary: Add support for merging lifetime-extended temporaries Reviewers: rsmith Reviewed By: rsmith Subscribers: xbolva00, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70190
* Revert "[clang][modules] Add support for merging lifetime-extended temporaries"Tyker2019-12-011-11/+0
| | | | This reverts commit a3cbe1a202df6ec8e23bd55e14db254e4bc33021.
* [clang][modules] Add support for merging lifetime-extended temporariesTyker2019-12-011-0/+11
| | | | | | | | | | | | | | Summary: Add support for merging lifetime-extended temporaries Reviewers: rsmith Reviewed By: rsmith Subscribers: xbolva00, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70190
* Revert "[clang][modules] Add support for merging lifetime-extended temporaries"Tyker2019-12-011-11/+0
| | | | This reverts commit 85c74384778909789389b9012a75cfcca7964a28.
* [clang][modules] Add support for merging lifetime-extended temporariesTyker2019-11-301-0/+11
| | | | | | | | | | | | | | Summary: Add support for merging lifetime-extended temporaries Reviewers: rsmith Reviewed By: rsmith Subscribers: xbolva00, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70190
* Revert "[clang][modules] Add support for merging lifetime-extended temporaries"Tyker2019-11-301-11/+0
| | | | This reverts commit 3c7f6b439699a9cbbc0ac8d288cc70aff357446b.
* [clang][modules] Add support for merging lifetime-extended temporariesTyker2019-11-301-0/+11
| | | | | | | | | | | | | | Summary: Add support for merging lifetime-extended temporaries Reviewers: rsmith Reviewed By: rsmith Subscribers: xbolva00, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70190
* [ConstExprPreter] Removed the flag forcing the use of the interpreterNandor Licker2019-11-273-134/+72
| | | | | | | | | | | | | | | | | | | Summary: Removed the ```-fforce-experimental-new-constant-interpreter flag```, leaving only the ```-fexperimental-new-constant-interpreter``` one. The interpreter now always emits an error on an unsupported feature. Allowing the interpreter to bail out would require a mapping from APValue to interpreter memory, which will not be necessary in the final version. It is more sensible to always emit an error if the interpreter fails. Reviewers: jfb, Bigcheese, rsmith, dexonsmith Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70071
* [OpenCL] Move addr space deduction to Sema.Anastasia Stulova2019-11-271-1/+1
| | | | | | | | | | | | | | | | In order to simplify implementation we are moving add space deduction into Sema while constructing variable declaration and on template instantiation. Pointee are deduced to generic addr space during creation of types. This commit also - fixed addr space dedution for auto type; - factors out in a separate helper function OpenCL specific logic from type diagnostics in var decl. Tags: #clang Differential Revision: https://reviews.llvm.org/D65744
* Workaround for EvalInfo ctor for MSVC 2017Yaxun (Sam) Liu2019-11-261-3/+3
| | | | | | | | | | | | Current EvalInfo ctor causes EnableNewConstInterp to be true even though it is supposed to be false on MSVC 2017. This is because a virtual function getLangOpts() is called in member initializer lists, whereas on MSVC member ctors are called before function virtual function pointers are initialized. This patch fixes that. Differential Revision: https://reviews.llvm.org/D70729
* [OPENMP]Fix PR41826: symbols visibility in device code.Alexey Bataev2019-11-251-0/+4
| | | | | | | | | | | | | | | | | | Summary: Currently, we ignore all locality attributes/info when building for the device and thus all symblos are externally visible and can be preemted at the runtime. It may lead to incorrect results. We need to follow the same logic, compiler uses for static/pie builds. But in some cases changing of dso locality may lead to problems with codegen, so instead mark external symbols as hidden instead in the device code. Reviewers: jdoerfert Subscribers: guansong, caomhin, kkwli0, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70549
* Separate the MS inheritance model enum from the attribute, NFCReid Kleckner2019-11-222-36/+37
| | | | | | This avoids the need to include Attr.h in DeclCXX.h for a four-value enum. Removing the include will be done separately, since it is large and risky change.
* Move vtordisp mode from Attr class to LangOptions.h, NFCReid Kleckner2019-11-222-5/+5
| | | | | This removes one of the two uses of Attr.h in DeclCXX.h, reducing the need to include Attr.h as widely. LangOptions is already very popular.
* [DeclCXX] Remove unknown external linkage specificationsEhud Katz2019-11-213-23/+4
| | | | | | | | | | | | | | | | Partial revert of r372681 "Support for DWARF-5 C++ language tags". The change introduced new external linkage languages ("C++11" and "C++14") which not supported in C++. It also changed the definition of the existing enum to use the DWARF constants. The problem is that "LinkageSpecDeclBits.Language" (the field that reserves this enum) is actually defined as 3 bits length (bitfield), which cannot contain the new DWARF constants. Defining the enum as integer literals is more appropriate for maintaining valid values. Differential Revision: https://reviews.llvm.org/D69935
* Atomics: support min/max orthogonallyTim Northover2019-11-211-0/+4
| | | | | | | | | | | | We seem to have been gradually growing support for atomic min/max operations (exposing longstanding IR atomicrmw instructions). But until now there have been gaps in the expected intrinsics. This adds support for the C11-style intrinsics (i.e. taking _Atomic, rather than individually blessed by C11 standard), and the variants that return the new value instead of the original one. That way, people won't be misled by trying one form and it not working, and the front-end is more friendly to people using _Atomic types, as we recommend.
* [Sema] Add a 'Semantic' parameter to Expr::isKnownToHaveBooleanValueErik Pilkington2019-11-201-14/+11
| | | | | | | | | Some clients of this function want to know about any expression that is known to produce a 0/1 value, and others care about expressions that are semantically boolean. This fixes a -Wswitch-bool regression I introduced in 8bfb353bb33c, pointed out by Chris Hamilton!
* fixe leak found by asan build botTyker2019-11-191-1/+3
|
* [NFC] Refactor representation of materialized temporariesTyker2019-11-199-59/+116
| | | | | | | | | | | | | | | Summary: this patch refactor representation of materialized temporaries to prevent an issue raised by rsmith in https://reviews.llvm.org/D63640#inline-612718 Reviewers: rsmith, martong, shafik Reviewed By: rsmith Subscribers: thakis, sammccall, ilya-biryukov, rnkovacs, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69360
* [Sema] Fix a -Wobjc-signed-char-bool false-positiveErik Pilkington2019-11-181-0/+6
| | | | | | | Unsigned bit-field flags can only have boolean values, so handle that case in Expr::isKnownToHaveBooleanValue. rdar://56256999
* Implement __attribute__((objc_direct)), __attribute__((objc_direct_members))Pierre Habouzit2019-11-184-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | __attribute__((objc_direct)) is an attribute on methods declaration, and __attribute__((objc_direct_members)) on implementation, categories or extensions. A `direct` property specifier is added (@property(direct) type name) These attributes / specifiers cause the method to have no associated Objective-C metadata (for the property or the method itself), and the calling convention to be a direct C function call. The symbol for the method has enforced hidden visibility and such direct calls are hence unreachable cross image. An explicit C function must be made if so desired to wrap them. The implicit `self` and `_cmd` arguments are preserved, however to maintain compatibility with the usual `objc_msgSend` semantics, 3 fundamental precautions are taken: 1) for instance methods, `self` is nil-checked. On arm64 backends this typically adds a single instruction (cbz x0, <closest-ret>) to the codegen, for the vast majority of the cases when the return type is a scalar. 2) for class methods, because the class may not be realized/initialized yet, a call to `[self self]` is emitted. When the proper deployment target is used, this is optimized to `objc_opt_self(self)`. However, long term we might want to emit something better that the optimizer can reason about. When inlining kicks in, these calls aren't optimized away as the optimizer has no idea that a single call is really necessary. 3) the calling convention for the `_cmd` argument is changed: the caller leaves the second argument to the call undefined, and the selector is loaded inside the body when it's referenced only. As far as error reporting goes, the compiler refuses: - making any overloads direct, - making an overload of a direct method, - implementations marked as direct when the declaration in the interface isn't (the other way around is allowed, as the direct attribute is inherited from the declaration), - marking methods required for protocol conformance as direct, - messaging an unqualified `id` with a direct method, - forming any @selector() expression with only direct selectors. As warnings: - any inconsistency of direct-related calling convention when @selector() or messaging is used, - forming any @selector() expression with a possibly direct selector. Lastly an `objc_direct_members` attribute is added that can decorate `@implementation` blocks and causes methods only declared there (and in no `@interface`) to be automatically direct. When decorating an `@interface` then all methods and properties declared in this block are marked direct. Radar-ID: rdar://problem/2684889 Differential Revision: https://reviews.llvm.org/D69991 Reviewed-By: John McCall
* [AST] Attach comment in `/** doc */ typedef struct A {} B` to B as well as A.Sam McCall2019-11-181-1/+3
| | | | | | | | | | | | | | | | | | | | | | Summary: Semantically they're the same thing, and it's important when the underlying struct is anonymous. There doesn't seem to be a problem attaching the same comment to multiple things as it already happens with `/** doc */ int a, b;` This affects an Index test but the results look better (name present, USR points to the typedef). Fixes https://github.com/clangd/clangd/issues/189 Reviewers: kadircet, lh123 Subscribers: ilya-biryukov, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70203
* Revert "[NFC] Refactor representation of materialized temporaries"Nico Weber2019-11-179-116/+59
| | | | | | This reverts commit 08ea1ee2db5f9d6460fef1d79d0d1d1a5eb78982. It broke ./ClangdTests/FindExplicitReferencesTest.All on the bots, see comments on https://reviews.llvm.org/D69360
* [NFC] Refactor representation of materialized temporariesTyker2019-11-169-59/+116
| | | | | | | | | | | | | | | Summary: this patch refactor representation of materialized temporaries to prevent an issue raised by rsmith in https://reviews.llvm.org/D63640#inline-612718 Reviewers: rsmith, martong, shafik Reviewed By: rsmith Subscribers: rnkovacs, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69360
* [AST] Let DeclarationNameInfo printing use PrintingPolicy, and fix ↵Sam McCall2019-11-153-13/+18
| | | | const-correctness
* [Clang][ASTImporter] Added visibility check for ClassTemplateDecl.Balázs Kéri2019-11-151-0/+2
| | | | | | | | | | | | | | | | Summary: ASTImporter makes now difference between class templates with same name in different translation units if these are not visible outside. Reviewers: martong, a.sidorin, shafik Reviewed By: martong Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, teemperor, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67543
* Include the mangled name in -ast-dump=jsonAlex Richardson2019-11-151-1/+5
| | | | | | | | | | | | | | | | | | | | I am planning to use this feature to make update_cc_test_checks.py less fragile by obtaining the mangled names directly from -ast-dump=json. Currently, it uses c-index-test which ignores the -triple=, etc. arguments that are in the RUN: line and therefore does not generate checks for some targets. The AST dump tests were updated using the following command: `python $LLVM_BINDIR/gen_ast_dump_json_test.py --update --source $LLVM_SRC/clang/test/AST/*-json.*` Reviewers: aaron.ballman Reviewed By: aaron.ballman Subscribers: rsmith, MaskRay, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69564
* [AST] Use written names instead of `type-param-0-0` in more cases when ↵Sam McCall2019-11-151-38/+30
| | | | | | | | | | | | | | | | | | | printing types and decls. Summary: This doesn't cover decls in diagnostics, which use NamedDecl::getNameForDiagnostic(). (That should also be fixed later I think). This covers some cases of https://github.com/clangd/clangd/issues/76 (hover, but not outline or sighelp) Reviewers: hokein Subscribers: ilya-biryukov, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70236
* Modernize llvm::Error handling in ExternalASTMergerRaphael Isemann2019-11-141-3/+1
|
* [AST] Use an explicit copy in a range-based forMark de Wever2019-11-122-2/+2
| | | | | | | | | The AssociationIteratorTy type will be copied in a range-based for loop. Make the copy explicit to avoid the -Wrange-loop-analysis warning. This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall. Differential Revision: https://reviews.llvm.org/D70045
* Revert "Reapply "Fix crash on switch conditions of non-integer types in ↵Melanie Blower2019-11-081-9/+0
| | | | | | | templates"" This reverts commit 759948467ea3181615d44d80f74ffeb260180fd0. There were build bot failures in clang-tidy
* Reapply "Fix crash on switch conditions of non-integer types in templates"Melanie Blower2019-11-081-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch reapplies commit 76945821b9cad3. The first version broke buildbots due to clang-tidy test fails. The fails are because some errors in templates are now diagnosed earlier (does not wait till instantiation). I have modified the tests to add checks for these diagnostics/prevent these diagnostics. There are no additional code changes. Summary of code changes: Clang currently crashes for switch statements inside a template when the condition is a non-integer field member because contextual implicit conversion is skipped when parsing the condition. This conversion is however later checked in an assert when the case statement is handled. The conversion is skipped when parsing the condition because the field member is set as type-dependent based on its containing class. This patch sets the type dependency based on the field's type instead. This patch fixes Bug 40982. Reviewers: rnk, gribozavr2 Patch by: Elizabeth Andrews (eandrews) Differential revision: https://reviews.llvm.org/D69950
* Redeclare Objective-C property accessors inside the ObjCImplDecl in which ↵Adrian Prantl2019-11-082-16/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | they are synthesized. This patch is motivated by (and factored out from) https://reviews.llvm.org/D66121 which is a debug info bugfix. Starting with DWARF 5 all Objective-C methods are nested inside their containing type, and that patch implements this for synthesized Objective-C properties. 1. SemaObjCProperty populates a list of synthesized accessors that may need to inserted into an ObjCImplDecl. 2. SemaDeclObjC::ActOnEnd inserts forward-declarations for all accessors for which no override was provided into their ObjCImplDecl. This patch does *not* synthesize AST function *bodies*. Moving that code from the static analyzer into Sema may be a good idea though. 3. Places that expect all methods to have bodies have been updated. I did not update the static analyzer's inliner for synthesized properties to point back to the property declaration (see test/Analysis/Inputs/expected-plists/nullability-notes.m.plist), which I believed to be more bug than a feature. Differential Revision: https://reviews.llvm.org/D68108 rdar://problem/53782400
* [AST][NFC] Fixes a comment typoMark de Wever2019-11-041-1/+1
| | | | Also a test for commit access.
* [OPENMP50]Support for imperfectly nested loops.Alexey Bataev2019-11-041-0/+68
| | | | Added support for imperfectly nested loops introduced in OpenMP 5.0.
* Remove unneeded template alias, causes issues with some MSVC versionReid Kleckner2019-10-311-3/+1
| | | | | | | | | I built locally with the latest MSVC in c++14 and c++17, but it does not complain for me. Osman Zakir on llvm-dev reports that they run into compile errors here. In any case, it seems prefereable to reuse clang's LLVM.h header to bring in llvm::Optional and Expected.
* [Diagnostics] Warn for std::is_constant_evaluated in constexpr modeDávid Bolvanský2019-10-311-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: constexpr int fn1() { if constexpr (std::is_constant_evaluated()) // condition is always true! return 0; else return 1; } constexpr int fn2() { if (std::is_constant_evaluated()) return 0; else return 1; } Solves PR42977 Reviewers: rsmith, aaron.ballman Reviewed By: rsmith Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69518
* Fix __attribute__((enable_if)) to treat arguments with side-effects asRichard Smith2019-10-301-11/+28
| | | | | | | | non-constant. We previously failed the entire condition evaluation if an unmodeled side-effect was encountered in an argument, even if that argument was unused in the attribute's condition.
* [OPENMP50]Add support for parallel master taskloop simd directive.Alexey Bataev2019-10-303-0/+68
| | | | Added full support for parallel master taskloop simd directive.
* [ASTImporter] Add support for BuiltinTemplateDeclRaphael Isemann2019-10-301-0/+16
| | | | | | | | | | | | | | | | | Summary: That decl kind is currently not implemented. BuiltinTemplateDecl is for decls that are hardcoded in the ASTContext, so we can import them like we do other builtin decls by just taking the equivalent decl from the target ASTContext. Reviewers: martong, a.sidorin, shafik Reviewed By: martong, shafik Subscribers: rnkovacs, kristina, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69566
* Replace std::function in PrintingPolicy with a callbacks object.Richard Smith2019-10-291-2/+2
| | | | | This makes PrintingPolicy significantly more lightweight and provides groundwork for more printing customization hooks.
* Revert "[Concepts] Constraint Enforcement & Diagnostics"Vlad Tsyrklevich2019-10-285-68/+9
| | | | | This reverts commit ffa214ef22892d75340dc6720271863901dc2c90, it was causing ASAN test failures on sanitizer-x86_64-linux-bootstrap.
* PR43762: when implicitly changing the active union member for anRichard Smith2019-10-271-3/+10
| | | | | assignment during constant evaluation, only start the lifetime of trivially-default-constructible union members.
* [Concepts] Constraint Enforcement & DiagnosticsSaar Raz2019-10-255-9/+68
| | | | | | Part of the C++20 concepts implementation effort. - Associated constraints (requires clauses, currently) are now enforced when instantiating/specializing templates and when considering partial specializations and function overloads. - Elaborated diagnostics give helpful insight as to why the constraints were not satisfied. Phabricator: D41569
OpenPOWER on IntegriCloud