summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* [analyzer] NFC: Remove unused parameteer of StoreManager::CastRetrievedVal().Artem Dergachev2018-05-042-17/+5
| | | | llvm-svn: 331496
* [CodeGenFunction] Use the StringRef::split function that takes a char ↵Craig Topper2018-05-031-2/+2
| | | | | | | | separator instead of StringRef separator. NFC The char separator version should be a little better optimized. llvm-svn: 331482
* Allow writing calling convention attributes on function types.Aaron Ballman2018-05-031-4/+9
| | | | | | Calling convention attributes notionally appertain to the function type -- they modify the mangling of the function, change the behavior of assignment operations, etc. This commit allows the calling convention attributes to be written in the type position as well as the declaration position. llvm-svn: 331459
* Rename invariant.group.barrier to launder.invariant.groupPiotr Padlewski2018-05-033-7/+7
| | | | | | | | | | | | | | Summary: This is one of the initial commit of "RFC: Devirtualization v2" proposal: https://docs.google.com/document/d/16GVtCpzK8sIHNc2qZz6RN8amICNBtvjWUod2SujZVEo/edit?usp=sharing Reviewers: rsmith, amharc, kuhar, sanjoy Subscribers: arsenm, nhaehnle, javed.absar, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D45111 llvm-svn: 331448
* Enable -fsanitize=function on FreeBSD.Fangrui Song2018-05-031-0/+1
| | | | llvm-svn: 331440
* Fix -Wunused-variable warning in Clang.cppKarl-Johan Karlsson2018-05-031-1/+1
| | | | llvm-svn: 331438
* Track the result of evaluating a computed noexcept specification on theRichard Smith2018-05-0328-335/+236
| | | | | | | | | | | | | | FunctionProtoType. We previously re-evaluated the expression each time we wanted to know whether the type is noexcept or not. We now evaluate the expression exactly once. This is not quite "no functional change": it fixes a crasher bug during AST deserialization where we would try to evaluate the noexcept specification in a situation where we have not deserialized sufficient portions of the AST to permit such evaluation. llvm-svn: 331428
* [Sema] Do not match function type with const T in template argument deductionLei Liu2018-05-031-0/+6
| | | | | | | | | | | From http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1584, function type should not match cv-qualified type in template argument deduction. This also matches what GCC and EDG do in template argument deduction. Differential Revision: https://reviews.llvm.org/D45755 llvm-svn: 331424
* [ObjC] Supress the 'implementing unavailable method' warning whenAlex Lorenz2018-05-032-5/+18
| | | | | | | | | | | | | the method declaration is unavailable for an app extension platform Rationale: Classes are often shared between an app extension code and non-app extension code. There's no way to remove the implementation using preprocessor when building the app extension, so we should not warn here. rdar://38150617 llvm-svn: 331421
* [ObjC] The absence of ownership qualifiers on an ambiguous property leadsAlex Lorenz2018-05-021-4/+14
| | | | | | | | | to synthesis of a valid property even when the selected protocol property has ownership qualifiers rdar://39024725 llvm-svn: 331409
* [analyzer] Revert r331096 "CStringChecker: Add support for BSD strlcpy()...".Artem Dergachev2018-05-021-39/+2
| | | | | | | | | The return values of the newly supported functions were not handled correctly: strlcpy()/strlcat() return string sizes rather than pointers. Differential Revision: https://reviews.llvm.org/D45177 llvm-svn: 331401
* [OPENMP] Add support for reductions on simd directives in targetAlexey Bataev2018-05-021-11/+47
| | | | | | | | regions. Added codegen for `simd reduction()` constructs in target directives. llvm-svn: 331393
* Revert "Emit an error when mixing <stdatomic.h> and <atomic>"Volodymyr Sapsai2018-05-021-4/+0
| | | | | | | | | | | | | It reverts r331378 as it caused test failures ThreadSanitizer-x86_64 :: Darwin/gcd-groups-destructor.mm ThreadSanitizer-x86_64 :: Darwin/libcxx-shared-ptr-stress.mm ThreadSanitizer-x86_64 :: Darwin/xpc-race.mm Only clang part of the change is reverted, libc++ part remains as is because it emits error less aggressively. llvm-svn: 331392
* [Driver] Infer Android sysroot location.Dan Albert2018-05-021-0/+9
| | | | | | | | | | | | | | | | Summary: Android toolchains include their headers and libraries in a self-contained directory within the toolchain. Reviewers: srhines Reviewed By: srhines Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D45291 llvm-svn: 331390
* [Driver] Obey computed sysroot when finding libc++ headers.Dan Albert2018-05-021-2/+3
| | | | | | | | | | | | | | | | Summary: A handful of targets will try some default paths if --sysroot is not provided. If that is the case, it should be used for the libc++ header paths. Reviewers: srhines, EricWF Reviewed By: srhines Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D45292 llvm-svn: 331389
* [OPENMP] Analyze the type of the mapped entity instead of its base.Alexey Bataev2018-05-021-1/+8
| | | | | | | If the mapped entity is a data member, we erroneously checked the type of its base rather than the type of the mapped entity itself. llvm-svn: 331385
* Emit an error when mixing <stdatomic.h> and <atomic>Volodymyr Sapsai2018-05-021-0/+4
| | | | | | | | | | | | | | | | | | | | | Atomics in C and C++ are incompatible at the moment and mixing the headers can result in confusing error messages. Emit an error explicitly telling about the incompatibility. Introduce the macro `__ALLOW_STDC_ATOMICS_IN_CXX__` that allows to choose in C++ between C atomics and C++ atomics. rdar://problem/27435938 Reviewers: rsmith, EricWF, mclow.lists Reviewed By: mclow.lists Subscribers: jkorous-apple, christof, bumblebritches57, JonChesterfield, smeenai, cfe-commits Differential Revision: https://reviews.llvm.org/D45470 llvm-svn: 331378
* [OPENMP] Do not emit warning for implicitly declared target functions.Alexey Bataev2018-05-021-14/+16
| | | | | | | Since upcoming OpenMP 5.0 functions can be mapped implicitly as declare target and we should not emit warnings for such functions. llvm-svn: 331377
* [OPENMP] Enable c++ exceptions outside of the target constructs iff they areAlexey Bataev2018-05-023-2/+11
| | | | | | | | | | enabled for the host. If the compilation for the host enables C++ exceptions, but they are not supported by the device, we still need to allow the code with the exception handling constructs outside of the target regions. llvm-svn: 331372
* Add -foutline option to enable the MachineOutliner in AArch64Jessica Paquette2018-05-021-0/+5
| | | | | | | | | | | | | Since we've been working on productizing the MachineOutliner in AArch64, it makes sense to provide a more user-friendly way to enable it. This allows users of AArch64 to enable the outliner using -foutline instead of -mllvm -enable-machine-outliner. Other, less mature implementations (e.g, x86-64) can still enable the pass using the -mllvm option. Also add a test to make sure it works. llvm-svn: 331370
* [OPENMP] Support C++ member functions in the device constructs.Alexey Bataev2018-05-023-12/+5
| | | | | | | Added correct emission of the C++ member functions for the device function when they are used in the device constructs. llvm-svn: 331365
* [analyzer] Fix filename in cross-file HTML reportMalcolm Parsons2018-05-021-1/+3
| | | | | | | | | | | | | | | | | Summary: The filename is currently taken from the start of the path, while the line and column are taken from the end of the path. This didn't matter until cross-file path reporting was added. Reviewers: george.karpenkov, dcoughlin, vlad.tsyrklevich Reviewed By: george.karpenkov, vlad.tsyrklevich Subscribers: xazax.hun, szepet, a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D45611 llvm-svn: 331361
* [OPENMP] Emit names of the globals depending on target.Alexey Bataev2018-05-023-74/+130
| | | | | | | | Some symbols are not allowed to be used as names on some targets. Patch ries to unify the emission of the names of LLVM globals so they could be used on different targets. llvm-svn: 331358
* [analyzer] Add `TaintBugVisitor` to the ArrayBoundV2, DivideZero and VLASize.Henry Wong2018-05-023-25/+31
| | | | | | | | | | | | | | Summary: Add `TaintBugVisitor` to the ArrayBoundV2, DivideZero, VLASize to be able to indicate where the taint information originated from. Reviewers: NoQ, george.karpenkov, xazax.hun, a.sidorin Reviewed By: NoQ Subscribers: szepet, rnkovacs, cfe-commits, MTC Differential Revision: https://reviews.llvm.org/D46007 llvm-svn: 331345
* [ASTImporter] Fix isa cast assertPeter Szecsi2018-05-021-3/+7
| | | | | | | | | | | | | | | | | | | | | | | Do early return if we can't import the found decl for a member expr. This follows the pre-existing scheme, e.g with E->getMemberDecl(). E->getFoundDecl().getDecl() can be null when a member expression does not involve lookup. It may involve a lookup in case of a using directive which refers to a member function in a base class template. We faced this assert during the CTU analysis of google::protobuf v3.5.2. We tried hard to synthesize a minimal test example both by hand and by executing creduce on multiple files. Unfortunately, we were unable to reduce to such a minimal example, yet. Nevertheless, this fix solved the problem in protobuf. To reproduce the error one must execute the analyzer with -Xclang -analyzer-config -Xclang experimental-enable-naive-ctu-analysis=true -Xclang -analyzer-config -Xclang ctu-dir=/path/to/ctu_dir Patch by Gabor Marton! Differential Revision: https://reviews.llvm.org/D46019 llvm-svn: 331344
* [Modules] Allow @import to reach submodules in private module mapsBruno Cardoso Lopes2018-05-021-0/+20
| | | | | | | | | | | | | | | | | | | | A @import targeting a top level module from a private module map file (@import Foo_Private), would fail if there's any submodule declaration around (module Foo.SomeSub) in the same private module map. This happens because compileModuleImpl, when building Foo_Private, will start with the private module map and will not parse the public one, which leads to unsuccessful parsing of Foo.SomeSub, since top level Foo was never parsed. Declaring other submodules in the private module map is not common and should usually be avoided, but it shouldn't fail to build. Canonicalize compileModuleImpl to always look at the public module first, so that all necessary information is available when parsing the private one. rdar://problem/39822328 llvm-svn: 331322
* Track skipped files in dependency scanning.Volodymyr Sapsai2018-05-011-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | It's possible for a header to be a symlink to another header. In this case both will be represented by clang::FileEntry with the same UID and they'll use the same clang::HeaderFileInfo. If you include both headers and use some single-inclusion mechanism like a header guard or #import, one header will get a FileChanged callback, and another FileSkipped. So that we get an accurate dependency file, we therefore need to also implement the FileSkipped callback in dependency scanning. Patch by Pete Cooper. Reviewers: bruno, pete Reviewed By: bruno Subscribers: cfe-commits, jkorous, vsapsai Differential Revision: https://reviews.llvm.org/D30881 llvm-svn: 331319
* Fix bogus MSVC char8_t mangling.Richard Smith2018-05-011-1/+1
| | | | | | | This appears to have been caused by a bad automatic svn merge with r330225 attaching the 'case' label to the wrong block of code. :( llvm-svn: 331299
* Driver: fix an assertion with `-print-prog-name=`Saleem Abdulrasool2018-05-011-1/+7
| | | | | | | | | Fix an assertion when -print-prog-name= is invoked without parameter. Returns an empty string. Patch by Christian Bruel! llvm-svn: 331296
* Add Microsoft Mangling for OpenCL Half TypeErich Keane2018-05-011-2/+5
| | | | | | | | | | | | Half-type mangling is accomplished following the method introduced by Erich Keane for mangling _Float16. Updated the half.cl LIT test to cover this particular case. Patch By: vbridgers Differential Revision: https://reviews.llvm.org/D46131 llvm-svn: 331263
* [OPENMP] Emit template instatiation|specialization functions forAlexey Bataev2018-05-011-1/+10
| | | | | | | | | | devices. If the function is an instantiation|specialization of the template and is used in the device code, the definitions of such functions should be emitted for the device. llvm-svn: 331261
* [X86] directstore and movdir64b intrinsicsGabor Buella2018-05-017-0/+83
| | | | | | | | | | Reviewers: spatel, craig.topper, RKSimon Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D45984 llvm-svn: 331249
* Implement P0482R2, support for char8_t type.Richard Smith2018-05-0133-19/+143
| | | | | | | | | | | | This is not yet part of any C++ working draft, and so is controlled by the flag -fchar8_t rather than a -std= flag. (The GCC implementation is controlled by a flag with the same name.) This implementation is experimental, and will be removed or revised substantially to match the proposal as it makes its way through the C++ committee. llvm-svn: 331244
* [Modules] Handle ObjC/C ODR-like semantics for EnumConstantDeclBruno Cardoso Lopes2018-04-301-4/+20
| | | | | | | | | | | | | | Support for ObjC/C ODR-like semantics with structural equivalence checking was added back in r306918. There enums are handled and also checked for structural equivalence. However, at use time of EnumConstantDecl, support was missing for preventing ambiguous name lookup. Add the missing bits for properly merging EnumConstantDecl. rdar://problem/38374569 llvm-svn: 331232
* [CodeGen] Fix typo in comment form->from. NFCCraig Topper2018-04-301-1/+1
| | | | llvm-svn: 331231
* AMDGPU: Add Vega12 and Vega20Matt Arsenault2018-04-302-2/+10
| | | | | | | | Changes by Matt Arsenault Konstantin Zhuravlyov llvm-svn: 331216
* [OPENMP] Do not emit warning about non-declared target function params.Alexey Bataev2018-04-301-1/+1
| | | | | | | | We should not emit warning that the parameters are not marked as declare target, these declaration are local and cannot be marked as declare target. llvm-svn: 331211
OpenPOWER on IntegriCloud