]> granicus.if.org Git - clang/log
clang
5 years ago[clang-format] [PR27004] omits leading space for noexcept when formatting operator...
Paul Hoad [Mon, 7 Oct 2019 17:03:44 +0000 (17:03 +0000)]
[clang-format] [PR27004] omits leading space for noexcept when formatting operator delete()

Summary:
clang-format is incorrectly thinking the parameter parens are part of a cast operation, this is resulting in there sometimes being not space between the paren and the noexcept (and other keywords like volatile etc..)

```
void operator++(int) noexcept;
void operator++(int &) noexcept;
void operator delete(void *, std::size_t, const std::nothrow_t &)noexcept;
```

Reviewers: klimek, owenpan, mitchell-stellar

Reviewed By: mitchell-stellar

Subscribers: cfe-commits

Tags: #clang-format, #clang

Differential Revision: https://reviews.llvm.org/D68481

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373922 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang-format] [NFC] Ensure clang-format is itself clang-formatted.
Paul Hoad [Mon, 7 Oct 2019 16:53:35 +0000 (16:53 +0000)]
[clang-format] [NFC] Ensure clang-format is itself clang-formatted.

Summary:
Before making a proposed change, ensure ClangFormat.cpp is fully clang-formatted,

no functional change just clang-formatting using the in tree .clang-format.

Reviewers: mitchell-stellar

Reviewed By: mitchell-stellar

Subscribers: Eugene.Zelenko, cfe-commits

Tags: #clang-format, #clang

Differential Revision: https://reviews.llvm.org/D68551

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373921 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoCodegen - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Mon, 7 Oct 2019 16:42:25 +0000 (16:42 +0000)]
Codegen - silence static analyzer getAs<> null dereference 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373918 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[libTooling] Add `toString` method to the Stencil class
Yitzhak Mandelbaum [Mon, 7 Oct 2019 16:20:22 +0000 (16:20 +0000)]
[libTooling] Add `toString` method to the Stencil class

Summary:
`toString` generates a string representation of the stencil.

Patch by Harshal T. Lehri.

Reviewers: gribozavr

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D68574

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373916 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoSema - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Mon, 7 Oct 2019 14:25:46 +0000 (14:25 +0000)]
Sema - silence static analyzer getAs<> null dereference 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373911 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang] Add test for FindNextToken in Lexer.
Utkarsh Saxena [Mon, 7 Oct 2019 14:20:46 +0000 (14:20 +0000)]
[clang] Add test for FindNextToken in Lexer.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D68565

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373910 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRewriteModernObjC - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Mon, 7 Oct 2019 13:58:15 +0000 (13:58 +0000)]
RewriteModernObjC - silence static analyzer getAs<> null dereference 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373905 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAST - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Mon, 7 Oct 2019 13:58:05 +0000 (13:58 +0000)]
AST - silence static analyzer getAs<> null dereference 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373904 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ASTImporter][NFC] Enable disabled but passing test
Gabor Marton [Mon, 7 Oct 2019 11:34:54 +0000 (11:34 +0000)]
[ASTImporter][NFC] Enable disabled but passing test

