summaryrefslogtreecommitdiffstats
path: root/test/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Merging r309722:Hans Wennborg2017-08-011-0/+8
| | | | | | | | | | | | | | | | | ------------------------------------------------------------------------ r309722 | bruno | 2017-08-01 12:05:25 -0700 (Tue, 01 Aug 2017) | 7 lines [Sema] Fix lax conversion between non ext vectors r282968 introduced a regression due to the lack of proper testing. Re-add lax conversion support between non ext vectors for compound assignments and add a test for that. rdar://problem/28639467 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_50@309770 91177308-0d34-0410-b5e6-96231b3b80d8
* Merging r308455:Hans Wennborg2017-07-194-78/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | ------------------------------------------------------------------------ r308455 | hans | 2017-07-19 05:31:01 -0700 (Wed, 19 Jul 2017) | 16 lines Revert r308441 "Recommit r308327: Add a warning for missing '#pragma pack (pop)' and suspicious uses of '#pragma pack' in included files" This seems to have broken the sanitizer-x86_64-linux buildbot. Reverting until it's fixed, especially since this landed just before the 5.0 branch. > This commit adds a new -Wpragma-pack warning. It warns in the following cases: > > - When a translation unit is missing terminating #pragma pack (pop) directives. > - When entering an included file if the current alignment value as determined > by '#pragma pack' directives is different from the default alignment value. > - When leaving an included file that changed the state of the current alignment > value. > > rdar://10184173 > > Differential Revision: https://reviews.llvm.org/D35484 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_50@308457 91177308-0d34-0410-b5e6-96231b3b80d8
* Recommit r308327: Add a warning for missing '#pragma pack (pop)'Alex Lorenz2017-07-194-0/+78
| | | | | | | | | | | | | | | | | | | and suspicious uses of '#pragma pack' in included files This commit adds a new -Wpragma-pack warning. It warns in the following cases: - When a translation unit is missing terminating #pragma pack (pop) directives. - When entering an included file if the current alignment value as determined by '#pragma pack' directives is different from the default alignment value. - When leaving an included file that changed the state of the current alignment value. rdar://10184173 Differential Revision: https://reviews.llvm.org/D35484 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308441 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r308327Alex Lorenz2017-07-184-78/+0
| | | | | | | I forgot to test clang-tools-extra which is now failing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308328 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a warning for missing '#pragma pack (pop)' and suspicious usesAlex Lorenz2017-07-184-0/+78
| | | | | | | | | | | | | | | | | | | of '#pragma pack' in included files This commit adds a new -Wpragma-pack warning. It warns in the following cases: - When a translation unit is missing terminating #pragma pack (pop) directives. - When entering an included file if the current alignment value as determined by '#pragma pack' directives is different from the default alignment value. - When leaving an included file that changed the state of the current alignment value. rdar://10184173 Differential Revision: https://reviews.llvm.org/D35484 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308327 91177308-0d34-0410-b5e6-96231b3b80d8
* [AArch64] Add support for __builtin_ms_va_list on aarch64Martin Storsjo2017-07-172-1/+12
| | | | | | | | | | | Move builtins from the x86 specific scope into the global scope. Their use is still limited to x86_64 and aarch64 though. This allows wine on aarch64 to properly handle variadic functions. Differential Revision: https://reviews.llvm.org/D34475 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308218 91177308-0d34-0410-b5e6-96231b3b80d8
* [SystemZ] Add support for IBM z14 processor (2/3)Ulrich Weigand2017-07-171-0/+211
| | | | | | | | | | | | This patch extends the -fzvector language feature to enable the new "vector float" data type when compiling at -march=z14. This matches the updated extension definition implemented by other compilers for the platform, which is indicated to applications by pre-defining __VEC__ to 10302 (instead of 10301). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308198 91177308-0d34-0410-b5e6-96231b3b80d8
* Enable TLS support on OpenBSD.Brad Smith2017-07-171-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308156 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix crash parsing invalid codeOlivier Goffart2017-07-071-0/+9
| | | | | | | | | | | | | | | | | | | | | The code in the test caused a crash with this backtrace: RecordLayoutBuilder.cpp:2934: const clang::ASTRecordLayout &clang::ASTContext::getASTRecordLayout(const clang::RecordDecl *) const: Assertion `!D->isInvalidDecl() && "Cannot get layout of invalid decl!"' failed. [...] #7 0x00007f63963d845a __assert_fail_base (/usr/lib/libc.so.6+0x2c45a) #8 0x00007f63963d84d2 (/usr/lib/libc.so.6+0x2c4d2) #9 0x00007f63937a0631 clang::ASTContext::getASTRecordLayout(clang::RecordDecl const*) const /home/olivier/prog/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp:2935:3 #10 0x00007f63937a1ad5 getFieldOffset(clang::ASTContext const&, clang::FieldDecl const*) /home/olivier/prog/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp:3057:37 #11 0x00007f6391869f14 clang::Sema::RefersToMemberWithReducedAlignment(clang::Expr*, llvm::function_ref<void (clang::Expr*, clang::RecordDecl*, clang::FieldDecl*, clang::CharUnits)>) /home/olivier/prog/llvm/tools/clang/lib/Sema/SemaChecking.cpp:12139:23 #12 0x00007f639186a2f8 clang::Sema::CheckAddressOfPackedMember(clang::Expr*) /home/olivier/prog/llvm/tools/clang/lib/Sema/SemaChecking.cpp:12190:1 #13 0x00007f6391a7a81c clang::Sema::CheckAddressOfOperand(clang::ActionResult<clang::Expr*, true>&, clang::SourceLocation) /home/olivier/prog/llvm/tools/clang/lib/Sema/SemaExpr.cpp:11111:10 #14 0x00007f6391a7f5d2 clang::Sema::CreateBuiltinUnaryOp(clang::SourceLocation, clang::UnaryOperatorKind, clang::Expr*) /home/olivier/prog/llvm/tools/clang/lib/Sema/SemaExpr.cpp:11932:18 Fixing by bailing out for invalid classes. Differential Revision: https://reviews.llvm.org/D35108 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307371 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Don't allow -Wunguarded-availability to be silenced with redeclsErik Pilkington2017-07-053-13/+24
| | | | | | Differential revision: https://reviews.llvm.org/D33816 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307175 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Make BreakContinueFinder handle nested loops.Eli Friedman2017-07-041-0/+48
| | | | | | | | | | | | | | We don't care about break or continue statements that aren't associated with the current loop, so make sure the visitor doesn't find them. Fixes https://bugs.llvm.org/show_bug.cgi?id=32648 . Differential Revision: https://reviews.llvm.org/D34568 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307051 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang] Implement -Wcast-qual for C++Roman Lebedev2017-07-031-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This way, the behavior of that warning flag more closely resembles that of GCC. Do note that there is at least one false-negative (see FIXME in tests). Fixes PR4802. Testing: ``` ninja check-clang-sema check-clang-semacxx ``` Reviewers: dblaikie, majnemer, rnk Reviewed By: dblaikie, rnk Subscribers: mclow.lists, cfe-commits, alexfh, rnk Differential Revision: https://reviews.llvm.org/D33102 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307045 91177308-0d34-0410-b5e6-96231b3b80d8
* fix trivial typos in comments; NFCHiroshi Inoue2017-07-021-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306969 91177308-0d34-0410-b5e6-96231b3b80d8
* [Parse] Use normalized attr name for late-parsing checks.George Burgess IV2017-06-301-0/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306899 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Allow unmarked overloadable functions.George Burgess IV2017-06-271-9/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch extends the `overloadable` attribute to allow for one function with a given name to not be marked with the `overloadable` attribute. The overload without the `overloadable` attribute will not have its name mangled. So, the following code is now legal: void foo(void) __attribute__((overloadable)); void foo(int); void foo(float) __attribute__((overloadable)); In addition, this patch fixes a bug where we'd accept code with `__attribute__((overloadable))` inconsistently applied. In other words, we used to accept: void foo(void); void foo(void) __attribute__((overloadable)); But we will do this no longer, since it defeats the original purpose of requiring `__attribute__((overloadable))` on all redeclarations of a function. This breakage seems to not be an issue in practice, since the only code I could find that had this pattern often looked like: void foo(void); void foo(void) __attribute__((overloadable)) __asm__("foo"); void foo(int) __attribute__((overloadable)); ...Which can now be simplified by simply removing the asm label and overloadable attribute from the redeclaration of `void foo(void);` Differential Revision: https://reviews.llvm.org/D32332 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306467 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r301742, which caused us to try to evaluate all full-expressions.Richard Smith2017-06-261-7/+1
| | | | | | | | | | | | | | | Also add testcases for a bunch of expression forms that cause our evaluator to crash. See PR33140 and PR32864 for crashes that this was causing. This reverts r305287, which reverted r305239, which reverted r301742. The previous revert claimed that buildbots were broken, but did not add any testcases and the buildbots have lost all memory of what was wrong here. Changes to test/OpenMP are not reverted; another change has triggered those tests to change their output in the same way that r301742 did. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306346 91177308-0d34-0410-b5e6-96231b3b80d8
* [inline asm][gcc-compatiblity] "=i" output constraint supportMarina Yatsina2017-06-261-0/+35
| | | | | | | | | | Ignore ‘i’,’n’,’E’,’F’ as output constraints in inline assembly (gcc compatibility) Differential Revision: https://reviews.llvm.org/D31383 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306297 91177308-0d34-0410-b5e6-96231b3b80d8
* [test] Make absolute line numbers relative; NFCGeorge Burgess IV2017-06-211-10/+10
| | | | | | | | Done to remove noise from https://reviews.llvm.org/D32332 (and to make this test more resilient to changes in general). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305947 91177308-0d34-0410-b5e6-96231b3b80d8
* [XRay][clang] Support capturing the implicit `this` argument to C++ class ↵Dean Michael Berris2017-06-161-0/+7
| | | | | | | | | | | | | | | | | | member functions Summary: Before this change, we couldn't capture the `this` pointer that's implicitly the first argument of class member functions. There are some interesting things we can do with capturing even just this single argument for zero-argument member functions. Reviewers: rnk, pelikan Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D34052 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305544 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Revert r301742 which made ExprConstant checking apply to all ↵Diana Picus2017-06-131-1/+7
| | | | | | | | | full-exprs." This reverts commit r305239 because it broke the buildbots (the diag-flags.cpp test is failing). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305287 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r301742 which made ExprConstant checking apply to all full-exprs.Nick Lewycky2017-06-121-7/+1
| | | | | | | This patch also exposed pre-existing bugs in clang, see PR32864 and PR33140#c3 . git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305239 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r303316, a change to ExprConstant to evaluate function arguments.Nick Lewycky2017-06-121-8/+0
| | | | | | | The patch was itself correct but it uncovered other bugs which are going to be difficult to fix, per PR33140. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305233 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[clang] Implement -Wcast-qual for C++"Roman Lebedev2017-06-101-31/+0
| | | | | | Breaks -Werror builders. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305148 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang] Implement -Wcast-qual for C++Roman Lebedev2017-06-101-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This way, the behavior of that warning flag more closely resembles that of GCC. Do note that there is at least one false-negative (see FIXME in tests). Fixes PR4802. Testing: ``` ninja check-clang-sema check-clang-semacxx ``` Reviewers: dblaikie, majnemer, rnk Reviewed By: dblaikie, rnk Subscribers: cfe-commits, alexfh, rnk Differential Revision: https://reviews.llvm.org/D33102 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305147 91177308-0d34-0410-b5e6-96231b3b80d8
* Bringt back -triple so the test passes on non-x86.Benjamin Kramer2017-06-091-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305103 91177308-0d34-0410-b5e6-96231b3b80d8
* Repair 2010-05-31-palignr.c testVassil Vassilev2017-06-091-5/+3
| | | | | | | | | | | | | | | | | | | | | This test was silently failing since a long time because it failed to include stdlib.h (as it's running in a freestanding environment). However, because we used just not clang_cc1 instead of the verify mode, this regression was never noticed and the test was just always passing. This adds -ffreestanding to the invocation, so that tmmintrin.h doesn't indirectly include mm_malloc.h, which in turns includes the unavailable stdlib.h. We also run now in the -verify mode to prevent that we silently regress again. I've also updated the test to no longer check the return value of _mm_alignr_epi8 as this is also causing it to fail (and it's not really the job of this test to test this). Patch by Raphael Isemann (D34022) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305089 91177308-0d34-0410-b5e6-96231b3b80d8
* Catch invalid bitwise operation on vector of floatsSerge Pavlov2017-06-081-0/+27
| | | | | | | | | | | | | Bitwise complement applied to vector of floats described with attribute `ext_vector_type` is not diagnosed as error. Attempt to compile such construct causes assertion violation in Instruction.cpp. With this change the complement is treated similar to the case of vector type described with attribute `vector_size`. Differential Revision: https://reviews.llvm.org/D33732 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304963 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for #pragma clang sectionJaved Absar2017-06-051-0/+17
| | | | | | | | | | | | | | | | | This patch provides a means to specify section-names for global variables, functions and static variables, using #pragma directives. This feature is only defined to work sensibly for ELF targets. One can specify section names as: #pragma clang section bss="myBSS" data="myData" rodata="myRodata" text="myText" One can "unspecify" a section name with empty string e.g. #pragma clang section bss="" data="" text="" rodata="" Reviewers: Roger Ferrer, Jonathan Roelofs, Reid Kleckner Differential Revision: https://reviews.llvm.org/D33412 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304705 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Improve -Wstrict-prototypes diagnostic message for blocks.Akira Hatanaka2017-06-021-3/+8
| | | | | | | | | | | Print "this block declaration is not a prototype" for non-prototype declarations of blocks instead of "this function declaration ...". rdar://problem/32461723 Differential Revision: https://reviews.llvm.org/D33739 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304507 91177308-0d34-0410-b5e6-96231b3b80d8
* Enable __float128 for mingw for GCC compatibility and define ↵Reid Kleckner2017-05-261-3/+7
| | | | | | | | | | | | __SIZEOF_FLOAT128__ on x86 GCC defines __FLOAT128__ on Power and __SIZEOF_FLOAT128__ on x86. We're just following the inconsistency for now so users have some way to test. Effectively merges this patch as requested by Martell Malone: https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-clang/0107-enable-__float128-for-X86-MinGW.patch git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304012 91177308-0d34-0410-b5e6-96231b3b80d8
* [AMDGPU] Do not require opencl triple environment for OpenCLYaxun Liu2017-05-231-0/+1
| | | | | | | | | | | | | A recent change requires opencl triple environment for compiling OpenCL program, which causes regressions in libclc. This patch fixes that. Instead of deducing language based on triple environment, it checks LangOptions. Differential Revision: https://reviews.llvm.org/D33445 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303644 91177308-0d34-0410-b5e6-96231b3b80d8
* [mips] Add one more check to the micromips attribute test case. NFCSimon Atanasyan2017-05-221-0/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303565 91177308-0d34-0410-b5e6-96231b3b80d8
* [mips] Support `micromips` attributeSimon Atanasyan2017-05-221-0/+15
| | | | | | | | | This patch adds support for the `micromips` and `nomicromips` attributes for MIPS targets. Differential revision: https://reviews.llvm.org/D33363 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303546 91177308-0d34-0410-b5e6-96231b3b80d8
* When a type-id is unexpectedly given a name, assume that the name is unrelatedRichard Smith2017-05-191-1/+1
| | | | | | | | | syntax unless we have a reason to think otherwise. This improves error recovery in a couple of cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303398 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: Cast alloca to expected address spaceYaxun Liu2017-05-181-1/+1
| | | | | | | | | | | | Alloca always returns a pointer in alloca address space, which may be different from the type defined by the language. For example, in C++ the auto variables are in the default address space. Therefore cast alloca to the expected address space when necessary. Differential Revision: https://reviews.llvm.org/D32248 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303370 91177308-0d34-0410-b5e6-96231b3b80d8
* The constant expression evaluator should examine function arguments for ↵Nick Lewycky2017-05-171-0/+8
| | | | | | non-constexpr function calls unless the EvalInfo says to stop. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303317 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Silence buildbot failures introduced by r302935Simon Dardis2017-05-122-2/+2
| | | | | | | | | Attempt to silence buildbot failures by pinning the test to a given triple rather than the host's triple. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302941 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Support implicit scalar to vector conversionsSimon Dardis2017-05-125-85/+742
| | | | | | | | | | | | | | | | | | | | This patch teaches clang to perform implicit scalar to vector conversions when one of the operands of a binary vector expression is a scalar which can be converted to the element type of the vector without truncation following GCC's implementation. If the (constant) scalar is can be casted safely, it is implicitly casted to the vector elements type and splatted to produce a vector of the same type. Contributions from: Petar Jovanovic Reviewers: bruno, vkalintiris Differential Revision: https://reviews.llvm.org/D25866 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302935 91177308-0d34-0410-b5e6-96231b3b80d8
* Make tests from r302765 windows friendlyBruno Cardoso Lopes2017-05-111-2/+2
| | | | | | | and appease: http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/2030 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302771 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Improve redefinition errors pointing to the same headerBruno Cardoso Lopes2017-05-111-0/+14
| | | | | | | | | | | | | | | | | | Diagnostics related to redefinition errors that point to the same header file do not provide much information that helps users fixing the issue. - In the modules context, it usually happens because of non modular includes. - When modules aren't involved it might happen because of the lack of header guards. Enhance diagnostics in these scenarios. Differential Revision: https://reviews.llvm.org/D28832 rdar://problem/31669175 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302765 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Make typeof(OverloadedFunctionName) not a pointer.George Burgess IV2017-05-091-0/+15
| | | | | | | | | | | | | | | | | We were sometimes doing a function->pointer conversion in Sema::CheckPlaceholderExpr, which isn't the job of CheckPlaceholderExpr. So, when we saw typeof(OverloadedFunctionName), where OverloadedFunctionName referenced a name with only one function that could have its address taken, we'd give back a function pointer type instead of a function type. This is incorrect. I kept the logic for doing the function pointer conversion in resolveAndFixAddressOfOnlyViableOverloadCandidate because it was more consistent with existing ResolveAndFix* methods. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302506 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Fix typos handling in an overloadable call.Anastasia Stulova2017-05-081-0/+7
| | | | | | | | | | | | | | | | | | In C typos in arguments in a call of an overloadable function lead to a failure of construction of CallExpr and following recovery does not handle created delayed typos. This causes an assertion fail in Sema::~Sema since Sema::DelayedTypos remains not empty. The patch fixes that behavior by handling a call with arguments having dependant types in the way that C++ does. Differential Revision: https://reviews.llvm.org/D31764 Patch by Dmitry Borisenkov! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302435 91177308-0d34-0410-b5e6-96231b3b80d8
* [ARM] Limit the diagnose when an ISR calls a regular functionWeiming Zhao2017-05-051-4/+18
| | | | | | | | | | | | | | | | Summary: When the function is compiled with soft-float or on CPU with no FPU, we don't need to diagnose for a call from an ISR to a regular function. Reviewers: jroelofs, eli.friedman Reviewed By: jroelofs Subscribers: aemerson, rengolin, javed.absar, cfe-commits Differential Revision: https://reviews.llvm.org/D32918 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302274 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a fix-it for -Wunguarded-availabilityAlex Lorenz2017-05-051-1/+1
| | | | | | | | | | | | | | This patch adds a fix-it for the -Wunguarded-availability warning. This fix-it is similar to the Swift one: it suggests that you wrap the statement in an `if (@available)` check. The produced fixits are indented (just like the Swift ones) to make them look nice in Xcode's fix-it preview. rdar://31680358 Differential Revision: https://reviews.llvm.org/D32424 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302253 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify some va_start checking logicReid Kleckner2017-05-021-1/+1
| | | | | | | | | | | | | | | Combine the logic doing the ms_abi/sysv_abi checks into one function so that each check and its logical opposite are near each other. Now we don't need two Sema entry points for MS va_start and regular va_start. Refactor the code that checks if the va_start caller is a function, block, or obj-c method. We do this in three places, and they are all buggy for variadic lambdas (PR32737). After this change, I have one place to apply the functional fix. NFC git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301968 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r301785 (and r301787) because they caused PR32864.Nick Lewycky2017-05-021-4/+4
| | | | | | | The fix is that ExprEvaluatorBase::VisitInitListExpr should handle transparent exprs instead of exprs with one element. Fixing that uncovers one testcase failure because the AST for "constexpr _Complex float test2 = {1};" is wrong (the _Complex prvalue should not be const-qualified), and a number of test failures in test/OpenMP where the captured stmt contains an InitListExpr that is in syntactic form. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301891 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix test that was incorrected merged between patches.Nick Lewycky2017-05-011-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301787 91177308-0d34-0410-b5e6-96231b3b80d8
* Handle expressions with non-literal types like ignored expressions if we are ↵Nick Lewycky2017-05-011-4/+4
| | | | | | | | | supposed to continue evaluating them. Also fix a crash casting a derived nullptr to a virtual base. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301785 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove Sema::CheckForIntOverflow, and instead check all full-expressions.Nick Lewycky2017-04-291-1/+7
| | | | | | | | | CheckForIntOverflow used to implement a whitelist of top-level expressions to send to the constant expression evaluator, which handled many more expressions than the CheckForIntOverflow whitelist did. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301742 91177308-0d34-0410-b5e6-96231b3b80d8
* In the expression evaluator, visit the index of an ArraySubscriptExpr even ↵Nick Lewycky2017-04-271-0/+4
| | | | | | if we can't evaluate the base, if the evaluation mode tells us to continue evaluation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301522 91177308-0d34-0410-b5e6-96231b3b80d8