summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix use of invalidated iterator introduced by r369680.Richard Smith2019-08-261-4/+4
| | | | llvm-svn: 369932
* [NFC] Add comments to some bool arguments for better readabilityGabor Horvath2019-08-261-4/+8
| | | | llvm-svn: 369928
* Fix -dA flag, it is not a preprocessor flag.Erich Keane2019-08-261-2/+1
| | | | | | | | | -dA was in the d_group, which is a preprocessor state dumping group. However -dA is a debug flag to cause a verbose asm. It was already implemented to do the same thing as -fverbose-asm, so make it just be an alias. llvm-svn: 369926
* clang-format: [JS] handle `as const`.Martin Probst2019-08-261-0/+4
| | | | | | | | | | | | | | | | | | | | Summary: TypeScript 3.4 supports casting into a const type using `as const`: const x = {x: 1} as const; Previously, clang-format would insert a space after the `const`. With this patch, no space is inserted after the sequence `as const`. Reviewers: krasimir Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66736 llvm-svn: 369916
* FileManager: Factor duplicated code in getBufferForFile, NFCDuncan P. N. Exon Smith2019-08-251-11/+6
| | | | | | | Incidentally, this also unifies the two versions (removing an unnecessary call to `SmallString::c_str`). llvm-svn: 369861
* [OpenCL] Microoptimize OCL2Qual a bitBenjamin Kramer2019-08-241-11/+10
| | | | | | Still not optimal, but makes clang 25k smaller. llvm-svn: 369846
* [analyzer] Analysis: Fix checker silencingCsaba Dabis2019-08-241-24/+27
| | | | llvm-svn: 369845
* PR42513: Enter the proper DeclContext before substituting into anRichard Smith2019-08-241-0/+1
| | | | | | | | | | | | default template argument expression. We already did this for type template parameters and template template parameters, but apparently forgot to do so for non-type template parameters. This causes the substituted default argument expression to be substituted in the proper context, and in particular to properly mark its subexpressions as odr-used. llvm-svn: 369834
* PR40674: fix assertion failure if a structured binding declaration has aRichard Smith2019-08-241-1/+2
| | | | | | | tuple-like decomposition that produces value-dependent reference bindings. llvm-svn: 369829
* [LifetimeAnalysis] Make it possible to disable the new warningsGabor Horvath2019-08-231-38/+70
| | | | llvm-svn: 369817
* Do a sweep of symbol internalization. NFC.Benjamin Kramer2019-08-234-7/+10
| | | | llvm-svn: 369803
* [OPENMP5]Use nonmonotonic modifier by default for non-static andAlexey Bataev2019-08-231-8/+21
| | | | | | | | | | non-ordered loops. According to OpenMP 5.0, 2.9.2 Worksharing-Loop Construct, Desription, If the static schedule kind is specified or if the ordered clause is specified, and if the nonmonotonic modifier is not specified, the effect is as if the monotonic modifier is specified. Otherwise, unless the monotonic modifier is specified, the effect is as if the nonmonotonic modifier is specified. The first part of this requirement is implemented in runtime. Patch adds support for the second, nonmonotonic, part of this requirement. llvm-svn: 369801
* [Sema] Don't warn on printf('%hd', [char]) (PR41467)Nathan Huckleberry2019-08-232-2/+8
| | | | | | | | | | | | | | | | Summary: Link: https://bugs.llvm.org/show_bug.cgi?id=41467 Reviewers: rsmith, nickdesaulniers, aaron.ballman, lebedev.ri Reviewed By: nickdesaulniers, aaron.ballman, lebedev.ri Subscribers: lebedev.ri, nickdesaulniers, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66186 llvm-svn: 369791
* Fixed a typo.Artem Belevich2019-08-231-1/+1
| | | | llvm-svn: 369777
* [OPENMP5.0]Add support for device_type clause in declare targetAlexey Bataev2019-08-2311-83/+434
| | | | | | | | | | construct. OpenMP 5.0 introduced new clause for declare target directive, device_type clause, which may accept values host, nohost, and any. Host means that the function must be emitted only for the host, nohost - only for the device, and any - for both, device and the host. llvm-svn: 369775
* [NFC] Move some variable declarations into their 'if' conditions.Erich Keane2019-08-231-9/+7
| | | | | | | | A couple of variables are being declared outside of the 'if' condition that is their only actual use. Additionally, switch a few 'const TYPE *' to 'const auto *' for consistency. llvm-svn: 369773
* [analyzer] Avoid unnecessary enum range check on LValueToRValue castsKristof Umann2019-08-231-0/+16
| | | | | | | | | | | | | | | | Summary: EnumCastOutOfRangeChecker should not perform enum range checks on LValueToRValue casts, since this type of cast does not actually change the underlying type. Performing the unnecessary check actually triggered an assertion failure deeper in EnumCastOutOfRange for certain input (which is captured in the accompanying test code). Reviewers: #clang, Szelethus, gamesh411, NoQ Reviewed By: Szelethus, gamesh411, NoQ Subscribers: NoQ, gamesh411, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, Charusso, bjope, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66014 llvm-svn: 369760
* clang-format: Disable across-block include reordering.Nico Weber2019-08-231-0/+21
| | | | | | Differential Revision: https://reviews.llvm.org/D66650 llvm-svn: 369759
* [clang-format] Recognize ECMAScript module .mjs as JavaScriptFangrui Song2019-08-231-2/+3
| | | | | | | | | | | | | | PR43085. Recognize .mjs files as JavaScript. .mjs is the extension for ECMAScript modules. A specific extension (and associated content type javascript/esm) is introduced to differentiate it from CommonJS modules and solve some interoperability problems. Differential Revision: https://reviews.llvm.org/D66584 Patch by Fergal Daly llvm-svn: 369732
* [analyzer] CastValueChecker: Correctly model results of based-to-derived casts.Artem Dergachev2019-08-231-9/+27
| | | | | | | | | | Our SVal hierarchy doesn't allow modeling pointer casts as no-op. The pointer type is instead encoded into the pointer object. Defer to our usual pointer casting facility, SValBuilder::evalBinOp(). Fixes a crash. llvm-svn: 369729
* [analyzer] CastValueChecker: Provide DynamicTypeMap with pointer types only.Artem Dergachev2019-08-232-28/+26
| | | | | | | | | The idea to drop this requirement is good, but for now every other user of DynamicTypeInfo expects pointer types. Fixes a crash. llvm-svn: 369728
* [analyzer] CastValueChecker: Avoid modeling casts between objects.Artem Dergachev2019-08-231-2/+7
| | | | | | | | | Our method only works correctly when casting a pointer to a pointer or a reference to a reference. Fixes a crash. llvm-svn: 369727
* [analyzer] DynamicTypeInfo: Avoid putting null regions into dynamic typemap.Artem Dergachev2019-08-231-0/+3
| | | | | | Fixes a crash. llvm-svn: 369726
* Revert "PR42587: diagnose unexpanded uses of a pack parameter of a generic" ↵Richard Smith2019-08-232-10/+3
| | | | | | | | due to buildbot breakage. This reverts commit r369722. llvm-svn: 369725
* PR42587: diagnose unexpanded uses of a pack parameter of a genericRichard Smith2019-08-232-3/+10
| | | | | | lambda from within the lambda-declarator. llvm-svn: 369722
* [clang][ifs] Dropping older experimental interface stub formats.Puyan Lotfi2019-08-224-164/+37
| | | | | | | | | | | | I've been working on a new tool, llvm-ifs, for merging interface stub files generated by clang and I've iterated on my derivative format of TBE to a newer format. llvm-ifs will only support the new format, so I am going to drop the older experimental interface stubs formats in this commit to make things simpler. Differential Revision: https://reviews.llvm.org/D66573 llvm-svn: 369719
* [clang][ifs] New interface stubs format (llvm triple based).Puyan Lotfi2019-08-224-0/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | After posting llvm-ifs on phabricator, I made some progress in hardening up how I think the format for Interface Stubs should look. There are a number of things I think the TBE format was missing (no endianness, no info about the Object Format because it assumes ELF), so I have added those and broken off from being as similar to the TBE schema. In a subsequent commit I can drop the other formats. An example of how The format will look is as follows: --- !experimental-ifs-v1 IfsVersion: 1.0 Triple: x86_64-unknown-linux-gnu ObjectFileFormat: ELF Symbols: _Z9nothiddenv: { Type: Func } _Z10cmdVisiblev: { Type: Func } ... The format is still marked experimental. Differential Revision: https://reviews.llvm.org/D66446 llvm-svn: 369715
* [Clang][CodeGen] set alias linkage on QualTypeNick Desaulniers2019-08-221-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: It seems that CodeGen was always using ExternalLinkage when emitting a GlobalDecl with __attribute__((alias)). This leads to symbol redefinitions (ODR) that cause failures at link time for static aliases. This is readily attempting to link an ARM (32b) allyesconfig Linux kernel built with Clang. Reported-by: nathanchance Suggested-by: ihalip Link: https://bugs.llvm.org/show_bug.cgi?id=42377 Link: https://github.com/ClangBuiltLinux/linux/issues/631 Reviewers: rsmith, aaron.ballman, erichkeane Reviewed By: aaron.ballman Subscribers: javed.absar, kristof.beyls, cfe-commits, srhines, ihalip, nathanchance Tags: #clang Differential Revision: https://reviews.llvm.org/D66492 llvm-svn: 369705
* IR. Change strip* family of functions to not look through aliases.Peter Collingbourne2019-08-221-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | I noticed another instance of the issue where references to aliases were being replaced with aliasees, this time in InstCombine. In the instance that I saw it turned out to be only a QoI issue (a symbol ended up being missing from the symbol table due to the last reference to the alias being removed, preventing HWASAN from symbolizing a global reference), but it could easily have manifested as incorrect behaviour. Since this is the third such issue encountered (previously: D65118, D65314) it seems to be time to address this common error/QoI issue once and for all and make the strip* family of functions not look through aliases. Includes a test for the specific issue that I saw, but no doubt there are other similar bugs fixed here. As with D65118 this has been tested to make sure that the optimization isn't load bearing. I built Clang, Chromium for Linux, Android and Windows as well as the test-suite and there were no size regressions. Differential Revision: https://reviews.llvm.org/D66606 llvm-svn: 369697
* Introduce FileEntryRef and use it when handling includes to report correct ↵Alex Lorenz2019-08-2215-298/+363
| | | | | | | | | | | | | | | | | | | | | | | dependencies when the FileManager is reused across invocations This commit introduces a parallel API to FileManager's getFile: getFileEntryRef, which returns a reference to the FileEntry, and the name that was used to access the file. In the case of a VFS with 'use-external-names', the FileEntyRef contains the external name of the file, not the filename that was used to access it. The new API is adopted only in the HeaderSearch and Preprocessor for include file lookup, so that the accessed path can be propagated to SourceManager's FileInfo. SourceManager's FileInfo now can report this accessed path, using the new getName method. This API is then adopted in the dependency collector, which now correctly reports dependencies when a file is included both using a symlink and a real path in the case when the FileManager is reused across multiple Preprocessor invocations. Note that this patch does not fix all dependency collector issues, as the same problem is still present in other cases when dependencies are obtained using FileSkipped, InclusionDirective, and HasInclude. This will be fixed in follow-up commits. Differential Revision: https://reviews.llvm.org/D65907 llvm-svn: 369680
* Revert "[LifetimeAnalysis] Support more STL idioms (template forward ↵Richard Smith2019-08-224-31/+15
| | | | | | | | | | declaration and DependentNameType)" This reverts commit r369591, because it causes the formerly-reliable -Wreturn-stack-address warning to start issuing false positives. Testcase provided on the commit thread. llvm-svn: 369677
* Retire llvm::less_ptr. llvm::deref is much more flexible.Benjamin Kramer2019-08-221-3/+3
| | | | llvm-svn: 369675
* [OPENMP]Generalization of handling of declare target attribute.Alexey Bataev2019-08-222-2/+2
| | | | | | | Used OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration instead of direct checking of the OMPDeclareTargetDeclAttr attribute. llvm-svn: 369668
* Revert r369402 "win: Enable /Zc:twoPhase by default if targeting MSVC 2017 ↵Hans Wennborg2019-08-221-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | update 3 or newer" This broke compiling some ASan tests with never versions of MSVC/the Win SDK, see https://crbug.com/996675 > MSVC 2017 update 3 (_MSC_VER 1911) enables /Zc:twoPhase by default, and > so should clang-cl: > https://docs.microsoft.com/en-us/cpp/build/reference/zc-twophase > > clang-cl takes the MSVC version it emulates from the -fmsc-version flag, > or if that's not passed it tries to check what the installed version of > MSVC is and uses that, and failing that it uses a default version that's > currently 1911. So this changes the default if no -fmsc-version flag is > passed and no installed MSVC is detected. (It also changes the default > if -fmsc-version is passed or MSVC is detected, and either indicates > _MSC_VER >= 1911.) > > As mentioned in the MSDN article, the Windows SDK header files in > version 10.0.15063.0 (Creators Update or Redstone 2) and earlier > versions do not work correctly with /Zc:twoPhase. If you need to use > these old SDKs with a new clang-cl, explicitly pass /Zc:twoPhase- to get > the old behavior. > > Fixes PR43032. > > Differential Revision: https://reviews.llvm.org/D66394 llvm-svn: 369647
* [OpenCL] Fix declaration of enqueue_markerYaxun Liu2019-08-221-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D66512 llvm-svn: 369641
* Revert r369458 "[DebugInfo] Add debug location to dynamic atexit destructor"Hans Wennborg2019-08-222-4/+1
| | | | | | | | | | | | | | | | It causes the build to fail with "inlinable function call in a function with debug info must have a !dbg location" in Chromium. See llvm-commits thread for more info. (This also reverts the follow-up in r369474.) > Fixes PR43012 > > Differential Revision: https://reviews.llvm.org/D66328 llvm-svn: 369633
* Remove an unused function, suppress -Wunused-function warning.Haojian Wu2019-08-221-6/+0
| | | | llvm-svn: 369629
* [OpenMP] Permit map with DSA on combined directiveJoel E. Denny2019-08-224-27/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | For `map`, the following restriction changed in OpenMP 5.0: * OpenMP 4.5 [2.15.5.1, Restrictions]: "A list item cannot appear in both a map clause and a data-sharing attribute clause on the same construct. * OpenMP 5.0 [2.19.7.1, Restrictions]: "A list item cannot appear in both a map clause and a data-sharing attribute clause on the same construct unless the construct is a combined construct." This patch removes this restriction in the case of combined constructs and OpenMP 5.0, and it updates Sema not to capture a scalar by copy in the target region when `firstprivate` and `map` appear for that scalar on a combined target construct. This patch also adds a fixme to a test that now reveals that a diagnostic about loop iteration variables is dropped in the case of OpenMP 5.0. That bug exists regardless of this patch's changes. Reviewed By: ABataev, jdoerfert, hfinkel, kkwli0 Differential Revision: https://reviews.llvm.org/D65835 llvm-svn: 369619
* [analyzer] CastValueChecker: Model isa(), isa_and_nonnull()Csaba Dabis2019-08-221-5/+100
| | | | | | | | | | Summary: - Reviewed By: NoQ Differential Revision: https://reviews.llvm.org/D66423 llvm-svn: 369615
* [analyzer] Don't track the condition of foreach loopsKristof Umann2019-08-221-0/+5
| | | | | | | | | As discussed on the mailing list, notes originating from the tracking of foreach loop conditions are always meaningless. Differential Revision: https://reviews.llvm.org/D66131 llvm-svn: 369613
* [analyzer] CastValueChecker: Try to fix the buildbotsCsaba Dabis2019-08-221-1/+1
| | | | llvm-svn: 369609
* [analyzer] CastValueChecker: Rewrite dead header hotfixCsaba Dabis2019-08-226-6/+6
| | | | llvm-svn: 369607
* [analyzer] CastValueChecker: Store the dynamic types and castsCsaba Dabis2019-08-226-211/+404
| | | | | | | | | | | | | | Summary: This patch introduces `DynamicCastInfo` similar to `DynamicTypeInfo` which is stored in `CastSets` which are storing the dynamic cast informations of objects based on memory regions. It could be used to store and check the casts and prevent infeasible paths. Reviewed By: NoQ Differential Revision: https://reviews.llvm.org/D66325 llvm-svn: 369605
* [analyzer] TrackConstraintBRVisitor: Do not track unknown valuesCsaba Dabis2019-08-221-3/+4
| | | | | | | | | | | | Summary: - Reviewers: NoQ, Szelethus Reviewed By: NoQ, Szelethus Differential Revision: https://reviews.llvm.org/D66267 llvm-svn: 369604
* [analyzer] Mention whether an event is about a condition in a bug report part 2Kristof Umann2019-08-211-0/+30
| | | | | | | | | In D65724, I do a pretty thorough explanation about how I'm solving this problem, I think that summary nails whats happening here ;) Differential Revision: https://reviews.llvm.org/D65725 llvm-svn: 369596
* [LifetimeAnalysis] Support more STL idioms (template forward declaration and ↵Matthias Gehre2019-08-214-15/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | DependentNameType) Summary: This fixes inference of gsl::Pointer on std::set::iterator with libstdc++ (the typedef for iterator on the template is a DependentNameType - we can only put the gsl::Pointer attribute on the underlaying record after instantiation) inference of gsl::Pointer on std::vector::iterator with libc++ (the class was forward-declared, we added the gsl::Pointer on the canonical decl (the forward decl), and later when the template was instantiated, there was no attribute on the definition so it was not instantiated). and a duplicate gsl::Pointer on some class with libstdc++ (we first added an attribute to a incomplete instantiation, and then another was copied from the template definition when the instantiation was completed). We now add the attributes to all redeclarations to fix thos issues and make their usage easier. Reviewers: gribozavr Subscribers: Szelethus, xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66179 llvm-svn: 369591
* [analyzer] Don't make ConditionBRVisitor events prunable when the condition ↵Kristof Umann2019-08-211-34/+46
| | | | | | | | | | | is an interesting field Exactly what it says on the tin! Note that we're talking about interestingness in general, hence this isn't a control-dependency-tracking specific patch. Differential Revision: https://reviews.llvm.org/D65724 llvm-svn: 369589
* NFCI: Simplify SourceManager::translateFile by removing code path that ↵Alex Lorenz2019-08-211-107/+21
| | | | | | | | | | | | | | | should never be taken I noticed that SourceManager::translateFile has code that doesn't really make sense. In particular, if it fails to find a FileID by comparing FileEntry * values, it tries to look through files that have the same filename, to see if they have a matching inode to try to find the right FileID. However, the inode comparison seem redundant, as Clang's FileManager already deduplicates FileEntry * values by inode. Thus the comparisons between inodes should never actually succeed, and the comparison between FileEntry * values should be sufficient here. Differential Revision: https://reviews.llvm.org/D65481 llvm-svn: 369585
* [analyzer][NFC] Add different interestingness kindsKristof Umann2019-08-212-23/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We defined (on the mailing list and here on phabricator) 2 different cases where retrieving information about a control dependency condition is very important: * When the condition's last write happened in a different stack frame * When the collapse point of the condition (when we can constrain it to be true/false) didn't happen in the actual condition. It seems like we solved this problem with the help of expression value tracking, and have started working on better diagnostics notes about this process. Expression value tracking is nothing more than registering a variety of visitors to construct reports about it. Each of the registered visitors (ReturnVisitor, FindLastStoreVisitor, NoStoreFuncVisitor, etc) have something to go by: a MemRegion, an SVal, an ExplodedNode, etc. For this reason, better explaining a last write is super simple, we can always just pass on some more information to the visitor in question (as seen in D65575). ConditionBRVisitor is a different beast, as it was built for a different purpose. It is responsible for constructing events at, well, conditions, and is registered only once, and isn't a part of the "expression value tracking family". Unfortunately, it is also the visitor to tinker with for constructing better diagnostics about the collapse point problem. This creates a need for alternative way to communicate with ConditionBRVisitor that a specific condition is being tracked for for the reason of being a control dependency. Since at almost all PathDiagnosticEventPiece construction the visitor checks interestingness, it makes sense to pair interestingness with a reason as to why we marked an entity as such. Differential Revision: https://reviews.llvm.org/D65723 llvm-svn: 369583
* [analyzer] Mention whether an event is about a condition in a bug report part 1Kristof Umann2019-08-211-3/+15
| | | | | | | | | | Can't add much more to the title! This is part 1, the case where the collapse point isn't in the condition point is the responsibility of ConditionBRVisitor, which I'm addressing in part 2. Differential Revision: https://reviews.llvm.org/D65575 llvm-svn: 369574
OpenPOWER on IntegriCloud