RedeclChainShouldBeCorrectAmongstNamespaces

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373896 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ASTImporter][NFC] Update ASTImporter internals docs
Gabor Marton [Mon, 7 Oct 2019 11:15:18 +0000 (11:15 +0000)]
[ASTImporter][NFC] Update ASTImporter internals docs

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373895 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ASTImporter][NFC] Fix typo in user docs
Gabor Marton [Mon, 7 Oct 2019 11:14:53 +0000 (11:14 +0000)]
[ASTImporter][NFC] Fix typo in user docs

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373894 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoclang-cl: Ignore the new /ZH options
Hans Wennborg [Mon, 7 Oct 2019 09:30:15 +0000 (09:30 +0000)]
clang-cl: Ignore the new /ZH options

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.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373887 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[c++20] Check for a class-specific operator delete when deleting an
Richard Smith [Mon, 7 Oct 2019 03:14:28 +0000 (03:14 +0000)]
[c++20] Check for a class-specific operator delete when deleting an
object of class type with a virtual destructor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373875 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix behavior of __builtin_bit_cast when the From and To types are the
Richard Smith [Mon, 7 Oct 2019 02:45:12 +0000 (02:45 +0000)]
Fix behavior of __builtin_bit_cast when the From and To types are the
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373874 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoImplements CWG 1601 in [over.ics.rank/4.2]
Richard Smith [Sun, 6 Oct 2019 18:50:40 +0000 (18:50 +0000)]
Implements CWG 1601 in [over.ics.rank/4.2]

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373866 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Sema] Avoids an assertion failure when an invalid conversion declaration is used
Richard Smith [Sun, 6 Oct 2019 18:40:59 +0000 (18:40 +0000)]
[Sema] Avoids an assertion failure when an invalid conversion declaration is 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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373862 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] don't assume 'inbounds' for bitcast pointer to GEP transform (PR43501)
Sanjay Patel [Sun, 6 Oct 2019 13:08:08 +0000 (13:08 +0000)]
[InstCombine] don't assume 'inbounds' for bitcast pointer to GEP transform (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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373847 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang-format][docs] Fix the Google C++ and Chromium style guide URLs
Paul Hoad [Sun, 6 Oct 2019 09:37:58 +0000 (09:37 +0000)]
[clang-format][docs] Fix the Google C++ and Chromium style guide URLs

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373844 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoTry to fix sphinx indentation error
Simon Pilgrim [Sat, 5 Oct 2019 16:08:17 +0000 (16:08 +0000)]
Try to fix sphinx indentation error

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373831 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRewriteObjC - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Sat, 5 Oct 2019 13:42:14 +0000 (13:42 +0000)]
RewriteObjC - silence static analyzer getAs<> null dereference warnings. NFCI.

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373829 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Diagnostics] Highlight expr's source range for -Wbool-operation
David Bolvansky [Sat, 5 Oct 2019 13:28:15 +0000 (13:28 +0000)]
[Diagnostics] Highlight expr's source range for -Wbool-operation

Warning message looks better; and GCC adds it too.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373828 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoSemaTemplate - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Sat, 5 Oct 2019 13:21:08 +0000 (13:21 +0000)]
SemaTemplate - silence static analyzer getAs<> null dereference warnings. NFCI.

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373827 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoTreeTransform - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Sat, 5 Oct 2019 13:20:59 +0000 (13:20 +0000)]
TreeTransform - silence static analyzer getAs<> null dereference warnings. NFCI.

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373826 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRemove redundant !HasDependentValue check. NFCI.
Simon Pilgrim [Sat, 5 Oct 2019 13:20:51 +0000 (13:20 +0000)]
Remove redundant !HasDependentValue check. NFCI.

Fixes cppcheck warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373825 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoSemaStmt - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Sat, 5 Oct 2019 13:20:42 +0000 (13:20 +0000)]
SemaStmt - silence static analyzer getAs<> null dereference warnings. NFCI.

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373824 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang-format] SpacesInSquareBrackets should affect lambdas with parameters too
Paul Hoad [Sat, 5 Oct 2019 09:55:23 +0000 (09:55 +0000)]
[clang-format] SpacesInSquareBrackets should affect lambdas with parameters too

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373821 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFCI] Slightly improve warning message
David Bolvansky [Sat, 5 Oct 2019 08:09:06 +0000 (08:09 +0000)]
[NFCI] Slightly improve warning message

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373818 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Diagnostics] Use Expr::isKnownToHaveBooleanValue() to check bitwise negation of...
David Bolvansky [Sat, 5 Oct 2019 08:02:11 +0000 (08:02 +0000)]
[Diagnostics] Use Expr::isKnownToHaveBooleanValue() to check bitwise negation of bool in languages without a bool type

Thanks for this advice, Richard Trieu!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373817 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang] fix a typo from r372531
Yuanfang Chen [Fri, 4 Oct 2019 21:37:20 +0000 (21:37 +0000)]
[clang] fix a typo from r372531

