[PATCH] D69327: [Clang][ThinLTO] Add a cache for compile phase output.

2019-10-24 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen added a comment.

In D69327#1719419 , @steven_wu wrote:

> In D69327#1719411 , @ychen wrote:
>
> > Thanks for the inputs @steven_wu @tejohnson. Totally agree with the points 
> > you brought up. One last thing I'm not quite sure is the caching of 
> > `-fthin-link-bitcode`. It is a `-cc1` option since it is a kind of 
> > implementation of ThinLTO, right? I'm a little hesitant to begin writing up 
> > patches to teach build system/caching tool (I could think of at least three 
> > for our workload) to recognize this option because of that. If there are 
> > any changes to the option, the same thing needs to be done again. Do you 
> > have any thoughts on that? Is the option in use for your workload and do 
> > you think it is stable enough to have build systems caching for it? 
> > (Another option is to produce `-fthin-link-bitcode` output post compile 
> > time which I assume having total build time impact to some degree).
>
>
> `-fthin-link-bitcode` option is used to run distributed thin link. The format 
> is not stable but it is deterministic for a fixed compiler version. You 
> should be able to cache the thin-link-bitcode and expected it to be used only 
> by the same compiler version.
>
> For any build system that implements caching, it must take compiler version 
> into consideration because different compiler will produce different output. 
> I don't think the rule to cache thin-link-bitcode is any different from any 
> other output during the build.


I tried ccache, it does not cache `-fthin-link-bitcode` output.

From this link, it seems ccache only cares about "-o" output. 
https://github.com/ccache/ccache/blob/ac9911b47b8a3777d20a3c481f90f877e8f9a81d/src/ccache.cpp#L2616


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69327/new/

https://reviews.llvm.org/D69327



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69327: [Clang][ThinLTO] Add a cache for compile phase output.

2019-10-24 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen added a comment.

Sorry for the confusion @steven_wu. By `stable` I mean the probability that the 
`-fthin-link-bitcode` option is replaced with some other thinlink mechanism 
under the distributed build environment. Since at least for ccache, the 
compilation output caching depends on the semantics of options ("-o" is assumed 
to be compilation output). For the case of  `-fthin-link-bitcode`,  both 
`-Xclang -fthin-link-bitcode` and `-o` are the output. I'm not familiar with 
compiler cache tools, but having the caching depends on a cc1 option feels not 
right since it is not an option of any other compilers, so most caching tools 
don't recognize it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69327/new/

https://reviews.llvm.org/D69327



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D67545: [clang-tidy] Added DefaultOperatorNewCheck.

2019-10-24 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 226206.
balazske added a comment.

- Improved check for C++17.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67545/new/

https://reviews.llvm.org/D67545

Files:
  clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp
  clang-tools-extra/clang-tidy/cert/CMakeLists.txt
  clang-tools-extra/clang-tidy/cert/DefaultOperatorNewAlignmentCheck.cpp
  clang-tools-extra/clang-tidy/cert/DefaultOperatorNewAlignmentCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/cert-mem57-cpp.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/test/clang-tidy/cert-mem57-cpp-cpp17.cpp
  clang-tools-extra/test/clang-tidy/cert-mem57-cpp.cpp

Index: clang-tools-extra/test/clang-tidy/cert-mem57-cpp.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/cert-mem57-cpp.cpp
@@ -0,0 +1,39 @@
+// RUN: %check_clang_tidy %s -std=c++14 cert-mem57-cpp %t
+
+namespace std {
+typedef __typeof(sizeof(int)) size_t;
+void *aligned_alloc(size_t, size_t);
+void free(void *);
+} // namespace std
+
+struct alignas(32) Vector1 {
+  char elems[32];
+};
+
+struct Vector2 {
+  char elems[32];
+};
+
+struct alignas(32) Vector3 {
+  char elems[32];
+  static void *operator new(std::size_t nbytes) noexcept(true) {
+return std::aligned_alloc(alignof(Vector3), nbytes);
+  }
+  static void operator delete(void *p) {
+std::free(p);
+  }
+};
+
+struct alignas(8) Vector4 {
+  char elems[32];
+};
+
+void f() {
+  auto *V1 = new Vector1;
+  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: allocation function returns a pointer with alignment 16 but the over-aligned type being allocated requires alignment 32 [cert-mem57-cpp]
+  auto *V2 = new Vector2;
+  auto *V3 = new Vector3;
+  auto *V4 = new Vector4;
+  auto *V1_Arr = new Vector1[2];
+  // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: allocation function returns a pointer with alignment 16 but the over-aligned type being allocated requires alignment 32 [cert-mem57-cpp]
+}
Index: clang-tools-extra/test/clang-tidy/cert-mem57-cpp-cpp17.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/cert-mem57-cpp-cpp17.cpp
@@ -0,0 +1,12 @@
+// RUN: %check_clang_tidy %s -std=c++14 cert-mem57-cpp %t
+// RUN: clang-tidy --extra-arg='-std=c++17' -checks='-*,cert-mem57-cpp' --warnings-as-errors='*' %s
+// RUN: clang-tidy --extra-arg='-std=c++2a' -checks='-*,cert-mem57-cpp' --warnings-as-errors='*' %s
+
+struct alignas(32) Vector {
+  char Elems[32];
+};
+
+void f() {
+  auto *V1 = new Vector;// CHECK-MESSAGES: warning: allocation function returns a pointer with alignment 16 but the over-aligned type being allocated requires alignment 32 [cert-mem57-cpp]
+  auto *V1_Arr = new Vector[2]; // CHECK-MESSAGES: warning: allocation function returns a pointer with alignment 16 but the over-aligned type being allocated requires alignment 32 [cert-mem57-cpp]
+}
Index: clang-tools-extra/docs/clang-tidy/checks/list.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/list.rst
+++ clang-tools-extra/docs/clang-tidy/checks/list.rst
@@ -98,6 +98,7 @@
cert-err61-cpp (redirects to misc-throw-by-value-catch-by-reference) 
cert-fio38-c (redirects to misc-non-copyable-objects) 
cert-flp30-c
+   cert-mem57-cpp
cert-msc30-c (redirects to cert-msc50-cpp) 
cert-msc32-c (redirects to cert-msc51-cpp) 
cert-msc50-cpp
Index: clang-tools-extra/docs/clang-tidy/checks/cert-mem57-cpp.rst
===
--- /dev/null
+++ clang-tools-extra/docs/clang-tidy/checks/cert-mem57-cpp.rst
@@ -0,0 +1,16 @@
+.. title:: clang-tidy - cert-mem57-cpp
+
+cert-mem57-cpp
+==
+
+This check flags uses of default ``operator new`` where the type has extended
+alignment (an alignment greater than the fundamental alignment). (The default
+``operator new`` is guaranteed to provide the correct alignmment if the
+requested alignment is less or equal to the fundamental alignment).
+Only cases are detected (by design) where the ``operator new`` is not
+user-defined and is not a placement new (the reason is that in these cases we
+assume that the user provided the correct memory allocation).
+
+This check corresponds to the CERT C++ Coding Standard rule
+`MEM57-CPP. Avoid using default operator new for over-aligned types
+`_.
Index: clang-tools-extra/docs/ReleaseNotes.rst
===
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -73,6 +73,12 @@
   Finds instances where variables with static storage are initialized
   dynamically in heade

[clang-tools-extra] bf71e4f - [clangd] Collect name references in the index.

2019-10-24 Thread Haojian Wu via cfe-commits

Author: Haojian Wu
Date: 2019-10-24T10:25:16+02:00
New Revision: bf71e4fe0a68085d29e9e883da1f17ae73945643

URL: 
https://github.com/llvm/llvm-project/commit/bf71e4fe0a68085d29e9e883da1f17ae73945643
DIFF: 
https://github.com/llvm/llvm-project/commit/bf71e4fe0a68085d29e9e883da1f17ae73945643.diff

LOG: [clangd] Collect name references in the index.

Summary:
This is used for cross-file rename. When renaming a class, we expect to
rename all related constructors/destructors.

Reviewers: kadircet, ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang-tools-extra/clangd/index/SymbolCollector.cpp
clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/index/SymbolCollector.cpp 
b/clang-tools-extra/clangd/index/SymbolCollector.cpp
index 269a699b90ef..b0932dcf97ad 100644
--- a/clang-tools-extra/clangd/index/SymbolCollector.cpp
+++ b/clang-tools-extra/clangd/index/SymbolCollector.cpp
@@ -263,10 +263,6 @@ bool SymbolCollector::handleDeclOccurence(
Decl::FriendObjectKind::FOK_None) &&
   !(Roles & static_cast(index::SymbolRole::Definition)))
 return true;
-  // Skip non-semantic references, we should start processing these when we
-  // decide to implement renaming with index support.
-  if ((Roles & static_cast(index::SymbolRole::NameReference)))
-return true;
   // A declaration created for a friend declaration should not be used as the
   // canonical declaration in the index. Use OrigD instead, unless we've 
already
   // picked a replacement for D

