summaryrefslogtreecommitdiffstats
path: root/clang/test
Commit message (Collapse)AuthorAgeFilesLines
* Add the ability to define "fake" arguments on attributes.John McCall2015-10-282-4/+4
| | | | | | | | | | | | | | Fake arguments are automatically handled for serialization, cloning, and other representational tasks, but aren't included in pretty-printing or parsing (should we eventually ever automate that). This is chiefly useful for attributes that can be written by the user, but which are also frequently synthesized by the compiler, and which we'd like to remember details of the synthesis for. As a simple example, use this to narrow the cases in which we were generating a specialized note for implicitly unavailable declarations. llvm-svn: 251469
* [analyzer] Assume escape is possible through system functions taking void*Anna Zaks2015-10-272-0/+23
| | | | | | | | | | | | | | | | | | The analyzer assumes that system functions will not free memory or modify the arguments in other ways, so we assume that arguments do not escape when those are called. However, this may lead to false positive leak errors. For example, in code like this where the pointers added to the rb_tree are freed later on: struct alarm_event *e = calloc(1, sizeof(*e)); <snip> rb_tree_insert_node(&alarm_tree, e); Add a heuristic to assume that calls to system functions taking void* arguments allow for pointer escape. llvm-svn: 251449
* Tweak how -Wunused-value interacts with macrosNico Weber2015-10-271-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Make the warning more strict in C mode. r172696 added code to suppress warnings from macro expansions in system headers, which checks `SourceMgr.isMacroBodyExpansion(E->IgnoreParens()->getExprLoc())`. Consider this snippet: #define FOO(x) (x) void f(int a) { FOO(a); } In C, the line `FOO(a)` is an `ImplicitCastExpr(ParenExpr(DeclRefExpr))`, while it's just a `ParenExpr(DeclRefExpr)` in C++. So in C++, `E->IgnoreParens()` returns the `DeclRefExpr` and the check tests the SourceLoc of `a`. In C, the `ImplicitCastExpr` has the effect of checking the SourceLoc of `FOO`, which is a macro body expansion, which causes the diagnostic to be skipped. It looks unintentional that clang does different things for C and C++ here, so use `IgnoreParenImpCasts` instead of `IgnoreParens` here. This has the effect of the warning firing more often than previously in C code – it now fires as often as it fires in C++ code. 2. Suppress the warning if it would warn on `UNREFERENCED_PARAMETER`. `UNREFERENCED_PARAMETER` is a commonly used macro on Windows and it happens to uselessly trigger -Wunused-value. As discussed in the thread "rfc: winnt.h's UNREFERENCED_PARAMETER() vs clang's -Wunused-value" on cfe-dev, fix this by special-casing this specific macro. (This costs a string comparison and some fast-path lexing per warning, but the warning is emitted rarely. It fires once in Windows.h itself, so this code runs at least once per TU including Windows.h, but it doesn't run hundreds of times.) http://reviews.llvm.org/D13969 llvm-svn: 251441
* Allow linking multiple bitcode files.Artem Belevich2015-10-273-4/+45
| | | | | | | | | | | | | | | | | | Linking options for particular file depend on the option that specifies the file. Currently there are two: * -mlink-bitcode-file links in complete content of the specified file. * -mlink-cuda-bitcode links in only the symbols needed by current TU. Linked symbols are internalized. This bitcode linking mode is used to link device-specific bitcode provided by CUDA. Files are linked in order they are specified on command line. -mlink-cuda-bitcode replaces -fcuda-uses-libdevice flag. Differential Revision: http://reviews.llvm.org/D13913 llvm-svn: 251427
* [ms-inline-asm] Test case for alignment directive change in LLVM r251418Reid Kleckner2015-10-271-0/+30
| | | | llvm-svn: 251419
* Index: expose is_mutable_fieldSaleem Abdulrasool2015-10-271-0/+6
| | | | | | | | Expose isMutable via libClang and python bindings. Patch by Jonathan B Coe! llvm-svn: 251410
* [analyzer] Fix lambdas that are capturing constants.Gabor Horvath2015-10-271-0/+15
| | | | llvm-svn: 251407
* [analyzer] Fix another crash when analyzing lambda functions.Gabor Horvath2015-10-271-0/+6
| | | | llvm-svn: 251404
* Handle target builtin options that are all required rather thanEric Christopher2015-10-271-0/+13
| | | | | | | | | | | | | | | | | only one of a group of possibilities. This changes the syntax in the builtin files to represent: , as the and operator | as the or operator The former syntax matches how the backend tablegen files represent multiple subtarget features being required. Updated the builtin and intrinsic headers accordingly for the new syntax. llvm-svn: 251388
* [coroutines] Creation of promise object, lookup of operator co_await, buildingRichard Smith2015-10-272-17/+73
| | | | | | of await_* calls, and AST representation for same. llvm-svn: 251387
* Be more conservative about diagnosing "incorrect" uses of __weak:John McCall2015-10-278-18/+72
| | | | | | | | | | | | allow them to be written in certain kinds of user declaration and diagnose on the use-site instead. Also, improve and fix some diagnostics relating to __weak and properties. rdar://23228631 llvm-svn: 251384
* MismatchingNewDeleteDetector uses incorrect field, and finds no initializerIsmail Pazarbasi2015-10-261-0/+16
| | | | | | | | | | | | | | | Summary: In `MismatchingNewDeleteDetector::analyzeInClassInitializer`, if `Field`'s initializer expression is null, lookup the field in implicit instantiation, and use found field's the initializer. Reviewers: rsmith, rtrieu Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D9898 llvm-svn: 251335
* [analyzer] Added a missing test case for r251289.Gabor Horvath2015-10-261-0/+13
| | | | llvm-svn: 251313
* [X86] Mark inregs correctly for MCU psABIMichael Kuperstein2015-10-251-0/+58
| | | | | | | | | The MCU psABI calling convention is somewhat, but not quite, like -mregparm 3. In particular, the rules involving structs are different. Differential Revision: http://reviews.llvm.org/D13978 llvm-svn: 251224
* Fixup this testcase after r251120.Adrian Prantl2015-10-231-3/+5
| | | | | | I accidentally tested r251120 with assertions disabled. llvm-svn: 251126
* [ARM] Renaming +t2dsp feature into +dsp, as discussed on llvm-devArtyom Skrobov2015-10-231-11/+11
| | | | llvm-svn: 251124
* Module Debugging: Emit module debug info for types inside of Objective-CAdrian Prantl2015-10-233-0/+15
| | | | | | | | containers. rdar://problem/23196170 llvm-svn: 251120
* Define weak and __weak to mean ARC-style weak references, even in MRC.John McCall2015-10-2211-32/+229
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, __weak was silently accepted and ignored in MRC mode. That makes this a potentially source-breaking change that we have to roll out cautiously. Accordingly, for the time being, actual support for __weak references in MRC is experimental, and the compiler will reject attempts to actually form such references. The intent is to eventually enable the feature by default in all non-GC modes. (It is, of course, incompatible with ObjC GC's interpretation of __weak.) If you like, you can enable this feature with -Xclang -fobjc-weak but like any -Xclang option, this option may be removed at any point, e.g. if/when it is eventually enabled by default. This patch also enables the use of the ARC __unsafe_unretained qualifier in MRC. Unlike __weak, this is being enabled immediately. Since variables are essentially __unsafe_unretained by default in MRC, the only practical uses are (1) communication and (2) changing the default behavior of by-value block capture. As an implementation matter, this means that the ObjC ownership qualifiers may appear in any ObjC language mode, and so this patch removes a number of checks for getLangOpts().ObjCAutoRefCount that were guarding the processing of these qualifiers. I don't expect this to be a significant drain on performance; it may even be faster to just check for these qualifiers directly on a type (since it's probably in a register anyway) than to do N dependent loads to grab the LangOptions. rdar://9674298 llvm-svn: 251041
* [MS ABI] Don't crash when inheriting from base with trailing empty array memberDavid Majnemer2015-10-221-1/+25
| | | | | | | | | | We got this right for Itanium but not MSVC because CGRecordLayoutBuilder was checking if the base's size was zero when it should have been checking the non-virtual size. This fixes PR21040. llvm-svn: 251036
* Disable trigraph and escaped newline expansion on all types of raw string ↵Craig Topper2015-10-221-0/+24
| | | | | | literals not just ASCII type. llvm-svn: 251025
* Attempt to fix build bot test failures.Gabor Horvath2015-10-221-1/+1
| | | | llvm-svn: 251014
* [analyzer] Bug identificationGabor Horvath2015-10-2232-8410/+11555
| | | | | | | | | | | | | | | | This patch adds hashes to the plist and html output to be able to identfy bugs for suppressing false positives or diff results against a baseline. This hash aims to be resilient for code evolution and is usable to identify bugs in two different snapshots of the same software. One missing piece however is a permanent unique identifier of the checker that produces the warning. Once that issue is resolved, the hashes generated are going to change. Until that point this feature is marked experimental, but it is suitable for early adoption. Differential Revision: http://reviews.llvm.org/D10305 Original patch by: Bence Babati! llvm-svn: 251011
* [MS ABI] Mangle static anonymous unionsDavid Majnemer2015-10-221-0/+9
| | | | | | | | | | | | We believed that internal linkage variables at global scope which are not variable template specializations did not have to be mangled. However, static anonymous unions have no identifier and therefore must be mangled. This fixes PR18204. llvm-svn: 250997
* [coroutines] Initial stub Sema functionality for handling coroutine await / ↵Richard Smith2015-10-221-0/+51
| | | | | | yield / return. llvm-svn: 250993
* [coroutines] Add forgotten test for lexing coroutines keywords.Richard Smith2015-10-221-0/+12
| | | | llvm-svn: 250992
* [coroutines] Add overloaded unary 'operator co_await'.Richard Smith2015-10-221-0/+14
| | | | llvm-svn: 250991
* [coroutines] Add parsing support for co_await expression, co_yield expression,Richard Smith2015-10-221-0/+21
| | | | | | co_await modifier on range-based for loop, co_return statement. llvm-svn: 250985
* [coroutines] Add feature-test macro for coroutines, defined to 1 to indicateRichard Smith2015-10-221-0/+5
| | | | | | the implementation is incomplete. llvm-svn: 250982
* Enable ARC on the fragile runtime.John McCall2015-10-211-0/+138
| | | | | | | | | | | | | | | | This is almost entirely a matter of just flipping a switch. 99% of the runtime support is available all the way back to when it was implemented in the non-fragile runtime, i.e. in Lion. However, fragile runtimes do not recognize ARC-style ivar layout strings, which means that accessing __strong or __weak ivars reflectively (e.g. via object_setIvar) will end up accessing the ivar as if it were __unsafe_unretained. Therefore, when using reflective technologies like KVC, be sure that your paths always refer to a property. rdar://23209307 llvm-svn: 250955
* [Driver] Alias -fvisibility=internal to -fvisibility=hiddenReid Kleckner2015-10-211-0/+3
| | | | | | | | | | | | | | | | | | The ELF symbol visibilities are: - internal: Not visibile across DSOs, cannot pass address across DSOs - hidden: Not visibile across DSOs, can be called indirectly - default: Usually visible across DSOs, possibly interposable - protected: Visible across DSOs, not interposable LLVM only supports the latter 3 visibilities. Internal visibility is in theory useful, as it allows you to assume that the caller is maintaining a PIC register for you in %ebx, or in some other pre-arranged location. As far as LLVM is concerned, this isn't worth the trouble. Using hidden visibility is always correct, so we can just do that. Resolves PR9183. llvm-svn: 250954
* MemorySanitizer does not require PIE.Evgeniy Stepanov2015-10-211-10/+14
| | | | | | | | | | | | | Since r249754 MemorySanitizer should work equally well for PIE and non-PIE executables on Linux/x86_64. Beware, with this change -fsanitize=memory no longer adds implicit -fPIE -pie compiler/linker flags on Linux/x86_64. This is a re-land of r250941, limited to Linux/x86_64 + a very minor refactoring in SanitizerArgs. llvm-svn: 250949
* Revert "MemorySanitizer does not require PIE."Evgeniy Stepanov2015-10-211-3/+2
| | | | | | It actually does require PIE on some targets. llvm-svn: 250944
* MemorySanitizer does not require PIE.Evgeniy Stepanov2015-10-211-2/+3
| | | | | | | | | | Since r249754 MemorySanitizer should work equally well for PIE and non-PIE executables. Beware, with this change -fsanitize=memory no longer adds implicit -fPIE -pie compiler/linker flags, unless the target defaults to PIE. llvm-svn: 250941
* Fix and stylize the emission of GC/ARC ivar and GC block layout strings.John McCall2015-10-213-2/+49
| | | | | | | | | | | | | | | Specifically, handle under-aligned object references (by explicitly ignoring them, because this just isn't representable in the format; yes, this means that GC silently ignores such references), descend into anonymous structs and unions, stop classifying fields of pointer-to-strong/weak type as strong/weak in ARC mode, and emit skips to cover the entirety of block layouts in GC mode. As a cleanup, extract this code into a helper class, avoid a number of unnecessary copies and layout queries, generate skips implicitly instead of explicitly tracking them, and clarify the bitmap-creation logic. llvm-svn: 250919
* Some minor ARC diagnostic improvements.John McCall2015-10-214-6/+16
| | | | llvm-svn: 250917
* In ARC, peephole the initialization of a __weak variable withJohn McCall2015-10-213-5/+12
| | | | | | | a value loaded from a __weak variable into a call to objc_copyWeak or objc_moveWeak. llvm-svn: 250916
* [OpenCL] Add test for program scope variable restrictions in OpenCL v2.0Anastasia Stulova2015-10-211-0/+15
| | | | | | http://reviews.llvm.org/D13105 llvm-svn: 250892
* Fix __ARM_FP value for sp-only FPUs with Half-precisionRichard Barton2015-10-212-15/+69
| | | | | | | | | The logic for parsing FP capabilities to set __ARM_FP was mistakenly removing the Half-Precision capability when handling fp-only-sp resulting in a value of 0x4. Section 6.5.1 of ACLE states that for such FP architectures the value should be 0x6 llvm-svn: 250888
* [modules] libstdc++ defines some static inline functions in its internalRichard Smith2015-10-216-0/+28
| | | | | | | | | | | headers. If those headers end up being textually included twice into the same module, we get ambiguity errors. Work around this by downgrading the ambiguity error to a warning if multiple identical internal-linkage functions appear in an overload set, and just pick one of those functions as the lookup result. llvm-svn: 250884
* Revert r247977, "clang/test/lit.cfg: *-ps4 doesn't have appropriate driver ↵NAKAMURA Takumi2015-10-201-1/+1
| | | | | | | | yet. Mark it as "non-clang-driver"." They, "tests requiring clang-driver", should work in trunk since ps4 driver has been introduced. llvm-svn: 250866
* Re-land r250592 without rejecting field refs in unevaluated contextsReid Kleckner2015-10-201-1/+64
| | | | | | | | | | | This time, I went with the first approach from http://reviews.llvm.org/D6700, where clang actually attempts to form an implicit member reference from an UnresolvedLookupExpr. We know that there are only two possible outcomes at this point, a DeclRefExpr of the FieldDecl or an error, but its safer to reuse the existing machinery for this. llvm-svn: 250856
* [-fms-extensions] Allow missing exception specifications in redeclarations ↵David Majnemer2015-10-201-0/+8
| | | | | | | | | | | as an extension Microsoft's ATL headers make use of this MSVC extension, add support for it and issue a diagnostic under -Wmicrosoft-exception-spec. This fixes PR25265. llvm-svn: 250854
* Add back null check removed accidentally in r250554Reid Kleckner2015-10-201-0/+3
| | | | | | Fixes PR25262 llvm-svn: 250844
* Look through using decls when classifying implicit member accessReid Kleckner2015-10-201-0/+13
| | | | | | | | | | | | | | | | | | | | | Clang will now accept this valid C++11 code: struct A { int field; }; struct B : A { using A::field; enum { TheSize = sizeof(field) }; }; Previously we would classify the 'field' reference as something other than a field, and then forget to apply the C++11 rule to allow non-static data member references in unevaluated contexts. This usually arises in class templates that want to reference fields of a dependent base in an unevaluated context outside of an instance method. Such contexts do not allow references to 'this', so the only way to access the field is with a using decl and an implicit member reference. llvm-svn: 250839
* [x86] Fix maskload/store intrinsic definitions in avxintrin.hAndrea Di Biagio2015-10-201-8/+8
| | | | | | | | | | | | | According to the Intel documentation, the mask operand of a maskload and maskstore intrinsics is always a vector of packed integer/long integer values. This patch introduces the following two changes: 1. It fixes the avx maskload/store intrinsic definitions in avxintrin.h. 2. It changes BuiltinsX86.def to match the correct gcc definitions for avx maskload/store (see D13861 for more details). Differential Revision: http://reviews.llvm.org/D13861 llvm-svn: 250816
* [DEBUG INFO] Emit debug info for type used in explicit cast only.Alexey Bataev2015-10-201-0/+46
| | | | | | | Currently debug info for types used in explicit cast only is not emitted. It happened after a patch for better alignment handling. This patch fixes this bug. Differential Revision: http://reviews.llvm.org/D13582 llvm-svn: 250795
* Revert "Diagnose UnresolvedLookupExprs that resolve to instance members in ↵Reid Kleckner2015-10-201-50/+1
| | | | | | | | | | | | | | | | | static methods" This reverts commit r250592. It has issues around unevaluated contexts, like this: template <class T> struct A { T i; }; template <class T> struct B : A<T> { using A<T>::i; typedef decltype(i) U; }; template struct B<int>; llvm-svn: 250774
* [MS ABI] Give linkonce_odr, instead of external_linkage, to certain kinds of ↵David Majnemer2015-10-192-8/+8
| | | | | | | | | | | | | | | | | static data members Out-of-line definitions of static data members which have an inline initializer must get GVA_DiscardableODR linkage instead of GVA_StrongExternal linkage. MSVC 2013's behavior is different with respect to this and would cause link errors if one TU provided a definition while another did not. MSVC 2015 fixed this bug, making this OK. Note that the 2015 behavior is always compatible with 2013: it never produces a strong definition. This essentially reverts r237787. llvm-svn: 250757
* clang-format: Use pipes instead of temporary files for most lit tests.Nico Weber2015-10-199-34/+31
| | | | | | | | | | | | | | | This makes the format tests look more like most other FileCheck tests in clang. The multiple-inputs tests still use temp files, to make sure that the file input code in clang-format stays tested. Stop stripping out the comment lines in style-on-command-line.cpp as they don't get in the way and it makes the test simpler. Also remove 2>&1s on the tests in that file that don't need it. http://reviews.llvm.org/D13852 llvm-svn: 250706
* Make test not rely on %T ending on /Output.Manuel Klimek2015-10-191-9/+9
| | | | llvm-svn: 250690
OpenPOWER on IntegriCloud