Reviewers: xbolva00

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D68482

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373792 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang] [cmake] Use add_clang_tool() to install all tools
Michal Gorny [Fri, 4 Oct 2019 20:28:59 +0000 (20:28 +0000)]
[clang] [cmake] Use add_clang_tool() to install all tools

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373785 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Sema] Split out -Wformat-type-confusion from -Wformat-pedantic
Erik Pilkington [Fri, 4 Oct 2019 19:20:27 +0000 (19:20 +0000)]
[Sema] Split out -Wformat-type-confusion from -Wformat-pedantic

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373774 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd missing null pointer check in -ftime-trace code
Reid Kleckner [Fri, 4 Oct 2019 18:57:01 +0000 (18:57 +0000)]
Add missing null pointer check in -ftime-trace code

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373771 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CMake] Clang: Don't use object libraries with Xcode
Jordan Rose [Fri, 4 Oct 2019 18:17:58 +0000 (18:17 +0000)]
[CMake] Clang: Don't use object libraries with Xcode

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373769 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OPENMP50]Suppport for multiple vendors in the same vendor context
Alexey Bataev [Fri, 4 Oct 2019 15:58:45 +0000 (15:58 +0000)]
[OPENMP50]Suppport for multiple vendors in the same vendor context
selector.

According to OpenMP 5.0, multiple vendors could be specified in the
vendor context selector via ',' as a separator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373756 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoSemaDeclAttr - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Fri, 4 Oct 2019 15:02:46 +0000 (15:02 +0000)]
SemaDeclAttr - silence static analyzer getAs<> null dereference 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373753 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoCGBlocks - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Fri, 4 Oct 2019 15:01:54 +0000 (15:01 +0000)]
CGBlocks - silence static analyzer getAs<> null dereference 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373752 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang-format] C++11 braced lists should respect the SpacesInParentheses setting
Paul Hoad [Fri, 4 Oct 2019 14:25:20 +0000 (14:25 +0000)]
[clang-format] C++11 braced lists should respect the SpacesInParentheses setting

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373751 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang-format] [PR43531] clang-format damages "alternative representations" for operators
Paul Hoad [Fri, 4 Oct 2019 14:16:59 +0000 (14:16 +0000)]
[clang-format] [PR43531] clang-format damages "alternative representations" 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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373750 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFurther improve -Wbool-operation bitwise negation message
Sam McCall [Fri, 4 Oct 2019 14:11:05 +0000 (14:11 +0000)]
Further improve -Wbool-operation bitwise negation message

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373749 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang-rename] Fix a crash when renaming a class without definition.
Haojian Wu [Fri, 4 Oct 2019 14:09:31 +0000 (14:09 +0000)]
[clang-rename] Fix a crash when renaming a class without definition.

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D68459

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373748 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang-format] [PR42417] clang-format inserts a space after '->' for operator->(...
Paul Hoad [Fri, 4 Oct 2019 13:24:15 +0000 (13:24 +0000)]
[clang-format] [PR42417] clang-format inserts a space after '->' for 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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373746 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang] Prevent false positives in arm-mfpu-none codegen test.
Simon Tatham [Fri, 4 Oct 2019 13:01:41 +0000 (13:01 +0000)]
[clang] Prevent false positives in arm-mfpu-none codegen test.

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.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373744 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFCI] Improve the -Wbool-operation's warning message
David Bolvansky [Fri, 4 Oct 2019 12:55:13 +0000 (12:55 +0000)]
[NFCI] Improve the -Wbool-operation's warning message

Based on the request from the post commit review. Also added one new test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373743 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Format] Fix docs after r373439
Sam McCall [Fri, 4 Oct 2019 09:52:54 +0000 (09:52 +0000)]
[Format] Fix docs after r373439

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373724 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Driver] NFC: Remove duplicate call to getLibGccType
Cullen Rhodes [Fri, 4 Oct 2019 08:26:37 +0000 (08:26 +0000)]
[Driver] NFC: Remove duplicate call to getLibGccType

Reviewed By: saugustine

