summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
* [ARM] Command-line options for embedded position-independent codeOliver Stannard2016-08-085-1/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch (with the corresponding ARM backend patch) adds support for some new relocation models: * Read-only position independence (ROPI): Code and read-only data is accessed PC-relative. The offsets between all code and RO data sections are known at static link time. * Read-write position independence (RWPI): Read-write data is accessed relative to a static base register. The offsets between all writeable data sections are known at static link time. These two modes are independent (they specify how different objects should be addressed), so they can be used individually or together. These modes are intended for bare-metal systems or systems with small real-time operating systems. They are designed to avoid the need for a dynamic linker, the only initialisation required is setting the static base register to an appropriate value for RWPI code. There is one C construct not currently supported by these modes: global variables initialised to the address of another global variable or function, where that address is not known at static-link time. There are a few possible ways to solve this: * Disallow this, and require the user to write their own initialisation function if they need variables like this. * Emit dynamic initialisers for these variables in the compiler, called from the .init_array section (as is currently done for C++ dynamic initialisers). We have a patch to do this, described in my original RFC email (http://lists.llvm.org/pipermail/llvm-dev/2015-December/093022.html), but the feedback from that RFC thread was that this is not something that belongs in clang. * Use a small dynamic loader to fix up these variables, by adding the difference between the load and execution address of the relevant section. This would require linker co-operation to generate a table of addresses that need fixing up. Differential Revision: https://reviews.llvm.org/D23196 llvm-svn: 278016
* [analyzer] Command line option to show enabled checker list.Gabor Horvath2016-08-089-6/+76
| | | | | | | | | | | | This patch adds a command line option to list the checkers that were enabled by analyzer-checker and not disabled by -analyzer-disable-checker. It can be very useful to debug long command lines when it is not immediately apparent which checkers are turned on and which checkers are turned off. Differential Revision: https://reviews.llvm.org/D23060 llvm-svn: 278006
* Fixes calculateRangesAfterReplacements crash when Replacements is empty.Eric Liu2016-08-082-0/+9
| | | | | | | | | | Reviewers: klimek, djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D23264 llvm-svn: 278004
* [analyzer] Model base to derived casts more precisely.Gabor Horvath2016-08-085-6/+46
| | | | | | | | | | | | | | Dynamic casts are handled relatively well by the static analyzer. BaseToDerived casts however are treated conservatively. This can cause some false positives with the NewDeleteLeaks checker. This patch alters the behavior of BaseToDerived casts. In case a dynamic cast would succeed use the same semantics. Otherwise fall back to the conservative approach. Differential Revision: https://reviews.llvm.org/D23014 llvm-svn: 277989
* Fix two bugs for musl-libc on ARMDiana Picus2016-08-082-2/+23
| | | | | | | | | | | | | | | Bug 1: triples like armv7-pc-linux-musl use the wrong linker name ld-musl-armv7.so.1; the right name should be ld-musl-arm.so.1, disregarding the subarch field. Bug 2: when compiler option -mhard-float is used, we should use the "hardfloat" linker, no matter whether the triple itself mentions "hardfloat". Patch by Lei Zhang! Differential Revision: https://reviews.llvm.org/D22904 llvm-svn: 277985
* Pass information in a record instead of stack. NFCSerge Pavlov2016-08-085-106/+105
| | | | | | | | | Functions of Sema that work with building of nested name specifiers have too many parameters (BuildCXXNestedNameSpecifier already expects 10 arguments). With this change the information about identifier and its context is packed into a structure, which is then passes to the semantic functions. llvm-svn: 277976
* [AVX512] integer comparisions enumeration.Asaf Badouh2016-08-073-39/+52
| | | | | | | | | | fix Bug 28842 https://llvm.org/bugs/show_bug.cgi?id=28842 Differential Revision: https://reviews.llvm.org/D22212 llvm-svn: 277955
* Update clang tests for LLVM r277950David Majnemer2016-08-071-2/+2
| | | | | | | We infer inbounds on GEPs of allocas leading to minor perturbations in tests. llvm-svn: 277953
* Add the new scan-build option (--show-description) in the 4.0 release notesSylvestre Ledru2016-08-061-0/+4
| | | | llvm-svn: 277935
* Headers: Add ARM support to intrin.h for MSVC compatibilitySaleem Abdulrasool2016-08-064-0/+54
| | | | | | | | | | | | | | | | | This fixes compiling with headers from the Windows SDK for ARM, where the YieldProcessor function (in winnt.h) refers to _ARM_BARRIER_ISHST. The actual MSVC armintr.h contains a lot more definitions, but this is enough to build code that uses the Windows SDK but doesn't use ARM intrinsics directly. An alternative would to just keep the addition to intrin.h (to include armintr.h), but not actually ship armintr.h, instead having clang's intrin.h include armintr.h from MSVC's include directory. (That one works fine with clang, at least for building code that uses the Windows SDK.) Patch by Martin Storsjö! llvm-svn: 277928
* [ASTReader] Use real move semantics instead of emulating them in the copy ctor.Benjamin Kramer2016-08-061-3/+3
| | | | | | No functionality change intended. llvm-svn: 277923
* [Sema] Make switch fully covered again.Benjamin Kramer2016-08-061-1/+2
| | | | llvm-svn: 277920
* Move helpers into anonymous namespaces. NFC.Benjamin Kramer2016-08-063-3/+6
| | | | llvm-svn: 277918
* [StaticAnalyzer] Remove dead code.Benjamin Kramer2016-08-062-48/+0
| | | | llvm-svn: 277917
* [NFC] Silence noisy -Wreturn-type warningsErik Pilkington2016-08-061-1/+1
| | | | llvm-svn: 277906
* Fix typos from r277797 and unused variable from r277889.Richard Trieu2016-08-062-7/+4
| | | | llvm-svn: 277900
* Fix two false positives in -Wreturn-stack-addressRichard Trieu2016-08-052-1/+76
| | | | | | | | | | | If the return type is a pointer and the function returns the reference to a pointer, don't warn since only the value is returned, not the reference. If a reference function parameter appears in the reference chain, don't warn since binding happens at the caller scope, so addresses returned are not to local stack. This includes default arguments as well. llvm-svn: 277889
* [NFC][ObjC Availability] Refactor DiagnoseAvailabilityOfDeclErik Pilkington2016-08-055-98/+101
| | | | | | Differential revision: https://reviews.llvm.org/D23221 llvm-svn: 277887
* [clang-tblgen] Remove unused #include (NFC)Vedant Kumar2016-08-051-1/+0
| | | | llvm-svn: 277885
* Fix false positive in -Wunsequenced and templates.Richard Trieu2016-08-052-1/+57
| | | | | | | | | | | | | | For builtin logical operators, there is a well-defined ordering of argument evaluation. For overloaded operator of the same type, there is no argument evaluation order, similar to other function calls. When both are present, uninstantiated templates with an operator&& is treated as an unresolved function call. Unresolved function calls are treated as normal function calls, and may result in false positives when the builtin logical operator is used. Have the unsequenced checker ignore dependent expressions to avoid this false positive. The check also happens in template instantiations to catch when the overloaded operator is used. llvm-svn: 277866
* PR26423: Assert on valid use of using declaration of a function with an ↵David Blaikie2016-08-052-4/+32
| | | | | | | | | | | | undeduced auto return type For now just disregard the using declaration in this case. Suboptimal, but wiring up the ability to have declarations of functions that are separate from their definition (we currently only do that for member functions) and have differing return types (we don't have any support for that) is more work than seems reasonable to at least fix this crash. llvm-svn: 277852
* [SemaOpenMP] Some miscellaneous cleanupsDavid Majnemer2016-08-051-142/+139
| | | | | | | | Clean up some typos, follow the coding style a little more rigorously. No functionality change is intended. llvm-svn: 277840
* Revert "[Sema] Add sizeof diagnostics for bzero"Bruno Cardoso Lopes2016-08-053-54/+3
| | | | | | This reverts commit r277787, which caused PR28870. llvm-svn: 277830
* AMDGPU : Add Clang builtin intrinsics for compare with the fullWei Ding2016-08-054-0/+89
| | | | | | | | wavefront result. Differential Revision: http://reviews.llvm.org/D22934 llvm-svn: 277824
* [OpenMP] Sema and parsing for 'teams distribute' pragmaKelvin Li2016-08-0536-13/+3543
| | | | | | | | This patch is to implement sema and parsing for 'teams distribute' pragma. Differential Revision: https://reviews.llvm.org/D23189 llvm-svn: 277818
* Reapply r276973 "Adjust Registry interface to not require plugins to export ↵John Brawn2016-08-057-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a registry" This differs from the previous version by being more careful about template instantiation/specialization in order to prevent errors when building with clang -Werror. Specifically: * begin is not defined in the template and is instead instantiated when Head is. I think the warning when we don't do that is wrong (PR28815) but for now at least do it this way to avoid the warning. * Instead of performing template specializations in LLVM_INSTANTIATE_REGISTRY instead provide a template definition then do explicit instantiation. No compiler I've tried has problems with doing it the other way, but strictly speaking it's not permitted by the C++ standard so better safe than sorry. Original commit message: Currently the Registry class contains the vestiges of a previous attempt to allow plugins to be used on Windows without using BUILD_SHARED_LIBS, where a plugin would have its own copy of a registry and export it to be imported by the tool that's loading the plugin. This only works if the plugin is entirely self-contained with the only interface between the plugin and tool being the registry, and in particular this conflicts with how IR pass plugins work. This patch changes things so that instead the add_node function of the registry is exported by the tool and then imported by the plugin, which solves this problem and also means that instead of every plugin having to export every registry they use instead LLVM only has to export the add_node functions. This allows plugins that use a registry to work on Windows if LLVM_EXPORT_SYMBOLS_FOR_PLUGINS is used. llvm-svn: 277806
* Fix crash in template type diffing.Richard Trieu2016-08-052-0/+36
| | | | | | | | | When the type being diffed is a type alias, and the orginal type is not a templated type, then there will be no unsugared TemplateSpecializationType. When this happens, exit early from the constructor. Also add assertions to the other iterator accessor to prevent the iterator from being used. llvm-svn: 277797
* Allow -1 to assign max value to unsigned bitfields.Richard Trieu2016-08-053-1/+19
| | | | | | | | Silence the -Wbitfield-constant-conversion warning for when -1 or other negative values are assigned to unsigned bitfields, provided that the bitfield is wider than the minimum number of bits needed to encode the negative value. llvm-svn: 277796
* [Sema] Add sizeof diagnostics for bzeroBruno Cardoso Lopes2016-08-043-3/+54
| | | | | | | | | | | | | | | | | | | | | | | | | For memset (and others) we can get diagnostics like: struct stat { int x; }; void foo(struct stat *stamps) { bzero(stamps, sizeof(stamps)); memset(stamps, 0, sizeof(stamps)); } t.c:7:28: warning: 'memset' call operates on objects of type 'struct stat' while the size is based on a different type 'struct stat *' [-Wsizeof-pointer-memaccess] memset(stamps, 0, sizeof(stamps)); ~~~~~~ ^~~~~~ t.c:7:28: note: did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)? memset(stamps, 0, sizeof(stamps)); ^~~~~~ This patch implements the same class of warnings for bzero. Differential Revision: https://reviews.llvm.org/D22525 rdar://problem/18963514 llvm-svn: 277787
* [ADT] Migrate DepthFirstIterator to use NodeRefTim Shen2016-08-043-0/+5
| | | | | | | | | | | | Summary: The corresponding LLVM change is D23146. Reviewers: dblaikie, chandlerc Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D23147 llvm-svn: 277783
* [analyzer] Make CloneDetector recognize different variable patterns.Artem Dergachev2016-08-043-25/+152
| | | | | | | | | | | | | | | | | CloneDetector should be able to detect clones with renamed variables. However, if variables are referenced multiple times around the code sample, the usage patterns need to be recognized. For example, (x < y ? y : x) and (y < x ? y : x) are no longer clones, however (a < b ? b : a) is still a clone of the former. Variable patterns are computed and compared during a separate filtering pass. Patch by Raphael Isemann! Differential Revision: https://reviews.llvm.org/D22982 llvm-svn: 277757
* [OpenCL] Add the lit test for image size which was omitted by r277647.Yaxun Liu2016-08-041-0/+18
| | | | llvm-svn: 277756
* [OpenCL] Remove extra native_ functions from opencl-c.hYaxun Liu2016-08-041-112/+0
| | | | | | | | | | There should be no native_ builtin functions with double type arguments. Patch by Aaron En Ye Shi. Differential Revision : https://reviews.llvm.org/D23071 llvm-svn: 277754
* [OpenCL] Added underscores to the names of 'to_addr' OpenCL built-ins.Alexey Bader2016-08-042-16/+17
| | | | | | | | | | | | | | | Summary: In order to re-define OpenCL built-in functions 'to_{private,local,global}' in OpenCL run-time library LLVM names must be different from the clang built-in function names. Reviewers: yaxunl, Anastasia Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D23120 llvm-svn: 277743
* Make isExternC work on VarDecls too.Benjamin Kramer2016-08-043-1/+20
| | | | llvm-svn: 277712
* After PR28761 use -Wall with -Werror in builtins tests to identifyEric Christopher2016-08-0433-61/+61
| | | | | | possible problems in headers. llvm-svn: 277696
* [Concepts] remove default argument for RequiresClause; NFCHubert Tong2016-08-031-2/+1
| | | | llvm-svn: 277658
* [OpenCL] Fix size of image typeYaxun Liu2016-08-036-18/+19
| | | | | | | | | | The size of image type is reported incorrectly as size of a pointer to address space 0, which causes error when casting image type to pointers by __builtin_astype. The fix is to get image address space from TargetInfo then report the size accordingly. Differential Revision: https://reviews.llvm.org/D22927 llvm-svn: 277647
* Fix bug in conflict check for Replacements::add().Manuel Klimek2016-08-032-7/+28
| | | | | | | We would not detect conflicts when inserting insertions at the same offset as previously contained replacements. llvm-svn: 277603
* Fix quadratic runtime when adding items to tooling::Replacements.Manuel Klimek2016-08-032-18/+90
| | | | | | | | | | | Previously, we would search through all replacements when inserting a new one to check for overlaps. Instead, make use of the fact that we already have a set of replacments without overlaps to find the potential overlap with lower_bound. Differential Revision: https://reviews.llvm.org/D23119 llvm-svn: 277597
* [clang/test] Fix a flaky unittest on windowsEtienne Bergeron2016-08-031-4/+10
| | | | | | | | | | | | | | | | | | | | Summary: The append operator on a shell command for quick command-line is causing trouble on windows. [NFC] The easiest way to fix them is to avoid using them. This patch is an attempt to fix this broken build bot: clang-x86-win2008-selfhost http://lab.llvm.org:8011/builders/clang-x86-win2008-selfhost/builds/9523 Reviewers: rnk Subscribers: cfe-commits, chrisha Differential Revision: https://reviews.llvm.org/D23105 llvm-svn: 277576
* [index] Fix crash with indexing designated init expressions inside templates.Argyrios Kyrtzidis2016-08-032-1/+13
| | | | | | rdar://27452869 llvm-svn: 277570
* [CUDA] Updated CUDA tests that must run w/o CUDA installation.Artem Belevich2016-08-024-11/+11
| | | | | | | Fixes test failures after r277542 on systems that don't have CUDA installed. llvm-svn: 277552
* [analyzer] Update two comments in MPI-Checker. NFC.Devin Coughlin2016-08-022-7/+4
| | | | | | | | | | Correct two comments that do not match the current behavior of the checker. A patch by Alexander Droste! Differential Revision: https://reviews.llvm.org/D22670 llvm-svn: 277547
* [CUDA] Fix libdevice selection.Artem Belevich2016-08-024-26/+74
| | | | | | | | | | | This makes clang's libdevice selection match that of NVCC as described in http://docs.nvidia.com/cuda/libdevice-users-guide/basic-usage.html#version-selection If required libdevice variant is not found, driver now fails with an error. Differential Revision: https://reviews.llvm.org/D23037 llvm-svn: 277542
* [CUDA] Do not allow using NVPTX target for host compilation.Artem Belevich2016-08-025-13/+20
| | | | | | Differential Revision: https://reviews.llvm.org/D23042 llvm-svn: 277537
* [CFG] Fix crash finding destructor of lifetime-extended temporary.Devin Coughlin2016-08-022-1/+26
| | | | | | | | | | | Fix a crash under -Wthread-safety when finding the destructor for a lifetime-extending reference. A patch by Nandor Licker! Differential Revision: https://reviews.llvm.org/D22419 llvm-svn: 277522
* Revert "[Order Files] Remove dtrace predicate"Chris Bieneman2016-08-021-1/+2
| | | | | | | | This reverts commit r277487. Removing the probe predicate was a red herring. It results in more symbols being placed in the final order file, but they are symbols from outside the clang image. llvm-svn: 277492
* Update Clang Parser test error message to match new parser errorsNirav Dave2016-08-021-1/+1
| | | | | | Update clang tests in light of r277489. llvm-svn: 277490
* Updated documentationVitaly Buka2016-08-021-1/+2
| | | | | | | | | | Reviewers: kcc, eugenis Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D22992 llvm-svn: 277488
OpenPOWER on IntegriCloud