summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
...
* Sema - silence static analyzer getAs<> null dereference warnings. NFCI.Simon Pilgrim2019-10-074-11/+11
| | | | | | The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us. llvm-svn: 373911
* [clang] Add test for FindNextToken in Lexer.Utkarsh Saxena2019-10-071-2/+23
| | | | | | | | | | | | Reviewers: ilya-biryukov Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68565 llvm-svn: 373910
* RewriteModernObjC - silence static analyzer getAs<> null dereference ↵Simon Pilgrim2019-10-071-7/+7
| | | | | | | | warnings. NFCI. The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us. llvm-svn: 373905
* AST - silence static analyzer getAs<> null dereference warnings. NFCI.Simon Pilgrim2019-10-076-14/+11
| | | | | | The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us. llvm-svn: 373904
* [ASTImporter][NFC] Enable disabled but passing testGabor Marton2019-10-071-4/+1
| | | | | | RedeclChainShouldBeCorrectAmongstNamespaces llvm-svn: 373896
* [ASTImporter][NFC] Update ASTImporter internals docsGabor Marton2019-10-071-11/+2
| | | | llvm-svn: 373895
* [ASTImporter][NFC] Fix typo in user docsGabor Marton2019-10-071-1/+1
| | | | llvm-svn: 373894
* clang-cl: Ignore the new /ZH optionsHans Wennborg2019-10-072-0/+6
| | | | | | | | | These were added to the MS docs in https://github.com/MicrosoftDocs/cpp-docs/commit/85b9b6967e58e485251450f7451673f6fc873e88 and are supposedly available in VS 2019 16.4 (though my 2019 Preview, version 16.4.0-pre.1.0 don't seem to have them.) llvm-svn: 373887
* [c++20] Check for a class-specific operator delete when deleting anRichard Smith2019-10-072-0/+38
| | | | | | object of class type with a virtual destructor. llvm-svn: 373875
* Fix behavior of __builtin_bit_cast when the From and To types are theRichard Smith2019-10-074-7/+24
| | | | | | | | | | same. We were missing the lvalue-to-rvalue conversion entirely in this case, and in fact still need the full CK_LValueToRValueBitCast conversion to perform a load with no TBAA. llvm-svn: 373874
* Implements CWG 1601 in [over.ics.rank/4.2]Richard Smith2019-10-064-6/+65
| | | | | | | | | | | | | | | | | | | Summary: The overload resolution for enums with a fixed underlying type has changed in the C++14 standard. This patch implements the new rule. Patch by Mark de Wever! Reviewers: rsmith Reviewed By: rsmith Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65695 llvm-svn: 373866
* [Sema] Avoids an assertion failure when an invalid conversion declaration is ↵Richard Smith2019-10-062-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | used Summary: When using a user-defined conversion function template with a deduced return type the compiler gives a set of warnings: ``` bug.cc:252:44: error: cannot specify any part of a return type in the declaration of a conversion function; use an alias template to declare a conversion to 'auto (Ts &&...) const' template <typename... Ts> operator auto()(Ts &&... xs) const; ^~~~~~~~~~~~~~~~~~~ bug.cc:252:29: error: conversion function cannot convert to a function type template <typename... Ts> operator auto()(Ts &&... xs) const; ^ error: pointer to function type cannot have 'const' qualifier ``` after which it triggers an assertion failure. It seems the last error is incorrect and doesn't have any location information. This patch stops the compilation after the second warning. Fixes bug 31422. Patch by Mark de Wever! Reviewers: rsmith Reviewed By: rsmith Subscribers: bbannier, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64820 llvm-svn: 373862
* [InstCombine] don't assume 'inbounds' for bitcast pointer to GEP transform ↵Sanjay Patel2019-10-063-45/+45
| | | | | | | | | | | | (PR43501) https://bugs.llvm.org/show_bug.cgi?id=43501 We can't declare a GEP 'inbounds' in general. But we may salvage that information if we have known dereferenceable bytes on the source pointer. Differential Revision: https://reviews.llvm.org/D68244 llvm-svn: 373847
* [clang-format][docs] Fix the Google C++ and Chromium style guide URLsPaul Hoad2019-10-061-1/+1
| | | | | | | | | | | | | | | | | | Summary: The Google C++ and Chromium style guides are broken in the clang-format docs. This patch updates them. Reviewers: djasper, MyDeveloperDay Reviewed By: MyDeveloperDay Subscribers: cfe-commits Tags: #clang Patch by: m4tx Differential Revision: https://reviews.llvm.org/D61256 llvm-svn: 373844
* Try to fix sphinx indentation errorSimon Pilgrim2019-10-051-3/+5
| | | | llvm-svn: 373831
* RewriteObjC - silence static analyzer getAs<> null dereference warnings. NFCI.Simon Pilgrim2019-10-051-7/+8
| | | | | | The static analyzer is warning about potential null dereferences, but we should be able to use castAs<> directly and if not assert will fire for us. llvm-svn: 373829
* [Diagnostics] Highlight expr's source range for -Wbool-operationDavid Bolvansky2019-10-051-0/+1
| | | | | | Warning message looks better; and GCC adds it too. llvm-svn: 373828
* SemaTemplate - silence static analyzer getAs<> null dereference warnings. NFCI.Simon Pilgrim2019-10-051-4/+4
| | | | | | The static analyzer is warning about potential null dereferences, but we should be able to use castAs<> directly and if not assert will fire for us. llvm-svn: 373827
* TreeTransform - silence static analyzer getAs<> null dereference warnings. NFCI.Simon Pilgrim2019-10-051-4/+4
| | | | | | The static analyzer is warning about potential null dereferences, but we should be able to use castAs<> directly and if not assert will fire for us. llvm-svn: 373826
* Remove redundant !HasDependentValue check. NFCI.Simon Pilgrim2019-10-051-1/+1
| | | | | | Fixes cppcheck warning. llvm-svn: 373825
* SemaStmt - silence static analyzer getAs<> null dereference warnings. NFCI.Simon Pilgrim2019-10-051-5/+5
| | | | | | The static analyzer is warning about potential null dereferences, but we should be able to use castAs<> directly and if not assert will fire for us. llvm-svn: 373824
* [clang-format] SpacesInSquareBrackets should affect lambdas with parameters tooPaul Hoad2019-10-053-8/+9
| | | | | | | | | | | | | | | | | | | | | | | Summary: This patch makes the `SpacesInSquareBrackets` setting also apply to C++ lambdas with parameters. Looking through the revision history, it appears support for only array brackets was added, and lambda brackets were ignored. Therefore, I am inclined to think it was simply an omission, rather than a deliberate choice. See https://bugs.llvm.org/show_bug.cgi?id=17887 and https://reviews.llvm.org/D4944. Reviewers: MyDeveloperDay, reuk, owenpan Reviewed By: MyDeveloperDay Subscribers: cfe-commits Patch by: mitchell-stellar Tags: #clang-format, #clang Differential Revision: https://reviews.llvm.org/D68473 llvm-svn: 373821
* [NFCI] Slightly improve warning messageDavid Bolvansky2019-10-052-2/+2
| | | | llvm-svn: 373818
* [Diagnostics] Use Expr::isKnownToHaveBooleanValue() to check bitwise ↵David Bolvansky2019-10-052-1/+3
| | | | | | | | negation of bool in languages without a bool type Thanks for this advice, Richard Trieu! llvm-svn: 373817
* [clang] fix a typo from r372531Yuanfang Chen2019-10-042-2/+2
| | | | | | | | | | | | Reviewers: xbolva00 Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68482 llvm-svn: 373792
* [clang] [cmake] Use add_clang_tool() to install all toolsMichal Gorny2019-10-043-11/+3
| | | | | | | | | | Switch clang-check, clang-extdef-mapping and clang-offload-bundler to use add_clang_tool() rather than add_clang_executable() with a custom install rule. This makes them LLVM_DISTRIBUTION_COMPONENTS-friendly. Differential Revision: https://reviews.llvm.org/D68429 llvm-svn: 373785
* [Sema] Split out -Wformat-type-confusion from -Wformat-pedanticErik Pilkington2019-10-048-30/+100
| | | | | | | | | The warnings now in -Wformat-type-confusion don't align with how we interpret 'pedantic' in clang, and don't belong in -pedantic. Differential revision: https://reviews.llvm.org/D67775 llvm-svn: 373774
* Add missing null pointer check in -ftime-trace codeReid Kleckner2019-10-041-13/+14
| | | | | | | | | | | | createOutputFile diagnoses the error for the caller already, so recover by not writing the output. Fixes PR43555 No test, since I couldn't think of a good, portable, simple way to make the regular -o output file writable, but outputfile.json not writable. llvm-svn: 373771
* [CMake] Clang: Don't use object libraries with XcodeJordan Rose2019-10-042-3/+13
| | | | | | | | | | | Undoes some of the effects of r360946 when using the Xcode CMake generator---it doesn't handle object libraries correctly at all. Attempts to still honor BUILD_SHARED_LIBS for Xcode, but I didn't actually test it. Should have no effect on non-Xcode generators. https://reviews.llvm.org/D68430 llvm-svn: 373769
* [OPENMP50]Suppport for multiple vendors in the same vendor contextAlexey Bataev2019-10-045-33/+48
| | | | | | | | | selector. According to OpenMP 5.0, multiple vendors could be specified in the vendor context selector via ',' as a separator. llvm-svn: 373756
* SemaDeclAttr - silence static analyzer getAs<> null dereference warnings. NFCI.Simon Pilgrim2019-10-041-4/+4
| | | | | | The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us. llvm-svn: 373753
* CGBlocks - silence static analyzer getAs<> null dereference warnings. NFCI.Simon Pilgrim2019-10-041-3/+2
| | | | | | The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us. llvm-svn: 373752
* [clang-format] C++11 braced lists should respect the SpacesInParentheses settingPaul Hoad2019-10-042-3/+34
| | | | | | | | | | | | | | | | | | | | | Summary: According to the clang-format documentation, "Fundamentally, C++11 braced lists are formatted exactly like function calls would be formatted in their place. If the braced list follows a name (e.g. a type or variable name), clang-format formats as if the `{}` were the parentheses of a function call with that name." This patch furthers the treatment of C++11 braced list braces as parentheses by respecting the `SpacesInParentheses` setting. Reviewers: MyDeveloperDay, reuk, owenpan Reviewed By: MyDeveloperDay Subscribers: cfe-commits Tags: #clang-format, #clang Patch By: mitchell-stellar Differential Revision: https://reviews.llvm.org/D68415 llvm-svn: 373751
* [clang-format] [PR43531] clang-format damages "alternative representations" ↵Paul Hoad2019-10-042-1/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for operators Summary: https://bugs.llvm.org/show_bug.cgi?id=43531 Fix for clang-format incorrectly handles "alternative operators" as described by https://en.cppreference.com/w/cpp/language/operator_alternative compl = ~ not = ! these are unary operators, and clang-format will remove the space between them and a numeric constant this incorrectly formats the following code ``` int a compl 5; int a not 5; ``` into: ``` int a compl5; int a not5; ``` The code adds FIXME unit tests for "alternative token" representations for {} [] and # as defined by the same link, which would require a more detailed change to the FormatTokenLexer Reviewers: klimek, reuk, owenpan, mitchell-stellar, STL_MSFT Reviewed By: mitchell-stellar Subscribers: cfe-commits Tags: #clang-format, #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D68332 llvm-svn: 373750
* Further improve -Wbool-operation bitwise negation messageSam McCall2019-10-042-4/+4
| | | | llvm-svn: 373749
* [clang-rename] Fix a crash when renaming a class without definition.Haojian Wu2019-10-042-0/+8
| | | | | | | | | | | | Reviewers: sammccall Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68459 llvm-svn: 373748
* [clang-format] [PR42417] clang-format inserts a space after '->' for ↵Paul Hoad2019-10-042-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | operator->() overloading Summary: https://bugs.llvm.org/show_bug.cgi?id=42417 This revision removes the extra space between the opertor-> and the parens () ``` class Bug { auto operator-> () -> int*; auto operator++(int) -> int; }; ``` Reviewers: klimek, owenpan, byoungyoung, mitchell-stellar Reviewed By: mitchell-stellar Subscribers: cfe-commits Tags: #clang-format, #clang Differential Revision: https://reviews.llvm.org/D68242 llvm-svn: 373746
* [clang] Prevent false positives in arm-mfpu-none codegen test.Simon Tatham2019-10-041-0/+1
| | | | | | | | | | | | | | | | | A user pointed out to me in private email that this test will fail if it sees the letter 's' followed by a digit in any part of clang's assembly output after the function label. That includes the .ident at the end, which can include a full pathname or hostname or both from the system clang was built on. So if that path or hostname includes any text like 's5' then it will cause the test to fail. Fixed by adding a check for `.fnend`, to limit the scope of the `CHECK-NOT` to only the actual generated code for the test function. (Committed without prior review on the basis that it's a simple and obvious pure test-suite fix and also in a test I contributed myself.) llvm-svn: 373744
* [NFCI] Improve the -Wbool-operation's warning messageDavid Bolvansky2019-10-042-3/+5
| | | | | | Based on the request from the post commit review. Also added one new test. llvm-svn: 373743
* [Format] Fix docs after r373439Sam McCall2019-10-041-1/+2
| | | | llvm-svn: 373724
* [Driver] NFC: Remove duplicate call to getLibGccTypeCullen Rhodes2019-10-041-1/+0
| | | | | | | | Reviewed By: saugustine Differential Revision: https://reviews.llvm.org/D68380 llvm-svn: 373712
* [lldb][modern-type-lookup] No longer import temporary declarations into the ↵Raphael Isemann2019-10-042-9/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | persistent AST Summary: As we figured out in D67803, importing declarations from a temporary ASTContext that were originally from a persistent ASTContext causes a bunch of duplicated declarations where we end up having declarations in the target AST that have no associated ASTImporter that can complete them. I haven't figured out how/if we can solve this in the current way we do things in LLDB, but in the modern-type-lookup this is solvable as we have a saner architecture with the ExternalASTMerger. As we can (hopefully) make modern-type-lookup the default mode in the future, I would say we try fixing this issue here. As we don't use the hack that was reinstated in D67803 during modern-type-lookup, the test case for this is essentially just printing any kind of container in `std::` as we would otherwise run into the issue that required a hack like D67803. What this patch is doing in essence is that instead of importing a declaration from a temporary ASTContext, we instead check if the declaration originally came from a persistent ASTContext (e.g. the debug information) and we directly import from there. The ExternalASTMerger is already connected with ASTImporters to these different sources, so this patch is essentially just two parts: 1. Mark our temporary ASTContext/ImporterSource as temporary when we import from the expression AST. 2. If the ExternalASTMerger sees we import from the expression AST, instead of trying to import these temporary declarations, check if we can instead import from the persistent ASTContext that is already connected. This ensures that all records from the persistent source actually come from the persistent source and are minimally imported in a way that allows them to be completed later on in the target AST. The next step is to run the ASTImporter for these temporary expressions with the MinimalImport mode disabled, but that's a follow up patch. This patch fixes most test failures with modern-type-lookup enabled by default (down to 73 failing tests, which includes the 22 import-std-module tests which need special treatment). Reviewers: shafik, martong Reviewed By: martong Subscribers: aprantl, rnkovacs, christof, abidh, JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68326 llvm-svn: 373711
* [CodeComplete] Ensure object is the same in compareOverloads()Ilya Biryukov2019-10-042-0/+16
| | | | | | | | | | | | | | | | | | Summary: This fixes a regression that led to size() not being available in clangd when completing 'deque().^' and using libc++. Reviewers: sammccall Reviewed By: sammccall Subscribers: jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68335 llvm-svn: 373710
* [clang-format] [PR43338] C# clang format has space issues betweern C# only ↵Paul Hoad2019-10-044-7/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | keywords Summary: When formatting C# there can be issues with a lack of spaces between `using (` , `foreach (` and generic types The C# code ``` public class Foo { Dictionary<string,string> foo; } ``` will be formatted as ``` public class Foo { Dictionary<string, string>foo; ^^^^^ missing a space } ``` This revision also reverts some of {D66662} in order to make this cleaner and resolve an issues seen by @owenpan that the formatting didn't add a space when not in a code block This also transforms C# foreach commands to be seen as tok::kw_for commands (to ensure foreach gets the same Brace Wrapping behavior as for without littering the code with `if(Style.isCSharp())` Reviewers: owenpan, klimek, russellmcc, mitchell-stellar Reviewed By: mitchell-stellar Subscribers: cfe-commits Tags: #clang, #clang-format Differential Revision: https://reviews.llvm.org/D67660 llvm-svn: 373709
* [clang-format] [PR43333] Fix C# breaking before function name when using ↵Paul Hoad2019-10-045-69/+189
| | | | | | | | | | | | | | | | | | | | | | | | | Attributes Summary: This is a fix for https://bugs.llvm.org/show_bug.cgi?id=43333 This comes with 3 main parts - C# attributes cause function names on a new line even when AlwaysBreakAfterReturnType is set to None - Add AlwaysBreakAfterReturnType to None by default in the Microsoft style, - C# unit tests are not using Microsoft style (which we created to define the default C# style to match a vanilla C# project). Reviewers: owenpan, klimek, russellmcc, mitchell-stellar Reviewed By: mitchell-stellar Subscribers: cfe-commits Tags: #clang-tools-extra, #clang, #clang-format Differential Revision: https://reviews.llvm.org/D67629 llvm-svn: 373707
* [clang] [cmake] Add distribution install targets for remaining componentsMichal Gorny2019-10-044-9/+46
| | | | | | | | | Add install targets as necessary to install bash-autocomplete, scan-build and scan-view via LLVM_DISTRIBUTION_TARGETS. Differential Revision: https://reviews.llvm.org/D68413 llvm-svn: 373695
* Properly handle instantiation-dependent array bounds.Richard Smith2019-10-0430-154/+235
| | | | | | | | | We previously failed to treat an array with an instantiation-dependent but not value-dependent bound as being an instantiation-dependent type. We now track the array bound expression as part of a constant array type if it's an instantiation-dependent expression. llvm-svn: 373685
* [OPENMP]Fix the test on Windows, NFC.Alexey Bataev2019-10-031-1/+1
| | | | llvm-svn: 373672
* ASTContext - silence static analyzer getAs<> null dereference warnings. NFCI.Simon Pilgrim2019-10-031-32/+19
| | | | | | | | The static analyzer is warning about potential null dereferences, but we should be able to use castAs<> directly and if not assert will fire for us. We can also remove a number of explicit asserts and reply on the internal asserts in castAs<> llvm-svn: 373667
* OverloadCandidate::getNumParams - silence static analyzer ↵Simon Pilgrim2019-10-031-2/+2
| | | | | | | | | | getAs<FunctionProtoType> null dereference warning. NFCI. The static analyzer is warning about a potential null dereference, but we should be able to use castAs<FunctionProtoType> directly and if not assert will fire for us. Also replaces an auto to make the type more obvious. llvm-svn: 373665
OpenPOWER on IntegriCloud