Differential Revision: https://reviews.llvm.org/D68380

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373712 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[lldb][modern-type-lookup] No longer import temporary declarations into the persisten...
Raphael Isemann [Fri, 4 Oct 2019 08:26:17 +0000 (08:26 +0000)]
[lldb][modern-type-lookup] No longer import temporary declarations into the 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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373711 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CodeComplete] Ensure object is the same in compareOverloads()
Ilya Biryukov [Fri, 4 Oct 2019 08:10:27 +0000 (08:10 +0000)]
[CodeComplete] Ensure object is the same in compareOverloads()

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373710 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang-format] [PR43338] C# clang format has space issues betweern C# only keywords
Paul Hoad [Fri, 4 Oct 2019 08:10:22 +0000 (08:10 +0000)]
[clang-format] [PR43338] C# clang format has space issues betweern C# only 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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373709 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang-format] [PR43333] Fix C# breaking before function name when using Attributes
Paul Hoad [Fri, 4 Oct 2019 07:56:49 +0000 (07:56 +0000)]
[clang-format] [PR43333] Fix C# breaking before function name when using 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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373707 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang] [cmake] Add distribution install targets for remaining components
Michal Gorny [Fri, 4 Oct 2019 05:43:20 +0000 (05:43 +0000)]
[clang] [cmake] Add distribution install targets for remaining components

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373695 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoProperly handle instantiation-dependent array bounds.
Richard Smith [Fri, 4 Oct 2019 01:25:59 +0000 (01:25 +0000)]
Properly handle instantiation-dependent array bounds.

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373685 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OPENMP]Fix the test on Windows, NFC.
Alexey Bataev [Thu, 3 Oct 2019 22:10:33 +0000 (22:10 +0000)]
[OPENMP]Fix the test on Windows, NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373672 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoASTContext - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Thu, 3 Oct 2019 21:47:42 +0000 (21:47 +0000)]
ASTContext - silence static analyzer getAs<> null dereference warnings. NFCI.

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<>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373667 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoOverloadCandidate::getNumParams - silence static analyzer getAs<FunctionProtoType...
Simon Pilgrim [Thu, 3 Oct 2019 21:27:02 +0000 (21:27 +0000)]
OverloadCandidate::getNumParams - silence static analyzer 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373665 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OPENMP50]Codegen support for scores in context selectors.
Alexey Bataev [Thu, 3 Oct 2019 20:49:48 +0000 (20:49 +0000)]
[OPENMP50]Codegen support for scores in context selectors.

If the context selector has associated score and several contexts
selectors matches current context, the function with the highest score
must be selected.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373661 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[HIP] Use option -nogpulib to disable linking device lib
Yaxun Liu [Thu, 3 Oct 2019 18:59:56 +0000 (18:59 +0000)]
[HIP] Use option -nogpulib to disable linking device lib

Differential Revision: https://reviews.llvm.org/D68300

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373649 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoCheck for qualified function types after substituting into the operand
Richard Smith [Thu, 3 Oct 2019 18:55:23 +0000 (18:55 +0000)]
Check for qualified function types after substituting into the operand
of 'typeid'.

This is a rare place where it's valid for a function type to be
substituted but not valid for a qualified function type to be
substituted, so needs a special check.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373648 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang-format] Add ability to wrap braces after multi-line control statements
Paul Hoad [Thu, 3 Oct 2019 18:42:31 +0000 (18:42 +0000)]
[clang-format] Add ability to wrap braces after multi-line control statements

Summary:
Change the BraceWrappingFlags' AfterControlStatement from a bool to an enum with three values:

* "Never": This is the default, and does not do any brace wrapping after control statements.
* "MultiLine": This only wraps braces after multi-line control statements (this really only happens when a ColumnLimit is specified).
* "Always": This always wraps braces after control statements.

The first and last options are backwards-compatible with "false" and "true", respectively.

The new "MultiLine" option is useful for when a wrapped control statement's indentation matches the subsequent block's indentation. It makes it easier to see at a glance where the control statement ends and where the block's code begins. For example:

```
if (
  foo
  && bar )
{
  baz();
}
```

vs.

```
if (
  foo
  && bar ) {
  baz();
}
```

Short control statements (1 line) do not wrap the brace to the next line, e.g.

```
if (foo) {
  bar();
} else {
  baz();
}
```

