aboutsummaryrefslogtreecommitdiff
path: root/clang/lib
AgeCommit message (Collapse)AuthorFilesLines
2016-03-08Sema: Methods in unavailable classes are unavailableDuncan P. N. Exon Smith1-1/+10
Similar to the template cases in r262050, when a C++ method in an unavailable struct/class calls unavailable API, don't diagnose an error. I.e., this case was failing: void foo() __attribute__((unavailable)); struct __attribute__((unavailable)) A { void bar() { foo(); } }; Since A is unavailable, A::bar is allowed to call foo. However, we were emitting a diagnostic here. This commit checks up the context chain from A::bar, in a manner inspired by SemaDeclAttr.cpp:isDeclUnavailable. I expected to find other related issues but failed to trigger them: - I wondered if DeclBase::getAvailability should check for `TemplateDecl` instead of `FunctionTemplateDecl`, but I couldn't find a way to trigger this. I left behind a few extra tests to make sure we don't regress. - I wondered if Sema::isFunctionConsideredUnavailable should be symmetric, checking up the context chain of the callee (this commit only checks up the context chain of the caller). However, I couldn't think of a testcase that didn't require first referencing the unavailable type; this, we already diagnose. rdar://problem/25030656 llvm-svn: 262921
2016-03-08Sema: Treat 'strict' availability flag like unavailableDuncan P. N. Exon Smith2-10/+2
This is a follow-up to r261512, which made the 'strict' availability attribute flag behave like 'unavailable'. However, that fix was insufficient. The following case would (erroneously) error when the deployment target was older than 10.9: struct __attribute__((availability(macosx,strict,introduced=10.9))) A; __attribute__((availability(macosx,strict,introduced=10.9))) void f(A*); The use of A* in the argument list for f is valid here, since f and A have the same availability. The fix is to return AR_Unavailable from DeclBase::getAvailability instead of AR_NotYetIntroduced. This also reverts the special handling added in r261163, instead relying on the well-tested logic for AR_Unavailable. rdar://problem/23791325 llvm-svn: 262915
2016-03-08Add doxygen comments to bmiintrin.h's intrinsics.Ekaterina Romanova1-0/+361
The doxygen comments are automatically generated based on Sony's intrinsics document. I got an OK from Eric Christopher to commit doxygen comments without prior code review upstream. llvm-svn: 262895
2016-03-08[analyzer] Fix missed leak from MSVC specific allocation functionsAnna Zaks1-13/+23
Add the wide character strdup variants (wcsdup, _wcsdup) and the MSVC version of alloca (_alloca) and other differently named function used by the Malloc checker. A patch by Alexander Riccio! Differential Revision: http://reviews.llvm.org/D17688 llvm-svn: 262894
2016-03-08P0188R1: add support for standard [[fallthrough]] attribute. This is almostRichard Smith4-20/+61
exactly the same as clang's existing [[clang::fallthrough]] attribute, which has been updated to have the same semantics. The one significant difference is that [[fallthrough]] is ill-formed if it's not used immediately before a switch label (even when -Wimplicit-fallthrough is disabled). To support that, we now build a CFG of any function that uses a '[[fallthrough]];' statement to check. In passing, fix some bugs with our support for statement attributes -- in particular, diagnose their use on declarations, rather than asserting. llvm-svn: 262881
2016-03-07Implement support for [[nodiscard]] in C++1z that is based off existing ↵Aaron Ballman4-12/+25
support for warn_unused_result, and treat it as an extension pre-C++1z. This also means extending the existing warn_unused_result attribute so that it can be placed on an enum as well as a class. llvm-svn: 262872
2016-03-07Module Debugging: Fix a crash when emitting debug info for nested tag typesAdrian Prantl1-0/+9
whose DeclContext is not yet complete by deferring their emission. rdar://problem/24918680 llvm-svn: 262851
2016-03-07[CLANG][AVX512][BUILTIN] Add builtin vcomi{ss|sd}Michael Zuckerman1-0/+8
Differential Revision: http://reviews.llvm.org/D17919 llvm-svn: 262847
2016-03-07[ms-inline-asm][AVX512] Add ability to use k registers in MS inline asm + ↵Marina Yatsina1-0/+6
fix bag with curly braces Until now curly braces could only be used in MS inline assembly to mark block start/end. All curly braces were removed completely at a very early stage. This approach caused bugs like: "m{o}v eax, ebx" turned into "mov eax, ebx" without any error. In addition, AVX-512 added special operands (e.g., k registers), which are also surrounded by curly braces that mark them as such. Now, we need to keep the curly braces and identify at a later stage if they are marking block start/end (if so, ignore them), or surrounding special AVX-512 operands (if so, parse them as such). This patch fixes the bug described above and enables the use of AVX-512 special operands. This commit is the the clang part of the patch. The clang part of the review is: http://reviews.llvm.org/D17766 The llvm part of the review is: http://reviews.llvm.org/D17767 Differential Revision: http://reviews.llvm.org/D17766 llvm-svn: 262842
2016-03-07Implement __builtin_eh_return_data_regno for SPARC and SPARC64.Joerg Sonnenberger1-0/+6
llvm-svn: 262838
2016-03-07[CLANG][AVX512][BUILTIN] Adding new feature flag headed files and new ↵Michael Zuckerman4-0/+222
BUILTIN vpermi2varq{i|t}{128|256|512}{mask|maskz} Differential Revision: http://reviews.llvm.org/D17917 llvm-svn: 262834
2016-03-07[OPENMP] Codegen for distribute directive: fix bug in ordering of parameters.Carlo Bertolli1-1/+1
llvm-svn: 262833
2016-03-07Reapply r262741 [OPENMP] Codegen for distribute directiveCarlo Bertolli6-106/+360
This patch provide basic implementation of codegen for teams directive, excluding all clauses except dist_schedule. It also fixes parts of AST reader/writer to enable correct pre-compiled header handling. http://reviews.llvm.org/D17170 llvm-svn: 262832
2016-03-07Resolved Bug 26414.Amjad Aboud1-3/+6
https://llvm.org/bugs/show_bug.cgi?id=26414 Since interrupt handler must be returned with iret, tail call can't be used. Differential Revision: http://reviews.llvm.org/D17853 llvm-svn: 262830
2016-03-07[CLANG][AVX512][BUILTIN] Adding new feature flag header file and new builtin ↵Michael Zuckerman4-0/+247
vpmadd52{h|l}uq{128|256|512}{mask|maskz} Differential Revision: http://reviews.llvm.org/D17915 llvm-svn: 262820
2016-03-07[MS ABI] Mangle symbols names longer than 4096 characters correctlyDavid Majnemer1-42/+104
Really long symbols are hashed using MD5 and prefixed/suffixed with the usual sigils. There is an additional reason beyond the usual compatibility with MSVC, it is important to keep COFF symbols shorter than 0xFFFF because the CodeView debugging format has a maximum symbol/record size of 0xFFFF. There are some quirks worth noting: - Some mangled names reference other entities which are mangled separately. A quick example: int I; template <int *> struct S {}; S<I> s; In this case, the mangling for 's' doesn't depend directly on the mangling for 'I'. While 's' would need an MD5 hash if 'I' also needed one, the hash for 's' applied to the fully realized mangled name. In other words, the mangled name for 's' will not depend on the MD5 of the mangled name for 'I'. - Some mangled names, like the venerable CatchableType, embed the MD5 verbatim. - Finally, the complete object locator is handled as a special case. A complete object locators are mangled exactly like a VFTable except for a small deviation in the prefix sigils. However, complete object locators for hashed vftables result in a complete object locator whose name is identical to the vftable except for an additional suffix. llvm-svn: 262818
2016-03-07[CLANG][AVX512][BUILTIN] Adding vpmultishiftqb{128|256|512}Michael Zuckerman3-0/+106
Differential Revision: http://reviews.llvm.org/D17914 llvm-svn: 262817
2016-03-06[Modules] Don't swallow errors when parsing optional attributes.Davide Italiano1-3/+8
Differential Revision: http://reviews.llvm.org/D17787 llvm-svn: 262789
2016-03-05Fixed -Wdocumentation warning - typo in a parameter nameSimon Pilgrim1-1/+1
llvm-svn: 262783
2016-03-05clang-format: [JS] Support destructuring assignments in for loops.Daniel Jasper1-0/+2
Before: for (let { a, b } of x) { } After: for (let {a, b} of x) { } llvm-svn: 262776
2016-03-05[X86] AMD Bobcat CPU (btver1) doesn't support XSAVE Simon Pilgrim1-1/+0
btver1 is a SSSE3/SSE4a only CPU - it doesn't have AVX and doesn't support XSAVE. Differential Revision: http://reviews.llvm.org/D17682 llvm-svn: 262772
2016-03-05Add null check to diagnostic path for lambda captures.Richard Trieu1-2/+3
Previously, the failed capture of a variable in nested lambdas may crash when the lambda pointer is null. Only give the note if a location can be retreived from the lambda pointer. llvm-svn: 262765
2016-03-05Test commit: Fix run-on sentence in commentMike Spertus1-2/+2
llvm-svn: 262764
2016-03-05[analyzer] Nullability: add option to not report on calls to system headers.Devin Coughlin1-2/+25
Add an -analyzer-config 'nullability:NoDiagnoseCallsToSystemHeaders' option to the nullability checker. When enabled, this option causes the analyzer to not report about passing null/nullable values to functions and methods declared in system headers. This option is motivated by the observation that large projects may have many nullability warnings. These projects may find warnings about nullability annotations that they have explicitly added themselves higher priority to fix than warnings on calls to system libraries. llvm-svn: 262763
2016-03-04Update diagnostics now that hexadecimal literals look likely to be part of ↵Richard Smith2-6/+13
C++17. llvm-svn: 262753
2016-03-04PR5941 - improve diagnostic for * vs & confusion when choosing overload ↵David Blaikie1-1/+4
candidate with a parameter of incomplete (ref or pointer) type Reviewers: dblaikie Differential Revision: http://reviews.llvm.org/D16949 llvm-svn: 262752
2016-03-04clang-cl: Enable PCH flags by default.Nico Weber1-8/+0
Now that pragma comment and pragma detect_mismatch are implemented, this might just work. Some pragmas aren't serialized yet (from the top of my head: code_seg, bss_seg, data_seg, const_seg, init_seg, section, vtordisp), but these are as far as I know usually pushed and popped within the header and usually don't leak out. If it turns out the current PCH support isn't good enough yet, we can turn it off again. llvm-svn: 262749
2016-03-04Implement P0036R0: remove support for empty unary folds of +, *, |, &.Richard Smith1-15/+0
llvm-svn: 262747
2016-03-04Revert r262741 - [OPENMP] Codegen for distribute directiveSamuel Antao6-360/+106
Was causing a failure in one of the buildbot slaves. llvm-svn: 262744
2016-03-04Switch krait to use -mcpu=cortex-a15 for assembler tool invocations.Stephen Hines1-2/+2
Summary: Using -no-integrated-as causes -mcpu=krait to be transformed into -march=armv7-a today. This precludes the assembler from using instructions like sdiv, which are present for krait. Cortex-a15 is the closest subset of functionality for krait, so we should switch the assembler to use that instead. Reviewers: cfe-commits, apazos, weimingz Subscribers: aemerson Differential Revision: http://reviews.llvm.org/D17874 llvm-svn: 262742
2016-03-04[OPENMP] Codegen for distribute directiveCarlo Bertolli6-106/+360
This patch provide basic implementation of codegen for teams directive, excluding all clauses except dist_schedule. It also fixes parts of AST reader/writer to enable correct pre-compiled header handling. http://reviews.llvm.org/D17170 llvm-svn: 262741
2016-03-04Make TargetInfo store an actual DataLayout instead of a string.James Y Knight9-152/+116
Use it to calculate UserLabelPrefix, instead of specifying it (often incorrectly). Note that the *actual* user label prefix has always come from the DataLayout, and is handled within LLVM. The main thing clang's TargetInfo::UserLabelPrefix did was to set the #define value. Having these be different from each-other is just silly. Differential Revision: http://reviews.llvm.org/D17183 llvm-svn: 262737
2016-03-04[analyzer] Add diagnostic in ObjCDeallocChecker for use of -dealloc instead ↵Devin Coughlin1-32/+92
of -release. In dealloc methods, the analyzer now warns when -dealloc is called directly on a synthesized retain/copy ivar instead of -release. This is intended to find mistakes of the form: - (void)dealloc { [_ivar dealloc]; // Mistaken call to -dealloc instead of -release [super dealloc]; } rdar://problem/16227989 llvm-svn: 262729
2016-03-04Move class into anonymous namespace. NFC.Benjamin Kramer1-0/+2
llvm-svn: 262716
2016-03-04[SemaExprCXX] Avoid calling isInSystemHeader for invalid source locationsPavel Labath1-1/+2
Summary: While diagnosing a CXXNewExpr warning, we were calling isInSystemHeader(), which expect to be called with a valid source location. This causes an assertion failure if the location is unknown. A quick grep shows it's not without precedent to guard calls to the function with a "Loc.isValid()". This fixes a test failure in LLDB, which always creates object with invalid source locations as it does not (always) have access to the source. Reviewers: nlewycky Subscribers: lldb-commits, cfe-commits Differential Revision: http://reviews.llvm.org/D17847 llvm-svn: 262700
2016-03-04[OPENMP 4.0] Codegen for 'declare reduction' construct.Alexey Bataev11-20/+144
Emit function for 'combiner' part of 'declare reduction' construct and 'initialilzer' part, if any. llvm-svn: 262699
2016-03-04[Coverage] Fix the start/end locations of switch statementsVedant Kumar1-1/+1
While pushing switch statements onto the region stack we neglected to specify their start/end locations. This results in a crash (PR26825) if we end up in nested macro expansions without enough information to handle the relevant file exits. I added a test in switchmacro.c and fixed up a bunch of incorrect CHECK lines that specify strange end locations for switches. llvm-svn: 262697
2016-03-04[OPENMP] Simplify handling of clauses with postupdates, NFC.Alexey Bataev3-6/+3
Clauses with post-update expressions always have pre-init statement. So OMPClauseWithPreInit now is the base for OMPClauseWithPostUpdate. llvm-svn: 262696
2016-03-04[index] Distinguish USRs of anonymous enums by using their first enumerator.Argyrios Kyrtzidis2-6/+11
rdar://24609949. llvm-svn: 262695
2016-03-04[index] Include parameter types in the USRs for C functions marked with ↵Argyrios Kyrtzidis1-1/+2
'overloadable' attribute. llvm-svn: 262694
2016-03-04[index] In ObjC++ handle objc type parameters for function USRs.Argyrios Kyrtzidis1-0/+17
llvm-svn: 262693
2016-03-04[OpenCL] Refine pipe builtin supportXiuli Pan1-44/+52
Summary: Refine the type builtin support as the request with http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160201/148637.html Reviewers: pekka.jaaskelainen, Anastasia, yaxunl Subscribers: rsmith, cfe-commits Differential Revision: http://reviews.llvm.org/D16876 llvm-svn: 262692
2016-03-04[MIPS] initFeatureMap() to handle empty string argumentBhushan D. Attarde1-0/+2
SUMMARY: This patch sets CPU string to its default value when it is not supplied by caller. Reviewers: vkalintiris, dsanders Subscribers: mohit.bhakkad, sagar, jaydeep, cfe-commits Differential Revision: http://reviews.llvm.org/D16139 llvm-svn: 262691
2016-03-04[X86] Pass __m64 types via SSE registers for GCC compatibilityDavid Majnemer1-6/+22
For compatibility with GCC, classify __m64 as SSE. However, clang is a platform compiler for certain targets; retain our old behavior on those targets: classify __m64 as integer. This fixes PR26832. llvm-svn: 262688
2016-03-04[VFS] Switch from close to SafelyCloseFileDescriptorDavid Majnemer1-13/+3
The SafelyCloseFileDescriptor machinery does the right thing in the face of signals while close will do something platform specific which results in the FD potentially getting leaked. llvm-svn: 262687
2016-03-04[index] Ignore ObjCTypeParamDecls during indexing.Argyrios Kyrtzidis1-0/+3
llvm-svn: 262686
2016-03-03[OPENMP] firstprivate and private clauses of teams, host codegenerationCarlo Bertolli1-0/+17
Add code generation support for firstprivate and private clauses of teams on the host. Add extensive regression tests including lambda functions and vla testing. http://reviews.llvm.org/D17582 llvm-svn: 262663
2016-03-03[analyzer] ObjCDeallocChecker: Only check for nil-out when type is retainable.Devin Coughlin1-1/+5
This fixes a crash when setting a property of struct type in -dealloc. llvm-svn: 262659
2016-03-03Add code generation for teams directive inside target regionCarlo Bertolli4-9/+136
llvm-svn: 262652
2016-03-03[OpenCL] Improve diagnostics of address spaces for variables in functionAnastasia Stulova1-20/+12
- Prevent local variables to be declared in global AS - Diagnose AS of local variables with an extern storage class as if they would be in a program scope Review: http://reviews.llvm.org/D17345 llvm-svn: 262641