summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang-format] Start formatting cpp code in raw strings in google styleKrasimir Georgiev2018-04-251-12/+31
| | | | | | | | | | | | | | Summary: This adds some delimiters to detect cpp code in raw strings. Reviewers: klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D46062 llvm-svn: 330832
* [HIP] Add predefined macros __HIPCC__ and __HIP_DEVICE_COMPILE__Yaxun Liu2018-04-251-2/+6
| | | | | | Differential Revision: https://reviews.llvm.org/D45441 llvm-svn: 330824
* Fix buildbot problems after rC330794Bjorn Pettersson2018-04-251-1/+2
| | | | | | | | | | | | | | Avoiding error: no matching function for call to 'makeArrayRef' at ../tools/clang/lib/Parse/ParseTemplate.cpp:373:17 By using a local C array as input to makeArrayRef. Not sure if this is the best solution, but it makes the code compile again. llvm-svn: 330802
* [c++2a] [concepts] Add rudimentary parsing support for template concept ↵Faisal Vali2018-04-2520-32/+391
| | | | | | | | | | | | | | declarations This patch is a tweak of changyu's patch: https://reviews.llvm.org/D40381. It differs in that the recognition of the 'concept' token is moved into the machinery that recognizes declaration-specifiers - this allows us to leverage the attribute handling machinery more seamlessly. See the test file to get a sense of the basic parsing that this patch supports. There is much more work to be done before concepts are usable... Thanks Changyu! llvm-svn: 330794
* [HIP] Add hip input kind and codegen for kernel launchingYaxun Liu2018-04-256-22/+65
| | | | | | | | | | | | | | | | | | | | | | | HIP is a language similar to CUDA (https://github.com/ROCm-Developer-Tools/HIP/blob/master/docs/markdown/hip_kernel_language.md ). The language syntax is very similar, which allows a hip program to be compiled as a CUDA program by Clang. The main difference is the host API. HIP has a set of vendor neutral host API which can be implemented on different platforms. Currently there is open source implementation of HIP runtime on amdgpu target (https://github.com/ROCm-Developer-Tools/HIP). This patch adds support of input kind and language standard hip. When hip file is compiled, both LangOpts.CUDA and LangOpts.HIP is turned on. This allows compilation of hip program as CUDA in most cases and only special handling of hip program is needed LangOpts.HIP is checked. This patch also adds support of kernel launching of HIP program using HIP host API. When -x hip is not specified, there is no behaviour change for CUDA. Patch by Greg Rodgers. Revised and lit test added by Yaxun Liu. Differential Revision: https://reviews.llvm.org/D44984 llvm-svn: 330790
* [ODRHash] Hash template arguments of methods.Richard Trieu2018-04-252-0/+103
| | | | llvm-svn: 330789
* Revert "[Driver] Android triples are not aliases for other triples."Dan Albert2018-04-241-76/+50
| | | | | | | | Revering while I diagnose the failures. This reverts commit 82dc3bf2157da280420f80e654292cb05e0dc5f7. llvm-svn: 330780
* [Driver] Android triples are not aliases for other triples.Dan Albert2018-04-241-50/+76
| | | | | | | | | | | | | | | | Summary: Android targets should never use tools/libraries for non-Android targets or vice versa. Reviewers: srhines, george.burgess.iv, eugenis Reviewed By: eugenis Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D45597 llvm-svn: 330770
* [analyzer] Add support for the note diagnostic pieces to plist output format.Artem Dergachev2018-04-241-29/+97
| | | | | | | | | | | | | | | | | Note diagnostic pieces are an additional way of highlighting code sections to the user. They aren't part of the normal path diagnostic sequence. They can also be attached to path-insensitive reports. Notes are already supported by the text output and scan-build. Expanding our machine-readable plist output format to be able to represent notes opens up the possibility for various analyzer GUIs to pick them up. Patch by Umann Kristóf! Differential Revision: https://reviews.llvm.org/D45407 llvm-svn: 330766
* Improve -Warray-bounds to handle multiple array extents rather than only ↵Aaron Ballman2018-04-241-1/+6
| | | | | | | | handling the top-most array extent. Patch by Bevin Hansson. llvm-svn: 330759
* [CUDA] Enable CUDA compilation with CUDA-9.2Artem Belevich2018-04-243-1/+10
| | | | | | Differential Revision: https://reviews.llvm.org/D45827 llvm-svn: 330753
* [X86] Add recently added intrinsic headers to the module map.Craig Topper2018-04-241-0/+3
| | | | llvm-svn: 330744
* [X86] Consistently use double underscore at the beginning of the include ↵Craig Topper2018-04-249-27/+27
| | | | | | | | guards in our intrinsic headers. Most files used double underscore, but a few used single. This converges them all to double. llvm-svn: 330743
* [Attr] Print enum attributes at correct positionJoel E. Denny2018-04-241-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For example, given: void fn() { enum __attribute__((deprecated)) T *p; } -ast-print produced: void fn() { enum T __attribute__((deprecated(""))) *p; } -ast-print on that produced: void fn() { enum T *p __attribute__((deprecated(""))); } The attribute is on enum T in the first case, but it's on p in the other cases. Details: Within enum declarations, enum attributes were always printed after the tag and any member list. When no member list was present but the enum was a type specifier in a variable declaration, the attribute then applied to the variable not the enum, changing the semantics. This patch fixes that by always printing attributes between the enum's keyword and tag, as clang already does for structs, unions, and classes. Reviewed By: rsmith Differential Revision: https://reviews.llvm.org/D45456 llvm-svn: 330722
* [OpenCL] Fix diagnostic of thread_localSven van Haastregt2018-04-241-0/+1
| | | | | | | | | | | | | Commit 08c258670c ("[OpenCL] Generic address space has been added in OpenCL v2.0.", 2014-11-26) did not mark the thread_local keyword as a storage class specifier, whereas it did mark _Thread_local as such. According to the C++14 spec s7.1.1, thread_local is a storage class specifier, so mark it as such. I will add a test for this in a follow-up commit that adds keyword restrictions to the OpenCL C++ language mode. llvm-svn: 330721
* [CodeComplete] Fix completion at the end of keywordsIlya Biryukov2018-04-241-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Make completion behave consistently no matter if it is run at the start, in the middle or at the end of an identifier that happens to be a keyword or a macro name. Since completion is often ran on incomplete identifiers, they may turn into keywords by accident. For example, we should produce same results for all of these completion points: // ^ is completion point. ^class cla^ss class^ Previously clang produced different results for the last case (as if the completion point was after a space: `class ^`). This change also updates some offsets in tests that (unintentionally?) relied on the old behavior. Reviewers: sammccall, bkramer, arphaman, aaron.ballman Reviewed By: sammccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D45887 llvm-svn: 330717
* [GCC] Don't keep a StringRef to a temporary std::stringMartin Storsjo2018-04-241-1/+1
| | | | | | | | | | This fixes failures in asan builds and possibly other buildbots as well, after SVN r330696. Prior to that revision, the std::string was stored in another variable, before assigning to a StringRef. llvm-svn: 330710
* [ASTImporter] Allow testing of import sequences; fix import of typedefs for ↵Aleksei Sidorin2018-04-241-23/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | anonymous decls This patch introduces the ability to test an arbitrary sequence of imports between a given set of virtual source files. This should finally allow us to write simple tests and fix annoying issues inside ASTImporter that cause failures in CSA CTU. This is done by refactoring ASTImporterTest functions and introducing `testImportSequence` facility. As a side effect, `testImport` facility was generalized a bit more. It should now allow import of non-decl AST nodes; however, there is still no test using this ability. As a "test for test", there is also a fix for import anonymous TagDecls referred by typedef. Before this patch, the setting of typedef for anonymous structure was delayed; however, this approach misses the corner case if an enum constant is imported directly. In this patch, typedefs for anonymous declarations are imported right after the anonymous declaration is imported, without any delay. Thanks to Adam Balogh for suggestions included into this patch. Differential Revision: https://reviews.llvm.org/D44079 llvm-svn: 330704
* [GCC] Match a GCC version with a patch suffix without a third version componentMartin Storsjo2018-04-241-3/+11
| | | | | | | | | | | | | | Previously it would only accept a string as a GCC version if it had either two components and no suffix, or three components with an optional suffix. Debian and ubuntu provided mingw compilers have lib/gcc/target entries like "5.3-posix" and "5.3-win32". This doesn't try to make any specific preference between them (other than lexical sorting of the suffix). Differential Revision: https://reviews.llvm.org/D45505 llvm-svn: 330696
* Link to AggressiveInstCombine in a few places. Unbreaks build for me.Roman Lebedev2018-04-241-0/+1
| | | | | | | | | | | | /usr/local/bin/ld.lld: error: undefined symbol: llvm::createAggressiveInstCombinerPass() >>> referenced by cc1_main.cpp >>> tools/clang/tools/driver/CMakeFiles/clang.dir/cc1_main.cpp.o:(_GLOBAL__sub_I_cc1_main.cpp) And so on The bot coverage is clearly missing. llvm-svn: 330694
* [X86] Remove '#ifdef __x86_64__' around mask_set1_epi64 intrinsics.Craig Topper2018-04-242-7/+0
| | | | | | The unmasked versions already didn't have this restrction. I don't think gcc or icc limit these to 64-bit mode so we shouldn't either. llvm-svn: 330681
* Fix build break due to content moving from Scalar.h to InstCombine.h in LLVMDavid Blaikie2018-04-241-0/+1
| | | | llvm-svn: 330671
* [AST] strcmp/memcmp always compares unsigned chars.Benjamin Kramer2018-04-231-2/+12
| | | | | | | This makes it return the right result in a couple of edge cases. The wide versions always do the comparison on the underlying wchar_t type. llvm-svn: 330656
* [Sema] Add -Wno-self-assign-overloadedRoman Lebedev2018-04-231-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: It seems there isn't much enthusiasm for `-wtest` D45685. This is more conservative version, which i had in the very first revision of D44883, but that 'erroneously' got removed because of the review. **Based on some [irc] discussions, it must really be documented that we want all the new diagnostics to have their own flags, to ease rollouts, transitions, etc.** Please do note that i'm only adding `-Wno-self-assign-overloaded`, but not `-Wno-self-assign-field-overloaded`, because i'm honestly not aware of any false-positives from the `-field` variant, but i can just as easily add it if wanted. https://reviews.llvm.org/D44883#1068561 Reviewers: dblaikie, aaron.ballman, thakis, rjmccall, rsmith Reviewed By: dblaikie Subscribers: Quuxplusone, chandlerc, cfe-commits Differential Revision: https://reviews.llvm.org/D45766 llvm-svn: 330651
* [OPENMP] Formatting and code improvement, NFC.Alexey Bataev2018-04-231-88/+93
| | | | llvm-svn: 330634
* DR727: remove wrong assertion for use of class-scope explicitRichard Smith2018-04-231-4/+0
| | | | | | specialization without -fms-extensions. llvm-svn: 330626
* [OPENMP] Do not cast captured by value variables with pointer types inAlexey Bataev2018-04-231-1/+2
| | | | | | | | | | | NVPTX target. When generating the wrapper function for the offloading region, we need to call the outlined function and cast the arguments correctly to follow the ABI. Usually, variables captured by value are casted to `uintptr_t` type. But this should not performed for the variables with pointer type. llvm-svn: 330620
* [analyzer] Don't crash on printing ConcreteInt of size >64 bitsAleksei Sidorin2018-04-231-7/+3
| | | | | | | | Printing of ConcreteInts with size >64 bits resulted in assertion failure in get[Z|S]ExtValue() because these methods are only allowed to be used with integers of 64 max bit width. This patch fixes the issue. llvm-svn: 330605
* [analyzer] Move `TaintBugVisitor` from `GenericTaintChecker.cpp` to ↵Henry Wong2018-04-232-39/+21
| | | | | | | | | | | | | | | | `BugReporterVisitors.h`. Summary: `TaintBugVisitor` is a universal visitor, and many checkers rely on it, such as `ArrayBoundCheckerV2.cpp`, `DivZeroChecker.cpp` and `VLASizeChecker.cpp`. Moving `TaintBugVisitor` to `BugReporterVisitors.h` enables other checker can also track where `tainted` value came from. Reviewers: NoQ, george.karpenkov, xazax.hun Reviewed By: george.karpenkov Subscribers: szepet, rnkovacs, a.sidorin, cfe-commits, MTC Differential Revision: https://reviews.llvm.org/D45682 llvm-svn: 330596
* [index] Fix methods that take a shared_ptr to just take a reference.Benjamin Kramer2018-04-231-16/+14
| | | | | | | There is no ownership here, passing a shared_ptr just adds confusion. No functionality change intended. llvm-svn: 330595
* [analyzer] CStringChecker.cpp - Code refactoring on bug report.Henry Wong2018-04-231-100/+96
| | | | | | | | | | Reviewers: NoQ, george.karpenkov, xazax.hun Reviewed By: george.karpenkov Differential Revision: https://reviews.llvm.org/D44557 llvm-svn: 330589
* [OpenCL] Reject virtual functions for OpenCL C++Sven van Haastregt2018-04-232-1/+10
| | | | | | Differential Revision: https://reviews.llvm.org/D45873 llvm-svn: 330579
* [CodeGen] Reland r330442: Add an option to suppress output of llvm.identMikhail Maltsev2018-04-234-2/+9
| | | | | | | The test case in the original patch was overly contrained and failed on PPC targets. llvm-svn: 330575
* [clang-format] Fix clang-tidy readability problems, NFCIKrasimir Georgiev2018-04-233-6/+6
| | | | llvm-svn: 330574
* Format closing braces when reformatting the line containing the opening brace.Manuel Klimek2018-04-2310-29/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This required a couple of yaks to be shaved: 1. MatchingOpeningBlockLineIndex was misused to also store the closing index; instead, use a second variable, as this doesn't work correctly for "} else {". 2. We needed to change the API of AffectedRangeManager to not use iterators; we always passed in begin / end for the whole container before, so there was no mismatch in generality. 3. We need an extra check to discontinue formatting at the top level, as we now sometimes change the indent of the closing brace, but want to bail out immediately afterwards, for example: void f() { if (a) { } void g(); Previously: void f() { if (a) { } void g(); Now: void f() { if (a) { } void g(); Differential Revision: https://reviews.llvm.org/D45726 llvm-svn: 330573
* [Solaris] __float128 is supported on Solaris/x86Rainer Orth2018-04-231-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When rebasing https://reviews.llvm.org/D40898 with GCC 5.4 on Solaris 11.4, I ran into a few instances of In file included from /vol/llvm/src/compiler-rt/local/test/asan/TestCases/Posix/asan-symbolize-sanity-test.cc:19: In file included from /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/string:40: In file included from /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/bits/char_traits.h:39: In file included from /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/bits/stl_algobase.h:64: In file included from /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/bits/stl_pair.h:59: In file included from /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/bits/move.h:57: /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/type_traits:311:39: error: __float128 is not supported on this target struct __is_floating_point_helper<__float128> ^ during make check-all. The line above is inside #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128) template<> struct __is_floating_point_helper<__float128> : public true_type { }; #endif While the libstdc++ header indicates support for __float128, clang does not, but should. The following patch implements this and fixed those errors. Differential Revision: https://reviews.llvm.org/D41240 llvm-svn: 330572
* Use special new Clang flag 'FrontendTimesIsEnabled' instead of ↵Andrew V. Tischenko2018-04-234-11/+32
| | | | | | | | 'llvm::TimePassesIsEnabled' inside -ftime-report feature. Differential Revision: https://reviews.llvm.org/D45619 llvm-svn: 330571
* Revert "[clang-format] Improve Incomplete detection for (text) protos"Krasimir Georgiev2018-04-231-18/+5
| | | | | | | | This reverts commit r330016. The incomplete detection has too many false positives, picking up typos for hard failures and refusing to format anything in that case. llvm-svn: 330569
* [Atomics] warn about atomic accesses using libcallsTim Northover2018-04-231-6/+10
| | | | | | | | | | | | If an atomic variable is misaligned (and that suspicion is why Clang emits libcalls at all) the runtime support library will have to use a lock to safely access it, with potentially very bad performance consequences. There's a very good chance this is unintentional so it makes sense to issue a warning. Also give it a named group so people can promote it to an error, or disable it if they really don't care. llvm-svn: 330566
* [XRay] Change std::sort to llvm::sort in response to r327219Mandeep Singh Grang2018-04-231-1/+1
| | | | | | | | | | | r327219 added wrappers to std::sort which randomly shuffle the container before sorting. This will help in uncovering non-determinism caused due to undefined sorting order of objects having the same key. To make use of that infrastructure we need to invoke llvm::sort instead of std::sort. llvm-svn: 330561
* [X86] WaitPKG intrinsicsGabor Buella2018-04-206-0/+70
| | | | | | | | | | Reviewers: craig.topper, zvi Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D45254 llvm-svn: 330463
* Record whether a module came from a private module mapJordan Rose2018-04-204-6/+16
| | | | | | | | | | | Right now we only use this information in one place, immediately after we calculate it, but it's still nice information to have. The Swift project is going to use this to tidy up its "API notes" feature (see past discussion on cfe-dev that never quite converged). Reviewed by Bruno Cardoso Lopes. llvm-svn: 330452
* Revert r330442, CodeGen/no-ident-version.c is failing on PPCMikhail Maltsev2018-04-204-9/+2
| | | | llvm-svn: 330451
* [CUDA] Set LLVM calling convention for CUDA kernelYaxun Liu2018-04-203-0/+11
| | | | | | | | | | | | | | Some targets need special LLVM calling convention for CUDA kernel. This patch does that through a TargetCodeGenInfo hook. It only affects amdgcn target. Patch by Greg Rodgers. Revised and lit tests added by Yaxun Liu. Differential Revision: https://reviews.llvm.org/D45223 llvm-svn: 330447
* [CodeGen] Add an option to suppress output of llvm.identMikhail Maltsev2018-04-204-2/+9
| | | | | | | | | | | | | | | | | | | | | | Summary: By default Clang outputs its version (including git commit hash, in case of trunk builds) into object and assembly files. It might be useful to have an option to disable this, especially for debugging purposes. This patch implements new command line flags -Qn and -Qy (the names are chosen for compatibility with GCC). -Qn disables output of the 'llvm.ident' metadata string and the 'producer' debug info. -Qy (enabled by default) does the opposite. Reviewers: faisalv, echristo, aprantl Reviewed By: aprantl Subscribers: aprantl, cfe-commits, JDevlieghere, rogfer01 Differential Revision: https://reviews.llvm.org/D45255 llvm-svn: 330442
* [CUDA] Register relocatable GPU binariesJonas Hahnfeld2018-04-201-19/+102
| | | | | | | | | | nvcc generates a unique registration function for each object file that contains relocatable device code. Unique names are achieved with a module id that is also reflected in the function's name. Differential Revision: https://reviews.llvm.org/D42922 llvm-svn: 330425
* [Driver] Support for -save-stats in AddGoldPlugin.Florian Hahn2018-04-207-41/+67
| | | | | | | | | | | | | | This patch updates AddGoldPlugin to pass stats-file to the Gold plugin, if -save-stats is passed. It also moves the save-stats option handling to a helper function tools::getStatsFileName. Reviewers: tejohnson, mehdi_amini, compnerd Reviewed By: tejohnson, compnerd Differential Revision: https://reviews.llvm.org/D45771 llvm-svn: 330422
* Fix -Wunused-variable warnings after r330377.Andrea Di Biagio2018-04-201-2/+2
| | | | llvm-svn: 330408
* [OpenCL] Add 'denorms-are-zero' function attributeAlexey Sotkin2018-04-201-0/+4
| | | | | | | | | | | | | | | | | | Summary: Generate attribute 'denorms-are-zero'='true' if '-cl-denorms-are-zero' compile option was specified and 'denorms-are-zero'='false' otherwise. Patch by krisb Reviewers: Anastasia, yaxunl Reviewed By: yaxunl Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D45808 llvm-svn: 330404
* [CFG] [analyzer] Add construction contexts for loop condition variables.Artem Dergachev2018-04-191-2/+14
| | | | | | | | | | | | | | | | | Loop condition variables, eg. while (shared_ptr<int> P = getIntPtr()) { ... }) weren't handled in r324794 because they don't go through the common CFGBuilder::VisitDeclStmt method. Which means that they regressed after r324800. Fix the regression by duplicating the necessary construction context scan in the loop visiting code. Differential Revision: https://reviews.llvm.org/D45706 llvm-svn: 330382
OpenPOWER on IntegriCloud