Reviewers: sammccall, owenpan, reuk, MyDeveloperDay, klimek

Reviewed By: MyDeveloperDay

Subscribers: MyDeveloperDay, cfe-commits

Patch By: mitchell-stellar

Tags: #clang-format, #clang, #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D68296

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373647 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoPR43547: substitute into the type of a non-type template parameter if
Richard Smith [Thu, 3 Oct 2019 18:24:40 +0000 (18:24 +0000)]
PR43547: substitute into the type of a non-type template parameter if
it's instantiation-dependent, even if it's not dependent.

There might be a SFINAE check in the parameter type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373643 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[HIP] Enable specifying different default gpu arch for HIP/CUDA.
Michael Liao [Thu, 3 Oct 2019 17:49:20 +0000 (17:49 +0000)]
[HIP] Enable specifying different default gpu arch for HIP/CUDA.

Reviewers: tra, yaxunl

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D68394

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373634 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoDeclBase/DeclCXX/DeclTemplate - silence static analyzer getAs<> null dereference...
Simon Pilgrim [Thu, 3 Oct 2019 16:58:01 +0000 (16:58 +0000)]
DeclBase/DeclCXX/DeclTemplate - silence static analyzer getAs<> null dereference 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373626 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OPENMP]Fix emission of the declare target variables in device mode.
Alexey Bataev [Thu, 3 Oct 2019 16:46:49 +0000 (16:46 +0000)]
[OPENMP]Fix emission of the declare target variables in device mode.

Declare target variables must be emitted in device mode, target triples
can be empty in this case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373624 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OPENMP]Improve diagnostics for not found declare target entries.
Alexey Bataev [Thu, 3 Oct 2019 16:20:34 +0000 (16:20 +0000)]
[OPENMP]Improve diagnostics for not found declare target entries.

We can point to the target region + emit parent functions names/real var
names if they were not found in host module during device codegen.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373620 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Added missing changes for rL373614
David Bolvansky [Thu, 3 Oct 2019 15:26:26 +0000 (15:26 +0000)]
[NFC] Added missing changes for rL373614

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373616 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Diagnostics] Bitwise negation of a boolean expr always evaluates to true; warn with...
David Bolvansky [Thu, 3 Oct 2019 15:17:59 +0000 (15:17 +0000)]
[Diagnostics] Bitwise negation of a boolean expr always evaluates to true; warn with -Wbool-operation

Requested here:
http://lists.llvm.org/pipermail/cfe-dev/2019-October/063452.html

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373614 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix MSVC "result of 32-bit shift implicitly converted to 64 bits" warning. NFCI.
Simon Pilgrim [Thu, 3 Oct 2019 15:10:47 +0000 (15:10 +0000)]
Fix MSVC "result of 32-bit shift implicitly converted to 64 bits" warning. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373613 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoExprConstant - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Thu, 3 Oct 2019 15:08:30 +0000 (15:08 +0000)]
ExprConstant - silence static analyzer getAs<> null dereference 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373612 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRemove duplicate P->getAs<PointerType>() call. NFCI.
Simon Pilgrim [Thu, 3 Oct 2019 15:08:20 +0000 (15:08 +0000)]
Remove duplicate P->getAs<PointerType>() call. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373611 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Alignment][NFC] Remove StoreInst::setAlignment(unsigned)
Guillaume Chatelet [Thu, 3 Oct 2019 13:17:21 +0000 (13:17 +0000)]
[Alignment][NFC] Remove StoreInst::setAlignment(unsigned)

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet, bollu, jdoerfert

Subscribers: hiraditya, asbirlea, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D68268

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373595 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[libTooling] Add various Stencil combinators for expressions.
Yitzhak Mandelbaum [Thu, 3 Oct 2019 13:01:00 +0000 (13:01 +0000)]
[libTooling] Add various Stencil combinators for expressions.

Summary:
This revision adds three new Stencil combinators:
* `expression`, which idiomatically constructs the source for an expression,
  including wrapping the expression's source in parentheses if needed.
* `deref`, which constructs an idiomatic dereferencing expression.
* `addressOf`, which constructs an idiomatic address-taking expression.

