summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* [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 llvm-svn: 308218
* [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). llvm-svn: 308198
* Enable TLS support on OpenBSD.Brad Smith2017-07-171-3/+3
| | | | llvm-svn: 308156
* 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 llvm-svn: 307371
* [Sema] Don't allow -Wunguarded-availability to be silenced with redeclsErik Pilkington2017-07-053-13/+24
| | | | | | Differential revision: https://reviews.llvm.org/D33816 llvm-svn: 307175
* [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 llvm-svn: 307051
* [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 llvm-svn: 307045
* fix trivial typos in comments; NFCHiroshi Inoue2017-07-021-1/+1
| | | | llvm-svn: 306969
* [Parse] Use normalized attr name for late-parsing checks.George Burgess IV2017-06-301-0/+4
| | | | llvm-svn: 306899
* [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 llvm-svn: 306467
* 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. llvm-svn: 306346
* [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 llvm-svn: 306297
* [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). llvm-svn: 305947
* [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 llvm-svn: 305544
* 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). llvm-svn: 305287
* 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 . llvm-svn: 305239
* 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. llvm-svn: 305233
* Revert "[clang] Implement -Wcast-qual for C++"Roman Lebedev2017-06-101-31/+0
| | | | | | Breaks -Werror builders. llvm-svn: 305148
* [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 llvm-svn: 305147
* Bringt back -triple so the test passes on non-x86.Benjamin Kramer2017-06-091-1/+1
| | | | llvm-svn: 305103
* 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) llvm-svn: 305089
* 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 llvm-svn: 304963
* 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 llvm-svn: 304705
* [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 llvm-svn: 304507
* 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 llvm-svn: 304012
* [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 llvm-svn: 303644
* [mips] Add one more check to the micromips attribute test case. NFCSimon Atanasyan2017-05-221-0/+2
| | | | llvm-svn: 303565
* [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 llvm-svn: 303546
* 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. llvm-svn: 303398
* 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 llvm-svn: 303370
* 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. llvm-svn: 303317
* [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. llvm-svn: 302941
* [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 llvm-svn: 302935
* 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 llvm-svn: 302771
* [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 llvm-svn: 302765
* [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. llvm-svn: 302506
* [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! llvm-svn: 302435
* [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 llvm-svn: 302274
* 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 llvm-svn: 302253
* 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 llvm-svn: 301968
* 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. llvm-svn: 301891
* Fix test that was incorrected merged between patches.Nick Lewycky2017-05-011-1/+1
| | | | llvm-svn: 301787
* 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. llvm-svn: 301785
* 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. llvm-svn: 301742
* 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. llvm-svn: 301522
* In the expression evaluator, descend into both the true and false ↵Nick Lewycky2017-04-271-0/+3
| | | | | | expressions of a ConditionalOperator when the condition can't be evaluated and we're in an evaluation mode that says we should continue evaluating. llvm-svn: 301520
* -Wdocumentation should not check the @returns command for Objective-CAlex Lorenz2017-04-261-0/+8
| | | | | | | | | | | | | | | | function/block pointer properties The commit r300981 allowed @param/@return commands for function/block pointer property declarations. This meant that -Wdocumentation started warning about @return that was used to document properties whose function/block type returned void. However, prior to that commit, we allowed @return for all property declarations, because it can be used to document the value that's returned by the property getter. This commit restores the previous behaviour: now the @return command can be used to document all properties without warnings. rdar://24978538 llvm-svn: 301402
* [AST] Look through attribute type locs when searching for function typeAlex Lorenz2017-04-261-1/+1
| | | | | | | | | | | | loc Prior to this commit -Wdocumentation crashed when checking the @returns command for declarations whose function/block pointer type included an attribute like _Nullable. rdar://31818195 llvm-svn: 301400
* [PR32667] -Wdocumentation should allow @param/@returns for fields/variablesAlex Lorenz2017-04-212-0/+134
| | | | | | | | | | | | | | | | that have a function/block pointer type This commit improves the -Wdocumentation warning by making sure that @param and @returns commands won't trigger warnings when used for fields, variables, or properties whose type is a function/block pointer type. The function/block pointer type must be specified directly with the declaration, and when a typedef is used the warning is still emitted. In the future we might also want to handle the std::function type as well. rdar://24978538 llvm-svn: 300981
* Add __CLANG_ATOMIC_<TYPE>_LOCK_FREE macros for use in MSVC compatibility mode.Eric Fiselier2017-04-201-0/+10
| | | | | | | | | | | | | | | | | Summary: Libc++ currently implements the `ATOMIC_<TYPE>_LOCK_FREE` macros using the `__GCC_ATOMIC_<TYPE>_LOCK_FREE` macros. However these are not available when MSVC compatibility is enabled even though C11 `_Atomic` is. This prevents libc++ from correctly implementing `ATOMIC_<TYPE>_LOCK_FREE`. This patch adds an alternative spelling `__CLANG_ATOMIC_<TYPE>_LOCK_FREE` that is enabled with `-fms-compatibility`. Reviewers: rsmith, aaron.ballman, majnemer, zturner, compnerd, jfb, rnk Reviewed By: rsmith Subscribers: BillyONeal, smeenai, jfb, cfe-commits, dschuff Differential Revision: https://reviews.llvm.org/D32265 llvm-svn: 300914
OpenPOWER on IntegriCloud