summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Fixes issue introduced by r331556.Alexander Kornienko2018-05-091-3/+5
| | | | | | | | | | Closes bug: https://bugs.llvm.org/show_bug.cgi?id=37357 Patch by Rafael Stahl! Differential revision: https://reviews.llvm.org/D46633 llvm-svn: 331870
* Revert r331843 "[DebugInfo] Generate debug information for labels."Hans Wennborg2018-05-093-39/+0
| | | | | | | | | | | | | | | | It broke the Chromium build (see reply on the review). > Generate DILabel metadata and call llvm.dbg.label after label > statement to associate the metadata with the label. > > Differential Revision: https://reviews.llvm.org/D45045 > > Patch by Hsiangkai Wang. This doesn't revert the change to backend-unsupported-error.ll that seems to correspond to an llvm-side change. llvm-svn: 331861
* Revert "[Driver] Use -fuse-line-directives by default in MSVC mode"Martin Storsjo2018-05-091-2/+2
| | | | | | | | | | | | This reverts commit SVN r331666. It was afterwards pointed out in https://reviews.llvm.org/D46520 that #line directives lose information about what parts come from a system header. That means the result of -E usually won't compile, since Windows headers are typically full of warnings and default-error warnings. llvm-svn: 331858
* [clang-format] Respect BreakBeforeClosingBrace while calculating lengthKrasimir Georgiev2018-05-093-20/+87
| | | | | | | | | | | | | | | | | | Summary: This patch makes `getLengthToMatchingParen` respect the `BreakBeforeClosingBrace` ParenState for matching scope closers. In order to distinguish between paren states introduced by real vs. fake parens, I've added the token opening the ParensState to that struct. Reviewers: djasper Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D46519 llvm-svn: 331857
* _Atomic of empty struct shouldn't assertJF Bastien2018-05-091-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: An _Atomic of an empty struct is pretty silly. In general we just widen empty structs to hold a byte's worth of storage, and we represent size and alignment as 0 internally and let LLVM figure out what to do. For _Atomic it's a bit different: the memory model mandates concrete effects occur when atomic operations occur, so in most cases actual instructions need to get emitted. It's really not worth trying to optimize empty struct atomics by figuring out e.g. that a fence would do, even though sane compilers should do optimize atomics. Further, wg21.link/p0528 will fix C++20 atomics with padding bits so that cmpxchg on them works, which means that we'll likely need to do the zero-init song and dance for empty atomic structs anyways (and I think we shouldn't special-case this behavior to C++20 because prior standards are just broken). This patch therefore makes a minor change to r176658 "Promote atomic type sizes up to a power of two": if the width of the atomic's value type is 0, just use 1 byte for width and leave alignment as-is (since it should never be zero, and over-aligned zero-width structs are weird but fine). This fixes an assertion: (NumBits >= MIN_INT_BITS && "bitwidth too small"), function get, file ../lib/IR/Type.cpp, line 241. It seems like this has run into other assertions before (namely the unreachable Kind check in ImpCastExprToType), but I haven't reproduced that issue with tip-of-tree. <rdar://problem/39678063> Reviewers: arphaman, rjmccall Subscribers: aheejin, cfe-commits Differential Revision: https://reviews.llvm.org/D46613 llvm-svn: 331845
* [DebugInfo] Generate debug information for labels.Shiva Chen2018-05-093-0/+39
| | | | | | | | | | | Generate DILabel metadata and call llvm.dbg.label after label statement to associate the metadata with the label. Differential Revision: https://reviews.llvm.org/D45045 Patch by Hsiangkai Wang. llvm-svn: 331843
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-09280-3566/+3566
| | | | | | | | | | | | | | | | | | | This is similar to the LLVM change https://reviews.llvm.org/D46290. We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46320 llvm-svn: 331834
* Fix float->int conversion warnings when near barriers.Erich Keane2018-05-081-20/+12
| | | | | | | | | | | | As Eli brought up here: https://reviews.llvm.org/D46535 I'd previously messed up this fix by missing conversions that are just slightly outside the range. This patch fixes this by no longer ignoring the return value of convertToInteger. Additionally, one of the error messages wasn't very sensical (mentioning out of range value, when it really was not), so it was cleaned up as well. llvm-svn: 331812
* [HIP] Add hip offload kindYaxun Liu2018-05-083-17/+34
| | | | | | | | | There are quite differences in HIP action builder and action job creation, which justifies to define a separate offload kind. Differential Revision: https://reviews.llvm.org/D46471 llvm-svn: 331811
* Add a mno-outline flag to disable the MachineOutlinerJessica Paquette2018-05-081-1/+2
| | | | | | | | | | | Since we're working on turning the MachineOutliner by default under -Oz for AArch64, it makes sense to have an -mno-outline flag available. This currently doesn't do much (it basically just undoes -moutline). When the MachineOutliner is on by default under AArch64, this flag should set -mllvm -enable-machine-outliner=never. llvm-svn: 331810
* [Driver] Don't add -dwarf-column-info when using -gcodeview on non-msvc targetsMartin Storsjo2018-05-081-1/+1
| | | | | | | | | | | | | | -dwarf-column-info is omitted if -gcodeview is specified for msvc targets at the moment, but since -gcodeview is an option that can be specified for any target, there's little reason to restrict this handling to msvc targets. This allows getting proper codeview debug info by passing -gcodeview for e.g. MinGW targets as well. Differential Revision: https://reviews.llvm.org/D46287 llvm-svn: 331807
* Change -foutline to -moutlineJessica Paquette2018-05-081-1/+1
| | | | | | | | | Nitpicky, but the MachineOutliner is a machine-level pass, and so we should reflect that by using "m" instead of "n". Figured we should get this in before people get used to the letter f. :) llvm-svn: 331806
* [OPENMP, NVPTX] Fix linkage of the global entries.Alexey Bataev2018-05-081-5/+5
| | | | | | | The linkage of the global entries must be weak to enable support of redefinition of the same target regions in multiple compilation units. llvm-svn: 331768
* [OpenCL] Factor out language version printingSven van Haastregt2018-05-083-11/+9
| | | | | | | | | Generate a printable OpenCL language version number in a single place and select between the OpenCL C or OpenCL C++ version accordingly. Differential Revision: https://reviews.llvm.org/D46382 llvm-svn: 331766
* [ASTImporter] Properly import SourceLocations of AttrsAleksei Sidorin2018-05-081-13/+12
| | | | | | | | Patch by Rafael Stahl! Differential Revision: https://reviews.llvm.org/D46115 llvm-svn: 331762
* Fix 'not all control paths return a value' MSVC warnings. NFCI.Simon Pilgrim2018-05-082-0/+2
| | | | llvm-svn: 331753
* [x86] Introduce the encl[u|s|v] intrinsicsGabor Buella2018-05-084-0/+76
| | | | | | | | | | Reviewers: craig.topper, zvi Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D46435 llvm-svn: 331743
* [x86] Introduce the pconfig intrinsicGabor Buella2018-05-087-0/+65
| | | | | | | | | | Reviewers: craig.topper, zvi Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D46431 llvm-svn: 331740
* [C++2a] operator<=>: Fix incorrect use of Twine.Eric Fiselier2018-05-081-3/+3
| | | | llvm-svn: 331713
* [C++2a] Implement operator<=>: Address bugs and post-commit review comments ↵Eric Fiselier2018-05-084-42/+35
| | | | | | | | | | | | after r331677. This patch addresses some mostly trivial post-commit review comments received on r331677. Additionally, this patch fixes an assertion in `getNarrowingKind` caused by the use of an uninitialized value from `checkThreeWayNarrowingConversion`. llvm-svn: 331707
* PR37352: mangle numbering for decomposition declarations.Richard Smith2018-05-071-1/+59
| | | | | | | | | | In order to match our mangling scheme, use a different set of numbers for decomposition declarations, and consider all binding names when forming the numbering. This does not yet affect any mangled names we produce, because local decomposition declarations can't yet have linkage, but a C++ standard proposal to change that is currently being processed. llvm-svn: 331692
* [X86] Make _mm256_gf2p8mul_epi8 require avx features since its 256 bits.Craig Topper2018-05-071-6/+10
| | | | | | | | Without this we throw an error on the header file instead of the user code when the right features aren't enabled in clang. Rename the other DEFAULT_FN_ATTRS defines to _Z for 512-bit since I used _Y for this case. llvm-svn: 331682
* [C++2a] Implement operator<=> CodeGen and ExprConstantEric Fiselier2018-05-0710-339/+1181
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch tackles long hanging fruit for the builtin operator<=> expressions. It is currently needs some cleanup before landing, but I want to get some initial feedback. The main changes are: * Lookup, build, and store the required standard library types and expressions in `ASTContext`. By storing them in ASTContext we don't need to store (and duplicate) the required expressions in the BinaryOperator AST nodes. * Implement [expr.spaceship] checking, including diagnosing narrowing conversions. * Implement `ExprConstant` for builtin spaceship operators. * Implement builitin operator<=> support in `CodeGenAgg`. Initially I emitted the required comparisons using `ScalarExprEmitter::VisitBinaryOperator`, but this caused the operand expressions to be emitted once for every required cmp. * Implement [builtin.over] with modifications to support the intent of P0946R0. See the note on `BuiltinOperatorOverloadBuilder::addThreeWayArithmeticOverloads` for more information about the workaround. Reviewers: rsmith, aaron.ballman, majnemer, rnk, compnerd, rjmccall Reviewed By: rjmccall Subscribers: rjmccall, rsmith, aaron.ballman, junbuml, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D45476 llvm-svn: 331677
* [CFI] Force LLVM to die if the implicit blacklist files cannot be found.Peter Collingbourne2018-05-071-0/+4
| | | | | | | | | | | | | | Currently LLVM CFI tries to use an implicit blacklist file, currently in /usr/lib64/clang/<version>/share. If the file is not there, LLVM happily continues, which causes CFI to add checks to files/functions that are known to fail, generating binaries that fail. This CL causes LLVM to die (I hope) if it can't find these implicit blacklist files. Patch by Caroline Tice! Differential Revision: https://reviews.llvm.org/D46403 llvm-svn: 331674
* Correct warning on Float->Integer conversions.Erich Keane2018-05-071-0/+17
| | | | | | | | | | | | | | | | | | As identified and briefly discussed here: https://bugs.llvm.org/show_bug.cgi?id=37305 Converting a floating point number to an integer type when the integral part is out of the range of the integer type is undefined behavior in C. Additionally, CodeGen emits an undef in this situation. HOWEVER, we've been giving a warning that says that the value is changed. This patch corrects the warning to list that it is actually undefined behavior. Differential Revision: https://reviews.llvm.org/D46535 llvm-svn: 331673
* [Driver] Use -fuse-line-directives by default in MSVC modeMartin Storsjo2018-05-071-2/+2
| | | | | | | | Don't use the GNU extension form of line markers in MSVC mode. Differential Revision: https://reviews.llvm.org/D46520 llvm-svn: 331666
* [OPENMP, NVPTX] Codegen for critical construct.Alexey Bataev2018-05-072-0/+70
| | | | | | Added correct codegen for the critical construct on NVPTX devices. llvm-svn: 331652
* Fix explicit template parameter reporting for narrowing conversionsErich Keane2018-05-071-0/+4
| | | | | | | | | | | | | | | | | | I found that explicit template parameters that caused a narrowing integer conversion resulted in the incorrect parameter being mentioned in the note (see test attached). This is because the argument checking code doesn't check to see if it caused SFINAE errors when checking the arguments, so instead of giving up on the first error, it continues through the list. This makes the error reporting pick up the last template param every time. This patch checks these parameters on each argument and gives up if there is an error. The result is that only the required amount of arguments are checked, and that the 'Converted' array contains only the successful arguments before the first failure, as the calls seem to all expect. llvm-svn: 331651
* [OPENMP, NVPTX] Added support for L2 parallelism.Alexey Bataev2018-05-074-127/+384
| | | | | | | Added initial codegen for level 2, 3 etc. parallelism. Currently, all the second, the third etc. parallel regions will run sequentially. llvm-svn: 331642
* [mips] Improve handling of -fno-[pic/PIC] optionAleksandar Beserminji2018-05-072-3/+20
| | | | | | | | | | | | | | | In order to disable PIC and to match GCC behaviour, -mno-abicalls option is neccessary. When -fno-[pic/PIC] is used witout -mno-abicalls, warning is reported. An error is reported when -fno-pic or -fno-PIC is used in combination with -mabicalls. In this commit, test case is added. Depends on D44381. Differential Revision: https://reviews.llvm.org/D44684 llvm-svn: 331640
* Revert "[mips] Improve handling of -fno-[pic/PIC] option"Aleksandar Beserminji2018-05-072-20/+3
| | | | | | This reverts commit r331636. Forgot to add the test case. llvm-svn: 331639
* [mips] Improve handling of -fno-[pic/PIC] optionAleksandar Beserminji2018-05-072-3/+20
| | | | | | | | | | | | | In order to disable PIC and to match GCC behaviour, -mno-abicalls option is neccessary. When -fno-[pic/PIC] is used witout -mno-abicalls, warning is reported. An error is reported when -fno-pic or -fno-PIC is used in combination with -mabicalls. Depends on D44381. Differential Revision: https://reviews.llvm.org/D44684 llvm-svn: 331636
* [ASTImporter] Support importing UnresolvedMemberExpr, DependentNameType, ↵Peter Szecsi2018-05-071-1/+86
| | | | | | | | | | DependentScopeDeclRefExpr The visit callback implementations for the 3 C++ AST Node added to the ASTImporter. Differential Revision: https://reviews.llvm.org/D38845 llvm-svn: 331630
* Remove now-unnecessary check for non-zero nvsize in addition toRichard Smith2018-05-071-2/+2
| | | | | | emptyness in MS record layout. llvm-svn: 331621
* Non-zero-length bit-fields make a class non-empty.Richard Smith2018-05-071-9/+13
| | | | | | | | | | | | | | | | | | | | This implements the rule intended by the standard (see LWG 2358) and the rule intended by the Itanium C++ ABI (see https://github.com/itanium-cxx-abi/cxx-abi/pull/51), and makes Clang match the behavior of GCC, ICC, and MSVC. A pedantic reading of both the standard and the ABI indicate that Clang is currently technically correct, but that's not worth much when it's clear that the wording is wrong in both those places. This is an ABI break for classes that derive from a class that is empty other than one or more unnamed non-zero-length bit-fields. Such cases are expected to be rare, but -fclang-abi-compat=6 restores the old behavior just in case. Differential Revision: https://reviews.llvm.org/D45174 llvm-svn: 331620
* Disallow pointers to const in __sync_fetch_and_xxx.Aaron Ballman2018-05-051-0/+6
| | | | | | | | | | | | Diagnoses code like: void f(const int *ptr) { __sync_fetch_and_add(ptr, 1); } which matches the behavior of GCC and ICC. llvm-svn: 331598
* [ThinLTO] Support opt remarks options with distributed ThinLTO backendsTeresa Johnson2018-05-052-2/+6
| | | | | | | | | | | | | | | | | Summary: Passes down the necessary code ge options to the LTO Config to enable -fdiagnostics-show-hotness and -fsave-optimization-record in the ThinLTO backend for a distributed build. Also, remove warning about not having PGO when the input is IR. Reviewers: pcc Subscribers: mehdi_amini, inglorion, eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D46464 llvm-svn: 331592
* Fix a couple places that immediately called operator-> on the result of ↵Craig Topper2018-05-052-2/+2
| | | | | | | | dyn_cast. It looks like it safe to just use cast for both cases. llvm-svn: 331578
* [analyzer] Remove untested code in evalLoad.Artem Dergachev2018-05-041-37/+0
| | | | | | No functional change intended. llvm-svn: 331565
* [analyzer] Invalidate union regions properly. Don't hesitate to load later.Artem Dergachev2018-05-041-6/+1
| | | | | | | | | | | | | | | | | | | We weren't invalidating our unions correctly. The previous behavior in invalidateRegionsWorker::VisitCluster() was to direct-bind an UnknownVal to the union (at offset 0). For that reason we were never actually loading default bindings from our unions, because there never was any default binding to load, and the value that is presumed when there's no default binding to load is usually completely incorrect (eg. UndefinedVal for stack unions). The new behavior is to default-bind a conjured symbol (of irrelevant type) to the union that's being invalidated, similarly to what we do for structures and classes. Then it becomes safe to load the value properly. Differential Revision: https://reviews.llvm.org/D45241 llvm-svn: 331563
* [analyzer] pr36458: Fix retrieved value cast for symbolic void pointers.Artem Dergachev2018-05-041-0/+14
| | | | | | | | | | | | | C allows us to write any bytes into any memory region. When loading weird bytes from memory regions of known types, the analyzer is required to make sure that the loaded value makes sense by casting it to an appropriate type. Fix such cast for loading values that represent void pointers from non-void pointer type places. Differential Revision: https://reviews.llvm.org/D46415 llvm-svn: 331562
* [analyzer] pr18953: Split C++ zero-initialization from default initialization.Artem Dergachev2018-05-046-35/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | The bindDefault() API of the ProgramState allows setting a default value for reads from memory regions that were not preceded by writes. It was used for implementing C++ zeroing constructors (i.e. default constructors that boil down to setting all fields of the object to 0). Because differences between zeroing consturctors and other forms of default initialization have been piling up (in particular, zeroing constructors can be called multiple times over the same object, probably even at the same offset, requiring a careful and potentially slow cleanup of previous bindings in the RegionStore), we split the API in two: bindDefaultInitial() for modeling initial values and bindDefaultZero() for modeling zeroing constructors. This fixes a few assertion failures from which the investigation originated. The imperfect protection from both inability of the RegionStore to support binding extents and lack of information in ASTRecordLayout has been loosened because it's, well, imperfect, and it is unclear if it fixing more than it was breaking. Differential Revision: https://reviews.llvm.org/D46368 llvm-svn: 331561
* [X86] Fix some inconsistent formatting in the first line of our intrinsics ↵Craig Topper2018-05-0413-15/+13
| | | | | | | | headers. Some were too long and some were too short. llvm-svn: 331559
* [analyzer] pr37209: Fix casts of glvalues to references.Artem Dergachev2018-05-041-0/+7
| | | | | | | | | | | | | | | Many glvalue expressions aren't of their respective reference type - they are simply glvalues of their value type. This was causing problems when we were trying to obtain type of the original expression while evaluating certain glvalue bit-casts. Fixed by artificially forging a reference type to provide to the casting procedure. Differential Revision: https://reviews.llvm.org/D46224 llvm-svn: 331558
* [analyzer] Treat more const variables and fields as known contants.Artem Dergachev2018-05-042-3/+52
| | | | | | | | | | | | | | | | When loading from a variable or a field that is declared as constant, the analyzer will try to inspect its initializer and constant-fold it. Upon success, the analyzer would skip normal load and return the respective constant. The new behavior also applies to fields/elements of brace-initialized structures and arrays. Patch by Rafael Stahl! Differential Revision: https://reviews.llvm.org/D45774 llvm-svn: 331556
* Allow modifying the PrintingPolicy for fully qualified names.Sterling Augustine2018-05-041-5/+1
| | | | | Author: mikhail.ramalho@gmail.com llvm-svn: 331552
* [clang-format] Refactor #include insertion/deletion functionality into a class.Eric Liu2018-05-041-102/+252
| | | | | | | | | | | | | | | | | | | | | | | | Summary: The class will be moved into libToolingCore as followup. The new behaviors in this patch: - New #include is inserted in the right position in a #include block to preserver sorted #includes. This is best effort - only works when the block is already sorted. - When inserting multiple #includes to the end of a file which doesn't end with a "\n" character, a "\n" will be prepended to each #include. This is a special and rare case that was previously handled. This is now relaxed to avoid complexity as it's rare in practice. Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: klimek, cfe-commits, djasper Differential Revision: https://reviews.llvm.org/D46180 llvm-svn: 331544
* [clang-cl] Print /showIncludes to stderr, if used in combination with /E, ↵Erich Keane2018-05-044-10/+29
| | | | | | | | | | | | | | | | | /EP or /P This replicates 'cl.exe' behavior and allows for both preprocessor output and dependency information to be extraced with a single compiler invocation. This is especially useful for compiler caching with tools like Mozilla's sccache. See: https://github.com/mozilla/sccache/issues/246 Patch By: fxb Differential Revision: https://reviews.llvm.org/D46394 llvm-svn: 331533
* [Coroutines] Catch exceptions in await_resumeBrian Gesiak2018-05-041-3/+45
| | | | | | | | | | | | | | | | | | | | | Summary: http://wg21.link/P0664r2 section "Evolution/Core Issues 24" describes a proposed change to Coroutines TS that would have any exceptions thrown after the initial suspend point of a coroutine be caught by the handler specified by the promise type's 'unhandled_exception' member function. This commit provides a sample implementation of the specified behavior. Test Plan: `check-clang` Reviewers: GorNishanov, EricWF Reviewed By: GorNishanov Subscribers: cfe-commits, lewissbaker, eric_niebler Differential Revision: https://reviews.llvm.org/D45860 llvm-svn: 331519
* [Driver] Don't warn about unused inputs in config filesMartin Storsjo2018-05-041-3/+7
| | | | | | | | | This avoids warnings about unused linker parameters, just like other flags are ignored if they're from config files. Differential Revision: https://reviews.llvm.org/D46286 llvm-svn: 331504
OpenPOWER on IntegriCloud