summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
* [analyzer] pr38838, pr39976: Fix crash on diagnosing before implicit destructor.Artem Dergachev2019-01-102-0/+27
| | | | | | | | | | | | | | | | | | | We need to be able to emit the diagnostic at PreImplicitCall, and the patch implements this functionality. However, for now the need for emitting such diagnostics is not all that great: it is only necessary to not crash when emitting a false positive due to an unrelated issue of having dead symbol collection not working properly. Coming up with a non-false-positive test seems impossible with the current set of checkers, though it is likely to be needed for good things as well in the future. Differential Revision: https://reviews.llvm.org/D56042 rdar://problem/46911462 llvm-svn: 350907
* Properly support -shared-libgcc.Sterling Augustine2019-01-102-18/+10
| | | | | | This revision was revied in D55016. llvm-svn: 350900
* Correct the source range returned from preprocessor callbacks.Aaron Ballman2019-01-104-38/+170
| | | | | | This adjusts the source range passed in to the preprocessor callbacks to only include the condition range itself, rather than all of the conditionally skipped tokens. llvm-svn: 350891
* NFC: Change case of identifiersStephen Kelly2019-01-103-13/+13
| | | | llvm-svn: 350890
* [Sema] Call CheckPlaceholderExpr to resolve typeof or decltypeAkira Hatanaka2019-01-106-7/+19
| | | | | | | | | | | | | | | placeholder expressions while an unevaluated context is still on the expression evaluation context stack. This prevents recordUseOfWeek from being called when a weak variable is used as an operand of a decltype or a typeof expression and fixes spurious -Warc-repeated-use-of-weak warnings. rdar://problem/45742525 Differential Revision: https://reviews.llvm.org/D55662 llvm-svn: 350887
* [HIP] Use nul instead of /dev/null when running on windowsYaxun Liu2019-01-101-1/+7
| | | | | | | | When clang is running on windows, /dev/null is not available. Use nul as empty input file instead. Differential Revision: https://reviews.llvm.org/D56225 llvm-svn: 350885
* fixup: sphinx warningNick Desaulniers2019-01-101-1/+1
| | | | | | | | | | Fixes the sphinx warning: tools/clang/docs/DiagnosticsReference.rst:7889: WARNING: Title underline too short. That I just introduced in r350877. llvm-svn: 350878
* [SemaCXX] add -Woverride-init alias to -Winitializer-overridesNick Desaulniers2019-01-103-0/+7
| | | | | | | | | | | | | | | | Summary: https://bugs.llvm.org/show_bug.cgi?id=40251 https://github.com/ClangBuiltLinux/linux/issues/307 Reviewers: rsmith Reviewed By: rsmith Subscribers: cfe-commits, nathanchance, srhines Differential Revision: https://reviews.llvm.org/D56522 llvm-svn: 350877
* Fix false positive unsequenced access and modification warning in array ↵Nicolas Lesser2019-01-103-16/+37
| | | | | | | | | | | | | | | | | | | | subscript expression. Summary: In the [expr.sub] p1, we can read that for a given E1[E2], E1 is sequenced before E2. Patch by Mateusz Janek. Reviewers: rsmith, Rakete1111 Reviewed By: rsmith, Rakete1111 Subscribers: riccibruno, lebedev.ri, Rakete1111, hiraditya, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D50766 llvm-svn: 350874
* [analyzer] [hotfix] Fix the testsGeorge Karpenkov2019-01-101-5/+7
| | | | | | The error must have crept during the cherry-pick. llvm-svn: 350870
* [analyzer] Update the category name for RetainCountChecker reportsGeorge Karpenkov2019-01-1014-109/+107
| | | | | | | | | | ..now that it includes OSObjects rdar://46509986 Differential Revision: https://reviews.llvm.org/D56404 llvm-svn: 350869
* [analyzer] [NFC] [RetainCountChecker] Remove dead unused mapGeorge Karpenkov2019-01-101-6/+0
| | | | | | Differential Revision: https://reviews.llvm.org/D56402 llvm-svn: 350868
* [analyzer] Quote the type of the leaked/problematic object in diagnostics ↵George Karpenkov2019-01-1011-2500/+1263
| | | | | | | | for readability Differential Revision: https://reviews.llvm.org/D56344 llvm-svn: 350867
* [analyzer] [NFC] Reverse the argument order for "diff" in testsGeorge Karpenkov2019-01-1035-36/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | The current argument order has "expected" and "actual" the wrong way around, so that the diff shows the change from expected to actual, not from actual to expected. Namely, if the expected diagnostics contains the string "foo", but the analyzer emits "bar", we really want to see: ``` - foo + bar ``` not ``` - bar + foo ``` since adapting to most changes would require applying that diff to the expected output. Differential Revision: https://reviews.llvm.org/D56340 llvm-svn: 350866
* [analyzer] [NFC] Reduce redundancy in RetainSummaryManager by using a functionGeorge Karpenkov2019-01-102-24/+11
| | | | | | Differential Revision: https://reviews.llvm.org/D56282 llvm-svn: 350865
* [analyzer] [RetainCountChecker] [NFC] Remove SummaryLogGeorge Karpenkov2019-01-104-103/+46
| | | | | | | | | | | | | | The complicated machinery for passing the summary log around is actually only used for one thing! To figure out whether the "dealloc" message was sent. Since I have tried to extend it for other uses and failed (it's actually very hard to use), I think it's much better to simply use a tag and remove the summary log altogether. Differential Revision: https://reviews.llvm.org/D56228 llvm-svn: 350864
* [analyzer] [RetainCountChecker] [NFC] Another minor cleanupGeorge Karpenkov2019-01-102-16/+15
| | | | | | Differential Revision: https://reviews.llvm.org/D56224 llvm-svn: 350863
* [analyzer] [RetainCountChecker] [NFC] Refactor the way attributes are handledGeorge Karpenkov2019-01-102-91/+113
| | | | | | | | | | | | | Make sure all checks for attributes go through a centralized function, which checks whether attribute handling is enabled, and performs validation. The type of the attribute is returned. Sadly, metaprogramming is required as attributes have no sensible static getters. Differential Revision: https://reviews.llvm.org/D56222 llvm-svn: 350862
* [analyzer] [RetainCountChecker] Remove redundant enum UnarySummaryKindGeorge Karpenkov2019-01-102-19/+9
| | | | | | Differential Revision: https://reviews.llvm.org/D56072 llvm-svn: 350861
* [analyzer] [RetainCountChecker] Remove obsolete "MakeCollectable" enum valueGeorge Karpenkov2019-01-103-11/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D56071 llvm-svn: 350860
* [analyzer] [RetainCountChecker] [NFC] Remove redundant enum items *Msg, as ↵George Karpenkov2019-01-105-82/+69
| | | | | | | | the object type is already communicated by a separate field Differential Revision: https://reviews.llvm.org/D56070 llvm-svn: 350859
* [analyzer] [NFC] Track object type with ArgEffect in RetainCountChecker.George Karpenkov2019-01-106-141/+180
| | | | | | | | This would be needed in the future. https://reviews.llvm.org/D56040 llvm-svn: 350858
* [analyzer] [NFC] Move ObjKind into a separate top-level enum in ↵George Karpenkov2019-01-106-69/+70
| | | | | | | | | | RetainSummaryManager. Allows using it in future outside of RetEffect. Differential Revision: https://reviews.llvm.org/D56039 llvm-svn: 350857
* Split -Wdelete-non-virtual-dtor into two groupsErik Pilkington2019-01-103-3/+37
| | | | | | | | | | | | | This group controls two diagnostics: deleting an abstract class with a non-virtual dtor, which is a guaranteed crash, and deleting a non-abstract polymorphic class with a non-virtual dtor, which is just suspicious. rdar://40380564 Differential revision: https://reviews.llvm.org/D56405 llvm-svn: 350856
* [analyzer][CrossTU][NFC] Generalize to external definitions instead of ↵Rafael Stahl2019-01-1024-124/+126
| | | | | | | | | | | | | | | | external functions Summary: This is just changing naming and documentation to be general about external definitions that can be imported for cross translation unit analysis. There is at least a plan to add VarDecls: D46421 Reviewers: NoQ, xazax.hun, martong, a.sidorin, george.karpenkov, serge-sans-paille Reviewed By: xazax.hun, martong Subscribers: mgorny, whisperity, baloghadamsoftware, szepet, rnkovacs, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, cfe-commits Differential Revision: https://reviews.llvm.org/D56441 llvm-svn: 350852
* Correct the spelling of helpURI to helpUri.Aaron Ballman2019-01-102-3/+3
| | | | | | JSON is case sensitive and the SARIF spec uses the corrected spelling. llvm-svn: 350817
* [libclang] Fix clang_Cursor_isAnonymousIvan Donchevskii2019-01-103-10/+31
| | | | | | | | Use the same logic as in TypePrinter::printTag to determine that the tag is anonymous and the separate check for namespaces. Differential Revision: https://reviews.llvm.org/D54996 llvm-svn: 350805
* [AMDGPU] Separate feature dot-instsStanislav Mekhanoshin2019-01-104-22/+23
| | | | | | Differential Revision: https://reviews.llvm.org/D56525 llvm-svn: 350794
* Refactor declarations of ASTContext allocate functions into its own header.Richard Trieu2019-01-106-23/+46
| | | | | | | | | | | | | | Forward declarations of the allocate functions combine with the forward declaration of the ASTContext class is enough information for some headers without pulling in ASTContext.h in its entirety. Pull the existing declarations from AttrIterator.h into a new header. Also place the default alignment size into this header. Previously, new had its default in AttrIterator.h while new[] had its default in ASTContext.h. Add new header includes where it is needed. Specifically to ASTVector.h to make it a standalone header, unlike previously which it was standalone as long as none of its functions were called. llvm-svn: 350792
* [X86] Really make the pointer arguments to avx512 gather/scatter intrinsics ↵Craig Topper2019-01-101-57/+57
| | | | | | | | | | 'void*' to match gcc and Intel's documentation. The avx2 gather intrinsics are documented to use 'int', 'long long', 'float', or 'double' *. So I'm leaving those. This matches gcc. I tried to do this in r350696, but I only updated the header not the builtin definition. llvm-svn: 350785
* In nothrow new-expressions, null-check the result if we're going toRichard Smith2019-01-102-2/+46
| | | | | | | | | apply sanitizers to it. This avoids a sanitizer false positive that we are initializing a null pointer. llvm-svn: 350779
* [Sema] Mark target of __attribute__((alias("target"))) used for CNick Desaulniers2019-01-092-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Prevents -Wunneeded-internal-delcaration warnings when the target has no other references. This occurs frequently in device drivers in the Linux kernel. Sema would need to invoke the demangler on the target, since in C++ the target name is mangled: int f() { return 42; } int g() __attribute__((alias("_Z1fv"))); Sema does not have the ability to demangle names at this time. https://bugs.llvm.org/show_bug.cgi?id=39088 https://github.com/ClangBuiltLinux/linux/issues/232 Reviewers: rsmith, rjmccall Reviewed By: rsmith Subscribers: erik.pilkington, cfe-commits, pirama, srhines Differential Revision: https://reviews.llvm.org/D54188 llvm-svn: 350776
* [ObjC] Allow the use of implemented unavailable methods from withinAlex Lorenz2019-01-092-6/+90
| | | | | | | | | | | | | | | | | | the @implementation context In Objective-C, it's common for some frameworks to mark some methods like init as unavailable in the @interface to prohibit their usage. However, these frameworks then often implemented said method and refer to it in another method that acts as a factory for that object. The recent change to how messages to self are type checked in clang (r349841) introduced a regression which started to prohibit this pattern with an X is unavailable error. This commit addresses the aforementioned regression. rdar://47134898 Differential Revision: https://reviews.llvm.org/D56469 llvm-svn: 350768
* [OpenMP] Avoid remainder operations for loop index values on a collapsed ↵Gheorghe-Teodor Bercea2019-01-095-68/+232
| | | | | | | | | | | | | | | | loop nest. Summary: Change the strategy for computing loop index variables after collapsing a loop nest via the collapse clause by replacing the expensive remainder operation with multiplications and additions. Reviewers: ABataev, caomhin Reviewed By: ABataev Subscribers: guansong, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D56413 llvm-svn: 350759
* [OpenMP] Add flag for preventing the extension to 64 bits for the collapse ↵Gheorghe-Teodor Bercea2019-01-097-21/+51
| | | | | | | | | | | | | | | | loop counter Summary: Introduce a compiler flag for cases when the user knows that the collapsed loop counter can be safely represented using at most 32 bits. This will prevent the emission of expensive mathematical operations (such as the div operation) on the iteration variable using 64 bits where 32 bit operations are sufficient. Reviewers: ABataev, caomhin Reviewed By: ABataev Subscribers: hfinkel, kkwli0, guansong, cfe-commits Differential Revision: https://reviews.llvm.org/D55928 llvm-svn: 350758
* [OPENMP][DOCS]Release notes/OpenMP support updates, NFC.Alexey Bataev2019-01-092-4/+19
| | | | llvm-svn: 350757
* Removing an include that was not necessary; NFC.Aaron Ballman2019-01-091-19/+19
| | | | | | The include also had a using namespace llvm in it, so this adds qualifiers where needed as well. llvm-svn: 350756
* [CodeGen] Clarify comment about COFF common symbol alignmentShoaib Meenai2019-01-091-2/+6
| | | | | | | | | | | | | After a discussion on the commit thread, it seems the 32 byte alignment limitation is an MSVC toolchain artifact, not an inherent COFF restriction. Clarify the comment accordingly, since saying COFF in the comment but using isKnownWindowsMSVCEnvironment in the conditional is confusing. Also add a newline before the comment, which is consistent with the local style. Differential Revision: https://reviews.llvm.org/D56466 llvm-svn: 350754
* [AST] Move back BasePathSize to the bit-fields of CastExprBruno Ricci2019-01-096-125/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | The number of trailing CXXBaseSpecifiers in CastExpr was moved from CastExprBitfields to a trailing object in r338489 (D50050). At this time these bit-fields classes were only 32 bits wide. However later r345459 widened these bit-field classes to 64 bits. The reason for this change was that on 64 bit archs alignment requirements caused 4 bytes of padding after the Stmt sub-object in nearly all expression classes. Reusing this padding yielded an >10% reduction in the size used by all statement/expressions when parsing all of Boost (on a 64 bit arch). This increased the size of statement/expressions for 32 bits archs, but this can be mitigated by moving more data to the bit-fields of Stmt (and moreover most people now care about 64 bits archs as a host). Therefore move back the number of CXXBaseSpecifiers in CastExpr to the bit-fields of Stmt. This in effect mostly revert r338489 while keeping the added test. Differential Revision: https://reviews.llvm.org/D56358 Reviewed By: lebedev.ri Reviewers: lebedev.ri, rjmccall llvm-svn: 350741
* Incorrect implicit data-sharing for nested tasksAlexey Bataev2019-01-092-9/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: There is a minor issue in how the implicit data-sharings for nested tasks are computed. For the following example: ``` int x; #pragma omp task shared(x) #pragma omp task x++; ``` We compute an implicit data-sharing of shared for `x` in the second task although I think that it should be firstprivate. Below you can find the part of the OpenMP spec that covers this example: - // In a task generating construct, if no default clause is present, a variable for which the data-sharing attribute is not determined by the rules above and that in the enclosing context is determined to be shared by all implicit tasks bound to the current team is shared.// - //In a task generating construct, if no default clause is present, a variable for which the data-sharing attribute is not determined by the rules above is firstprivate.// Since each implicit-task has its own copy of `x`, we shouldn't apply the first rule. Reviewers: ABataev Reviewed By: ABataev Subscribers: cfe-commits, rogfer01 Tags: #openmp Differential Revision: https://reviews.llvm.org/D56430 llvm-svn: 350734
* [AST] Store the results in OverloadExpr in a trailing arrayBruno Ricci2019-01-095-275/+388
| | | | | | | | | | | | | | | Use the newly available space in the bit-fields of Stmt to pack OverloadExpr, UnresolvedLookupExpr and UnresolvedMemberExpr. Additionally store the results in the overload set in a trailing array. This saves 1 pointer + 8 bytes per UnresolvedLookupExpr and UnresolvedMemberExpr. Differential Revision: https://reviews.llvm.org/D56368 Reviewed By: rjmccall llvm-svn: 350732
* Remove dependency-related arguments in clang-check.Alexander Kornienko2019-01-091-0/+1
| | | | | | | This is the default behavior of clang tools, but clang-check overrides default argument adjusters for some reason. llvm-svn: 350727
* Fix typo in commentNico Weber2019-01-091-1/+1
| | | | llvm-svn: 350724
* Revert r350648: "Fix clang for r350647: Missed a function rename"Florian Hahn2019-01-091-3/+2
| | | | | | | The related commit r350647 breaks thread sanitizer on some macOS builders, e.g. http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/52725/ llvm-svn: 350718
* [Driver] Fix libcxx detection on Darwin with clang run as ./clangIlya Biryukov2019-01-093-5/+7
| | | | | | | | | | | | | | | | | | | | | | Summary: By using '..' instead of fs::parent_path. The intention of the code was to go from 'path/to/clang/bin' to 'path/to/clang/include'. In most cases parent_path works, however it would fail when clang is run as './clang'. This was noticed in Chromium's bug tracker, see https://bugs.chromium.org/p/chromium/issues/detail?id=919761 Reviewers: arphaman, thakis, EricWF Reviewed By: arphaman, thakis Subscribers: christof, cfe-commits Differential Revision: https://reviews.llvm.org/D56446 llvm-svn: 350714
* Use DeclSpec for quals in DeclaratorChunk::FunctionTypeInfo.Anastasia Stulova2019-01-0910-132/+135
| | | | | | | | | | Rather than duplicating data fields, use DeclSpec directly to store the qualifiers for the functions/methods. This change doesn't handle attributes yet and has to be extended further. Differential revision: https://reviews.llvm.org/D55948 llvm-svn: 350703
* [X86] Make the pointer arguments to avx512 gather/scatter intrinsics 'void*' ↵Craig Topper2019-01-093-96/+96
| | | | | | | | to match gcc and Intel's documentation. The avx2 gather intrinsics are documented to use 'int', 'long long', 'float', or 'double' *. So I'm leaving those. This matches gcc. llvm-svn: 350696
* [libclang] Fix the mismatched delete operator for ExprEvalResultAlex Lorenz2019-01-081-1/+1
| | | | | | | | The '.stringVal' field in ExprEvalResult is allocated using new[], but was freed using a regular delete. That caused memory leaks in the test from r350666. llvm-svn: 350680
* [ASTDump] NFC: Move dumpDeclRef to NodeDumperStephen Kelly2019-01-083-45/+46
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55337 llvm-svn: 350677
* [Driver] Default to -fno-addrsig on Android.Dan Albert2019-01-082-0/+2
| | | | | | | | | | | | | | Summary: The Android NDK still uses GNU binutils by default. Reviewers: srhines, pirama Reviewed By: srhines Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56456 llvm-svn: 350668
OpenPOWER on IntegriCloud