Reviewers: gribozavr

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D68315

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373593 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Alignment][Clang][NFC] Add CharUnits::getAsAlign
Guillaume Chatelet [Thu, 3 Oct 2019 13:00:29 +0000 (13:00 +0000)]
[Alignment][Clang][NFC] Add CharUnits::getAsAlign

Summary:
This is a prerequisite to removing `llvm::GlobalObject::setAlignment(unsigned)`.
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: jholewinski, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D68274

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373592 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoSilence static analyzer getAs<RecordType> null dereference warnings. NFCI.
Simon Pilgrim [Thu, 3 Oct 2019 11:22:48 +0000 (11:22 +0000)]
Silence static analyzer getAs<RecordType> null dereference warnings. NFCI.

The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<RecordType> directly and if not assert will fire for us.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373584 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang][NFC] Fix misspellings in ExternalASTMerger.h
Raphael Isemann [Thu, 3 Oct 2019 09:55:13 +0000 (09:55 +0000)]
[clang][NFC] Fix misspellings in ExternalASTMerger.h

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373577 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix driver tests when `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR` is `ON`
Serge Pavlov [Thu, 3 Oct 2019 04:52:46 +0000 (04:52 +0000)]
Fix driver tests when `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR` is `ON`

Some Driver tests relied on the default resource direcory having per-os per-arch
subdirectory layout, and when clang is built with `-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON`,
those test fail, because clang by default assumes per-target subdirectories.

Explicitly set `-resource-dir` flag to point to a tree with per-os per-arch layout.

See also: D45604, D62469

Differential Revision: https://reviews.llvm.org/D66981

Patch by Sergej Jaskiewicz <jaskiewiczs@icloud.com>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373565 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[HIP] Support -emit-llvm for device compilation
Yaxun Liu [Thu, 3 Oct 2019 03:27:43 +0000 (03:27 +0000)]
[HIP] Support -emit-llvm for device compilation

Sometimes it is useful to compile HIP device code to LLVM BC. It is not convenient to use clang -cc1 since
there are lots of options needed.

This patch allows clang driver to compile HIP device code to LLVM BC with -emit-llvm -c.

Differential Revision: https://reviews.llvm.org/D68284

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373561 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert 373538 and follow-ups 373549 and 373552.
Nico Weber [Thu, 3 Oct 2019 02:38:43 +0000 (02:38 +0000)]
Revert 373538 and follow-ups 373549 and 373552.

They break tests on (at least) macOS.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373556 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoPR43519: don't inject a diagnostic when constant-evaulation of a
Richard Smith [Thu, 3 Oct 2019 01:20:27 +0000 (01:20 +0000)]
PR43519: don't inject a diagnostic when constant-evaulation of a
pointer-to-member call can't determine a callee.

We will have produced a diagnostic already if the callee is known to be
unevaluatable, and diagnosing here rejects valid code during potential
constant expression checking.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373553 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFixing broken builds due to r373538, issues with filepath and hexagon toolchain.
Puyan Lotfi [Thu, 3 Oct 2019 01:19:51 +0000 (01:19 +0000)]
Fixing broken builds due to r373538, issues with filepath and hexagon toolchain.

It appears there are some issues with the hexagon toolchain, and also the file
path for the library file. If this doesn't fix the remaining breakages I will
attempt a revert.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373552 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFixing broken builds due to r373538 due to test that should have been deleted.
Puyan Lotfi [Thu, 3 Oct 2019 00:41:13 +0000 (00:41 +0000)]
Fixing broken builds due to r373538 due to test that should have been deleted.

test/InterfaceStubs/object.cpp should have been deleted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373549 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoMark P0784R7 as complete and start defining its feature-test macro.
Richard Smith [Thu, 3 Oct 2019 00:39:37 +0000 (00:39 +0000)]
Mark P0784R7 as complete and start defining its feature-test macro.

