summaryrefslogtreecommitdiffstats
path: root/clang/test
Commit message (Collapse)AuthorAgeFilesLines
* CodeGen: mark ObjC cstring literals as unnamed_addrSaleem Abdulrasool2016-09-1818-79/+79
| | | | | | | | These are all emitted into a section with a cstring_literal attribute. The attribute permits the linker to coalesce the string contents. The address of the strings are not important. llvm-svn: 281855
* CodeGen: mark ObjC cstring literals as constantSaleem Abdulrasool2016-09-1818-79/+79
| | | | | | | | These strings are constants, mark them as such. This doesn't matter too much in practice on MachO since the constants are placed into a special section and not referred to directly. llvm-svn: 281854
* Fix a couple of wrong-code bugs in switch-on-constant optimization:Richard Smith2016-09-161-2/+80
| | | | | | | | | | | | * recurse through intermediate LabelStmts and AttributedStmts when checking whether a statement inside a switch declares a variable * if the end of a compound statement is reachable from the chosen case label, and the compound statement contains a variable declaration, it's not valid to just emit the contents of the compound statement -- we must emit the statement itself or we lose the scope (and thus end lifetimes at the wrong point) llvm-svn: 281797
* Add REQUIRES line.Peter Collingbourne2016-09-161-0/+2
| | | | llvm-svn: 281796
* Add target triples to fix test on non-x86.Peter Collingbourne2016-09-161-3/+3
| | | | llvm-svn: 281790
* CodeGen: Add more checks to nobuiltin.c test, add a negative test.Peter Collingbourne2016-09-161-5/+7
| | | | llvm-svn: 281785
* Introduce inline assembly parsing test is PR30372.Nirav Dave2016-09-161-0/+12
| | | | llvm-svn: 281753
* Improve handling of floating point literals in OpenCL to only use double ↵Neil Hickey2016-09-162-1/+23
| | | | | | | | precision if the target supports fp64 https://reviews.llvm.org/D24235 llvm-svn: 281714
* Testing commit rights. Removing trailing white space from test file.Neil Hickey2016-09-161-1/+1
| | | | llvm-svn: 281711
* Alter the iOS/tvOS ARM64 C++ ABI to ignore the upper half of theJohn McCall2016-09-161-0/+36
| | | | | | | | | | | | | | | | | | | | | virtual table offset in a member function pointer. We are reserving this space for future ABI use relating to alternative v-table configurations. In the meantime, continue to zero-initialize this space when actually emitting a member pointer literal. This will successfully interoperate with existing compilers. Future versions of the compiler may place additional data in this location, and at that point, code emitted by compilers prior to this patch will fail if exposed to such a member pointer. This is therefore a somewhat hard ABI break. However, because it is limited to an uncommon case of an uncommon language feature, and especially because interoperation with the standard library does not depend on member pointers, we believe that with a sufficiently advance compiler change the impact of this break will be minimal in practice. llvm-svn: 281693
* Do not warn about format strings that are indexed string literals.Stephen Hines2016-09-161-0/+35
| | | | | | | | | | | | | | | | | | | | | Summary: The warning for a format string not being a string literal and therefore being potentially insecure is overly strict for indices into string literals. This fix checks if the index into the string literal is precomputable. If that's the case it will check if the suffix of that string literal is a valid format string string literal. It will still issue the aforementioned warning for out of range indices into the string literal. Patch by Meike Baumgärtner (meikeb) Reviewers: rsmith Subscribers: srhines, cfe-commits Differential Revision: https://reviews.llvm.org/D24584 llvm-svn: 281686
* [CodeGen][ObjC] Block captures should inherit the type of the capturedAkira Hatanaka2016-09-161-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | field in the enclosing lambda or block. This patch fixes a bug in code-gen where it uses the type of the declared variable rather than the type of the capture of the enclosing lambda or block for the block capture. For example, in the following function, code-gen currently uses i32* for the block capture "a" because "a" is passed to foo1 as a reference, but it should use i32 since the enclosing lambda captures "a" by value. void foo1(int &a) { auto lambda = [a]{ auto block1 = ^{ i = a; }; block1(); }; lambda(); } rdar://problem/18586386 Differential Revision: https://reviews.llvm.org/D21104 llvm-svn: 281682
* [CUDA] Don't try to run sanitizers on NVPTX.Justin Lebar2016-09-151-0/+12
| | | | | | | | | | | | | | | | Summary: Sanitizers aren't supported on NVPTX -- don't try to run them. This lets you e.g. pass -fsanitize=address and get asan on your host code. Reviewers: kcc Subscribers: cfe-commits, tra, jhen Differential Revision: https://reviews.llvm.org/D24640 llvm-svn: 281680
* [Sema] Allow shifting a scalar operand by a vector operand.Akira Hatanaka2016-09-152-0/+213
| | | | | | | | | | | | r278501 inadvertently introduced a bug in which it disallowed shifting scalar operands by vector operands when not compiling for OpenCL. This commit fixes it. Patch by Vladimir Yakovlev. Differential Revision: https://reviews.llvm.org/D24467 llvm-svn: 281669
* Reapply: Silence false positive diagnostics regarding passing an object of ↵Aaron Ballman2016-09-151-1/+19
| | | | | | | | | | enumeration type to va_start(). The underlying type for an enumeration in C is either char, signed int, or unsigned int. In the case the underlying type is chosen to be char (such as when passing -fshort-enums or using __attribute__((packed)) on the enum declaration), the enumeration can result in undefined behavior. However, when the underlying type is signed int or unsigned int (or long long as an extension), there is no undefined behavior because the types are compatible. This patch silences diagnostics for the latter while retaining the diagnostics for the former. This patch addresses PR29140. llvm-svn: 281632
* Reverting r281609; it caused some build bots to break.Aaron Ballman2016-09-151-19/+1
| | | | | | http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/20061/steps/test/logs/stdio llvm-svn: 281612
* Silence false positive diagnostics regarding passing an object of ↵Aaron Ballman2016-09-151-1/+19
| | | | | | | | enumeration type to va_start(). The underlying type for an enumeration in C is either char, signed int, or unsigned int. In the case the underlying type is chosen to be char (such as when passing -fshort-enums or using __attribute__((packed)) on the enum declaration), the enumeration can result in undefined behavior. However, when the underlying type is signed int or unsigned int (or long long as an extension), there is no undefined behavior because the types are compatible. This patch silences diagnostics for the latter while retaining the diagnostics for the former. This patch addresses PR29140. llvm-svn: 281609
* [ARM] ARM-specific attributes should be accepted for big-endianOliver Stannard2016-09-151-0/+3
| | | | | | | | | | | | | | The ARM-specific C attributes (currently just interrupt) need to check for both the big- and little-endian versions of the triples, so that they are accepted for both big and little endian targets. TargetWindows and TargetMicrosoftCXXABI also only use the little-endian triples, but this is correct as windows is not supported on big-endian ARM targets (and this is asserted in lib/Basic/Targets.cpp). Differential Revision: https://reviews.llvm.org/D24245 llvm-svn: 281596
* Update clang unittests for rL281586.Wei Mi2016-09-156-37/+37
| | | | | | | The change in rL281586 is in llvm component and tests updated here are in clang component, so I have to commit them consecutively. llvm-svn: 281587
* [clang-cl] Accept the joined equals version of -resource-dir=Reid Kleckner2016-09-141-1/+2
| | | | | | | lib/Tooling injects this argument without regard for what driver syntax is in use. llvm-svn: 281550
* [CUDA] Add test checking our ability to take a function pointer to a ↵Justin Lebar2016-09-141-0/+31
| | | | | | | | | | | | | | __global__ function on the host side. Summary: This functionality is used by Thrust. Reviewers: tra Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D24581 llvm-svn: 281543
* Add some MS aliases for existing intrinsicsAlbert Gutowski2016-09-144-0/+79
| | | | | | | | | | Reviewers: thakis, compnerd, majnemer, rsmith, rnk Subscribers: alexshap, cfe-commits Differential Revision: https://reviews.llvm.org/D24330 llvm-svn: 281540
* Revert "Do not warn about format strings that are indexed string literals."Stephen Hines2016-09-141-35/+0
| | | | | | | | | | | | Summary: This reverts r281527 because I messed up the attribution. Reviewers: srhines Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D24579 llvm-svn: 281530
* Do not warn about format strings that are indexed string literals.Stephen Hines2016-09-141-0/+35
| | | | | | | | | | | | | | | | | | | Summary: The warning for a format string not being a sting literal and therefore being potentially insecure is overly strict for indecies into sting literals. This fix checks if the index into the string literal is precomputable. If thats the case it will check if the suffix of that sting literal is a valid format string string literal. It will still issue the aforementioned warning for out of range indecies into the string literal. Reviewers: rsmith Subscribers: srhines, cfe-commits Differential Revision: https://reviews.llvm.org/D23820 llvm-svn: 281527
* Convert finite to builtinDehao Chen2016-09-141-0/+4
| | | | | | | | | | | | Summary: This patch converts finite/__finite to builtin functions so that it will be inlined by compiler. Reviewers: hfinkel, davidxl, efriedma Subscribers: efriedma, llvm-commits Differential Revision: https://reviews.llvm.org/D24483 llvm-svn: 281509
* Revert "[modules] When merging one definition into another, propagate the ↵Eric Liu2016-09-144-11/+0
| | | | | | | | list of re-exporting modules from the discarded definition to the retained definition." This reverts commit r281429. llvm-svn: 281452
* [sanitizer-coverage] add yet another flavour of coverage instrumentation: ↵Kostya Serebryany2016-09-141-0/+8
| | | | | | trace-pc-guard. The intent is to eventually replace all of {bool coverage, 8bit-counters, trace-pc} with just this one. Clang part llvm-svn: 281432
* Follow-up to r281367: Compare uuids case-insensitively.Nico Weber2016-09-141-1/+2
| | | | llvm-svn: 281430
* [modules] When merging one definition into another, propagate the list ofRichard Smith2016-09-144-0/+11
| | | | | | re-exporting modules from the discarded definition to the retained definition. llvm-svn: 281429
* Also don't inline dllimport functions referring to non-dllimport constructors.Hans Wennborg2016-09-132-4/+8
| | | | | | | | The AST walker wasn't visiting CXXConstructExprs before. This is a follow-up to r281395. llvm-svn: 281413
* [CUDA] Do not merge CUDA target attributes.Artem Belevich2016-09-132-0/+40
| | | | | | | | | | | | CUDA target attributes are used for function overloading and must not be merged. This fixes a bug where attributes were inherited during function template specialization in CUDA and made it impossible for specialized function to provide its own target attributes. Differential Revision: https://reviews.llvm.org/D24522 llvm-svn: 281406
* [CodeGen] Fix an assert in EmitNullConstant.Akira Hatanaka2016-09-131-0/+21
| | | | | | | | | | | | | | | r235815 changed CGRecordLowering::accumulateBases to ignore non-virtual bases of size 0, which prevented adding those non-virtual bases to CGRecordLayout's NonVirtualBases. This caused clang to assert when CGRecordLayout::getNonVirtualBaseLLVMFieldNo was called in EmitNullConstant. This commit fixes the bug by ignoring zero-sized non-virtual bases in EmitNullConstant. rdar://problem/28100139 Differential Revision: https://reviews.llvm.org/D24312 llvm-svn: 281405
* Temporary fix for MS _Interlocked intrinsicsAlbert Gutowski2016-09-131-66/+0
| | | | llvm-svn: 281401
* Reverse commit 281375 (breaks building Chromium)Albert Gutowski2016-09-133-68/+0
| | | | llvm-svn: 281399
* Try harder to not inline dllimport functions referencing non-dllimport functionsHans Wennborg2016-09-132-1/+8
| | | | | | | | In r246338, code was added to check for this, but it failed to take into account implicit destructor invocations because those are not reflected in the AST. This adds a separate check for them. llvm-svn: 281395
* [SemaObjC] Be more strict while parsing type arguments and protocolsBruno Cardoso Lopes2016-09-131-0/+40
| | | | | | | | | | | | | | | | | | | | Fix a crash-on-invalid. When parsing type arguments and protocols, parseObjCTypeArgsOrProtocolQualifiers() calls ParseTypeName(), which tries to find matching tokens for '[', '(', etc whenever they appear among potential type names. If unmatched, ParseTypeName() yields a tok::eof token stream. This leads to crashes since the parsing at this point is not expected to go beyond the param list closing '>'. Fix that by properly handling tok::eof in parseObjCTypeArgsOrProtocolQualifiers() callers. Differential Revision: https://reviews.llvm.org/D23852 rdar://problem/25063557 llvm-svn: 281383
* Add bunch of _Interlocked builtinsAlbert Gutowski2016-09-132-11/+283
| | | | | | | | | | Reviewers: compnerd, thakis, Prazek, majnemer, rnk Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D24153 llvm-svn: 281378
* Add some MS aliases for existing intrinsicsAlbert Gutowski2016-09-133-0/+68
| | | | | | | | | | Reviewers: thakis, compnerd, majnemer, rsmith, rnk Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D24330 llvm-svn: 281375
* [analyzer] Fix ExprEngine::VisitMemberExprAlexander Shaposhnikov2016-09-131-0/+11
| | | | | | | | | | | AST may contain intermediate ParenExpr nodes between MemberExpr and ArrayToPointerDecay. This diff adjusts the check in ExprEngine::VisitMemberExpr accordingly. Test plan: make -j8 check-clang-analysis Differential revision: https://reviews.llvm.org/D24484 llvm-svn: 281373
* [clang-cl] Diagnose duplicate uuids.Nico Weber2016-09-131-0/+94
| | | | | | | | | | | | This mostly behaves cl.exe's behavior, even though clang-cl is stricter in some corner cases and more lenient in others (see the included test). To make the uuid declared previously here diagnostic work correctly, tweak stripTypeAttributesOffDeclSpec() to keep attributes in the right order. https://reviews.llvm.org/D24469 llvm-svn: 281367
* ObjectiveC Generics: Start using ObjCTypeParamType.Manman Ren2016-09-132-1/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | For ObjC type parameter, we used to have TypedefType that is canonicalized to id or the bound type. We can't represent "T <protocol>" and thus will lose the type information in the following example: @interface MyMutableDictionary<KeyType, ObjectType> : NSObject - (void)setObject:(ObjectType)obj forKeyedSubscript:(KeyType <NSCopying>)key; @end MyMutableDictionary<NSString *, NSString *> *stringsByString; NSNumber *n1, *n2; stringsByString[n1] = n2; --> no warning on type mismatch of the key. To fix the problem, we introduce a new type ObjCTypeParamType that supports a list of protocol qualifiers. We create ObjCTypeParamType for ObjCTypeParamDecl when we create ObjCTypeParamDecl. We also substitute ObjCTypeParamType instead of TypedefType on an ObjCTypeParamDecl. rdar://24619481 rdar://25060179 Differential Revision: http://reviews.llvm.org/D23080 llvm-svn: 281358
* AMDGPU: Fix target options fp32/64-denormalsYaxun Liu2016-09-131-2/+8
| | | | | | | | | | | | | | Fix target options for fp32/64-denormals so that +fp64-denormals is set if fp64 is supported -fp32-denormals if fp32 denormals is not supported, or -cl-denorms-are-zero is set +fp32-denormals if fp32 denormals is supported and -cl-denorms-are-zero is not set If target feature fp32/64-denormals is explicitly set, they will override default options and options deduced from -cl-denorms-are-zero. Differential Revision: https://reviews.llvm.org/D24512 llvm-svn: 281357
* Allow register variables in naked functions.Nikola Smiljanic2016-09-131-0/+18
| | | | llvm-svn: 281298
* Reapply r281276 with passing -emit-llvm in one of the testsAdam Nemet2016-09-132-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Original commit message: Add -fdiagnostics-show-hotness Summary: I've recently added the ability for optimization remarks to include the hotness of the corresponding code region. This uses PGO and allows filtering of the optimization remarks by relevance. The idea was first discussed here: http://thread.gmane.org/gmane.comp.compilers.llvm.devel/98334 The general goal is to produce a YAML file with the remarks. Then, an external tool could dynamically filter these by hotness and perhaps by other things. That said it makes sense to also expose this at the more basic level where we just include the hotness info with each optimization remark. For example, in D22694, the clang flag was pretty useful to measure the overhead of the additional analyses required to include hotness. (Without the flag we don't even run the analyses.) For the record, Hal has already expressed support for the idea of this patch on IRC. Differential Revision: https://reviews.llvm.org/D23284 llvm-svn: 281293
* Fix interaction between serialization and c++1z feature.Richard Trieu2016-09-133-0/+12
| | | | | | | | In c++1z, static_assert is not required to have a StringLiteral message, where previously it was required. Update the AST Reader to be able to handle a null StringLiteral. llvm-svn: 281286
* Update Clang for D20147 ("DebugInfo: New metadata representation for global ↵Peter Collingbourne2016-09-1326-121/+141
| | | | | | | | variables.") Differential Revision: http://reviews.llvm.org/D20415 llvm-svn: 281285
* Revert "Add -fdiagnostics-show-hotness"Adam Nemet2016-09-132-70/+0
| | | | | | | | This reverts commit r281276. Many bots are failing. llvm-svn: 281279
* [DebugInfo] Deduplicate debug info limiting logicReid Kleckner2016-09-132-4/+13
| | | | | | | | | | | | | We should be doing the same checks when a type is completed as we do when a complete type is used during emission. Previously, we duplicated the logic, and it got out of sync. This could be observed with dllimported classes. Also reduce a test case for this slightly. Implementing review feedback from David Blaikie on r281057. llvm-svn: 281278
* [Sema] Fix PR30346: relax __builtin_object_size checks.George Burgess IV2016-09-122-6/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes us act more conservatively when trying to determine the objectsize for an array at the end of an object. This is in response to code like the following: ``` struct sockaddr { /* snip */ char sa_data[14]; }; void foo(const char *s) { size_t slen = strlen(s) + 1; size_t added_len = slen <= 14 ? 0 : slen - 14; struct sockaddr *sa = malloc(sizeof(struct sockaddr) + added_len); strcpy(sa->sa_data, s); // ... } ``` `__builtin_object_size(sa->sa_data, 1)` would return 14, when there could be more than 14 bytes at `sa->sa_data`. Code like this is apparently not uncommon. FreeBSD's manual even explicitly mentions this pattern: https://www.freebsd.org/doc/en/books/developers-handbook/sockets-essential-functions.html (section 7.5.1.1.2). In light of this, we now just give up on any array at the end of an object if we can't find the object's initial allocation. I lack numbers for how much more conservative we actually become as a result of this change, so I chose the fix that would make us as compatible with GCC as possible. If we want to be more aggressive, I'm happy to consider some kind of whitelist or something instead. llvm-svn: 281277
* Add -fdiagnostics-show-hotnessAdam Nemet2016-09-122-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: I've recently added the ability for optimization remarks to include the hotness of the corresponding code region. This uses PGO and allows filtering of the optimization remarks by relevance. The idea was first discussed here: http://thread.gmane.org/gmane.comp.compilers.llvm.devel/98334 The general goal is to produce a YAML file with the remarks. Then, an external tool could dynamically filter these by hotness and perhaps by other things. That said it makes sense to also expose this at the more basic level where we just include the hotness info with each optimization remark. For example, in D22694, the clang flag was pretty useful to measure the overhead of the additional analyses required to include hotness. (Without the flag we don't even run the analyses.) For the record, Hal has already expressed support for the idea of this patch on IRC. Differential Revision: https://reviews.llvm.org/D23284 llvm-svn: 281276
OpenPOWER on IntegriCloud