diff  --git a/clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp 
b/clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
index af1729e3c9e9..798c5bbcd4e6 100644
--- a/clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
+++ b/clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
@@ -626,6 +626,23 @@ TEST_F(SymbolCollectorTest, Refs) {
   EXPECT_THAT(Refs, Not(Contains(Pair(findSymbol(MainSymbols, "c").ID, _;
 }
 
+TEST_F(SymbolCollectorTest, NameReferences) {
+  CollectorOpts.RefFilter = RefKind::All;
+  CollectorOpts.RefsInHeaders = true;
+  Annotations Header(R"(
+class [[Foo]] {
+public:
+  [[Foo]]() {}
+  ~[[Foo]]() {}
+};
+  )");
+  CollectorOpts.RefFilter = RefKind::All;
+  runSymbolCollector(Header.code(), "");
+  // When we find references for class Foo, we expect to see all
+  // constructor/destructor references.
+  EXPECT_THAT(Refs, Contains(Pair(findSymbol(Symbols, "Foo").ID,
+  HaveRanges(Header.ranges();
+}
 
 TEST_F(SymbolCollectorTest, HeaderAsMainFile) {
   CollectorOpts.RefFilter = RefKind::All;



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69338: [clangd] Collect name references in the index.

2019-10-24 Thread Haojian Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbf71e4fe0a68: [clangd] Collect name references in the index. 
(authored by hokein).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69338/new/

https://reviews.llvm.org/D69338

Files:
  clang-tools-extra/clangd/index/SymbolCollector.cpp
  clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp


Index: clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
===
--- clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
+++ clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
@@ -626,6 +626,23 @@
   EXPECT_THAT(Refs, Not(Contains(Pair(findSymbol(MainSymbols, "c").ID, _;
 }
 
+TEST_F(SymbolCollectorTest, NameReferences) {
+  CollectorOpts.RefFilter = RefKind::All;
+  CollectorOpts.RefsInHeaders = true;
+  Annotations Header(R"(
+class [[Foo]] {
+public:
+  [[Foo]]() {}
+  ~[[Foo]]() {}
+};
+  )");
+  CollectorOpts.RefFilter = RefKind::All;
+  runSymbolCollector(Header.code(), "");
+  // When we find references for class Foo, we expect to see all
+  // constructor/destructor references.
+  EXPECT_THAT(Refs, Contains(Pair(findSymbol(Symbols, "Foo").ID,
+  HaveRanges(Header.ranges();
+}
 
 TEST_F(SymbolCollectorTest, HeaderAsMainFile) {
   CollectorOpts.RefFilter = RefKind::All;
Index: clang-tools-extra/clangd/index/SymbolCollector.cpp
===
--- clang-tools-extra/clangd/index/SymbolCollector.cpp
+++ clang-tools-extra/clangd/index/SymbolCollector.cpp
@@ -263,10 +263,6 @@
Decl::FriendObjectKind::FOK_None) &&
   !(Roles & static_cast(index::SymbolRole::Definition)))
 return true;
-  // Skip non-semantic references, we should start processing these when we
-  // decide to implement renaming with index support.
-  if ((Roles & static_cast(index::SymbolRole::NameReference)))
-return true;
   // A declaration created for a friend declaration should not be used as the
   // canonical declaration in the index. Use OrigD instead, unless we've 
already
   // picked a replacement for D


Index: clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
===
--- clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
+++ clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
@@ -626,6 +626,23 @@
   EXPECT_THAT(Refs, Not(Contains(Pair(findSymbol(MainSymbols, "c").ID, _;
 }
 
+TEST_F(SymbolCollectorTest, NameReferences) {
+  CollectorOpts.RefFilter = RefKind::All;
+  CollectorOpts.RefsInHeaders = true;
+  Annotations Header(R"(
+class [[Foo]] {
+public:
+  [[Foo]]() {}
+  ~[[Foo]]() {}
+};
+  )");
+  CollectorOpts.RefFilter = RefKind::All;
+  runSymbolCollector(Header.code(), "");
+  // When we find references for class Foo, we expect to see all
+  // constructor/destructor references.
+  EXPECT_THAT(Refs, Contains(Pair(findSymbol(Symbols, "Foo").ID,
+  HaveRanges(Header.ranges();
+}
 
 TEST_F(SymbolCollectorTest, HeaderAsMainFile) {
   CollectorOpts.RefFilter = RefKind::All;
Index: clang-tools-extra/clangd/index/SymbolCollector.cpp
===
--- clang-tools-extra/clangd/index/SymbolCollector.cpp
+++ clang-tools-extra/clangd/index/SymbolCollector.cpp
@@ -263,10 +263,6 @@
Decl::FriendObjectKind::FOK_None) &&
   !(Roles & static_cast(index::SymbolRole::Definition)))
 return true;
-  // Skip non-semantic references, we should start processing these when we
-  // decide to implement renaming with index support.
-  if ((Roles & static_cast(index::SymbolRole::NameReference)))
-return true;
   // A declaration created for a friend declaration should not be used as the
   // canonical declaration in the index. Use OrigD instead, unless we've already
   // picked a replacement for D
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69263: [clangd] Implement cross-file rename.

2019-10-24 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments.



Comment at: clang-tools-extra/clangd/refactor/Rename.cpp:119
 
+llvm::Optional
+renameableOutsideFile(const NamedDecl &RenameDecl, const SymbolIndex *Index) {

hokein wrote:
> ilya-biryukov wrote:
> > So `llvm::None` means we do not reject?
> > Probably worth documenting that.
> > 
> > Maybe even add an enumerator `ReasonToReject::Accept`, indicating the 
> > symbol should be accepted and get rid of `Optional` altogether.
> > 
> > Otherwise this leads to code like:
> > ```
> > auto R = renameableOutsideFile(N, I);
> > if (!R) { // negative condition.
> >  return doRename(N, I); // But we're running the rename anyway... WAT?
> > }
> > ``
> yeah, returning `None` means that we accept the rename.
> 
> Adding `Accept` is not aligning with the mental model, `Accept` doesn't 
> belong to `ReasonToReject` I think. I agree the above given code is 
> misleading, but looking at the current code in this file, it doesn't seem too 
> bad, I think?
> 
> ```
>  if (auto Reject = renameableOutsideFile(*RenameDecl, RInputs.Index))
> return makeError(*Reject);
> ```
Agreed this aligns with the other functions we have in the file, so let's keep 
as is.



Comment at: clang-tools-extra/clangd/refactor/Rename.cpp:121
+renameableOutsideFile(const NamedDecl &RenameDecl, const SymbolIndex *Index) {
+  if (RenameDecl.getParentFunctionOrMethod())
+return None; // function-local symbols

hokein wrote:
> ilya-biryukov wrote:
> > This function resembles `renamableWithinFile`.
> > We should probably share implementation and pass an extra flag. Something 
> > like `isRenamable(..., bool IsCrossFile)`.
> > 
> > WDYT?
> though they look similar,  the logic is quite different, for example, we 
> query the index in within-file rename to detect a symbol is used outside of 
> the file which is not needed for cross-file rename, and cross-file rename 
> allows fewer symbols (as our index doesn't support them), so I don't think we 
> can share a lot of implementation.
Can this be handled with a special flag:
```
bool renameable(NamedDecl &Decl, const SymbolIndex *Index, bool CrossFile) {
  if (CrossFileRename) {
// check something special...
  }
}
```

Sharing implementation in the same function makes the differences between 
cross-file and single-file case obvious and also ensures any things that need 
to be updated for both are shared.



Comment at: clang-tools-extra/clangd/refactor/Rename.cpp:317
+  std::string OldName = RenameDecl->getNameAsString();
+  for (const auto &FileAndOccurrences : AffectedFiles) {
+llvm::StringRef FilePath = FileAndOccurrences.first();

hokein wrote:
> ilya-biryukov wrote:
> > I feel this code is fundamental to the trade-offs we made for rename.
> > Could we move this to a separate function and add unit-tests for it?
> > 
> > You probably want to have something that handles just a single file rather 
> > than all edits in all files, to avoid mocking VFS in tests, etc.
> > 
> > 
> Agree, especially when we start implementing complicated stuff, e.g. range 
> patching heuristics.
> 
>  Moved it out, but note that I don't plan to add more stuff in this initial 
> patch, so the logic is pretty straightforward, just assembling rename 
> replacement from occurrences.
> 
> but note that I don't plan to add more stuff in this initial patch
Should we also check whether the replaced text matches the expected identifier 
and add unit-tests for this?
Or would you prefer to move all changes to this function to a separate patch?



Comment at: clang-tools-extra/clangd/refactor/Rename.cpp:380
+auto MainFileRenameEdit =
+renameWithinFile(AST, RenameDecl, RInputs.NewName);
+if (!MainFileRenameEdit)

hokein wrote:
> ilya-biryukov wrote:
> > Can we rely on the fact that dynamic index should not be stale for the 
> > current file instead?
> > Or don't we have this invariant?
> > 
> > We end up having two implementations now: index-based and AST-based. It'd 
> > be nice to have just one.
> > If that's not possible in the first revision, could you explain why?
> > 
> > Note that moving the current-file rename to index-based implementation is 
> > independent of doing cross-file renames. Maybe we should start with it?
> I think we can't get rid of the AST-based rename -- mainly for renaming local 
> symbols (e.g. local variable in function body), as we don't index these 
> symbols...
Thanks, I believe you're right... We can't unify these implementations, at 
least not in the short term.

So `renameOutsideFile` fails on local symbols and `renameWithinFile` should 
handle that, right?
Also worth noting that `renameWithinFile` is AST-based and `renameOutsideFile` 
is index-based.
Could we document that?



Comment at: clang-tools-extra/clangd/refactor/Rename.cpp:357
+// Handle within-file rename.
+auto Reject = renamable

[PATCH] D66647: [clangd] DefineInline action apply logic with fully qualified names

2019-10-24 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 226209.
kadircet marked 20 inline comments as done.
kadircet added a comment.

- Address comments


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66647/new/

https://reviews.llvm.org/D66647

Files:
  clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp
  clang-tools-extra/clangd/unittests/TweakTesting.cpp
  clang-tools-extra/clangd/unittests/TweakTesting.h
  clang-tools-extra/clangd/unittests/TweakTests.cpp

Index: clang-tools-extra/clangd/unittests/TweakTests.cpp
===
--- clang-tools-extra/clangd/unittests/TweakTests.cpp
+++ clang-tools-extra/clangd/unittests/TweakTests.cpp
@@ -25,6 +25,7 @@
 #include "clang/Tooling/Core/Replacement.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/MemoryBuffer.h"
@@ -40,11 +41,16 @@
 using ::testing::AllOf;
 using ::testing::HasSubstr;
 using ::testing::StartsWith;
+using ::testing::ElementsAre;
 
 namespace clang {
 namespace clangd {
 namespace {
 
+MATCHER_P2(FileWithContents, FileName, Contents, "") {
+  return arg.first() == FileName && arg.second == Contents;
+}
+
 TEST(FileEdits, AbsolutePath) {
   auto RelPaths = {"a.h", "foo.cpp", "test/test.cpp"};
 
@@ -1047,6 +1053,455 @@
   })cpp");
 }
 
+TEST_F(DefineInlineTest, TransformNestedNamespaces) {
+  EXPECT_EQ(apply(R"cpp(
+  namespace a {
+void bar();
+namespace b {
+  void baz();
+  namespace c {
+void aux();
+  }
+}
+  }
+
+  void foo();
+  using namespace a;
+  using namespace b;
+  using namespace c;
+  void f^oo() {
+bar();
+a::bar();
+
+baz();
+b::baz();
+a::b::baz();
+
+aux();
+c::aux();
+b::c::aux();
+a::b::c::aux();
+  })cpp"), R"cpp(
+  namespace a {
+void bar();
+namespace b {
+  void baz();
+  namespace c {
+void aux();
+  }
+}
+  }
+
+  void foo(){
+a::bar();
+a::bar();
+
+a::b::baz();
+a::b::baz();
+a::b::baz();
+
+a::b::c::aux();
+a::b::c::aux();
+a::b::c::aux();
+a::b::c::aux();
+  }
+  using namespace a;
+  using namespace b;
+  using namespace c;
+  )cpp");
+}
+
+TEST_F(DefineInlineTest, TransformUsings) {
+  EXPECT_EQ(apply(R"cpp(
+  namespace a { namespace b { namespace c { void aux(); } } }
+
+  void foo();
+  void f^oo() {
+using namespace a;
+using namespace b;
+using namespace c;
+using c::aux;
+namespace d = c;
+  })cpp"),
+R"cpp(
+  namespace a { namespace b { namespace c { void aux(); } } }
+
+  void foo(){
+using namespace a;
+using namespace a::b;
+using namespace a::b::c;
+using a::b::c::aux;
+namespace d = a::b::c;
+  }
+  )cpp");
+}
+
+TEST_F(DefineInlineTest, TransformDecls) {
+  EXPECT_EQ(apply(R"cpp(
+  void foo();
+  void f^oo() {
+class Foo {
+public:
+  void foo();
+  int x;
+  static int y;
+};
+Foo::y = 0;
+
+enum En { Zero, One };
+En x = Zero;
+
+enum class EnClass { Zero, One };
+EnClass y = EnClass::Zero;
+  })cpp"),
+R"cpp(
+  void foo(){
+class Foo {
+public:
+  void foo();
+  int x;
+  static int y;
+};
+Foo::y = 0;
+
+enum En { Zero, One };
+En x = Zero;
+
+enum class EnClass { Zero, One };
+EnClass y = EnClass::Zero;
+  }
+  )cpp");
+}
+
+TEST_F(DefineInlineTest, TransformTemplDecls) {
+  EXPECT_EQ(apply(R"cpp(
+  namespace a {
+template  class Bar {
+public:
+  void bar();
+};
+template  T bar;
+template  void aux() {}
+  }
+
+  void foo();
+
+  using namespace a;
+  void f^oo() {
+bar>.bar();
+aux>();
+  })cpp"),
+R"cpp(
+  namespace a {
+template  class Bar {
+public:
+  void bar();
+};
+template  T bar;
+template  void aux() {}
+  }
+
+  void foo(){
+a::bar>.bar();
+a::aux>();
+  }
+
+  using namespace a;
+  )cpp");
+}
+
+TEST_F(DefineInlineTest, TransformMembers) {
+  EXPECT_EQ(apply(R"cpp(
+  class Foo {
+void foo();
+  };
+
+  void Foo::f^oo() {
+return;
+  }
+  )cpp"),
+R"cpp(
+  class Foo {
+void foo(){
+return;
+  }
+  };
+
+  
+  )cpp");
+
+  ExtraFiles["a.h"] = R"cpp(
+  class Foo {
+void foo();
+  };)cpp";
+
+  llvm::StringMap EditedFiles;
+  EXPECT_EQ(apply(R"cpp(
+  #include "a.h"
+  void Foo::f^oo() {
+return;
+  })cpp",
+  &EditedFiles),
+R"cpp(
+  #include "a.h"
+  )cpp");
+  EXPECT_THAT(EditedFiles,
+  ElementsAre(FileWithContents(testPath("a.h"),
+R"cpp(
+  class Foo {
+void foo(){
+return;
+  }
+  };)cpp")));
+}
+
+TEST_F(DefineInlineTest, TransformDependentTypes) {
+  EXPECT_EQ(apply(R"cpp(
+  namespace a {
+template  class Bar {};
+  }
+  using na

[PATCH] D66647: [clangd] DefineInline action apply logic with fully qualified names

2019-10-24 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added inline comments.



Comment at: clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp:79
+  Token CurToken;
+  while (!CurToken.is(tok::semi)) {
+if (RawLexer.LexFromRawLexer(CurToken))

ilya-biryukov wrote:
> What are the tokens we expect to see before the semicolon here?
> It feels safer to just skip comments and whitespace and check the next token 
> is a semicolon.
> 
> Any reason to have an actual loop here?
it has been a long time since our offline discussions around this one. but the 
idea was could have any attributes before semicolon, these could be macros that 
will expand to one thing in some platforms and another in a different platform. 
Therefore we've decided to skip anything until we've found a semicolon.

I don't think I follow the second part of the question though? What do you mean 
by "having an actual loop"?



Comment at: clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp:208
+
+  if (HadErrors) {
+return llvm::createStringError(

ilya-biryukov wrote:
> NIT: braces are redundant
I've thought you were a fan of braces when the inner statement spans multiple 
lines, even if it is a single statement :D



Comment at: clang-tools-extra/clangd/unittests/TweakTests.cpp:922
+
+template  class Bar {};
+Bar z;

ilya-biryukov wrote:
> Template declarations inside function bodies are not allowed in C++.
> Are we getting compiler errors here and not actually testing anything?
well, it was still working and inlining the function definition, apparently 
despite the diagnostic, ranges were correct.



Comment at: clang-tools-extra/clangd/unittests/TweakTests.cpp:1076
+  template <>
+  void foo(int p);
+

ilya-biryukov wrote:
> This is really uncommon, I'm not even sure we should test this.
> The other case is much more common and interesting:
> 
> ```
> template 
> void foo(T p);
> 
> template <>
> void foo(int p) { /* do something */ }
> 
> ```
> 
> Could we add a test that we don't suggest this action in that case?
yes there is a test for this in availability checks patch:

```
EXPECT_UNAVAILABLE(R"cpp(
template  void foo();

template<> void f^oo() {
})cpp");
```



Comment at: clang-tools-extra/clangd/unittests/TweakTests.cpp:1215
+namespace b {
+class Foo{};
+namespace c {

ilya-biryukov wrote:
> Could you indent here and in other tests? it's hard to follow the fact that 
> `Foo` is inside `b` without indentation.
> Same for other tests.
> 
> Alternatively, put on one line if there's just a single declaration inside 
> the namespace
no more nested namespaces


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66647/new/

https://reviews.llvm.org/D66647



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] 13fc899 - [clangd] Handle the missing constructor initializers in findExplicitReferences.

2019-10-24 Thread Haojian Wu via cfe-commits

Author: Haojian Wu
Date: 2019-10-24T10:38:37+02:00
New Revision: 13fc899cdecc85c944fc5b516a2bdfdd2f5f5903

URL: 
https://github.com/llvm/llvm-project/commit/13fc899cdecc85c944fc5b516a2bdfdd2f5f5903
DIFF: 
https://github.com/llvm/llvm-project/commit/13fc899cdecc85c944fc5b516a2bdfdd2f5f5903.diff

LOG: [clangd] Handle the missing constructor initializers in 
findExplicitReferences.

Reviewers: ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang-tools-extra/clangd/FindTarget.cpp
clang-tools-extra/clangd/unittests/FindTargetTests.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/FindTarget.cpp 
b/clang-tools-extra/clangd/FindTarget.cpp
index 4919105335d3..7dc7fd906be9 100644
--- a/clang-tools-extra/clangd/FindTarget.cpp
+++ b/clang-tools-extra/clangd/FindTarget.cpp
@@ -642,6 +642,11 @@ class ExplicitReferenceColletor
 return RecursiveASTVisitor::TraverseNestedNameSpecifierLoc(L);
   }
 
+  bool TraverseConstructorInitializer(CXXCtorInitializer *Init) {
+visitNode(DynTypedNode::create(*Init));
+return RecursiveASTVisitor::TraverseConstructorInitializer(Init);
+  }
+
 private:
   /// Obtain information about a reference directly defined in \p N. Does not
   /// recurse into child nodes, e.g. do not expect references for constructor
@@ -669,13 +674,14 @@ class ExplicitReferenceColletor
 if (const TypeLoc *TL = N.get())
   return refInTypeLoc(*TL);
 if (const CXXCtorInitializer *CCI = N.get()) {
-  if (CCI->isBaseInitializer())
-return refInTypeLoc(CCI->getBaseClassLoc());
-  assert(CCI->isAnyMemberInitializer());
-  return {ReferenceLoc{NestedNameSpecifierLoc(),
-   CCI->getMemberLocation(),
-   /*IsDecl=*/false,
-   {CCI->getAnyMember()}}};
+  // Other type initializers (e.g. base initializer) are handled by 
visiting
+  // the typeLoc.
+  if (CCI->isAnyMemberInitializer()) {
+return {ReferenceLoc{NestedNameSpecifierLoc(),
+ CCI->getMemberLocation(),
+ /*IsDecl=*/false,
+ {CCI->getAnyMember()}}};
+  }
 }
 // We do not have location information for other nodes (QualType, etc)
 return {};

diff  --git a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp 
b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
index bf74b45abbfb..f7095aebd868 100644
--- a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -812,6 +812,7 @@ TEST_F(FindExplicitReferencesTest, All) {
"1: targets = {func}\n"
"2: targets = {w}, decl\n"
"3: targets = {FuncParam}\n"},
+  // declaration references.
   {R"cpp(
  namespace ns {}
  class S {};
@@ -835,6 +836,44 @@ TEST_F(FindExplicitReferencesTest, All) {
"8: targets = {INT2}, decl\n"
"9: targets = {NS}, decl\n"
"10: targets = {ns}\n"},
+  // cxx constructor initializer.
+  {R"cpp(
+ class Base {};
+ void foo() {
+   // member initializer
+   class $0^X {
+ int $1^abc;
+ $2^X(): $3^abc() {}
+   };
+   // base initializer
+   class $4^Derived : public $5^Base {
+ $6^Base $7^B;
+ $8^Derived() : $9^Base() {}
+   };
+   // delegating initializer
+   class $10^Foo {
+ $11^Foo(int$12^);
+ $13^Foo(): $14^Foo(111) {}
+   };
+ }
+   )cpp",
+   "0: targets = {X}, decl\n"
+   "1: targets = {foo()::X::abc}, decl\n"
+   "2: targets = {foo()::X::X}, decl\n"
+   "3: targets = {foo()::X::abc}\n"
+   "4: targets = {Derived}, decl\n"
+   "5: targets = {Base}\n"
+   "6: targets = {Base}\n"
+   "7: targets = {foo()::Derived::B}, decl\n"
+   "8: targets = {foo()::Derived::Derived}, decl\n"
+   "9: targets = {Base}\n"
+   "10: targets = {Foo}, decl\n"
+   "11: targets = {foo()::Foo::Foo}, decl\n"
+   // FIXME: we should exclude the built-in type.
+   "12: targets = {}, decl\n"
+   "13: targets = {foo()::Foo::Foo}, decl\n"
+   "14: targets = {Foo}\n"},
+
   };
 
   for (const auto &C : Cases) {



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69241: [clangd] Handle the missing constructor initializers in findExplicitReferences.

2019-10-24 Thread Haojian Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG13fc899cdecc: [clangd] Handle the missing constructor 
initializers in findExplicitReferences. (authored by hokein).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69241/new/

https://reviews.llvm.org/D69241

Files:
  clang-tools-extra/clangd/FindTarget.cpp
  clang-tools-extra/clangd/unittests/FindTargetTests.cpp


Index: clang-tools-extra/clangd/unittests/FindTargetTests.cpp
===
--- clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -812,6 +812,7 @@
"1: targets = {func}\n"
"2: targets = {w}, decl\n"
"3: targets = {FuncParam}\n"},
+  // declaration references.
   {R"cpp(
  namespace ns {}
  class S {};
@@ -835,6 +836,44 @@
"8: targets = {INT2}, decl\n"
"9: targets = {NS}, decl\n"
"10: targets = {ns}\n"},
+  // cxx constructor initializer.
+  {R"cpp(
+ class Base {};
+ void foo() {
+   // member initializer
+   class $0^X {
+ int $1^abc;
+ $2^X(): $3^abc() {}
+   };
+   // base initializer
+   class $4^Derived : public $5^Base {
+ $6^Base $7^B;
+ $8^Derived() : $9^Base() {}
+   };
+   // delegating initializer
+   class $10^Foo {
+ $11^Foo(int$12^);
+ $13^Foo(): $14^Foo(111) {}
+   };
+ }
+   )cpp",
+   "0: targets = {X}, decl\n"
+   "1: targets = {foo()::X::abc}, decl\n"
+   "2: targets = {foo()::X::X}, decl\n"
+   "3: targets = {foo()::X::abc}\n"
+   "4: targets = {Derived}, decl\n"
+   "5: targets = {Base}\n"
+   "6: targets = {Base}\n"
+   "7: targets = {foo()::Derived::B}, decl\n"
+   "8: targets = {foo()::Derived::Derived}, decl\n"
+   "9: targets = {Base}\n"
+   "10: targets = {Foo}, decl\n"
+   "11: targets = {foo()::Foo::Foo}, decl\n"
+   // FIXME: we should exclude the built-in type.
+   "12: targets = {}, decl\n"
+   "13: targets = {foo()::Foo::Foo}, decl\n"
+   "14: targets = {Foo}\n"},
+
   };
 
   for (const auto &C : Cases) {
Index: clang-tools-extra/clangd/FindTarget.cpp
===
--- clang-tools-extra/clangd/FindTarget.cpp
+++ clang-tools-extra/clangd/FindTarget.cpp
@@ -642,6 +642,11 @@
 return RecursiveASTVisitor::TraverseNestedNameSpecifierLoc(L);
   }
 
+  bool TraverseConstructorInitializer(CXXCtorInitializer *Init) {
+visitNode(DynTypedNode::create(*Init));
+return RecursiveASTVisitor::TraverseConstructorInitializer(Init);
+  }
+
 private:
   /// Obtain information about a reference directly defined in \p N. Does not
   /// recurse into child nodes, e.g. do not expect references for constructor
@@ -669,13 +674,14 @@
 if (const TypeLoc *TL = N.get())
   return refInTypeLoc(*TL);
 if (const CXXCtorInitializer *CCI = N.get()) {
-  if (CCI->isBaseInitializer())
-return refInTypeLoc(CCI->getBaseClassLoc());
-  assert(CCI->isAnyMemberInitializer());
-  return {ReferenceLoc{NestedNameSpecifierLoc(),
-   CCI->getMemberLocation(),
-   /*IsDecl=*/false,
-   {CCI->getAnyMember()}}};
+  // Other type initializers (e.g. base initializer) are handled by 
visiting
+  // the typeLoc.
+  if (CCI->isAnyMemberInitializer()) {
+return {ReferenceLoc{NestedNameSpecifierLoc(),
+ CCI->getMemberLocation(),
+ /*IsDecl=*/false,
+ {CCI->getAnyMember()}}};
+  }
 }
 // We do not have location information for other nodes (QualType, etc)
 return {};


Index: clang-tools-extra/clangd/unittests/FindTargetTests.cpp
===
--- clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -812,6 +812,7 @@
"1: targets = {func}\n"
"2: targets = {w}, decl\n"
"3: targets = {FuncParam}\n"},
+  // declaration references.
   {R"cpp(
  namespace ns {}
  class S {};
@@ -835,6 +836,44 @@
"8: targets = {INT2}, decl\n"
"9: targets = {NS}, decl\n"
"10: targets = {ns}\n"},
+  // cxx constructor initializer.
+  {R"cpp(
+ class Base {};
+ void foo() {
+   // member initializer
+   class $0^X {
+ 

[PATCH] D66647: [clangd] DefineInline action apply logic with fully qualified names

2019-10-24 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments.



Comment at: clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp:79
+  Token CurToken;
+  while (!CurToken.is(tok::semi)) {
+if (RawLexer.LexFromRawLexer(CurToken))

kadircet wrote:
> ilya-biryukov wrote:
> > What are the tokens we expect to see before the semicolon here?
> > It feels safer to just skip comments and whitespace and check the next 
> > token is a semicolon.
> > 
> > Any reason to have an actual loop here?
> it has been a long time since our offline discussions around this one. but 
> the idea was could have any attributes before semicolon, these could be 
> macros that will expand to one thing in some platforms and another in a 
> different platform. Therefore we've decided to skip anything until we've 
> found a semicolon.
> 
> I don't think I follow the second part of the question though? What do you 
> mean by "having an actual loop"?
The loop I mentioned is 
```while (!CurToken.is(tok::semi))```
I believe this could be replaced with
```
auto NextTok = Lexer::findNextToken(...);
if (NextTok && NextTok->is(tok::semi))
  ...
```

There are two common attribute applications we should mostly care about: 
```
// Attribute in declaration specifiers.
[[noreturn]] int foo(); 

// Attribute after declarator name
int foo [[noreturn]]();
```
Both work with a simple if statement, rather than the attributes.

The case we're covering with the loop is super uncommon and I don't think we 
should even bother to support it:
```
int foo() [[some::attribute]];
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66647/new/

https://reviews.llvm.org/D66647



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69266: [clangd] Define out-of-line availability checks

2019-10-24 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments.



Comment at: clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp:77
+Source = getSelectedFunction(Sel.ASTSelection.commonAncestor());
+if (!Source || !Source->isThisDeclarationADefinition())
+  return false;

I think `doesThisDeclarationHaveABody` is probably a better choice here? 
`isThisDeclarationADefinition` returns true for defaulted methods like `void 
Ctor() = default;`, we'd need to disable the tweak for this case, could you add 
a test case for this?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69266/new/

https://reviews.llvm.org/D69266



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D66647: [clangd] DefineInline action apply logic with fully qualified names

2019-10-24 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov marked an inline comment as done.
ilya-biryukov added inline comments.



Comment at: clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp:208
+
+  if (HadErrors) {
+return llvm::createStringError(

kadircet wrote:
> ilya-biryukov wrote:
> > NIT: braces are redundant
> I've thought you were a fan of braces when the inner statement spans multiple 
> lines, even if it is a single statement :D
It's more complicated than that... Let me explain...
I'm a fan of braces when:
1. There are line comments (I perceive those as an extra statement):
```
if (something) {
  // Here comes a comment...
  return 10;
}
```
2. There are composite statements inside the if body:
```
if (something) {
  for (;;)
do_something_else();
}
```

In your case, I'd not use braces...
It's not important, though, pick the style you like most.



Comment at: clang-tools-extra/clangd/unittests/TweakTests.cpp:922
+
+template  class Bar {};
+Bar z;

kadircet wrote:
> ilya-biryukov wrote:
> > Template declarations inside function bodies are not allowed in C++.
> > Are we getting compiler errors here and not actually testing anything?
> well, it was still working and inlining the function definition, apparently 
> despite the diagnostic, ranges were correct.
I guess we didn't need to do any edits there, so we just carried the text 
unchanged.
Had we actually needed to change something inside the template, we'd fail to do 
so.

Range of the function body is correct, since the parser can easily recover in 
those cases.



Comment at: clang-tools-extra/clangd/unittests/TweakTests.cpp:1215
+namespace b {
+class Foo{};
+namespace c {

kadircet wrote:
> ilya-biryukov wrote:
> > Could you indent here and in other tests? it's hard to follow the fact that 
> > `Foo` is inside `b` without indentation.
> > Same for other tests.
> > 
> > Alternatively, put on one line if there's just a single declaration inside 
> > the namespace
> no more nested namespaces
Yay! Thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66647/new/

https://reviews.llvm.org/D66647



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D67750: Allow additional file suffixes/extensions considered as source in main include grouping

2019-10-24 Thread Mateusz Furdyna via Phabricator via cfe-commits
furdyna added a comment.

Hi, @krasimir @sylvestre.ledru , would you be able to help me with this patch? 
I am looking for anyone interested in reviewing this :)


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67750/new/

https://reviews.llvm.org/D67750



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D66647: [clangd] DefineInline action apply logic with fully qualified names

2019-10-24 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov marked an inline comment as done.
ilya-biryukov added a comment.

A few last NITs and one important comment about handling the case when function 
definition come from macro expansions




Comment at: clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp:323
+
+auto SemiColon = getSemicolonForDecl(Target);
+if (!SemiColon) {

NIT: s/SemiColon/Semicolon



Comment at: clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp:334
+
+const tooling::Replacement SemiColonToFuncBody(SM, *SemiColon, 1,
+   *QualifiedBody);

Could we add a test when the semicolon comes from a macro expansion? I believe 
the action won't be available in that case, which is ok. Just to make sure we 
cover this corner-case.

```
#define SEMI ;
void foo() SEMI
```

Also interesting cases:
- source function is in a macro expansion
- target function is in a macro expansion.

I believe they might catch a few bugs here, as we seem to assume all locations 
are file locations...



Comment at: clang-tools-extra/clangd/unittests/TweakTesting.h:73
+  //for the main file.
+  //Populates \p EditedFiles if there were changes to other files whenever
+  //it is non-null. It is a mapping from absolute path of the edited file 
to

Hm, maybe even call `ADD_FAILURE()` when there are changes to other files and 
tests pass `null` to `EditedFiles`?
Likely an error in the test.



Comment at: clang-tools-extra/clangd/unittests/TweakTests.cpp:1226
+void foo(){
+return;
+  }

Argh... Without `clang-format` that looks SO weird :-)



Comment at: clang-tools-extra/clangd/unittests/TweakTests.cpp:1266
+  template 
+  void foo();
+

Maybe put it before `using  namespace a;`?
To make sure the test does not need to change if we actually support not 
qualifying when not neccessary



Comment at: clang-tools-extra/clangd/unittests/TweakTests.cpp:1332
+  template <>
+  void fo^o(char p) {
+return;

How is this test different from the previous one?
Is it just trying to make sure we don't always move to the first function body?



Comment at: clang-tools-extra/clangd/unittests/TweakTests.cpp:1374
+  )cpp");
+}
+

Do we test the following case anywhere?
```
template  void foo();
template <> void ^foo() { // should not be available
  return;
}
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66647/new/

https://reviews.llvm.org/D66647



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69266: [clangd] Define out-of-line availability checks

2019-10-24 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments.



Comment at: clang-tools-extra/clangd/unittests/TweakTests.cpp:1556
+
+[[void [[Bar::[[b^a^z() [[{
+  return;

Sorry for not spotting it earlier.

Moving out-of-line methods is different than general functions, `void 
Bar::bar();` is illegal in C++ (C++ requires the out-of-line member declaration 
must be a definition). I think for this case, we could 1) delete the original 
method definition 2) disable the tweak. I slightly prefer 2) as out-of-line 
member definitions are rare in header files. WDYT?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69266/new/

https://reviews.llvm.org/D69266



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50078: clang-format: support aligned nested conditionals formatting

2019-10-24 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 226218.
Typz marked 2 inline comments as done.
Typz added a comment.

Fix corner in previous rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D50078/new/

https://reviews.llvm.org/D50078

Files:
  clang/lib/Format/ContinuationIndenter.cpp
  clang/lib/Format/ContinuationIndenter.h
  clang/lib/Format/WhitespaceManager.cpp
  clang/lib/Format/WhitespaceManager.h
  clang/unittests/Format/FormatTest.cpp

Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -5798,6 +5798,113 @@
" // comment\n"
" ? a = b\n"
" : a;");
+
+  // Chained conditionals
+  FormatStyle Style = getLLVMStyle();
+  Style.ColumnLimit = 70;
+  Style.AlignOperands = true;
+  verifyFormat("return  ? \n"
+   "   : bb ? \n"
+   ": ;",
+   Style);
+  verifyFormat("return  ? \n"
+   "   : bb ? \n"
+   ": ;",
+   Style);
+  verifyFormat("return aa ? \n"
+   "   :  ? \n"
+   "  : ;",
+   Style);
+  verifyFormat("return  ? \n"
+   "   : bb ? 22\n"
+   ": 33;",
+   Style);
+  verifyFormat("return  ? \n"
+   "   : bb ? \n"
+   "   : cc ? \n"
+   ": ;",
+   Style);
+  verifyFormat("return  ? (aaa ? bbb : ccc)\n"
+   "   : bb ? \n"
+   ": ;",
+   Style);
+  verifyFormat("return  ? \n"
+   "   : bb ? \n"
+   ": (aaa ? bbb : ccc);",
+   Style);
+  verifyFormat("return  ? (a ? bb\n"
+   " : cc)\n"
+   "   : bb ? \n"
+   ": ;",
+   Style);
+  verifyFormat("return a? (a ? bb\n"
+   " : cc)\n"
+   "   : bb ? \n"
+   ": ;",
+   Style);
+  verifyFormat("return a? a = (a ? bb\n"
+   " : dd)\n"
+   "   : bb ? \n"
+   ": ;",
+   Style);
+  verifyFormat("return a? a + (a ? bb\n"
+   " : dd)\n"
+   "   : bb ? \n"
+   ": ;",
+   Style);
+  verifyFormat("return a? \n"
+   "   : bb ? \n"
+   ": a + (a ? bb\n"
+   " : dd)\n",
+   Style);
+  verifyFormat("return  ? \n"
+   "   : bb ? \n"
+   ": (a ? bb\n"
+   " : cc);",
+   Style);
+  verifyFormat("return  ? (a ? bb\n"
+   "   : ccc ? dd\n"
+   " : ee)\n"
+   "   : bb ? \n"
+   ": ;",
+   Style);
+  verifyFormat("return  ? (aa? bb\n"
+   "   

[PATCH] D69373: [Clang] Fix Sema class build fix

2019-10-24 Thread David CARLIER via Phabricator via cfe-commits
devnexen created this revision.
devnexen added a reviewer: rsmith.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

- DefaultedComparisonKind not being a classic enum, setting as a so small 
bitfield triggers gcc warning.


Repository:
  rC Clang

https://reviews.llvm.org/D69373

Files:
  clang/include/clang/Sema/Sema.h


Index: clang/include/clang/Sema/Sema.h
===
--- clang/include/clang/Sema/Sema.h
+++ clang/include/clang/Sema/Sema.h
@@ -2563,7 +2563,7 @@
   /// For a defaulted function, the kind of defaulted function that it is.
   class DefaultedFunctionKind {
 CXXSpecialMember SpecialMember : 8;
-DefaultedComparisonKind Comparison : 8;
+DefaultedComparisonKind Comparison;
 
   public:
 DefaultedFunctionKind()


Index: clang/include/clang/Sema/Sema.h
===
--- clang/include/clang/Sema/Sema.h
+++ clang/include/clang/Sema/Sema.h
@@ -2563,7 +2563,7 @@
   /// For a defaulted function, the kind of defaulted function that it is.
   class DefaultedFunctionKind {
 CXXSpecialMember SpecialMember : 8;
-DefaultedComparisonKind Comparison : 8;
+DefaultedComparisonKind Comparison;
 
   public:
 DefaultedFunctionKind()
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 1ae8e8d - Don't add -fsplit-lto-unit for thin LTO builds with PS4 and Darwin toolchains

2019-10-24 Thread via cfe-commits

Author: evgeny
Date: 2019-10-24T14:10:03+03:00
New Revision: 1ae8e8d25fd87048d3d8d7429308e52b236c79a1

URL: 
https://github.com/llvm/llvm-project/commit/1ae8e8d25fd87048d3d8d7429308e52b236c79a1
DIFF: 
https://github.com/llvm/llvm-project/commit/1ae8e8d25fd87048d3d8d7429308e52b236c79a1.diff

LOG: Don't add -fsplit-lto-unit for thin LTO builds with PS4 and Darwin 
toolchains

These toolchains use legacy thin LTO API, which is not capable of unit splitting
Differential revision: https://reviews.llvm.org/D69173

Added: 


Modified: 
clang/include/clang/Driver/ToolChain.h
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Driver/ToolChains/Darwin.h
clang/lib/Driver/ToolChains/PS4CPU.h
clang/test/Driver/split-lto-unit.c

Removed: 




diff  --git a/clang/include/clang/Driver/ToolChain.h 
b/clang/include/clang/Driver/ToolChain.h
index f0676eee2d6c..c40af1e6e01f 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -600,6 +600,10 @@ class ToolChain {
   virtual SanitizerMask getDefaultSanitizers() const {
 return SanitizerMask();
   }
+
+  /// Returns true when it's possible to split LTO unit to use whole
+  /// program devirtualization and CFI santiizers.
+  virtual bool canSplitThinLTOUnit() const { return true; }
 };
 
 /// Set a ToolChain's effective triple. Reset it when the registration object

diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 55d631733add..198b0b5b228f 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -5395,7 +5395,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction 
&JA,
 CmdArgs.push_back("-fwhole-program-vtables");
   }
 
-  bool DefaultsSplitLTOUnit = WholeProgramVTables || Sanitize.needsLTO();
+  bool DefaultsSplitLTOUnit =
+  (WholeProgramVTables || Sanitize.needsLTO()) &&
+  (D.getLTOMode() == LTOK_Full || TC.canSplitThinLTOUnit());
   bool SplitLTOUnit =
   Args.hasFlag(options::OPT_fsplit_lto_unit,
options::OPT_fno_split_lto_unit, DefaultsSplitLTOUnit);

diff  --git a/clang/lib/Driver/ToolChains/Darwin.h 
b/clang/lib/Driver/ToolChains/Darwin.h
index 2dc7c85880f7..1b1c358c40a4 100644
--- a/clang/lib/Driver/ToolChains/Darwin.h
+++ b/clang/lib/Driver/ToolChains/Darwin.h
@@ -258,6 +258,9 @@ class LLVM_LIBRARY_VISIBILITY MachO : public ToolChain {
 return "";
   }
 
+  // Darwin toolchain uses legacy thin LTO API, which is not
+  // capable of unit splitting.
+  bool canSplitThinLTOUnit() const override { return false; }
   /// }
 };
 

diff  --git a/clang/lib/Driver/ToolChains/PS4CPU.h 
b/clang/lib/Driver/ToolChains/PS4CPU.h
index e9f0891c1194..18852b2808cb 100644
--- a/clang/lib/Driver/ToolChains/PS4CPU.h
+++ b/clang/lib/Driver/ToolChains/PS4CPU.h
@@ -84,6 +84,10 @@ class LLVM_LIBRARY_VISIBILITY PS4CPU : public Generic_ELF {
 
   SanitizerMask getSupportedSanitizers() const override;
 
+  // PS4 toolchain uses legacy thin LTO API, which is not
+  // capable of unit splitting.
+  bool canSplitThinLTOUnit() const override { return false; }
+
 protected:
   Tool *buildAssembler() const override;
   Tool *buildLinker() const override;

diff  --git a/clang/test/Driver/split-lto-unit.c 
b/clang/test/Driver/split-lto-unit.c
index d2ed253ca201..66314161c942 100644
--- a/clang/test/Driver/split-lto-unit.c
+++ b/clang/test/Driver/split-lto-unit.c
@@ -3,6 +3,10 @@
 // RUN: %clang -target x86_64-unknown-linux -### %s -flto=thin 
-fno-split-lto-unit 2>&1 | FileCheck --check-prefix=NOUNIT %s
 // RUN: %clang -target x86_64-unknown-linux -### %s -flto=thin 
-fno-split-lto-unit -fwhole-program-vtables 2>&1 | FileCheck 
--check-prefix=ERROR1 %s
 // RUN: %clang -target x86_64-unknown-linux -### %s -flto=thin 
-fno-split-lto-unit -fsanitize=cfi 2>&1 | FileCheck --check-prefix=ERROR2 %s
+// RUN: %clang -target x86_64-apple-darwin13.3.0 -### %s 
-fwhole-program-vtables -flto=full 2>&1 | FileCheck --check-prefix=UNIT %s
+// RUN: %clang -target x86_64-apple-darwin13.3.0 -### %s 
-fwhole-program-vtables -flto=thin 2>&1 | FileCheck --check-prefix=NOUNIT %s
+// RUN: %clang -target x86_64-scei-ps4 -### %s -fwhole-program-vtables 
-flto=full 2>&1 | FileCheck --check-prefix=UNIT %s
+// RUN: %clang -target x86_64-scei-ps4 -### %s -fwhole-program-vtables 
-flto=thin 2>&1 | FileCheck --check-prefix=NOUNIT %s
 
 // UNIT: "-fsplit-lto-unit"
 // NOUNIT-NOT: "-fsplit-lto-unit"



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69173: [clang][ThinLTO][Legacy] Don't add -fsplit-lto-unit for legacy thin LTO builds

2019-10-24 Thread Eugene Leviant via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1ae8e8d25fd8: Don't add -fsplit-lto-unit for thin LTO 
builds with PS4 and Darwin toolchains (authored by evgeny777).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Changed prior to commit:
  https://reviews.llvm.org/D69173?vs=226049&id=226223#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69173/new/

https://reviews.llvm.org/D69173

Files:
  clang/include/clang/Driver/ToolChain.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/Darwin.h
  clang/lib/Driver/ToolChains/PS4CPU.h
  clang/test/Driver/split-lto-unit.c


Index: clang/test/Driver/split-lto-unit.c
===
--- clang/test/Driver/split-lto-unit.c
+++ clang/test/Driver/split-lto-unit.c
@@ -3,6 +3,10 @@
 // RUN: %clang -target x86_64-unknown-linux -### %s -flto=thin 
-fno-split-lto-unit 2>&1 | FileCheck --check-prefix=NOUNIT %s
 // RUN: %clang -target x86_64-unknown-linux -### %s -flto=thin 
-fno-split-lto-unit -fwhole-program-vtables 2>&1 | FileCheck 
--check-prefix=ERROR1 %s
 // RUN: %clang -target x86_64-unknown-linux -### %s -flto=thin 
-fno-split-lto-unit -fsanitize=cfi 2>&1 | FileCheck --check-prefix=ERROR2 %s
+// RUN: %clang -target x86_64-apple-darwin13.3.0 -### %s 
-fwhole-program-vtables -flto=full 2>&1 | FileCheck --check-prefix=UNIT %s
+// RUN: %clang -target x86_64-apple-darwin13.3.0 -### %s 
-fwhole-program-vtables -flto=thin 2>&1 | FileCheck --check-prefix=NOUNIT %s
+// RUN: %clang -target x86_64-scei-ps4 -### %s -fwhole-program-vtables 
-flto=full 2>&1 | FileCheck --check-prefix=UNIT %s
+// RUN: %clang -target x86_64-scei-ps4 -### %s -fwhole-program-vtables 
-flto=thin 2>&1 | FileCheck --check-prefix=NOUNIT %s
 
 // UNIT: "-fsplit-lto-unit"
 // NOUNIT-NOT: "-fsplit-lto-unit"
Index: clang/lib/Driver/ToolChains/PS4CPU.h
===
--- clang/lib/Driver/ToolChains/PS4CPU.h
+++ clang/lib/Driver/ToolChains/PS4CPU.h
@@ -84,6 +84,10 @@
 
   SanitizerMask getSupportedSanitizers() const override;
 
+  // PS4 toolchain uses legacy thin LTO API, which is not
+  // capable of unit splitting.
+  bool canSplitThinLTOUnit() const override { return false; }
+
 protected:
   Tool *buildAssembler() const override;
   Tool *buildLinker() const override;
Index: clang/lib/Driver/ToolChains/Darwin.h
===
--- clang/lib/Driver/ToolChains/Darwin.h
+++ clang/lib/Driver/ToolChains/Darwin.h
@@ -258,6 +258,9 @@
 return "";
   }
 
+  // Darwin toolchain uses legacy thin LTO API, which is not
+  // capable of unit splitting.
+  bool canSplitThinLTOUnit() const override { return false; }
   /// }
 };
 
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -5395,7 +5395,9 @@
 CmdArgs.push_back("-fwhole-program-vtables");
   }
 
-  bool DefaultsSplitLTOUnit = WholeProgramVTables || Sanitize.needsLTO();
+  bool DefaultsSplitLTOUnit =
+  (WholeProgramVTables || Sanitize.needsLTO()) &&
+  (D.getLTOMode() == LTOK_Full || TC.canSplitThinLTOUnit());
   bool SplitLTOUnit =
   Args.hasFlag(options::OPT_fsplit_lto_unit,
options::OPT_fno_split_lto_unit, DefaultsSplitLTOUnit);
Index: clang/include/clang/Driver/ToolChain.h
===
--- clang/include/clang/Driver/ToolChain.h
+++ clang/include/clang/Driver/ToolChain.h
@@ -600,6 +600,10 @@
   virtual SanitizerMask getDefaultSanitizers() const {
 return SanitizerMask();
   }
+
+  /// Returns true when it's possible to split LTO unit to use whole
+  /// program devirtualization and CFI santiizers.
+  virtual bool canSplitThinLTOUnit() const { return true; }
 };
 
 /// Set a ToolChain's effective triple. Reset it when the registration object


Index: clang/test/Driver/split-lto-unit.c
===
--- clang/test/Driver/split-lto-unit.c
+++ clang/test/Driver/split-lto-unit.c
@@ -3,6 +3,10 @@
 // RUN: %clang -target x86_64-unknown-linux -### %s -flto=thin -fno-split-lto-unit 2>&1 | FileCheck --check-prefix=NOUNIT %s
 // RUN: %clang -target x86_64-unknown-linux -### %s -flto=thin -fno-split-lto-unit -fwhole-program-vtables 2>&1 | FileCheck --check-prefix=ERROR1 %s
 // RUN: %clang -target x86_64-unknown-linux -### %s -flto=thin -fno-split-lto-unit -fsanitize=cfi 2>&1 | FileCheck --check-prefix=ERROR2 %s
+// RUN: %clang -target x86_64-apple-darwin13.3.0 -### %s -fwhole-program-vtables -flto=full 2>&1 | FileCheck --check-prefix=UNIT %s
+// RUN: %clang -target x86_64-apple-darwin13.3.0 -### %s -fwhole-program-vtables -flto=thin 2>&1 | FileCheck --check-prefix=NOUNIT %s
+// RUN: %clang 

[PATCH] D67508: [RISCV] support mutilib in baremetal environment

2019-10-24 Thread Sam Elliott via Phabricator via cfe-commits
lenary added a comment.

Ok, found a path forward for this patch. Notes inline:




Comment at: clang/lib/Driver/ToolChains/Gnu.cpp:1547
+  else if (IsRV64)
+MArch = "rv64i";
+  else

khchen wrote:
> lenary wrote:
> > I think this line is the issue: where someone doesn't specify `-march`, you 
> > choose a default `-march` that does not appear in the list of multilib 
> > arches in `RISCVMultilibSet` above.
> > 
> > I think this issue probably didn't arise when you had `rv64i/lp64` in the 
> > list, but given that's not in the riscv-gcc `t-elf-multilib`, so this code 
> > should choose a new default. I don't know how this new default will affect 
> > defaults chosen in other parts of the clang codebase.
> oh it's why I added rv64i/lp64 in previous version, but it's wrong default.
> in riscv gcc if configure only with --enable-multilib, the default march/abi 
> is rv64imafdc/lp64d
> The option 1 is aligning to gcc, but the default abi is lp64 in clang,
> maybe chosing rv64imac as default is less side effect? what do you think?
The solution for this patch is to use the function `riscv::getRISCVABI(const 
ArgList &Args, const llvm::Triple &Triple)` from 
`clang/lib/Driver/ToolChains/Arch/RISCV.h`. 

Then when I update the logic there to match gcc's logic, the right thing will 
happen. I will submit a patch to have this function match the gcc logic today. 
It took me a few hours but I found the default logic for GCC. 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67508/new/

https://reviews.llvm.org/D67508



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D66647: [clangd] DefineInline action apply logic with fully qualified names

2019-10-24 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 226230.
kadircet marked 15 inline comments as done.
kadircet added a comment.

- Improve macro handling


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66647/new/

https://reviews.llvm.org/D66647

Files:
  clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp
  clang-tools-extra/clangd/unittests/TweakTesting.cpp
  clang-tools-extra/clangd/unittests/TweakTesting.h
  clang-tools-extra/clangd/unittests/TweakTests.cpp

Index: clang-tools-extra/clangd/unittests/TweakTests.cpp
===
--- clang-tools-extra/clangd/unittests/TweakTests.cpp
+++ clang-tools-extra/clangd/unittests/TweakTests.cpp
@@ -25,6 +25,7 @@
 #include "clang/Tooling/Core/Replacement.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/MemoryBuffer.h"
@@ -40,11 +41,16 @@
 using ::testing::AllOf;
 using ::testing::HasSubstr;
 using ::testing::StartsWith;
+using ::testing::ElementsAre;
 
 namespace clang {
 namespace clangd {
 namespace {
 
+MATCHER_P2(FileWithContents, FileName, Contents, "") {
+  return arg.first() == FileName && arg.second == Contents;
+}
+
 TEST(FileEdits, AbsolutePath) {
   auto RelPaths = {"a.h", "foo.cpp", "test/test.cpp"};
 
@@ -1047,6 +1053,512 @@
   })cpp");
 }
 
+TEST_F(DefineInlineTest, TransformNestedNamespaces) {
+  EXPECT_EQ(apply(R"cpp(
+  namespace a {
+void bar();
+namespace b {
+  void baz();
+  namespace c {
+void aux();
+  }
+}
+  }
+
+  void foo();
+  using namespace a;
+  using namespace b;
+  using namespace c;
+  void f^oo() {
+bar();
+a::bar();
+
+baz();
+b::baz();
+a::b::baz();
+
+aux();
+c::aux();
+b::c::aux();
+a::b::c::aux();
+  })cpp"), R"cpp(
+  namespace a {
+void bar();
+namespace b {
+  void baz();
+  namespace c {
+void aux();
+  }
+}
+  }
+
+  void foo(){
+a::bar();
+a::bar();
+
+a::b::baz();
+a::b::baz();
+a::b::baz();
+
+a::b::c::aux();
+a::b::c::aux();
+a::b::c::aux();
+a::b::c::aux();
+  }
+  using namespace a;
+  using namespace b;
+  using namespace c;
+  )cpp");
+}
+
+TEST_F(DefineInlineTest, TransformUsings) {
+  EXPECT_EQ(apply(R"cpp(
+  namespace a { namespace b { namespace c { void aux(); } } }
+
+  void foo();
+  void f^oo() {
+using namespace a;
+using namespace b;
+using namespace c;
+using c::aux;
+namespace d = c;
+  })cpp"),
+R"cpp(
+  namespace a { namespace b { namespace c { void aux(); } } }
+
+  void foo(){
+using namespace a;
+using namespace a::b;
+using namespace a::b::c;
+using a::b::c::aux;
+namespace d = a::b::c;
+  }
+  )cpp");
+}
+
+TEST_F(DefineInlineTest, TransformDecls) {
+  EXPECT_EQ(apply(R"cpp(
+  void foo();
+  void f^oo() {
+class Foo {
+public:
+  void foo();
+  int x;
+  static int y;
+};
+Foo::y = 0;
+
+enum En { Zero, One };
+En x = Zero;
+
+enum class EnClass { Zero, One };
+EnClass y = EnClass::Zero;
+  })cpp"),
+R"cpp(
+  void foo(){
+class Foo {
+public:
+  void foo();
+  int x;
+  static int y;
+};
+Foo::y = 0;
+
+enum En { Zero, One };
+En x = Zero;
+
+enum class EnClass { Zero, One };
+EnClass y = EnClass::Zero;
+  }
+  )cpp");
+}
+
+TEST_F(DefineInlineTest, TransformTemplDecls) {
+  EXPECT_EQ(apply(R"cpp(
+  namespace a {
+template  class Bar {
+public:
+  void bar();
+};
+template  T bar;
+template  void aux() {}
+  }
+
+  void foo();
+
+  using namespace a;
+  void f^oo() {
+bar>.bar();
+aux>();
+  })cpp"),
+R"cpp(
+  namespace a {
+template  class Bar {
+public:
+  void bar();
+};
+template  T bar;
+template  void aux() {}
+  }
+
+  void foo(){
+a::bar>.bar();
+a::aux>();
+  }
+
+  using namespace a;
+  )cpp");
+}
+
+TEST_F(DefineInlineTest, TransformMembers) {
+  EXPECT_EQ(apply(R"cpp(
+  class Foo {
+void foo();
+  };
+
+  void Foo::f^oo() {
+return;
+  })cpp"),
+R"cpp(
+  class Foo {
+void foo(){
+return;
+  }
+  };
+
+  )cpp");
+
+  ExtraFiles["a.h"] = R"cpp(
+  class Foo {
+void foo();
+  };)cpp";
+
+  llvm::StringMap EditedFiles;
+  EXPECT_EQ(apply(R"cpp(
+  #include "a.h"
+  void Foo::f^oo() {
+return;
+  })cpp",
+  &EditedFiles),
+R"cpp(
+  #include "a.h"
+  )cpp");
+  EXPECT_THAT(EditedFiles,
+  ElementsAre(FileWithContents(testPath("a.h"),
+R"cpp(
+  class Foo {
+void foo(){
+return;
+  }
+  };)cpp")));
+}
+
+TEST_F(DefineInlineTest, TransformDependentTypes) {
+  EXPECT_EQ(apply(R"cpp(
+  namespace a {
+template  class Bar {};
+  }
+
+  template

[PATCH] D69378: [AArch64][SVE] Implement masked store intrinsics

2019-10-24 Thread Kerry McLaughlin via Phabricator via cfe-commits
kmclaughlin created this revision.
kmclaughlin added reviewers: huntergr, greened, dmgreen, rovka.
Herald added subscribers: psnobl, rkruppe, hiraditya, kristof.beyls, tschuett.
Herald added a project: LLVM.

Adds support for codegen of masked stores, with non-truncating
and truncating variants.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69378

Files:
  llvm/lib/Target/AArch64/AArch64InstrInfo.td
  llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
  llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
  llvm/test/CodeGen/AArch64/sve-masked-ldst-nonext.ll
  llvm/test/CodeGen/AArch64/sve-masked-ldst-trunc.ll

Index: llvm/test/CodeGen/AArch64/sve-masked-ldst-trunc.ll
===
--- /dev/null
+++ llvm/test/CodeGen/AArch64/sve-masked-ldst-trunc.ll
@@ -0,0 +1,76 @@
+; RUN: llc -mtriple=aarch64--linux-gnu -mattr=+sve < %s | FileCheck %s
+
+;
+; Masked Stores
+;
+
+define void @masked_trunc_store_nxv2i8( *%a,  *%b,  %mask) {
+; CHECK-LABEL: masked_trunc_store_nxv2i8:
+; CHECK: ld1d { [[IN:z[0-9]]].d }, [[PG:p[0-9]]]/z, [x0]
+; CHECK: st1b { [[IN]].d }, [[PG]], [x1]
+  %load = call  @llvm.masked.load.nxv2i64( *%a, i32 8,  %mask,  undef)
+  %trunc = trunc  %load to 
+  call void @llvm.masked.store.nxv2i8( %trunc,  *%b, i32 8,  %mask)
+  ret void
+}
+
+define void @masked_trunc_store_nxv2i16( *%a,  *%b,  %mask) {
+; CHECK-LABEL: masked_trunc_store_nxv2i16:
+; CHECK: ld1d { [[IN:z[0-9]]].d }, [[PG:p[0-9]]]/z, [x0]
+; CHECK: st1h { [[IN]].d }, [[PG]], [x1]
+  %load = call  @llvm.masked.load.nxv2i64( *%a, i32 8,  %mask,  undef)
+  %trunc = trunc  %load to 
+  call void @llvm.masked.store.nxv2i16( %trunc,  *%b, i32 8,  %mask)
+  ret void
+}
+
+define void @masked_trunc_store_nxv2i32( *%a,  *%b,  %mask) {
+; CHECK-LABEL: masked_trunc_store_nxv2i32:
+; CHECK: ld1d { [[IN:z[0-9]]].d }, [[PG:p[0-9]]]/z, [x0]
+; CHECK: st1w { [[IN]].d }, [[PG]], [x1]
+  %load = call  @llvm.masked.load.nxv2i64( *%a, i32 8,  %mask,  undef)
+  %trunc = trunc  %load to 
+  call void @llvm.masked.store.nxv2i32( %trunc,  *%b, i32 8,  %mask)
+  ret void
+}
+
+define void @masked_trunc_store_nxv4i8( *%a,  *%b,  %mask) {
+; CHECK-LABEL: masked_trunc_store_nxv4i8:
+; CHECK: ld1w { [[IN:z[0-9]]].s }, [[PG:p[0-9]]]/z, [x0]
+; CHECK: st1b { [[IN]].s }, [[PG]], [x1]
+  %load = call  @llvm.masked.load.nxv4i32( *%a, i32 4,  %mask,  undef)
+  %trunc = trunc  %load to 
+  call void @llvm.masked.store.nxv4i8( %trunc,  *%b, i32 4,  %mask)
+  ret void
+}
+
+define void @masked_trunc_store_nxv4i16( *%a,  *%b,  %mask) {
+; CHECK-LABEL: masked_trunc_store_nxv4i16:
+; CHECK: ld1w { [[IN:z[0-9]]].s }, [[PG:p[0-9]]]/z, [x0]
+; CHECK: st1h { [[IN]].s }, [[PG]], [x1]
+  %load = call  @llvm.masked.load.nxv4i32( *%a, i32 4,  %mask,  undef)
+  %trunc = trunc  %load to 
+  call void @llvm.masked.store.nxv4i16( %trunc,  *%b, i32 4,  %mask)
+  ret void
+}
+
+define void @masked_trunc_store_nxv8i8( *%a,  *%b,  %mask) {
+; CHECK-LABEL: masked_trunc_store_nxv8i8:
+; CHECK: ld1h { [[IN:z[0-9]]].h }, [[PG:p[0-9]]]/z, [x0]
+; CHECK: st1b { [[IN]].h }, [[PG]], [x1]
+  %load = call  @llvm.masked.load.nxv8i16( *%a, i32 2,  %mask,  undef)
+  %trunc = trunc  %load to 
+  call void @llvm.masked.store.nxv8i8( %trunc,  *%b, i32 2,  %mask)
+  ret void
+}
+
+declare  @llvm.masked.load.nxv2i64(*, i32, , )
+declare  @llvm.masked.load.nxv4i32(*, i32, , )
+declare  @llvm.masked.load.nxv8i16(*, i32, , )
+
+declare void @llvm.masked.store.nxv2i8(, *, i32, )
+declare void @llvm.masked.store.nxv2i16(, *, i32, )
+declare void @llvm.masked.store.nxv2i32(, *, i32, )
+declare void @llvm.masked.store.nxv4i8(, *, i32, )
+declare void @llvm.masked.store.nxv4i16(, *, i32, )
+declare void @llvm.masked.store.nxv8i8(, *, i32, )
Index: llvm/test/CodeGen/AArch64/sve-masked-ldst-nonext.ll
===
--- llvm/test/CodeGen/AArch64/sve-masked-ldst-nonext.ll
+++ llvm/test/CodeGen/AArch64/sve-masked-ldst-nonext.ll
@@ -1,77 +1,97 @@
 ; RUN: llc -mtriple=aarch64--linux-gnu -mattr=+sve < %s | FileCheck %s
 
 ;
-; Masked Loads
+; Masked Loads & Stores
 ;
 
-define  @masked_load_nxv2i64( *%a,  %mask) {
+define void @masked_load_nxv2i64( *%a,  %mask) {
 ; CHECK-LABEL: masked_load_nxv2i64:
 ; CHECK: ld1d { [[IN:z[0-9]+]].d }, [[PG:p[0-9]+]]/z, [x0]
+; CHECK: st1d { [[IN]].d }, [[PG]], [x0]
   %load = call  @llvm.masked.load.nxv2i64( *%a, i32 8,  %mask,  undef)
-  ret  %load
+  call void @llvm.masked.store.nxv2i64( %load,  *%a, i32 8,  %mask)
+  ret void
 }
 
-define  @masked_load_nxv4i32( *%a,  %mask) {
+define void @masked_load_nxv4i32( *%a,  %mask) {
 ; CHECK-LABEL: masked_load_nxv4i32:
 ; CHECK: ld1w { [[IN:z[0-9]+]].s }, [[PG:p[0-9]+]]/z, [x0]
+; CHECK: st1w { [[IN]].s }, [[PG]], [x0]
   %load = call  @llvm.masked.load.nxv4i32( *%a, i32 4,  %mask,  undef)
-  ret  %load
+  call void @llvm.masked.store.nxv4i32( %load,  *%a, i32 4,  %mask)
+  ret void
 }
 
-define  @masked_load_nxv8i16( *%a, 

[PATCH] D67159: [clang] New __attribute__((__clang_arm_mve_alias)).

2019-10-24 Thread Simon Tatham via Phabricator via cfe-commits
simon_tatham updated this revision to Diff 226238.
simon_tatham added a comment.

(Rebased to current master; no change)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67159/new/

https://reviews.llvm.org/D67159

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/AST/Decl.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/Misc/pragma-attribute-supported-attributes-list.test
  clang/test/Sema/arm-mve-alias-attribute.c

Index: clang/test/Sema/arm-mve-alias-attribute.c
===
--- /dev/null
+++ clang/test/Sema/arm-mve-alias-attribute.c
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -triple armv8.1m.main-arm-none-eabi -verify -fsyntax-only %s
+
+static __inline__ __attribute__((__clang_arm_mve_alias(__builtin_arm_nop))) // expected-error {{'__clang_arm_mve_alias' attribute can only be applied to an ARM MVE builtin}}
+void nop(void);
+
+static __inline__ __attribute__((__clang_arm_mve_alias)) // expected-error {{'__clang_arm_mve_alias' attribute takes one argument}}
+void noparens(void);
+
+static __inline__ __attribute__((__clang_arm_mve_alias())) // expected-error {{'__clang_arm_mve_alias' attribute takes one argument}}
+void emptyparens(void);
+
+static __inline__ __attribute__((__clang_arm_mve_alias("string literal"))) // expected-error {{'__clang_arm_mve_alias' attribute requires parameter 1 to be an identifier}}
+void stringliteral(void);
+
+static __inline__ __attribute__((__clang_arm_mve_alias(1))) // expected-error {{'__clang_arm_mve_alias' attribute requires parameter 1 to be an identifier}}
+void integer(void);
+
+static __inline__ __attribute__((__clang_arm_mve_alias(__builtin_arm_nop, 2))) // expected-error {{'__clang_arm_mve_alias' attribute takes one argument}}
+void twoargs(void);
+
+static __attribute__((__clang_arm_mve_alias(__builtin_arm_nop))) // expected-error {{'__clang_arm_mve_alias' attribute only applies to functions}}
+int variable;
Index: clang/test/Misc/pragma-attribute-supported-attributes-list.test
===
--- clang/test/Misc/pragma-attribute-supported-attributes-list.test
+++ clang/test/Misc/pragma-attribute-supported-attributes-list.test
@@ -17,6 +17,7 @@
 // CHECK-NEXT: Annotate ()
 // CHECK-NEXT: AnyX86NoCfCheck (SubjectMatchRule_hasType_functionType)
 // CHECK-NEXT: ArcWeakrefUnavailable (SubjectMatchRule_objc_interface)
+// CHECK-NEXT: ArmMveAlias (SubjectMatchRule_function)
 // CHECK-NEXT: AssumeAligned (SubjectMatchRule_objc_method, SubjectMatchRule_function)
 // CHECK-NEXT: Availability ((SubjectMatchRule_record, SubjectMatchRule_enum, SubjectMatchRule_enum_constant, SubjectMatchRule_field, SubjectMatchRule_function, SubjectMatchRule_namespace, SubjectMatchRule_objc_category, SubjectMatchRule_objc_implementation, SubjectMatchRule_objc_interface, SubjectMatchRule_objc_method, SubjectMatchRule_objc_property, SubjectMatchRule_objc_protocol, SubjectMatchRule_record, SubjectMatchRule_type_alias, SubjectMatchRule_variable))
 // CHECK-NEXT: CFAuditedTransfer (SubjectMatchRule_function)
Index: clang/lib/Sema/SemaDeclAttr.cpp
===
--- clang/lib/Sema/SemaDeclAttr.cpp
+++ clang/lib/Sema/SemaDeclAttr.cpp
@@ -23,6 +23,7 @@
 #include "clang/AST/RecursiveASTVisitor.h"
 #include "clang/Basic/CharInfo.h"
 #include "clang/Basic/SourceManager.h"
+#include "clang/Basic/TargetBuiltins.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Sema/DeclSpec.h"
@@ -4830,6 +4831,30 @@
  XRayLogArgsAttr(S.Context, AL, ArgCount.getSourceIndex()));
 }
 
+static bool ArmMveAliasValid(unsigned BuiltinID, StringRef AliasName) {
+  // FIXME: this will be filled in by Tablegen which isn't written yet
+  return false;
+}
+
+static void handleArmMveAliasAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
+  if (!AL.isArgIdent(0)) {
+S.Diag(AL.getLoc(), diag::err_attribute_argument_n_type)
+<< AL << 1 << AANT_ArgumentIdentifier;
+return;
+  }
+
+  IdentifierInfo *Ident = AL.getArgAsIdent(0)->Ident;
+  unsigned BuiltinID = Ident->getBuiltinID();
+
+  if (!ArmMveAliasValid(BuiltinID,
+cast(D)->getIdentifier()->getName())) {
+S.Diag(AL.getLoc(), diag::err_attribute_arm_mve_alias);
+return;
+  }
+
+  D->addAttr(::new (S.Context) ArmMveAliasAttr(S.Context, AL, Ident));
+}
+
 //===--===//
 // Checker-specific attribute handlers.
 //===--===//
@@ -7160,6 +7185,10 @@
   case ParsedAttr::AT_MSAllocator:
 handleMSAllocatorAttr(S, D, AL);
 break;
+
+  case ParsedAttr::AT_ArmMveAlias:
+handleArmMveAliasAttr(S, D, AL);
+break;
   }
 }
 
Index: clang/lib/AST/Decl.cpp
==

[PATCH] D50078: clang-format: support aligned nested conditionals formatting

2019-10-24 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay accepted this revision.
MyDeveloperDay added a comment.

LGTM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D50078/new/

https://reviews.llvm.org/D50078



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D67508: [RISCV] support mutilib in baremetal environment

2019-10-24 Thread Sam Elliott via Phabricator via cfe-commits
lenary added inline comments.



Comment at: clang/lib/Driver/ToolChains/Gnu.cpp:1547
+  else if (IsRV64)
+MArch = "rv64i";
+  else

lenary wrote:
> khchen wrote:
> > lenary wrote:
> > > I think this line is the issue: where someone doesn't specify `-march`, 
> > > you choose a default `-march` that does not appear in the list of 
> > > multilib arches in `RISCVMultilibSet` above.
> > > 
> > > I think this issue probably didn't arise when you had `rv64i/lp64` in the 
> > > list, but given that's not in the riscv-gcc `t-elf-multilib`, so this 
> > > code should choose a new default. I don't know how this new default will 
> > > affect defaults chosen in other parts of the clang codebase.
> > oh it's why I added rv64i/lp64 in previous version, but it's wrong default.
> > in riscv gcc if configure only with --enable-multilib, the default 
> > march/abi is rv64imafdc/lp64d
> > The option 1 is aligning to gcc, but the default abi is lp64 in clang,
> > maybe chosing rv64imac as default is less side effect? what do you think?
> The solution for this patch is to use the function `riscv::getRISCVABI(const 
> ArgList &Args, const llvm::Triple &Triple)` from 
> `clang/lib/Driver/ToolChains/Arch/RISCV.h`. 
> 
> Then when I update the logic there to match gcc's logic, the right thing will 
> happen. I will submit a patch to have this function match the gcc logic 
> today. It took me a few hours but I found the default logic for GCC. 
Sorry, I'm wrong. I'm adding a `riscv::getRISCVArch(...)` to that file, which 
will solve this issue, sorry for the confusion. Will add this patch as 
dependent on that one when it's ready.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67508/new/

https://reviews.llvm.org/D67508



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69327: [Clang][ThinLTO] Add a cache for compile phase output.

2019-10-24 Thread Teresa Johnson via Phabricator via cfe-commits
tejohnson added a comment.

We rely on the minimized bitcode from that option in our builds, so it won't be 
going away. We could add it as a driver option, but it doesn't sound like that 
will solve the ccache issue. I'm not very familiar with that cache support, or 
if there is a way to express other output files (in our build system we 
identify all the outputs of a build action). At least with something like make 
and ninja the compile action should not be done again if none of the inputs 
change.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69327/new/

https://reviews.llvm.org/D69327



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50078: clang-format: support aligned nested conditionals formatting

2019-10-24 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 226245.
Typz added a comment.

Fix earlier error in patch upload.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D50078/new/

https://reviews.llvm.org/D50078

Files:
  clang/lib/Format/ContinuationIndenter.cpp
  clang/lib/Format/ContinuationIndenter.h
  clang/lib/Format/WhitespaceManager.cpp
  clang/lib/Format/WhitespaceManager.h
  clang/unittests/Format/FormatTest.cpp

Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -5734,9 +5734,9 @@
getLLVMStyleWithColumns(60));
   verifyFormat("bool aa = a //\n"
"  ? aaa\n"
-   "  : bbb //\n"
-   "? ccc\n"
-   ": ddd;");
+   "  : bbb //\n"
+   "  ? ccc\n"
+   "  : ddd;");
   verifyFormat("bool aa = a //\n"
"  ? aaa\n"
"  : (bbb //\n"
@@ -5798,6 +5798,113 @@
" // comment\n"
" ? a = b\n"
" : a;");
+
+  // Chained conditionals
+  FormatStyle Style = getLLVMStyle();
+  Style.ColumnLimit = 70;
+  Style.AlignOperands = true;
+  verifyFormat("return  ? \n"
+   "   : bb ? \n"
+   ": ;",
+   Style);
+  verifyFormat("return  ? \n"
+   "   : bb ? \n"
+   ": ;",
+   Style);
+  verifyFormat("return aa ? \n"
+   "   :  ? \n"
+   "  : ;",
+   Style);
+  verifyFormat("return  ? \n"
+   "   : bb ? 22\n"
+   ": 33;",
+   Style);
+  verifyFormat("return  ? \n"
+   "   : bb ? \n"
+   "   : cc ? \n"
+   ": ;",
+   Style);
+  verifyFormat("return  ? (aaa ? bbb : ccc)\n"
+   "   : bb ? \n"
+   ": ;",
+   Style);
+  verifyFormat("return  ? \n"
+   "   : bb ? \n"
+   ": (aaa ? bbb : ccc);",
+   Style);
+  verifyFormat("return  ? (a ? bb\n"
+   " : cc)\n"
+   "   : bb ? \n"
+   ": ;",
+   Style);
+  verifyFormat("return a? (a ? bb\n"
+   " : cc)\n"
+   "   : bb ? \n"
+   ": ;",
+   Style);
+  verifyFormat("return a? a = (a ? bb\n"
+   " : dd)\n"
+   "   : bb ? \n"
+   ": ;",
+   Style);
+  verifyFormat("return a? a + (a ? bb\n"
+   " : dd)\n"
+   "   : bb ? \n"
+   ": ;",
+   Style);
+  verifyFormat("return a? \n"
+   "   : bb ? \n"
+   ": a + (a ? bb\n"
+   " : dd)\n",
+   Style);
+  verifyFormat("return  ? \n"
+   "   : bb ? \n"
+   ": (a ? 

[PATCH] D50078: clang-format: support aligned nested conditionals formatting

2019-10-24 Thread Francois Ferrand via Phabricator via cfe-commits
Typz updated this revision to Diff 226246.
Typz added a comment.

.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D50078/new/

https://reviews.llvm.org/D50078

Files:
  clang/lib/Format/ContinuationIndenter.cpp
  clang/lib/Format/ContinuationIndenter.h
  clang/lib/Format/WhitespaceManager.cpp
  clang/lib/Format/WhitespaceManager.h
  clang/unittests/Format/FormatTest.cpp

Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -5734,9 +5734,9 @@
getLLVMStyleWithColumns(60));
   verifyFormat("bool aa = a //\n"
"  ? aaa\n"
-   "  : bbb //\n"
-   "? ccc\n"
-   ": ddd;");
+   "  : bbb //\n"
+   "  ? ccc\n"
+   "  : ddd;");
   verifyFormat("bool aa = a //\n"
"  ? aaa\n"
"  : (bbb //\n"
@@ -5798,6 +5798,113 @@
" // comment\n"
" ? a = b\n"
" : a;");
+
+  // Chained conditionals
+  FormatStyle Style = getLLVMStyle();
+  Style.ColumnLimit = 70;
+  Style.AlignOperands = true;
+  verifyFormat("return  ? \n"
+   "   : bb ? \n"
+   ": ;",
+   Style);
+  verifyFormat("return  ? \n"
+   "   : bb ? \n"
+   ": ;",
+   Style);
+  verifyFormat("return aa ? \n"
+   "   :  ? \n"
+   "  : ;",
+   Style);
+  verifyFormat("return  ? \n"
+   "   : bb ? 22\n"
+   ": 33;",
+   Style);
+  verifyFormat("return  ? \n"
+   "   : bb ? \n"
+   "   : cc ? \n"
+   ": ;",
+   Style);
+  verifyFormat("return  ? (aaa ? bbb : ccc)\n"
+   "   : bb ? \n"
+   ": ;",
+   Style);
+  verifyFormat("return  ? \n"
+   "   : bb ? \n"
+   ": (aaa ? bbb : ccc);",
+   Style);
+  verifyFormat("return  ? (a ? bb\n"
+   " : cc)\n"
+   "   : bb ? \n"
+   ": ;",
+   Style);
+  verifyFormat("return a? (a ? bb\n"
+   " : cc)\n"
+   "   : bb ? \n"
+   ": ;",
+   Style);
+  verifyFormat("return a? a = (a ? bb\n"
+   " : dd)\n"
+   "   : bb ? \n"
+   ": ;",
+   Style);
+  verifyFormat("return a? a + (a ? bb\n"
+   " : dd)\n"
+   "   : bb ? \n"
+   ": ;",
+   Style);
+  verifyFormat("return a? \n"
+   "   : bb ? \n"
+   ": a + (a ? bb\n"
+   " : dd)\n",
+   Style);
+  verifyFormat("return  ? \n"
+   "   : bb ? \n"
+   ": (a ? bb\n"
+   "  

[PATCH] D67750: Allow additional file suffixes/extensions considered as source in main include grouping

2019-10-24 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay requested changes to this revision.
MyDeveloperDay marked an inline comment as done.
MyDeveloperDay added a comment.
This revision now requires changes to proceed.

I think fundamentally this seems like a reasonable idea, for those that don't 
need they don't need to use it.




Comment at: clang/docs/ClangFormat.rst:36
--style=file) and to determine the language.
+-assume-filename= - Override filename used to determine the 
language.
+When reading from stdin, clang-format assumes 
this
+filename to determine the language.
 -cursor=- The position of the cursor when invoking
 clang-format from an editor integration

I agree this seems wrong, it's making it sound like -assume-filename is a file 
that will replace .clang-format .. I don't think thats true as you correctly 
point out



Comment at: clang/lib/Format/Format.cpp:456
+IO.mapOptional("IncludeIsMainSourceRegex",
+   Style.IncludeStyle.IncludeIsMainSourceRegex);
 IO.mapOptional("IndentCaseLabels", Style.IndentCaseLabels);

I think we are missing a change to the operator== in Format.h (I notice 
IncludeIsMainRegex is missing from there too)



Comment at: clang/lib/Tooling/Inclusions/HeaderIncludes.cpp:183
 CategoryRegexs.emplace_back(Category.Regex, llvm::Regex::IgnoreCase);
+  llvm::Regex MainFileRegex(Style.IncludeIsMainSourceRegex);
   IsMainFile = FileName.endswith(".c") || FileName.endswith(".cc") ||

whats the default value of `IncludeIsMainSourceRegex?`, are we making a regex 
even when its empty?

could we not or the regex after if its defined

```
IsMainFile = FileName.endswith(".c") || FileName.endswith(".cc") ||
   FileName.endswith(".cpp") || FileName.endswith(".c++") ||
   FileName.endswith(".cxx") || FileName.endswith(".m") ||
   FileName.endswith(".mm");
if (!Style.IncludeIsMainSourceRegex.empty()){
llvm::Regex MainFileRegex(Style.IncludeIsMainSourceRegex);
IsMainFile |= MainFileRegex.match(FileName);
}
```



Comment at: clang/tools/clang-format/ClangFormat.cpp:79
+ "When reading from stdin, clang-format assumes this\n"
+ "filename to determine the language."),
+cl::init(""), cl::cat(ClangFormatCategory));

This may be a little out of date and needs rebasing as I believe this reformat 
has already been done, but your new wording is correct


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67750/new/

https://reviews.llvm.org/D67750



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50078: clang-format: support aligned nested conditionals formatting

2019-10-24 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added inline comments.



Comment at: clang/unittests/Format/FormatTest.cpp:5739
+   "  ? ccc\n"
+   "  : ddd;");
   verifyFormat("bool aa = a //\n"

MyDeveloperDay wrote:
> Nit: I'm just slightly confused as to what is happening here.. I assume this 
> is the case where they are not aligned in the style. 
Ternary operator do indeed get aligned, thus :
* the "tests" (on first and third lines) get aligned
* the "results" do not fit on the line, thus get further wrapped



Comment at: clang/unittests/Format/FormatTest.cpp:5998
+   "  ddd;",
Style);
   verifyFormat("bool aa = a ? //\n"

MyDeveloperDay wrote:
> as above how does one get back to the original case?
I tried this quite a bit, but could not find a reliable way to "skip" the 
ternary operator alignment when result operand get wrapped.
If you have an idea/hint how to do this, I'd be glad to give a try...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D50078/new/

https://reviews.llvm.org/D50078



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69382: [clangd] Do not insert parentheses when completing a using declaration

2019-10-24 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov created this revision.
ilya-biryukov added a reviewer: kadircet.
Herald added subscribers: usaxena95, arphaman, jkorous, MaskRay.
Herald added a project: clang.

Would be nice to also fix this in clang, but that looks like more work
if we want to preserve signatures in informative chunks.

Fixes https://github.com/clangd/clangd/issues/118


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69382

Files:
  clang-tools-extra/clangd/CodeComplete.cpp
  clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/CodeCompleteConsumer.h
  clang/include/clang/Sema/Sema.h
  clang/lib/Parse/ParseDeclCXX.cpp
  clang/lib/Parse/ParseExprCXX.cpp
  clang/lib/Sema/SemaCodeComplete.cpp

Index: clang/lib/Sema/SemaCodeComplete.cpp
===
--- clang/lib/Sema/SemaCodeComplete.cpp
+++ clang/lib/Sema/SemaCodeComplete.cpp
@@ -5330,7 +5330,8 @@
 }
 
 void Sema::CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS,
-   bool EnteringContext, QualType BaseType,
+   bool EnteringContext,
+   bool IsUsingDeclaration, QualType BaseType,
QualType PreferredType) {
   if (SS.isEmpty() || !CodeCompleter)
 return;
@@ -5341,6 +5342,7 @@
   // contexts/symbols that are not in the AST.
   if (SS.isInvalid()) {
 CodeCompletionContext CC(CodeCompletionContext::CCC_Symbol, PreferredType);
+CC.setIsUsingDeclaration(IsUsingDeclaration);
 CC.setCXXScopeSpecifier(SS);
 // As SS is invalid, we try to collect accessible contexts from the current
 // scope with a dummy lookup so that the completion consumer can try to
@@ -5371,10 +5373,12 @@
   if (!isDependentScopeSpecifier(SS) && RequireCompleteDeclContext(SS, Ctx))
 return;
 
-  ResultBuilder Results(
-  *this, CodeCompleter->getAllocator(),
-  CodeCompleter->getCodeCompletionTUInfo(),
-  CodeCompletionContext(CodeCompletionContext::CCC_Symbol, PreferredType));
+  CodeCompletionContext CC(CodeCompletionContext::CCC_Symbol, PreferredType);
+  CC.setCXXScopeSpecifier(SS);
+  CC.setIsUsingDeclaration(IsUsingDeclaration);
+
+  ResultBuilder Results(*this, CodeCompleter->getAllocator(),
+CodeCompleter->getCodeCompletionTUInfo(), CC);
   if (!PreferredType.isNull())
 Results.setPreferredType(PreferredType);
   Results.EnterNewScope();
@@ -5403,23 +5407,21 @@
CodeCompleter->loadExternal());
   }
 
-  auto CC = Results.getCompletionContext();
-  CC.setCXXScopeSpecifier(SS);
-
-  HandleCodeCompleteResults(this, CodeCompleter, CC, Results.data(),
-Results.size());
+  HandleCodeCompleteResults(this, CodeCompleter, Results.getCompletionContext(),
+Results.data(), Results.size());
 }
 
 void Sema::CodeCompleteUsing(Scope *S) {
   if (!CodeCompleter)
 return;
 
+  // This can be both a using alias or using declaration, in the former we
+  // expect a new name and a symbol in the latter case.
+  CodeCompletionContext Context(CodeCompletionContext::CCC_SymbolOrNewName);
+  Context.setIsUsingDeclaration(true);
+
   ResultBuilder Results(*this, CodeCompleter->getAllocator(),
-CodeCompleter->getCodeCompletionTUInfo(),
-// This can be both a using alias or using
-// declaration, in the former we expect a new name and a
-// symbol in the latter case.
-CodeCompletionContext::CCC_SymbolOrNewName,
+CodeCompleter->getCodeCompletionTUInfo(), Context,
 &ResultBuilder::IsNestedNameSpecifier);
   Results.EnterNewScope();
 
Index: clang/lib/Parse/ParseExprCXX.cpp
===
--- clang/lib/Parse/ParseExprCXX.cpp
+++ clang/lib/Parse/ParseExprCXX.cpp
@@ -143,13 +143,10 @@
 /// \param OnlyNamespace If true, only considers namespaces in lookup.
 ///
 /// \returns true if there was an error parsing a scope specifier
-bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS,
-ParsedType ObjectType,
-bool EnteringContext,
-bool *MayBePseudoDestructor,
-bool IsTypename,
-IdentifierInfo **LastII,
-bool OnlyNamespace) {
+bool Parser::ParseOptionalCXXScopeSpecifier(
+CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext,
+bool *MayBePseudoDestructor, bool IsTypename, IdentifierInfo **LastII,
+bool OnlyNamespace, bool InUsingDeclaration) {
   assert(getLangOpts().CPlusPlus &&
  "Call sites of this function sho

[clang-tools-extra] ed913a2 - [clangd] Fix case of variables and functions in code complete tests. NFC

2019-10-24 Thread Ilya Biryukov via cfe-commits

Author: Ilya Biryukov
Date: 2019-10-24T15:41:50+02:00
New Revision: ed913a291532968c188909e932a94c5cc7b416be

URL: 
https://github.com/llvm/llvm-project/commit/ed913a291532968c188909e932a94c5cc7b416be
DIFF: 
https://github.com/llvm/llvm-project/commit/ed913a291532968c188909e932a94c5cc7b416be.diff

LOG: [clangd] Fix case of variables and functions in code complete tests. NFC

Added: 


Modified: 
clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp 
b/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
index 73bb1f97bda2..74d37df795a7 100644
--- a/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
+++ b/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
@@ -97,7 +97,7 @@ std::unique_ptr memIndex(std::vector 
Symbols) {
 }
 
 CodeCompleteResult completions(ClangdServer &Server, llvm::StringRef TestCode,
-   Position point,
+   Position Point,
std::vector IndexSymbols = {},
clangd::CodeCompleteOptions Opts = {}) {
   std::unique_ptr OverrideIndex;
@@ -110,7 +110,7 @@ CodeCompleteResult completions(ClangdServer &Server, 
llvm::StringRef TestCode,
   auto File = testPath("foo.cpp");
   runAddDocument(Server, File, TestCode);
   auto CompletionList =
-  llvm::cantFail(runCodeComplete(Server, File, point, Opts));
+  llvm::cantFail(runCodeComplete(Server, File, Point, Opts));
   return CompletionList;
 }
 
@@ -209,7 +209,7 @@ TEST(CompletionTest, Filter) {
   AllOf(Has("Car"), Not(Has("MotorCar";
 }
 
-void TestAfterDotCompletion(clangd::CodeCompleteOptions Opts) {
+void testAfterDotCompletion(clangd::CodeCompleteOptions Opts) {
   auto Results = completions(
   R"cpp(
   int global_var;
@@ -264,7 +264,7 @@ void TestAfterDotCompletion(clangd::CodeCompleteOptions 
Opts) {
  Contains(IsDocumented()));
 }
 
-void TestGlobalScopeCompletion(clangd::CodeCompleteOptions Opts) {
+void testGlobalScopeCompletion(clangd::CodeCompleteOptions Opts) {
   auto Results = completions(
   R"cpp(
   int global_var;
@@ -313,8 +313,8 @@ void TestGlobalScopeCompletion(clangd::CodeCompleteOptions 
Opts) {
 
 TEST(CompletionTest, CompletionOptions) {
   auto Test = [&](const clangd::CodeCompleteOptions &Opts) {
-TestAfterDotCompletion(Opts);
-TestGlobalScopeCompletion(Opts);
+testAfterDotCompletion(Opts);
+testGlobalScopeCompletion(Opts);
   };
   // We used to test every combination of options, but that got too slow (2^N).
   auto Flags = {
@@ -2131,12 +2131,12 @@ TEST(CompletionTest, EnableSpeculativeIndexRequest) {
 
 TEST(CompletionTest, InsertTheMostPopularHeader) {
   std::string DeclFile = URI::create(testPath("foo")).toString();
-  Symbol sym = func("Func");
-  sym.CanonicalDeclaration.FileURI = DeclFile.c_str();
-  sym.IncludeHeaders.emplace_back("\"foo.h\"", 2);
-  sym.IncludeHeaders.emplace_back("\"bar.h\"", 1000);
+  Symbol Sym = func("Func");
+  Sym.CanonicalDeclaration.FileURI = DeclFile.c_str();
+  Sym.IncludeHeaders.emplace_back("\"foo.h\"", 2);
+  Sym.IncludeHeaders.emplace_back("\"bar.h\"", 1000);
 
-  auto Results = completions("Fun^", {sym}).Completions;
+  auto Results = completions("Fun^", {Sym}).Completions;
   assert(!Results.empty());
   EXPECT_THAT(Results[0], AllOf(Named("Func"), InsertInclude("\"bar.h\"")));
   EXPECT_EQ(Results[0].Includes.size(), 2u);
@@ -2153,13 +2153,13 @@ TEST(CompletionTest, NoInsertIncludeIfOnePresent) {
   ClangdServer Server(CDB, FS, DiagConsumer, ClangdServer::optsForTest());
 
   std::string DeclFile = URI::create(testPath("foo")).toString();
-  Symbol sym = func("Func");
-  sym.CanonicalDeclaration.FileURI = DeclFile.c_str();
-  sym.IncludeHeaders.emplace_back("\"foo.h\"", 2);
-  sym.IncludeHeaders.emplace_back("\"bar.h\"", 1000);
+  Symbol Sym = func("Func");
+  Sym.CanonicalDeclaration.FileURI = DeclFile.c_str();
+  Sym.IncludeHeaders.emplace_back("\"foo.h\"", 2);
+  Sym.IncludeHeaders.emplace_back("\"bar.h\"", 1000);
 
   EXPECT_THAT(
-  completions(Server, "#include \"foo.h\"\nFun^", {sym}).Completions,
+  completions(Server, "#include \"foo.h\"\nFun^", {Sym}).Completions,
   UnorderedElementsAre(
   AllOf(Named("Func"), HasInclude("\"foo.h\""), 
Not(InsertInclude();
 }



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69382: [clangd] Do not insert parentheses when completing a using declaration

2019-10-24 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 226253.
ilya-biryukov added a comment.

- Fix name of a constructor parameter


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69382/new/

https://reviews.llvm.org/D69382

Files:
  clang-tools-extra/clangd/CodeComplete.cpp
  clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/CodeCompleteConsumer.h
  clang/include/clang/Sema/Sema.h
  clang/lib/Parse/ParseDeclCXX.cpp
  clang/lib/Parse/ParseExprCXX.cpp
  clang/lib/Sema/SemaCodeComplete.cpp

Index: clang/lib/Sema/SemaCodeComplete.cpp
===
--- clang/lib/Sema/SemaCodeComplete.cpp
+++ clang/lib/Sema/SemaCodeComplete.cpp
@@ -5330,7 +5330,8 @@
 }
 
 void Sema::CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS,
-   bool EnteringContext, QualType BaseType,
+   bool EnteringContext,
+   bool IsUsingDeclaration, QualType BaseType,
QualType PreferredType) {
   if (SS.isEmpty() || !CodeCompleter)
 return;
@@ -5341,6 +5342,7 @@
   // contexts/symbols that are not in the AST.
   if (SS.isInvalid()) {
 CodeCompletionContext CC(CodeCompletionContext::CCC_Symbol, PreferredType);
+CC.setIsUsingDeclaration(IsUsingDeclaration);
 CC.setCXXScopeSpecifier(SS);
 // As SS is invalid, we try to collect accessible contexts from the current
 // scope with a dummy lookup so that the completion consumer can try to
@@ -5371,10 +5373,12 @@
   if (!isDependentScopeSpecifier(SS) && RequireCompleteDeclContext(SS, Ctx))
 return;
 
-  ResultBuilder Results(
-  *this, CodeCompleter->getAllocator(),
-  CodeCompleter->getCodeCompletionTUInfo(),
-  CodeCompletionContext(CodeCompletionContext::CCC_Symbol, PreferredType));
+  CodeCompletionContext CC(CodeCompletionContext::CCC_Symbol, PreferredType);
+  CC.setCXXScopeSpecifier(SS);
+  CC.setIsUsingDeclaration(IsUsingDeclaration);
+
+  ResultBuilder Results(*this, CodeCompleter->getAllocator(),
+CodeCompleter->getCodeCompletionTUInfo(), CC);
   if (!PreferredType.isNull())
 Results.setPreferredType(PreferredType);
   Results.EnterNewScope();
@@ -5403,23 +5407,21 @@
CodeCompleter->loadExternal());
   }
 
-  auto CC = Results.getCompletionContext();
-  CC.setCXXScopeSpecifier(SS);
-
-  HandleCodeCompleteResults(this, CodeCompleter, CC, Results.data(),
-Results.size());
+  HandleCodeCompleteResults(this, CodeCompleter, Results.getCompletionContext(),
+Results.data(), Results.size());
 }
 
 void Sema::CodeCompleteUsing(Scope *S) {
   if (!CodeCompleter)
 return;
 
+  // This can be both a using alias or using declaration, in the former we
+  // expect a new name and a symbol in the latter case.
+  CodeCompletionContext Context(CodeCompletionContext::CCC_SymbolOrNewName);
+  Context.setIsUsingDeclaration(true);
+
   ResultBuilder Results(*this, CodeCompleter->getAllocator(),
-CodeCompleter->getCodeCompletionTUInfo(),
-// This can be both a using alias or using
-// declaration, in the former we expect a new name and a
-// symbol in the latter case.
-CodeCompletionContext::CCC_SymbolOrNewName,
+CodeCompleter->getCodeCompletionTUInfo(), Context,
 &ResultBuilder::IsNestedNameSpecifier);
   Results.EnterNewScope();
 
Index: clang/lib/Parse/ParseExprCXX.cpp
===
--- clang/lib/Parse/ParseExprCXX.cpp
+++ clang/lib/Parse/ParseExprCXX.cpp
@@ -143,13 +143,10 @@
 /// \param OnlyNamespace If true, only considers namespaces in lookup.
 ///
 /// \returns true if there was an error parsing a scope specifier
-bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS,
-ParsedType ObjectType,
-bool EnteringContext,
-bool *MayBePseudoDestructor,
-bool IsTypename,
-IdentifierInfo **LastII,
-bool OnlyNamespace) {
+bool Parser::ParseOptionalCXXScopeSpecifier(
+CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext,
+bool *MayBePseudoDestructor, bool IsTypename, IdentifierInfo **LastII,
+bool OnlyNamespace, bool InUsingDeclaration) {
   assert(getLangOpts().CPlusPlus &&
  "Call sites of this function should be guarded by checking for C++");
 
@@ -240,7 +237,7 @@
 // Code completion for a nested-name-specifier, where the code
 // completion token follow

[PATCH] D69383: [RISCV] Match GCC `-march`/`-mabi` driver defaults

2019-10-24 Thread Sam Elliott via Phabricator via cfe-commits
lenary created this revision.
lenary added reviewers: asb, luismarques, rogfer01, kito-cheng, khchen.
Herald added subscribers: cfe-commits, pzheng, s.egerton, Jim, benna, psnobl, 
jocewei, PkmX, rkruppe, the_o, brucehoult, MartinMosbeck, edward-jones, zzheng, 
MaskRay, jrtc27, shiva0217, niosHD, sabuasal, apazos, simoncook, johnrusso, 
rbar.
Herald added a project: clang.
lenary added a child revision: D67508: [RISCV] support mutilib in baremetal 
environment.
lenary updated this revision to Diff 226252.
lenary added a comment.

- Correct code formatting issue


GCC is not a cross-compiler, and has convoluted logic in its build
system to choose a default `-march`/`-mabi` based on build options.

Clang/LLVM is a cross-compiler, and so we don't have to make a choice
about `-march`/`-mabi` at build-time, but we may have to compute a
default `-march`/`-mabi` when compiling a program.

This patch adds a new function `riscv::getRISCVArch` which encapsulates
the logic in GCC's build system for computing a default `-march` value
when none is provided. This patch also updates the logic in
`riscv::getRISCVABI` to match the logic in GCC's build system for
computing a default `-mabi`.

This patch also updates anywhere that `-march` is used to now use the
new function which can compute a default. In particular, we now
explicitly pass a `-march` value down to the gnu assembler.

Tests have been updated to match the new logic.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69383

Files:
  clang/lib/Driver/ToolChains/Arch/RISCV.cpp
  clang/lib/Driver/ToolChains/Arch/RISCV.h
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/test/Driver/riscv-abi.c
  clang/test/Driver/riscv-gnutools.c

Index: clang/test/Driver/riscv-gnutools.c
===
--- clang/test/Driver/riscv-gnutools.c
+++ clang/test/Driver/riscv-gnutools.c
@@ -1,19 +1,19 @@
 // Check gnutools are invoked with propagated values for -mabi and -march.
 
 // RUN: %clang -target riscv32 -fno-integrated-as %s -###  -c \
-// RUN: 2>&1 | FileCheck -check-prefix=MABI-ILP32 %s
+// RUN: 2>&1 | FileCheck -check-prefix=MABI-ILP32D %s
 
 // RUN: %clang -target riscv32 -fno-integrated-as -march=rv32g %s -### -c \
-// RUN: 2>&1 | FileCheck -check-prefix=MABI-ILP32-MARCH-G %s
+// RUN: 2>&1 | FileCheck -check-prefix=MABI-ILP32D-MARCH-G %s
 
 // RUN: %clang -target riscv64 -fno-integrated-as %s -###  -c \
-// RUN: 2>&1 | FileCheck -check-prefix=MABI-ILP64 %s
+// RUN: 2>&1 | FileCheck -check-prefix=MABI-ILP64D %s
 
 // RUN: %clang -target riscv64 -fno-integrated-as -march=rv64g %s -### -c \
-// RUN: 2>&1 | FileCheck -check-prefix=MABI-ILP64-MARCH-G %s
+// RUN: 2>&1 | FileCheck -check-prefix=MABI-ILP64D-MARCH-G %s
 
-// MABI-ILP32: "{{.*}}as{{(.exe)?}}" "-mabi" "ilp32"
-// MABI-ILP32-MARCH-G: "{{.*}}as{{(.exe)?}}" "-mabi" "ilp32" "-march" "rv32g"
+// MABI-ILP32D: "{{.*}}as{{(.exe)?}}" "-mabi" "ilp32d" "-march" "rv32gc"
+// MABI-ILP32D-MARCH-G: "{{.*}}as{{(.exe)?}}" "-mabi" "ilp32d" "-march" "rv32g"
 
-// MABI-ILP64: "{{.*}}as{{(.exe)?}}" "-mabi" "lp64"
-// MABI-ILP64-MARCH-G: "{{.*}}as{{(.exe)?}}" "-mabi" "lp64" "-march" "rv64g"
+// MABI-ILP64D: "{{.*}}as{{(.exe)?}}" "-mabi" "lp64d"
+// MABI-ILP64D-MARCH-G: "{{.*}}as{{(.exe)?}}" "-mabi" "lp64d" "-march" "rv64g"
Index: clang/test/Driver/riscv-abi.c
===
--- clang/test/Driver/riscv-abi.c
+++ clang/test/Driver/riscv-abi.c
@@ -1,9 +1,5 @@
-// RUN: %clang -target riscv32-unknown-elf %s -### -o %t.o 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHECK-ILP32 %s
 // RUN: %clang -target riscv32-unknown-elf %s -### -o %t.o -mabi=ilp32 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK-ILP32 %s
-// RUN: %clang -target riscv32-unknown-elf -x assembler %s -### -o %t.o 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHECK-ILP32 %s
 // RUN: %clang -target riscv32-unknown-elf -x assembler %s -### -o %t.o \
 // RUN:   -mabi=ilp32 2>&1 | FileCheck -check-prefix=CHECK-ILP32 %s
 
@@ -14,6 +10,10 @@
 
 // CHECK-ILP32F: "-target-abi" "ilp32f"
 
+// RUN: %clang -target riscv32-unknown-elf %s -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-ILP32D %s
+// RUN: %clang -target riscv32-unknown-elf -x assembler %s -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-ILP32D %s
 // RUN: %clang -target riscv32-unknown-elf %s -### -o %t.o -march=rv32ifd -mabi=ilp32d 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK-ILP32D %s
 
@@ -24,12 +24,8 @@
 
 // CHECK-RV32-LP64: error: unknown target ABI 'lp64'
 
-// RUN: %clang -target riscv64-unknown-elf %s -### -o %t.o 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHECK-LP64 %s
 // RUN: %clang -target riscv64-unknown-elf %s -### -o %t.o -mabi=lp64 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK-LP64 %s
-// RUN: %clang -target riscv64-unknown-elf -x assembler %s -### -o %t.o 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHECK-LP64  %s
 // RUN: %clang -target riscv64-unknown-elf -

[PATCH] D69383: [RISCV] Match GCC `-march`/`-mabi` driver defaults

2019-10-24 Thread Sam Elliott via Phabricator via cfe-commits
lenary updated this revision to Diff 226252.
lenary added a comment.

- Correct code formatting issue


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69383/new/

https://reviews.llvm.org/D69383

Files:
  clang/lib/Driver/ToolChains/Arch/RISCV.cpp
  clang/lib/Driver/ToolChains/Arch/RISCV.h
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/test/Driver/riscv-abi.c
  clang/test/Driver/riscv-gnutools.c

Index: clang/test/Driver/riscv-gnutools.c
===
--- clang/test/Driver/riscv-gnutools.c
+++ clang/test/Driver/riscv-gnutools.c
@@ -1,19 +1,19 @@
 // Check gnutools are invoked with propagated values for -mabi and -march.
 
 // RUN: %clang -target riscv32 -fno-integrated-as %s -###  -c \
-// RUN: 2>&1 | FileCheck -check-prefix=MABI-ILP32 %s
+// RUN: 2>&1 | FileCheck -check-prefix=MABI-ILP32D %s
 
 // RUN: %clang -target riscv32 -fno-integrated-as -march=rv32g %s -### -c \
-// RUN: 2>&1 | FileCheck -check-prefix=MABI-ILP32-MARCH-G %s
+// RUN: 2>&1 | FileCheck -check-prefix=MABI-ILP32D-MARCH-G %s
 
 // RUN: %clang -target riscv64 -fno-integrated-as %s -###  -c \
-// RUN: 2>&1 | FileCheck -check-prefix=MABI-ILP64 %s
+// RUN: 2>&1 | FileCheck -check-prefix=MABI-ILP64D %s
 
 // RUN: %clang -target riscv64 -fno-integrated-as -march=rv64g %s -### -c \
-// RUN: 2>&1 | FileCheck -check-prefix=MABI-ILP64-MARCH-G %s
+// RUN: 2>&1 | FileCheck -check-prefix=MABI-ILP64D-MARCH-G %s
 
-// MABI-ILP32: "{{.*}}as{{(.exe)?}}" "-mabi" "ilp32"
-// MABI-ILP32-MARCH-G: "{{.*}}as{{(.exe)?}}" "-mabi" "ilp32" "-march" "rv32g"
+// MABI-ILP32D: "{{.*}}as{{(.exe)?}}" "-mabi" "ilp32d" "-march" "rv32gc"
+// MABI-ILP32D-MARCH-G: "{{.*}}as{{(.exe)?}}" "-mabi" "ilp32d" "-march" "rv32g"
 
-// MABI-ILP64: "{{.*}}as{{(.exe)?}}" "-mabi" "lp64"
-// MABI-ILP64-MARCH-G: "{{.*}}as{{(.exe)?}}" "-mabi" "lp64" "-march" "rv64g"
+// MABI-ILP64D: "{{.*}}as{{(.exe)?}}" "-mabi" "lp64d"
+// MABI-ILP64D-MARCH-G: "{{.*}}as{{(.exe)?}}" "-mabi" "lp64d" "-march" "rv64g"
Index: clang/test/Driver/riscv-abi.c
===
--- clang/test/Driver/riscv-abi.c
+++ clang/test/Driver/riscv-abi.c
@@ -1,9 +1,5 @@
-// RUN: %clang -target riscv32-unknown-elf %s -### -o %t.o 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHECK-ILP32 %s
 // RUN: %clang -target riscv32-unknown-elf %s -### -o %t.o -mabi=ilp32 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK-ILP32 %s
-// RUN: %clang -target riscv32-unknown-elf -x assembler %s -### -o %t.o 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHECK-ILP32 %s
 // RUN: %clang -target riscv32-unknown-elf -x assembler %s -### -o %t.o \
 // RUN:   -mabi=ilp32 2>&1 | FileCheck -check-prefix=CHECK-ILP32 %s
 
@@ -14,6 +10,10 @@
 
 // CHECK-ILP32F: "-target-abi" "ilp32f"
 
+// RUN: %clang -target riscv32-unknown-elf %s -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-ILP32D %s
+// RUN: %clang -target riscv32-unknown-elf -x assembler %s -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-ILP32D %s
 // RUN: %clang -target riscv32-unknown-elf %s -### -o %t.o -march=rv32ifd -mabi=ilp32d 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK-ILP32D %s
 
@@ -24,12 +24,8 @@
 
 // CHECK-RV32-LP64: error: unknown target ABI 'lp64'
 
-// RUN: %clang -target riscv64-unknown-elf %s -### -o %t.o 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHECK-LP64 %s
 // RUN: %clang -target riscv64-unknown-elf %s -### -o %t.o -mabi=lp64 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK-LP64 %s
-// RUN: %clang -target riscv64-unknown-elf -x assembler %s -### -o %t.o 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHECK-LP64  %s
 // RUN: %clang -target riscv64-unknown-elf -x assembler %s -### -o %t.o \
 // RUN:   -mabi=lp64 2>&1 | FileCheck -check-prefix=CHECK-LP64 %s
 
@@ -40,6 +36,10 @@
 
 // CHECK-LP64F: "-target-abi" "lp64f"
 
+// RUN: %clang -target riscv64-unknown-elf %s -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-LP64D %s
+// RUN: %clang -target riscv64-unknown-elf -x assembler %s -### -o %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-LP64D  %s
 // RUN: %clang -target riscv64-unknown-elf %s -### -o %t.o -march=rv64d -mabi=lp64d 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK-LP64D %s
 
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -709,11 +709,9 @@
 StringRef ABIName = riscv::getRISCVABI(Args, getToolChain().getTriple());
 CmdArgs.push_back("-mabi");
 CmdArgs.push_back(ABIName.data());
-if (const Arg *A = Args.getLastArg(options::OPT_march_EQ)) {
-  StringRef MArch = A->getValue();
-  CmdArgs.push_back("-march");
-  CmdArgs.push_back(MArch.data());
-}
+StringRef MArchName = riscv::getRISCVArch(Args, getToolChain().getTriple());
+CmdArgs.push_back("-march");
+CmdArgs.push_back(MArchName.data());

[PATCH] D69382: [clangd] Do not insert parentheses when completing a using declaration

2019-10-24 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

Build result: fail - 59611 tests passed, 1 failed and 763 were skipped.

  failed: 
libc++.libcxx/thread/thread_threads/thread_thread_this/sleep_for.pass.cpp

Log files: cmake-log.txt 
, 
ninja_check_all-log.txt 
, 
CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69382/new/

https://reviews.llvm.org/D69382



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69382: [clangd] Do not insert parentheses when completing a using declaration

2019-10-24 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

Build result: fail - 59587 tests passed, 1 failed and 805 were skipped.

  failed: LLVM.tools/llvm-ar/mri-utf8.test

Log files: cmake-log.txt 
, 
ninja_check_all-log.txt 
, 
CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69382/new/

https://reviews.llvm.org/D69382



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D66795: [Mips] Use appropriate private label prefix based on Mips ABI

2019-10-24 Thread Mirko Brkusanin via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4b63ca1379a8: [Mips] Use appropriate private label prefix 
based on Mips ABI (authored by mbrkusanin).

Changed prior to commit:
  https://reviews.llvm.org/D66795?vs=224603&id=226112#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66795/new/

https://reviews.llvm.org/D66795

Files:
  clang/lib/Parse/ParseStmtAsm.cpp
  clang/tools/driver/cc1as_main.cpp
  lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
  lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
  lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
  llvm/include/llvm/Support/TargetRegistry.h
  llvm/lib/CodeGen/LLVMTargetMachine.cpp
  llvm/lib/MC/MCDisassembler/Disassembler.cpp
  llvm/lib/Object/ModuleSymbolTable.cpp
  llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
  llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCAsmInfo.cpp
  llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCAsmInfo.h
  llvm/lib/Target/ARC/MCTargetDesc/ARCMCTargetDesc.cpp
  llvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp
  llvm/lib/Target/AVR/MCTargetDesc/AVRMCAsmInfo.cpp
  llvm/lib/Target/AVR/MCTargetDesc/AVRMCAsmInfo.h
  llvm/lib/Target/BPF/MCTargetDesc/BPFMCAsmInfo.h
  llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
  llvm/lib/Target/Lanai/MCTargetDesc/LanaiMCAsmInfo.cpp
  llvm/lib/Target/Lanai/MCTargetDesc/LanaiMCAsmInfo.h
  llvm/lib/Target/MSP430/MCTargetDesc/MSP430MCAsmInfo.cpp
  llvm/lib/Target/MSP430/MCTargetDesc/MSP430MCAsmInfo.h
  llvm/lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp
  llvm/lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.h
  llvm/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp
  llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp
  llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.h
  llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCTargetDesc.cpp
  llvm/lib/Target/Sparc/MCTargetDesc/SparcMCTargetDesc.cpp
  llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.cpp
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCAsmInfo.cpp
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCAsmInfo.h
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.cpp
  llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
  llvm/lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.cpp
  llvm/test/CodeGen/Mips/compactbranches/no-beqzc-bnezc.ll
  llvm/test/MC/Mips/macro-li.d.s
  llvm/test/MC/Mips/macro-li.s.s
  llvm/test/MC/Mips/private-prefix.s
  llvm/tools/dsymutil/DwarfStreamer.cpp
  llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp
  llvm/tools/llvm-dwp/llvm-dwp.cpp
  llvm/tools/llvm-exegesis/lib/Analysis.cpp
  llvm/tools/llvm-jitlink/llvm-jitlink.cpp
  llvm/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp
  llvm/tools/llvm-mc/Disassembler.cpp
  llvm/tools/llvm-mc/Disassembler.h
  llvm/tools/llvm-mc/llvm-mc.cpp
  llvm/tools/llvm-mca/llvm-mca.cpp
  llvm/tools/llvm-objdump/MachODump.cpp
  llvm/tools/llvm-objdump/llvm-objdump.cpp
  llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp
  llvm/tools/sancov/sancov.cpp
  llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
  llvm/unittests/ExecutionEngine/JITLink/JITLinkTestCommon.cpp
  llvm/unittests/MC/DwarfLineTables.cpp
  llvm/unittests/MC/MCInstPrinter.cpp

Index: llvm/unittests/MC/MCInstPrinter.cpp
===
--- llvm/unittests/MC/MCInstPrinter.cpp
+++ llvm/unittests/MC/MCInstPrinter.cpp
@@ -9,6 +9,7 @@
 #include "llvm/MC/MCInstPrinter.h"
 #include "llvm/MC/MCAsmInfo.h"
 #include "llvm/MC/MCInstrInfo.h"
+#include "llvm/MC/MCTargetOptions.h"
 #include "llvm/Support/TargetRegistry.h"
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Target/TargetMachine.h"
@@ -40,7 +41,8 @@
   return;
 
 MRI.reset(TheTarget->createMCRegInfo(TripleName));
-MAI.reset(TheTarget->createMCAsmInfo(*MRI, TripleName));
+MCTargetOptions MCOptions;
+MAI.reset(TheTarget->createMCAsmInfo(*MRI, TripleName, MCOptions));
 MII.reset(TheTarget->createMCInstrInfo());
 Printer.reset(TheTarget->createMCInstPrinter(
 Triple(TripleName), MAI->getAssemblerDialect(), *MAI, *MII, *MRI));
Index: llvm/unittests/MC/DwarfLineTables.cpp
===
--- llvm/unittests/MC/DwarfLineTables.cpp
+++ llvm/unittests/MC/DwarfLineTables.cpp
@@ -12,6 +12,7 @@
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCDwarf.h"
 #include "llvm/MC/MCRegisterInfo.h"
+#include "llvm/MC/MCTargetOptions.h"
 #include "llvm/Support/TargetRegistry.h"
 #include "llvm/Support/TargetSelect.h"
 #include "gtest/gtest.h"
@@ -37,7 +38,8 @@
   return;
 
 MRI.reset(TheTarget->createMCRegInfo(Triple));
-MAI.reset(TheTarget->createMCAsmInfo(*MRI, Triple));
+MCTargetOptions MCOptions;
+MAI.reset(TheTarget->createMCAsmInfo(*MRI, Triple, MCOptions));
 Ctx = std::make_unique(MAI.get

[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-24 Thread Jason Liu via Phabricator via cfe-commits
jasonliu accepted this revision.
jasonliu added a comment.
This revision is now accepted and ready to land.

Aside from the nit comment that can be addressed when checkin. 
LGTM.




Comment at: clang/lib/Driver/ToolChains/AIX.cpp:59
+
+  auto getCrt0Basename = [&IsArch32Bit, &Args] {
+// Enable gprofiling when "-pg" is specified.

nit: There is no need to capture IsArch32Bit by reference. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68340/new/

https://reviews.llvm.org/D68340



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D68720: Support -fstack-clash-protection for x86

2019-10-24 Thread Sylvestre Ledru via Phabricator via cfe-commits
sylvestre.ledru added inline comments.



Comment at: clang/docs/ClangCommandLineReference.rst:1901
+
+Instrument stack allocation to prevent stack clash attacks.
+

Maybe add that it is Linux only? :)



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68720/new/

https://reviews.llvm.org/D68720



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69378: [AArch64][SVE] Implement masked store intrinsics

2019-10-24 Thread Dave Green via Phabricator via cfe-commits
dmgreen accepted this revision.
dmgreen added a comment.
This revision is now accepted and ready to land.

Looks good to me. (Stores are easier than loads)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69378/new/

https://reviews.llvm.org/D69378



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D67159: [clang] New __attribute__((__clang_arm_mve_alias)).

2019-10-24 Thread Simon Tatham via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7c11da0cfd33: [clang] New 
__attribute__((__clang_arm_mve_alias)). (authored by simon_tatham).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67159/new/

https://reviews.llvm.org/D67159

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/AST/Decl.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/Misc/pragma-attribute-supported-attributes-list.test
  clang/test/Sema/arm-mve-alias-attribute.c

Index: clang/test/Sema/arm-mve-alias-attribute.c
===
--- /dev/null
+++ clang/test/Sema/arm-mve-alias-attribute.c
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -triple armv8.1m.main-arm-none-eabi -verify -fsyntax-only %s
+
+static __inline__ __attribute__((__clang_arm_mve_alias(__builtin_arm_nop))) // expected-error {{'__clang_arm_mve_alias' attribute can only be applied to an ARM MVE builtin}}
+void nop(void);
+
+static __inline__ __attribute__((__clang_arm_mve_alias)) // expected-error {{'__clang_arm_mve_alias' attribute takes one argument}}
+void noparens(void);
+
+static __inline__ __attribute__((__clang_arm_mve_alias())) // expected-error {{'__clang_arm_mve_alias' attribute takes one argument}}
+void emptyparens(void);
+
+static __inline__ __attribute__((__clang_arm_mve_alias("string literal"))) // expected-error {{'__clang_arm_mve_alias' attribute requires parameter 1 to be an identifier}}
+void stringliteral(void);
+
+static __inline__ __attribute__((__clang_arm_mve_alias(1))) // expected-error {{'__clang_arm_mve_alias' attribute requires parameter 1 to be an identifier}}
+void integer(void);
+
+static __inline__ __attribute__((__clang_arm_mve_alias(__builtin_arm_nop, 2))) // expected-error {{'__clang_arm_mve_alias' attribute takes one argument}}
+void twoargs(void);
+
+static __attribute__((__clang_arm_mve_alias(__builtin_arm_nop))) // expected-error {{'__clang_arm_mve_alias' attribute only applies to functions}}
+int variable;
Index: clang/test/Misc/pragma-attribute-supported-attributes-list.test
===
--- clang/test/Misc/pragma-attribute-supported-attributes-list.test
+++ clang/test/Misc/pragma-attribute-supported-attributes-list.test
@@ -17,6 +17,7 @@
 // CHECK-NEXT: Annotate ()
 // CHECK-NEXT: AnyX86NoCfCheck (SubjectMatchRule_hasType_functionType)
 // CHECK-NEXT: ArcWeakrefUnavailable (SubjectMatchRule_objc_interface)
+// CHECK-NEXT: ArmMveAlias (SubjectMatchRule_function)
 // CHECK-NEXT: AssumeAligned (SubjectMatchRule_objc_method, SubjectMatchRule_function)
 // CHECK-NEXT: Availability ((SubjectMatchRule_record, SubjectMatchRule_enum, SubjectMatchRule_enum_constant, SubjectMatchRule_field, SubjectMatchRule_function, SubjectMatchRule_namespace, SubjectMatchRule_objc_category, SubjectMatchRule_objc_implementation, SubjectMatchRule_objc_interface, SubjectMatchRule_objc_method, SubjectMatchRule_objc_property, SubjectMatchRule_objc_protocol, SubjectMatchRule_record, SubjectMatchRule_type_alias, SubjectMatchRule_variable))
 // CHECK-NEXT: CFAuditedTransfer (SubjectMatchRule_function)
Index: clang/lib/Sema/SemaDeclAttr.cpp
===
--- clang/lib/Sema/SemaDeclAttr.cpp
+++ clang/lib/Sema/SemaDeclAttr.cpp
@@ -23,6 +23,7 @@
 #include "clang/AST/RecursiveASTVisitor.h"
 #include "clang/Basic/CharInfo.h"
 #include "clang/Basic/SourceManager.h"
+#include "clang/Basic/TargetBuiltins.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Sema/DeclSpec.h"
@@ -4830,6 +4831,30 @@
  XRayLogArgsAttr(S.Context, AL, ArgCount.getSourceIndex()));
 }
 
+static bool ArmMveAliasValid(unsigned BuiltinID, StringRef AliasName) {
+  // FIXME: this will be filled in by Tablegen which isn't written yet
+  return false;
+}
+
+static void handleArmMveAliasAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
+  if (!AL.isArgIdent(0)) {
+S.Diag(AL.getLoc(), diag::err_attribute_argument_n_type)
+<< AL << 1 << AANT_ArgumentIdentifier;
+return;
+  }
+
+  IdentifierInfo *Ident = AL.getArgAsIdent(0)->Ident;
+  unsigned BuiltinID = Ident->getBuiltinID();
+
+  if (!ArmMveAliasValid(BuiltinID,
+cast(D)->getIdentifier()->getName())) {
+S.Diag(AL.getLoc(), diag::err_attribute_arm_mve_alias);
+return;
+  }
+
+  D->addAttr(::new (S.Context) ArmMveAliasAttr(S.Context, AL, Ident));
+}
+
 //===--===//
 // Checker-specific attribute handlers.
 //===--===//
@@ -7160,6 +7185,10 @@
   case ParsedAttr::AT_MSAllocator:
 handleMSAllocatorAttr(S, D, AL);
 break;
+
+  case ParsedAttr::AT_ArmMveAlias:
+handleArmMveAliasAttr

[PATCH] D69388: [clang-tidy] Fix modernize-use-nodiscard check for classes marked as [[nodiscard]]

2019-10-24 Thread Eugene Sedykh via Phabricator via cfe-commits
sedykh.eugene created this revision.
sedykh.eugene added reviewers: MyDeveloperDay, JonasToth.
sedykh.eugene added a project: clang-tools-extra.
Herald added subscribers: cfe-commits, mgehre, xazax.hun.
Herald added a project: clang.

Current implementation suggests to add [[nodiscard]] to methods even if the 
return type is marked already as [[nodiscard]]:

Try this:

struct [[nodiscard]] S{};

class C{

  S method() const; --> suggests adding [[nodiscard]]

};

This small diff fixes this incorrect behaviour.

This is my first timid try to contribute to open source, so please help me with 
this piece of code. Maybe there are better ways.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D69388

Files:
  clang-tidy/modernize/UseNodiscardCheck.cpp
  test/clang-tidy/checkers/modernize-use-nodiscard.cpp


Index: test/clang-tidy/checkers/modernize-use-nodiscard.cpp
===
--- test/clang-tidy/checkers/modernize-use-nodiscard.cpp
+++ test/clang-tidy/checkers/modernize-use-nodiscard.cpp
@@ -23,6 +23,8 @@
 typedef unsigned &my_unsigned_reference;
 typedef const unsigned &my_unsigned_const_reference;
 
+struct NO_DISCARD NoDiscardStruct{};
+
 class Foo {
 public:
 using size_type = unsigned;
@@ -160,6 +162,9 @@
 
 // Do not add ``[[nodiscard]]`` to conversion functions.
 // explicit operator bool() const { return true; }
+
+// Do not add ``[[nodiscard]]`` to functions returning types marked 
[[nodiscard]].
+NoDiscardStruct f50() const;
 };
 
 // Do not add ``[[nodiscard]]`` to Lambda.
Index: clang-tidy/modernize/UseNodiscardCheck.cpp
===
--- clang-tidy/modernize/UseNodiscardCheck.cpp
+++ clang-tidy/modernize/UseNodiscardCheck.cpp
@@ -94,16 +94,20 @@
   auto FunctionObj =
   cxxRecordDecl(hasAnyName("::std::function", "::boost::function"));
 
+  using clang::attr::WarnUnusedResult;
+
   // Find all non-void const methods which have not already been marked to
   // warn on unused result.
   Finder->addMatcher(
   cxxMethodDecl(
   allOf(isConst(), isDefinitionOrInline(),
 unless(anyOf(
-returns(voidType()), isNoReturn(), isOverloadedOperator(),
+returns(voidType()),
+returns(hasDeclaration(decl(hasAttr(WarnUnusedResult,
+isNoReturn(), isOverloadedOperator(),
 isVariadic(), hasTemplateReturnType(),
 hasClassMutableFields(), isConversionOperator(),
-hasAttr(clang::attr::WarnUnusedResult),
+hasAttr(WarnUnusedResult),
 hasType(isInstantiationDependentType()),
 hasAnyParameter(anyOf(
 parmVarDecl(anyOf(hasType(FunctionObj),


Index: test/clang-tidy/checkers/modernize-use-nodiscard.cpp
===
--- test/clang-tidy/checkers/modernize-use-nodiscard.cpp
+++ test/clang-tidy/checkers/modernize-use-nodiscard.cpp
@@ -23,6 +23,8 @@
 typedef unsigned &my_unsigned_reference;
 typedef const unsigned &my_unsigned_const_reference;
 
+struct NO_DISCARD NoDiscardStruct{};
+
 class Foo {
 public:
 using size_type = unsigned;
@@ -160,6 +162,9 @@
 
 // Do not add ``[[nodiscard]]`` to conversion functions.
 // explicit operator bool() const { return true; }
+
+// Do not add ``[[nodiscard]]`` to functions returning types marked [[nodiscard]].
+NoDiscardStruct f50() const;
 };
 
 // Do not add ``[[nodiscard]]`` to Lambda.
Index: clang-tidy/modernize/UseNodiscardCheck.cpp
===
--- clang-tidy/modernize/UseNodiscardCheck.cpp
+++ clang-tidy/modernize/UseNodiscardCheck.cpp
@@ -94,16 +94,20 @@
   auto FunctionObj =
   cxxRecordDecl(hasAnyName("::std::function", "::boost::function"));
 
+  using clang::attr::WarnUnusedResult;
+
   // Find all non-void const methods which have not already been marked to
   // warn on unused result.
   Finder->addMatcher(
   cxxMethodDecl(
   allOf(isConst(), isDefinitionOrInline(),
 unless(anyOf(
-returns(voidType()), isNoReturn(), isOverloadedOperator(),
+returns(voidType()),
+returns(hasDeclaration(decl(hasAttr(WarnUnusedResult,
+isNoReturn(), isOverloadedOperator(),
 isVariadic(), hasTemplateReturnType(),
 hasClassMutableFields(), isConversionOperator(),
-hasAttr(clang::attr::WarnUnusedResult),
+hasAttr(WarnUnusedResult),
 hasType(isInstantiationDependentType()),
 hasAnyParameter(anyOf(
 parmVarDecl(anyOf(hasType(FunctionObj),
___
cfe-commits mailing list
cfe-commit

[PATCH] D63607: [clang][driver] Add basic --driver-mode=flang support for fortran

2019-10-24 Thread Peter Waller via Phabricator via cfe-commits
peterwaller-arm updated this revision to Diff 226270.
peterwaller-arm added a comment.

I have rebased the patch for conflicts to master and all the tests are passing.

While doing so, I discovered that the test for flang-not-installed was not fit 
for purpose, because clang actually doesn't first check the PATH, it can find a 
flang binary which lives in the same directory as itself. I conclude that 
having such a test is more trouble than it is worth. Adding such a test would 
involve adding some questionable test-specific machinery. Therefore I've 
removed that test for now.

I'll leave the patch over the weekend in case anyone objects, otherwise I 
intend to submit early next week.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63607/new/

https://reviews.llvm.org/D63607

Files:
  clang/include/clang/Driver/Driver.h
  clang/include/clang/Driver/ToolChain.h
  clang/include/clang/Driver/Types.h
  clang/lib/Driver/CMakeLists.txt
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/Flang.cpp
  clang/lib/Driver/ToolChains/Flang.h
  clang/lib/Driver/Types.cpp
  clang/test/Driver/flang/Inputs/one.f90
  clang/test/Driver/flang/Inputs/other.c
  clang/test/Driver/flang/Inputs/two.f90
  clang/test/Driver/flang/flang.F90
  clang/test/Driver/flang/flang.f90
  clang/test/Driver/flang/multiple-inputs-mixed.f90
  clang/test/Driver/flang/multiple-inputs.f90
  clang/test/Driver/fortran.f95
  clang/test/Driver/lit.local.cfg

Index: clang/test/Driver/lit.local.cfg
===
--- clang/test/Driver/lit.local.cfg
+++ clang/test/Driver/lit.local.cfg
@@ -1,4 +1,4 @@
-config.suffixes = ['.c', '.cpp', '.h', '.m', '.mm', '.S', '.s', '.f90', '.f95',
+config.suffixes = ['.c', '.cpp', '.h', '.m', '.mm', '.S', '.s', '.f90', '.F90', '.f95',
'.cu', '.rs', '.cl', '.hip']
 config.substitutions = list(config.substitutions)
 config.substitutions.insert(0,
Index: clang/test/Driver/fortran.f95
===
--- clang/test/Driver/fortran.f95
+++ clang/test/Driver/fortran.f95
@@ -1,21 +1,22 @@
-// Check that the clang driver can invoke gcc to compile Fortran.
+! Check that the clang driver can invoke gcc to compile Fortran when in
+! --driver-mode=clang. This is legacy behaviour - see also --driver-mode=flang.
 
-// RUN: %clang -target x86_64-unknown-linux-gnu -integrated-as -c %s -### 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-OBJECT %s
-// CHECK-OBJECT: gcc
-// CHECK-OBJECT: "-c"
-// CHECK-OBJECT: "-x" "f95"
-// CHECK-OBJECT-NOT: cc1as
+! RUN: %clang -target x86_64-unknown-linux-gnu -integrated-as -c %s -### 2>&1 \
+! RUN:   | FileCheck --check-prefix=CHECK-OBJECT %s
+! CHECK-OBJECT: gcc
+! CHECK-OBJECT: "-c"
+! CHECK-OBJECT: "-x" "f95"
+! CHECK-OBJECT-NOT: cc1as
 
-// RUN: %clang -target x86_64-unknown-linux-gnu -integrated-as -S %s -### 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-ASM %s
-// CHECK-ASM: gcc
-// CHECK-ASM: "-S"
-// CHECK-ASM: "-x" "f95"
-// CHECK-ASM-NOT: cc1
+! RUN: %clang -target x86_64-unknown-linux-gnu -integrated-as -S %s -### 2>&1 \
+! RUN:   | FileCheck --check-prefix=CHECK-ASM %s
+! CHECK-ASM: gcc
+! CHECK-ASM: "-S"
+! CHECK-ASM: "-x" "f95"
+! CHECK-ASM-NOT: cc1
 
-// RUN: %clang -Wall -target x86_64-unknown-linux-gnu -integrated-as %s -o %t -### 2>&1 | FileCheck --check-prefix=CHECK-WARN %s
-// CHECK-WARN: gcc
-// CHECK-WARN-NOT: "-Wall"
-// CHECK-WARN: ld
-// CHECK-WARN-NOT: "-Wall"
+! RUN: %clang -Wall -target x86_64-unknown-linux-gnu -integrated-as %s -o %t -### 2>&1 | FileCheck --check-prefix=CHECK-WARN %s
+! CHECK-WARN: gcc
+! CHECK-WARN-NOT: "-Wall"
+! CHECK-WARN: ld
+! CHECK-WARN-NOT: "-Wall"
Index: clang/test/Driver/flang/multiple-inputs.f90
===
--- /dev/null
+++ clang/test/Driver/flang/multiple-inputs.f90
@@ -0,0 +1,7 @@
+! Check that flang driver can handle multiple inputs at once.
+
+! RUN: %clang --driver-mode=flang -### -fsyntax-only %S/Inputs/one.f90 %S/Inputs/two.f90 2>&1 | FileCheck --check-prefixes=CHECK-SYNTAX-ONLY %s
+! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang" "-fc1"
+! CHECK-SYNTAX-ONLY: "{{[^"]*}}/Inputs/one.f90"
+! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang" "-fc1"
+! CHECK-SYNTAX-ONLY: "{{[^"]*}}/Inputs/two.f90"
Index: clang/test/Driver/flang/multiple-inputs-mixed.f90
===
--- /dev/null
+++ clang/test/Driver/flang/multiple-inputs-mixed.f90
@@ -0,0 +1,7 @@
+! Check that flang can handle mixed C and fortran inputs.
+
+! RUN: %clang --driver-mode=flang -### -fsyntax-only %S/Inputs/one.f90 %S/Inputs/other.c 2>&1 | FileCheck --check-prefixes=CHECK-SYNTAX-ONLY %s
+! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang{{[^"/]*}}" "-fc1"
+! CHECK-SYNTAX-ONLY: "{{[^"]*}}/Inputs/one.f90"
+! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}clang{{[^"/]*}}" "-cc1"
+! CHECK-SYNTAX-ONLY: "{{[^"]*}}/Inputs/other.c"
Inde

[PATCH] D63607: [clang][driver] Add basic --driver-mode=flang support for fortran

2019-10-24 Thread Peter Waller via Phabricator via cfe-commits
peterwaller-arm marked 2 inline comments as done.
peterwaller-arm added inline comments.



Comment at: clang/test/Driver/flang/flang-not-installed.f90:11
+! shell syntax.
+! UNSUPPORTED: windows
+

hfinkel wrote:
> I believe that you can write:
> 
>   REQUIRES: shell
> 
> for this.
I've removed this test for now because I discovered that setting PATH="" is not 
enough to make clang lose the flang binary, if the flang binary is in the same 
directory as clang (which will be likely once flang is in-tree).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63607/new/

https://reviews.llvm.org/D63607



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69327: [Clang][ThinLTO] Add a cache for compile phase output.

2019-10-24 Thread Steven Wu via Phabricator via cfe-commits
steven_wu added a comment.

`ccache` does not have the support for this, I am just saying that this can be 
easily implemented in `ccache` and that would be much better than the proposed 
solution here.

If we need to add a clang driver flag so build system can better support to 
detect thin bitcode as output and caching them, we should just add the official 
driver flag.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69327/new/

https://reviews.llvm.org/D69327



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69389: [hip] Relax an allow the declaration of functions with variadic arguments in HIP.

2019-10-24 Thread Michael Liao via Phabricator via cfe-commits
hliao created this revision.
hliao added reviewers: jlebar, tra, yaxunl.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

- As variadic parameters have the lowest rank in overload resolution, without 
real usage of `va_arg`, they are commonly used as the catch-all fallbacks in 
SFINAE. As the front-end still reports errors on calls to `va_arg`, the 
declaration of functions with variadic arguments should be allowed in general.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69389

Files:
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/HIP.cpp
  clang/test/Driver/hip-toolchain-no-rdc.hip
  clang/test/Driver/hip-toolchain-rdc.hip

Index: clang/test/Driver/hip-toolchain-rdc.hip
===
--- clang/test/Driver/hip-toolchain-rdc.hip
+++ clang/test/Driver/hip-toolchain-rdc.hip
@@ -16,7 +16,7 @@
 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
 // CHECK-SAME: "-emit-llvm-bc"
 // CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx803"
-// CHECK-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fvisibility" "hidden"
+// CHECK-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
 // CHECK-SAME: "-fapply-global-visibility-to-externs"
 // CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
 // CHECK-SAME: {{.*}} "-o" [[A_BC:".*bc"]] "-x" "hip"
@@ -26,7 +26,7 @@
 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
 // CHECK-SAME: "-emit-llvm-bc"
 // CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx803"
-// CHECK-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fvisibility" "hidden"
+// CHECK-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
 // CHECK-SAME: "-fapply-global-visibility-to-externs"
 // CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
 // CHECK-SAME: {{.*}} "-o" [[B_BC:".*bc"]] "-x" "hip"
Index: clang/test/Driver/hip-toolchain-no-rdc.hip
===
--- clang/test/Driver/hip-toolchain-no-rdc.hip
+++ clang/test/Driver/hip-toolchain-no-rdc.hip
@@ -20,7 +20,7 @@
 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
 // CHECK-SAME: "-emit-llvm-bc"
 // CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx803"
-// CHECK-SAME: "-fcuda-is-device" "-fvisibility" "hidden"
+// CHECK-SAME: "-fcuda-is-device" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
 // CHECK-SAME: "-fapply-global-visibility-to-externs"
 // CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
 // CHECK-SAME: {{.*}} "-o" [[A_BC_803:".*bc"]] "-x" "hip"
@@ -48,7 +48,7 @@
 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
 // CHECK-SAME: "-emit-llvm-bc"
 // CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx900"
-// CHECK-SAME: "-fcuda-is-device" "-fvisibility" "hidden"
+// CHECK-SAME: "-fcuda-is-device" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
 // CHECK-SAME: "-fapply-global-visibility-to-externs"
 // CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
 // CHECK-SAME: {{.*}} "-o" [[A_BC_900:".*bc"]] "-x" "hip"
@@ -92,7 +92,7 @@
 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
 // CHECK-SAME: "-emit-llvm-bc"
 // CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx803"
-// CHECK-SAME: "-fcuda-is-device" "-fvisibility" "hidden"
+// CHECK-SAME: "-fcuda-is-device" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
 // CHECK-SAME: "-fapply-global-visibility-to-externs"
 // CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
 // CHECK-SAME: {{.*}} "-o" [[B_BC_803:".*bc"]] "-x" "hip"
@@ -120,7 +120,7 @@
 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
 // CHECK-SAME: "-emit-llvm-bc"
 // CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx900"
-// CHECK-SAME: "-fcuda-is-device" "-fvisibility" "hidden"
+// CHECK-SAME: "-fcuda-is-device" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
 // CHECK-SAME: "-fapply-global-visibility-to-externs"
 // CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
 // CHECK-SAME: {{.*}} "-o" [[B_BC_900:".*bc"]] "-x" "hip"
Index: clang/lib/Driver/ToolChains/HIP.cpp
===
--- clang/lib/Driver/ToolChains/HIP.cpp
+++ clang/lib/Driver/ToolChains/HIP.cpp
@@ -296,6 +296,8 @@
  options::OPT_fno_gpu_allow_device_init, false))
 CC1Args.push_back("-fgpu-allow-device-init");
 
+  CC1Args.push_back("-fcuda-allow-variadic-functions");
+
   // Default to "hidden" visibility, as object level linking will not be
   // supported for the foreseeable future.
   if (!DriverArgs.hasArg(options::OPT_fvisibility_EQ,
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -5331,6 +5331,9 @@
   CmdArgs.push_

[PATCH] D69391: Add #pragma clang loop ivdep

2019-10-24 Thread Yashas Andaluri via Phabricator via cfe-commits
YashasAndaluri created this revision.
YashasAndaluri added reviewers: hfinkel, Meinersbur, rscottmanley, DTharun.
YashasAndaluri created this object with edit policy "Administrators".
YashasAndaluri added a project: clang.
Herald added subscribers: cfe-commits, zzheng.
YashasAndaluri edited the summary of this revision.
YashasAndaluri edited the summary of this revision.
YashasAndaluri edited the summary of this revision.
YashasAndaluri edited the summary of this revision.
YashasAndaluri edited the summary of this revision.

This patch adds a `ivdep` pragma which uses the `IsParallel` loop hint 
attribute to indicate to the vectorizer that load and store instructions in the 
loop can be executed in parallel (belong to the same `llvm.access.group`) . 
This pragma will also imply `vectorize(enable)`.
Usage:

  #pragma clang loop ivdep(enable|disable)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69391

Files:
  clang/docs/LanguageExtensions.rst
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/DiagnosticParseKinds.td
  clang/lib/CodeGen/CGLoopInfo.cpp
  clang/lib/Parse/ParsePragma.cpp
  clang/lib/Sema/SemaStmtAttr.cpp
  clang/test/AST/ast-print-pragmas.cpp
  clang/test/CodeGenCXX/pragma-loop-ivdep.cpp
  clang/test/Parser/pragma-loop.cpp
  clang/test/Parser/pragma-unroll-and-jam.cpp

Index: clang/test/Parser/pragma-unroll-and-jam.cpp
===
--- clang/test/Parser/pragma-unroll-and-jam.cpp
+++ clang/test/Parser/pragma-unroll-and-jam.cpp
@@ -67,7 +67,7 @@
   }
 
 // pragma clang unroll_and_jam is disabled for the moment
-/* expected-error {{invalid option 'unroll_and_jam'; expected vectorize, vectorize_width, interleave, interleave_count, unroll, unroll_count, pipeline, pipeline_initiation_interval, vectorize_predicate, or distribute}} */ #pragma clang loop unroll_and_jam(4)
+/* expected-error {{invalid option 'unroll_and_jam'; expected vectorize, vectorize_width, interleave, interleave_count, unroll, unroll_count, pipeline, pipeline_initiation_interval, vectorize_predicate, ivdep, or distribute}} */ #pragma clang loop unroll_and_jam(4)
   for (int i = 0; i < Length; i++) {
 for (int j = 0; j < Length; j++) {
   List[i * Length + j] = Value;
Index: clang/test/Parser/pragma-loop.cpp
===
--- clang/test/Parser/pragma-loop.cpp
+++ clang/test/Parser/pragma-loop.cpp
@@ -82,6 +82,7 @@
 #pragma clang loop vectorize(enable)
 #pragma clang loop interleave(enable)
 #pragma clang loop vectorize_predicate(enable)
+#pragma clang loop ivdep(enable)
 #pragma clang loop unroll(full)
   while (i + 1 < Length) {
 List[i] = i;
@@ -97,6 +98,7 @@
 #pragma clang loop vectorize(disable)
 #pragma clang loop interleave(disable)
 #pragma clang loop vectorize_predicate(disable)
+#pragma clang loop ivdep(disable)
 #pragma clang loop unroll(disable)
   while (i - 1 < Length) {
 List[i] = i;
@@ -113,7 +115,7 @@
   }
 
   int VList[Length];
-#pragma clang loop vectorize(disable) interleave(disable) unroll(disable) vectorize_predicate(disable)
+#pragma clang loop vectorize(disable) interleave(disable) unroll(disable) vectorize_predicate(disable) ivdep(disable)
   for (int j : VList) {
 VList[j] = List[j];
   }
@@ -135,12 +137,14 @@
 /* expected-error {{expected '('}} */ #pragma clang loop vectorize_predicate
 /* expected-error {{expected '('}} */ #pragma clang loop unroll
 /* expected-error {{expected '('}} */ #pragma clang loop distribute
+/* expected-error {{expected '('}} */ #pragma clang loop ivdep
 
 /* expected-error {{expected ')'}} */ #pragma clang loop vectorize(enable
 /* expected-error {{expected ')'}} */ #pragma clang loop interleave(enable
 /* expected-error {{expected ')'}} */ #pragma clang loop vectorize_predicate(enable
 /* expected-error {{expected ')'}} */ #pragma clang loop unroll(full
 /* expected-error {{expected ')'}} */ #pragma clang loop distribute(enable
+/* expected-error {{expected ')'}} */ #pragma clang loop ivdep(enable
 
 /* expected-error {{expected ')'}} */ #pragma clang loop vectorize_width(4
 /* expected-error {{expected ')'}} */ #pragma clang loop interleave_count(4
@@ -151,7 +155,7 @@
 /* expected-error {{missing argument; expected 'enable', 'full' or 'disable'}} */ #pragma clang loop unroll()
 /* expected-error {{missing argument; expected 'enable' or 'disable'}} */ #pragma clang loop distribute()
 
-/* expected-error {{missing option; expected vectorize, vectorize_width, interleave, interleave_count, unroll, unroll_count, pipeline, pipeline_initiation_interval, vectorize_predicate, or distribute}} */ #pragma clang loop
+/* expected-error {{missing option; expected vectorize, vectorize_width, interleave, interleave_count, unroll, unroll_count, pipeline, pipeline_initiation_interval, vectorize_predicate, ivdep, or distribute}} */ #pragma clang loop
 /* expected-error {{invalid option 'badkeywo

[PATCH] D69383: [RISCV] Match GCC `-march`/`-mabi` driver defaults

2019-10-24 Thread Roger Ferrer Ibanez via Phabricator via cfe-commits
rogfer01 added inline comments.



Comment at: clang/lib/Driver/ToolChains/Arch/RISCV.cpp:475
+
+if (MArch.startswith_lower("rv32")) {
+  if (MArch.substr(4).contains_lower("d") ||

`llvm::StringSwitch` has a method `StartsWithLower` which might help make the 
logic a bit clearer

Something like this (I haven't tested it!)

```lang=cpp
StringRef ABIFromMarch = StringSwitch(MArch)
   .StartsWithLower("rv32d", "ilp32d")
   .StartsWithLower("rv32g", "ilp32d")
   .StartsWithLower("rv32e", "ilp32e")
   .StartsWithLower("rv32", "ilp32")

   .StartsWithLower("rv64d", "lp64d")
   .StartsWithLower("rv64g", "lp64d")
   .StartsWithLower("rv64", "lp64").

   .Default("");

if (!ABIFromMarch.empty()) return ABIFromMarch;
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69383/new/

https://reviews.llvm.org/D69383



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69382: [clangd] Do not insert parentheses when completing a using declaration

2019-10-24 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added inline comments.



Comment at: clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp:463
+  // Check all-scopes completions too.
+  Opts.AllScopes = true;
+  Results = completions(R"cpp(

I believe `AllScopes` and this feature is orthogonal what exactly is this part 
of the test checking for?



Comment at: clang/lib/Sema/SemaCodeComplete.cpp:5376
 
-  ResultBuilder Results(
-  *this, CodeCompleter->getAllocator(),
-  CodeCompleter->getCodeCompletionTUInfo(),
-  CodeCompletionContext(CodeCompletionContext::CCC_Symbol, PreferredType));
+  CodeCompletionContext CC(CodeCompletionContext::CCC_Symbol, PreferredType);
+  CC.setCXXScopeSpecifier(SS);

`CC` in here and above(in the `SS.isInvalid` case) seems to be the same, why 
not use only a single one?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69382/new/

https://reviews.llvm.org/D69382



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69393: [RFC][DebugInfo] emit user specified address_space in dwarf

2019-10-24 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song created this revision.
yonghong-song added reviewers: arsenm, aprantl, Anastasia, ast.
yonghong-song added a project: debug-info.
Herald added subscribers: cfe-commits, wdng.
Herald added a project: clang.

The RFC intends to kick off the discussion on how to support
user defined address_space attributes in dwarf.

The use case:
=

In linux kernel, under certain make flags, pointers may be
annotated with additional address_space information. The source
code is below:

  https://github.com/torvalds/linux/blob/master/include/linux/compiler_types.h

For example, we have

1. define __user   __attribute__((noderef, address_space(1)))
2. define __kernel __attribute__((address_space(0)))
3. define __iomem  __attribute__((noderef, address_space(2)))
4. define __percpu __attribute__((noderef, address_space(3)))
5. define __rcu__attribute__((noderef, address_space(4)))

Currently, the address_space annotation is not used when compiling
a normal (production) kernel. It is typically used during development
and used by 'sparse' tool to check proper pointer usage.

Now there is a growing need to put address_space info into debug info,
e.g., dwarf, in linux binary to help automatically differentiate
pointers accessing kernel and user memories in order to avoid
explicit user annotations like below:

  http://lkml.iu.edu/hypermail/linux/kernel/1905.1/05750.html

Other tracing tools like bpftrace, bcc would have similar issues.

The current patch
=

The proposal here is for user specified address_space, just add it
to DebugInfo and then later it will be automatically inserted into
dwarf. For example,

  -bash-4.4$ cat t.c
  #define __user __attribute__((noderef, address_space(3)))
  void __user *g;
  extern int __user *foo(int *a, int __user *b);
  int __user *foo(int *a, int __user *b) { return b; }
  -bash-4.4$ clang -O2 -g -c t.c
  -bash-4.4$ llvm-dwarfdump t.o
  ...
  0x002a:   DW_TAG_variable
DW_AT_name  ("g")
DW_AT_type  (0x0042 "*")
  0x0042:   DW_TAG_pointer_type
DW_AT_address_class (0x0003)
  0x0060: DW_TAG_formal_parameter
  DW_AT_name("a")
  DW_AT_type(0x0091 "int*")
  0x0071: DW_TAG_formal_parameter
  DW_AT_name("b")
  DW_AT_type(0x0081 "int*")
  0x0081:   DW_TAG_pointer_type
DW_AT_type  (0x008a "int")
DW_AT_address_class (0x0003)
  0x0091:   DW_TAG_pointer_type
DW_AT_type  (0x008a "int")
DW_AT_address_class (0x)

This patch mixed language address space and user defined address space
in the same debuginfo address_space and in the dwarf final encoding,
it is encoded as address_class which is more tailored into
language address_space.

Question:
=

This patch probably won't work as it mixed language address_space
and user address_space.

How we should proceed from here? Separate field in
IR DebugInfo and Dwarf for user defined address_space?


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69393

Files:
  clang/lib/Basic/Targets/BPF.h
  clang/lib/Basic/Targets/X86.h


Index: clang/lib/Basic/Targets/X86.h
===
--- clang/lib/Basic/Targets/X86.h
+++ clang/lib/Basic/Targets/X86.h
@@ -257,6 +257,11 @@
 setFeatureEnabledImpl(Features, Name, Enabled);
   }
 
+  Optional
+  getDWARFAddressSpace(unsigned AddressSpace) const override {
+return AddressSpace;
+  }
+
   // This exists purely to cut down on the number of virtual calls in
   // initFeatureMap which calls this repeatedly.
   static void setFeatureEnabledImpl(llvm::StringMap &Features,
Index: clang/lib/Basic/Targets/BPF.h
===
--- clang/lib/Basic/Targets/BPF.h
+++ clang/lib/Basic/Targets/BPF.h
@@ -58,6 +58,11 @@
 
   ArrayRef getTargetBuiltins() const override;
 
+  Optional
+  getDWARFAddressSpace(unsigned AddressSpace) const override {
+return AddressSpace;
+  }
+
   const char *getClobbers() const override { return ""; }
 
   BuiltinVaListKind getBuiltinVaListKind() const override {


Index: clang/lib/Basic/Targets/X86.h
===
--- clang/lib/Basic/Targets/X86.h
+++ clang/lib/Basic/Targets/X86.h
@@ -257,6 +257,11 @@
 setFeatureEnabledImpl(Features, Name, Enabled);
   }
 
+  Optional
+  getDWARFAddressSpace(unsigned AddressSpace) const override {
+return AddressSpace;
+  }
+
   // This exists purely to cut down on the number of virtual calls in
   // initFeatureMap which calls this repeatedly.
   static void setFeatureEnabledImpl(llvm::StringMap &Features,
Index: clang/lib/Basic/Targets/BPF.h
===
--- clang/li

[PATCH] D69383: [RISCV] Match GCC `-march`/`-mabi` driver defaults

2019-10-24 Thread Sam Elliott via Phabricator via cfe-commits
lenary marked an inline comment as done.
lenary added inline comments.



Comment at: clang/lib/Driver/ToolChains/Arch/RISCV.cpp:475
+
+if (MArch.startswith_lower("rv32")) {
+  if (MArch.substr(4).contains_lower("d") ||

rogfer01 wrote:
> `llvm::StringSwitch` has a method `StartsWithLower` which might help make the 
> logic a bit clearer
> 
> Something like this (I haven't tested it!)
> 
> ```lang=cpp
> StringRef ABIFromMarch = StringSwitch(MArch)
>.StartsWithLower("rv32d", "ilp32d")
>.StartsWithLower("rv32g", "ilp32d")
>.StartsWithLower("rv32e", "ilp32e")
>.StartsWithLower("rv32", "ilp32")
> 
>.StartsWithLower("rv64d", "lp64d")
>.StartsWithLower("rv64g", "lp64d")
>.StartsWithLower("rv64", "lp64").
> 
>.Default("");
> 
> if (!ABIFromMarch.empty()) return ABIFromMarch;
> ```
Sadly I don't think this will work, because of the case of matching `rv32*d*` 
and `rv64*d*` (the `March.substr(4).contains_lower("d")` cases) from 
config.gcc. Explicitly "d" does not come immediately after `rv<32/64>`, it can 
come anywhere after like in `rv32imafdc`.

The other issue I have with the StringSwitch is that it requires I have a 
default, which I feel makes the control flow harder to understand, rather than 
easier. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69383/new/

https://reviews.llvm.org/D69383



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D67161: [clang,ARM] Initial ACLE intrinsics for MVE.

2019-10-24 Thread Yi-Hong Lyu via Phabricator via cfe-commits
Yi-Hong.Lyu added a comment.

Seems this commit broke the build 
http://lab.llvm.org:8011/builders/ppc64le-lld-multistage-test/builds/6794/


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67161/new/

https://reviews.llvm.org/D67161



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69382: [clangd] Do not insert parentheses when completing a using declaration

2019-10-24 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov marked 3 inline comments as done.
ilya-biryukov added inline comments.



Comment at: clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp:463
+  // Check all-scopes completions too.
+  Opts.AllScopes = true;
+  Results = completions(R"cpp(

kadircet wrote:
> I believe `AllScopes` and this feature is orthogonal what exactly is this 
> part of the test checking for?
There are two different code paths in code completion that trigger here:
1. one coming from `ParseOptionalCXXScopeSpecifier`, this is checked with 
`using ns::^`
2. one coming from `ParseUsingDeclarator`, this is checked with `using ^`.

I haven't checked, but the second one shouldn't provide completions from the 
same namespace, it's a bit more reliable long-term to assume we only provide 
results from other scopes.
Although maybe I'm overthinking, our index is definitely not smart enough to 
filter out results from the current scope in that situation (at least now)



Comment at: clang/lib/Sema/SemaCodeComplete.cpp:5376
 
-  ResultBuilder Results(
-  *this, CodeCompleter->getAllocator(),
-  CodeCompleter->getCodeCompletionTUInfo(),
-  CodeCompletionContext(CodeCompletionContext::CCC_Symbol, PreferredType));
+  CodeCompletionContext CC(CodeCompletionContext::CCC_Symbol, PreferredType);
+  CC.setCXXScopeSpecifier(SS);

kadircet wrote:
> `CC` in here and above(in the `SS.isInvalid` case) seems to be the same, why 
> not use only a single one?
Good point, thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69382/new/

https://reviews.llvm.org/D69382



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69382: [clangd] Do not insert parentheses when completing a using declaration

2019-10-24 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 226293.
ilya-biryukov marked an inline comment as done.
ilya-biryukov added a comment.

- Use the same CodeCompletionContext


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69382/new/

https://reviews.llvm.org/D69382

Files:
  clang-tools-extra/clangd/CodeComplete.cpp
  clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/CodeCompleteConsumer.h
  clang/include/clang/Sema/Sema.h
  clang/lib/Parse/ParseDeclCXX.cpp
  clang/lib/Parse/ParseExprCXX.cpp
  clang/lib/Sema/SemaCodeComplete.cpp

Index: clang/lib/Sema/SemaCodeComplete.cpp
===
--- clang/lib/Sema/SemaCodeComplete.cpp
+++ clang/lib/Sema/SemaCodeComplete.cpp
@@ -5330,18 +5330,21 @@
 }
 
 void Sema::CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS,
-   bool EnteringContext, QualType BaseType,
+   bool EnteringContext,
+   bool IsUsingDeclaration, QualType BaseType,
QualType PreferredType) {
   if (SS.isEmpty() || !CodeCompleter)
 return;
 
+  CodeCompletionContext CC(CodeCompletionContext::CCC_Symbol, PreferredType);
+  CC.setIsUsingDeclaration(IsUsingDeclaration);
+  CC.setCXXScopeSpecifier(SS);
+
   // We want to keep the scope specifier even if it's invalid (e.g. the scope
   // "a::b::" is not corresponding to any context/namespace in the AST), since
   // it can be useful for global code completion which have information about
   // contexts/symbols that are not in the AST.
   if (SS.isInvalid()) {
-CodeCompletionContext CC(CodeCompletionContext::CCC_Symbol, PreferredType);
-CC.setCXXScopeSpecifier(SS);
 // As SS is invalid, we try to collect accessible contexts from the current
 // scope with a dummy lookup so that the completion consumer can try to
 // guess what the specified scope is.
@@ -5371,10 +5374,8 @@
   if (!isDependentScopeSpecifier(SS) && RequireCompleteDeclContext(SS, Ctx))
 return;
 
-  ResultBuilder Results(
-  *this, CodeCompleter->getAllocator(),
-  CodeCompleter->getCodeCompletionTUInfo(),
-  CodeCompletionContext(CodeCompletionContext::CCC_Symbol, PreferredType));
+  ResultBuilder Results(*this, CodeCompleter->getAllocator(),
+CodeCompleter->getCodeCompletionTUInfo(), CC);
   if (!PreferredType.isNull())
 Results.setPreferredType(PreferredType);
   Results.EnterNewScope();
@@ -5403,23 +5404,21 @@
CodeCompleter->loadExternal());
   }
 
-  auto CC = Results.getCompletionContext();
-  CC.setCXXScopeSpecifier(SS);
-
-  HandleCodeCompleteResults(this, CodeCompleter, CC, Results.data(),
-Results.size());
+  HandleCodeCompleteResults(this, CodeCompleter, Results.getCompletionContext(),
+Results.data(), Results.size());
 }
 
 void Sema::CodeCompleteUsing(Scope *S) {
   if (!CodeCompleter)
 return;
 
+  // This can be both a using alias or using declaration, in the former we
+  // expect a new name and a symbol in the latter case.
+  CodeCompletionContext Context(CodeCompletionContext::CCC_SymbolOrNewName);
+  Context.setIsUsingDeclaration(true);
+
   ResultBuilder Results(*this, CodeCompleter->getAllocator(),
-CodeCompleter->getCodeCompletionTUInfo(),
-// This can be both a using alias or using
-// declaration, in the former we expect a new name and a
-// symbol in the latter case.
-CodeCompletionContext::CCC_SymbolOrNewName,
+CodeCompleter->getCodeCompletionTUInfo(), Context,
 &ResultBuilder::IsNestedNameSpecifier);
   Results.EnterNewScope();
 
Index: clang/lib/Parse/ParseExprCXX.cpp
===
--- clang/lib/Parse/ParseExprCXX.cpp
+++ clang/lib/Parse/ParseExprCXX.cpp
@@ -143,13 +143,10 @@
 /// \param OnlyNamespace If true, only considers namespaces in lookup.
 ///
 /// \returns true if there was an error parsing a scope specifier
-bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS,
-ParsedType ObjectType,
-bool EnteringContext,
-bool *MayBePseudoDestructor,
-bool IsTypename,
-IdentifierInfo **LastII,
-bool OnlyNamespace) {
+bool Parser::ParseOptionalCXXScopeSpecifier(
+CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext,
+bool *MayBePseudoDestructor, bool IsTypename, IdentifierInfo **LastII,
+bool OnlyNamespace, bool InUsingDec

[PATCH] D69388: [clang-tidy] Fix modernize-use-nodiscard check for classes marked as [[nodiscard]]

2019-10-24 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

Thank you for the patch,  I wrote this checker originally and this LGTM.

I'm not sure if others have any objections to using "using 
clang::attr::WarnUnusedResult" in the body of the function, I couldn't see this 
pattern used elsewhere in clang-tidy, all I've seen is it being used in 
ClangTidyOptions.cpp globally.

I'd wait for some more feedback from the main owners, but thank you and welcome.


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69388/new/

https://reviews.llvm.org/D69388



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69389: [hip] Allow the declaration of functions with variadic arguments in HIP.

2019-10-24 Thread Michael Liao via Phabricator via cfe-commits
hliao updated this revision to Diff 226301.
hliao added a comment.

revise commit message


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69389/new/

https://reviews.llvm.org/D69389

Files:
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/HIP.cpp
  clang/test/Driver/hip-toolchain-no-rdc.hip
  clang/test/Driver/hip-toolchain-rdc.hip

Index: clang/test/Driver/hip-toolchain-rdc.hip
===
--- clang/test/Driver/hip-toolchain-rdc.hip
+++ clang/test/Driver/hip-toolchain-rdc.hip
@@ -16,7 +16,7 @@
 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
 // CHECK-SAME: "-emit-llvm-bc"
 // CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx803"
-// CHECK-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fvisibility" "hidden"
+// CHECK-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
 // CHECK-SAME: "-fapply-global-visibility-to-externs"
 // CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
 // CHECK-SAME: {{.*}} "-o" [[A_BC:".*bc"]] "-x" "hip"
@@ -26,7 +26,7 @@
 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
 // CHECK-SAME: "-emit-llvm-bc"
 // CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx803"
-// CHECK-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fvisibility" "hidden"
+// CHECK-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
 // CHECK-SAME: "-fapply-global-visibility-to-externs"
 // CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
 // CHECK-SAME: {{.*}} "-o" [[B_BC:".*bc"]] "-x" "hip"
Index: clang/test/Driver/hip-toolchain-no-rdc.hip
===
--- clang/test/Driver/hip-toolchain-no-rdc.hip
+++ clang/test/Driver/hip-toolchain-no-rdc.hip
@@ -20,7 +20,7 @@
 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
 // CHECK-SAME: "-emit-llvm-bc"
 // CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx803"
-// CHECK-SAME: "-fcuda-is-device" "-fvisibility" "hidden"
+// CHECK-SAME: "-fcuda-is-device" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
 // CHECK-SAME: "-fapply-global-visibility-to-externs"
 // CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
 // CHECK-SAME: {{.*}} "-o" [[A_BC_803:".*bc"]] "-x" "hip"
@@ -48,7 +48,7 @@
 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
 // CHECK-SAME: "-emit-llvm-bc"
 // CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx900"
-// CHECK-SAME: "-fcuda-is-device" "-fvisibility" "hidden"
+// CHECK-SAME: "-fcuda-is-device" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
 // CHECK-SAME: "-fapply-global-visibility-to-externs"
 // CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
 // CHECK-SAME: {{.*}} "-o" [[A_BC_900:".*bc"]] "-x" "hip"
@@ -92,7 +92,7 @@
 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
 // CHECK-SAME: "-emit-llvm-bc"
 // CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx803"
-// CHECK-SAME: "-fcuda-is-device" "-fvisibility" "hidden"
+// CHECK-SAME: "-fcuda-is-device" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
 // CHECK-SAME: "-fapply-global-visibility-to-externs"
 // CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
 // CHECK-SAME: {{.*}} "-o" [[B_BC_803:".*bc"]] "-x" "hip"
@@ -120,7 +120,7 @@
 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
 // CHECK-SAME: "-emit-llvm-bc"
 // CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx900"
-// CHECK-SAME: "-fcuda-is-device" "-fvisibility" "hidden"
+// CHECK-SAME: "-fcuda-is-device" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
 // CHECK-SAME: "-fapply-global-visibility-to-externs"
 // CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
 // CHECK-SAME: {{.*}} "-o" [[B_BC_900:".*bc"]] "-x" "hip"
Index: clang/lib/Driver/ToolChains/HIP.cpp
===
--- clang/lib/Driver/ToolChains/HIP.cpp
+++ clang/lib/Driver/ToolChains/HIP.cpp
@@ -296,6 +296,8 @@
  options::OPT_fno_gpu_allow_device_init, false))
 CC1Args.push_back("-fgpu-allow-device-init");
 
+  CC1Args.push_back("-fcuda-allow-variadic-functions");
+
   // Default to "hidden" visibility, as object level linking will not be
   // supported for the foreseeable future.
   if (!DriverArgs.hasArg(options::OPT_fvisibility_EQ,
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -5331,6 +5331,9 @@
   CmdArgs.push_back("-fcuda-short-ptr");
   }
 
+  if (IsHIP)
+CmdArgs.push_back("-fcuda-allow-variadic-functions");
+
   // OpenMP offloading device jobs take the argument -fopenmp-host-ir-file-path
   // to specify the result of the compile phase on the host, so the meaningful
   // device declarations can

[PATCH] D68835: [clang-scan-deps] Add basic support for Clang modules.

2019-10-24 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman accepted this revision.
arphaman added a comment.
This revision is now accepted and ready to land.

@Bigcheese I don't have time right now to do the build experiments, so I'll 
leave it as follow-up for me to resolve later. LGTM.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68835/new/

https://reviews.llvm.org/D68835



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69382: [clangd] Do not insert parentheses when completing a using declaration

2019-10-24 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

Build result: pass - 59630 tests passed, 0 failed and 763 were skipped.
Log files: cmake-log.txt 
, 
ninja_check_all-log.txt 
, 
CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69382/new/

https://reviews.llvm.org/D69382



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69383: [RISCV] Match GCC `-march`/`-mabi` driver defaults

2019-10-24 Thread Kuan Hsu Chen via Phabricator via cfe-commits
khchen added inline comments.
Herald added a subscriber: sameer.abuasal.



Comment at: clang/lib/Driver/ToolChains/Arch/RISCV.cpp:537
+  if (Triple.getArch() == llvm::Triple::riscv32)
+return "rv32gc";
   else

Why do you set rv32gc and rv64gc as default march? Is there a any reason?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69383/new/

https://reviews.llvm.org/D69383



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] ec66603 - [clang-format] Remove the dependency on frontend

2019-10-24 Thread via cfe-commits

Author: paulhoad
Date: 2019-10-24T19:03:57+01:00
New Revision: ec66603ac7ea655be5c2c5f508c5bf0d5eaeb65b

URL: 
https://github.com/llvm/llvm-project/commit/ec66603ac7ea655be5c2c5f508c5bf0d5eaeb65b
DIFF: 
https://github.com/llvm/llvm-project/commit/ec66603ac7ea655be5c2c5f508c5bf0d5eaeb65b.diff

LOG: [clang-format] Remove the dependency on frontend

Summary:
Address review comments from {D68554} by trying to drop the dependency again on 
Frontend whilst keeping the same format diagnostic messages

Not completely happy with having to do a split in order to get the StringRef 
for the Line the error occurred on, but could see a way to use SourceManager 
and SourceLocation to give me a single line?

But this removes the dependency on frontend which should keep the binary size 
down.

Reviewers: thakis, klimek, mitchell-stellar

Reviewed By: klimek

Subscribers: mgorny, cfe-commits

Tags: #clang, #clang-format

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

Added: 


Modified: 
clang/tools/clang-format/CMakeLists.txt
clang/tools/clang-format/ClangFormat.cpp

Removed: 




diff  --git a/clang/tools/clang-format/CMakeLists.txt 
b/clang/tools/clang-format/CMakeLists.txt
index 28ac4fb5913e..35ecdb11253c 100644
--- a/clang/tools/clang-format/CMakeLists.txt
+++ b/clang/tools/clang-format/CMakeLists.txt
@@ -7,7 +7,6 @@ add_clang_tool(clang-format
 set(CLANG_FORMAT_LIB_DEPS
   clangBasic
   clangFormat
-  clangFrontend
   clangRewrite
   clangToolingCore
   )

diff  --git a/clang/tools/clang-format/ClangFormat.cpp 
b/clang/tools/clang-format/ClangFormat.cpp
index f39c18bae3ff..a10541d88f07 100644
--- a/clang/tools/clang-format/ClangFormat.cpp
+++ b/clang/tools/clang-format/ClangFormat.cpp
@@ -18,7 +18,6 @@
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/Version.h"
 #include "clang/Format/Format.h"
-#include "clang/Frontend/TextDiagnosticPrinter.h"
 #include "clang/Rewrite/Core/Rewriter.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/FileSystem.h"
@@ -325,12 +324,9 @@ emitReplacementWarnings(const Replacements &Replaces, 
StringRef AssumedFileName,
   IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions();
   DiagOpts->ShowColors = (ShowColors && !NoShowColors);
 
-  TextDiagnosticPrinter *DiagsBuffer =
-  new TextDiagnosticPrinter(llvm::errs(), &*DiagOpts, false);
-
   IntrusiveRefCntPtr DiagID(new DiagnosticIDs());
   IntrusiveRefCntPtr Diags(
-  new DiagnosticsEngine(DiagID, &*DiagOpts, DiagsBuffer));
+  new DiagnosticsEngine(DiagID, &*DiagOpts));
 
   IntrusiveRefCntPtr InMemoryFileSystem(
   new llvm::vfs::InMemoryFileSystem);
@@ -339,24 +335,40 @@ emitReplacementWarnings(const Replacements &Replaces, 
StringRef AssumedFileName,
   FileID FileID = createInMemoryFile(AssumedFileName, Code.get(), Sources,
  Files, InMemoryFileSystem.get());
 
-  const unsigned ID = Diags->getCustomDiagID(
-  WarningsAsErrors ? clang::DiagnosticsEngine::Error
-   : clang::DiagnosticsEngine::Warning,
-  "code should be clang-formatted [-Wclang-format-violations]");
+  FileManager &FileMgr = Sources.getFileManager();
+  llvm::ErrorOr FileEntryPtr =
+  FileMgr.getFile(AssumedFileName);
 
   unsigned Errors = 0;
-  DiagsBuffer->BeginSourceFile(LangOptions(), nullptr);
   if (WarnFormat && !NoWarnFormat) {
 for (const auto &R : Replaces) {
-  Diags->Report(
-  Sources.getLocForStartOfFile(FileID).getLocWithOffset(R.getOffset()),
-  ID);
+  PresumedLoc PLoc = Sources.getPresumedLoc(
+  
Sources.getLocForStartOfFile(FileID).getLocWithOffset(R.getOffset()));
+
+  SourceLocation LineBegin =
+  Sources.translateFileLineCol(FileEntryPtr.get(), PLoc.getLine(), 1);
+  SourceLocation NextLineBegin = Sources.translateFileLineCol(
+  FileEntryPtr.get(), PLoc.getLine() + 1, 1);
+
+  const char *StartBuf = Sources.getCharacterData(LineBegin);
+  const char *EndBuf = Sources.getCharacterData(NextLineBegin);
+
+  StringRef Line(StartBuf, (EndBuf - StartBuf) - 1);
+
+  SMDiagnostic Diags(
+  llvm::SourceMgr(), SMLoc(), AssumedFileName, PLoc.getLine(),
+  PLoc.getColumn(),
+  WarningsAsErrors ? SourceMgr::DiagKind::DK_Error
+   : SourceMgr::DiagKind::DK_Warning,
+  "code should be clang-formatted [-Wclang-format-violations]", Line,
+  ArrayRef>());
+
+  Diags.print(nullptr, llvm::errs(), (ShowColors && !NoShowColors));
   Errors++;
   if (ErrorLimit && Errors >= ErrorLimit)
 break;
 }
   }
-  DiagsBuffer->EndSourceFile();
   return WarningsAsErrors;
 }
 



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D68969: [clang-format] Remove the dependency on frontend

2019-10-24 Thread MyDeveloperDay via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
MyDeveloperDay marked an inline comment as done.
Closed by commit rGec66603ac7ea: [clang-format] Remove the dependency on 
frontend (authored by MyDeveloperDay).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68969/new/

https://reviews.llvm.org/D68969

Files:
  clang/tools/clang-format/CMakeLists.txt
  clang/tools/clang-format/ClangFormat.cpp


Index: clang/tools/clang-format/ClangFormat.cpp
===
--- clang/tools/clang-format/ClangFormat.cpp
+++ clang/tools/clang-format/ClangFormat.cpp
@@ -18,7 +18,6 @@
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/Version.h"
 #include "clang/Format/Format.h"
-#include "clang/Frontend/TextDiagnosticPrinter.h"
 #include "clang/Rewrite/Core/Rewriter.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/FileSystem.h"
@@ -325,12 +324,9 @@
   IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions();
   DiagOpts->ShowColors = (ShowColors && !NoShowColors);
 
-  TextDiagnosticPrinter *DiagsBuffer =
-  new TextDiagnosticPrinter(llvm::errs(), &*DiagOpts, false);
-
   IntrusiveRefCntPtr DiagID(new DiagnosticIDs());
   IntrusiveRefCntPtr Diags(
-  new DiagnosticsEngine(DiagID, &*DiagOpts, DiagsBuffer));
+  new DiagnosticsEngine(DiagID, &*DiagOpts));
 
   IntrusiveRefCntPtr InMemoryFileSystem(
   new llvm::vfs::InMemoryFileSystem);
@@ -339,24 +335,40 @@
   FileID FileID = createInMemoryFile(AssumedFileName, Code.get(), Sources,
  Files, InMemoryFileSystem.get());
 
-  const unsigned ID = Diags->getCustomDiagID(
-  WarningsAsErrors ? clang::DiagnosticsEngine::Error
-   : clang::DiagnosticsEngine::Warning,
-  "code should be clang-formatted [-Wclang-format-violations]");
+  FileManager &FileMgr = Sources.getFileManager();
+  llvm::ErrorOr FileEntryPtr =
+  FileMgr.getFile(AssumedFileName);
 
   unsigned Errors = 0;
-  DiagsBuffer->BeginSourceFile(LangOptions(), nullptr);
   if (WarnFormat && !NoWarnFormat) {
 for (const auto &R : Replaces) {
-  Diags->Report(
-  Sources.getLocForStartOfFile(FileID).getLocWithOffset(R.getOffset()),
-  ID);
+  PresumedLoc PLoc = Sources.getPresumedLoc(
+  
Sources.getLocForStartOfFile(FileID).getLocWithOffset(R.getOffset()));
+
+  SourceLocation LineBegin =
+  Sources.translateFileLineCol(FileEntryPtr.get(), PLoc.getLine(), 1);
+  SourceLocation NextLineBegin = Sources.translateFileLineCol(
+  FileEntryPtr.get(), PLoc.getLine() + 1, 1);
+
+  const char *StartBuf = Sources.getCharacterData(LineBegin);
+  const char *EndBuf = Sources.getCharacterData(NextLineBegin);
+
+  StringRef Line(StartBuf, (EndBuf - StartBuf) - 1);
+
+  SMDiagnostic Diags(
+  llvm::SourceMgr(), SMLoc(), AssumedFileName, PLoc.getLine(),
+  PLoc.getColumn(),
+  WarningsAsErrors ? SourceMgr::DiagKind::DK_Error
+   : SourceMgr::DiagKind::DK_Warning,
+  "code should be clang-formatted [-Wclang-format-violations]", Line,
+  ArrayRef>());
+
+  Diags.print(nullptr, llvm::errs(), (ShowColors && !NoShowColors));
   Errors++;
   if (ErrorLimit && Errors >= ErrorLimit)
 break;
 }
   }
-  DiagsBuffer->EndSourceFile();
   return WarningsAsErrors;
 }
 
Index: clang/tools/clang-format/CMakeLists.txt
===
--- clang/tools/clang-format/CMakeLists.txt
+++ clang/tools/clang-format/CMakeLists.txt
@@ -7,7 +7,6 @@
 set(CLANG_FORMAT_LIB_DEPS
   clangBasic
   clangFormat
-  clangFrontend
   clangRewrite
   clangToolingCore
   )


Index: clang/tools/clang-format/ClangFormat.cpp
===
--- clang/tools/clang-format/ClangFormat.cpp
+++ clang/tools/clang-format/ClangFormat.cpp
@@ -18,7 +18,6 @@
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/Version.h"
 #include "clang/Format/Format.h"
-#include "clang/Frontend/TextDiagnosticPrinter.h"
 #include "clang/Rewrite/Core/Rewriter.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/FileSystem.h"
@@ -325,12 +324,9 @@
   IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions();
   DiagOpts->ShowColors = (ShowColors && !NoShowColors);
 
-  TextDiagnosticPrinter *DiagsBuffer =
-  new TextDiagnosticPrinter(llvm::errs(), &*DiagOpts, false);
-
   IntrusiveRefCntPtr DiagID(new DiagnosticIDs());
   IntrusiveRefCntPtr Diags(
-  new DiagnosticsEngine(DiagID, &*DiagOpts, DiagsBuffer));
+  new DiagnosticsEngine(DiagID, &*DiagOpts));
 
   IntrusiveRefCntPtr InMemoryFileSystem(
   new llvm::vfs::InMemoryFileSystem);
@@ -339,24 +335,40 @@
   FileID FileID = createInMemoryFile(AssumedFileName, Code.get(), Sources,
  Files, InMemoryFileSystem

[PATCH] D69383: [RISCV] Match GCC `-march`/`-mabi` driver defaults

2019-10-24 Thread Sam Elliott via Phabricator via cfe-commits
lenary marked an inline comment as done.
lenary added inline comments.



Comment at: clang/lib/Driver/ToolChains/Arch/RISCV.cpp:537
+  if (Triple.getArch() == llvm::Triple::riscv32)
+return "rv32gc";
   else

khchen wrote:
> Why do you set rv32gc and rv64gc as default march? Is there a any reason?
This reflects the logic in [[ 
https://github.com/riscv/riscv-gcc/blob/riscv-gcc-9.2.0/gcc/config.gcc#L4229-L4369
 | `config.gcc` ]]. Note line 4273, which applies if neither arch nor abi is 
given (the xlen is set on line 4233-4234 based on the target triple).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69383/new/

https://reviews.llvm.org/D69383



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-24 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 226304.
stevewan added a comment.

Capture local variable IsArch32Bit by value.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68340/new/

https://reviews.llvm.org/D68340

Files:
  clang/lib/Driver/CMakeLists.txt
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/AIX.h
  clang/test/Driver/Inputs/aix_ppc_tree/powerpc-ibm-aix7.1.0.0/dummy.a
  clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/crt0.o
  clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/crt0_64.o
  clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/crti.o
  clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/crti_64.o
  clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/gcrt0.o
  clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/gcrt0_64.o
  clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/mcrt0.o
  clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/mcrt0_64.o
  clang/test/Driver/aix-ld.c

Index: clang/test/Driver/aix-ld.c
===
--- /dev/null
+++ clang/test/Driver/aix-ld.c
@@ -0,0 +1,177 @@
+// General tests that ld invocations on AIX targets are sane. Note that we use
+// sysroot to make these tests independent of the host system.
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32 %s
+// CHECK-LD32-NOT: warning:
+// CHECK-LD32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-NOT: "-bnso"
+// CHECK-LD32: "-b32" 
+// CHECK-LD32: "-bpT:0x1000" "-bpD:0x2000" 
+// CHECK-LD32: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32: "-L[[SYSROOT]]/usr/lib" 
+// CHECK-LD32: "-lc"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD64 %s
+// CHECK-LD64-NOT: warning:
+// CHECK-LD64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD64-NOT: "-bnso"
+// CHECK-LD64: "-b64" 
+// CHECK-LD64: "-bpT:0x1" "-bpD:0x11000" 
+// CHECK-LD64: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64: "-L[[SYSROOT]]/usr/lib" 
+// CHECK-LD64: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -pthread \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-PTHREAD %s
+// CHECK-LD32-PTHREAD-NOT: warning:
+// CHECK-LD32-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-PTHREAD: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-PTHREAD-NOT: "-bnso"
+// CHECK-LD32-PTHREAD: "-b32" 
+// CHECK-LD32-PTHREAD: "-bpT:0x1000" "-bpD:0x2000" 
+// CHECK-LD32-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-PTHREAD: "-lpthreads"
+// CHECK-LD32-PTHREAD: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -pthreads \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD64-PTHREAD %s
+// CHECK-LD64-PTHREAD-NOT: warning:
+// CHECK-LD64-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64-PTHREAD: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD64-PTHREAD-NOT: "-bnso"
+// CHECK-LD64-PTHREAD: "-b64" 
+// CHECK-LD64-PTHREAD: "-bpT:0x1" "-bpD:0x11000" 
+// CHECK-LD64-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-PTHREAD: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD64-PTHREAD: "-lpthreads"
+// CHECK-LD64-PTHREAD: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable profiling.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -p \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-PROF %s
+// CHECK-LD32-PROF-NOT: warning:
+// CHECK-LD32-PROF: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-PROF: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-PROF: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-PROF-NOT: "-bnso"
+// CHECK-LD32-PROF: "-b32" 
+// CHECK-LD32-PROF: "-bpT:0x1000" "-bpD:0x200

[PATCH] D69122: Add support to find out resource dir and add it as compilation args

2019-10-24 Thread Michael Spencer via Phabricator via cfe-commits
Bigcheese added a reviewer: klimek.
Bigcheese added a comment.

I've added Manuel as a reviewer as this patch is also changing the tooling APIs.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69122/new/

https://reviews.llvm.org/D69122



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D67508: [RISCV] support mutilib in baremetal environment

2019-10-24 Thread Kuan Hsu Chen via Phabricator via cfe-commits
khchen added a comment.
Herald added a subscriber: sameer.abuasal.

@lenary  
You patch is very useful to look up the default march, thanks!
But there is some issue if we set the default rv32 march as `rv32gc`. 
Because the default multilib does not include `rv32gc`/`lp32d` in riscv gnu 
toolchain, 
https://github.com/riscv/riscv-gcc/blob/ed3f6ec/gcc/config/riscv/t-elf-multilib#L19
so if user does not give the default march clang will not find the library and 
cause linking error.
Do you think this is a clang's problem? or maybe this is just user's problem so 
they should config multilib to support `rv32gc/lip3d2d`?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67508/new/

https://reviews.llvm.org/D67508



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-24 Thread Steven Wan via Phabricator via cfe-commits
stevewan marked 2 inline comments as done.
stevewan added inline comments.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:59
+
+  auto getCrt0Basename = [&IsArch32Bit, &Args] {
+// Enable gprofiling when "-pg" is specified.

jasonliu wrote:
> nit: There is no need to capture IsArch32Bit by reference. 
Agreed. It's safer to capture IsArch32Bit by value here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68340/new/

https://reviews.llvm.org/D68340



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D67161: [clang,ARM] Initial ACLE intrinsics for MVE.

2019-10-24 Thread Dave Green via Phabricator via cfe-commits
dmgreen added a comment.

Hmm.. Let me take a look. There's a different error on the same build now, but 
I think it's just hiding this one.

I'll also try and fix the tests that are failing in places too, if I can.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67161/new/

https://reviews.llvm.org/D67161



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 7b3de1e - [ARM] Attempt to fixup MveEmitter warnings

2019-10-24 Thread David Green via cfe-commits

Author: David Green
Date: 2019-10-24T19:43:15+01:00
New Revision: 7b3de1e811972b874d91554642ccb2ef5b32eed6

URL: 
https://github.com/llvm/llvm-project/commit/7b3de1e811972b874d91554642ccb2ef5b32eed6
DIFF: 
https://github.com/llvm/llvm-project/commit/7b3de1e811972b874d91554642ccb2ef5b32eed6.diff

LOG: [ARM] Attempt to fixup MveEmitter warnings

Change-Id: I3fb06de2202c3b7a9ce511a40e758d0971ef9fdb

Added: 


Modified: 
clang/utils/TableGen/MveEmitter.cpp

Removed: 




diff  --git a/clang/utils/TableGen/MveEmitter.cpp 
b/clang/utils/TableGen/MveEmitter.cpp
index 6fac472a7a19..c4270ff586cf 100644
--- a/clang/utils/TableGen/MveEmitter.cpp
+++ b/clang/utils/TableGen/MveEmitter.cpp
@@ -157,8 +157,6 @@ inline std::string toLetter(ScalarTypeKind kind) {
 return "u";
   case ScalarTypeKind::Float:
 return "f";
-  default:
-llvm_unreachable("bad scalar type kind");
   }
 }
 inline std::string toCPrefix(ScalarTypeKind kind) {
@@ -169,8 +167,6 @@ inline std::string toCPrefix(ScalarTypeKind kind) {
 return "uint";
   case ScalarTypeKind::Float:
 return "float";
-  default:
-llvm_unreachable("bad scalar type kind");
   }
 }
 
@@ -538,7 +534,7 @@ class BuiltinArgResult : public Result {
 OS << (AddressType ? "EmitPointerWithAlignment" : "EmitScalarExpr")
<< "(E->getArg(" << ArgNum << "))";
   }
-  virtual std::string typeName() const {
+  std::string typeName() const override {
 return AddressType ? "Address" : Result::typeName();
   }
 };



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] bb6a27f - Add AIX toolchain and basic linker functionality

2019-10-24 Thread David Tenty via cfe-commits

Author: stevewan
Date: 2019-10-24T14:47:57-04:00
New Revision: bb6a27fc257faac1339e79c20ae807db70a31ebd

URL: 
https://github.com/llvm/llvm-project/commit/bb6a27fc257faac1339e79c20ae807db70a31ebd
DIFF: 
https://github.com/llvm/llvm-project/commit/bb6a27fc257faac1339e79c20ae807db70a31ebd.diff

LOG: Add AIX toolchain and basic linker functionality

Summary:
This patch adds AIX toolchain infrastructure into driver, and enables AIX
system linker invocation with some basic functionality support

Reviewers: daltenty, hubert.reinterpretcast, jasonliu, Xiangling_L

Reviewed By: jasonliu

Subscribers: Xiangling_L, jasonliu, ormris, wuzish, nemanjai, mgorny, kbarton, 
jfb, jsji, cfe-commits

Tags: #clang

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

Added: 
clang/lib/Driver/ToolChains/AIX.cpp
clang/lib/Driver/ToolChains/AIX.h
clang/test/Driver/Inputs/aix_ppc_tree/powerpc-ibm-aix7.1.0.0/dummy.a
clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/crt0.o
clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/crt0_64.o
clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/crti.o
clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/crti_64.o
clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/gcrt0.o
clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/gcrt0_64.o
clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/mcrt0.o
clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/mcrt0_64.o
clang/test/Driver/aix-ld.c

Modified: 
clang/lib/Driver/CMakeLists.txt
clang/lib/Driver/Driver.cpp

Removed: 




diff  --git a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt
index 64b5d70f42b6..84fd58cf6819 100644
--- a/clang/lib/Driver/CMakeLists.txt
+++ b/clang/lib/Driver/CMakeLists.txt
@@ -30,6 +30,7 @@ add_clang_library(clangDriver
   ToolChains/Arch/Sparc.cpp
   ToolChains/Arch/SystemZ.cpp
   ToolChains/Arch/X86.cpp
+  ToolChains/AIX.cpp
   ToolChains/Ananas.cpp
   ToolChains/AMDGPU.cpp
   ToolChains/AVR.cpp

diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index f6016b43b692..4c59bf0a5e20 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -8,6 +8,7 @@
 
 #include "clang/Driver/Driver.h"
 #include "InputInfo.h"
+#include "ToolChains/AIX.h"
 #include "ToolChains/AMDGPU.h"
 #include "ToolChains/AVR.h"
 #include "ToolChains/Ananas.h"
@@ -4699,6 +4700,9 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
   auto &TC = ToolChains[Target.str()];
   if (!TC) {
 switch (Target.getOS()) {
+case llvm::Triple::AIX:
+  TC = std::make_unique(*this, Target, Args);
+  break;
 case llvm::Triple::Haiku:
   TC = std::make_unique(*this, Target, Args);
   break;

diff  --git a/clang/lib/Driver/ToolChains/AIX.cpp 
b/clang/lib/Driver/ToolChains/AIX.cpp
new file mode 100644
index ..369a5fc17c91
--- /dev/null
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -0,0 +1,101 @@
+//===--- AIX.cpp - AIX ToolChain Implementations *- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "AIX.h"
+#include "Arch/PPC.h"
+#include "CommonArgs.h"
+#include "clang/Driver/Compilation.h"
+#include "clang/Driver/Options.h"
+#include "clang/Driver/SanitizerArgs.h"
+#include "llvm/Option/ArgList.h"
+
+namespace aix = clang::driver::tools::aix;
+using AIX = clang::driver::toolchains::AIX;
+
+using namespace llvm::opt;
+
+void aix::Linker::ConstructJob(Compilation &C, const JobAction &JA,
+   const InputInfo &Output,
+   const InputInfoList &Inputs, const ArgList 
&Args,
+   const char *LinkingOutput) const {
+  const AIX &ToolChain = static_cast(getToolChain());
+  ArgStringList CmdArgs;
+
+  const bool IsArch32Bit = ToolChain.getTriple().isArch32Bit();
+  const bool IsArch64Bit = ToolChain.getTriple().isArch64Bit();
+  // Only support 32 and 64 bit.
+  if (!(IsArch32Bit || IsArch64Bit))
+llvm_unreachable("Unsupported bit width value.");
+
+  // Force static linking when "-static" is present.
+  if (Args.hasArg(options::OPT_static))
+CmdArgs.push_back("-bnso");
+
+  // Specify linker output file.
+  assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");
+  if (Output.isFilename()) {
+CmdArgs.push_back("-o");
+CmdArgs.push_back(Output.getFilename());
+  } 
+
+  // Set linking mode (i.e., 32/64-bit) and the address of
+  // text and data sections based on arch bit width.
+  if (IsArch32Bit) {
+CmdArgs.push_back("-b32");
+CmdArgs.push_back("-bpT:0x1000");
+CmdArgs.push_back("-bpD:0x2000");
+  } else {
+// Must be 64-bit, otherwise asserted already.
+CmdA

[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-24 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbb6a27fc257f: Add AIX toolchain and basic linker 
functionality (authored by stevewan, committed by daltenty).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68340/new/

https://reviews.llvm.org/D68340

Files:
  clang/lib/Driver/CMakeLists.txt
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/AIX.h
  clang/test/Driver/Inputs/aix_ppc_tree/powerpc-ibm-aix7.1.0.0/dummy.a
  clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/crt0.o
  clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/crt0_64.o
  clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/crti.o
  clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/crti_64.o
  clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/gcrt0.o
  clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/gcrt0_64.o
  clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/mcrt0.o
  clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/mcrt0_64.o
  clang/test/Driver/aix-ld.c

Index: clang/test/Driver/aix-ld.c
===
--- /dev/null
+++ clang/test/Driver/aix-ld.c
@@ -0,0 +1,177 @@
+// General tests that ld invocations on AIX targets are sane. Note that we use
+// sysroot to make these tests independent of the host system.
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32 %s
+// CHECK-LD32-NOT: warning:
+// CHECK-LD32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-NOT: "-bnso"
+// CHECK-LD32: "-b32" 
+// CHECK-LD32: "-bpT:0x1000" "-bpD:0x2000" 
+// CHECK-LD32: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32: "-L[[SYSROOT]]/usr/lib" 
+// CHECK-LD32: "-lc"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD64 %s
+// CHECK-LD64-NOT: warning:
+// CHECK-LD64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD64-NOT: "-bnso"
+// CHECK-LD64: "-b64" 
+// CHECK-LD64: "-bpT:0x1" "-bpD:0x11000" 
+// CHECK-LD64: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64: "-L[[SYSROOT]]/usr/lib" 
+// CHECK-LD64: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -pthread \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-PTHREAD %s
+// CHECK-LD32-PTHREAD-NOT: warning:
+// CHECK-LD32-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-PTHREAD: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-PTHREAD-NOT: "-bnso"
+// CHECK-LD32-PTHREAD: "-b32" 
+// CHECK-LD32-PTHREAD: "-bpT:0x1000" "-bpD:0x2000" 
+// CHECK-LD32-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-PTHREAD: "-lpthreads"
+// CHECK-LD32-PTHREAD: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -pthreads \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD64-PTHREAD %s
+// CHECK-LD64-PTHREAD-NOT: warning:
+// CHECK-LD64-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64-PTHREAD: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD64-PTHREAD-NOT: "-bnso"
+// CHECK-LD64-PTHREAD: "-b64" 
+// CHECK-LD64-PTHREAD: "-bpT:0x1" "-bpD:0x11000" 
+// CHECK-LD64-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-PTHREAD: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD64-PTHREAD: "-lpthreads"
+// CHECK-LD64-PTHREAD: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable profiling.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -p \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-PROF %s
+// CHECK-LD32-PROF-NOT: warning:
+// CHECK-LD32-PROF: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-PROF: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-PROF: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-PROF-NOT: "-b

[PATCH] D69145: Give readability-redundant-member-init an option IgnoreBaseInCopyConstructors to avoid breaking code with gcc -Werror=extra

2019-10-24 Thread Conrad Poelman via Phabricator via cfe-commits
poelmanc added a comment.

What do @malcolm.parsons, @alexfh, @hokein, @aaron.ballman, @lebedev.ri think 
of @mgehre's suggestion to enable `IgnoreBaseInCopyConstructors` as the default 
setting, so gcc users won't experience build errors and think "clang-tidy broke 
my code!"

I could go either way and appreciate any input.


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69145/new/

https://reviews.llvm.org/D69145



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 78700ef - [ARM] Fixup MVE intrinsic tests with no assert builds

2019-10-24 Thread David Green via cfe-commits

Author: David Green
Date: 2019-10-24T19:59:15+01:00
New Revision: 78700ef8866db7f5cea113fa81d810a28b5b7438

URL: 
https://github.com/llvm/llvm-project/commit/78700ef8866db7f5cea113fa81d810a28b5b7438
DIFF: 
https://github.com/llvm/llvm-project/commit/78700ef8866db7f5cea113fa81d810a28b5b7438.diff

LOG: [ARM] Fixup MVE intrinsic tests with no assert builds

The labels will be missing, so -fno-discard-value-names is added to the tests.

Added: 


Modified: 
clang/test/CodeGen/arm-mve-intrinsics/scalar-shifts.c
clang/test/CodeGen/arm-mve-intrinsics/vadc.c
clang/test/CodeGen/arm-mve-intrinsics/vaddq.c
clang/test/CodeGen/arm-mve-intrinsics/vcvt.c
clang/test/CodeGen/arm-mve-intrinsics/vld24.c
clang/test/CodeGen/arm-mve-intrinsics/vldr.c
clang/test/CodeGen/arm-mve-intrinsics/vminvq.c

Removed: 




diff  --git a/clang/test/CodeGen/arm-mve-intrinsics/scalar-shifts.c 
b/clang/test/CodeGen/arm-mve-intrinsics/scalar-shifts.c
index d7c4d5e85ae4..ec9a47f18eb9 100644
--- a/clang/test/CodeGen/arm-mve-intrinsics/scalar-shifts.c
+++ b/clang/test/CodeGen/arm-mve-intrinsics/scalar-shifts.c
@@ -1,5 +1,5 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
-// RUN: %clang --target=arm-arm-none-eabi -march=armv8.1m.main+mve.fp 
-mfloat-abi=hard -O0 -Xclang -disable-O0-optnone -S -emit-llvm -o - %s | opt -S 
-mem2reg | FileCheck %s
+// RUN: %clang --target=arm-arm-none-eabi -march=armv8.1m.main+mve.fp 
-mfloat-abi=hard -O0 -Xclang -disable-O0-optnone -fno-discard-value-names -S 
-emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s
 
 #include 
 

diff  --git a/clang/test/CodeGen/arm-mve-intrinsics/vadc.c 
b/clang/test/CodeGen/arm-mve-intrinsics/vadc.c
index bd6bdc53d08d..6b77eac9ca54 100644
--- a/clang/test/CodeGen/arm-mve-intrinsics/vadc.c
+++ b/clang/test/CodeGen/arm-mve-intrinsics/vadc.c
@@ -1,6 +1,6 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
-// RUN: %clang --target=arm-arm-none-eabi -march=armv8.1m.main+mve.fp 
-mfloat-abi=hard -O0 -Xclang -disable-O0-optnone -S -emit-llvm -o - %s | opt -S 
-mem2reg | FileCheck %s
-// RUN: %clang --target=arm-arm-none-eabi -march=armv8.1m.main+mve.fp 
-mfloat-abi=hard -DPOLYMORPHIC -O0 -Xclang -disable-O0-optnone -S -emit-llvm -o 
- %s | opt -S -mem2reg | FileCheck %s
+// RUN: %clang --target=arm-arm-none-eabi -march=armv8.1m.main+mve.fp 
-mfloat-abi=hard -O0 -Xclang -disable-O0-optnone -fno-discard-value-names -S 
-emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s
+// RUN: %clang --target=arm-arm-none-eabi -march=armv8.1m.main+mve.fp 
-mfloat-abi=hard -DPOLYMORPHIC -O0 -Xclang -disable-O0-optnone 
-fno-discard-value-names -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s
 
 #include 
 

diff  --git a/clang/test/CodeGen/arm-mve-intrinsics/vaddq.c 
b/clang/test/CodeGen/arm-mve-intrinsics/vaddq.c
index 30923ee1a2b2..970ac53cefc6 100644
--- a/clang/test/CodeGen/arm-mve-intrinsics/vaddq.c
+++ b/clang/test/CodeGen/arm-mve-intrinsics/vaddq.c
@@ -1,6 +1,6 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
-// RUN: %clang --target=arm-arm-none-eabi -march=armv8.1m.main+mve.fp 
-mfloat-abi=hard -O0 -Xclang -disable-O0-optnone -S -emit-llvm -o - %s | opt -S 
-mem2reg | FileCheck %s
-// RUN: %clang --target=arm-arm-none-eabi -march=armv8.1m.main+mve.fp 
-mfloat-abi=hard -DPOLYMORPHIC -O0 -Xclang -disable-O0-optnone -S -emit-llvm -o 
- %s | opt -S -mem2reg | FileCheck %s
+// RUN: %clang --target=arm-arm-none-eabi -march=armv8.1m.main+mve.fp 
-mfloat-abi=hard -O0 -Xclang -disable-O0-optnone -fno-discard-value-names -S 
-emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s
+// RUN: %clang --target=arm-arm-none-eabi -march=armv8.1m.main+mve.fp 
-mfloat-abi=hard -DPOLYMORPHIC -O0 -Xclang -disable-O0-optnone 
-fno-discard-value-names -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s
 
 #include 
 

diff  --git a/clang/test/CodeGen/arm-mve-intrinsics/vcvt.c 
b/clang/test/CodeGen/arm-mve-intrinsics/vcvt.c
index ab1b0180eeef..1aae36619dfa 100644
--- a/clang/test/CodeGen/arm-mve-intrinsics/vcvt.c
+++ b/clang/test/CodeGen/arm-mve-intrinsics/vcvt.c
@@ -1,5 +1,5 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
-// RUN: %clang --target=arm-arm-none-eabi -march=armv8.1m.main+mve.fp 
-mfloat-abi=hard -O0 -Xclang -disable-O0-optnone -S -emit-llvm -o - %s | opt -S 
-mem2reg | FileCheck %s
+// RUN: %clang --target=arm-arm-none-eabi -march=armv8.1m.main+mve.fp 
-mfloat-abi=hard -O0 -Xclang -disable-O0-optnone -fno-discard-value-names -S 
-emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s
 
 #include 
 

diff  --git a/clang/test/CodeGen/arm-mve-intrinsics/vld24.c 
b/clang/test/CodeGen/arm-mve-intrinsics/vld24.c
index 2adf6db98832..df128b61bcea 100644
--- a/clang/test/CodeGen/arm-mve-intrinsics/vld24.c
+++ b/clang/test/CodeGen/arm-mve-intrinsics/vld24.c
@@ -1,6 +1,6 @@
 /

[PATCH] D67161: [clang,ARM] Initial ACLE intrinsics for MVE.

2019-10-24 Thread Dave Green via Phabricator via cfe-commits
dmgreen added a comment.

I've hopefully fixed the build in rG7b3de1e81197 
, but it's 
hard to tell for sure with the other error.

I also fixed the tests in rG78700ef8866d 
 (and 
worked out how to remove change-id's from commit messages).

Let us know if anything else looks broken.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67161/new/

https://reviews.llvm.org/D67161



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D67787: Add 8548 CPU definition and attributes

2019-10-24 Thread Justin Hibbits via Phabricator via cfe-commits
jhibbits added a comment.

In D67787#1719251 , @vit9696 wrote:

> A side note regarding SPE support. I am currently upgrading to LLVM 9.0 and I 
> discovered that this patch was not committed anyhow at all:
>  https://reviews.llvm.org/D54583#1444288


Yeah, I noticed that after I committed it.  Problem is, to submit that for 
review, I need a valid reduced test case., and my laziness/busy-ness has 
prevented me from creating a reduced test case in LLVM language.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67787/new/

https://reviews.llvm.org/D67787



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69122: Add support to find out resource dir and add it as compilation args

2019-10-24 Thread Manuel Klimek via Phabricator via cfe-commits
klimek added a comment.

> since resource directory should be picked relative
>  to the path of the clang-compiler in the compilation command.

The resource dir should be the resource dir that shipped with the clang source 
code that the *tool* was built with.
We can think about the resource dir as files that should really have been 
compiled into the tool.
If the compiler has a different version, its resource dir might break the tool.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69122/new/

https://reviews.llvm.org/D69122



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 8fa5e98 - [clang-format] Remove duplciate code from Invalid BOM detection

2019-10-24 Thread via cfe-commits

Author: paulhoad
Date: 2019-10-24T20:24:44+01:00
New Revision: 8fa5e98fd191d02fc7e0e220d74af267b9140e6a

URL: 
https://github.com/llvm/llvm-project/commit/8fa5e98fd191d02fc7e0e220d74af267b9140e6a
DIFF: 
https://github.com/llvm/llvm-project/commit/8fa5e98fd191d02fc7e0e220d74af267b9140e6a.diff

LOG: [clang-format] Remove duplciate code from Invalid BOM detection

Summary:
Review comments on {D68767} asked that this duplicated code in clang-format was 
moved to one central location that being SourceManager (where it had originally 
be copied from I assume)

Moved function into static function  ContentCache::getInvalidBOM(...)  - 
(closest class to where it was defined before)
Updated clang-format to call this static function

Added unit tests for said new function in BasicTests

Sorry not my normal code area so may have the wrong reviewers. (but your names 
were on the recent history)

Reviewers: bruno, arphaman, klimek, owenpan, mitchell-stellar, dexonsmith

Reviewed By: owenpan

Subscribers: cfe-commits

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

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

Added: 


Modified: 
clang/include/clang/Basic/SourceManager.h
clang/lib/Basic/SourceManager.cpp
clang/tools/clang-format/ClangFormat.cpp
clang/unittests/Basic/SourceManagerTest.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/SourceManager.h 
b/clang/include/clang/Basic/SourceManager.h
index 3185ca0f4a25..ec1b0bcf9897 100644
--- a/clang/include/clang/Basic/SourceManager.h
+++ b/clang/include/clang/Basic/SourceManager.h
@@ -226,6 +226,10 @@ namespace SrcMgr {
 bool shouldFreeBuffer() const {
   return (Buffer.getInt() & DoNotFreeFlag) == 0;
 }
+
+// If BufStr has an invalid BOM, returns the BOM name; otherwise, returns
+// nullptr
+static const char *getInvalidBOM(StringRef BufStr);
   };
 
   // Assert that the \c ContentCache objects will always be 8-byte aligned so

diff  --git a/clang/lib/Basic/SourceManager.cpp 
b/clang/lib/Basic/SourceManager.cpp
index 58b95289eaf2..5f457d6f9e3d 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -95,6 +95,29 @@ void ContentCache::replaceBuffer(const llvm::MemoryBuffer 
*B, bool DoNotFree) {
   Buffer.setInt((B && DoNotFree) ? DoNotFreeFlag : 0);
 }
 
+const char *ContentCache::getInvalidBOM(StringRef BufStr) {
+  // If the buffer is valid, check to see if it has a UTF Byte Order Mark
+  // (BOM).  We only support UTF-8 with and without a BOM right now.  See
+  // http://en.wikipedia.org/wiki/Byte_order_mark for more information.
+  const char *InvalidBOM =
+  llvm::StringSwitch(BufStr)
+  .StartsWith(llvm::StringLiteral::withInnerNUL("\x00\x00\xFE\xFF"),
+  "UTF-32 (BE)")
+  .StartsWith(llvm::StringLiteral::withInnerNUL("\xFF\xFE\x00\x00"),
+  "UTF-32 (LE)")
+  .StartsWith("\xFE\xFF", "UTF-16 (BE)")
+  .StartsWith("\xFF\xFE", "UTF-16 (LE)")
+  .StartsWith("\x2B\x2F\x76", "UTF-7")
+  .StartsWith("\xF7\x64\x4C", "UTF-1")
+  .StartsWith("\xDD\x73\x66\x73", "UTF-EBCDIC")
+  .StartsWith("\x0E\xFE\xFF", "SCSU")
+  .StartsWith("\xFB\xEE\x28", "BOCU-1")
+  .StartsWith("\x84\x31\x95\x33", "GB-18030")
+  .Default(nullptr);
+
+  return InvalidBOM;
+}
+
 const llvm::MemoryBuffer *ContentCache::getBuffer(DiagnosticsEngine &Diag,
   FileManager &FM,
   SourceLocation Loc,
@@ -190,20 +213,7 @@ const llvm::MemoryBuffer 
*ContentCache::getBuffer(DiagnosticsEngine &Diag,
   // (BOM).  We only support UTF-8 with and without a BOM right now.  See
   // http://en.wikipedia.org/wiki/Byte_order_mark for more information.
   StringRef BufStr = Buffer.getPointer()->getBuffer();
-  const char *InvalidBOM = llvm::StringSwitch(BufStr)
-.StartsWith(llvm::StringLiteral::withInnerNUL("\x00\x00\xFE\xFF"),
-  "UTF-32 (BE)")
-.StartsWith(llvm::StringLiteral::withInnerNUL("\xFF\xFE\x00\x00"),
-  "UTF-32 (LE)")
-.StartsWith("\xFE\xFF", "UTF-16 (BE)")
-.StartsWith("\xFF\xFE", "UTF-16 (LE)")
-.StartsWith("\x2B\x2F\x76", "UTF-7")
-.StartsWith("\xF7\x64\x4C", "UTF-1")
-.StartsWith("\xDD\x73\x66\x73", "UTF-EBCDIC")
-.StartsWith("\x0E\xFE\xFF", "SCSU")
-.StartsWith("\xFB\xEE\x28", "BOCU-1")
-.StartsWith("\x84\x31\x95\x33", "GB-18030")
-.Default(nullptr);
+  const char *InvalidBOM = getInvalidBOM(BufStr);
 
   if (InvalidBOM) {
 Diag.Report(Loc, diag::err_unsupported_bom)

diff  --git a/clang/tools/clang-format/ClangFormat.cpp 
b/clang/tools/clang-format/ClangFormat.cpp
index a10541d88f07..cbbb52bd0aa8 100644
--- a/clang/tools/clang-format/ClangFormat.cpp
+++ b/clang/

[PATCH] D68914: [clang-format] Remove duplciate code from Invalid BOM detection

2019-10-24 Thread MyDeveloperDay via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8fa5e98fd191: [clang-format] Remove duplciate code from 
Invalid BOM detection (authored by MyDeveloperDay).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68914/new/

https://reviews.llvm.org/D68914

Files:
  clang/include/clang/Basic/SourceManager.h
  clang/lib/Basic/SourceManager.cpp
  clang/tools/clang-format/ClangFormat.cpp
  clang/unittests/Basic/SourceManagerTest.cpp

Index: clang/unittests/Basic/SourceManagerTest.cpp
===
--- clang/unittests/Basic/SourceManagerTest.cpp
+++ clang/unittests/Basic/SourceManagerTest.cpp
@@ -200,6 +200,47 @@
 "");
 }
 
+TEST_F(SourceManagerTest, getInvalidBOM) {
+  ASSERT_EQ(SrcMgr::ContentCache::getInvalidBOM(""), nullptr);
+  ASSERT_EQ(SrcMgr::ContentCache::getInvalidBOM("\x00\x00\x00"), nullptr);
+  ASSERT_EQ(SrcMgr::ContentCache::getInvalidBOM("\xFF\xFF\xFF"), nullptr);
+  ASSERT_EQ(SrcMgr::ContentCache::getInvalidBOM("#include "),
+nullptr);
+
+  ASSERT_EQ(StringRef(SrcMgr::ContentCache::getInvalidBOM(
+"\xFE\xFF#include ")),
+"UTF-16 (BE)");
+  ASSERT_EQ(StringRef(SrcMgr::ContentCache::getInvalidBOM(
+"\xFF\xFE#include ")),
+"UTF-16 (LE)");
+  ASSERT_EQ(StringRef(SrcMgr::ContentCache::getInvalidBOM(
+"\x2B\x2F\x76#include ")),
+"UTF-7");
+  ASSERT_EQ(StringRef(SrcMgr::ContentCache::getInvalidBOM(
+"\xF7\x64\x4C#include ")),
+"UTF-1");
+  ASSERT_EQ(StringRef(SrcMgr::ContentCache::getInvalidBOM(
+"\xDD\x73\x66\x73#include ")),
+"UTF-EBCDIC");
+  ASSERT_EQ(StringRef(SrcMgr::ContentCache::getInvalidBOM(
+"\x0E\xFE\xFF#include ")),
+"SCSU");
+  ASSERT_EQ(StringRef(SrcMgr::ContentCache::getInvalidBOM(
+"\xFB\xEE\x28#include ")),
+"BOCU-1");
+  ASSERT_EQ(StringRef(SrcMgr::ContentCache::getInvalidBOM(
+"\x84\x31\x95\x33#include ")),
+"GB-18030");
+  ASSERT_EQ(StringRef(SrcMgr::ContentCache::getInvalidBOM(
+llvm::StringLiteral::withInnerNUL(
+"\x00\x00\xFE\xFF#include "))),
+"UTF-32 (BE)");
+  ASSERT_EQ(StringRef(SrcMgr::ContentCache::getInvalidBOM(
+llvm::StringLiteral::withInnerNUL(
+"\xFF\xFE\x00\x00#include "))),
+"UTF-32 (LE)");
+}
+
 #if defined(LLVM_ON_UNIX)
 
 TEST_F(SourceManagerTest, getMacroArgExpandedLocation) {
Index: clang/tools/clang-format/ClangFormat.cpp
===
--- clang/tools/clang-format/ClangFormat.cpp
+++ clang/tools/clang-format/ClangFormat.cpp
@@ -289,31 +289,6 @@
   }
 }
 
-// If BufStr has an invalid BOM, returns the BOM name; otherwise, returns
-// nullptr.
-static const char *getInValidBOM(StringRef BufStr) {
-  // Check to see if the buffer has a UTF Byte Order Mark (BOM).
-  // We only support UTF-8 with and without a BOM right now.  See
-  // https://en.wikipedia.org/wiki/Byte_order_mark#Byte_order_marks_by_encoding
-  // for more information.
-  const char *InvalidBOM =
-  llvm::StringSwitch(BufStr)
-  .StartsWith(llvm::StringLiteral::withInnerNUL("\x00\x00\xFE\xFF"),
-  "UTF-32 (BE)")
-  .StartsWith(llvm::StringLiteral::withInnerNUL("\xFF\xFE\x00\x00"),
-  "UTF-32 (LE)")
-  .StartsWith("\xFE\xFF", "UTF-16 (BE)")
-  .StartsWith("\xFF\xFE", "UTF-16 (LE)")
-  .StartsWith("\x2B\x2F\x76", "UTF-7")
-  .StartsWith("\xF7\x64\x4C", "UTF-1")
-  .StartsWith("\xDD\x73\x66\x73", "UTF-EBCDIC")
-  .StartsWith("\x0E\xFE\xFF", "SCSU")
-  .StartsWith("\xFB\xEE\x28", "BOCU-1")
-  .StartsWith("\x84\x31\x95\x33", "GB-18030")
-  .Default(nullptr);
-  return InvalidBOM;
-}
-
 static bool
 emitReplacementWarnings(const Replacements &Replaces, StringRef AssumedFileName,
 const std::unique_ptr &Code) {
@@ -412,7 +387,7 @@
 
   StringRef BufStr = Code->getBuffer();
 
-  const char *InvalidBOM = getInValidBOM(BufStr);
+  const char *InvalidBOM = SrcMgr::ContentCache::getInvalidBOM(BufStr);
 
   if (InvalidBOM) {
 errs() << "error: encoding with unsupported byte order mark \""
Index: clang/lib/Basic/SourceManager.cpp
===
--- clang/lib/Basic/SourceManager.cpp
+++ clang/lib/Basic/SourceManager.cpp
@@ -95,6 +95,29 @@
   Buffer.setInt((B && DoNotFree) ? DoNotFreeFlag : 0);
 }
 
+const char *ContentCache::getInvalidBOM(StringRef BufStr) {
+  // If the buffer is valid, check to see if it has a UTF Byte Order Mark
+  // (BOM).  We only support UTF-8 with and without a BOM right now.  See
+  // http://en.wikipedia.org/wiki/Byte_order_mark for more information.
+

[PATCH] D69389: [hip] Allow the declaration of functions with variadic arguments in HIP.

2019-10-24 Thread Artem Belevich via Phabricator via cfe-commits
tra added inline comments.



Comment at: clang/lib/CodeGen/TargetInfo.cpp:7764
+ QualType Ty) const {
+  llvm_unreachable("AMDGPU does not support varargs");
+}

llvm_unreachable() should be used to indicate an error in compiler's own code, 
not in the user code that we're compiling. 

I think what you need to do is to issue a postponed diagnostics in Sema where 
we're currently checking for varargs functions and materialize them if we 
attempt to codegen such function.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69389/new/

https://reviews.llvm.org/D69389



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69389: [hip] Allow the declaration of functions with variadic arguments in HIP.

2019-10-24 Thread Michael Liao via Phabricator via cfe-commits
hliao marked an inline comment as done.
hliao added inline comments.



Comment at: clang/lib/CodeGen/TargetInfo.cpp:7764
+ QualType Ty) const {
+  llvm_unreachable("AMDGPU does not support varargs");
+}

tra wrote:
> llvm_unreachable() should be used to indicate an error in compiler's own 
> code, not in the user code that we're compiling. 
> 
> I think what you need to do is to issue a postponed diagnostics in Sema where 
> we're currently checking for varargs functions and materialize them if we 
> attempt to codegen such function.
this is just a stub to assert that there won't be codegen for va_arg. the real 
diagnosing is @ lib/Sema/SemaExpr.cpp around L14438. I just want to add an 
assertion to capture them if anything goes wrong. Error on `va_arg` use is 
already there for a while.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69389/new/

https://reviews.llvm.org/D69389



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69181: [clang-tidy] Adding misc-signal-terminated-thread check

2019-10-24 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added inline comments.



Comment at: clang-tools-extra/clang-tidy/misc/BadSignalToKillThreadCheck.cpp:28
+
+static Preprocessor *PP;
+

Can't we place this `PP` variable to the checker class?
Like the [[ 
https://github.com/llvm/llvm-project/blob/master/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.h#L39
 | modernize/UseTrailingReturnTypeCheck ]] does?



Comment at: clang-tools-extra/clang-tidy/misc/BadSignalToKillThreadCheck.cpp:35
+  const auto TryExpandAsInteger =
+  [PP = PP](Preprocessor::macro_iterator It) -> Optional {
+if (It == PP->macro_end())

aaron.ballman wrote:
> This lambda capture looks suspicious -- why do you need to initialize the 
> capture?
You are right, I forgot that `PP` is a global variable when I offered this 
solution.
Global variables should not be captured, so empty capture is good enough.


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69181/new/

https://reviews.llvm.org/D69181



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 76ee21e - Namespace fixup for D68340 build on MSVC

2019-10-24 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2019-10-24T15:47:08-04:00
New Revision: 76ee21e1d09084288bbfee7f960ce0b9e4306d60

URL: 
https://github.com/llvm/llvm-project/commit/76ee21e1d09084288bbfee7f960ce0b9e4306d60
DIFF: 
https://github.com/llvm/llvm-project/commit/76ee21e1d09084288bbfee7f960ce0b9e4306d60.diff

LOG: Namespace fixup for D68340 build on MSVC

we seem to run into issues with nested namespace lookups in recently landed
D68340 so just make them explicit.

Added: 


Modified: 
clang/lib/Driver/ToolChains/AIX.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/AIX.cpp 
b/clang/lib/Driver/ToolChains/AIX.cpp
index 369a5fc17c91..b548919526df 100644
--- a/clang/lib/Driver/ToolChains/AIX.cpp
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -16,6 +16,8 @@
 
 namespace aix = clang::driver::tools::aix;
 using AIX = clang::driver::toolchains::AIX;
+using namespace clang::driver;
+using namespace clang::driver::tools;
 
 using namespace llvm::opt;
 



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D31574: [clang-format] update documentation

2019-10-24 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

When I land this change, I'll include the ClangFormatStyleOptions.rst to match  
(plus some minor NFC) in Format.h that are preventing dump_format_style.py from 
being rerun

in a later commit I'll try and bring the Format.h and 
ClangFormaatStyleOptions.rst back into line


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D31574/new/

https://reviews.llvm.org/D31574



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 23b7836 - [clang-format] update documentation

2019-10-24 Thread via cfe-commits

Author: paulhoad
Date: 2019-10-24T21:10:13+01:00
New Revision: 23b78364150cd946a8b111e87defdf179eecbc8f

URL: 
https://github.com/llvm/llvm-project/commit/23b78364150cd946a8b111e87defdf179eecbc8f
DIFF: 
https://github.com/llvm/llvm-project/commit/23b78364150cd946a8b111e87defdf179eecbc8f.diff

LOG: [clang-format] update documentation

Summary:
  - Added example code for BreakStringLiterals;

Reviewers: MyDeveloperDay

Reviewed By: MyDeveloperDay

Patch By: mrexodia

Subscribers: cfe-commits, MyDeveloperDay

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

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

Added: 


Modified: 
clang/docs/ClangFormatStyleOptions.rst
clang/include/clang/Format/Format.h

Removed: 




diff  --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index 3cd47d3c0ac0..cadb6d4f4919 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -1321,6 +1321,17 @@ the configuration (without a prefix: ``Auto``).
 **BreakStringLiterals** (``bool``)
   Allow breaking string literals when formatting.
 
+  .. code-block:: c++
+
+ true:
+ const char* x = "veryVeryVeryVeryVeryVe"
+ "ryVeryVeryVeryVeryVery"
+ "VeryLongString";
+
+ false:
+ const char* x =
+   "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString";
+
 **ColumnLimit** (``unsigned``)
   The column limit.
 

diff  --git a/clang/include/clang/Format/Format.h 
b/clang/include/clang/Format/Format.h
index 7e71b7e8b167..1095821eb664 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -782,7 +782,7 @@ struct FormatStyle {
   /// The brace breaking style to use.
   BraceBreakingStyle BreakBeforeBraces;
 
-  // Different ways to wrap braces after control statements.
+  /// Different ways to wrap braces after control statements.
   enum BraceWrappingAfterControlStatementStyle {
 /// Never wrap braces after a control statement.
 /// \code
@@ -1077,6 +1077,16 @@ struct FormatStyle {
   bool BreakAfterJavaFieldAnnotations;
 
   /// Allow breaking string literals when formatting.
+  /// \code
+  ///true:
+  ///const char* x = "veryVeryVeryVeryVeryVe"
+  ///"ryVeryVeryVeryVeryVery"
+  ///"VeryLongString";
+  ///
+  ///false:
+  ///const char* x =
+  ///  "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString";
+  /// \endcode
   bool BreakStringLiterals;
 
   /// The column limit.
@@ -1985,7 +1995,6 @@ struct FormatStyle {
 /// Latest: Parse and format using the latest supported language version.
 /// 'Cpp11' is an alias for LS_Latest for historical reasons.
 LS_Latest,
-
 /// Auto: Automatic detection based on the input.
 /// Parse using the latest language version. Format based on detected 
input.
 LS_Auto,



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D31574: [clang-format] update documentation

2019-10-24 Thread MyDeveloperDay via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG23b78364150c: [clang-format] update documentation (authored 
by MyDeveloperDay).

Changed prior to commit:
  https://reviews.llvm.org/D31574?vs=223443&id=226316#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D31574/new/

https://reviews.llvm.org/D31574

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/include/clang/Format/Format.h


Index: clang/include/clang/Format/Format.h
===
--- clang/include/clang/Format/Format.h
+++ clang/include/clang/Format/Format.h
@@ -782,7 +782,7 @@
   /// The brace breaking style to use.
   BraceBreakingStyle BreakBeforeBraces;
 
-  // Different ways to wrap braces after control statements.
+  /// Different ways to wrap braces after control statements.
   enum BraceWrappingAfterControlStatementStyle {
 /// Never wrap braces after a control statement.
 /// \code
@@ -1077,6 +1077,16 @@
   bool BreakAfterJavaFieldAnnotations;
 
   /// Allow breaking string literals when formatting.
+  /// \code
+  ///true:
+  ///const char* x = "veryVeryVeryVeryVeryVe"
+  ///"ryVeryVeryVeryVeryVery"
+  ///"VeryLongString";
+  ///
+  ///false:
+  ///const char* x =
+  ///  "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString";
+  /// \endcode
   bool BreakStringLiterals;
 
   /// The column limit.
@@ -1985,7 +1995,6 @@
 /// Latest: Parse and format using the latest supported language version.
 /// 'Cpp11' is an alias for LS_Latest for historical reasons.
 LS_Latest,
-
 /// Auto: Automatic detection based on the input.
 /// Parse using the latest language version. Format based on detected 
input.
 LS_Auto,
Index: clang/docs/ClangFormatStyleOptions.rst
===
--- clang/docs/ClangFormatStyleOptions.rst
+++ clang/docs/ClangFormatStyleOptions.rst
@@ -1321,6 +1321,17 @@
 **BreakStringLiterals** (``bool``)
   Allow breaking string literals when formatting.
 
+  .. code-block:: c++
+
+ true:
+ const char* x = "veryVeryVeryVeryVeryVe"
+ "ryVeryVeryVeryVeryVery"
+ "VeryLongString";
+
+ false:
+ const char* x =
+   "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString";
+
 **ColumnLimit** (``unsigned``)
   The column limit.
 


Index: clang/include/clang/Format/Format.h
===
--- clang/include/clang/Format/Format.h
+++ clang/include/clang/Format/Format.h
@@ -782,7 +782,7 @@
   /// The brace breaking style to use.
   BraceBreakingStyle BreakBeforeBraces;
 
-  // Different ways to wrap braces after control statements.
+  /// Different ways to wrap braces after control statements.
   enum BraceWrappingAfterControlStatementStyle {
 /// Never wrap braces after a control statement.
 /// \code
@@ -1077,6 +1077,16 @@
   bool BreakAfterJavaFieldAnnotations;
 
   /// Allow breaking string literals when formatting.
+  /// \code
+  ///true:
+  ///const char* x = "veryVeryVeryVeryVeryVe"
+  ///"ryVeryVeryVeryVeryVery"
+  ///"VeryLongString";
+  ///
+  ///false:
+  ///const char* x =
+  ///  "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString";
+  /// \endcode
   bool BreakStringLiterals;
 
   /// The column limit.
@@ -1985,7 +1995,6 @@
 /// Latest: Parse and format using the latest supported language version.
 /// 'Cpp11' is an alias for LS_Latest for historical reasons.
 LS_Latest,
-
 /// Auto: Automatic detection based on the input.
 /// Parse using the latest language version. Format based on detected input.
 LS_Auto,
Index: clang/docs/ClangFormatStyleOptions.rst
===
--- clang/docs/ClangFormatStyleOptions.rst
+++ clang/docs/ClangFormatStyleOptions.rst
@@ -1321,6 +1321,17 @@
 **BreakStringLiterals** (``bool``)
   Allow breaking string literals when formatting.
 
+  .. code-block:: c++
+
+ true:
+ const char* x = "veryVeryVeryVeryVeryVe"
+ "ryVeryVeryVeryVeryVery"
+ "VeryLongString";
+
+ false:
+ const char* x =
+   "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString";
+
 **ColumnLimit** (``unsigned``)
   The column limit.
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D67723: [DebugInfo] Add option to disable inline line tables.

2019-10-24 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

In D67723#1717468 , @aprantl wrote:

> I agree that it would make sense to have a `-ginline-info-threshold=<#insns>` 
> or `-gno-small-inline-functions` with a hardcoded threshold to implement the 
> feature Paul described, and this patch seems to be a step in that direction, 
> with the threshold being hardcoded to 0.


OK. :)

>> We are motivated by one tool in particular at the moment, but if we're going 
>> to take the time to add a knob, we might as well make it work for DWARF.
> 
> Here you got me confused: When I read "we might as well make it work for 
> DWARF", I read that as "we should emit the inlined instructions with line 0 
> under a DWARF debugger tuning". But that reading seems to to contradict your 
> next sentence:
> 
>> If the user cares enough to find this flag, it seems more user friendly to 
>> make it behave the same rather than making it format-dependent.
> 
> Can you clarify?

If we use line zero for DWARF, gdb will not behave in the way documented by the 
function attribute in LangRef. I was the one who suggested the wording there, 
so maybe we could come up with new wording that describes what the user should 
expect in the debugger when using line zero. However, given the behavior I show 
below, I have a hard time imagining the use case for it.

I applied the version of this patch that uses getMergedLocation, compiled this 
program, and ran it under gdb:

  volatile int x;
  static inline void foo() {
++x;
*(volatile int*)0 = 42; // crash
++x;
  }
  int main() {
++x;  // line 8
foo();  // line 9
++x;
return x;
  }

If we apply line zero, the debugger stops on line 8:

  Program received signal SIGSEGV, Segmentation fault.
  0x0040111e in main () at t.cpp:8
  8 ++x;
  (gdb) bt
  #0  0x0040111e in main () at t.cpp:8

The inline frame is gone, as expected for this flag, but the current location 
does not reflect the site of the call to `foo`. So, if we want it to behave as 
documented, we have to put the call site location on some instructions.

Alternatively, if I arrange things like this, the crash is attributed to line 
`return x`, which is completely unrelated to the inline call site:

  static inline void foo() {
++x;
if (x) {
  *(volatile int*)0 = 42; // crash
  __builtin_unreachable();
}
++x;
  }

This means that if line zero is used, the source location shown in the debugger 
becomes sensitive to code layout, which is arbitrary.

These experiments are convincing me that, in general, line zero isn't that 
helpful for DWARF consumers. If the goal is to get smooth stepping, we may want 
to refocus on getting reliable is_stmt bits in the line table.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67723/new/

https://reviews.llvm.org/D67723



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69383: [RISCV] Match GCC `-march`/`-mabi` driver defaults

2019-10-24 Thread Roger Ferrer Ibanez via Phabricator via cfe-commits
rogfer01 added inline comments.



Comment at: clang/lib/Driver/ToolChains/Arch/RISCV.cpp:475
+
+if (MArch.startswith_lower("rv32")) {
+  if (MArch.substr(4).contains_lower("d") ||

lenary wrote:
> rogfer01 wrote:
> > `llvm::StringSwitch` has a method `StartsWithLower` which might help make 
> > the logic a bit clearer
> > 
> > Something like this (I haven't tested it!)
> > 
> > ```lang=cpp
> > StringRef ABIFromMarch = StringSwitch(MArch)
> >.StartsWithLower("rv32d", "ilp32d")
> >.StartsWithLower("rv32g", "ilp32d")
> >.StartsWithLower("rv32e", "ilp32e")
> >.StartsWithLower("rv32", "ilp32")
> > 
> >.StartsWithLower("rv64d", "lp64d")
> >.StartsWithLower("rv64g", "lp64d")
> >.StartsWithLower("rv64", "lp64").
> > 
> >.Default("");
> > 
> > if (!ABIFromMarch.empty()) return ABIFromMarch;
> > ```
> Sadly I don't think this will work, because of the case of matching `rv32*d*` 
> and `rv64*d*` (the `March.substr(4).contains_lower("d")` cases) from 
> config.gcc. Explicitly "d" does not come immediately after `rv<32/64>`, it 
> can come anywhere after like in `rv32imafdc`.
> 
> The other issue I have with the StringSwitch is that it requires I have a 
> default, which I feel makes the control flow harder to understand, rather 
> than easier. 
Oh I see.

Then I would comment what this part does with a bit more detail right after the 
`// 2. Choose a default based on -march=`. For example

```
// rv32g | rv32*d -> ilp32d
// rv32e -> ilp32e
// rv32* -> ilp32
// rv64g | rv64*d -> lp64d
// rv64* -> lp64
```

Given that gcc is using a shell glob, then `GlobPattern` in 
`Support/GlobPattern.h` may help as well. But it might be overkill in this 
scenario.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69383/new/

https://reviews.llvm.org/D69383



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69356: [NFC] Rename LLVM_NO_DEAD_STRIP

2019-10-24 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 226319.
daltenty added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Address comments round 1


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69356/new/

https://reviews.llvm.org/D69356

Files:
  clang/tools/driver/CMakeLists.txt
  llvm/cmake/modules/AddLLVM.cmake
  llvm/cmake/modules/HandleLLVMOptions.cmake
  llvm/tools/bugpoint/CMakeLists.txt
  llvm/tools/llc/CMakeLists.txt
  llvm/tools/opt/CMakeLists.txt


Index: llvm/tools/opt/CMakeLists.txt
===
--- llvm/tools/opt/CMakeLists.txt
+++ llvm/tools/opt/CMakeLists.txt
@@ -25,7 +25,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(opt
   AnalysisWrappers.cpp
Index: llvm/tools/llc/CMakeLists.txt
===
--- llvm/tools/llc/CMakeLists.txt
+++ llvm/tools/llc/CMakeLists.txt
@@ -20,7 +20,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(llc
   llc.cpp
Index: llvm/tools/bugpoint/CMakeLists.txt
===
--- llvm/tools/bugpoint/CMakeLists.txt
+++ llvm/tools/bugpoint/CMakeLists.txt
@@ -22,7 +22,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(bugpoint
   BugDriver.cpp
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -772,7 +772,7 @@
 # Add flags for add_dead_strip().
 # FIXME: With MSVS, consider compiling with /Gy and linking with /OPT:REF?
 # But MinSizeRel seems to add that automatically, so maybe disable these
-# flags instead if LLVM_NO_DEAD_STRIP is set.
+# flags instead if LLVM_SUPPORT_PLUGINS is set.
 if(NOT CYGWIN AND NOT WIN32)
   if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND
  NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
Index: llvm/cmake/modules/AddLLVM.cmake
===
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -228,7 +228,7 @@
   # to enable. See https://sourceware.org/bugzilla/show_bug.cgi?id=17704.
 endif()
 
-if(NOT LLVM_NO_DEAD_STRIP)
+if(NOT LLVM_SUPPORT_PLUGINS)
   if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
 # ld64's implementation of -dead_strip breaks tools that use plugins.
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
@@ -245,7 +245,7 @@
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
  LINK_FLAGS " -Wl,--gc-sections")
   endif()
-else() #LLVM_NO_DEAD_STRIP
+else() #LLVM_SUPPORT_PLUGINS
   if(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
  LINK_FLAGS " -Wl,-bnogc")
Index: clang/tools/driver/CMakeLists.txt
===
--- clang/tools/driver/CMakeLists.txt
+++ clang/tools/driver/CMakeLists.txt
@@ -20,9 +20,9 @@
 option(CLANG_PLUGIN_SUPPORT "Build clang with plugin support" ON)
 
 # Support plugins. This must be before add_clang_executable as it reads
-# LLVM_NO_DEAD_STRIP.
+# LLVM_SUPPORT_PLUGINS.
 if(CLANG_PLUGIN_SUPPORT)
-  set(LLVM_NO_DEAD_STRIP 1)
+  set(LLVM_SUPPORT_PLUGINS 1)
 endif()
 
 if(NOT CLANG_BUILT_STANDALONE)


Index: llvm/tools/opt/CMakeLists.txt
===
--- llvm/tools/opt/CMakeLists.txt
+++ llvm/tools/opt/CMakeLists.txt
@@ -25,7 +25,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(opt
   AnalysisWrappers.cpp
Index: llvm/tools/llc/CMakeLists.txt
===
--- llvm/tools/llc/CMakeLists.txt
+++ llvm/tools/llc/CMakeLists.txt
@@ -20,7 +20,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(llc
   llc.cpp
Index: llvm/tools/bugpoint/CMakeLists.txt
===
--- llvm/tools/bugpoint/CMakeLists.txt
+++ llvm/tools/bugpoint/CMakeLists.txt
@@ -22,7 +22,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(bugpoint
   BugDriver.cpp
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -772,7 +772,7 @@
 # Add flags for add_dead_strip().
 # FIXME: With MSVS, consider compiling with /Gy and linking with /OPT:REF?
 # But MinSizeRel seems to add that automatically, so maybe disable these
-# flags instead 

[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-24 Thread Yi-Hong Lyu via Phabricator via cfe-commits
Yi-Hong.Lyu added a comment.

Seems this commit broke the buildbot 
http://lab.llvm.org:8011/builders/ppc64le-lld-multistage-test/builds/6806


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68340/new/

https://reviews.llvm.org/D68340



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D67541: [ClangFormat] Future-proof Standard option, allow floating or pinning to arbitrary lang version

2019-10-24 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

ClangFormatStyleOptions.rst and Format.h are inconsistent which means when 
clang/doc/tools/dump_format_style.py is run the rst file being generated is in 
danger of overwriting your changes (which I think you might have made by hand).

I'm happy to try and fix this for you, but I need to know what you want to 
keep, whats in the rst or whats in the Format.h


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67541/new/

https://reviews.llvm.org/D67541



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69363: [www] Change URLs to HTTPS.

2019-10-24 Thread Stephan T. Lavavej via Phabricator via cfe-commits
STL_MSFT closed this revision.
STL_MSFT added a comment.

Committed: 
https://github.com/llvm/llvm-project/commit/2e4f1e112dfee1d16c138d42f2bc7ee639f9ae05


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69363/new/

https://reviews.llvm.org/D69363



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69356: [NFC] Rename LLVM_NO_DEAD_STRIP

2019-10-24 Thread Steven Wan via Phabricator via cfe-commits
stevewan accepted this revision.
stevewan added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69356/new/

https://reviews.llvm.org/D69356



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 126a72f - Fix MSVC "not all control paths return a value" warnings. NFCI.

2019-10-24 Thread Simon Pilgrim via cfe-commits

Author: Simon Pilgrim
Date: 2019-10-24T13:40:13-07:00
New Revision: 126a72fcbf7e5e4d958d3804033710c0a4efbe39

URL: 
https://github.com/llvm/llvm-project/commit/126a72fcbf7e5e4d958d3804033710c0a4efbe39
DIFF: 
https://github.com/llvm/llvm-project/commit/126a72fcbf7e5e4d958d3804033710c0a4efbe39.diff

LOG: Fix MSVC "not all control paths return a value" warnings. NFCI.

Added: 


Modified: 
clang/utils/TableGen/MveEmitter.cpp

Removed: 




diff  --git a/clang/utils/TableGen/MveEmitter.cpp 
b/clang/utils/TableGen/MveEmitter.cpp
index c4270ff586cf..9c3328e3bbfb 100644
--- a/clang/utils/TableGen/MveEmitter.cpp
+++ b/clang/utils/TableGen/MveEmitter.cpp
@@ -158,6 +158,7 @@ inline std::string toLetter(ScalarTypeKind kind) {
   case ScalarTypeKind::Float:
 return "f";
   }
+  llvm_unreachable("Unhandled ScalarTypeKind enum");
 }
 inline std::string toCPrefix(ScalarTypeKind kind) {
   switch (kind) {
@@ -168,6 +169,7 @@ inline std::string toCPrefix(ScalarTypeKind kind) {
   case ScalarTypeKind::Float:
 return "float";
   }
+  llvm_unreachable("Unhandled ScalarTypeKind enum");
 }
 
 class VoidType : public Type {



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69171: [clang-fuzzer] Add new fuzzer target for Objective-C

2019-10-24 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr added a comment.

Looks reasonable to me. The duplication is unfortunate, but it is reasonable 
while we have two binaries.

However, you could explore reading the command line flags for HandleCXX in 
LLVMFuzzerInitialize from fuzzer's command line flags.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69171/new/

https://reviews.llvm.org/D69171



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69404: [clang-format] [NFC] update the documentation in Format.h to allow dump_format_style.py to get a little closer to being correct.

2019-10-24 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay created this revision.
MyDeveloperDay added reviewers: klimek, mitchell-stellar, owenpan.
MyDeveloperDay added projects: clang-format, clang.

Running dump_format_style.py on the tip of the trunk causes 
ClangFormatStyleOptions.rst to have changes, which I think ideally it shouldn't.

Some recent commits have meant Format.h and ClangFormatStyleOptions.rst have 
become out of sync such that dump_format_style.py either couldn't be run or 
generated incorrect .rst files.

It's also important to remember to edit the IncludeStyles from Tooling.

Make a couple of changes which came from recent clang-format commits that 
missed this step. There are still a couple of other changes which also need to 
be made, but I'd like to park these changes first.


Repository:
  rC Clang

https://reviews.llvm.org/D69404

Files:
  clang/include/clang/Format/Format.h
  clang/include/clang/Tooling/Inclusions/IncludeStyle.h

Index: clang/include/clang/Tooling/Inclusions/IncludeStyle.h
===
--- clang/include/clang/Tooling/Inclusions/IncludeStyle.h
+++ clang/include/clang/Tooling/Inclusions/IncludeStyle.h
@@ -84,18 +84,27 @@
   /// (https://llvm.org/docs/CodingStandards.html#include-style). However, you
   /// can also assign negative priorities if you have certain headers that
   /// always need to be first.
+  /// 
+  /// There is a third and optional field ``SortPriority`` which can used while
+  /// ``IncludeBloks = IBS_Regroup`` to define the priority in which ``#includes``
+  /// should be ordered, and value of ``Priority`` defines the order of
+  /// ``#include blocks`` and also enables to group ``#includes`` of different
+  /// priority for order.``SortPriority`` is set to the value of ``Priority``
+  /// as default if it is not assigned.
   ///
   /// To configure this in the .clang-format file, use:
   /// \code{.yaml}
   ///   IncludeCategories:
   /// - Regex:   '^"(llvm|llvm-c|clang|clang-c)/'
   ///   Priority:2
+  ///   SortPriority:2
   /// - Regex:   '^(<|"(gtest|gmock|isl|json)/)'
   ///   Priority:3
   /// - Regex:   '<[[:alnum:].]+>'
   ///   Priority:4
   /// - Regex:   '.*'
   ///   Priority:1
+  ///   SortPriority:0
   /// \endcode
   std::vector IncludeCategories;
 
Index: clang/include/clang/Format/Format.h
===
--- clang/include/clang/Format/Format.h
+++ clang/include/clang/Format/Format.h
@@ -706,21 +706,19 @@
 ///   };
 /// \endcode
 BS_Allman,
-/// Always break before braces and add an extra level of indentation to
-/// braces of control statements, not to those of class, function
-/// or other definitions.
+/// Like ``Allman`` but always indent braces and line up code with braces.
 /// \code
-///   try
+///try
 /// {
-///   foo();
+/// foo();
 /// }
 ///   catch ()
 /// {
 /// }
 ///   void foo() { bar(); }
 ///   class foo
-///   {
-///   };
+/// {
+/// };
 ///   if (foo())
 /// {
 /// }
@@ -728,25 +726,27 @@
 /// {
 /// }
 ///   enum X : int
-///   {
+/// {
 /// A,
 /// B
-///   };
+/// };
 /// \endcode
 BS_Whitesmiths,
-/// Like ``Allman`` but always indent braces and line up code with braces.
+/// Always break before braces and add an extra level of indentation to
+/// braces of control statements, not to those of class, function
+/// or other definitions.
 /// \code
-///try
+///   try
 /// {
-/// foo();
+///   foo();
 /// }
 ///   catch ()
 /// {
 /// }
 ///   void foo() { bar(); }
 ///   class foo
-/// {
-/// };
+///   {
+///   };
 ///   if (foo())
 /// {
 /// }
@@ -754,10 +754,10 @@
 /// {
 /// }
 ///   enum X : int
-/// {
+///   {
 /// A,
 /// B
-/// };
+///   };
 /// \endcode
 BS_GNU,
 /// Like ``Attach``, but break before functions.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D66035: [WebAssembly] WIP: Add support for reference types

2019-10-24 Thread Thomas Lively via Phabricator via cfe-commits
tlively added a comment.

It would be great to see some test .ll files here so we can get a better 
understanding for what is implemented here. I would also like to see tests of 
what happens if you try to do a `ptrtoint` or some other illegal operation on a 
reference type.




Comment at: llvm/lib/Target/WebAssembly/WebAssembly.h:88
+  MAX_CUSTOM_ADDRESS = 255,
+  ANYREF_ADDRESS = 256, // Address space for anyref
+};

I assume other reference types will get their own address spaces so we can 
differentiate them in IR. Would it then make sense to put the table itself in 
another address space? We should also think about how best to partition the 
address space space looking forward to when we will have multiple memories, 
multiple tables, and multiple function references or reference type imports.



Comment at: llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp:1101
+  GA->getAddressSpace() != WebAssemblyAS::ANYREF_ADDRESS)
+fail(DL, DAG, "WebAssembly only expects the 0 or 1 address space");
 

I think this message needs to be updated for the new AS numbers.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66035/new/

https://reviews.llvm.org/D66035



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D66035: [WebAssembly] WIP: Add support for reference types

2019-10-24 Thread Thomas Lively via Phabricator via cfe-commits
tlively added a comment.

One other thought: Does the implementation in this diff care what type the 
reference type pointers are pointing to? It would be nice if we could enforce 
the use of an opaque pointee type to prevent the reference types from being 
dereferenced.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66035/new/

https://reviews.llvm.org/D66035



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 201ed14 - Follow on to Namespace fixup for D68340

2019-10-24 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2019-10-24T17:01:17-04:00
New Revision: 201ed14aea8cd03e776dbe8484fa7de3ac94a3cf

URL: 
https://github.com/llvm/llvm-project/commit/201ed14aea8cd03e776dbe8484fa7de3ac94a3cf
DIFF: 
https://github.com/llvm/llvm-project/commit/201ed14aea8cd03e776dbe8484fa7de3ac94a3cf.diff

LOG: Follow on to Namespace fixup for D68340

remove using directive that can make lookup ambiguous.

Added: 


Modified: 
clang/lib/Driver/ToolChains/AIX.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/AIX.cpp 
b/clang/lib/Driver/ToolChains/AIX.cpp
index b548919526df..50450b7deb56 100644
--- a/clang/lib/Driver/ToolChains/AIX.cpp
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -14,7 +14,6 @@
 #include "clang/Driver/SanitizerArgs.h"
 #include "llvm/Option/ArgList.h"
 
-namespace aix = clang::driver::tools::aix;
 using AIX = clang::driver::toolchains::AIX;
 using namespace clang::driver;
 using namespace clang::driver::tools;



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69327: [Clang][ThinLTO] Add a cache for compile phase output.

2019-10-24 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen added a comment.

Thank you @steven_wu @tejohnson. I created D69406 
 to promote the flag to the driver.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69327/new/

https://reviews.llvm.org/D69327



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


  1   2   >