Note that this only covers the language side of this feature. (The
library side has its own feature test macro.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373548 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFor P0784R7: support placement new-expressions in constant evaluation.
Richard Smith [Thu, 3 Oct 2019 00:39:35 +0000 (00:39 +0000)]
For P0784R7: support placement new-expressions in constant evaluation.

For now, we restrict this support to use from within the standard
library implementation, since we're required to make parts of the
standard library that use placement new work, but not permitted to
make uses of placement new from user code work.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373547 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFor P0784R7: allow direct calls to operator new / operator delete from
Richard Smith [Thu, 3 Oct 2019 00:39:33 +0000 (00:39 +0000)]
For P0784R7: allow direct calls to operator new / operator delete from
std::allocator::{allocate,deallocate} in constant evaluation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373546 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang][ifs] Clang Interface Stubs ToolChain plumbing.
Puyan Lotfi [Wed, 2 Oct 2019 22:50:07 +0000 (22:50 +0000)]
[clang][ifs] Clang Interface Stubs ToolChain plumbing.

This patch enables end to end support for generating ELF interface stubs
directly from clang. Now the following:

clang -emit-interface-stubs -o libfoo.so a.cpp b.cpp c.cpp

will product an ELF binary with visible symbols populated. Visibility attributes
and -fvisibility can be used to control what gets populated.

* Adding ToolChain support for clang Driver IFS Merge Phase
* Implementing a default InterfaceStubs Merge clang Tool, used by ToolChain
* Adds support for the clang Driver to involve llvm-ifs on ifs files.
* Adds -emit-merged-ifs flag, to tell llvm-ifs to emit a merged ifs text file
  instead of the final object format (normally ELF)

Differential Revision: https://reviews.llvm.org/D63978

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373538 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix uninitialized variable warning in CodeGenPGO constructor. NFCI.
Simon Pilgrim [Wed, 2 Oct 2019 21:05:21 +0000 (21:05 +0000)]
Fix uninitialized variable warning in CodeGenPGO constructor. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373526 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoItaniumCXXABI - silence static analyzer getAs<RecordType> null dereference warnings...
Simon Pilgrim [Wed, 2 Oct 2019 20:45:16 +0000 (20:45 +0000)]
ItaniumCXXABI - silence static analyzer getAs<RecordType> null dereference warnings. NFCI.

The static analyzer is warning about potential null dereferences, but we should be able to use castAs<RecordType> directly and if not assert will fire for us.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373525 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Clang][Driver][NFC] Corrected DeviceActionBuilder methods' comments.
Sergey Dmitriev [Wed, 2 Oct 2019 20:44:45 +0000 (20:44 +0000)]
[Clang][Driver][NFC] Corrected DeviceActionBuilder methods' comments.

Differential Revision: https://reviews.llvm.org/D68355

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373523 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoCGObjCMac - silence static analyzer dyn_cast<>/getAs<> null dereference warnings...
Simon Pilgrim [Wed, 2 Oct 2019 20:30:37 +0000 (20:30 +0000)]
CGObjCMac - silence static analyzer dyn_cast<>/getAs<> null dereference warnings. NFCI.

The static analyzer is warning about potential null dereferences, but we should be able to use cast<>/castAs<> directly and if not assert will fire for us.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373520 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Stencil] Hide implementaion detai. NFC.
Benjamin Kramer [Wed, 2 Oct 2019 18:33:44 +0000 (18:33 +0000)]
[Stencil] Hide implementaion detai. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373504 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OPENMP50]Add parsing/sema analysis for declare variant score.
Alexey Bataev [Wed, 2 Oct 2019 18:19:02 +0000 (18:19 +0000)]
[OPENMP50]Add parsing/sema analysis for declare variant score.

Context selectors may include optional score clause in format
`score(<expr>):`, where `<expr>` must be a constant integer expression.
Added parsing/sema analysis only.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373502 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoType - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Wed, 2 Oct 2019 16:03:36 +0000 (16:03 +0000)]
Type - silence static analyzer getAs<> null dereference 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373480 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoSilence static analyzer getAs<VectorType> null dereference warnings. NFCI.
Simon Pilgrim [Wed, 2 Oct 2019 15:31:25 +0000 (15:31 +0000)]
Silence static analyzer getAs<VectorType> null dereference warnings. NFCI.

