summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
* Basic: fix __{,U}INTPTR_TYPE__ on ARMSaleem Abdulrasool2017-10-183-36/+39
| | | | | | | | | | Darwin and OpenBSD are the only platforms which use `long int` for `__INTPTR_TYPE__`. The other platforms use `int` in 32-bit, and `long int` on 64-bit (except for VMS and Windows which are LLP64). Adjust the type definitions to match the platform definitions. We now generate the same definition as GCC on all the targets. llvm-svn: 316046
* Resubmit "[lit] Raise the logic for enabling clang & lld substitutions to llvm."Zachary Turner2017-10-171-136/+21
| | | | | | | The substitution for %debuginfo_tests had been inadvertently removed. This adds it back. llvm-svn: 316043
* Basic: fix `__INTPTR_TYPE__` for Windows ARMSaleem Abdulrasool2017-10-172-0/+6
| | | | | | | The `IntPtrType` for Windows ARM should be `int` as per MSVC. Adjust the type accordingly. llvm-svn: 316042
* [Analyzer] Always use non-reference types when creating expressions in BodyFarm.George Karpenkov2017-10-172-23/+15
| | | | | | | | | | | | | | Remove an option to use a reference type (on by default!) since a non-reference type is always needed for creating expressions, functions with multiple boolean parameters are very hard to use, and in general it was just a booby trap for further crashes. Furthermore, generalize call_once test case to fix some of the crashes mentioned https://bugs.llvm.org/show_bug.cgi?id=34869 Also removes std::call_once crash. Differential Revision: https://reviews.llvm.org/D39015 llvm-svn: 316041
* Fix PR34981, a crash-on-invalid merging dllimport to an invalid redecl.Nico Weber2017-10-172-3/+9
| | | | | | This is basically like r288207, just the other way round. llvm-svn: 316032
* [CFG] Relax Wexceptions warning on rethrow Erich Keane2017-10-172-5/+22
| | | | | | | | | | | | As reported here: https://bugs.llvm.org/show_bug.cgi?id=34973 "catch(...)" should catch EVERYTHING, even a rethrow. This patch changes the order in which things are checked to ensure that a '...' catch will get a rethrow. Differential Revision: https://reviews.llvm.org/D39013 llvm-svn: 316030
* This test case was missing -fsyntax-only, so I've added it. NFC to the ↵Aaron Ballman2017-10-171-1/+1
| | | | | | actual test contents, just how the test is executed. llvm-svn: 316028
* Enable support for the [[nodiscard]] attribute from WG14 N2050 when enabling ↵Aaron Ballman2017-10-173-3/+53
| | | | | | double square bracket attributes in C code. llvm-svn: 316026
* Expose ConsumeAnyToken interface to external clients.Vassil Vassilev2017-10-171-20/+21
| | | | llvm-svn: 316022
* [OpenCL] Restrict swizzle length check to OpenCL modeBruno Cardoso Lopes2017-10-173-2/+14
| | | | | | | | | | | Changes behavior introduced in r298369 to only error out on vector component invalid length access on OpenCL mode. Differential Revision: https://reviews.llvm.org/D38868 rdar://problem/33568748 llvm-svn: 316016
* Replace use of SmallVector::back + pop_back with pop_back_valErich Keane2017-10-171-2/+1
| | | | | | | | | I ran across an instance where the value was being loaded out via back, then immediately popped. Since pop_back_val is more efficient at this (it moves out), replace this instance. llvm-svn: 316015
* Sema: use new `getNS{,U}IntegerType` for NS{,U}IntegerSaleem Abdulrasool2017-10-171-3/+3
| | | | | | | | Use the new helper methods to get the underlying type for NSUInteger, NSInteger types. This avoids spreading the knowledge of the underlying types in various sites. For non-LLP64 targets, this has no change. llvm-svn: 316013
* [OPENMP] Fix capturing of boolean variables in debug mode.Alexey Bataev2017-10-172-6/+7
| | | | | | | | If the variables is boolean and we generating inner function with real types, the codegen may crash because of not loading boolean value from memory. llvm-svn: 316011
* [OpenMP] Implement omp_is_initial_device() as builtinJonas Hahnfeld2017-10-175-1/+45
| | | | | | | | This allows to return the static value that we know at compile time. Differential Revision: https://reviews.llvm.org/D38968 llvm-svn: 316001
* CodeGen: Fix invalid bitcasts for atomic builtinsYaxun Liu2017-10-172-41/+43
| | | | | | | | | | | | | Currently clang assumes the temporary variables emitted during codegen of atomic builtins have address space 0, which is not true for target triple amdgcn---amdgiz and causes invalid bitcasts. This patch fixes that. Differential Revision: https://reviews.llvm.org/D38966 llvm-svn: 316000
* [clang-rename] Rename enum.Haojian Wu2017-10-173-4/+230
| | | | | | | | | | | | | | | | Summary: * Add unit tests for renaming enum. * Support unscoped enum constants in expressions. Reviewers: ioeric Reviewed By: ioeric Subscribers: klimek, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D38989 llvm-svn: 315999
* [CMake][OpenMP] Customize default offloading archJonas Hahnfeld2017-10-174-21/+19
| | | | | | | | | For the shuffle instructions in reductions we need at least sm_30 but the user may want to customize the default architecture. Differential Revision: https://reviews.llvm.org/D38883 llvm-svn: 315996
* [CodeGen] Refine generation of TBAA info for bit-field lvaluesIvan A. Kosarev2017-10-171-63/+51
| | | | | | | | | | | | | | | | | The main change is that now we generate TBAA info before constructing the resulting lvalue instead of constructing lvalue with some default TBAA info and fixing it as necessary afterwards. We also keep the TBAA info close to lvalue base info, which is supposed to simplify their future merging. This patch should not bring in any functional changes. This is part of D38126 reworked to be a separate patch to simplify review. Differential Revision: https://reviews.llvm.org/D38947 llvm-svn: 315989
* [CodeGen] Pass TBAA info along with lvalue base info everywhereIvan A. Kosarev2017-10-175-55/+43
| | | | | | | | | | | | | | This patch addresses the rest of the cases where we pass lvalue base info, but do not provide corresponding TBAA info. This patch should not bring in any functional changes. This is part of D38126 reworked to be a separate patch to make reviewing easier. Differential Revision: https://reviews.llvm.org/D38945 llvm-svn: 315986
* [CodeGen] EmitPointerWithAlignment() to generate TBAA info along with LValue ↵Ivan A. Kosarev2017-10-178-42/+114
| | | | | | | | base info Differential Revision: https://reviews.llvm.org/D38796 llvm-svn: 315984
* [Coverage] Discard deferred region in closing if-elseVedant Kumar2017-10-172-8/+44
| | | | | | | | | | | | | | | | A trailing deferred region isn't necessary in a function that ends with this pattern: ... else { ... return; } Special-case this pattern so that the closing curly brace of the function isn't marked as uncovered. This issue came up in PR34962. llvm-svn: 315982
* [Coverage] Explicitly mark the l.h.s of && and || (fixes PR33465)Vedant Kumar2017-10-173-11/+20
| | | | | | | | | | This makes it possible to view sub-line region counts for the l.h.s of && and || expressions in coverage reports. It also fixes PR33465, which shows an example of incorrect coverage output for an assignment statement containing '||'. llvm-svn: 315979
* Basic: make the nan family pureSaleem Abdulrasool2017-10-172-15/+11
| | | | | | | | | | The nan family of math routines do not rely on global state. They do however depend on their parameter. This fits the description of pure: Functions which have no effects except the return value and their return value depends only on the parameters and/or global variables. Mark the family as `readonly`. llvm-svn: 315968
* [libclang] Add support for querying cursor availabilityJonathan Coe2017-10-162-0/+58
| | | | | | | | | | | | | | | | | | | | Summary: This patch allows checking the availability of cursors through libclang and clang.cindex (Python). This e.g. allows to check whether a C++ member function has been marked as deleted. Reviewers: arphaman, jbcoe Reviewed By: jbcoe Subscribers: cfe-commits Tags: #clang Patch by jklaehn (Johann Klähn) Differential Revision: https://reviews.llvm.org/D36973 llvm-svn: 315959
* [libclang] Visit attributes for function and class templatesJonathan Coe2017-10-163-2/+36
| | | | | | | | | | | | | | | | | | Summary: Previously, `VisitAttributes` was not called for function and class templates and thus their attributes were not accessible using libclang. Reviewers: bkramer, arphaman, rsmith, jbcoe Reviewed By: jbcoe Subscribers: cfe-commits Tags: #clang Patch by jklaehn (Johann Klähn) Differential Revision: https://reviews.llvm.org/D36955 llvm-svn: 315958
* Fix usage in TableGen of getValueAsStringErich Keane2017-10-161-28/+27
| | | | | | | | | | | | | | | Record::getValueAsString returns a stringref to an interned string (apparently had been changed since most of tablegen was written). In this patch, I audited the usage of getValueAsString to find places where we can trivially stop storing 'std::string' and instead keep the stringref. There was one instance where an unnecessary 'stringstream' was being used, so that has been removed as well to unblock the stringref replacing string fix. Differential Revision: https://reviews.llvm.org/D38979 llvm-svn: 315956
* Don't print end-of-directive tokens in -E outputReid Kleckner2017-10-162-0/+22
| | | | | | | | | | This comes up when pre-processing standalone .s files containing hash-prefixed comments. The pre-processor should skip the unknown directive and not emit an extra newline as we were doing. Fixes PR34950 llvm-svn: 315953
* Make __builtin_types_compatible_p more like GCC'sGeorge Burgess IV2017-10-162-3/+24
| | | | | | | | | | | GCC ignore qualifiers on array types. Since we seem to have this function primarily for GCC compatibility, we should try to match that behavior. This also adds a few more test-cases __builtin_types_compatible_p, which were inspired by GCC's documentation on the builtin. llvm-svn: 315951
* Replace usage of std::stringstream with raw_string_ostreamErich Keane2017-10-161-2/+3
| | | | | | | | Typically we don't use the stringstream, so instead use raw_string_stream. Additionally, the dependent function changed to use raw_ostream. llvm-svn: 315950
* Remove AnyX86Interrupt documentationErich Keane2017-10-162-55/+1
| | | | | | | | | This documentation was copied directly from the GCC documentaiton in r257867. Reverting and alterting the original author so that it can be rewritten in copyright-safe language. llvm-svn: 315934
* Sort Attributes by "HeaderName" Erich Keane2017-10-161-20/+36
| | | | | | | | | | | | | | Attributes in the docs were previously sorted (apparently) by the attribute name, so AnyX86Interrupt ended up being the first one, rather than in a meaningful place. This resulted in the 4 'interrupt' titled sections being all in different places. This replaces it with a naive alphabetical sort (case sensitive, underscore and special characters first, etc). Differential Revision: https://reviews.llvm.org/D38969 llvm-svn: 315931
* Clarify the 'interrupt' names in Attribute DocsErich Keane2017-10-161-0/+4
| | | | | | | All 4 of the 'interrupt' headers were automatically named 'interrupt'. This patch gives them unique names. llvm-svn: 315929
* [refactor] allow the use of refactoring diagnosticsAlex Lorenz2017-10-1618-34/+192
| | | | | | | | | This commit allows the refactoring library to use its own set of refactoring-specific diagnostics to reports things like initiation errors. Differential Revision: https://reviews.llvm.org/D38772 llvm-svn: 315924
* clang-refactor: Use llvm_unreachable in an unused overrideAlex Lorenz2017-10-161-1/+1
| | | | | | As suggested by David Blaikie! llvm-svn: 315923
* Do not link clang_rt.cfi on Android.Evgeniy Stepanov2017-10-163-27/+33
| | | | | | | | | | | | | | | Summary: The OS provides cross-dso CFI support starting with Android O. Trapping mode does not require any runtime at all, and diagnostic mode requires just ubsan-standalone. Reviewers: pcc Subscribers: srhines, cfe-commits Differential Revision: https://reviews.llvm.org/D38908 llvm-svn: 315921
* Recommit r315738 "[clang-refactor] Apply source replacements"Alex Lorenz2017-10-166-6/+198
| | | | | | | | | | | | | | | The fixed commit ensures that ParsedSourceRange works correctly with Windows paths. Original message: This commit actually brings clang-refactor to a usable state as it can now apply the refactoring changes to source files. The -selection option is now also fully supported. Differential Revision: https://reviews.llvm.org/D38402 llvm-svn: 315918
* [Bitfield] Add an option to access bitfield in a fine-grained manner.Wei Mi2017-10-167-2/+222
| | | | | | | | Currently all the consecutive bitfields are wrapped as a large integer unless there is unamed zero sized bitfield in between. The patch provides an alternative manner which makes the bitfield to be accessed as separate memory location if it has legal integer width and is naturally aligned. Such separate bitfield may split the original consecutive bitfields into subgroups of consecutive bitfields, and each subgroup will be wrapped as an integer. Now This is all controlled by an option -ffine-grained-bitfield-accesses. The alternative of bitfield access manner can improve the access efficiency of those bitfields with legal width and being aligned, but may reduce the chance of load/store combining of other bitfields, so it depends on how the bitfields are defined and actually accessed to choose when to use the option. For now the option is off by default. Differential revision: https://reviews.llvm.org/D36562 llvm-svn: 315915
* [CUDA] Require libdevice only if neededJonas Hahnfeld2017-10-166-14/+19
| | | | | | | | | If the user passes -nocudalib, we can live without it being present. Simplify the code by just checking whether LibDeviceMap is empty. Differential Revision: https://reviews.llvm.org/D38901 llvm-svn: 315902
* [clang-rename] Add function unit tests.Haojian Wu2017-10-164-0/+580
| | | | | | | | | | | | | | | | | Summary: Also contain a fix: * Fix a false positive of renaming a using shadow function declaration. Reviewers: ioeric Reviewed By: ioeric Subscribers: klimek, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D38882 llvm-svn: 315898
* [clang-format] Break non-trailing comments, try 2Krasimir Georgiev2017-10-166-1/+122
| | | | | | | | | | | | | | | | | | | | Summary: This patch enables `BreakableToken` to manage the formatting of non-trailing block comments. It is a refinement of https://reviews.llvm.org/D37007. We discovered that the optimizer outsmarts us on cases where breaking the comment costs considerably less than breaking after the comment. This patch addresses this by ensuring that a newline is inserted between a block comment and the next token. Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D37695 llvm-svn: 315893
* [Sema] Re-land: Diagnose tautological comparison with type's min/max valuesRoman Lebedev2017-10-159-297/+1032
| | | | | | | | | | | | | | | | | | | | | | | | | The first attempt, rL315614 was reverted because one libcxx test broke, and i did not know at the time how to deal with it. Summary: Currently, clang only diagnoses completely out-of-range comparisons (e.g. `char` and constant `300`), and comparisons of unsigned and `0`. But gcc also does diagnose the comparisons with the `std::numeric_limits<>::max()` / `std::numeric_limits<>::min()` so to speak Finally Fixes https://bugs.llvm.org/show_bug.cgi?id=34147 Continuation of https://reviews.llvm.org/D37565 Reviewers: rjmccall, rsmith, aaron.ballman Reviewed By: rsmith Subscribers: rtrieu, jroelofs, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D38101 llvm-svn: 315875
* Convert clang::LangAS to a strongly typed enumAlexander Richardson2017-10-1532-163/+179
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Convert clang::LangAS to a strongly typed enum Currently both clang AST address spaces and target specific address spaces are represented as unsigned which can lead to subtle errors if the wrong type is passed. It is especially confusing in the CodeGen files as it is not possible to see what kind of address space should be passed to a function without looking at the implementation. I originally made this change for our LLVM fork for the CHERI architecture where we make extensive use of address spaces to differentiate between capabilities and pointers. When merging the upstream changes I usually run into some test failures or runtime crashes because the wrong kind of address space is passed to a function. By converting the LangAS enum to a C++11 we can catch these errors at compile time. Additionally, it is now obvious from the function signature which kind of address space it expects. I found the following errors while writing this patch: - ItaniumRecordLayoutBuilder::LayoutField was passing a clang AST address space to TargetInfo::getPointer{Width,Align}() - TypePrinter::printAttributedAfter() prints the numeric value of the clang AST address space instead of the target address space. However, this code is not used so I kept the current behaviour - initializeForBlockHeader() in CGBlocks.cpp was passing LangAS::opencl_generic to TargetInfo::getPointer{Width,Align}() - CodeGenFunction::EmitBlockLiteral() was passing a AST address space to TargetInfo::getPointerWidth() - CGOpenMPRuntimeNVPTX::translateParameter() passed a target address space to Qualifiers::addAddressSpace() - CGOpenMPRuntimeNVPTX::getParameterAddress() was using llvm::Type::getPointerTo() with a AST address space - clang_getAddressSpace() returns either a LangAS or a target address space. As this is exposed to C I have kept the current behaviour and added a comment stating that it is probably not correct. Other than this the patch should not cause any functional changes. Reviewers: yaxunl, pcc, bader Reviewed By: yaxunl, bader Subscribers: jlebar, jholewinski, nhaehnle, Anastasia, cfe-commits Differential Revision: https://reviews.llvm.org/D38816 llvm-svn: 315871
* Fix test case regresstion from rL315864Martell Malone2017-10-151-1/+1
| | | | | | The patch should have been checking against STDCXX17 not STDCXX14. llvm-svn: 315868
* Driver: use ld64.lld when -fuse-ld=lld for darwinMartell Malone2017-10-151-1/+5
| | | | | | | | | | | | | | | | | | | When using lld on macOS the current level of detection between ld and ld64 forces us to rename lld to ld. For ELF targets we have the ld.lld alias so for MACHO we should have ld64.lld so we can use lld without replacing the system compiler. This also solves the additional issue of cross compiling for MACHO where renaming lld to ld with only target ELF. This is the clang driver component change to use this new alias. Reviewers: ruiu, rnk Differential Revision: https://reviews.llvm.org/D38290 llvm-svn: 315867
* [driver] [cl] Add/fix c++17/c++latestMartell Malone2017-10-152-2/+6
| | | | | | | | Patch by: daxpedda Differential Revision: https://reviews.llvm.org/D38123 llvm-svn: 315864
* Add -f[no-]double-square-bracket-attributes as new driver options to control ↵Aaron Ballman2017-10-1516-72/+393
| | | | | | use of [[]] attributes in all language modes. This is the initial implementation of WG14 N2165, which is a proposal to add [[]] attributes to C2x, but also allows you to enable these attributes in C++98, or disable them in C++11 or later. llvm-svn: 315856
* [Lex] Remove unused variables. No functionality change.Benjamin Kramer2017-10-152-9/+1
| | | | llvm-svn: 315845
* [c++2a] Fix failing regression test related to not adding the extension ↵Faisal Vali2017-10-152-3/+8
| | | | | | | | | | warning to a diagnostic group (in r315840) In passing also complete a comment that I left uncompleted. For ease of reference, here's the parent commit: https://reviews.llvm.org/rL315840 llvm-svn: 315842
* [c++2a] Implement P0306 __VA_OPT__ (Comma omission and comma deletion)Faisal Vali2017-10-1511-53/+715
| | | | | | | | | | | | | | | | | | | | | | | | | This patch implements an extension to the preprocessor: __VA_OPT__(contents) --> which expands into its contents if variadic arguments are supplied to the parent macro, or behaves as an empty token if none. - Currently this feature is only enabled for C++2a (this could be enabled, with some careful tweaks, for other dialects with the appropriate extension or compatibility warnings) - The patch was reviewed here: https://reviews.llvm.org/D35782 and asides from the above (and moving some of the definition and expansion recognition logic into the corresponding state machines), I believe I incorporated all of Richard's suggestions. A few technicalities (most of which were clarified through private correspondence between rsmith, hubert and thomas) are worth mentioning. Given: #define F(a,...) a #__VA_OPT__(a ## a) a ## __VA_OPT__(__VA_ARGS__) - The call F(,) Does not supply any tokens for the variadic arguments and hence VA_OPT behaves as a placeholder. - When expanding VA_OPT (for e.g. F(,1) token pasting occurs eagerly within its contents if the contents need to be stringified. - A hash or a hashhash prior to VA_OPT does not inhibit expansion of arguments if they are the first token within VA_OPT. - When a variadic argument is supplied, argument substitution occurs within the contents as does stringification - and these resulting tokens are inserted back into the macro expansions token stream just prior to the entire stream being rescanned and concatenated. See wg21.link/P0306 for further details on the feature. Acknowledgment: This patch would have been poorer if not for Richard Smith's usual thoughtful analysis and feedback. llvm-svn: 315840
* Revert "Mark test as unsupported until r315808 is fixed"Konstantin Zhuravlyov2017-10-141-1/+0
| | | | | | Test is fixed in r315830 llvm-svn: 315831
OpenPOWER on IntegriCloud