summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Add protocol redefinition to the current scope/contextBruno Cardoso Lopes2018-06-301-0/+5
| | | | | | | | | | | | Not doing so causes the AST writter to assert since the decl in question never gets emitted. This is fine when modules is not used, but otherwise we need to serialize something other than garbage. rdar://problem/39844933 Differential Revision: https://reviews.llvm.org/D47297 llvm-svn: 336031
* [CUDA] Make __host__/__device__ min/max overloads constexpr in C++14.Justin Lebar2018-06-291-4/+13
| | | | | | | | | | | | Summary: Tests in a separate change to the test-suite. Reviewers: rsmith, tra Subscribers: lahwaacz, sanjoy, cfe-commits Differential Revision: https://reviews.llvm.org/D48151 llvm-svn: 336026
* [CUDA] Make min/max shims host+device.Justin Lebar2018-06-291-4/+4
| | | | | | | | | | | | | | | | Summary: Fixes PR37753: min/max can't be called from __host__ __device__ functions in C++14 mode. Testcase in a separate test-suite commit. Reviewers: rsmith Subscribers: sanjoy, lahwaacz, cfe-commits Differential Revision: https://reviews.llvm.org/D48036 llvm-svn: 336025
* PR33924: merge local declarations that have linkage of some kind withinRichard Smith2018-06-292-25/+94
| | | | | | | | | | | | | | | | | | | | | merged function definitions; also merge functions with deduced return types. This seems like two independent fixes, but unfortunately they are hard to separate because it's challenging to reliably test either one of them without also testing the other. A complication arises with deduced return type support: we need the type of the function in order to know how to merge it, but we can't load the actual type of the function because it might reference an entity declared within the function (and we need to have already merged the function to correctly merge that entity, which we would need to do to determine if the function types match). So we instead compare the declared function type when merging functions, and defer loading the actual type of a function with a deduced type until we've finished loading and merging the function. llvm-svn: 336021
* [modules] Emit the type of the TypeSourceInfo for a DeclaratorDecl (butRichard Smith2018-06-294-17/+26
| | | | | | | | | | | not the corresponding location information) earlier. We need the type as written in order to properly merge functions with deduced return types, so we need to load that early. But we don't want to load the location information early, because that contains problematic things such as the function parameters. llvm-svn: 336016
* Request init/fini array on FreeBSD 12 and laterDimitry Andric2018-06-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | | Summary: It seems a bad idea to change the default in the middle of a release branch due to possible changes in global ctor / dtor ordering between .ctors and .init_array. With FreeBSD 11.0's release imminent lets change the default now for FreeBSD 12 (the current development stream) and later. FreeBSD rtld has supported .init_array / .fini_array for many years. As of Jan 1 2017 all supported FreeBSD releases and branches will have support. Reviewers: dim, brooks, arichardson Reviewed By: dim, brooks, arichardson Subscribers: bsdjhb, krytarowski, emaste, cfe-commits Differential Revision: https://reviews.llvm.org/D24867 llvm-svn: 336008
* [mips][ias] Enable IAS by default for OpenBSD / FreeBSD mips64/mips64el.Brad Smith2018-06-291-4/+6
| | | | | | | | Reviewers: atanasyan Differential Revision: https://reviews.llvm.org/D48515 llvm-svn: 336004
* [analyzer] Replace the vector of ConstraintSets by a single ConstraintSet ↵Mikhail R. Gadelha2018-06-291-15/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and a function to merge ConstraintSets Now, instead of adding the constraints when they are removed, this patch adds them when they first appear and, since we walk the bug report backward, it should be the last set of ranges generated by the CSA for a given symbol. These are the number before and after the patch: ``` Project | current | patch | tmux | 283.222 | 123.052 | redis | 614.858 | 400.347 | openssl | 308.292 | 307.149 | twin | 274.478 | 245.411 | git | 547.687 | 477.335 | postgresql | 2927.495 | 2002.526 | sqlite3 | 3264.305 | 1028.416 | ``` Major speedups in tmux and sqlite (less than half of the time), redis and postgresql were about 25% faster while the rest are basically the same. Reviewers: NoQ, george.karpenkov Reviewed By: george.karpenkov Subscribers: rnkovacs, xazax.hun, szepet, a.sidorin Differential Revision: https://reviews.llvm.org/D48565 llvm-svn: 336002
* [MachineOutliner] Make -mno-outline use -enable-machine-outliner=neverJessica Paquette2018-06-291-15/+22
| | | | | | | | This updates -mno-outline so that it passes -enable-machine-outliner=never instead of nothing. This puts it in sync with the behaviour in llc and other tools. llvm-svn: 336001
* [Fixed Point Arithmetic] Rename `-fsame-fbits` flagLeonard Chan2018-06-294-10/+6
| | | | | | | | | | | - Rename the `-fsame-fbits` flag to `-fpadding-on-unsigned-fixed-point` - Move the flag from a driver option to a cc1 option - Rename the `SameFBits` member in TargetInfo to `PaddingOnUnsignedFixedPoint` - Updated descriptions Differential Revision: https://reviews.llvm.org/D48727 llvm-svn: 335993
* [clang-format/ObjC] Fix NS_SWIFT_NAME(foo(bar:baz:)) after ObjC method declBen Hamilton2018-06-291-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In D44638, I partially fixed `NS_SWIFT_NAME(foo(bar:baz:))`-style annotations on C functions, but didn't add a test for Objective-C method declarations. For ObjC method declarations which are annotated with `NS_SWIFT_NAME(...)`, we currently fail to annotate the final component of the selector name as `TT_SelectorName`. Because the token type is left unknown, clang-format will happily cause a compilation error when it changes the following: ``` @interface Foo - (void)doStuffWithFoo:(id)name bar:(id)bar baz:(id)baz NS_SWIFT_NAME(doStuff(withFoo:bar:baz:)); @end ``` to: ``` @interface Foo - (void)doStuffWithFoo:(id)name bar:(id)bar baz:(id)baz NS_SWIFT_NAME(doStuff(withFoo:bar:baz :)); @end ``` (note the linebreak before the final `:`). The logic which decides whether or not to annotate the token before a `:` with `TT_SelectorName` is pretty fragile, and has to handle some pretty odd cases like pair-parameters: ``` [I drawRectOn:surface ofSize:aa:bbb atOrigin:cc:dd]; ``` So, to minimize the effect of this change, I decided to only annotate unknown identifiers before a `:` as `TT_SelectorName` for Objective-C declaration lines. Test Plan: New tests included. Confirmed tests failed before change and passed after change. Ran tests with: % make -j16 FormatTests && ./tools/clang/unittests/Format/FormatTests Reviewers: djasper, krasimir, jolesiak Reviewed By: krasimir Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D48679 llvm-svn: 335983
* [clang-format] Support additional common functions for text proto formattingKrasimir Georgiev2018-06-291-1/+4
| | | | | | | | | | | | | | Summary: This adds a few more common function names expecting a text proto argument. Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D48760 llvm-svn: 335978
* [ASTImporter] Added import of CXXStdInitializerListExprGabor Marton2018-06-291-0/+14
| | | | | | | | | | | | | | Reviewers: a.sidorin Reviewed By: a.sidorin Subscribers: martong, cfe-commits Differential Revision: https://reviews.llvm.org/D48631 Patch by Balazs Keri! llvm-svn: 335968
* [analyzer][UninitializedObjectChecker] Added a NotesAsWarnings flagKristof Umann2018-06-291-21/+53
| | | | | | | | | | In order to better support consumers of the plist output that don't parse note entries just yet, a 'NotesAsWarnings' flag was added. If it's set to true, all notes will be converted to warnings. Differential Revision: https://reviews.llvm.org/D48285 llvm-svn: 335964
* [X86] Remove masking from the avx512 packed sqrt builtins. Use select ↵Craig Topper2018-06-293-67/+52
| | | | | | builtins instead. llvm-svn: 335945
* [frontend] Don't include the C++ stdlib for -x assembler-with-cppAlex Lorenz2018-06-281-2/+2
| | | | | | | | | | | | | | The new C++ stdlib warning added in r335081 gets triggered when compiling an assembly file with -x assembler-with-cpp. This commit ensures that the C++ stdlib is not included when compiling assembly. In general, it's not really useful to include the C++ stdlib search path when compiling assembly source. rdar://41359632 Differential Revision: https://reviews.llvm.org/D48736 llvm-svn: 335940
* DebugInfo: Add -gno-gnu-pubnames to allow disabling gnu-pubnames later in ↵David Blaikie2018-06-281-1/+2
| | | | | | the command line llvm-svn: 335938
* [Parse] Make -Wgcc-compat complain about for loop inits in C89George Burgess IV2018-06-281-1/+3
| | | | | | | | | | While clang allows declarations in for loop init statements in c89 and gnu89, gcc does not. So, we should probably warn if users care about gcc compatibility. Differential Revision: https://reviews.llvm.org/D47840 llvm-svn: 335927
* [analyzer] Fix wrong comparison generation of the ranges generated by the ↵Mikhail R. Gadelha2018-06-281-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | refutation manager The refutation manager is removing a true bug from the test in this patch. The problem is that the following constraint: ``` (conj_$1{struct o *}) - (reg_$3<int * r>): [-9223372036854775808, 0] ``` is encoded as: ``` (and (bvuge (bvsub $1 $3) #x8000000000000000) (bvule (bvsub $1 $3) #x0000000000000000)) ``` The issue is that unsigned comparisons (bvuge and bvule) are being generated instead of signed comparisons (bvsge and bvsle). When generating the expressions: ``` (conj_$1{p *}) - (reg_$3<int * r>) >= -9223372036854775808 ``` and ``` (conj_$1{p *}) - (reg_$3<int * r>) <= 0 ``` both -9223372036854775808 and 0 are casted to pointer type and `LTy->isSignedIntegerOrEnumerationType()` in `Z3ConstraintManager::getZ3BinExpr` only checks if the type is signed, not if it's a pointer. Reviewers: NoQ, george.karpenkov, ddcc Subscribers: rnkovacs, NoQ, george.karpenkov, ddcc, xazax.hun, szepet, a.sidorin Differential Revision: https://reviews.llvm.org/D48324 llvm-svn: 335926
* PR37979: integral promotions in C++ treat enum bit-fields like enums,Richard Smith2018-06-282-1/+22
| | | | | | | | | | | | | | | | | not like bit-fields. We used to get this right "by accident", because conversions for the selected built-in overloaded operator would convert the enum bit-field to its corresponding underlying type early. But after DR1687 that no longer happens. Technically this change should also apply to C, where bit-fields only have special promotion rules if the bit-field's declared type is _Bool, int, signed int, or unsigned int, but for GCC compatibility we only look at the bit-width and not the underlying type when performing bit-field integral promotions in C. llvm-svn: 335925
* [OPENMP] Fix incomplete type check for array reductionsJoel E. Denny2018-06-281-1/+1
| | | | | | | | | | | A reduction for an incomplete array type used to produce an assert fail during codegen. Now it produces a diagnostic. Reviewed By: ABataev Differential Revision: https://reviews.llvm.org/D48735 llvm-svn: 335911
* Revert r335907: [OPENMP] Fix incomplete type check for array reductionsJoel E. Denny2018-06-281-1/+1
| | | | | | Sorry, forgot to add commit log attributes again. llvm-svn: 335910
* [OPENMP] Fix incomplete type check for array reductionsJoel E. Denny2018-06-281-1/+1
| | | | | | | A reduction for an incomplete array type used to produce an assert fail during codegen. Now it produces a diagnostic. llvm-svn: 335907
* [Darwin] Remove _VPMergeHook from the auto-export listVedant Kumar2018-06-281-1/+0
| | | | | | | | | | | Remove _VPMergeHook from Darwin's automatically-exported symbol list for PGO. As of r328987 this symbol is no longer weak. An integration test in compiler-rt will follow. rdar://41470205 llvm-svn: 335890
* [CUDA] Place all CUDA sections in __NV_CUDA segment on Mac.Artem Belevich2018-06-281-4/+6
| | | | | | | | That's where CUDA binaries appear to put them. Differential Revision: https://reviews.llvm.org/D48615 llvm-svn: 335880
* [clang-format] Do not format raw string literals inside a recognized ↵Krasimir Georgiev2018-06-281-1/+1
| | | | | | | | | | | | | | function with a non-recognized delimiter Summary: This stops clang-format from touching raw string contents with unrecognized delimiters inside recognized functions. Unrecognized delimiters signal that the string might be special. Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D48728 llvm-svn: 335876
* OpenBSD driver needs ld.lld in sanitizer contextDavid Carlier2018-06-281-1/+3
| | | | | | | | | | | | | Base GNU ld is pretty ancient and does not support --dynamic-list flag. For conveniency, we can it automatically when compile with ubsan sanitizer flag. Reviewers: dberris Reviewed by: dberris Differential Revision: https://reviews.llvm.org/D48574 llvm-svn: 335856
* [ODRHash] Do not rely on Type* when computing the hash.Vassil Vassilev2018-06-281-9/+0
| | | | | | | | | | | | | | | | | ODRHash aims to provide Cross-TU stable hashing. Making clang::Type pointer part of the hash connects (remotely) the ODRHash with the TU-specific ::Profile hasher. r332281 exposed the issue by changing the way the ASTContext different elaborated types if there is an owning tag. In that case, ODRHash stores two different types in its TypeMap which yields false ODR violation in modules. The current state of implementation shouldn't need the TypeMap concept anymore. Rip it out. Differential Revision: https://reviews.llvm.org/D48524 llvm-svn: 335853
* [Analyzer] Iterator Checker - Part 2: Increment, decrement operators and ↵Adam Balogh2018-06-281-31/+448
| | | | | | | | | | | | | ahead-of-begin checks Add handling of the begin() funcion of containers to the iterator checkers, together with the pre- and postfix ++ and -- operators of the iterators. This makes possible the checking of iterators dereferenced ahead of the begin of the container. Differential Revision: https://reviews.llvm.org/D32642 llvm-svn: 335835
* [DebugInfo] Follow-up commit to improve consistency. NFCJonas Devlieghere2018-06-282-127/+117
| | | | | | Follow-up commit for r335757 to address some inconsistencies. llvm-svn: 335834
* [Analyzer] Constraint Manager Negates DifferenceAdam Balogh2018-06-281-1/+68
| | | | | | | | If range [m .. n] is stored for symbolic expression A - B, then we can deduce the range for B - A which is [-n .. -m]. This is only true for signed types, unless the range is [0 .. 0]. Differential Revision: https://reviews.llvm.org/D35110 llvm-svn: 335814
* Support for multiarch runtimes layoutPetr Hosek2018-06-283-24/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | This change adds a support for multiarch style runtimes layout, so in addition to the existing layout where runtimes get installed to: lib/clang/$version/lib/$os Clang now allows runtimes to be installed to: lib/clang/$version/$target/lib This also includes libc++, libc++abi and libunwind; today those are assumed to be in Clang library directory built for host, with the new layout it is possible to install libc++, libc++abi and libunwind into the runtime directory built for different targets. The use of new layout is enabled by setting the LLVM_ENABLE_RUNTIME_TARGET_DIR CMake variable and is supported by both projects and runtimes layouts. The runtimes CMake build has been further modified to use the new layout when building runtimes for multiple targets. Differential Revision: https://reviews.llvm.org/D45604 llvm-svn: 335809
* [analyzer] Remove redundant ';'.Artem Dergachev2018-06-281-1/+1
| | | | | | Fixes a compiler warning. No functionan change intended. llvm-svn: 335808
* [modules] Do not serialize / deserialize pending new/delete mismatchRichard Smith2018-06-282-17/+16
| | | | | | | | | | checks across module boundaries. This was causing us to load constructor definitions for all consumers of a module with a pending check. (In one case we saw ~7% of total frontend time spent loading constructors for this check.) llvm-svn: 335807
* [modules] Ensure that an in-class function definition is attached to theRichard Smith2018-06-281-0/+13
| | | | | | | | | | | declaration of the function that ends up in the primary definition of the class. ... at least for class templates. This is necessary for us to be able to track when an inline friend function has a definition that needs to be (lazily) instantiated. llvm-svn: 335805
* [analyzer] Use sufficiently large types for index bounds calculation.Artem Dergachev2018-06-282-3/+3
| | | | | | | | | | | | | | | | | The ProgramState::assumeInBound() API is used by checkers to make an assumption that a certain array index is within the array's bounds (i.e. is greater than or equal to 0 and is less than the length of the array). When the type of the index was unspecified by the caller, it assumed that the type is 'int', which caused some indices and sizes to truncate during calculations. Use ArrayIndexTy by default instead, which is used by the analyzer to represent index types and is currently hardcoded to long long. Patch by Bevin Hansson! Differential Revision: https://reviews.llvm.org/D46944 llvm-svn: 335803
* [analyzer] Add support for pre-C++17 copy elision.Artem Dergachev2018-06-282-43/+150
| | | | | | | | | | | | | | | | r335795 adds copy elision information to CFG. This commit allows static analyzer to elide elidable copy constructors by constructing the objects that were previously subject to elidable copy directly in the target region of the copy. The chain of elided constructors may potentially be indefinitely long. This only happens when the object is being returned from a function which in turn is returned from another function, etc. NRVO is not supported yet. Differential Revision: https://reviews.llvm.org/D47671 llvm-svn: 335800
* [CFG] [analyzer] Simplify lifetime-extended temporary construction contexts.Artem Dergachev2018-06-282-8/+8
| | | | | | | | | | | | | | When a temporary object is materialized and through that obtain lifetime that is longer than the duration of the full-expression, it does not require a temporary object destructor; it will be destroyed in a different manner. Therefore it's not necessary to include CXXBindTemporaryExpr into the construction context for such temporary in the CFG only to make clients throw it away. Differential Revision: https://reviews.llvm.org/D47667 llvm-svn: 335798
* [analyzer] Re-enable lifetime extension for temporaries without destructors.Artem Dergachev2018-06-281-9/+7
| | | | | | | | | | | | | | | | When an object's class provides no destructor, it's less important to materialize that object properly because we don't have to model the destructor correctly, so previously we skipped the support for these syntax patterns. Additionally, fix support for construction contexts of "static temporaries" (temporaries that are lifetime-extended by static references) because it turned out that we only had tests for them without destructors, which caused us to regress when we re-introduced the construction context for such temporaries. Differential Revision: https://reviews.llvm.org/D47658 llvm-svn: 335796
* [CFG] [analyzer] Add construction contexts that explain pre-C++17 copy elision.Artem Dergachev2018-06-286-31/+119
| | | | | | | | | | | | | | | | Before C++17 copy elision was optional, even if the elidable copy/move constructor had arbitrary side effects. The elidable constructor is present in the AST, but marked as elidable. In these cases CFG now contains additional information that allows its clients to figure out if a temporary object is only being constructed so that to pass it to an elidable constructor. If so, it includes a reference to the elidable constructor's construction context, so that the client could elide the elidable constructor and construct the object directly at its final destination. Differential Revision: https://reviews.llvm.org/D47616 llvm-svn: 335795
* DR1687: When overload resolution selects a built-in operator, implicitRichard Smith2018-06-275-35/+104
| | | | | | | | | | | conversions are only applied to operands of class type, and the second standard conversion sequence is not applied. When diagnosing an invalid builtin binary operator, talk about the original types rather than the converted types. If these differ by a user-defined conversion, tell the user what happened. llvm-svn: 335781
* [Modules][ObjC] Warn on the use of '@import' in framework headersBruno Cardoso Lopes2018-06-271-0/+12
| | | | | | | | | | | Using @import in framework headers inhibit the use of such headers when not using modules, this is specially bad for headers that end up in the SDK (or any other system framework). Add a warning to give users some indication that this is discouraged. rdar://problem/39192894 llvm-svn: 335780
* DR1213: Ignore implicit conversions when determining if an operand of anRichard Smith2018-06-271-4/+14
| | | | | | | | array subscript expression is an array prvalue. Also apply DR1213 to vector prvalues for consistency. llvm-svn: 335779
* [HIP] Fix ordering of device-libs linkingAaron Enye Shi2018-06-271-1/+1
| | | | | | | | | | | | | | | Summary: HIP should link the bitcodes with caller functions before callee functions. Also added lit test to check the ordering of the linked bitcodes is matches. Reviewers: yaxunl, b-sumner Reviewed By: yaxunl, b-sumner Subscribers: cfe-commits, yaxunl, b-sumner, scchan Differential Revision: https://reviews.llvm.org/D48667 llvm-svn: 335774
* [HIP] Support flush denormals bitcodeAaron Enye Shi2018-06-271-1/+7
| | | | | | | | | | | | | | | Summary: Use oclc_daz_opt_on.amdgcn.bc bitcode when option fcuda-flush-denormal-to-zero is enabled, otherwise use oclc_daz_opt_off.amdgcn.bc bitcode. Added lit tests to verify that the correct bitcode is linked when -fcuda-flush-denormal-to-zero option is enabled or disabled. Reviewers: yaxunl, scchan, b-sumner Reviewed By: yaxunl, scchan, b-sumner Subscribers: cfe-commits, yaxunl Differential Revision: https://reviews.llvm.org/D48493 llvm-svn: 335765
* [CUDA] Use atexit() to call module destructor.Artem Belevich2018-06-272-3/+15
| | | | | | | | | | This matches the way NVCC does it. Doing module cleanup at global destructor phase used to work, but is, apparently, too late for the CUDA runtime in CUDA-9.2, which ends up crashing with double-free. Differential Revision: https://reviews.llvm.org/D48613 llvm-svn: 335763
* [DebugInfo] Emit ObjC methods as part of interfaceJonas Devlieghere2018-06-272-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As brought up during the discussion of the DWARF5 accelerator tables, there is currently no way to associate Objective-C methods with the interface they belong to, other than the .apple_objc accelerator table. After due consideration we came to the conclusion that it makes more sense to follow Pavel's suggestion of just emitting this information in the .debug_info section. One concern was that categories were emitted in the .apple_names as well, but it turns out that LLDB doesn't rely on the accelerator tables for this information. This patch changes the codegen behavior to emit subprograms for structure types, like we do for C++. This will result in the DW_TAG_subprogram being nested as a child under its DW_TAG_structure_type. This behavior is only enabled for DWARF5 and later, so we can have a unique code path in LLDB with regards to obtaining the class methods. This was tested on the LLDB side and doesn't lead to a regression. There's already code in place to deal with member functions in C++, which deals with this transparently. For more background please refer to the discussion on the mailing list: http://lists.llvm.org/pipermail/llvm-dev/2018-June/123986.html Differential revision: https://reviews.llvm.org/D48241 llvm-svn: 335757
* Revert "[Analyzer] Moved RangeConstraintManager to header. NFC."Mikhail R. Gadelha2018-06-271-0/+83
| | | | | | | | This broke a number of bots. This reverts commit 5e1a89912d37a21c3b49ccf30600d7f498dffa9c. llvm-svn: 335752
* [X86] Rename llvm.x86.avx512.mask.fpclass.p* to exclude 'mask.' from the ↵Craig Topper2018-06-271-6/+6
| | | | | | name to match llvm. llvm-svn: 335745
* [analyzer] Allow registering custom statically-linked analyzer checkersAlexander Kornienko2018-06-272-6/+18
| | | | | | | | | | | | | | | | | | Summary: Add an extension point to allow registration of statically-linked Clang Static Analyzer checkers that are not a part of the Clang tree. This extension point employs the mechanism used when checkers are registered from dynamically loaded plugins. Reviewers: george.karpenkov, NoQ, xazax.hun, dcoughlin Reviewed By: george.karpenkov Subscribers: mgorny, mikhail.ramalho, rnkovacs, xazax.hun, szepet, a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D45718 llvm-svn: 335740
OpenPOWER on IntegriCloud