The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<VectorType> directly and if not assert will fire for us.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373478 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoSemaOverload - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Wed, 2 Oct 2019 14:02:27 +0000 (14:02 +0000)]
SemaOverload - silence static analyzer getAs<> null dereference 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373475 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoSemaInit - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Wed, 2 Oct 2019 14:02:18 +0000 (14:02 +0000)]
SemaInit - silence static analyzer getAs<> null dereference 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373474 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoLog2_32 returns an unsigned. NFCI.
Simon Pilgrim [Wed, 2 Oct 2019 11:49:32 +0000 (11:49 +0000)]
Log2_32 returns an unsigned. NFCI.

Silences clang static analyzer warning about out of bounds (negative) shifts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373451 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoASTContext - silence static analyzer getAs<> null dereference warnings. NFCI.
Simon Pilgrim [Wed, 2 Oct 2019 11:48:06 +0000 (11:48 +0000)]
ASTContext - silence static analyzer getAs<> null dereference warnings. NFCI.

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373447 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ClangFormat] relnotes for r373439
Sam McCall [Wed, 2 Oct 2019 09:52:52 +0000 (09:52 +0000)]
[ClangFormat] relnotes for r373439

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373441 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang-rename] Better renaming the typedef decl.
Haojian Wu [Wed, 2 Oct 2019 09:50:46 +0000 (09:50 +0000)]
[clang-rename] Better renaming the typedef decl.

Summary:
when renaming a typedef decl, we used to rename the underlying decl of the
typedef, we should rename the typedef itself.

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D68322

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373440 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ClangFormat] Future-proof Standard option, allow floating or pinning to arbitrary...
Sam McCall [Wed, 2 Oct 2019 09:50:40 +0000 (09:50 +0000)]
[ClangFormat] Future-proof Standard option, allow floating or pinning to arbitrary lang version

Summary:
The historical context:
- clang-format was written when C++11 was current,
  and the main language-version concern was >> vs > > template-closers.
  An option was added to allow selection of the 03/11 behavior, or auto-detection.
- there was no option to choose simply "latest standard" so anyone who didn't
  ever want 03 behavior or auto-detection specified Cpp11.
- In r185149 this option started to affect lexer mode.
- no options were added to cover c++14, as parsing/formatting
  didn't change that much. The usage of Cpp11 to mean "latest" became
  codified e.g. in r206263
- c++17 added some new constructs. These were mostly backwards-compatible and so
  not used in old programs, so having no way to turn them off was OK.
- c++20 added some new constructs and keywords (e.g. co_*) that changed the
  meaning of existing programs, and people started to complain that
  the c++20 parsing couldn't be turned off.

New plan:
 - Default ('Auto') behavior remains unchanged: parse as latest, format
   template-closers based on input.
 - Add new 'Latest' option that more clearly expresses the intent "use
   modern features" that many projects have chosen for their .clang-format files.
 - Allow pinning to *any* language version, using the same name as clang -std:
   c++03, c++11, c++14 etc. These set precise lexer options, and any
   clang-format code depending on these can use a >= check.
 - For backwards compatibility, `Cpp11` is an alias for `Latest`, not `c++11`.
   This matches the historical documented semantics of this option.
   This spelling (and `Cpp03`) are deprecated.

Reviewers: klimek, modocache

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D67541

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373439 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRename TypeNodes.def to TypeNodes.inc for consistency across all
John McCall [Wed, 2 Oct 2019 06:35:23 +0000 (06:35 +0000)]
Rename TypeNodes.def to TypeNodes.inc for consistency across all
our autogenerated files.  NFC.

As requested by Nico Weber.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373425 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert r368237 - Update fix-it hints for std::move warnings.
Richard Trieu [Wed, 2 Oct 2019 02:32:15 +0000 (02:32 +0000)]
Revert r368237 - Update fix-it hints for std::move warnings.

r368237 attempted to improve fix-its for move warnings, but introduced some
regressions to -Wpessimizing-move.  Revert that change and add the missing
test cases to the pessimizing move test to prevent future regressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373421 91177308-0d34-0410-b5e6-96231b3b80d8