summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* [OPENMP]Use standard parsing for 'match' clause, NFC.Alexey Bataev2019-09-231-0/+7
| | | | | | | Reused standard clauses parsing scheme for parsing/matching 'match' clause in 'declare variant' directive. llvm-svn: 372635
* Fix __is_signed builtinZoe Carver2019-09-231-1/+3
| | | | | | | | | | | | | | Summary: This patch fixes the __is_signed builtin type trait to work with floating point types and enums. Now, the builtin will return true if it is passed a floating point type and false for an enum type. Reviewers: EricWF, rsmith, erichkeane, craig.topper, efriedma Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67897 llvm-svn: 372621
* [Diagnostics] Warn if '<<' in bool context with -Wint-in-bool-context (GCC ↵David Bolvansky2019-09-231-1/+10
| | | | | | | | compatibility) Extracted from D63082, addressed review comments related to a warning message. llvm-svn: 372612
* [Diagnostics] Avoid -Wsizeof-array-div when dividing the size of a nested ↵David Bolvansky2019-09-231-1/+2
| | | | | | array by the size of the deepest base type llvm-svn: 372600
* For P0784R7: add support for constexpr destructors, and call them asRichard Smith2019-09-234-28/+87
| | | | | | | | | | | appropriate during constant evaluation. Note that the evaluator is sometimes invoked on incomplete expressions. In such cases, if an object is constructed but we never reach the point where it would be destroyed (and it has non-trivial destruction), we treat the expression as having an unmodeled side-effect. llvm-svn: 372538
* [Diagnostics] Warn if ?: with integer constants always evaluates to trueDavid Bolvansky2019-09-221-0/+41
| | | | | | Extracted from D63082. GCC has this warning under -Wint-in-bool-context, but as noted in the D63082's review, we should put it under TautologicalConstantCompare. llvm-svn: 372531
* [CLANG][BPF] permit any argument type for __builtin_preserve_access_index()Yonghong Song2019-09-221-11/+1
| | | | | | | | | | | | | | | | | | | | Commit c15aa241f821 ("[CLANG][BPF] change __builtin_preserve_access_index() signature") changed the builtin function signature to PointerT __builtin_preserve_access_index(PointerT ptr) with a pointer type as the argument/return type, where argument and return types must be the same. There is really no reason for this constraint. The builtin just presented a code region so that IR builtins __builtin_{array, struct, union}_preserve_access_index can be applied. This patch removed the pointer type restriction to permit any argument type as long as it is permitted by the compiler. Differential Revision: https://reviews.llvm.org/D67883 llvm-svn: 372516
* NFC: Change ObjCQualified*TypesAreCompatible to takeJames Y Knight2019-09-212-6/+5
| | | | | | | | | ObjCObjectPointerType arguments. All callers already had one, just creating a QualType to pass, after which the function cast it right back. llvm-svn: 372492
* Merge and improve code that detects same value in comparisons.Richard Trieu2019-09-211-18/+13
| | | | | | | | | | | | -Wtautological-overlap-compare and self-comparison from -Wtautological-compare relay on detecting the same operand in different locations. Previously, each warning had it's own operand checker. Now, both are merged together into one function that each can call. The function also now looks through member access and array accesses. Differential Revision: https://reviews.llvm.org/D66045 llvm-svn: 372453
* Revert assertion added by r372394Yaxun Liu2019-09-211-1/+0
| | | | | | | | The assertion added by r372394 causes CUDA test in test-suite to assert. The assertion was not there originally, so revert it. llvm-svn: 372452
* Ensure AtomicExpr goes through SEMA checking after TreeTransformErich Keane2019-09-202-55/+59
| | | | | | | | | | | RebuildAtomicExpr was skipping doing semantic analysis which broke in the cases where the expressions were not dependent. This resulted in the ImplicitCastExpr from an array to a pointer being lost, causing a crash in IR CodeGen. Differential Revision: https://reviews.llvm.org/D67854 llvm-svn: 372422
* [CUDA][HIP] Fix hostness of defaulted constructorYaxun Liu2019-09-201-12/+27
| | | | | | | | | | | Clang does not respect the explicit device host attributes of defaulted special members. Also clang does not respect the hostness of special members determined by their first declarations. Clang also adds duplicate implicit device or host attributes in certain cases. This patch fixes that. Differential Revision: https://reviews.llvm.org/D67509 llvm-svn: 372394
* Finish building the full-expression for a static_assert expressionRichard Smith2019-09-201-9/+18
| | | | | | | | | | | | | | before evaluating it rather than afterwards. This is groundwork for C++20's P0784R7, where non-trivial destructors can be constexpr, so we need ExprWithCleanups markers in constant expressions. No significant functionality change intended (though this fixes a bug only visible through libclang / -ast-dump / tooling: we now store the converted condition on the StaticAssertDecl rather than the original). llvm-svn: 372368
* Model converted constant expressions as full-expressions.Richard Smith2019-09-193-43/+63
| | | | | | | | | | This is groundwork for C++20's P0784R7, where non-trivial destructors can be constexpr, so we need ExprWithCleanups markers in constant expressions. No functionality change intended. llvm-svn: 372359
* [CUDA][HIP] Re-apply part of r372318.Michael Liao2019-09-191-2/+4
| | | | | | | | | | - r372318 causes violation of `use-of-uninitialized-value` detected by MemorySanitizer. Once `Viable` field is set to false, `FailureKind` needs setting as well as it will be checked during destruction if `Viable` is not true. - Revert the part trying to skip `std::vector` erasing. llvm-svn: 372356
* Revert "[CUDA][HIP] Fix typo in `BestViableFunction`"Mitch Phillips2019-09-191-9/+7
| | | | | | | | Broke the msan buildbots (see comments on rL372318 for more details). This reverts commit eb231d15825ac345b546f4c99372d1cac8f14f02. llvm-svn: 372353
* [OpenCL] Add version handling and add vector ld/st builtinsSven van Haastregt2019-09-192-16/+152
| | | | | | | | | | | | | | | | | | | Allow setting a MinVersion, stating from which OpenCL version a builtin function is available, and a MaxVersion, stating from which OpenCL version a builtin function should not be available anymore. Guard some definitions of the "work-item" builtin functions according to the OpenCL versions from which they are available. Add the "vector data load and store" builtin functions (e.g. vload/vstore), whose signatures differ before and after OpenCL 2.0 in the pointer argument address spaces. Patch by Pierre Gondois and Sven van Haastregt. Differential Revision: https://reviews.llvm.org/D63504 llvm-svn: 372321
* [CUDA][HIP] Fix typo in `BestViableFunction`Michael Liao2019-09-191-7/+9
| | | | | | | | | | | | | | | | | | | Summary: - Should consider viable ones only when checking SameSide candidates. - Replace erasing with clearing viable flag to reduce data moving/copying. - Add one and revise another one as the diagnostic message are more relevant compared to previous one. Reviewers: tra Subscribers: cfe-commits, yaxunl Tags: #clang Differential Revision: https://reviews.llvm.org/D67730 llvm-svn: 372318
* [CLANG][BPF] change __builtin_preserve_access_index() signatureYonghong Song2019-09-191-1/+11
| | | | | | | | | | | | | | | | | | | | | | | The clang intrinsic __builtin_preserve_access_index() currently has signature: const void * __builtin_preserve_access_index(const void * ptr) This may cause compiler warning when: - parameter type is "volatile void *" or "const volatile void *", or - the assign-to type of the intrinsic does not have "const" qualifier. Further, this signature does not allow dereference of the builtin result pointer as it is a "const void *" type, which adds extra step for the user to do type casting. Let us change the signature to: PointerT __builtin_preserve_access_index(PointerT ptr) such that the result and argument types are the same. With this, directly dereferencing the builtin return value becomes possible. Differential Revision: https://reviews.llvm.org/D67734 llvm-svn: 372294
* [Sema] Suppress -Wformat diagnostics for bool types when printed using %hhdErik Pilkington2019-09-181-0/+16
| | | | | | | | | | | Also, add a diagnostic under -Wformat for printing a boolean value as a character. rdar://54579473 Differential revision: https://reviews.llvm.org/D66856 llvm-svn: 372247
* [c++20] P1331R2: Allow transient use of uninitialized objects inRichard Smith2019-09-181-11/+30
| | | | | | constant evaluation. llvm-svn: 372237
* [OPENMP5.0]Allow multiple context selectors in the context selectorAlexey Bataev2019-09-182-33/+42
| | | | | | | | | sets. According to OpenMP 5.0, context selector set might include several context selectors, separated with commas. Patch fixes this problem. llvm-svn: 372235
* [Sema] Split of versions of -Wimplicit-{float,int}-conversion for ↵Erik Pilkington2019-09-171-28/+59
| | | | | | | | | | | | | Objective-C BOOL Also, add a diagnostic group, -Wobjc-signed-char-bool, to control all these related diagnostics. rdar://51954400 Differential revision: https://reviews.llvm.org/D67559 llvm-svn: 372183
* Ignore exception specifier mismatch when merging redeclarationsReid Kleckner2019-09-171-1/+6
| | | | | | | | | | | | | | | | | | Exception specifiers are now part of the function type in C++17. Normally, it is illegal to redeclare the same function or specialize a template with a different exception specifier, but under -fms-compatibility, we accept it with a warning. Without this change, the function types would not match due to the exception specifier, and clang would claim that the types were "incompatible". Now we emit the warning and merge the redeclaration as we would in C++14 and earlier. Fixes PR42842, which is about compiling _com_ptr_t in C++17. Based on a patch by Alex Fusco <alexfusco@google.com>! Differential Revision: https://reviews.llvm.org/D67590 llvm-svn: 372178
* [OPENMP5.0]Introduce attribute for declare variant directive.Alexey Bataev2019-09-173-1/+87
| | | | | | | | Added attribute for declare variant directive. It will allow to handle declare variant directive at the codegen and will allow to add extra checks. llvm-svn: 372147
* Add SpellingNotCalculated to Attribute Enums to suppress UBSan warningsErich Keane2019-09-171-0/+2
| | | | | | | UBSan downstreams noticed that the assignment of SpellingNotCalculated to the spellings caused warnings. llvm-svn: 372124
* [OpenCL] Tidy up some comments; NFCSven van Haastregt2019-09-171-10/+4
| | | | llvm-svn: 372119
* Hide implementation details in namespaces.Benjamin Kramer2019-09-171-0/+2
| | | | llvm-svn: 372113
* Push lambda scope earlier when transforming lambda expressionNicholas Allegra2019-09-171-4/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D66067 llvm-svn: 372058
* [Modules][Objective-C] Use complete decl from module when diagnosing missing ↵Bruno Cardoso Lopes2019-09-161-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | import Summary: Otherwise the definition (first found) for ObjCInterfaceDecl's might precede the module one, which will eventually lead to crash, since diagnoseMissingImport needs one coming from a module. This behavior changed after Richard's r342018, which started to look into the definition of ObjCInterfaceDecls. rdar://problem/49237144 Reviewers: rsmith, arphaman Subscribers: jkorous, dexonsmith, ributzka, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66982 llvm-svn: 372039
* [OPENMP]Fix parsing/sema for function templates with declare simd.Alexey Bataev2019-09-161-1/+1
| | | | | | | | Need to return original declaration group with FunctionTemplateDecl, not the inner FunctionDecl, to correctly handle parsing of directives with the templates parameters. llvm-svn: 372011
* Move some definitions from Sema to Basic to fix shared libs buildErich Keane2019-09-161-70/+0
| | | | | | | | r371875 moved some functionality around to a Basic header file, but didn't move its definitions as well. This patch moves some things around so that shared library building can work. llvm-svn: 371985
* [Diagnostics] Added silence note for -Wsizeof-array-div; suggest extra parensDavid Bolvansky2019-09-141-0/+2
| | | | llvm-svn: 371924
* [OPENMP5.0]Add basic support for declare variant directive.Alexey Bataev2019-09-132-77/+296
| | | | | | | Added basic support for declare variant directive and its match clause with user context selector. llvm-svn: 371892
* [NFCI]Create CommonAttributeInfo Type as base type of *Attr and ParsedAttr.Erich Keane2019-09-1311-829/+529
| | | | | | | | | | | | In order to enable future improvements to our attribute diagnostics, this moves info from ParsedAttr into CommonAttributeInfo, then makes this type the base of the *Attr and ParsedAttr types. Quite a bit of refactoring took place, including removing a bunch of redundant Spelling Index propogation. Differential Revision: https://reviews.llvm.org/D67368 llvm-svn: 371875
* [Sema][Typo Correction] Fix potential infite loop on ambiguity checksDavid Goldman2019-09-131-0/+4
| | | | | | | | | | | | | | | | | | | | | | Summary: This fixes a bug introduced in D62648, where Clang could infinite loop if it became stuck on a single TypoCorrection when it was supposed to be testing ambiguous corrections. Although not a common case, it could happen if there are multiple possible corrections with the same edit distance. The fix is simply to wipe the TypoExpr from the `TransformCache` so that the call to `TransformTypoExpr` doesn't use the `CachedEntry`. Reviewers: rsmith Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67515 llvm-svn: 371859
* For PR17164: split -fno-lax-vector-conversion into three differentRichard Smith2019-09-131-1/+21
| | | | | | | | | | | | | | | | | | | | | levels: -- none: no lax vector conversions [new GCC default] -- integer: only conversions between integer vectors [old GCC default] -- all: all conversions between same-size vectors [Clang default] For now, Clang still defaults to "all" mode, but per my proposal on cfe-dev (2019-04-10) the default will be changed to "integer" as soon as that doesn't break lots of testcases. (Eventually I'd like to change the default to "none" to match GCC and general sanity.) Following GCC's behavior, the driver flag -flax-vector-conversions is translated to -flax-vector-conversions=integer. This reinstates r371805, reverted in r371813, with an additional fix for lldb. llvm-svn: 371817
* Revert "For PR17164: split -fno-lax-vector-conversion into three different"Jonas Devlieghere2019-09-131-21/+1
| | | | | | | This breaks the LLDB build. I tried reaching out to Richard, but haven't gotten a reply yet. llvm-svn: 371813
* For PR17164: split -fno-lax-vector-conversion into three differentRichard Smith2019-09-131-1/+21
| | | | | | | | | | | | | | | | | | levels: -- none: no lax vector conversions [new GCC default] -- integer: only conversions between integer vectors [old GCC default] -- all: all conversions between same-size vectors [Clang default] For now, Clang still defaults to "all" mode, but per my proposal on cfe-dev (2019-04-10) the default will be changed to "integer" as soon as that doesn't break lots of testcases. (Eventually I'd like to change the default to "none" to match GCC and general sanity.) Following GCC's behavior, the driver flag -flax-vector-conversions is translated to -flax-vector-conversions=integer. llvm-svn: 371805
* [MS] Warn when shadowing template parameters under -fms-compatibilityReid Kleckner2019-09-121-6/+5
| | | | | | | | | | | | | | | | | | | | Summary: C++ does not allow shadowing template parameters, but previously we allowed it under -fms-extensions. Now this behavior is controlled by -fms-compatibility, and we emit a -Wmicrosoft-template warning when it happens. Fixes PR43265 Reviewers: thakis, hans Subscribers: amccarth, rsmith, STL_MSFT, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67463 llvm-svn: 371753
* Don't warn about selectany on implicitly inline variablesReid Kleckner2019-09-121-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This avoids a -Wignored-attribute warning on the code pattern Microsoft recommends for integral const static data members defined in headers here: https://docs.microsoft.com/en-us/cpp/build/reference/microsoft-extensions-to-c-and-cpp?view=vs-2019 The attribute is redundant, but it is necessary when compiling in C++14 modes with /Za, which disables MSVC's extension that treats such variables as implicitly inline. Fixes PR43270 Reviewers: epastor, thakis, hans Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67426 llvm-svn: 371749
* Removed some questionable default arguments from settersDmitri Gribenko2019-09-121-4/+4
| | | | | | | | | | | | | | | | | Summary: They can be confusing -- what does it mean to call a setter without a value? Also, some setters, like `setPrintTemplateTree` had `false` as the default value! The callers are largely not using these default arguments anyway. Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67491 llvm-svn: 371731
* [MS] Consder constexpr globals to be inline, as in C++17Reid Kleckner2019-09-111-2/+5
| | | | | | | | | | | | | | | | Summary: Microsoft seems to do this regardless of the language mode, so we must also do it in order to be ABI compatible. Fixes PR36125 Reviewers: thakis Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D47956 llvm-svn: 371642
* [OPENMP] Update the diagnosis message for canonical loop form, by ChiAlexey Bataev2019-09-111-15/+16
| | | | | | | | | | | | | | | Chun Chen. The previous patch (https://reviews.llvm.org/D54441) support the relational-op != very well for openmp canonical loop form, however, it didn't update the diagnosis message. So this patch is simply update the diagnosis message by adding !=, update the test related to it, and update the section number for canonical loop form for OpenMP 5.0 in comment. Differential Revision: https://reviews.llvm.org/D66559 llvm-svn: 371631
* [Diagnostics] Add -Wsizeof-array-divDavid Bolvansky2019-09-111-10/+21
| | | | | | | | | | Summary: Clang version of https://www.viva64.com/en/examples/v706/ Reviewers: rsmith Differential Revision: https://reviews.llvm.org/D67287 llvm-svn: 371605
* Emit -Wmicrosoft-enum-value warning instead of error in MS ABIReid Kleckner2019-09-111-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The first NFC change is to replace a getCXXABI().isMicrosoft() check with getTriple().isWindowsMSVCEnvironment(). This code takes effect in non-C++ compilations, so it doesn't make sense to check the C++ ABI. In the MS ABI, enums are always considered to be "complete" because the underlying type of an unfixed enum will always be 'int'. This behavior was moved from -fms-compatibility to MS ABI back in r249656. The second change is functional, and it downgrades an error to a warning when the MS ABI is used rather than only under -fms-compatibility. The reasoning is that it's unreasonable for the following code to reject the following code for all MS ABI targets with -fno-ms-compatibility: enum Foo { Foo_Val = 0xDEADBEEF }; This is valid code for any other target, but in the MS ABI, Foo_Val just happens to be negative. With this change, clang emits a -Wmicrosoft-enum-value warning on this code, but compiles it without error. Fixes PR38478 Reviewers: hans, rsmith, STL_MSFT Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67304 llvm-svn: 371581
* [OPENMP5.0]Allow teams directive outside of the target directives.Alexey Bataev2019-09-101-1/+4
| | | | | | | According to OpenMP 5.0, teams directives are allowed not only in the target context, but also in the implicit parallel regions. llvm-svn: 371553
* PR43242: Fix crash when typo-correcting to an operator() that should notRichard Smith2019-09-091-10/+1
| | | | | | have been visible. llvm-svn: 371468
* [X86] Allow _MM_FROUND_CUR_DIRECTION and _MM_FROUND_NO_EXC to be used ↵Craig Topper2019-09-091-1/+3
| | | | | | | | | | together on instructions that only support SAE and not embedded rounding. Current for SAE instructions we only allow _MM_FROUND_CUR_DIRECTION(bit 2) or _MM_FROUND_NO_EXC(bit 3) to be used as the immediate passed to the inrinsics. But these instructions don't perform rounding so _MM_FROUND_CUR_DIRECTION is just sort of a default placeholder when you don't want to suppress exceptions. Using _MM_FROUND_NO_EXC by itself is really bit equivalent to (_MM_FROUND_NO_EXC | _MM_FROUND_TO_NEAREST_INT) since _MM_FROUND_TO_NEAREST_INT is 0. Since we aren't rounding on these instructions we should also accept (_MM_FROUND_CUR_DIRECTION | _MM_FROUND_NO_EXC) as equivalent to (_MM_FROUND_NO_EXC). icc allows this, but gcc does not. Differential Revision: https://reviews.llvm.org/D67289 llvm-svn: 371430
* Merge note_ovl_builtin_candidate diagnostics; NFCSven van Haastregt2019-09-091-2/+2
| | | | | | | There is no difference between the unary and binary case, so merge them. llvm-svn: 371403
OpenPOWER on IntegriCloud