[PATCH] D94503: [clangd] Explicitly avoid background-indexing the same file twice.

2021-01-13 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.

thank, as discussed offline this looks like the right thing to do before the 
branch cut. we might re-evaluate our decision around re-indexing on cmd changes 
and canonicalization one day ...

LGTM! (with some small comments)




Comment at: clang-tools-extra/clangd/index/Background.cpp:143
 Tasks.reserve(NeedsReIndexing.size());
-for (auto &Cmd : NeedsReIndexing)
-  Tasks.push_back(indexFileTask(std::move(Cmd)));
+for (const auto &Cmd : NeedsReIndexing)
+  Tasks.push_back(indexFileTask(Cmd));

nit: while here can we `s/Cmd/FilePath` ?



Comment at: clang-tools-extra/clangd/index/Background.cpp:144
+for (const auto &Cmd : NeedsReIndexing)
+  Tasks.push_back(indexFileTask(Cmd));
 Queue.append(std::move(Tasks));

why do we drop std::move here ? these are strings in the end and 
`indexFileTask` is still expecting a value not a reference.



Comment at: clang-tools-extra/clangd/index/Background.cpp:360
+  if (ContextProvider) {
+trace::Span Tracer("BackgroundPolicy");
 llvm::erase_if(MainFiles, [&](const std::string &TU) {

nit: might be nice to have this in a separate patch



Comment at: clang-tools-extra/clangd/index/Background.h:220
   enum QueuePriority {
+ReindexFile = 0, // Implicitly applied by BackgroundQueue
 IndexFile,

i suppose this is no longer needed ?



Comment at: clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp:868
+  Sequence.push_back(' ');
+  Q.append({A, B, A, B}); // One A is dropped, the other is zero priority.
+} else {

both As are dropped here right ? not just one.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94503

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


[PATCH] D93525: [OpenMP] Add unbundling of archives containing bundled object files into device specific archives

2021-01-13 Thread Saiyedul Islam via Phabricator via cfe-commits
saiislam added a comment.

In D93525#2493752 , @t-tye wrote:

> In D93525#2493024 , @yaxunl wrote:
>
>> can you document this in ClangOffloadBundler.rst ? I think we need a clear 
>> description about how clang-offload-bundler knows which file in the .a file 
>> belongs to which target.
>
> How does the .a relate to bundled code objects? Does the .a have a number of 
> bundled code objects? If so wouldn't the identity of code objects be defined 
> by the existing bundled code object ABI already documented? If the .a is a 
> set of non-bundled code objects then defining how they are identified is not 
> part of the clang-offload-bundler documentation as there are no bundled code 
> objects involved. It would seem that the documentation belongs with the 
> OpenMP runtime/compiler that is choosing to use .a files in this manner.

Bundles (created using clang-offload-bundler) are passed to llvm-ar to create 
an archive of bundled objects (*.a file). An archive can have bundles for 
multiple device types. So, yes, the identity of code objects is defined by the 
existing bundled code object ABI.
This patch reads such an archive and produces a device-specific archive for 
each of the target devices given as input. Each device-specific archive 
contains all the code objects corresponding to that particular device and are 
written as per llvm archive format.

Here is a snippet of relevant lit run lines:

  // RUN: %clang -O0 -target %itanium_abi_triple %s -c -o %t.o
  
  // RUN: echo 'Content of device file 1' > %t.tgt1
  // RUN: clang-offload-bundler -type=o 
-targets=host-%itanium_abi_triple,openmp-amdgcn-amd-amdhsa-gfx900 
-inputs=%t.o,%t.tgt1 -outputs=%t.abundle1.o
   
  // RUN: echo 'Content of device file 2' > %t.tgt2
  // RUN: clang-offload-bundler -type=o 
-targets=host-%itanium_abi_triple,openmp-amdgcn-amd-amdhsa-gfx900 
-inputs=%t.o,%t.tgt2 -outputs=%t.abundle2.o
   
  // RUN: llvm-ar cr %t.lib.a %t.abundle1.o %t.abundle2.o
  
  This patch ==>
  // RUN: clang-offload-bundler -unbundle -type=a 
-targets=openmp-amdgcn-amd-amdhsa-gfx900 -inputs=%t.lib.a 
-outputs=%t.devicelib.a
  
  %t.devicelib.a will contain all devices objects corresponding to gfx900

Though my interest originates from OpenMP side, Device-specific Archive 
Libraries created like this can be used by other offloading languages like HIP, 
CUDA, and OpenCL. Pelase refer D81109  for the 
an earlier patch in the series of patches which will enable this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93525

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


[PATCH] D93938: [clang-format] Fixed AfterEnum handling

2021-01-13 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/D93938/new/

https://reviews.llvm.org/D93938

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


[clang] cbea673 - [clang][driver] Restore the original help text for `-I`

2021-01-13 Thread Andrzej Warzynski via cfe-commits

Author: Andrzej Warzynski
Date: 2021-01-13T09:19:50Z
New Revision: cbea6737d5130724c7c8cf8ee4ccf1c3dd099450

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

LOG: [clang][driver] Restore the original help text for `-I`

The help text for `-I` was recently expanded in [1]. The expanded
version focuses on explaining the semantics of `-I` in Clang. We are now
in the process of adding support for `-I` in Flang and this new
description is incompatible with the semantics of `-I` in Flang. This
was brought up in this review:
  * https://reviews.llvm.org/D93453

This patch reverts the original change in Options.td. This way the help
text for `-I` remains generic enough so that it applies to both Clang
and Flang.

The expanded description of `-I` from [1] is moved to the
`DocBrief` field for `-I`. This field is prioritised over the help text
when generating ClangCommandLineReference.rst, so the user facing
documentation for Clang retains the expanded description:
  * https://clang.llvm.org/docs/ClangCommandLineReference.html
`DocBrief` fields are currently not used in Flang.

As requested in the reviews, the help text and the expanded description
are slightly refined.

[1] Commit: 8dd4e3ceb804a58bcf25e6856fc6fde5e1995a66

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

Added: 


Modified: 
clang/docs/ClangCommandLineReference.rst
clang/include/clang/Driver/Options.td

Removed: 




diff  --git a/clang/docs/ClangCommandLineReference.rst 
b/clang/docs/ClangCommandLineReference.rst
index ac97f6fed935..d8ad75ce 100644
--- a/clang/docs/ClangCommandLineReference.rst
+++ b/clang/docs/ClangCommandLineReference.rst
@@ -1016,7 +1016,12 @@ Flags controlling how ``#include``\s are resolved to 
files.
 
 .. option:: -I, --include-directory , --include-directory=
 
-Add directory to include search path. If there are multiple -I options, these 
directories are searched in the order they are given before the standard system 
directories are searched. If the same directory is in the SYSTEM include search 
paths, for example if also specified with -isystem, the -I option will be 
ignored
+Add directory to include search path. For C++ input, if
+there are multiple -I options, these directories are searched
+in the order they are given before the standard system directories
+are searched. If the same directory is in the SYSTEM include search
+paths, for example if also specified with -isystem, the -I option
+will be ignored
 
 .. option:: -I-, --include-barrier
 

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index b441c1b4c169..acc3db40bdc7 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -651,12 +651,13 @@ def I_ : Flag<["-"], "I-">, Group,
  "remove current directory from include path">;
 def I : JoinedOrSeparate<["-"], "I">, Group,
 Flags<[CC1Option,CC1AsOption]>, MetaVarName<"">,
-HelpText<"Add directory to include search path. If there are multiple -I "
- "options, these directories are searched in the order they are "
- "given before the standard system directories are searched. "
- "If the same directory is in the SYSTEM include search paths, for 
"
- "example if also specified with -isystem, the -I option will be "
- "ignored">;
+HelpText<"Add directory to the end of the list of include search paths">,
+DocBrief<[{Add directory to include search path. For C++ inputs, if
+there are multiple -I options, these directories are searched
+in the order they are given before the standard system directories
+are searched. If the same directory is in the SYSTEM include search
+paths, for example if also specified with -isystem, the -I option
+will be ignored}]>;
 def L : JoinedOrSeparate<["-"], "L">, Flags<[RenderJoined]>, Group,
 MetaVarName<"">, HelpText<"Add directory to library search path">;
 def MD : Flag<["-"], "MD">, Group,



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


[PATCH] D94169: [clang][driver] Restore the original help text for `-I`

2021-01-13 Thread Andrzej Warzynski via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGcbea6737d513: [clang][driver] Restore the original help text 
for `-I` (authored by awarzynski).

Changed prior to commit:
  https://reviews.llvm.org/D94169?vs=316074&id=316342#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94169

Files:
  clang/docs/ClangCommandLineReference.rst
  clang/include/clang/Driver/Options.td


Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -651,12 +651,13 @@
  "remove current directory from include path">;
 def I : JoinedOrSeparate<["-"], "I">, Group,
 Flags<[CC1Option,CC1AsOption]>, MetaVarName<"">,
-HelpText<"Add directory to include search path. If there are multiple -I "
- "options, these directories are searched in the order they are "
- "given before the standard system directories are searched. "
- "If the same directory is in the SYSTEM include search paths, for 
"
- "example if also specified with -isystem, the -I option will be "
- "ignored">;
+HelpText<"Add directory to the end of the list of include search paths">,
+DocBrief<[{Add directory to include search path. For C++ inputs, if
+there are multiple -I options, these directories are searched
+in the order they are given before the standard system directories
+are searched. If the same directory is in the SYSTEM include search
+paths, for example if also specified with -isystem, the -I option
+will be ignored}]>;
 def L : JoinedOrSeparate<["-"], "L">, Flags<[RenderJoined]>, Group,
 MetaVarName<"">, HelpText<"Add directory to library search path">;
 def MD : Flag<["-"], "MD">, Group,
Index: clang/docs/ClangCommandLineReference.rst
===
--- clang/docs/ClangCommandLineReference.rst
+++ clang/docs/ClangCommandLineReference.rst
@@ -1016,7 +1016,12 @@
 
 .. option:: -I, --include-directory , --include-directory=
 
-Add directory to include search path. If there are multiple -I options, these 
directories are searched in the order they are given before the standard system 
directories are searched. If the same directory is in the SYSTEM include search 
paths, for example if also specified with -isystem, the -I option will be 
ignored
+Add directory to include search path. For C++ input, if
+there are multiple -I options, these directories are searched
+in the order they are given before the standard system directories
+are searched. If the same directory is in the SYSTEM include search
+paths, for example if also specified with -isystem, the -I option
+will be ignored
 
 .. option:: -I-, --include-barrier
 


Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -651,12 +651,13 @@
  "remove current directory from include path">;
 def I : JoinedOrSeparate<["-"], "I">, Group,
 Flags<[CC1Option,CC1AsOption]>, MetaVarName<"">,
-HelpText<"Add directory to include search path. If there are multiple -I "
- "options, these directories are searched in the order they are "
- "given before the standard system directories are searched. "
- "If the same directory is in the SYSTEM include search paths, for "
- "example if also specified with -isystem, the -I option will be "
- "ignored">;
+HelpText<"Add directory to the end of the list of include search paths">,
+DocBrief<[{Add directory to include search path. For C++ inputs, if
+there are multiple -I options, these directories are searched
+in the order they are given before the standard system directories
+are searched. If the same directory is in the SYSTEM include search
+paths, for example if also specified with -isystem, the -I option
+will be ignored}]>;
 def L : JoinedOrSeparate<["-"], "L">, Flags<[RenderJoined]>, Group,
 MetaVarName<"">, HelpText<"Add directory to library search path">;
 def MD : Flag<["-"], "MD">, Group,
Index: clang/docs/ClangCommandLineReference.rst
===
--- clang/docs/ClangCommandLineReference.rst
+++ clang/docs/ClangCommandLineReference.rst
@@ -1016,7 +1016,12 @@
 
 .. option:: -I, --include-directory , --include-directory=
 
-Add directory to include search path. If there are multiple -I options, these directories are searched in the order they are given before the standard system directories are searched. If the same directory is in the SYSTEM include search paths, for example if also specified with -isystem, the -I option will be ignored
+Add directory to include search path.

[PATCH] D94169: [clang][driver] Restore the original help text for `-I`

2021-01-13 Thread Andrzej Warzynski via Phabricator via cfe-commits
awarzynski added a comment.

I have now merged this into `main`. I updated the commit message based on the 
discussion here, but kept the original **SUMMARY** above (just in case people 
are confused by the inconsistency).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94169

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


[PATCH] D93224: [RFC][analyzer] Use the MacroExpansionContext for macro expansions in plists

2021-01-13 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment.

In D93224#2493710 , @steakhal wrote:

> In D93224#2493515 , @xazax.hun wrote:
>
>> Could you validate that this solution works for the latter [ctu-on-demand]?
>
> Sure, I suspect that will have the required PP events since the Preprocessor 
> is parsing source code :D
> I'm going to check this just to be sure.

On-demand parsing does indeed populate the required PP events.
The 4-th element of this patch stack will aim to implement macro expansions for 
that scenario.

In D93224#2493515 , @xazax.hun wrote:

> If we really want to make it work for the CTU mode with dumps, we could dump 
> the macro expansions to a separate file together with the AST and read it 
> back for the error reporting.

I don't know. Theoretically yes, but I'm not sure how much of a breaking change 
would it be.
Do we really promise ABI compatibility for AST dumps? If we support it to some 
extent, then we would have a problem - which would mean that we can not target 
clang-12 anymore with this patch stack.


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

https://reviews.llvm.org/D93224

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


[PATCH] D94237: [clang] Use SourceLocations in unions [NFCI]

2021-01-13 Thread Mikhail Maltsev via Phabricator via cfe-commits
miyuki added a comment.

In D94237#2493844 , @dblaikie wrote:

> Do you need to run the destructor before placement new in these situations?

No, because there is no active union member in any of those situations. And if 
even if there was an active member, all destructors are trivial anyway.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94237

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


[PATCH] D94554: [clangd][WIP] Add a Filesystem that overlays Dirty files.

2021-01-13 Thread Nathan James via Phabricator via cfe-commits
njames93 updated this revision to Diff 316357.
njames93 added a comment.

Remove some unrelated changes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94554

Files:
  clang-tools-extra/clangd/ClangdLSPServer.cpp
  clang-tools-extra/clangd/ClangdServer.cpp
  clang-tools-extra/clangd/ClangdServer.h
  clang-tools-extra/clangd/DraftStore.cpp
  clang-tools-extra/clangd/DraftStore.h
  clang-tools-extra/clangd/TUScheduler.cpp
  clang-tools-extra/clangd/TUScheduler.h
  clang-tools-extra/clangd/refactor/Rename.cpp
  clang-tools-extra/clangd/refactor/Rename.h
  clang-tools-extra/clangd/refactor/Tweak.cpp
  clang-tools-extra/clangd/refactor/Tweak.h
  clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
  clang-tools-extra/clangd/tool/Check.cpp
  clang-tools-extra/clangd/tool/ClangdMain.cpp
  clang-tools-extra/clangd/unittests/DraftStoreTests.cpp
  clang-tools-extra/clangd/unittests/RenameTests.cpp
  clang-tools-extra/clangd/unittests/tweaks/TweakTesting.cpp

Index: clang-tools-extra/clangd/unittests/tweaks/TweakTesting.cpp
===
--- clang-tools-extra/clangd/unittests/tweaks/TweakTesting.cpp
+++ clang-tools-extra/clangd/unittests/tweaks/TweakTesting.cpp
@@ -74,7 +74,8 @@
   SelectionTree::createEach(AST.getASTContext(), AST.getTokens(), Range.first,
 Range.second, [&](SelectionTree ST) {
   Tweak::Selection S(Index, AST, Range.first,
- Range.second, std::move(ST));
+ Range.second, std::move(ST),
+ nullptr);
   if (auto T = prepareTweak(TweakID, S)) {
 Result = (*T)->apply(S);
 return true;
Index: clang-tools-extra/clangd/unittests/RenameTests.cpp
===
--- clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -33,6 +33,19 @@
 using testing::UnorderedElementsAre;
 using testing::UnorderedElementsAreArray;
 
+llvm::IntrusiveRefCntPtr
+createOverlay(llvm::IntrusiveRefCntPtr Base,
+  llvm::IntrusiveRefCntPtr Overlay) {
+  auto OFS =
+  llvm::makeIntrusiveRefCnt(std::move(Base));
+  OFS->pushOverlay(std::move(Overlay));
+  return OFS;
+}
+
+llvm::IntrusiveRefCntPtr getVFSFromAST(ParsedAST &AST) {
+  return &AST.getSourceManager().getFileManager().getVirtualFileSystem();
+}
+
 // Convert a Range to a Ref.
 Ref refWithRange(const clangd::Range &Range, const std::string &URI) {
   Ref Result;
@@ -833,8 +846,8 @@
 TU.ExtraArgs.push_back("-xobjective-c++");
 auto AST = TU.build();
 for (const auto &RenamePos : Code.points()) {
-  auto RenameResult =
-  rename({RenamePos, NewName, AST, testPath(TU.Filename)});
+  auto RenameResult = rename(
+  {RenamePos, NewName, AST, testPath(TU.Filename), getVFSFromAST(AST)});
   ASSERT_TRUE(bool(RenameResult)) << RenameResult.takeError();
   ASSERT_EQ(1u, RenameResult->GlobalChanges.size());
   EXPECT_EQ(
@@ -1040,8 +1053,8 @@
 }
 auto AST = TU.build();
 llvm::StringRef NewName = Case.NewName;
-auto Results =
-rename({T.point(), NewName, AST, testPath(TU.Filename), Case.Index});
+auto Results = rename({T.point(), NewName, AST, testPath(TU.Filename),
+   getVFSFromAST(AST), Case.Index});
 bool WantRename = true;
 if (T.ranges().empty())
   WantRename = false;
@@ -1081,8 +1094,8 @@
   auto AST = TU.build();
   llvm::StringRef NewName = "abcde";
 
-  auto RenameResult =
-  rename({Code.point(), NewName, AST, testPath(TU.Filename)});
+  auto RenameResult = rename(
+  {Code.point(), NewName, AST, testPath(TU.Filename), getVFSFromAST(AST)});
   ASSERT_TRUE(bool(RenameResult)) << RenameResult.takeError() << Code.point();
   ASSERT_EQ(1u, RenameResult->GlobalChanges.size());
   EXPECT_EQ(applyEdits(std::move(RenameResult->GlobalChanges)).front().second,
@@ -1098,7 +,8 @@
   )cpp";
   TU.HeaderFilename = "protobuf.pb.h";
   auto AST = TU.build();
-  auto Results = rename({Code.point(), "newName", AST, testPath(TU.Filename)});
+  auto Results = rename({Code.point(), "newName", AST, testPath(TU.Filename),
+ getVFSFromAST(AST)});
   EXPECT_FALSE(Results);
   EXPECT_THAT(llvm::toString(Results.takeError()),
   testing::HasSubstr("not a supported kind"));
@@ -1170,12 +1184,10 @@
 
   Annotations MainCode("class  [[Fo^o]] {};");
   auto MainFilePath = testPath("main.cc");
-  // Dirty buffer for foo.cc.
-  auto GetDirtyBuffer = [&](PathRef Path) -> llvm::Optional {
-if (Path == FooPath)
-  return FooDirtyBuffer.code().str();
-return llvm::None;
-  };
+  llvm::Intrusi

[PATCH] D93101: [Clang][Codegen] Truncate initializers of union bitfield members

2021-01-13 Thread Joe Ellis via Phabricator via cfe-commits
joechrisellis added inline comments.



Comment at: clang/lib/AST/ExprConstant.cpp:9803-9804
+   (Field->isBitField() &&
+truncateBitfieldValue(Info, InitExpr, Result.getUnionValue(),
+  Field));
   }

nit: I would prefer this:

```
if (Field->isBitField() && truncateBitfieldValue(Info, InitExpr, 
Result.getUnionValue(), Field))
return true;

return EvaluateInPlace(Result.getUnionValue(), Info, Subobject, InitExpr);
```

It feels more in-line with the rest of the function. But it is okay if you want 
to ignore this too. 😄 



Comment at: clang/test/CodeGenCXX/bitfield-layout.cpp:88-95
+// CHECK: define i32 @_Z10test_truncv()
+int test_trunc() {
+  union {
+int i : 4;
+  } U = {15};
+  return U.i;
+  // CHECK: ret i32 -1

I'd like to see some more tests that check the truncation behaviour. My 
understanding is that this is trucating to -1 because of two's complement? How 
about something like:

```
int test_trunc() {
union {
int i : 4;
} U = {80};
return U.i;
// CHECK: ret i32 0
}
```

Am I understanding the behaviour correctly?

Some comments about what is actually happening on the bit-level to get this 
result would also be nice.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93101

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


[PATCH] D93224: [RFC][analyzer] Use the MacroExpansionContext for macro expansions in plists

2021-01-13 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a comment.

In D93224#2495404 , @steakhal wrote:

> Do we really promise ABI compatibility for AST dumps? If we support it to 
> some extent, then we would have a problem - which would mean that we can not 
> target clang-12 anymore with this patch stack.

I don't think so. As far as I remember we only support consuming AST dumps that 
were generated with the same version of the compiler. When a compiler is 
upgraded the user is expected to regenerate all the dumps.


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

https://reviews.llvm.org/D93224

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


[PATCH] D93986: [clang-format] Add the possibility to align assignments spanning empty lines or comments

2021-01-13 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

I think I would remove the code examples from the "AlignConsecutive style" to 
avoid confusion (that would be the first change)

then perhaps regenerate and update the documentation so we can then see, its 
seems most have a "code block", can the specific examples not go into that area?

And just have the enum explain its different configuration options?

  /// \brief If ``true``, aligns consecutive C/C++ preprocessor macros.
  ///
  /// This will align C/C++ preprocessor macros of consecutive lines.
  /// Will result in formattings like
  /// \code
  ///   #define SHORT_NAME   42
  ///   #define LONGER_NAME  0x007f
  ///   #define EVEN_LONGER_NAME (2)
  ///   #define foo(x)   (x * x)
  ///   #define bar(y, z)(y + z)
  /// \endcode
  bool AlignConsecutiveMacros;


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93986

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


[PATCH] D94596: [clang][AST] Encapsulate DeclarationNameLoc, NFCI

2021-01-13 Thread Mikhail Maltsev via Phabricator via cfe-commits
miyuki created this revision.
miyuki added reviewers: aprantl, dexonsmith, rsmith, faisalv.
Herald added a subscriber: arphaman.
miyuki requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This change makes `DeclarationNameLoc` a proper class and refactors its
users to use getter methods instead of accessing the members directly.
The change also makes `DeclarationNameLoc` immutable (i.e., it cannot
be modified once constructed).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94596

Files:
  clang/include/clang/AST/DeclarationName.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/DeclarationName.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaLambda.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/tools/libclang/CIndex.cpp

Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -3351,10 +3351,8 @@
 Pieces.push_back(*TemplateArgsLoc);
 
   if (Kind == DeclarationName::CXXOperatorName) {
-Pieces.push_back(SourceLocation::getFromRawEncoding(
-NI.getInfo().CXXOperatorName.BeginOpNameLoc));
-Pieces.push_back(SourceLocation::getFromRawEncoding(
-NI.getInfo().CXXOperatorName.EndOpNameLoc));
+Pieces.push_back(NI.getInfo().getCXXOperatorNameBeginLoc());
+Pieces.push_back(NI.getInfo().getCXXOperatorNameEndLoc());
   }
 
   if (WantSinglePiece) {
Index: clang/lib/Serialization/ASTWriter.cpp
===
--- clang/lib/Serialization/ASTWriter.cpp
+++ clang/lib/Serialization/ASTWriter.cpp
@@ -5406,19 +5406,15 @@
   case DeclarationName::CXXConstructorName:
   case DeclarationName::CXXDestructorName:
   case DeclarationName::CXXConversionFunctionName:
-AddTypeSourceInfo(DNLoc.NamedType.TInfo);
+AddTypeSourceInfo(DNLoc.getNamedTypeInfo());
 break;
 
   case DeclarationName::CXXOperatorName:
-AddSourceLocation(SourceLocation::getFromRawEncoding(
-DNLoc.CXXOperatorName.BeginOpNameLoc));
-AddSourceLocation(
-SourceLocation::getFromRawEncoding(DNLoc.CXXOperatorName.EndOpNameLoc));
+AddSourceRange(DNLoc.getCXXOperatorNameRange());
 break;
 
   case DeclarationName::CXXLiteralOperatorName:
-AddSourceLocation(SourceLocation::getFromRawEncoding(
-DNLoc.CXXLiteralOperatorName.OpNameLoc));
+AddSourceLocation(DNLoc.getCXXLiteralOperatorNameLoc());
 break;
 
   case DeclarationName::Identifier:
Index: clang/lib/Serialization/ASTReader.cpp
===
--- clang/lib/Serialization/ASTReader.cpp
+++ clang/lib/Serialization/ASTReader.cpp
@@ -8704,25 +8704,18 @@
 
 DeclarationNameLoc
 ASTRecordReader::readDeclarationNameLoc(DeclarationName Name) {
-  DeclarationNameLoc DNLoc;
   switch (Name.getNameKind()) {
   case DeclarationName::CXXConstructorName:
   case DeclarationName::CXXDestructorName:
   case DeclarationName::CXXConversionFunctionName:
-DNLoc.NamedType.TInfo = readTypeSourceInfo();
-break;
+return DeclarationNameLoc::makeNamedTypeLoc(readTypeSourceInfo());
 
   case DeclarationName::CXXOperatorName:
-DNLoc.CXXOperatorName.BeginOpNameLoc
-  = readSourceLocation().getRawEncoding();
-DNLoc.CXXOperatorName.EndOpNameLoc
-  = readSourceLocation().getRawEncoding();
-break;
+return DeclarationNameLoc::makeCXXOperatorNameLoc(readSourceRange());
 
   case DeclarationName::CXXLiteralOperatorName:
-DNLoc.CXXLiteralOperatorName.OpNameLoc
-  = readSourceLocation().getRawEncoding();
-break;
+return DeclarationNameLoc::makeCXXLiteralOperatorNameLoc(
+readSourceLocation());
 
   case DeclarationName::Identifier:
   case DeclarationName::ObjCZeroArgSelector:
@@ -8732,7 +8725,7 @@
   case DeclarationName::CXXDeductionGuideName:
 break;
   }
-  return DNLoc;
+  return DeclarationNameLoc();
 }
 
 DeclarationNameInfo ASTRecordReader::readDeclarationNameInfo() {
Index: clang/lib/Sema/TreeTransform.h
===
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -14334,11 +14334,9 @@
 SourceLocation RBrace;
 
 if (DeclRefExpr *DRE = dyn_cast(Callee)) {
-DeclarationNameLoc NameLoc = DRE->getNameInfo().getInfo();
-LBrace = SourceLocation::getFromRawEncoding(
-NameLoc.CXXOperatorName.BeginOpNameLoc);
-RBrace = SourceLocation::getFromRawEncoding(
-NameLoc.CXXOperatorName.EndOpNameLoc);
+  DeclarationNameLoc NameLoc = DRE->getNameInfo().getInfo();
+  LBrace = NameLoc.getCXXOperatorNameBeginLoc();
+  RBrace = NameLoc.getCXXOperatorNameEndLoc();
 } else {
   LBrace = Callee->getBeginLoc();
   RBrace = OpLoc;
Index: clang/lib/Sema/SemaLambda.c

[PATCH] D69903: [Basic] Introduce PODSourceLocation, NFCI

2021-01-13 Thread Mikhail Maltsev via Phabricator via cfe-commits
miyuki abandoned this revision.
miyuki added a comment.

Abandoning in favor of D94237  and D94596 
.


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

https://reviews.llvm.org/D69903

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


[PATCH] D94500: Rework Whitesmiths mode to use line-level values in UnwrappedLineParser

2021-01-13 Thread Tim Wojtulewicz via Phabricator via cfe-commits
timwoj added a comment.

This fixes https://bugs.llvm.org/show_bug.cgi?id=48569, amongst other things.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94500

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


[PATCH] D94424: [clangd] Make AST-based signals available to runWithPreamble.

2021-01-13 Thread Utkarsh Saxena via Phabricator via cfe-commits
usaxena95 updated this revision to Diff 316379.
usaxena95 marked 4 inline comments as done.
usaxena95 added a comment.

Addressed comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94424

Files:
  clang-tools-extra/clangd/TUScheduler.cpp
  clang-tools-extra/clangd/TUScheduler.h
  clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp

Index: clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
===
--- clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
+++ clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
@@ -14,6 +14,7 @@
 #include "Preamble.h"
 #include "TUScheduler.h"
 #include "TestFS.h"
+#include "TestIndex.h"
 #include "support/Cancellation.h"
 #include "support/Context.h"
 #include "support/Path.h"
@@ -42,12 +43,14 @@
 namespace clangd {
 namespace {
 
+using ::testing::_;
 using ::testing::AnyOf;
 using ::testing::Each;
 using ::testing::ElementsAre;
 using ::testing::Eq;
 using ::testing::Field;
 using ::testing::IsEmpty;
+using ::testing::Pair;
 using ::testing::Pointee;
 using ::testing::SizeIs;
 using ::testing::UnorderedElementsAre;
@@ -679,12 +682,12 @@
 cantFail(std::move(Preamble)).Preamble->Preamble.getBounds().Size,
 0u);
   });
-  // Wait for the preamble is being built.
+  // Wait while the preamble is being built.
   ASSERT_TRUE(S.blockUntilIdle(timeoutSeconds(10)));
 
   // Update the file which results in an empty preamble.
   S.update(Foo, getInputs(Foo, WithEmptyPreamble), WantDiagnostics::Auto);
-  // Wait for the preamble is being built.
+  // Wait while the preamble is being built.
   ASSERT_TRUE(S.blockUntilIdle(timeoutSeconds(10)));
   S.runWithPreamble(
   "getEmptyPreamble", Foo, TUScheduler::Stale,
@@ -696,6 +699,73 @@
   });
 }
 
+TEST_F(TUSchedulerTests, ASTSignals) {
+  TUScheduler S(CDB, optsForTest());
+  auto Foo = testPath("foo.cpp");
+  auto Header = testPath("foo.h");
+
+  FS.Files[Header] = R"cpp(
+  #define ADD(x, y, z) (x + y + z)
+  namespace tar {  // A related namespace.
+  int kConst = 5;
+  int foo();
+  void bar();  // Unused symbols are not recorded.
+  class X {
+public: int Y;
+  };
+  } // namespace tar
+  namespace ns1::ns2 { int fooInNS2(); }}
+  )cpp";
+  const char *Contents = R"cpp(
+  #include "foo.h"
+  namespace ns1 {
+  namespace ns2 {
+  namespace {
+  int func() {
+tar::X a;
+a.Y = 1;
+return ADD(tar::kConst, a.Y, tar::foo()) + fooInNS2();
+  }
+  } // namespace
+  } // namespace ns2
+  } // namespace ns1
+  )cpp";
+  // Update the file which results in an empty preamble.
+  S.update(Foo, getInputs(Foo, Contents), WantDiagnostics::Yes);
+  // Wait while the preamble is being built.
+  ASSERT_TRUE(S.blockUntilIdle(timeoutSeconds(10)));
+  Notification TaskRun;
+  S.runWithPreamble(
+  "ASTSignals", Foo, TUScheduler::Stale,
+  [&](Expected IP) {
+ASSERT_FALSE(!IP);
+std::vector> NS;
+for (const auto &P : IP->Signals->RelatedNamespaces)
+  NS.emplace_back(P.getKey(), P.getValue());
+EXPECT_THAT(NS, UnorderedElementsAre(Pair("ns1::", 1),
+ Pair("ns1::ns2::", 1),
+ Pair("tar::", 3)));
+
+std::vector> Sym;
+for (const auto &P : IP->Signals->Symbols)
+  Sym.emplace_back(P.getFirst(), P.getSecond());
+EXPECT_THAT(
+Sym,
+UnorderedElementsAre(
+Pair(ns("tar").ID, 3), Pair(ns("ns1").ID, 1),
+Pair(ns("ns1::ns2").ID, 1), Pair(_ /*int func();*/, 1),
+Pair(cls("tar::X").ID, 1), Pair(var("tar::kConst").ID, 1),
+Pair(func("tar::foo").ID, 1),
+Pair(func("ns1::ns2::fooInNS2").ID, 1),
+Pair(sym("Y", index::SymbolKind::Variable, "@N@tar@S@X@FI@\\0")
+ .ID,
+ 2),
+Pair(_ /*a*/, 3)));
+TaskRun.notify();
+  });
+  TaskRun.wait();
+}
+
 TEST_F(TUSchedulerTests, RunWaitsForPreamble) {
   // Testing strategy: we update the file and schedule a few preamble reads at
   // the same time. All reads should get the same non-null preamble.
Index: clang-tools-extra/clangd/TUScheduler.h
===
--- clang-tools-extra/clangd/TUScheduler.h
+++ clang-tools-extra/clangd/TUScheduler.h
@@ -13,10 +13,12 @@
 #include "Diagnostics.h"
 #include "GlobalCompilationDatabase.h"
 #include "index/CanonicalIncludes.h"
+#include "index/SymbolID.h"
 #include "support/Function.h"
 #include "support/MemoryTree.h"
 #include "support/Path.h"
 #include "support/Threading.h"
+#include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringMap.h"
@@ -33,6 +35,14 @@
 /// synchronously).
 unsigned getDefaultAsyncThrea

[PATCH] D94424: [clangd] Make AST-based signals available to runWithPreamble.

2021-01-13 Thread Utkarsh Saxena via Phabricator via cfe-commits
usaxena95 added inline comments.



Comment at: clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp:720
+  #include "foo.h"
+  namespace ns1 {
+  namespace ns2 {

adamcz wrote:
> Can you add anonymous namespaces as well?
Good point. Avoided capturing anonymous namespaces.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94424

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


[clang] 7c77b53 - [OpenCL] Improve OpenCL operator tests

2021-01-13 Thread Sven van Haastregt via cfe-commits

Author: Sven van Haastregt
Date: 2021-01-13T14:50:49Z
New Revision: 7c77b536efdd953d6d97bffbd9ca320c517b26d7

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

LOG: [OpenCL] Improve OpenCL operator tests

Extend testing of increment/decrement operators and make sure these
operators are tested in only one dedicated test file.

Rename logical-ops.cl to operators.cl, as it was already containing
more than just logical operators.

Add testing for the remainder operator on floating point types.

Added: 
clang/test/SemaOpenCL/operators.cl

Modified: 
clang/test/SemaOpenCL/invalid-vector-literals.cl
clang/test/SemaOpenCL/vector_inc_dec_ops.cl

Removed: 
clang/test/SemaOpenCL/logical-ops.cl



diff  --git a/clang/test/SemaOpenCL/invalid-vector-literals.cl 
b/clang/test/SemaOpenCL/invalid-vector-literals.cl
index 4e502aad3bad..1d82fedf29de 100644
--- a/clang/test/SemaOpenCL/invalid-vector-literals.cl
+++ b/clang/test/SemaOpenCL/invalid-vector-literals.cl
@@ -8,7 +8,6 @@ void vector_literals_invalid()
 {
   int4 a = (int4)(1,2,3); // expected-error{{too few elements}}
   int4 b = (int4)(1,2,3,4,5); // expected-error{{excess elements in vector}}
-  ((float4)(1.0f))++; // expected-error{{cannot increment value of type 
'float4'}}
   int8 d = (int8)(a,(float4)(1)); // expected-error{{initializing 'int' with 
an expression of incompatible type 'float4'}}
   ((int4)(0)).x = 8; // expected-error{{expression is not assignable}}
 }

diff  --git a/clang/test/SemaOpenCL/logical-ops.cl 
b/clang/test/SemaOpenCL/operators.cl
similarity index 90%
rename from clang/test/SemaOpenCL/logical-ops.cl
rename to clang/test/SemaOpenCL/operators.cl
index f6972c46e2ad..cf359acd5acb 100644
--- a/clang/test/SemaOpenCL/logical-ops.cl
+++ b/clang/test/SemaOpenCL/operators.cl
@@ -36,6 +36,8 @@ kernel void float_ops() {
 #if __OPENCL_C_VERSION__ < 120
 // expected-error@-2{{invalid argument type}}
 #endif
+  float fcst = 5.5f;
+  float fremainder = fcst % 2.0f; // expected-error {{invalid operands to 
binary expression}}
 }
 
 kernel void vec_float_ops() {
@@ -56,6 +58,8 @@ kernel void vec_float_ops() {
 #if __OPENCL_C_VERSION__ < 120
 // expected-error@-2{{invalid argument type}}
 #endif
+  float4 f4cst = (float4)(5.5f, 5.5f, 5.5f, 5.5f);
+  float4 f4remainder = f4cst % (float4)(2.0f, 2.0f, 2.0f, 2.0f); // 
expected-error {{invalid operands to binary expression}}
 }
 
 kernel void double_ops() {
@@ -85,6 +89,8 @@ kernel void double_ops() {
 #if __OPENCL_C_VERSION__ < 120
 // expected-error@-2{{invalid argument type}}
 #endif
+  double dcst = 5.5;
+  double dremainder = dcst % 2.0; // expected-error {{invalid operands to 
binary expression}}
 }
 
 kernel void vec_double_ops() {

diff  --git a/clang/test/SemaOpenCL/vector_inc_dec_ops.cl 
b/clang/test/SemaOpenCL/vector_inc_dec_ops.cl
index c65bbcb5b749..533253ee696f 100644
--- a/clang/test/SemaOpenCL/vector_inc_dec_ops.cl
+++ b/clang/test/SemaOpenCL/vector_inc_dec_ops.cl
@@ -1,9 +1,9 @@
 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
-// expected-no-diagnostics
 
 typedef __attribute__((ext_vector_type(2)))  char char2;
 typedef __attribute__((ext_vector_type(4)))  unsigned int uint4;
 typedef __attribute__((ext_vector_type(8)))  long long8;
+typedef __attribute__((ext_vector_type(4)))  float float4;
 
 void vectorIncrementDecrementOps()
 {
@@ -17,3 +17,10 @@ void vectorIncrementDecrementOps()
   ++B;
   C++;
 }
+
+void invalidIncrementDecrementOps() {
+  ((float4)(1.0f))++; // expected-error{{cannot increment value of type 
'float4'}}
+  float4 i;
+  ++i; // expected-error{{cannot increment value of type '__private float4'}}
+  i--; // expected-error{{cannot decrement value of type '__private float4'}}
+}



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


[PATCH] D94599: [clang][Tooling] Get rid of a hack in SymbolOccurrences, NFCI

2021-01-13 Thread Mikhail Maltsev via Phabricator via cfe-commits
miyuki created this revision.
miyuki added reviewers: aprantl, dexonsmith, arphaman.
miyuki requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The class `SymbolOccurrences` can store either a single `SourceRange`
in-place or multiple `SourceRanges` on the heap. In the latter case
the number of source ranges is stored in the internal representation
of the beginning `SourceLocation` of the in-place `SourceRange`
object.

This change gets rid of such hack by placing `SourceRange` in a union
which holds either a valid `SourceRange` or an `unsigned int` (a number
of ranges).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94599

Files:
  clang/include/clang/Tooling/Refactoring/Rename/SymbolOccurrences.h
  clang/lib/Tooling/Refactoring/Rename/SymbolOccurrences.cpp


Index: clang/lib/Tooling/Refactoring/Rename/SymbolOccurrences.cpp
===
--- clang/lib/Tooling/Refactoring/Rename/SymbolOccurrences.cpp
+++ clang/lib/Tooling/Refactoring/Rename/SymbolOccurrences.cpp
@@ -21,13 +21,12 @@
  "mismatching number of locations and lengths");
   assert(!Locations.empty() && "no locations");
   if (Locations.size() == 1) {
-RangeOrNumRanges = SourceRange(
+new (&SingleRange) SourceRange(
 Locations[0], Locations[0].getLocWithOffset(NamePieces[0].size()));
 return;
   }
   MultipleRanges = std::make_unique(Locations.size());
-  RangeOrNumRanges.setBegin(
-  SourceLocation::getFromRawEncoding(Locations.size()));
+  NumRanges = Locations.size();
   for (const auto &Loc : llvm::enumerate(Locations)) {
 MultipleRanges[Loc.index()] = SourceRange(
 Loc.value(),
Index: clang/include/clang/Tooling/Refactoring/Rename/SymbolOccurrences.h
===
--- clang/include/clang/Tooling/Refactoring/Rename/SymbolOccurrences.h
+++ clang/include/clang/Tooling/Refactoring/Rename/SymbolOccurrences.h
@@ -69,17 +69,18 @@
   OccurrenceKind getKind() const { return Kind; }
 
   ArrayRef getNameRanges() const {
-if (MultipleRanges) {
-  return llvm::makeArrayRef(MultipleRanges.get(),
-RangeOrNumRanges.getBegin().getRawEncoding());
-}
-return RangeOrNumRanges;
+if (MultipleRanges)
+  return llvm::makeArrayRef(MultipleRanges.get(), NumRanges);
+return SingleRange;
   }
 
 private:
   OccurrenceKind Kind;
   std::unique_ptr MultipleRanges;
-  SourceRange RangeOrNumRanges;
+  union {
+SourceRange SingleRange;
+unsigned NumRanges;
+  };
 };
 
 using SymbolOccurrences = std::vector;


Index: clang/lib/Tooling/Refactoring/Rename/SymbolOccurrences.cpp
===
--- clang/lib/Tooling/Refactoring/Rename/SymbolOccurrences.cpp
+++ clang/lib/Tooling/Refactoring/Rename/SymbolOccurrences.cpp
@@ -21,13 +21,12 @@
  "mismatching number of locations and lengths");
   assert(!Locations.empty() && "no locations");
   if (Locations.size() == 1) {
-RangeOrNumRanges = SourceRange(
+new (&SingleRange) SourceRange(
 Locations[0], Locations[0].getLocWithOffset(NamePieces[0].size()));
 return;
   }
   MultipleRanges = std::make_unique(Locations.size());
-  RangeOrNumRanges.setBegin(
-  SourceLocation::getFromRawEncoding(Locations.size()));
+  NumRanges = Locations.size();
   for (const auto &Loc : llvm::enumerate(Locations)) {
 MultipleRanges[Loc.index()] = SourceRange(
 Loc.value(),
Index: clang/include/clang/Tooling/Refactoring/Rename/SymbolOccurrences.h
===
--- clang/include/clang/Tooling/Refactoring/Rename/SymbolOccurrences.h
+++ clang/include/clang/Tooling/Refactoring/Rename/SymbolOccurrences.h
@@ -69,17 +69,18 @@
   OccurrenceKind getKind() const { return Kind; }
 
   ArrayRef getNameRanges() const {
-if (MultipleRanges) {
-  return llvm::makeArrayRef(MultipleRanges.get(),
-RangeOrNumRanges.getBegin().getRawEncoding());
-}
-return RangeOrNumRanges;
+if (MultipleRanges)
+  return llvm::makeArrayRef(MultipleRanges.get(), NumRanges);
+return SingleRange;
   }
 
 private:
   OccurrenceKind Kind;
   std::unique_ptr MultipleRanges;
-  SourceRange RangeOrNumRanges;
+  union {
+SourceRange SingleRange;
+unsigned NumRanges;
+  };
 };
 
 using SymbolOccurrences = std::vector;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D86671: [clang-tidy] Add new case type to check variables with Hungarian notation

2021-01-13 Thread Douglas Chen via Phabricator via cfe-commits
dougpuob added a comment.

Ping @njames93


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86671

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


[clang-tools-extra] 90164ba - [clangd] Split out a base class for delegating GlobalCompilationDatabases. NFC

2021-01-13 Thread Sam McCall via cfe-commits

Author: Sam McCall
Date: 2021-01-13T16:20:33+01:00
New Revision: 90164ba957a2532daef6515d7114af69eca025a7

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

LOG: [clangd] Split out a base class for delegating GlobalCompilationDatabases. 
NFC

This prepares for adding another delegatable method (blockUntilIdle) to GCDB.

Added: 


Modified: 
clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
clang-tools-extra/clangd/GlobalCompilationDatabase.h
clang-tools-extra/clangd/QueryDriverDatabase.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp 
b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
index 86375fa11d3b1..9a74ef0d5c2fd 100644
--- a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
+++ b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
@@ -556,13 +556,8 @@ 
DirectoryBasedGlobalCompilationDatabase::getProjectInfo(PathRef File) const {
 OverlayCDB::OverlayCDB(const GlobalCompilationDatabase *Base,
std::vector FallbackFlags,
tooling::ArgumentsAdjuster Adjuster)
-: Base(Base), ArgsAdjuster(std::move(Adjuster)),
-  FallbackFlags(std::move(FallbackFlags)) {
-  if (Base)
-BaseChanged = Base->watch([this](const std::vector Changes) {
-  OnCommandChanged.broadcast(Changes);
-});
-}
+: DelegatingCDB(Base), ArgsAdjuster(std::move(Adjuster)),
+  FallbackFlags(std::move(FallbackFlags)) {}
 
 llvm::Optional
 OverlayCDB::getCompileCommand(PathRef File) const {
@@ -573,8 +568,8 @@ OverlayCDB::getCompileCommand(PathRef File) const {
 if (It != Commands.end())
   Cmd = It->second;
   }
-  if (!Cmd && Base)
-Cmd = Base->getCompileCommand(File);
+  if (!Cmd)
+Cmd = DelegatingCDB::getCompileCommand(File);
   if (!Cmd)
 return llvm::None;
   if (ArgsAdjuster)
@@ -583,8 +578,7 @@ OverlayCDB::getCompileCommand(PathRef File) const {
 }
 
 tooling::CompileCommand OverlayCDB::getFallbackCommand(PathRef File) const {
-  auto Cmd = Base ? Base->getFallbackCommand(File)
-  : GlobalCompilationDatabase::getFallbackCommand(File);
+  auto Cmd = DelegatingCDB::getFallbackCommand(File);
   std::lock_guard Lock(Mutex);
   Cmd.CommandLine.insert(Cmd.CommandLine.end(), FallbackFlags.begin(),
  FallbackFlags.end());
@@ -609,13 +603,37 @@ void OverlayCDB::setCompileCommand(
   OnCommandChanged.broadcast({CanonPath});
 }
 
-llvm::Optional OverlayCDB::getProjectInfo(PathRef File) const {
-  // It wouldn't make much sense to treat files with overridden commands
-  // specially when we can't do the same for the (unknown) local headers they
-  // include or changing behavior mid-air after receiving an override.
+DelegatingCDB::DelegatingCDB(const GlobalCompilationDatabase *Base)
+: Base(Base) {
   if (Base)
-return Base->getProjectInfo(File);
-  return llvm::None;
+BaseChanged = Base->watch([this](const std::vector Changes) {
+  OnCommandChanged.broadcast(Changes);
+});
+}
+
+DelegatingCDB::DelegatingCDB(std::unique_ptr Base)
+: DelegatingCDB(Base.get()) {
+  BaseOwner = std::move(Base);
 }
+
+llvm::Optional
+DelegatingCDB::getCompileCommand(PathRef File) const {
+  if (!Base)
+return llvm::None;
+  return Base->getCompileCommand(File);
+}
+
+llvm::Optional DelegatingCDB::getProjectInfo(PathRef File) const {
+  if (!Base)
+return llvm::None;
+  return Base->getProjectInfo(File);
+}
+
+tooling::CompileCommand DelegatingCDB::getFallbackCommand(PathRef File) const {
+  if (!Base)
+return GlobalCompilationDatabase::getFallbackCommand(File);
+  return Base->getFallbackCommand(File);
+}
+
 } // namespace clangd
 } // namespace clang

diff  --git a/clang-tools-extra/clangd/GlobalCompilationDatabase.h 
b/clang-tools-extra/clangd/GlobalCompilationDatabase.h
index 9fb6f15f13d2f..125bd77a52073 100644
--- a/clang-tools-extra/clangd/GlobalCompilationDatabase.h
+++ b/clang-tools-extra/clangd/GlobalCompilationDatabase.h
@@ -62,6 +62,25 @@ class GlobalCompilationDatabase {
   mutable CommandChanged OnCommandChanged;
 };
 
+// Helper class for implementing GlobalCompilationDatabases that wrap others.
+class DelegatingCDB : public GlobalCompilationDatabase {
+public:
+  DelegatingCDB(const GlobalCompilationDatabase *Base);
+  DelegatingCDB(std::unique_ptr Base);
+
+  llvm::Optional
+  getCompileCommand(PathRef File) const override;
+
+  llvm::Optional getProjectInfo(PathRef File) const override;
+
+  tooling::CompileCommand getFallbackCommand(PathRef File) const override;
+
+private:
+  const GlobalCompilationDatabase *Base;
+  std::unique_ptr BaseOwner;
+  CommandChanged::Subscription BaseChanged;
+};
+
 /// Gets compile args from tooling::CompilationDatabases built for parent
 /// directories.
 class Dir

[PATCH] D94601: [clang-tidy] Use DenseSet in UpgradeDurationConversionsCheck, NFCI

2021-01-13 Thread Mikhail Maltsev via Phabricator via cfe-commits
miyuki created this revision.
miyuki added reviewers: aprantl, dexonsmith, EricWF.
Herald added a subscriber: xazax.hun.
miyuki requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This change replaces `unordered_set` (which used to store
internal representation of `SourceLocation`-s) with
`DenseSet` (which stores `SourceLocation`-s directly).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94601

Files:
  clang-tools-extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.cpp
  clang-tools-extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.h


Index: clang-tools-extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.h
===
--- clang-tools-extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.h
+++ clang-tools-extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.h
@@ -11,7 +11,8 @@
 
 #include "../ClangTidyCheck.h"
 
-#include 
+#include "clang/Basic/SourceLocation.h"
+#include "llvm/ADT/DenseSet.h"
 
 namespace clang {
 namespace tidy {
@@ -32,7 +33,7 @@
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
 
 private:
-  std::unordered_set MatchedTemplateLocations;
+  llvm::DenseSet MatchedTemplateLocations;
 };
 
 } // namespace abseil
Index: clang-tools-extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.cpp
===
--- clang-tools-extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.cpp
+++ clang-tools-extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.cpp
@@ -128,7 +128,7 @@
 
   if (!match(isInTemplateInstantiation(), *OuterExpr, *Result.Context)
.empty()) {
-if (MatchedTemplateLocations.count(Loc.getRawEncoding()) == 0) {
+if (MatchedTemplateLocations.count(Loc) == 0) {
   // For each location matched in a template instantiation, we check if the
   // location can also be found in `MatchedTemplateLocations`. If it is not
   // found, that means the expression did not create a match without the
@@ -144,7 +144,7 @@
   internal::Matcher IsInsideTemplate =
   hasAncestor(decl(anyOf(classTemplateDecl(), functionTemplateDecl(;
   if (!match(IsInsideTemplate, *ArgExpr, *Result.Context).empty())
-MatchedTemplateLocations.insert(Loc.getRawEncoding());
+MatchedTemplateLocations.insert(Loc);
 
   DiagnosticBuilder Diag = diag(Loc, Message);
   CharSourceRange SourceRange = Lexer::makeFileCharRange(


Index: clang-tools-extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.h
===
--- clang-tools-extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.h
+++ clang-tools-extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.h
@@ -11,7 +11,8 @@
 
 #include "../ClangTidyCheck.h"
 
-#include 
+#include "clang/Basic/SourceLocation.h"
+#include "llvm/ADT/DenseSet.h"
 
 namespace clang {
 namespace tidy {
@@ -32,7 +33,7 @@
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
 
 private:
-  std::unordered_set MatchedTemplateLocations;
+  llvm::DenseSet MatchedTemplateLocations;
 };
 
 } // namespace abseil
Index: clang-tools-extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.cpp
===
--- clang-tools-extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.cpp
+++ clang-tools-extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.cpp
@@ -128,7 +128,7 @@
 
   if (!match(isInTemplateInstantiation(), *OuterExpr, *Result.Context)
.empty()) {
-if (MatchedTemplateLocations.count(Loc.getRawEncoding()) == 0) {
+if (MatchedTemplateLocations.count(Loc) == 0) {
   // For each location matched in a template instantiation, we check if the
   // location can also be found in `MatchedTemplateLocations`. If it is not
   // found, that means the expression did not create a match without the
@@ -144,7 +144,7 @@
   internal::Matcher IsInsideTemplate =
   hasAncestor(decl(anyOf(classTemplateDecl(), functionTemplateDecl(;
   if (!match(IsInsideTemplate, *ArgExpr, *Result.Context).empty())
-MatchedTemplateLocations.insert(Loc.getRawEncoding());
+MatchedTemplateLocations.insert(Loc);
 
   DiagnosticBuilder Diag = diag(Loc, Message);
   CharSourceRange SourceRange = Lexer::makeFileCharRange(
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D94603: [clangd] Allow CDBs to have background work to block on.

2021-01-13 Thread Sam McCall via Phabricator via cfe-commits
sammccall created this revision.
sammccall added a reviewer: kadircet.
Herald added subscribers: usaxena95, arphaman.
sammccall requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang.

In preparation for moving DirectoryBasedCompilationDatabase broadcasting off
the main thread.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94603

Files:
  clang-tools-extra/clangd/ClangdServer.cpp
  clang-tools-extra/clangd/ClangdServer.h
  clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
  clang-tools-extra/clangd/GlobalCompilationDatabase.h


Index: clang-tools-extra/clangd/GlobalCompilationDatabase.h
===
--- clang-tools-extra/clangd/GlobalCompilationDatabase.h
+++ clang-tools-extra/clangd/GlobalCompilationDatabase.h
@@ -51,6 +51,10 @@
   /// Clangd should treat the results as unreliable.
   virtual tooling::CompileCommand getFallbackCommand(PathRef File) const;
 
+  /// If the CDB does any asynchronous work, wait for it to complete.
+  /// For use in tests.
+  virtual bool blockUntilIdle(Deadline D) const { return true; }
+
   using CommandChanged = Event>;
   /// The callback is notified when files may have new compile commands.
   /// The argument is a list of full file paths.
@@ -75,6 +79,8 @@
 
   tooling::CompileCommand getFallbackCommand(PathRef File) const override;
 
+  bool blockUntilIdle(Deadline D) const override;
+
 private:
   const GlobalCompilationDatabase *Base;
   std::unique_ptr BaseOwner;
Index: clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
===
--- clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
+++ clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
@@ -635,5 +635,11 @@
   return Base->getFallbackCommand(File);
 }
 
+bool DelegatingCDB::blockUntilIdle(Deadline D) const {
+  if (!Base)
+return true;
+  return Base->blockUntilIdle(D);
+}
+
 } // namespace clangd
 } // namespace clang
Index: clang-tools-extra/clangd/ClangdServer.h
===
--- clang-tools-extra/clangd/ClangdServer.h
+++ clang-tools-extra/clangd/ClangdServer.h
@@ -362,6 +362,7 @@
   Context createProcessingContext(PathRef) const;
   config::Provider *ConfigProvider = nullptr;
 
+  const GlobalCompilationDatabase &CDB;
   const ThreadsafeFS &TFS;
   Callbacks *ServerCallbacks = nullptr;
   mutable std::mutex ConfigDiagnosticsMu;
Index: clang-tools-extra/clangd/ClangdServer.cpp
===
--- clang-tools-extra/clangd/ClangdServer.cpp
+++ clang-tools-extra/clangd/ClangdServer.cpp
@@ -139,7 +139,8 @@
 ClangdServer::ClangdServer(const GlobalCompilationDatabase &CDB,
const ThreadsafeFS &TFS, const Options &Opts,
Callbacks *Callbacks)
-: ConfigProvider(Opts.ConfigProvider), TFS(TFS), 
ServerCallbacks(Callbacks),
+: ConfigProvider(Opts.ConfigProvider), CDB(CDB), TFS(TFS),
+  ServerCallbacks(Callbacks),
   DynamicIdx(Opts.BuildDynamicSymbolIndex
  ? new FileIndex(Opts.HeavyweightDynamicSymbolIndex,
  Opts.CollectMainFileRefs)
@@ -873,6 +874,7 @@
 LLVM_NODISCARD bool
 ClangdServer::blockUntilIdleForTest(llvm::Optional TimeoutSeconds) {
   return WorkScheduler.blockUntilIdle(timeoutSeconds(TimeoutSeconds)) &&
+ CDB.blockUntilIdle(timeoutSeconds(TimeoutSeconds)) &&
  (!BackgroundIdx ||
   BackgroundIdx->blockUntilIdleForTest(TimeoutSeconds));
 }


Index: clang-tools-extra/clangd/GlobalCompilationDatabase.h
===
--- clang-tools-extra/clangd/GlobalCompilationDatabase.h
+++ clang-tools-extra/clangd/GlobalCompilationDatabase.h
@@ -51,6 +51,10 @@
   /// Clangd should treat the results as unreliable.
   virtual tooling::CompileCommand getFallbackCommand(PathRef File) const;
 
+  /// If the CDB does any asynchronous work, wait for it to complete.
+  /// For use in tests.
+  virtual bool blockUntilIdle(Deadline D) const { return true; }
+
   using CommandChanged = Event>;
   /// The callback is notified when files may have new compile commands.
   /// The argument is a list of full file paths.
@@ -75,6 +79,8 @@
 
   tooling::CompileCommand getFallbackCommand(PathRef File) const override;
 
+  bool blockUntilIdle(Deadline D) const override;
+
 private:
   const GlobalCompilationDatabase *Base;
   std::unique_ptr BaseOwner;
Index: clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
===
--- clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
+++ clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
@@ -635,5 +635,11 @@
   return Base->getFallbackCommand(File);
 }
 
+bool DelegatingCDB::blockUntilIdle(Deadline D) const {

[clang] f0abe2a - [Frontend] Add pragma align natural and sort out pragma pack stack effect

2021-01-13 Thread Xiangling Liao via cfe-commits

Author: Xiangling Liao
Date: 2021-01-13T10:53:24-05:00
New Revision: f0abe2aeaca76a24b1e17295ab797068c057a15d

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

LOG: [Frontend] Add pragma align natural and sort out pragma pack stack effect

- Implemente the natural align for XL on AIX
- Sort out pragma pack stack effect
- Add -fxl-pragma-stack option to enable XL on AIX pragma stack effect

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

Added: 
clang/test/Driver/aix-pragma-pack.c
clang/test/Layout/aix-power-natural-interaction.cpp
clang/test/PCH/aix-pragma-pack.c
clang/test/Sema/aix-pragma-pack-and-align.c

Modified: 
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Basic/LangOptions.def
clang/include/clang/Driver/Options.td
clang/include/clang/Sema/Sema.h
clang/include/clang/Serialization/ASTReader.h
clang/include/clang/Serialization/ASTWriter.h
clang/lib/AST/RecordLayoutBuilder.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/lib/Parse/ParsePragma.cpp
clang/lib/Sema/Sema.cpp
clang/lib/Sema/SemaAttr.cpp
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTWriter.cpp
clang/test/Layout/aix-double-struct-member.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/Attr.td 
b/clang/include/clang/Basic/Attr.td
index c51e95fa6fa8..b30b91d3d4a6 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -681,6 +681,13 @@ def AlignMac68k : InheritableAttr {
   let Documentation = [Undocumented];
 }
 
+def AlignNatural : InheritableAttr {
+  // This attribute has no spellings as it is only ever created implicitly.
+  let Spellings = [];
+  let SemaHandler = 0;
+  let Documentation = [Undocumented];
+}
+
 def AlwaysInline : InheritableAttr {
   let Spellings = [GCC<"always_inline">, Keyword<"__forceinline">];
   let Subjects = SubjectList<[Function]>;

diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 717bf6e12ccd..b387736832a9 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -854,6 +854,8 @@ def err_pragma_options_align_mac68k_target_unsupported : 
Error<
 def warn_pragma_pack_invalid_alignment : Warning<
   "expected #pragma pack parameter to be '1', '2', '4', '8', or '16'">,
   InGroup;
+def err_pragma_pack_invalid_alignment : Error<
+  warn_pragma_pack_invalid_alignment.Text>;
 def warn_pragma_pack_non_default_at_include : Warning<
   "non-default #pragma pack value changes the alignment of struct or union "
   "members in the included file">, InGroup,
@@ -887,6 +889,8 @@ def warn_cxx_ms_struct :
   Warning<"ms_struct may not produce Microsoft-compatible layouts for classes "
   "with base classes or virtual functions">,
   DefaultError, InGroup;
+def err_pragma_pack_identifer_not_supported : Error<
+  "specifying an identifier within `#pragma pack` is not supported on this 
target">;
 def err_section_conflict : Error<"%0 causes a section type conflict with %1">;
 def err_no_base_classes : Error<"invalid use of '__super', %0 has no base 
classes">;
 def err_invalid_super_scope : Error<"invalid use of '__super', "

diff  --git a/clang/include/clang/Basic/LangOptions.def 
b/clang/include/clang/Basic/LangOptions.def
index 963fde5f3ad4..c01f0cca9c9c 100644
--- a/clang/include/clang/Basic/LangOptions.def
+++ b/clang/include/clang/Basic/LangOptions.def
@@ -354,6 +354,8 @@ ENUM_LANGOPT(VtorDispMode, MSVtorDispMode, 2, 
MSVtorDispMode::ForVBaseOverride,
 
 LANGOPT(ApplePragmaPack, 1, 0, "Apple gcc-compatible #pragma pack handling")
 
+LANGOPT(XLPragmaPack, 1, 0, "IBM XL #pragma pack handling")
+
 LANGOPT(RetainCommentsFromSystemHeaders, 1, 0, "retain documentation comments 
from system headers in the AST")
 
 LANGOPT(SanitizeAddressFieldPadding, 2, 0, "controls how aggressive is ASan "

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index acc3db40bdc7..9ea3feccddff 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1026,6 +1026,8 @@ defm apple_pragma_pack : BoolFOption<"apple-pragma-pack",
   "LangOpts->ApplePragmaPack", DefaultsToFalse,
   ChangedBy,
   ResetBy>;
+def fxl_pragma_pack : Flag<["-"], "fxl-pragma-pack">, Group, 
Flags<[CC1Option]>,
+  HelpText<"Enable IBM XL #pragma pack handling">;
 def shared_libsan : Flag<["-"], "shared-libsan">,
   HelpText<"Dynamically link the sanitizer runtime">;
 def static_libsan : Flag<["-"], "static-libsan">,
@@ -1966,6 +1968,7 @@ def fmudflapth : Flag<["-"], "fmudflapth">, 
Group;
 def fmudf

[PATCH] D87702: [Frontend] Add pragma align natural and sort out pragma pack stack effect

2021-01-13 Thread Xiangling Liao via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Xiangling_L marked 8 inline comments as done.
Closed by commit rGf0abe2aeaca7: [Frontend] Add pragma align natural and sort 
out pragma pack stack effect (authored by Xiangling_L).

Changed prior to commit:
  https://reviews.llvm.org/D87702?vs=315855&id=316400#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87702

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Driver/Options.td
  clang/include/clang/Sema/Sema.h
  clang/include/clang/Serialization/ASTReader.h
  clang/include/clang/Serialization/ASTWriter.h
  clang/lib/AST/RecordLayoutBuilder.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Parse/ParsePragma.cpp
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaAttr.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/test/Driver/aix-pragma-pack.c
  clang/test/Layout/aix-double-struct-member.cpp
  clang/test/Layout/aix-power-natural-interaction.cpp
  clang/test/PCH/aix-pragma-pack.c
  clang/test/Sema/aix-pragma-pack-and-align.c

Index: clang/test/Sema/aix-pragma-pack-and-align.c
===
--- /dev/null
+++ clang/test/Sema/aix-pragma-pack-and-align.c
@@ -0,0 +1,229 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -fdump-record-layouts \
+// RUN: -fxl-pragma-pack -verify -fsyntax-only -x c++ %s | \
+// RUN:   FileCheck %s
+
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -fdump-record-layouts \
+// RUN: -fxl-pragma-pack -verify -fsyntax-only -x c++ %s | \
+// RUN:   FileCheck %s
+
+namespace test1 {
+#pragma align(natural)
+#pragma pack(4)
+#pragma pack(2)
+struct A {
+  int i;
+  double d;
+};
+
+int a = sizeof(A);
+#pragma pack()
+#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 4}}
+#pragma pack(pop)
+#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 8}}
+struct B {
+  int i;
+  double d;
+};
+#pragma align(reset)
+
+int b = sizeof(B);
+
+// CHECK:  *** Dumping AST Record Layout
+// CHECK-NEXT:  0 | struct test1::A
+// CHECK-NEXT:  0 |   int i
+// CHECK-NEXT:  4 |   double d
+// CHECK-NEXT:| [sizeof=12, dsize=12, align=2, preferredalign=2,
+// CHECK-NEXT:|  nvsize=12, nvalign=2, preferrednvalign=2]
+
+// CHECK:  *** Dumping AST Record Layout
+// CHECK-NEXT:  0 | struct test1::B
+// CHECK-NEXT:  0 |   int i
+// CHECK-NEXT:  8 |   double d
+// CHECK-NEXT:| [sizeof=16, dsize=16, align=4, preferredalign=8,
+// CHECK-NEXT:|  nvsize=16, nvalign=4, preferrednvalign=8]
+
+} // namespace test1
+
+namespace test2 {
+#pragma align(natural)
+#pragma pack(2)
+struct A {
+  int i;
+  double d;
+};
+
+int a = sizeof(A);
+#pragma align(reset)
+
+struct B {
+  int i;
+  double d;
+};
+
+int b = sizeof(B);
+
+// CHECK:  *** Dumping AST Record Layout
+// CHECK-NEXT:  0 | struct test2::A
+// CHECK-NEXT:  0 |   int i
+// CHECK-NEXT:  4 |   double d
+// CHECK-NEXT:| [sizeof=12, dsize=12, align=2, preferredalign=2,
+// CHECK-NEXT:|  nvsize=12, nvalign=2, preferrednvalign=2]
+
+// CHECK:  *** Dumping AST Record Layout
+// CHECK-NEXT:  0 | struct test2::B
+// CHECK-NEXT:  0 |   int i
+// CHECK-NEXT:  4 |   double d
+// CHECK-NEXT:| [sizeof=12, dsize=12, align=4, preferredalign=4,
+// CHECK-NEXT:|  nvsize=12, nvalign=4, preferrednvalign=4]
+
+} // namespace test2
+
+namespace test3 {
+#pragma pack(2)
+#pragma align(natural)
+struct A {
+  double d;
+};
+#pragma align(reset)
+#pragma pack(pop)
+
+int a = sizeof(A);
+
+// CHECK:  *** Dumping AST Record Layout
+// CHECK-NEXT:  0 | struct test3::A
+// CHECK-NEXT:  0 |   double d
+// CHECK-NEXT:| [sizeof=8, dsize=8, align=4, preferredalign=8,
+// CHECK-NEXT:|  nvsize=8, nvalign=4, preferrednvalign=8]
+
+} // namespace test3
+
+namespace test4 {
+#pragma pack(2)
+#pragma align(natural)
+#pragma pack(pop)
+
+struct A {
+  int i;
+  double d;
+} a;
+#pragma align(reset)
+#pragma pack(pop)
+
+int i = sizeof(A);
+
+// CHECK:  *** Dumping AST Record Layout
+// CHECK-NEXT:  0 | struct test4::A
+// CHECK-NEXT:  0 |   int i
+// CHECK-NEXT:  8 |   double d
+// CHECK-NEXT:| [sizeof=16, dsize=16, align=4, preferredalign=8,
+// CHECK-NEXT:|  nvsize=16, nvalign=4, preferrednvalign=8]
+
+} // namespace test4
+
+namespace test5 {
+#pragma align(power)
+#pragma align(natural)
+#pragma pack(2)
+#pragma align(reset)
+struct A {
+  int i;
+  double d;
+};
+#pragma align(reset)
+
+int a = sizeof(A);
+
+// CHECK:  *** Dumping AST Recor

[PATCH] D92715: [Clang][RISCV] Define RISC-V V builtin types

2021-01-13 Thread Hsiangkai Wang via Phabricator via cfe-commits
HsiangKai added a comment.

@liaolucy RISC-V vector types are sizeless types. Sizeless is kind of 
characteristic for builtin types. If we use attribute to declare RISC-V vector 
types, the frontend does not know anything about it. I still think to define 
RISC-V vector types as builtin types is a better way.


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

https://reviews.llvm.org/D92715

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


[PATCH] D93525: [OpenMP] Add unbundling of archives containing bundled object files into device specific archives

2021-01-13 Thread Tony Tye via Phabricator via cfe-commits
t-tye added a comment.

In D93525#2495374 , @saiislam wrote:

> In D93525#2493752 , @t-tye wrote:
>
>> In D93525#2493024 , @yaxunl wrote:
>>
>>> can you document this in ClangOffloadBundler.rst ? I think we need a clear 
>>> description about how clang-offload-bundler knows which file in the .a file 
>>> belongs to which target.
>>
>> How does the .a relate to bundled code objects? Does the .a have a number of 
>> bundled code objects? If so wouldn't the identity of code objects be defined 
>> by the existing bundled code object ABI already documented? If the .a is a 
>> set of non-bundled code objects then defining how they are identified is not 
>> part of the clang-offload-bundler documentation as there are no bundled code 
>> objects involved. It would seem that the documentation belongs with the 
>> OpenMP runtime/compiler that is choosing to use .a files in this manner.
>
> Bundles (created using clang-offload-bundler) are passed to llvm-ar to create 
> an archive of bundled objects (*.a file). An archive can have bundles for 
> multiple device types. So, yes, the identity of code objects is defined by 
> the existing bundled code object ABI.
> This patch reads such an archive and produces a device-specific archive for 
> each of the target devices given as input. Each device-specific archive 
> contains all the code objects corresponding to that particular device and are 
> written as per llvm archive format.
>
> Here is a snippet of relevant lit run lines:
>
>   // RUN: %clang -O0 -target %itanium_abi_triple %s -c -o %t.o
>   
>   // RUN: echo 'Content of device file 1' > %t.tgt1
>   // RUN: clang-offload-bundler -type=o 
> -targets=host-%itanium_abi_triple,openmp-amdgcn-amd-amdhsa-gfx900 
> -inputs=%t.o,%t.tgt1 -outputs=%t.abundle1.o
>
>   // RUN: echo 'Content of device file 2' > %t.tgt2
>   // RUN: clang-offload-bundler -type=o 
> -targets=host-%itanium_abi_triple,openmp-amdgcn-amd-amdhsa-gfx900 
> -inputs=%t.o,%t.tgt2 -outputs=%t.abundle2.o
>
>   // RUN: llvm-ar cr %t.lib.a %t.abundle1.o %t.abundle2.o
>   
>   This patch ==>
>   // RUN: clang-offload-bundler -unbundle -type=a 
> -targets=openmp-amdgcn-amd-amdhsa-gfx900 -inputs=%t.lib.a 
> -outputs=%t.devicelib.a
>   
>   %t.devicelib.a will contain all devices objects corresponding to gfx900
>
> Though my interest originates from OpenMP side, Device-specific Archive 
> Libraries created like this can be used by other offloading languages like 
> HIP, CUDA, and OpenCL. Pelase refer D81109  
> for the an earlier patch in the series of patches which will enable this.

The naming of code objects in a bundled code object includes the processor name 
and the settings for target features (see 
https://clang.llvm.org/docs/ClangOffloadBundler.html#target-id and 
https://llvm.org/docs/AMDGPUUsage.html#target-id). The compatibility of code 
objects considers both target processor matching and target feature 
compatibility. Target features can have three settings: on, off and any. The 
compatibility is that each feature that is on/off must exactly match, but any 
will match either on or off.

So when unbundling an archive how is the desired code object being requested? 
How is it handling the target features? For example, if code objects that will 
be compatible with a feature being on is required, then matching code objects 
in the archive would be those that have that feature either on or any.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93525

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


[PATCH] D94606: [clangd] Move DirBasedCDB broadcasting onto its own thread.

2021-01-13 Thread Sam McCall via Phabricator via cfe-commits
sammccall created this revision.
sammccall added a reviewer: kadircet.
Herald added subscribers: usaxena95, jfb, arphaman.
sammccall requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang.

This is on the critical path (it blocks getting the compile command for
the first file).

It's not trivially fast: it involves processing all filenames in the CDB
and doing some IO to look for shadowing CDBs.

And we may make this slower soon - making CDB configurable implies evaluating
the config for each listed to see which ones really are owned by the
broadcasted CDB.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94606

Files:
  clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
  clang-tools-extra/clangd/GlobalCompilationDatabase.h
  clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp

Index: clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp
===
--- clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp
+++ clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp
@@ -217,11 +217,13 @@
 });
 
 DB.getCompileCommand(testPath("build/../a.cc"));
+ASSERT_TRUE(DB.blockUntilIdle(timeoutSeconds(10)));
 EXPECT_THAT(DiscoveredFiles, UnorderedElementsAre(AllOf(
  EndsWith("a.cc"), Not(HasSubstr("..");
 DiscoveredFiles.clear();
 
 DB.getCompileCommand(testPath("build/gen.cc"));
+ASSERT_TRUE(DB.blockUntilIdle(timeoutSeconds(10)));
 EXPECT_THAT(DiscoveredFiles, UnorderedElementsAre(EndsWith("gen.cc")));
   }
 
@@ -237,12 +239,14 @@
 });
 
 DB.getCompileCommand(testPath("a.cc"));
+ASSERT_TRUE(DB.blockUntilIdle(timeoutSeconds(10)));
 EXPECT_THAT(DiscoveredFiles,
 UnorderedElementsAre(EndsWith("a.cc"), EndsWith("gen.cc"),
  EndsWith("gen2.cc")));
 DiscoveredFiles.clear();
 
 DB.getCompileCommand(testPath("build/gen.cc"));
+ASSERT_TRUE(DB.blockUntilIdle(timeoutSeconds(10)));
 EXPECT_THAT(DiscoveredFiles, IsEmpty());
   }
 }
Index: clang-tools-extra/clangd/GlobalCompilationDatabase.h
===
--- clang-tools-extra/clangd/GlobalCompilationDatabase.h
+++ clang-tools-extra/clangd/GlobalCompilationDatabase.h
@@ -120,6 +120,8 @@
   /// \p File's parents.
   llvm::Optional getProjectInfo(PathRef File) const override;
 
+  bool blockUntilIdle(Deadline Timeout) const override;
+
 private:
   Options Opts;
 
@@ -152,6 +154,9 @@
   };
   llvm::Optional lookupCDB(CDBLookupRequest Request) const;
 
+  class BroadcastThread;
+  std::unique_ptr Broadcaster;
+
   // Performs broadcast on governed files.
   void broadcastCDB(CDBLookupResult Res) const;
 
Index: clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
===
--- clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
+++ clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
@@ -11,6 +11,7 @@
 #include "SourceCode.h"
 #include "support/Logger.h"
 #include "support/Path.h"
+#include "support/Threading.h"
 #include "support/ThreadsafeFS.h"
 #include "clang/Frontend/CompilerInvocation.h"
 #include "clang/Tooling/ArgumentsAdjusters.h"
@@ -22,12 +23,15 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/ScopeExit.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringMap.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/FileUtilities.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Program.h"
 #include "llvm/Support/VirtualFileSystem.h"
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -356,7 +360,7 @@
 
 DirectoryBasedGlobalCompilationDatabase::
 DirectoryBasedGlobalCompilationDatabase(const Options &Opts)
-: Opts(Opts) {
+: Opts(Opts), Broadcaster(std::make_unique(*this)) {
   if (Opts.CompileCommandsDir)
 OnlyDirCache = std::make_unique(*Opts.CompileCommandsDir);
 }
@@ -471,25 +475,98 @@
   Result.CDB = std::move(CDB);
   Result.PI.SourceRoot = DirCache->Path;
 
-  // FIXME: Maybe make the following part async, since this can block
-  // retrieval of compile commands.
   if (ShouldBroadcast)
 broadcastCDB(Result);
   return Result;
 }
 
-void DirectoryBasedGlobalCompilationDatabase::broadcastCDB(
-CDBLookupResult Result) const {
-  vlog("Broadcasting compilation database from {0}", Result.PI.SourceRoot);
-  assert(Result.CDB && "Trying to broadcast an invalid CDB!");
+// The broadcast thread announces files with new compile commands to the world.
+// Primarily this is used to enqueue them for background indexing.
+//
+// It's on a separate thread because:
+//  - otherwise it would block the first parse of the initial file
+//  - we need to enumerate all files in the CDB, of which there are many
+//  - we (wil

[clang-tools-extra] 66d5994 - [clangd] Explicitly avoid background-indexing the same file twice.

2021-01-13 Thread Sam McCall via cfe-commits

Author: Sam McCall
Date: 2021-01-13T17:29:30+01:00
New Revision: 66d5994bd38a9be4a0c05de2b69f88b64e6845ce

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

LOG: [clangd] Explicitly avoid background-indexing the same file twice.

This used to implicitly never happen due to only discovering each CDB
once.

We may want to carefully support reindexing one day, but we need to do
it carefully (tricky tradeoffs) and it would need further support in
background indexer.

Making this explicit here rather than just turning off rebroadcast in
background index for a few reasons:
- allows *new* files in the same CDB to be indexed
- relying on bugs-at-a-distance cancelling each other out is bound to bite us
- gets us closer to actually supporting reindexing, which requires similar 
tracking

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

Added: 


Modified: 
clang-tools-extra/clangd/index/Background.cpp
clang-tools-extra/clangd/index/Background.h
clang-tools-extra/clangd/index/BackgroundQueue.cpp
clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/index/Background.cpp 
b/clang-tools-extra/clangd/index/Background.cpp
index 1649bffea2ed..e4ce1f57ff2f 100644
--- a/clang-tools-extra/clangd/index/Background.cpp
+++ b/clang-tools-extra/clangd/index/Background.cpp
@@ -43,6 +43,7 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Threading.h"
+#include "llvm/Support/xxhash.h"
 
 #include 
 #include 
@@ -139,8 +140,8 @@ BackgroundQueue::Task BackgroundIndex::changedFilesTask(
  std::mt19937(std::random_device{}()));
 std::vector Tasks;
 Tasks.reserve(NeedsReIndexing.size());
-for (auto &Cmd : NeedsReIndexing)
-  Tasks.push_back(indexFileTask(std::move(Cmd)));
+for (const auto &File : NeedsReIndexing)
+  Tasks.push_back(indexFileTask(std::move(File)));
 Queue.append(std::move(Tasks));
   });
 
@@ -156,6 +157,7 @@ static llvm::StringRef 
filenameWithoutExtension(llvm::StringRef Path) {
 
 BackgroundQueue::Task BackgroundIndex::indexFileTask(std::string Path) {
   std::string Tag = filenameWithoutExtension(Path).str();
+  uint64_t Key = llvm::xxHash64(Path);
   BackgroundQueue::Task T([this, Path(std::move(Path))] {
 llvm::Optional WithProvidedContext;
 if (ContextProvider)
@@ -168,6 +170,7 @@ BackgroundQueue::Task 
BackgroundIndex::indexFileTask(std::string Path) {
   });
   T.QueuePri = IndexFile;
   T.Tag = std::move(Tag);
+  T.Key = Key;
   return T;
 }
 

diff  --git a/clang-tools-extra/clangd/index/Background.h 
b/clang-tools-extra/clangd/index/Background.h
index e8f9468889f2..fbcec7014957 100644
--- a/clang-tools-extra/clangd/index/Background.h
+++ b/clang-tools-extra/clangd/index/Background.h
@@ -76,6 +76,8 @@ class BackgroundQueue {
 llvm::ThreadPriority ThreadPri = llvm::ThreadPriority::Background;
 unsigned QueuePri = 0; // Higher-priority tasks will run first.
 std::string Tag;   // Allows priority to be boosted later.
+uint64_t Key = 0;  // If the key matches a previous task, drop this 
one.
+   // (in practice this means we never reindex a file).
 
 bool operator<(const Task &O) const { return QueuePri < O.QueuePri; }
   };
@@ -114,6 +116,7 @@ class BackgroundQueue {
 
 private:
   void notifyProgress() const; // Requires lock Mu
+  bool adjust(Task &T);
 
   std::mutex Mu;
   Stats Stat;
@@ -122,6 +125,7 @@ class BackgroundQueue {
   std::vector Queue; // max-heap
   llvm::StringMap Boosts;
   std::function OnProgress;
+  llvm::DenseSet SeenKeys;
 };
 
 // Builds an in-memory index by by running the static indexer action over

diff  --git a/clang-tools-extra/clangd/index/BackgroundQueue.cpp 
b/clang-tools-extra/clangd/index/BackgroundQueue.cpp
index 3262a2f46d38..b0dc2acca356 100644
--- a/clang-tools-extra/clangd/index/BackgroundQueue.cpp
+++ b/clang-tools-extra/clangd/index/BackgroundQueue.cpp
@@ -72,10 +72,24 @@ void BackgroundQueue::stop() {
   CV.notify_all();
 }
 
+// Tweaks the priority of a newly-enqueued task, or returns false to cancel it.
+bool BackgroundQueue::adjust(Task &T) {
+  // It is tempting to drop duplicates of queued tasks, and merely deprioritize
+  // duplicates of completed tasks (i.e. reindexing on CDB changes). But:
+  //  - the background indexer doesn't support reindexing well, e.g. staleness
+  //is checked at *enqueue* time only, and doesn't account for compile 
flags
+  //  - reindexing on compile flags is often a poor use of CPU in practice
+  if (T.Key && !SeenKeys.insert(T.Key).second)
+return false;
+  T.QueuePri = std::max(T.QueuePri, Boosts.lookup(T.Tag));
+  return true;
+}
+
 void BackgroundQueue::push(Task T) {
   {
  

[PATCH] D94503: [clangd] Explicitly avoid background-indexing the same file twice.

2021-01-13 Thread Sam McCall via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
sammccall marked 5 inline comments as done.
Closed by commit rG66d5994bd38a: [clangd] Explicitly avoid background-indexing 
the same file twice. (authored by sammccall).

Changed prior to commit:
  https://reviews.llvm.org/D94503?vs=316152&id=316409#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94503

Files:
  clang-tools-extra/clangd/index/Background.cpp
  clang-tools-extra/clangd/index/Background.h
  clang-tools-extra/clangd/index/BackgroundQueue.cpp
  clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp

Index: clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp
===
--- clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp
+++ clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp
@@ -9,6 +9,7 @@
 #include "index/BackgroundRebuild.h"
 #include "clang/Tooling/ArgumentsAdjusters.h"
 #include "clang/Tooling/CompilationDatabase.h"
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/ScopedPrinter.h"
 #include "llvm/Support/Threading.h"
 #include "gmock/gmock.h"
@@ -666,25 +667,45 @@
   // Make sure we only store the Cmd for main file.
   EXPECT_FALSE(MSS.loadShard(testPath("A.h"))->Cmd);
 
-  {
-tooling::CompileCommand CmdStored = *MSS.loadShard(testPath("A.cc"))->Cmd;
-EXPECT_EQ(CmdStored.CommandLine, Cmd.CommandLine);
-EXPECT_EQ(CmdStored.Directory, Cmd.Directory);
-  }
+  tooling::CompileCommand CmdStored = *MSS.loadShard(testPath("A.cc"))->Cmd;
+  EXPECT_EQ(CmdStored.CommandLine, Cmd.CommandLine);
+  EXPECT_EQ(CmdStored.Directory, Cmd.Directory);
+}
 
-  // FIXME: Changing compile commands should be enough to invalidate the cache.
-  FS.Files[testPath("A.cc")] = " ";
-  Cmd.CommandLine = {"clang++", "../A.cc", "-Dfoo", "-fsyntax-only"};
-  CDB.setCompileCommand(testPath("build/../A.cc"), Cmd);
+TEST_F(BackgroundIndexTest, Reindex) {
+  MockFS FS;
+  llvm::StringMap Storage;
+  size_t CacheHits = 0;
+  MemoryShardStorage MSS(Storage, CacheHits);
+  OverlayCDB CDB(/*Base=*/nullptr);
+  BackgroundIndex Idx(FS, CDB, [&](llvm::StringRef) { return &MSS; },
+  /*Opts=*/{});
+
+  // Index a file.
+  FS.Files[testPath("A.cc")] = "int theOldFunction();";
+  tooling::CompileCommand Cmd;
+  Cmd.Filename = "../A.cc";
+  Cmd.Directory = testPath("build");
+  Cmd.CommandLine = {"clang++", "../A.cc", "-fsyntax-only"};
+  CDB.setCompileCommand(testPath("A.cc"), Cmd);
   ASSERT_TRUE(Idx.blockUntilIdleForTest());
 
-  EXPECT_FALSE(MSS.loadShard(testPath("A.h"))->Cmd);
+  // Verify the result is indexed and stored.
+  EXPECT_EQ(1u, runFuzzyFind(Idx, "theOldFunction").size());
+  EXPECT_EQ(0u, runFuzzyFind(Idx, "theNewFunction").size());
+  std::string OldShard = Storage.lookup(testPath("A.cc"));
+  EXPECT_NE("", OldShard);
 
-  {
-tooling::CompileCommand CmdStored = *MSS.loadShard(testPath("A.cc"))->Cmd;
-EXPECT_EQ(CmdStored.CommandLine, Cmd.CommandLine);
-EXPECT_EQ(CmdStored.Directory, Cmd.Directory);
-  }
+  // Change the content and command, and notify to reindex it.
+  Cmd.CommandLine.push_back("-DFOO");
+  FS.Files[testPath("A.cc")] = "int theNewFunction();";
+  CDB.setCompileCommand(testPath("A.cc"), Cmd);
+  ASSERT_TRUE(Idx.blockUntilIdleForTest());
+
+  // Currently, we will never index the same main file again.
+  EXPECT_EQ(1u, runFuzzyFind(Idx, "theOldFunction").size());
+  EXPECT_EQ(0u, runFuzzyFind(Idx, "theNewFunction").size());
+  EXPECT_EQ(OldShard, Storage.lookup(testPath("A.cc")));
 }
 
 class BackgroundIndexRebuilderTest : public testing::Test {
@@ -829,6 +850,31 @@
   }
 }
 
+TEST(BackgroundQueueTest, Duplicates) {
+  std::string Sequence;
+  BackgroundQueue::Task A([&] { Sequence.push_back('A'); });
+  A.QueuePri = 100;
+  A.Key = 1;
+  BackgroundQueue::Task B([&] { Sequence.push_back('B'); });
+  // B has no key, and is not subject to duplicate detection.
+  B.QueuePri = 50;
+
+  BackgroundQueue Q;
+  Q.append({A, B, A, B}); // One A is dropped, the other is high priority.
+  Q.work(/*OnIdle=*/[&] {
+// The first time we go idle, we enqueue the same task again.
+if (!llvm::is_contained(Sequence, ' ')) {
+  Sequence.push_back(' ');
+  Q.append({A, B, A, B}); // Both As are dropped.
+} else {
+  Q.stop();
+}
+  });
+
+  // This could reasonably be "ABB BBA", if we had good *re*indexing support.
+  EXPECT_EQ("ABB BB", Sequence);
+}
+
 TEST(BackgroundQueueTest, Progress) {
   using testing::AnyOf;
   BackgroundQueue::Stats S;
Index: clang-tools-extra/clangd/index/BackgroundQueue.cpp
===
--- clang-tools-extra/clangd/index/BackgroundQueue.cpp
+++ clang-tools-extra/clangd/index/BackgroundQueue.cpp
@@ -72,10 +72,24 @@
   CV.notify_all();
 }
 
+// Tweaks the priority of a newly-enqueued task, or returns false to cancel it.
+

[PATCH] D94237: [clang] Use SourceLocations in unions [NFCI]

2021-01-13 Thread Mikhail Maltsev via Phabricator via cfe-commits
miyuki updated this revision to Diff 316414.
miyuki added a comment.

Refactored `SLocEntry` in a similar way.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94237

Files:
  clang/include/clang/AST/DependentDiagnostic.h
  clang/include/clang/AST/Expr.h
  clang/include/clang/AST/TemplateBase.h
  clang/include/clang/Basic/SourceManager.h
  clang/include/clang/Sema/DeclSpec.h
  clang/include/clang/Sema/Designator.h
  clang/include/clang/Sema/Initialization.h
  clang/lib/AST/Expr.cpp
  clang/lib/AST/TemplateBase.cpp
  clang/lib/Parse/ParseDeclCXX.cpp
  clang/lib/Sema/DeclSpec.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaType.cpp

Index: clang/lib/Sema/SemaType.cpp
===
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -3125,11 +3125,11 @@
   diag::warn_qual_return_type,
   PTI.TypeQuals,
   SourceLocation(),
-  SourceLocation::getFromRawEncoding(PTI.ConstQualLoc),
-  SourceLocation::getFromRawEncoding(PTI.VolatileQualLoc),
-  SourceLocation::getFromRawEncoding(PTI.RestrictQualLoc),
-  SourceLocation::getFromRawEncoding(PTI.AtomicQualLoc),
-  SourceLocation::getFromRawEncoding(PTI.UnalignedQualLoc));
+  PTI.ConstQualLoc,
+  PTI.VolatileQualLoc,
+  PTI.RestrictQualLoc,
+  PTI.AtomicQualLoc,
+  PTI.UnalignedQualLoc);
   return;
 }
 
@@ -6086,7 +6086,7 @@
   }
 
   // Finally fill in MemberPointerLocInfo fields.
-  TL.setStarLoc(SourceLocation::getFromRawEncoding(Chunk.Mem.StarLoc));
+  TL.setStarLoc(Chunk.Mem.StarLoc);
   TL.setClassTInfo(ClsTInfo);
 }
 void VisitLValueReferenceTypeLoc(LValueReferenceTypeLoc TL) {
@@ -6163,7 +6163,7 @@
 llvm_unreachable("cannot be _Atomic qualified");
 
   case DeclaratorChunk::Pointer:
-Loc = SourceLocation::getFromRawEncoding(Chunk.Ptr.AtomicQualLoc);
+Loc = Chunk.Ptr.AtomicQualLoc;
 break;
 
   case DeclaratorChunk::BlockPointer:
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -2851,8 +2851,7 @@
   // turn this into Self->ivar, just return a BareIVarExpr or something.
   IdentifierInfo &II = Context.Idents.get("self");
   UnqualifiedId SelfName;
-  SelfName.setIdentifier(&II, SourceLocation());
-  SelfName.setKind(UnqualifiedIdKind::IK_ImplicitSelfParam);
+  SelfName.setImplicitSelfParam(&II);
   CXXScopeSpec SelfScopeSpec;
   SourceLocation TemplateKWLoc;
   ExprResult SelfExpr =
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -5344,8 +5344,8 @@
   case UnqualifiedIdKind::IK_OperatorFunctionId:
 NameInfo.setName(Context.DeclarationNames.getCXXOperatorName(
Name.OperatorFunctionId.Operator));
-NameInfo.getInfo().CXXOperatorName.BeginOpNameLoc
-  = Name.OperatorFunctionId.SymbolLocations[0];
+NameInfo.getInfo().CXXOperatorName.BeginOpNameLoc =
+Name.OperatorFunctionId.SymbolLocations[0].getRawEncoding();
 NameInfo.getInfo().CXXOperatorName.EndOpNameLoc
   = Name.EndLocation.getRawEncoding();
 return NameInfo;
Index: clang/lib/Sema/DeclSpec.cpp
===
--- clang/lib/Sema/DeclSpec.cpp
+++ clang/lib/Sema/DeclSpec.cpp
@@ -191,28 +191,29 @@
   I.Kind= Function;
   I.Loc = LocalRangeBegin;
   I.EndLoc  = LocalRangeEnd;
+  new (&I.Fun) FunctionTypeInfo;
   I.Fun.hasPrototype= hasProto;
   I.Fun.isVariadic  = EllipsisLoc.isValid();
   I.Fun.isAmbiguous = isAmbiguous;
-  I.Fun.LParenLoc   = LParenLoc.getRawEncoding();
-  I.Fun.EllipsisLoc = EllipsisLoc.getRawEncoding();
-  I.Fun.RParenLoc   = RParenLoc.getRawEncoding();
+  I.Fun.LParenLoc   = LParenLoc;
+  I.Fun.EllipsisLoc = EllipsisLoc;
+  I.Fun.RParenLoc   = RParenLoc;
   I.Fun.DeleteParams= false;
   I.Fun.NumParams   = NumParams;
   I.Fun.Params  = nullptr;
   I.Fun.RefQualifierIsLValueRef = RefQualifierIsLvalueRef;
-  I.Fun.RefQualifierLoc = RefQualifierLoc.getRawEncoding();
-  I.Fun.MutableLoc  = MutableLoc.getRawEncoding();
+  I.Fun.RefQualifierLoc = RefQualifierLoc;
+  I.Fun.MutableLoc  = MutableLoc;
   I.Fun.ExceptionSpecType   = ESpecType;
-  I.Fun.ExceptionSpecLocBeg = ESpecRange.getBegin().getRawEncoding();
-  I.Fun.ExceptionSpecLocEnd = ESpecRange.getEnd().getRawEncoding();
+  I.Fun.ExceptionSpecLocBeg = ESpecRange.getBegin(

[clang-tools-extra] 466acd6 - [clangd] Avoid reallocating buffers for each message read:

2021-01-13 Thread Sam McCall via cfe-commits

Author: Sam McCall
Date: 2021-01-13T17:40:33+01:00
New Revision: 466acd694861138997d668a3f9cb29aa87bd316e

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

LOG: [clangd] Avoid reallocating buffers for each message read:

 - reuse std::string we read messages into
 - when reading line-wise, use SmallVector<128> and read in chunks of 128
   (this affects headers, which are short, and tests, which don't matter)

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

Added: 


Modified: 
clang-tools-extra/clangd/JSONTransport.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/JSONTransport.cpp 
b/clang-tools-extra/clangd/JSONTransport.cpp
index 662e5df4e27b..3e8caceda21c 100644
--- a/clang-tools-extra/clangd/JSONTransport.cpp
+++ b/clang-tools-extra/clangd/JSONTransport.cpp
@@ -10,6 +10,7 @@
 #include "support/Cancellation.h"
 #include "support/Logger.h"
 #include "support/Shutdown.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/Support/Errno.h"
 #include "llvm/Support/Error.h"
 #include 
@@ -99,6 +100,7 @@ class JSONTransport : public Transport {
   }
 
   llvm::Error loop(MessageHandler &Handler) override {
+std::string JSON; // Messages may be large, reuse same big buffer.
 while (!feof(In)) {
   if (shutdownRequested())
 return error(std::make_error_code(std::errc::operation_canceled),
@@ -106,14 +108,14 @@ class JSONTransport : public Transport {
   if (ferror(In))
 return llvm::errorCodeToError(
 std::error_code(errno, std::system_category()));
-  if (auto JSON = readRawMessage()) {
-if (auto Doc = llvm::json::parse(*JSON)) {
+  if (readRawMessage(JSON)) {
+if (auto Doc = llvm::json::parse(JSON)) {
   vlog(Pretty ? "<<< {0:2}\n" : "<<< {0}\n", *Doc);
   if (!handleMessage(std::move(*Doc), Handler))
 return llvm::Error::success(); // we saw the "exit" notification.
 } else {
   // Parse error. Log the raw message.
-  vlog("<<< {0}\n", *JSON);
+  vlog("<<< {0}\n", JSON);
   elog("JSON parse error: {0}", llvm::toString(Doc.takeError()));
 }
   }
@@ -136,12 +138,12 @@ class JSONTransport : public Transport {
   }
 
   // Read raw string messages from input stream.
-  llvm::Optional readRawMessage() {
-return Style == JSONStreamStyle::Delimited ? readDelimitedMessage()
-   : readStandardMessage();
+  bool readRawMessage(std::string &JSON) {
+return Style == JSONStreamStyle::Delimited ? readDelimitedMessage(JSON)
+   : readStandardMessage(JSON);
   }
-  llvm::Optional readDelimitedMessage();
-  llvm::Optional readStandardMessage();
+  bool readDelimitedMessage(std::string &JSON);
+  bool readStandardMessage(std::string &JSON);
 
   llvm::SmallVector OutputBuffer;
   std::FILE *In;
@@ -191,12 +193,14 @@ bool JSONTransport::handleMessage(llvm::json::Value 
Message,
 
 // Tries to read a line up to and including \n.
 // If failing, feof(), ferror(), or shutdownRequested() will be set.
-bool readLine(std::FILE *In, std::string &Out) {
-  static constexpr int BufSize = 1024;
+bool readLine(std::FILE *In, llvm::SmallVectorImpl &Out) {
+  // Big enough to hold any reasonable header line. May not fit content lines
+  // in delimited mode, but performance doesn't matter for that mode.
+  static constexpr int BufSize = 128;
   size_t Size = 0;
   Out.clear();
   for (;;) {
-Out.resize(Size + BufSize);
+Out.resize_for_overwrite(Size + BufSize);
 // Handle EINTR which is sent when a debugger attaches on some platforms.
 if (!retryAfterSignalUnlessShutdown(
 nullptr, [&] { return std::fgets(&Out[Size], BufSize, In); }))
@@ -216,14 +220,14 @@ bool readLine(std::FILE *In, std::string &Out) {
 // Returns None when:
 //  - ferror(), feof(), or shutdownRequested() are set.
 //  - Content-Length is missing or empty (protocol error)
-llvm::Optional JSONTransport::readStandardMessage() {
+bool JSONTransport::readStandardMessage(std::string &JSON) {
   // A Language Server Protocol message starts with a set of HTTP headers,
   // delimited  by \r\n, and terminated by an empty line (\r\n).
   unsigned long long ContentLength = 0;
-  std::string Line;
+  llvm::SmallString<128> Line;
   while (true) {
 if (feof(In) || ferror(In) || !readLine(In, Line))
-  return llvm::None;
+  return false;
 InMirror << Line;
 
 llvm::StringRef LineRef(Line);
@@ -258,14 +262,14 @@ llvm::Optional 
JSONTransport::readStandardMessage() {
 elog("Refusing to read message with long Content-Length: {0}. "
  "Expect protocol errors",
  ContentLength);
-return llvm::None;
+return false;
   }
   if (Conte

[PATCH] D93653: [clangd] Avoid reallocating buffers for each message read:

2021-01-13 Thread Sam McCall via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG466acd694861: [clangd] Avoid reallocating buffers for each 
message read: (authored by sammccall).

Changed prior to commit:
  https://reviews.llvm.org/D93653?vs=313159&id=316416#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93653

Files:
  clang-tools-extra/clangd/JSONTransport.cpp

Index: clang-tools-extra/clangd/JSONTransport.cpp
===
--- clang-tools-extra/clangd/JSONTransport.cpp
+++ clang-tools-extra/clangd/JSONTransport.cpp
@@ -10,6 +10,7 @@
 #include "support/Cancellation.h"
 #include "support/Logger.h"
 #include "support/Shutdown.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/Support/Errno.h"
 #include "llvm/Support/Error.h"
 #include 
@@ -99,6 +100,7 @@
   }
 
   llvm::Error loop(MessageHandler &Handler) override {
+std::string JSON; // Messages may be large, reuse same big buffer.
 while (!feof(In)) {
   if (shutdownRequested())
 return error(std::make_error_code(std::errc::operation_canceled),
@@ -106,14 +108,14 @@
   if (ferror(In))
 return llvm::errorCodeToError(
 std::error_code(errno, std::system_category()));
-  if (auto JSON = readRawMessage()) {
-if (auto Doc = llvm::json::parse(*JSON)) {
+  if (readRawMessage(JSON)) {
+if (auto Doc = llvm::json::parse(JSON)) {
   vlog(Pretty ? "<<< {0:2}\n" : "<<< {0}\n", *Doc);
   if (!handleMessage(std::move(*Doc), Handler))
 return llvm::Error::success(); // we saw the "exit" notification.
 } else {
   // Parse error. Log the raw message.
-  vlog("<<< {0}\n", *JSON);
+  vlog("<<< {0}\n", JSON);
   elog("JSON parse error: {0}", llvm::toString(Doc.takeError()));
 }
   }
@@ -136,12 +138,12 @@
   }
 
   // Read raw string messages from input stream.
-  llvm::Optional readRawMessage() {
-return Style == JSONStreamStyle::Delimited ? readDelimitedMessage()
-   : readStandardMessage();
+  bool readRawMessage(std::string &JSON) {
+return Style == JSONStreamStyle::Delimited ? readDelimitedMessage(JSON)
+   : readStandardMessage(JSON);
   }
-  llvm::Optional readDelimitedMessage();
-  llvm::Optional readStandardMessage();
+  bool readDelimitedMessage(std::string &JSON);
+  bool readStandardMessage(std::string &JSON);
 
   llvm::SmallVector OutputBuffer;
   std::FILE *In;
@@ -191,12 +193,14 @@
 
 // Tries to read a line up to and including \n.
 // If failing, feof(), ferror(), or shutdownRequested() will be set.
-bool readLine(std::FILE *In, std::string &Out) {
-  static constexpr int BufSize = 1024;
+bool readLine(std::FILE *In, llvm::SmallVectorImpl &Out) {
+  // Big enough to hold any reasonable header line. May not fit content lines
+  // in delimited mode, but performance doesn't matter for that mode.
+  static constexpr int BufSize = 128;
   size_t Size = 0;
   Out.clear();
   for (;;) {
-Out.resize(Size + BufSize);
+Out.resize_for_overwrite(Size + BufSize);
 // Handle EINTR which is sent when a debugger attaches on some platforms.
 if (!retryAfterSignalUnlessShutdown(
 nullptr, [&] { return std::fgets(&Out[Size], BufSize, In); }))
@@ -216,14 +220,14 @@
 // Returns None when:
 //  - ferror(), feof(), or shutdownRequested() are set.
 //  - Content-Length is missing or empty (protocol error)
-llvm::Optional JSONTransport::readStandardMessage() {
+bool JSONTransport::readStandardMessage(std::string &JSON) {
   // A Language Server Protocol message starts with a set of HTTP headers,
   // delimited  by \r\n, and terminated by an empty line (\r\n).
   unsigned long long ContentLength = 0;
-  std::string Line;
+  llvm::SmallString<128> Line;
   while (true) {
 if (feof(In) || ferror(In) || !readLine(In, Line))
-  return llvm::None;
+  return false;
 InMirror << Line;
 
 llvm::StringRef LineRef(Line);
@@ -258,14 +262,14 @@
 elog("Refusing to read message with long Content-Length: {0}. "
  "Expect protocol errors",
  ContentLength);
-return llvm::None;
+return false;
   }
   if (ContentLength == 0) {
 log("Warning: Missing Content-Length header, or zero-length message.");
-return llvm::None;
+return false;
   }
 
-  std::string JSON(ContentLength, '\0');
+  JSON.resize(ContentLength);
   for (size_t Pos = 0, Read; Pos < ContentLength; Pos += Read) {
 // Handle EINTR which is sent when a debugger attaches on some platforms.
 Read = retryAfterSignalUnlessShutdown(0, [&]{
@@ -274,24 +278,24 @@
 if (Read == 0) {
   elog("Input was aborted. Read only {0} bytes of expected {1}.", Pos,
ContentLength);
-  return llvm::None;
+  return false;
 }
 InMirror <<

[clang-tools-extra] a4f3866 - [clangd] Remove "decision-forest-base" experimental flag.

2021-01-13 Thread Utkarsh Saxena via cfe-commits

Author: Utkarsh Saxena
Date: 2021-01-13T17:54:38+01:00
New Revision: a4f386688239b06e09f28fd31f93bf761aa9c76f

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

LOG: [clangd] Remove "decision-forest-base" experimental flag.

The value of this flag can only be fine tuned by using A/B testing on large
user base.
We do not expect individual users to use and fine tune this flag.

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

Added: 


Modified: 
clang-tools-extra/clangd/tool/ClangdMain.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp 
b/clang-tools-extra/clangd/tool/ClangdMain.cpp
index d2c52cf61c53..9c75cafdb08e 100644
--- a/clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -194,14 +194,6 @@ opt 
RankingModel{
 Hidden,
 };
 
-opt DecisionForestBase{
-"decision-forest-base",
-cat(Features),
-desc("Base for exponentiating the prediction from DecisionForest."),
-init(CodeCompleteOptions().DecisionForestBase),
-Hidden,
-};
-
 // FIXME: also support "plain" style where signatures are always omitted.
 enum CompletionStyleFlag { Detailed, Bundled };
 opt CompletionStyle{
@@ -841,7 +833,6 @@ clangd accepts flags on the commandline, and in the 
CLANGD_FLAGS environment var
   Opts.CodeComplete.AllScopes = AllScopesCompletion;
   Opts.CodeComplete.RunParser = CodeCompletionParse;
   Opts.CodeComplete.RankingModel = RankingModel;
-  Opts.CodeComplete.DecisionForestBase = DecisionForestBase;
 
   RealThreadsafeFS TFS;
   std::vector> ProviderStack;



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


[PATCH] D94513: [clangd] Remove "decision-forest-base" experimental flag.

2021-01-13 Thread Utkarsh Saxena via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa4f386688239: [clangd] Remove 
"decision-forest-base" experimental flag. (authored by usaxena95).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94513

Files:
  clang-tools-extra/clangd/tool/ClangdMain.cpp


Index: clang-tools-extra/clangd/tool/ClangdMain.cpp
===
--- clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -194,14 +194,6 @@
 Hidden,
 };
 
-opt DecisionForestBase{
-"decision-forest-base",
-cat(Features),
-desc("Base for exponentiating the prediction from DecisionForest."),
-init(CodeCompleteOptions().DecisionForestBase),
-Hidden,
-};
-
 // FIXME: also support "plain" style where signatures are always omitted.
 enum CompletionStyleFlag { Detailed, Bundled };
 opt CompletionStyle{
@@ -841,7 +833,6 @@
   Opts.CodeComplete.AllScopes = AllScopesCompletion;
   Opts.CodeComplete.RunParser = CodeCompletionParse;
   Opts.CodeComplete.RankingModel = RankingModel;
-  Opts.CodeComplete.DecisionForestBase = DecisionForestBase;
 
   RealThreadsafeFS TFS;
   std::vector> ProviderStack;


Index: clang-tools-extra/clangd/tool/ClangdMain.cpp
===
--- clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -194,14 +194,6 @@
 Hidden,
 };
 
-opt DecisionForestBase{
-"decision-forest-base",
-cat(Features),
-desc("Base for exponentiating the prediction from DecisionForest."),
-init(CodeCompleteOptions().DecisionForestBase),
-Hidden,
-};
-
 // FIXME: also support "plain" style where signatures are always omitted.
 enum CompletionStyleFlag { Detailed, Bundled };
 opt CompletionStyle{
@@ -841,7 +833,6 @@
   Opts.CodeComplete.AllScopes = AllScopesCompletion;
   Opts.CodeComplete.RunParser = CodeCompletionParse;
   Opts.CodeComplete.RankingModel = RankingModel;
-  Opts.CodeComplete.DecisionForestBase = DecisionForestBase;
 
   RealThreadsafeFS TFS;
   std::vector> ProviderStack;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] 0bbc6a6 - [clangd] Remove some old CodeCompletion options that are never (un)set. NFC

2021-01-13 Thread Sam McCall via cfe-commits

Author: Sam McCall
Date: 2021-01-13T18:01:48+01:00
New Revision: 0bbc6a6bb643af69baaf85f7f380dbcfe1f5ad54

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

LOG: [clangd] Remove some old CodeCompletion options that are never (un)set.  
NFC

Added: 


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

Removed: 




diff  --git a/clang-tools-extra/clangd/CodeComplete.cpp 
b/clang-tools-extra/clangd/CodeComplete.cpp
index 53c647a68788..b3b40022fbb2 100644
--- a/clang-tools-extra/clangd/CodeComplete.cpp
+++ b/clang-tools-extra/clangd/CodeComplete.cpp
@@ -277,7 +277,7 @@ struct CodeCompletionBuilder {
 CodeCompletionContext::Kind ContextKind,
 const CodeCompleteOptions &Opts,
 bool IsUsingDeclaration, tok::TokenKind NextTokenKind)
-  : ASTCtx(ASTCtx), ExtractDocumentation(Opts.IncludeComments),
+  : ASTCtx(ASTCtx),
 EnableFunctionArgSnippets(Opts.EnableFunctionArgSnippets),
 IsUsingDeclaration(IsUsingDeclaration), NextTokenKind(NextTokenKind) {
 add(C, SemaCCS);
@@ -393,7 +393,7 @@ struct CodeCompletionBuilder {
   S.SnippetSuffix = std::string(C.IndexResult->CompletionSnippetSuffix);
   S.ReturnType = std::string(C.IndexResult->ReturnType);
 }
-if (ExtractDocumentation && !Completion.Documentation) {
+if (!Completion.Documentation) {
   auto SetDoc = [&](llvm::StringRef Doc) {
 if (!Doc.empty()) {
   Completion.Documentation.emplace();
@@ -512,7 +512,6 @@ struct CodeCompletionBuilder {
   ASTContext *ASTCtx;
   CodeCompletion Completion;
   llvm::SmallVector Bundled;
-  bool ExtractDocumentation;
   bool EnableFunctionArgSnippets;
   // No snippets will be generated for using declarations and when the function
   // arguments are already present.
@@ -1765,8 +1764,8 @@ class CodeCompleteFlow {
 
 clang::CodeCompleteOptions CodeCompleteOptions::getClangCompleteOpts() const {
   clang::CodeCompleteOptions Result;
-  Result.IncludeCodePatterns = EnableSnippets && IncludeCodePatterns;
-  Result.IncludeMacros = IncludeMacros;
+  Result.IncludeCodePatterns = EnableSnippets;
+  Result.IncludeMacros = true;
   Result.IncludeGlobals = true;
   // We choose to include full comments and not do doxygen parsing in
   // completion.

diff  --git a/clang-tools-extra/clangd/CodeComplete.h 
b/clang-tools-extra/clangd/CodeComplete.h
index ce8a2097a6d9..f7ac3c7e5aba 100644
--- a/clang-tools-extra/clangd/CodeComplete.h
+++ b/clang-tools-extra/clangd/CodeComplete.h
@@ -50,17 +50,6 @@ struct CodeCompleteOptions {
   /// b})).
   bool EnableSnippets = false;
 
-  /// Add code patterns to completion results.
-  /// If EnableSnippets is false, this options is ignored and code patterns 
will
-  /// always be omitted.
-  bool IncludeCodePatterns = true;
-
-  /// Add macros to code completion results.
-  bool IncludeMacros = true;
-
-  /// Add comments to code completion results, if available.
-  bool IncludeComments = true;
-
   /// Include results that are not legal completions in the current context.
   /// For example, private members are usually inaccessible.
   bool IncludeIneligibleResults = false;

diff  --git a/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp 
b/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
index 76b193b49791..43a557d6c73e 100644
--- a/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
+++ b/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
@@ -315,8 +315,7 @@ void testAfterDotCompletion(clangd::CodeCompleteOptions 
Opts) {
   EXPECT_THAT(Results.Completions,
   Not(Contains(Kind(CompletionItemKind::Snippet;
   // Check documentation.
-  EXPECT_IFF(Opts.IncludeComments, Results.Completions,
- Contains(IsDocumented()));
+  EXPECT_THAT(Results.Completions, Contains(IsDocumented()));
 }
 
 void testGlobalScopeCompletion(clangd::CodeCompleteOptions Opts) {
@@ -356,14 +355,13 @@ void 
testGlobalScopeCompletion(clangd::CodeCompleteOptions Opts) {
 Has("index_func" /* our fake symbol doesn't include () */),
 Has("GlobalClass"), Has("IndexClass")));
   // A macro.
-  EXPECT_IFF(Opts.IncludeMacros, Results.Completions, Has("MACRO"));
+  EXPECT_THAT(Results.Completions, Has("MACRO"));
   // Local items. Must be present always.
   EXPECT_THAT(Results.Completions,
   AllOf(Has("local_var"), Has("LocalClass"),
 Contains(Kind(CompletionItemKind::Snippet;
   // Check documentation.
-  EXPECT_IFF(Opts.IncludeComments, Results.Completions,
- Contains(IsDocumented()));
+  EXPECT_THAT(Results.Completions, Contains(I

[PATCH] D93453: [flang][driver] Add support for `-I`

2021-01-13 Thread Faris via Phabricator via cfe-commits
FarisRehman updated this revision to Diff 316423.
FarisRehman added a comment.

Add a new test

Update the regression test to check the behaviour of multiple `-I`'s specified.

Summary of changes:

- Update regression test with new checks
- Fix regression tests that broke when patch D93712 
 was implemented


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93453

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/Flang.cpp
  flang/include/flang/Frontend/PreprocessorOptions.h
  flang/lib/Frontend/CompilerInvocation.cpp
  flang/test/Flang-Driver/Inputs/SecondaryInputs/basic-test-header.h
  flang/test/Flang-Driver/Inputs/basic-test-header.h
  flang/test/Flang-Driver/driver-help-hidden.f90
  flang/test/Flang-Driver/driver-help.f90
  flang/test/Flang-Driver/include-header.f90

Index: flang/test/Flang-Driver/include-header.f90
===
--- /dev/null
+++ flang/test/Flang-Driver/include-header.f90
@@ -0,0 +1,59 @@
+! Ensure argument -I works as expected.
+
+! REQUIRES: new-flang-driver
+
+!--
+! FLANG DRIVER (flang-new)
+!--
+! RUN: not %flang-new -E %s  2>&1 | FileCheck %s --check-prefix=UNINCLUDED
+! RUN: %flang-new -E -I %S/Inputs %s  2>&1 | FileCheck %s --check-prefix=SINGLEINCLUDE
+! RUN: %flang-new -E -I %S/Inputs -I %S/Inputs/SecondaryInputs %s  2>&1 | FileCheck %s --check-prefix=PRIMARYINCLUDE
+! RUN: %flang-new -E -I %S/Inputs/SecondaryInputs -I %S/Inputs %s  2>&1 | FileCheck %s --check-prefix=SECONDARYINCLUDE
+! RUN: not %flang-new -E -I %S/InvalidFolder %s  2>&1 | FileCheck %s --check-prefix=UNINCLUDED
+
+!-
+! FRONTEND FLANG DRIVER (flang-new -fc1)
+!-
+! RUN: not %flang-new -fc1 -E %s  2>&1 | FileCheck %s --check-prefix=UNINCLUDED
+! RUN: %flang-new -fc1 -E -I %S/Inputs %s  2>&1 | FileCheck %s --check-prefix=SINGLEINCLUDE
+! RUN: %flang-new -E -I %S/Inputs -I %S/Inputs/SecondaryInputs %s  2>&1 | FileCheck %s --check-prefix=PRIMARYINCLUDE
+! RUN: %flang-new -E -I %S/Inputs/SecondaryInputs -I %S/Inputs %s  2>&1 | FileCheck %s --check-prefix=SECONDARYINCLUDE
+! RUN: not %flang-new -fc1 -E -I %S/InvalidFolder %s  2>&1 | FileCheck %s --check-prefix=UNINCLUDED
+
+!
+! EXPECTED OUTPUT FOR MISSING INCLUDED FILE
+!
+! UNINCLUDED:No such file or directory
+! UNINCLUDED-NOT:program a
+
+!--
+! EXPECTED OUTPUT FOR A SINGLE INCLUDE
+!--
+! SINGLEINCLUDE:program firstdirectory
+! SINGLEINCLUDE-NOT:program x
+! SINGLEINCLUDE-NOT:program b
+! SINGLEINCLUDE-NEXT:end
+
+!-
+! EXPECTED OUTPUT FOR /Inputs/ FOLDER SPECIFIED FIRST
+!-
+! PRIMARYINCLUDE:program firstdirectory
+! PRIMARYINCLUDE-NOT:program seconddirectory
+! PRIMARYINCLUDE-NOT:program b
+! PRIMARYINCLUDE-NEXT:end
+
+!-
+! EXPECTED OUTPUT FOR /Inputs/SecondaryInputs/ FOLDER SPECIFIED FIRST
+!-
+! SECONDARYINCLUDE:program seconddirectory
+! SECONDARYINCLUDE-NOT:program firstdirectory
+! SECONDARYINCLUDE-NOT:program b
+! SECONDARYINCLUDE-NEXT:end
+
+#include 
+#ifdef X
+program X
+#else
+program B
+#endif
+end
\ No newline at end of file
Index: flang/test/Flang-Driver/driver-help.f90
===
--- flang/test/Flang-Driver/driver-help.f90
+++ flang/test/Flang-Driver/driver-help.f90
@@ -25,6 +25,7 @@
 ! HELP-NEXT: -fcolor-diagnosticsEnable colors in diagnostics
 ! HELP-NEXT: -fno-color-diagnostics Disable colors in diagnostics
 ! HELP-NEXT: -help  Display available options
+! HELP-NEXT: -IAdd directory to the end of the list of include search paths
 ! HELP-NEXT: -o   Write output to 
 ! HELP-NEXT: -U  Undefine macro 
 ! HELP-NEXT: --version  Print version information
@@ -39,6 +40,7 @@
 ! HELP-FC1-NEXT: -emit-obj Emit native object files
 ! HELP-FC1-NEXT: -E Only run the preprocessor
 ! HELP-FC1-NEXT: -help  Display available options
+! HELP-FC1-NEXT: -IAdd directory to the end of the list of include search paths
 ! HELP-FC1-NEXT: -o   Write output to 
 ! HELP-FC1-NEXT: -U  Undefine macro 
 ! HELP-FC1-NEXT: --version  Print version information
Index: flang/test/Flang-Driver/driver-help-hidden.f90
===
--- flang/test/Flang-Driver/driver-help-hidden.f90
+++ flang/test/Flang-Dr

[PATCH] D93453: [flang][driver] Add support for `-I`

2021-01-13 Thread Tim Keith via Phabricator via cfe-commits
tskeith added inline comments.



Comment at: flang/test/Flang-Driver/include-header.f90:59
+#endif
+end

`-I` also is supposed to affect INCLUDE lines so it would be good to have a 
test for that too. They are handled during preprocessing and so can be tested 
the same way.

It also affects searching for .mod files but I think to test that requires 
semantics (i.e. to report an error if the module can't be found). It would be 
good to test that somewhere too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93453

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


[PATCH] D94614: [FPEnv][X86] Platform builtins edition: clang should get from the AST the metadata for constrained FP builtins

2021-01-13 Thread Kevin P. Neal via Phabricator via cfe-commits
kpn created this revision.
kpn added reviewers: craig.topper, andrew.w.kaylor.
kpn added a project: clang.
Herald added a subscriber: pengfei.
kpn requested review of this revision.
Herald added a subscriber: cfe-commits.

Currently clang is not correctly retrieving from the AST the metadata for 
constrained FP builtins. This patch fixes that for the X86 specific builtins.

For previous work in this vein see D92122  for 
example.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94614

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/X86/avx-builtins-constrained-cmp.c
  clang/test/CodeGen/X86/avx512dq-builtins-constrained.c
  clang/test/CodeGen/X86/avx512f-builtins-constrained.c
  clang/test/CodeGen/X86/fma-builtins-constrained.c
  clang/test/CodeGen/X86/sse-builtins-constrained.c

Index: clang/test/CodeGen/X86/sse-builtins-constrained.c
===
--- clang/test/CodeGen/X86/sse-builtins-constrained.c
+++ clang/test/CodeGen/X86/sse-builtins-constrained.c
@@ -1,8 +1,15 @@
 // REQUIRES: x86-registered-target
 // RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +sse -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefix=UNCONSTRAINED --check-prefix=COMMON --check-prefix=COMMONIR
-// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +sse -ffp-exception-behavior=strict -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefix=CONSTRAINED --check-prefix=COMMON --check-prefix=COMMONIR
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +sse -ffp-exception-behavior=maytrap -DSTRICT=1 -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefix=CONSTRAINED --check-prefix=COMMON --check-prefix=COMMONIR
 // RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +sse -S %s -o - -Wall -Werror | FileCheck %s --check-prefix=CHECK-ASM --check-prefix=COMMON
-// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +sse -ffp-exception-behavior=strict -S %s -o - -Wall -Werror | FileCheck %s --check-prefix=CHECK-ASM --check-prefix=COMMON
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +sse -ffp-exception-behavior=maytrap -DSTRICT=1 -S %s -o - -Wall -Werror | FileCheck %s --check-prefix=CHECK-ASM --check-prefix=COMMON
+
+#ifdef STRICT
+// Test that the constrained intrinsics are picking up the exception
+// metadata from the AST instead of the global default from the command line.
+
+#pragma float_control(except, on)
+#endif
 
 
 #include 
Index: clang/test/CodeGen/X86/fma-builtins-constrained.c
===
--- clang/test/CodeGen/X86/fma-builtins-constrained.c
+++ clang/test/CodeGen/X86/fma-builtins-constrained.c
@@ -1,8 +1,15 @@
 // REQUIRES: x86-registered-target
 // RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +fma -O2 -emit-llvm -o - | FileCheck %s --check-prefixes=COMMON,COMMONIR,UNCONSTRAINED
-// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +fma -ffp-exception-behavior=strict -O2 -emit-llvm -o - | FileCheck %s --check-prefixes=COMMON,COMMONIR,CONSTRAINED
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +fma -ffp-exception-behavior=maytrap -DSTRICT=1 -O2 -emit-llvm -o - | FileCheck %s --check-prefixes=COMMON,COMMONIR,CONSTRAINED
 // RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +fma -O2 -S -o - | FileCheck %s --check-prefixes=COMMON,CHECK-ASM
-// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +fma -O2 -ffp-exception-behavior=strict -S -o - | FileCheck %s --check-prefixes=COMMON,CHECK-ASM
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +fma -O2 -ffp-exception-behavior=maytrap -DSTRICT=1 -S -o - | FileCheck %s --check-prefixes=COMMON,CHECK-ASM
+
+#ifdef STRICT
+// Test that the constrained intrinsics are picking up the exception
+// metadata from the AST instead of the global default from the command line.
+
+#pragma float_control(except, on)
+#endif
 
 #include 
 
Index: clang/test/CodeGen/X86/avx512f-builtins-constrained.c
===
--- clang/test/CodeGen/X86/avx512f-builtins-constrained.c
+++ clang/test/CodeGen/X86/avx512f-builtins-constrained.c
@@ -1,10 +1,17 @@
 // REQUIRES: x86-registered-target
 // RUN: %clang_cc1 -fexperimental-new-pass-manager -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +avx512f -emit-llvm -o - -Wall -Werror | FileCheck --check-prefix=COMMON --check-prefix=COMMONIR --check-prefix=UNCONSTRAINED %s
 // RUN: %clang_cc1 -fexperimental-new-pass-manager -flax-vector-conversions=none -fms-extensions -f

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-13 Thread Albertas Vyšniauskas via Phabricator via cfe-commits
thezbyg updated this revision to Diff 316446.
thezbyg added a comment.

Rebased changes on master.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93846

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/include/clang/Format/Format.h
  clang/lib/Format/Format.cpp
  clang/lib/Format/UnwrappedLineFormatter.cpp
  clang/test/Format/access-modifiers.cpp
  clang/unittests/Format/FormatTest.cpp

Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -8887,6 +8887,292 @@
getLLVMStyle());
 }
 
+TEST_F(FormatTest, FormatsAccessModifiers) {
+  verifyFormat("struct foo {\n"
+   "private:\n"
+   "  void f() {}\n"
+   "\n"
+   "private:\n"
+   "  int i;\n"
+   "\n"
+   "protected:\n"
+   "  int j;\n"
+   "};\n");
+  verifyFormat("struct foo {\n"
+   "private:\n"
+   "  void f() {}\n"
+   "\n"
+   "private:\n"
+   "  int i;\n"
+   "\n"
+   "protected:\n"
+   "  int j;\n"
+   "};\n",
+   "struct foo {\n"
+   "private:\n"
+   "  void f() {}\n"
+   "private:\n"
+   "  int i;\n"
+   "protected:\n"
+   "  int j;\n"
+   "};\n");
+  verifyFormat("struct foo { /* comment */\n"
+   "private:\n"
+   "  int i;\n"
+   "  // comment\n"
+   "private:\n"
+   "  int j;\n"
+   "};\n");
+  verifyFormat("struct foo {\n"
+   "#ifdef FOO\n"
+   "#endif\n"
+   "private:\n"
+   "  int i;\n"
+   "#ifdef FOO\n"
+   "private:\n"
+   "#endif\n"
+   "  int j;\n"
+   "};\n");
+  FormatStyle Style = getLLVMStyle();
+  Style.EmptyLineBeforeAccessModifier = FormatStyle::ELBAMS_Never;
+  verifyFormat("struct foo {\n"
+   "private:\n"
+   "  void f() {}\n"
+   "private:\n"
+   "  int i;\n"
+   "protected:\n"
+   "  int j;\n"
+   "};\n",
+   Style);
+  verifyFormat("struct foo {\n"
+   "private:\n"
+   "  void f() {}\n"
+   "private:\n"
+   "  int i;\n"
+   "protected:\n"
+   "  int j;\n"
+   "};\n",
+   "struct foo {\n"
+   "\n"
+   "private:\n"
+   "  void f() {}\n"
+   "\n"
+   "private:\n"
+   "  int i;\n"
+   "\n"
+   "protected:\n"
+   "  int j;\n"
+   "};\n",
+   Style);
+  verifyFormat("struct foo { /* comment */\n"
+   "private:\n"
+   "  int i;\n"
+   "  // comment\n"
+   "private:\n"
+   "  int j;\n"
+   "};\n",
+   "struct foo { /* comment */\n"
+   "\n"
+   "private:\n"
+   "  int i;\n"
+   "  // comment\n"
+   "\n"
+   "private:\n"
+   "  int j;\n"
+   "};\n",
+   Style);
+  verifyFormat("struct foo {\n"
+   "#ifdef FOO\n"
+   "#endif\n"
+   "private:\n"
+   "  int i;\n"
+   "#ifdef FOO\n"
+   "private:\n"
+   "#endif\n"
+   "  int j;\n"
+   "};\n",
+   "struct foo {\n"
+   "#ifdef FOO\n"
+   "#endif\n"
+   "\n"
+   "private:\n"
+   "  int i;\n"
+   "#ifdef FOO\n"
+   "\n"
+   "private:\n"
+   "#endif\n"
+   "  int j;\n"
+   "};\n",
+   Style);
+  Style.EmptyLineBeforeAccessModifier = FormatStyle::ELBAMS_Always;
+  verifyFormat("struct foo {\n"
+   "private:\n"
+   "  void f() {}\n"
+   "\n"
+   "private:\n"
+   "  int i;\n"
+   "\n"
+   "protected:\n"
+   "  int j;\n"
+   "};\n",
+   Style);
+  verifyFormat("struct foo {\n"
+   "private:\n"
+   "  void f() {}\n"
+   "\n"
+   "private:\n"
+   "  int i;\n"
+   "\n"
+   "protected:\n"
+   "  int j;\n"
+   "};\n",
+   "struct foo {\n"
+   "private:\n"
+   "  void f() {}\n"
+   "private:\n"
+   "  int i;\n"
+  

[PATCH] D89909: [SYCL] Implement SYCL address space attributes handling

2021-01-13 Thread Alexey Bader via Phabricator via cfe-commits
bader added a comment.

In D89909#2448443 , @Anastasia wrote:

> If you prefer to continue this route then you should just document your 
> dialect sematic somewhere publicly accessible and avoid aliasing to OpenCL, 
> or target address spaces. So it would become a proper language dialect 
> implementation.

I've added a section to our internal design document about address space 
handling in SYCL mode: pull request  
(more readable version 
).
 Please, take a look and let me know if it can be improved.




Comment at: clang/lib/Basic/Targets.cpp:577
-  case llvm::Triple::spir: {
-if (Triple.getOS() != llvm::Triple::UnknownOS ||
-Triple.getEnvironment() != llvm::Triple::UnknownEnvironment)

Anastasia wrote:
> bader wrote:
> > Anastasia wrote:
> > > We should not allow any arbitrary OS/Environment for SPIR.
> > @Anastasia, could you elaborate on that, please? Why can't we allow 
> > arbitrary values for these triple components?
> > 
> > The only reason I'm aware of is that LLVM-SPIRV-Translator was checking OS 
> > triple component and rejected LLVM module if value was not "unknow". Today 
> > it checks only "architecture' component and accepts only "spir" 
> > architecture. I personally think that even this restriction is artificial 
> > and LLVM module shouldn't be rejected based on the triple values, but it's 
> > a separate discussion.
> > 
> > I use additional environment component to choose between address space 
> > maps. We could update default address space in SPIRAddrSpaceMap directly, 
> > but IIRC, it caused some issues for OpenCL C++ mode, which uses Default 
> > address space instead of `opencl_private` in some cases.
> > 
> > Do you know if there is a better way to communicate the difference in 
> > Default address space to SPIRTargetInfo object?
> SPIR is not a real target but a virtual one and therefore it doesn't have 
> different flavour for vendors or  and not run with any concrete OS. What good 
> would it make to allow specifying `spir-apple-darwin10` or `spir-pc-win32`? 
> What difference do we expect?
> 
> > Do you know if there is a better way to communicate the difference in 
> > Default address space to SPIRTargetInfo object?
> 
> If you only add the environment component to set the address spaces map then 
> it doesn't feel like the right flow. In fact, your comments indicate that you 
> aim to support the other targets too - how would this work for other targets 
> that are not SPIR? And why are you specializing the map for SPIR but not 
> other targets? 
> SPIR is not a real target but a virtual one and therefore it doesn't have 
> different flavour for vendors or and not run with any concrete OS. What good 
> would it make to allow specifying `spir-apple-darwin10` or `spir-pc-win32`? 
> What difference do we expect?

I'm not sure I follow you. I don't see how OS or environment components are 
related to target architecture component. Additional information about 
execution environment allows compiler provide better results (e.g. configure 
include directories to system paths, set macro enabling code customization for 
particular OS, etc). I can imagine a situation when user would want write a 
code customized for different execution environments:
```
#if __linux__
...
#elseif _WIN32
...
#endif
```

and materialize "virtual LLVM IR" to x86 or ARM architecture.


> > Do you know if there is a better way to communicate the difference in 
> > Default address space to SPIRTargetInfo object?
> 
> If you only add the environment component to set the address spaces map then 
> it doesn't feel like the right flow. In fact, your comments indicate that you 
> aim to support the other targets too 

Not at all.

> And why are you specializing the map for SPIR but not other targets? 

Other targets correctly map Default AST address space to LLVM address space. 
The only other target specializing this map is AMDGPU and it selects the map 
based on architecture component of the target triple.



Comment at: clang/lib/Basic/Targets.cpp:577
-  case llvm::Triple::spir: {
-if (Triple.getOS() != llvm::Triple::UnknownOS ||
-Triple.getEnvironment() != llvm::Triple::UnknownEnvironment)

bader wrote:
> Anastasia wrote:
> > bader wrote:
> > > Anastasia wrote:
> > > > We should not allow any arbitrary OS/Environment for SPIR.
> > > @Anastasia, could you elaborate on that, please? Why can't we allow 
> > > arbitrary values for these triple components?
> > > 
> > > The only reason I'm aware of is that LLVM-SPIRV-Translator was checking 
> > > OS triple component and rejected LLVM module if value was not "unknow". 
> > > Today it checks only "architecture' component and accepts only "spir" 
> > > archite

[PATCH] D89909: [SYCL] Implement SYCL address space attributes handling

2021-01-13 Thread Alexey Bader via Phabricator via cfe-commits
bader updated this revision to Diff 316447.
bader added a comment.

Re-base patch and fix lit test failures.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89909

Files:
  clang/include/clang/AST/Type.h
  clang/include/clang/Basic/AddressSpaces.h
  clang/include/clang/Sema/ParsedAttr.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ItaniumMangle.cpp
  clang/lib/AST/TypePrinter.cpp
  clang/lib/Basic/Targets.cpp
  clang/lib/Basic/Targets/AMDGPU.cpp
  clang/lib/Basic/Targets/NVPTX.h
  clang/lib/Basic/Targets/SPIR.h
  clang/lib/Basic/Targets/TCE.h
  clang/lib/Basic/Targets/X86.h
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/Sema/SemaType.cpp
  clang/test/CodeGenSYCL/address-space-cond-op.cpp
  clang/test/CodeGenSYCL/address-space-of-returns.cpp
  clang/test/CodeGenSYCL/address-space-parameter-conversions.cpp
  clang/test/CodeGenSYCL/address-spaces.cpp
  clang/test/SemaSYCL/address-space-parameter-conversions.cpp
  clang/test/SemaTemplate/address_space-dependent.cpp
  llvm/include/llvm/ADT/Triple.h
  llvm/lib/Support/Triple.cpp

Index: llvm/lib/Support/Triple.cpp
===
--- llvm/lib/Support/Triple.cpp
+++ llvm/lib/Support/Triple.cpp
@@ -246,6 +246,8 @@
   case Musl: return "musl";
   case MuslEABI: return "musleabi";
   case MuslEABIHF: return "musleabihf";
+  case SYCLDevice:
+return "sycldevice";
   case Simulator: return "simulator";
   }
 
@@ -535,26 +537,27 @@
 
 static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) {
   return StringSwitch(EnvironmentName)
-.StartsWith("eabihf", Triple::EABIHF)
-.StartsWith("eabi", Triple::EABI)
-.StartsWith("gnuabin32", Triple::GNUABIN32)
-.StartsWith("gnuabi64", Triple::GNUABI64)
-.StartsWith("gnueabihf", Triple::GNUEABIHF)
-.StartsWith("gnueabi", Triple::GNUEABI)
-.StartsWith("gnux32", Triple::GNUX32)
-.StartsWith("code16", Triple::CODE16)
-.StartsWith("gnu", Triple::GNU)
-.StartsWith("android", Triple::Android)
-.StartsWith("musleabihf", Triple::MuslEABIHF)
-.StartsWith("musleabi", Triple::MuslEABI)
-.StartsWith("musl", Triple::Musl)
-.StartsWith("msvc", Triple::MSVC)
-.StartsWith("itanium", Triple::Itanium)
-.StartsWith("cygnus", Triple::Cygnus)
-.StartsWith("coreclr", Triple::CoreCLR)
-.StartsWith("simulator", Triple::Simulator)
-.StartsWith("macabi", Triple::MacABI)
-.Default(Triple::UnknownEnvironment);
+  .StartsWith("eabihf", Triple::EABIHF)
+  .StartsWith("eabi", Triple::EABI)
+  .StartsWith("gnuabin32", Triple::GNUABIN32)
+  .StartsWith("gnuabi64", Triple::GNUABI64)
+  .StartsWith("gnueabihf", Triple::GNUEABIHF)
+  .StartsWith("gnueabi", Triple::GNUEABI)
+  .StartsWith("gnux32", Triple::GNUX32)
+  .StartsWith("code16", Triple::CODE16)
+  .StartsWith("gnu", Triple::GNU)
+  .StartsWith("android", Triple::Android)
+  .StartsWith("musleabihf", Triple::MuslEABIHF)
+  .StartsWith("musleabi", Triple::MuslEABI)
+  .StartsWith("musl", Triple::Musl)
+  .StartsWith("msvc", Triple::MSVC)
+  .StartsWith("itanium", Triple::Itanium)
+  .StartsWith("cygnus", Triple::Cygnus)
+  .StartsWith("coreclr", Triple::CoreCLR)
+  .StartsWith("sycldevice", Triple::SYCLDevice)
+  .StartsWith("simulator", Triple::Simulator)
+  .StartsWith("macabi", Triple::MacABI)
+  .Default(Triple::UnknownEnvironment);
 }
 
 static Triple::ObjectFormatType parseFormat(StringRef EnvironmentName) {
Index: llvm/include/llvm/ADT/Triple.h
===
--- llvm/include/llvm/ADT/Triple.h
+++ llvm/include/llvm/ADT/Triple.h
@@ -221,8 +221,9 @@
 Itanium,
 Cygnus,
 CoreCLR,
+SYCLDevice,
 Simulator, // Simulator variants of other systems, e.g., Apple's iOS
-MacABI, // Mac Catalyst variant of Apple's iOS deployment target.
+MacABI,// Mac Catalyst variant of Apple's iOS deployment target.
 LastEnvironmentType = MacABI
   };
   enum ObjectFormatType {
@@ -496,6 +497,10 @@
isMacCatalystEnvironment()));
   }
 
+  bool isSYCLDeviceEnvironment() const {
+return getEnvironment() == Triple::SYCLDevice;
+  }
+
   bool isOSNetBSD() const {
 return getOS() == Triple::NetBSD;
   }
Index: clang/test/SemaTemplate/address_space-dependent.cpp
===
--- clang/test/SemaTemplate/address_space-dependent.cpp
+++ clang/test/SemaTemplate/address_space-dependent.cpp
@@ -43,7 +43,7 @@
 
 template 
 void tooBig() {
-  __attribute__((address_space(I))) int *bounds; // expected-error {{address space is larger than the maximum supported (8388593)}}
+  __attribute__((address_space(I))) int *bounds; // expected-error {{address space is larger than the maximum supported (8388590)}}
 }
 
 template 
@@ -101,7 +101,7 @@

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-13 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added inline comments.



Comment at: clang/lib/Format/Format.cpp:235
+IO.enumCase(Value, "Never", FormatStyle::ELBAMS_Never);
+IO.enumCase(Value, "DontModify", FormatStyle::ELBAMS_DontModify);
+IO.enumCase(Value, "LogicalBlock", FormatStyle::ELBAMS_LogicalBlock);

Other places use `Leave` I assume that means the same as DontModify?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93846

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


[PATCH] D93101: [Clang][Codegen] Truncate initializers of union bitfield members

2021-01-13 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments.



Comment at: clang/lib/AST/ExprConstant.cpp:9801-9804
+return EvaluateInPlace(Result.getUnionValue(), Info, Subobject, InitExpr) 
||
+   (Field->isBitField() &&
+truncateBitfieldValue(Info, InitExpr, Result.getUnionValue(),
+  Field));

Shouldn't this be `&&` not `||`? These functions return `true` if they succeed 
(unlike the convention in `Sema` where `true` means an error diagnostic was 
produced).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93101

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


[PATCH] D94617: [RISCV] Add Zba feature and move add.uw and slli.uw to it.

2021-01-13 Thread Craig Topper via Phabricator via cfe-commits
craig.topper created this revision.
craig.topper added reviewers: asb, lenary, frasercrmck, luismarques, kito-cheng.
Herald added subscribers: NickHung, evandro, apazos, sameer.abuasal, pzheng, 
s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, 
rogfer01, edward-jones, zzheng, jrtc27, shiva0217, niosHD, sabuasal, simoncook, 
johnrusso, rbar, hiraditya.
craig.topper requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.
Herald added projects: clang, LLVM.

Still need to add SH*ADD instructions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94617

Files:
  clang/lib/Driver/ToolChains/Arch/RISCV.cpp
  clang/test/Driver/riscv-arch.c
  llvm/lib/Target/RISCV/RISCV.td
  llvm/lib/Target/RISCV/RISCVInstrInfoB.td
  llvm/lib/Target/RISCV/RISCVSubtarget.h
  llvm/test/CodeGen/RISCV/rv64Zba.ll
  llvm/test/CodeGen/RISCV/rv64Zbb.ll
  llvm/test/MC/RISCV/rv64zba-invalid.s
  llvm/test/MC/RISCV/rv64zba-valid.s
  llvm/test/MC/RISCV/rv64zbb-invalid.s
  llvm/test/MC/RISCV/rv64zbb-valid.s

Index: llvm/test/MC/RISCV/rv64zbb-valid.s
===
--- llvm/test/MC/RISCV/rv64zbb-valid.s
+++ llvm/test/MC/RISCV/rv64zbb-valid.s
@@ -12,12 +12,6 @@
 # RUN: | llvm-objdump --mattr=+experimental-zbb -d -r - \
 # RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
 
-# CHECK-ASM-AND-OBJ: slli.uw t0, t1, 0
-# CHECK-ASM: encoding: [0x9b,0x12,0x03,0x08]
-slli.uw t0, t1, 0
-# CHECK-ASM-AND-OBJ: add.uw t0, t1, t2
-# CHECK-ASM: encoding: [0xbb,0x02,0x73,0x08]
-add.uw t0, t1, t2
 # CHECK-ASM-AND-OBJ: slow t0, t1, t2
 # CHECK-ASM: encoding: [0xbb,0x12,0x73,0x20]
 slow t0, t1, t2
Index: llvm/test/MC/RISCV/rv64zbb-invalid.s
===
--- llvm/test/MC/RISCV/rv64zbb-invalid.s
+++ llvm/test/MC/RISCV/rv64zbb-invalid.s
@@ -1,13 +1,6 @@
 # RUN: not llvm-mc -triple riscv64 -mattr=+experimental-b,experimental-zbb < %s 2>&1 | FileCheck %s
 
 # Too few operands
-slli.uw t0, t1 # CHECK: :[[@LINE]]:1: error: too few operands for instruction
-# Immediate operand out of range
-slli.uw t0, t1, 64 # CHECK: :[[@LINE]]:17: error: immediate must be an integer in the range [0, 63]
-slli.uw t0, t1, -1 # CHECK: :[[@LINE]]:17: error: immediate must be an integer in the range [0, 63]
-# Too few operands
-add.uw t0, t1 # CHECK: :[[@LINE]]:1: error: too few operands for instruction
-# Too few operands
 slow t0, t1 # CHECK: :[[@LINE]]:1: error: too few operands for instruction
 # Too few operands
 srow t0, t1 # CHECK: :[[@LINE]]:1: error: too few operands for instruction
Index: llvm/test/MC/RISCV/rv64zba-valid.s
===
--- /dev/null
+++ llvm/test/MC/RISCV/rv64zba-valid.s
@@ -0,0 +1,20 @@
+# With B extension:
+# RUN: llvm-mc %s -triple=riscv64 -mattr=+experimental-b -show-encoding \
+# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
+# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+experimental-b < %s \
+# RUN: | llvm-objdump --mattr=+experimental-b -d -r - \
+# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
+
+# With Bitmanip base extension:
+# RUN: llvm-mc %s -triple=riscv64 -mattr=+experimental-zba -show-encoding \
+# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
+# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+experimental-zba < %s \
+# RUN: | llvm-objdump --mattr=+experimental-zba -d -r - \
+# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
+
+# CHECK-ASM-AND-OBJ: slli.uw t0, t1, 0
+# CHECK-ASM: encoding: [0x9b,0x12,0x03,0x08]
+slli.uw t0, t1, 0
+# CHECK-ASM-AND-OBJ: add.uw t0, t1, t2
+# CHECK-ASM: encoding: [0xbb,0x02,0x73,0x08]
+add.uw t0, t1, t2
Index: llvm/test/MC/RISCV/rv64zba-invalid.s
===
--- /dev/null
+++ llvm/test/MC/RISCV/rv64zba-invalid.s
@@ -0,0 +1,9 @@
+# RUN: not llvm-mc -triple riscv64 -mattr=+experimental-b,experimental-zba < %s 2>&1 | FileCheck %s
+
+# Too few operands
+slli.uw t0, t1 # CHECK: :[[@LINE]]:1: error: too few operands for instruction
+# Immediate operand out of range
+slli.uw t0, t1, 64 # CHECK: :[[@LINE]]:17: error: immediate must be an integer in the range [0, 63]
+slli.uw t0, t1, -1 # CHECK: :[[@LINE]]:17: error: immediate must be an integer in the range [0, 63]
+# Too few operands
+add.uw t0, t1 # CHECK: :[[@LINE]]:1: error: too few operands for instruction
Index: llvm/test/CodeGen/RISCV/rv64Zbb.ll
===
--- llvm/test/CodeGen/RISCV/rv64Zbb.ll
+++ llvm/test/CodeGen/RISCV/rv64Zbb.ll
@@ -987,49 +987,3 @@
   %abs = tail call i64 @llvm.abs.i64(i64 %x, i1 true)
   ret i64 %abs
 }
-
-define i64 @slliuw(i64 %a) nounwind {
-; RV64I-LABEL: slliuw:
-; RV64I:   # %bb.0:
-; RV64I-NEXT:slli a0, a0, 1
-; RV64I-NEXT:addi a1, zero, 1
-; RV64I-NEXT:slli a1, a1, 33
-; RV64I-NEXT:addi 

[PATCH] D94337: Add cuda header type for cuh files

2021-01-13 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment.

In D94337#2492108 , @rgreenblatt wrote:

> In D94337#2491825 , @tra wrote:
>
>> 'Works' is not exactly the same as 'works correctly'. This example makes 
>> `a()` look like a regular host function, instead of the kernel, and that 
>> affects how the rest of the TU get parsed.
>> I.e. you'll have further errors if somewhere down below the file has 
>> `a<<<1,1>>>()`. Similar story with ignoring `__host__` and `__device__` 
>> attributes -- that may lead to various overload resolution errors, or 
>> reporting conflicting redeclarations/redefinitions for the perfectly valid 
>> host/device function overloads. The list goes on.
>
> No, this part is definitely working, the full set of SDK headers is included. 
> I have confirmed this by compiling a .cu and a .cuh file with `-E` and 
> checking that the output is identical. Further, I have confirmed that 
> `global<<<_, _>>>()` builds, that `__host__` only functions can't be used on 
> the device, and that `__device__` functions can't be used on the host.

We were talking about the case where clang can't expand CUDA-specific macros. 
It works in your specific case because you do have CUDA installed and compiler 
did find it. It's not necessarily the case for everyone everywhere. We want 
clang to work for tooling even when CUDA SDK is not installed on the machine at 
all. My argument was that without a sufficient set of CUDA macros clang can't 
parse CUDA sources correctly. CUDA SDK is currently the only source of those 
macros. We need clang to provide its own for the cases when CUDA SDK is not 
available.

Try compiling that source with `-nocudainc` which will illustrate what happens 
when CUDA SDK is not found. E.g. https://godbolt.org/z/MoKvfq

> To fix this, I added a new type `TY_CUDAHeader_DEVICE`. This type precompiles 
> a header for a specific device architecture. 
> This type is used in place of `TY_CUDA_DEVICE` in the appropriate case. 
> I think having a header device type is the correct approach if a separate 
> header type is used.

I think this kind of compilation pipeline restructuring is a bit premature. We 
need to address being able to parse CUDA headers reliably first.

There's also a question of whether it's necessary. It's not very useful for the 
Driver functionality itself and can be implemented in the tooling by explicitly 
telling the driver what we want. Your patch appears to implement it the other 
way around -- the tooling relies on the driver to implement the CUDA header 
handling magic. I think the right approach is to teach tooling how to handle 
CUDA and keep the clang driver changes to a minimum. Based on our previous 
conversation, se seem to need only `-x cuda-header`. Everything else can be 
controlled by the tooling with `--cuda-host-only`/`--cuda-device-only 
--cuda-gpu-arch=XXX`. Considering that tooling can't deal with more than one 
sub-compilation, using these flags is going to be necessary anyways.

> @tra I am guessing you have already thought about this, but
> one thing which is worth noting is that language servers 
> only maintain a single AST per file (and this probably won't change).

Using AST from the host-side compilation was an easy-to-do trade-off. It works 
reasonably well most of the time, at least for the sources we have exact 
compilation flags for. Re-engineering tooling to deal with multiple ASTs per TU 
just for CUDA may not be worth it.

> This is the host AST of course.
> For example, in the above program language servers
> will only have a diagnostic for `#pragma message "host"`.
> So, the values of `--cuda-gpu-arch` aren't relevant for language servers
> beyond determining what the preprocessor includes.
> However, the fact that the preprocessor includes depend on arch
> means that the __clang_cuda_standalone_defs.h approach won't always be 
> perfectly
> correct.

Yes, that's exactly why I mentioned before that ideally we may need multiple 
ASTs as each device compilation will have a slightly different one.  The goal 
of `__clang_cuda_standalone_defs.h` is to make it possible to parse CUDA 
sources at all w/o having to rely on CUDA SDK. It is not intended to solve the 
multiple-AST issue.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94337

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


[PATCH] D80344: [Windows SEH]: HARDWARE EXCEPTION HANDLING (MSVC -EHa) - Part 1

2021-01-13 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

I'm sorry that it's taking a while to find time to review the implementation; 
I'll try to get to it this week.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80344

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


[PATCH] D94500: Rework Whitesmiths mode to use line-level values in UnwrappedLineParser

2021-01-13 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added inline comments.



Comment at: clang/unittests/Format/FormatTest.cpp:13707
WhitesmithsBraceStyle);
 
   verifyFormat("enum X\n"

any reason why this is being removed?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94500

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


[PATCH] D94621: docs

2021-01-13 Thread Vasily Kulikov via Phabricator via cfe-commits
segoon created this revision.
segoon requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94621

Files:
  clang-tools-extra/docs/clang-tidy/checks/concurrency-async-fs.rst


Index: clang-tools-extra/docs/clang-tidy/checks/concurrency-async-fs.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/concurrency-async-fs.rst
+++ clang-tools-extra/docs/clang-tidy/checks/concurrency-async-fs.rst
@@ -24,6 +24,9 @@
 * Linux syscalls
 * Boost.Filesystem, Boost.Nowide
 
+Options
+---
+
 .. option:: FunctionsExtra
 
   Specifies additional functions to search for, separated with semicolon.


Index: clang-tools-extra/docs/clang-tidy/checks/concurrency-async-fs.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/concurrency-async-fs.rst
+++ clang-tools-extra/docs/clang-tidy/checks/concurrency-async-fs.rst
@@ -24,6 +24,9 @@
 * Linux syscalls
 * Boost.Filesystem, Boost.Nowide
 
+Options
+---
+
 .. option:: FunctionsExtra
 
   Specifies additional functions to search for, separated with semicolon.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D94621: [clang-tidy] add concurrency-async-fs

2021-01-13 Thread Vasily Kulikov via Phabricator via cfe-commits
segoon updated this revision to Diff 316460.
segoon retitled this revision from "docs" to "[clang-tidy] add 
concurrency-async-fs".
segoon edited the summary of this revision.
segoon added a comment.
Herald added subscribers: ormris, xazax.hun, mgorny.

fix


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

https://reviews.llvm.org/D94621

Files:
  clang-tools-extra/clang-tidy/concurrency/AsyncFsCheck.cpp
  clang-tools-extra/clang-tidy/concurrency/AsyncFsCheck.h
  clang-tools-extra/clang-tidy/concurrency/CMakeLists.txt
  clang-tools-extra/clang-tidy/concurrency/ConcurrencyTidyModule.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/concurrency-async-fs.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/test/clang-tidy/checkers/concurrency-async-fs.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/concurrency-async-fs.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/concurrency-async-fs.cpp
@@ -0,0 +1,87 @@
+// RUN: %check_clang_tidy %s concurrency-async-fs %t -- \
+// RUN: -config='{CheckOptions: [{key: "concurrency-async-fs.FunctionsExtra", value: "::my::block"},{key: "concurrency-async-fs.TypesExtra", value: "::my::file"}]}'
+
+void chdir(const char *);
+
+namespace std {
+namespace filesystem {
+bool exists(const char *);
+
+void copy(const char *, const char *);
+
+class directory_iterator {
+public:
+  directory_iterator(const char *);
+
+  bool operator!=(const directory_iterator &) const;
+
+  directory_iterator &operator++();
+
+  int operator*() const;
+};
+
+directory_iterator begin(directory_iterator iter) noexcept;
+// CHECK-MESSAGES: :[[@LINE-1]]:26: warning: type 'directory_iterator' may access filesystem in a blocking way [concurrency-async-fs]
+directory_iterator end(const directory_iterator &) noexcept;
+
+} // namespace filesystem
+
+template 
+class basic_fstream {};
+
+template 
+class basic_ofstream {};
+
+template 
+class basic_ifstream {};
+
+typedef basic_fstream fstream;
+typedef basic_ofstream ofstream;
+typedef basic_ifstream ifstream;
+
+} // namespace std
+
+void copy();
+
+void test_core() {
+  chdir("/");
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: function 'chdir' may block on filesystem access [concurrency-async-fs]
+
+  std::filesystem::exists("/");
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: function 'exists' may block on filesystem access [concurrency-async-fs]
+
+  std::filesystem::copy("/a", "/b");
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: function 'copy' may block on filesystem access [concurrency-async-fs]
+
+  copy();
+
+  for (const auto &f : std::filesystem::directory_iterator("/")) {
+// CHECK-MESSAGES: :[[@LINE-1]]:22: warning: type 'directory_iterator' may access filesystem in a blocking way [concurrency-async-fs]
+  }
+}
+
+void test_fstream() {
+  std::fstream fs;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: type 'basic_fstream' may access filesystem in a blocking way [concurrency-async-fs]
+  std::ofstream of;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: type 'basic_ofstream' may access filesystem in a blocking way [concurrency-async-fs]
+  std::ifstream ifs;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: type 'basic_ifstream' may access filesystem in a blocking way [concurrency-async-fs]
+
+  std::basic_fstream bfs;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: type 'basic_fstream' may access filesystem in a blocking way [concurrency-async-fs]
+}
+
+namespace my {
+class file {};
+
+void block();
+} // namespace my
+
+void test_user() {
+  my::file f;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: type 'file' may access filesystem in a blocking way [concurrency-async-fs]
+
+  my::block();
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: function 'block' may block on filesystem access [concurrency-async-fs]
+}
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
@@ -139,6 +139,7 @@
`clang-analyzer-valist.CopyToSelf `_,
`clang-analyzer-valist.Uninitialized `_,
`clang-analyzer-valist.Unterminated `_,
+   `concurrency-async-fs `_,
`concurrency-mt-unsafe `_,
`cppcoreguidelines-avoid-goto `_,
`cppcoreguidelines-avoid-non-const-global-variables `_,
Index: clang-tools-extra/docs/clang-tidy/checks/concurrency-async-fs.rst
===
--- /dev/null
+++ clang-tools-extra/docs/clang-tidy/checks/concurrency-async-fs.rst
@@ -0,0 +1,36 @@
+.. title:: clang-tidy - concurrency-async-fs
+
+concurrency-async-fs
+
+
+Search for filesystem accesses that might block current system thread.
+Asynchronous code may deal with it in numerous ways, the most widespread
+ways are the following:
+
+* use asynchronous API like aio

[PATCH] D94624: [PATCH] [clang-query] Add a --use-color option to clang-query

2021-01-13 Thread Tom Ritter via Phabricator via cfe-commits
tomrittervg created this revision.
tomrittervg requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

My first attempt was to figure out how to plumb the
--use-color command line argument to the DiagnosticEngine
that gets referenced in AST->getDiagnostics().getDiagnosticOptions()

However, this did not turn to be fruitful. Those options get created
in ToolInvocation::run() from the command line given to the *tool*.
That command-line is constructed in ClangTool::run() and there's no
apparent way to edit those Diagnostics from the clang-query tool
easily.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94624

Files:
  clang-tools-extra/clang-query/Query.cpp
  clang-tools-extra/clang-query/QuerySession.h
  clang-tools-extra/clang-query/tool/ClangQuery.cpp


Index: clang-tools-extra/clang-query/tool/ClangQuery.cpp
===
--- clang-tools-extra/clang-query/tool/ClangQuery.cpp
+++ clang-tools-extra/clang-query/tool/ClangQuery.cpp
@@ -49,6 +49,14 @@
 static cl::extrahelp CommonHelp(CommonOptionsParser::HelpMessage);
 static cl::OptionCategory ClangQueryCategory("clang-query options");
 
+static cl::opt
+UseColor("use-color",
+ cl::desc(
+ R"(Use colors in detailed AST output. If not set, colors
+will be used if the terminal connected to
+standard output supports colors.)"),
+ cl::init(false), cl::cat(ClangQueryCategory));
+
 static cl::list Commands("c", cl::desc("Specify command to run"),
   cl::value_desc("command"),
   cl::cat(ClangQueryCategory));
@@ -124,7 +132,7 @@
 assert(Status == 0 && "Unexpected status returned");
   }
 
-  QuerySession QS(ASTs);
+  QuerySession QS(ASTs, UseColor);
 
   if (!Commands.empty()) {
 for (auto I = Commands.begin(), E = Commands.end(); I != E; ++I) {
Index: clang-tools-extra/clang-query/QuerySession.h
===
--- clang-tools-extra/clang-query/QuerySession.h
+++ clang-tools-extra/clang-query/QuerySession.h
@@ -23,9 +23,9 @@
 /// Represents the state for a particular clang-query session.
 class QuerySession {
 public:
-  QuerySession(llvm::ArrayRef> ASTs)
+  QuerySession(llvm::ArrayRef> ASTs, bool UseColor)
   : ASTs(ASTs), PrintOutput(false), DiagOutput(true),
-DetailedASTOutput(false), BindRoot(true), PrintMatcher(false),
+DetailedASTOutput(false), ColorOutput(UseColor), BindRoot(true), 
PrintMatcher(false),
 Terminate(false), TK(ast_type_traits::TK_AsIs) {}
 
   llvm::ArrayRef> ASTs;
@@ -34,6 +34,8 @@
   bool DiagOutput;
   bool DetailedASTOutput;
 
+  bool ColorOutput;
+
   bool BindRoot;
   bool PrintMatcher;
   bool Terminate;
Index: clang-tools-extra/clang-query/Query.cpp
===
--- clang-tools-extra/clang-query/Query.cpp
+++ clang-tools-extra/clang-query/Query.cpp
@@ -157,7 +157,7 @@
   OS << "Binding for \"" << BI->first << "\":\n";
   const ASTContext &Ctx = AST->getASTContext();
   const SourceManager &SM = Ctx.getSourceManager();
-  ASTDumper Dumper(OS, Ctx, SM.getDiagnostics().getShowColors());
+  ASTDumper Dumper(OS, Ctx, QS.ColorOutput);
   Dumper.SetTraversalKind(QS.TK);
   Dumper.Visit(BI->second);
   OS << "\n";


Index: clang-tools-extra/clang-query/tool/ClangQuery.cpp
===
--- clang-tools-extra/clang-query/tool/ClangQuery.cpp
+++ clang-tools-extra/clang-query/tool/ClangQuery.cpp
@@ -49,6 +49,14 @@
 static cl::extrahelp CommonHelp(CommonOptionsParser::HelpMessage);
 static cl::OptionCategory ClangQueryCategory("clang-query options");
 
+static cl::opt
+UseColor("use-color",
+ cl::desc(
+ R"(Use colors in detailed AST output. If not set, colors
+will be used if the terminal connected to
+standard output supports colors.)"),
+ cl::init(false), cl::cat(ClangQueryCategory));
+
 static cl::list Commands("c", cl::desc("Specify command to run"),
   cl::value_desc("command"),
   cl::cat(ClangQueryCategory));
@@ -124,7 +132,7 @@
 assert(Status == 0 && "Unexpected status returned");
   }
 
-  QuerySession QS(ASTs);
+  QuerySession QS(ASTs, UseColor);
 
   if (!Commands.empty()) {
 for (auto I = Commands.begin(), E = Commands.end(); I != E; ++I) {
Index: clang-tools-extra/clang-query/QuerySession.h
===
--- clang-tools-extra/clang-query/QuerySession.h
+++ clang-tools-extra/clang-query/QuerySession.h
@@ -23,9 +23,9 @@
 /// Represents the state for a particular clang-query session.
 class QuerySession {
 public:
-  QuerySession(llvm::ArrayRef> ASTs)
+  QuerySession(ll

[PATCH] D93585: [AArch64] Enable out-of-line atomics by default.

2021-01-13 Thread Pavel Iliin via Phabricator via cfe-commits
ilinpv updated this revision to Diff 316471.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93585

Files:
  clang/include/clang/Driver/ToolChain.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/Linux.cpp
  clang/lib/Driver/ToolChains/Linux.h
  llvm/lib/Target/AArch64/AArch64.td
  llvm/test/CodeGen/AArch64/arm64_32-atomics.ll
  llvm/test/CodeGen/AArch64/atomic-ops-not-barriers.ll
  llvm/test/CodeGen/AArch64/atomic-ops.ll
  llvm/test/CodeGen/AArch64/cmpxchg-O0.ll
  llvm/test/CodeGen/AArch64/cmpxchg-idioms.ll
  llvm/test/Transforms/AtomicExpand/AArch64/expand-atomicrmw-xchg-fp.ll

Index: llvm/test/Transforms/AtomicExpand/AArch64/expand-atomicrmw-xchg-fp.ll
===
--- llvm/test/Transforms/AtomicExpand/AArch64/expand-atomicrmw-xchg-fp.ll
+++ llvm/test/Transforms/AtomicExpand/AArch64/expand-atomicrmw-xchg-fp.ll
@@ -1,6 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt -S -mtriple=aarch64-- -atomic-expand %s | FileCheck %s
-; RUN: opt -S -mtriple=aarch64-- -mattr=+outline-atomics -atomic-expand %s | FileCheck %s --check-prefix=OUTLINE-ATOMICS
+; RUN: opt -S -mtriple=aarch64-- -mattr=-outline-atomics -atomic-expand %s | FileCheck %s
+; RUN: opt -S -mtriple=aarch64-- -atomic-expand %s | FileCheck %s --check-prefix=OUTLINE-ATOMICS
 
 define void @atomic_swap_f16(half* %ptr, half %val) nounwind {
 ; CHECK-LABEL: @atomic_swap_f16(
Index: llvm/test/CodeGen/AArch64/cmpxchg-idioms.ll
===
--- llvm/test/CodeGen/AArch64/cmpxchg-idioms.ll
+++ llvm/test/CodeGen/AArch64/cmpxchg-idioms.ll
@@ -1,5 +1,5 @@
-; RUN: llc -mtriple=aarch64-apple-ios7.0 -o - %s | FileCheck %s
-; RUN: llc -mtriple=aarch64-apple-ios7.0 -mattr=+outline-atomics -o - %s | FileCheck %s --check-prefix=OUTLINE-ATOMICS
+; RUN: llc -mtriple=aarch64-apple-ios7.0 -mattr=-outline-atomics -o - %s | FileCheck %s
+; RUN: llc -mtriple=aarch64-apple-ios7.0 -o - %s | FileCheck %s --check-prefix=OUTLINE-ATOMICS
 
 define i32 @test_return(i32* %p, i32 %oldval, i32 %newval) {
 ; OUTLINE-ATOMICS: bl ___aarch64_cas4_acq_rel
Index: llvm/test/CodeGen/AArch64/cmpxchg-O0.ll
===
--- llvm/test/CodeGen/AArch64/cmpxchg-O0.ll
+++ llvm/test/CodeGen/AArch64/cmpxchg-O0.ll
@@ -1,5 +1,5 @@
-; RUN: llc -verify-machineinstrs -mtriple=aarch64-linux-gnu -O0 -fast-isel=0 -global-isel=false %s -o - | FileCheck -enable-var-scope %s
-; RUN: llc -verify-machineinstrs -mtriple=aarch64-linux-gnu -O0 -fast-isel=0 -global-isel=false -mattr=+outline-atomics %s -o - | FileCheck -enable-var-scope %s --check-prefix=OUTLINE-ATOMICS
+; RUN: llc -verify-machineinstrs -mtriple=aarch64-linux-gnu -O0 -fast-isel=0 -global-isel=false -mattr=-outline-atomics %s -o - | FileCheck -enable-var-scope %s
+; RUN: llc -verify-machineinstrs -mtriple=aarch64-linux-gnu -O0 -fast-isel=0 -global-isel=false %s -o - | FileCheck -enable-var-scope %s --check-prefix=OUTLINE-ATOMICS
 
 define { i8, i1 } @test_cmpxchg_8(i8* %addr, i8 %desired, i8 %new) nounwind {
 ; OUTLINE-ATOMICS: bl __aarch64_cas1_acq_rel
Index: llvm/test/CodeGen/AArch64/atomic-ops.ll
===
--- llvm/test/CodeGen/AArch64/atomic-ops.ll
+++ llvm/test/CodeGen/AArch64/atomic-ops.ll
@@ -1,6 +1,6 @@
-; RUN: llc -mtriple=aarch64-none-linux-gnu -disable-post-ra -verify-machineinstrs < %s | FileCheck %s
-; RUN: llc -mtriple=aarch64-none-linux-gnu -disable-post-ra -verify-machineinstrs < %s | FileCheck %s --check-prefix=CHECK-REG
-; RUN: llc -mtriple=aarch64-none-linux-gnu -disable-post-ra -verify-machineinstrs -mattr=+outline-atomics < %s | FileCheck %s --check-prefix=OUTLINE_ATOMICS
+; RUN: llc -mtriple=aarch64-none-linux-gnu -disable-post-ra -verify-machineinstrs -mattr=-outline-atomics < %s | FileCheck %s
+; RUN: llc -mtriple=aarch64-none-linux-gnu -disable-post-ra -verify-machineinstrs -mattr=-outline-atomics < %s | FileCheck %s --check-prefix=CHECK-REG
+; RUN: llc -mtriple=aarch64-none-linux-gnu -disable-post-ra -verify-machineinstrs < %s | FileCheck %s --check-prefix=OUTLINE_ATOMICS
 
 
 ; Point of CHECK-REG is to make sure UNPREDICTABLE instructions aren't created
Index: llvm/test/CodeGen/AArch64/atomic-ops-not-barriers.ll
===
--- llvm/test/CodeGen/AArch64/atomic-ops-not-barriers.ll
+++ llvm/test/CodeGen/AArch64/atomic-ops-not-barriers.ll
@@ -1,5 +1,5 @@
-; RUN: llc -mtriple=aarch64-none-linux-gnu -verify-machineinstrs < %s | FileCheck %s
-; RUN: llc -mtriple=aarch64-none-linux-gnu -verify-machineinstrs -mattr=+outline-atomics < %s | FileCheck %s --check-prefix=OUTLINE-ATOMICS
+; RUN: llc -mtriple=aarch64-none-linux-gnu -verify-machineinstrs -mattr=-outline-atomics < %s | FileCheck %s
+; RUN: llc -mtriple=aar

[PATCH] D94627: [PowerPC][PC Rel] Implement option to omit P10 instructions from stubs

2021-01-13 Thread Albion Fung via Phabricator via cfe-commits
Conanap created this revision.
Conanap added reviewers: stefanp, nemanjai, PowerPC.
Conanap added projects: LLVM, clang, PowerPC.
Herald added subscribers: dang, kbarton, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a reviewer: MaskRay.
Conanap requested review of this revision.

Implemented the option to omit Power10 instructions from save stubs via the 
option `--no-power10-stubs` or `--power10-stubs=no` on lld. `--power10-stubs=` 
will override the other option. `--power10-stubs=auto` also exists to use the 
default behaviour (ie allow Power10 instructions in stubs).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94627

Files:
  lld/ELF/Config.h
  lld/ELF/Driver.cpp
  lld/ELF/Options.td
  lld/ELF/Thunks.cpp
  lld/test/ELF/ppc64-call-reach.s
  lld/test/ELF/ppc64-long-branch-localentry-offset.s
  lld/test/ELF/ppc64-long-branch-pi.s
  lld/test/ELF/ppc64-long-branch-rel14.s
  lld/test/ELF/ppc64-long-branch.s
  lld/test/ELF/ppc64-pcrel-call-to-extern.s
  lld/test/ELF/ppc64-pcrel-call-to-toc.s
  lld/test/ELF/ppc64-plt-stub-compatible.s
  lld/test/ELF/ppc64-tls-pcrel-gd.s
  lld/test/ELF/ppc64-toc-call-to-pcrel-long-jump.s
  lld/test/ELF/ppc64-toc-call-to-pcrel.s
  llvm/include/llvm/Object/ELF.h

Index: llvm/include/llvm/Object/ELF.h
===
--- llvm/include/llvm/Object/ELF.h
+++ llvm/include/llvm/Object/ELF.h
@@ -50,7 +50,11 @@
 
 enum PPCInstrMasks : uint64_t {
   PADDI_R12_NO_DISP = 0x06103980,
+  ADDIS_R12_NO_DISP = 0x3D80,
+  ADDI_R12_TO_R12_NO_DISP = 0x398C,
   PLD_R12_NO_DISP = 0x0410E580,
+  LD_R12_NO_DISP = 0xE980,
+  LD_R12_TO_R12_NO_DISP = 0xE98C,
   MTCTR_R12 = 0x7D8903A6,
   BCTR = 0x4E800420,
 };
Index: lld/test/ELF/ppc64-toc-call-to-pcrel.s
===
--- lld/test/ELF/ppc64-toc-call-to-pcrel.s
+++ lld/test/ELF/ppc64-toc-call-to-pcrel.s
@@ -14,7 +14,13 @@
 # RUN: llvm-readelf -s %t | FileCheck %s --check-prefix=SYMBOL
 # RUN: llvm-objdump -d --no-show-raw-insn --mcpu=future %t | FileCheck %s
 
-# The point of this test is to make sure that when a function with TOC access
+# RUN: llvm-mc -filetype=obj -triple=powerpc64 %s -o %t.o
+# RUN: ld.lld -T %t.script %t.o -o %t --no-power10-stubs
+# RUN: llvm-readelf -s %t | FileCheck %s --check-prefix=SYMBOL
+# RUN: llvm-objdump -d --no-show-raw-insn --mcpu=future %t \
+# RUN: | FileCheck %s
+
+## The point of this test is to make sure that when a function with TOC access
 # a local function with st_other=1, a TOC save stub is inserted.
 
 # SYMBOL: Symbol table '.symtab' contains 7 entries
Index: lld/test/ELF/ppc64-toc-call-to-pcrel-long-jump.s
===
--- lld/test/ELF/ppc64-toc-call-to-pcrel-long-jump.s
+++ lld/test/ELF/ppc64-toc-call-to-pcrel-long-jump.s
@@ -16,10 +16,10 @@
 # SYM-NEXT: 2: 20020008 0 NOTYPE  LOCAL  DEFAULT []   3 caller
 # SYM-NEXT: 3: 10020008 0 NOTYPE  LOCAL  DEFAULT  2 caller_close
 # SYM-NEXT: 4: 000520020008 0 NOTYPE  LOCAL  DEFAULT  4 caller_far
-# SYM-NEXT: 5: 000520028038 0 NOTYPE  LOCAL  HIDDEN   6 .TOC.
+# SYM-NEXT: 5: 000520028040 0 NOTYPE  LOCAL  HIDDEN   6 .TOC.
 # SYM-NEXT: 6: 10020020 8 FUNCLOCAL  DEFAULT  2 __toc_save_callee
-# SYM-NEXT: 7: 2002002020 FUNCLOCAL  DEFAULT  3 __toc_save_callee
-# SYM-NEXT: 8: 00052002002020 FUNCLOCAL  DEFAULT  4 __toc_save_callee
+# SYM-NEXT: 7: 2002002032 FUNCLOCAL  DEFAULT  3 __toc_save_callee
+# SYM-NEXT: 8: 00052002002032 FUNCLOCAL  DEFAULT  4 __toc_save_callee
 
 #--- lts
 PHDRS {
Index: lld/test/ELF/ppc64-tls-pcrel-gd.s
===
--- lld/test/ELF/ppc64-tls-pcrel-gd.s
+++ lld/test/ELF/ppc64-tls-pcrel-gd.s
@@ -42,10 +42,10 @@
 #--- asm
 
 # GD-RELOC: Relocation section '.rela.dyn' at offset 0x100b8 contains 4 entries:
-# GD-RELOC: 01001160  00020044 R_PPC64_DTPMOD64    x + 0
-# GD-RELOC: 01001168  0002004e R_PPC64_DTPREL64    x + 0
-# GD-RELOC: 01001170  00030044 R_PPC64_DTPMOD64    y + 0
-# GD-RELOC: 01001178  0003004e R_PPC64_DTPREL64    y + 0
+# GD-RELOC: 01001170  00020044 R_PPC64_DTPMOD64    x + 0
+# GD-RELOC: 01001178  0002004e R_PPC64_DTPREL64    x + 0
+# GD-RELOC: 01001180  00030044 R_PPC64_DTPMOD64    y + 0
+# GD-RELOC: 01001188  0003004e R_PPC64_DTPREL64    y + 0
 
 # GD-SYM:   Symbol table '.dynsym' contains 4 entries:
 # GD-SYM:

[PATCH] D93585: [AArch64] Enable out-of-line atomics by default.

2021-01-13 Thread Pavel Iliin via Phabricator via cfe-commits
ilinpv marked 2 inline comments as done.
ilinpv added inline comments.



Comment at: llvm/lib/Target/AArch64/AArch64.td:1087
  FeatureNEON,
+ FeatureOutlineAtomics,
  FeaturePerfMon,

t.p.northover wrote:
> I think this still enables it more widely than we want. Clang overrides it 
> with `-outline-atomics`, but other front-ends don't.
Could I ask you to clarify what front-ends you meant (to check outline atomics 
suport for them)?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93585

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


[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-13 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added a comment.

Apart from that last naming issue looks good to me.




Comment at: clang/lib/Format/Format.cpp:235
+IO.enumCase(Value, "Never", FormatStyle::ELBAMS_Never);
+IO.enumCase(Value, "DontModify", FormatStyle::ELBAMS_DontModify);
+IO.enumCase(Value, "LogicalBlock", FormatStyle::ELBAMS_LogicalBlock);

MyDeveloperDay wrote:
> Other places use `Leave` I assume that means the same as DontModify?
If that's the case, we should stick with it. Although I personally find 
DontModify better.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93846

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


[PATCH] D94500: Rework Whitesmiths mode to use line-level values in UnwrappedLineParser

2021-01-13 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added inline comments.



Comment at: clang/lib/Format/TokenAnalyzer.cpp:71
Env.getFirstStartColumn(), Style, Encoding, Allocator,
-
IdentTable);

Unrelated change (although I think it's good one).



Comment at: clang/lib/Format/UnwrappedLineParser.h:143
   bool tryToParseSimpleAttribute();
-  void addUnwrappedLine();
+  void addUnwrappedLine(bool RemoveLevel = true);
   bool eof() const;

A `bool` parameter for something like that is not very nice. An `enum (class)` 
is much nicer.

If one does not know the declaration `addUnwrappedLine(false)` seems a bit odd, 
`addUnwrappedLine(LineLevel::Keep)` looks better. (The naming may be changed.)



Comment at: clang/unittests/Format/FormatTest.cpp:13528
"namespace B\n"
-   "  {\n"
+   "{\n"
"class C;\n"

So until now it has formatted that always wrong?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94500

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


[PATCH] D80391: [Driver] Don't make -gsplit-dwarf imply -g2

2021-01-13 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

Do we emit a warning if we see `-gsplit-dwarf` alone? Should we?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80391

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


[PATCH] D80391: [Driver] Don't make -gsplit-dwarf imply -g2

2021-01-13 Thread Nico Weber via Phabricator via cfe-commits
thakis added inline comments.



Comment at: clang/docs/ReleaseNotes.rst:120
   `nonnull` attribute on `this` for configurations that need it to be nullable.
+- ``-gsplit-dwarf`` no longer implies ``-g2``.
 

This apparently bit us (chromium) in thinlto configs. Could this here be more 
explicit that `-gsplit-dwarf` now needs an explicit `-g2` in cflags, and if 
using thinlto, in ldflags as well?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80391

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


[PATCH] D94424: [clangd] Make AST-based signals available to runWithPreamble.

2021-01-13 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment.

Thanks, this looks pretty solid!

I want to be pretty careful about APIs/naming/code organization here (even 
moreso than usual!) because TUScheduler is a big complex beast as it is, and 
it's easy to get lost.




Comment at: clang-tools-extra/clangd/TUScheduler.cpp:421
 
+  std::shared_ptr getASTSignals() const;
+

In practice, this is always called together with getPossiblyStalePreamble() for 
runWithPreamble (2 callsites). The two feel fairly related, and they each lock 
the same mutex.

The other two callsites of getPossiblyStalePreamble() are measuring memory 
(which in principle should also get the ASTSignals, though in practice it's 
likely small enough not to matter), and building ASTs, which can ignore it.

I'd suggest combining them into the somewhat awkward signature
```shared_ptr getPossiblyStalePreamble(shared_ptr *PossiblyStaleASTSignals = nullptr)```



Comment at: clang-tools-extra/clangd/TUScheduler.cpp:423
+
+  void updateASTSignals(ParsedAST &AST);
+

why is this public?



Comment at: clang-tools-extra/clangd/TUScheduler.cpp:841
 
+void ASTWorker::updateASTSignals(ParsedAST &AST) {
+  ASTSignals Signals;

This implementation doesn't belong in TUScheduler, which is all about managing 
lifecycles and threading, rather than inspecting ASTs.

Best suggestion I have is to create a separate header ASTSignals.h, which 
defines the ASTSignals struct and a `static ASTSignals ASTSignals::derive(const 
ParsedAST&)` function to extract them.

(It's pretty awkward to even directly depend on it, since this feels more of a 
"feature" like go-to-definition that's independent of to TUScheduler and 
injected by ClangdServer, rather than core things like ParsedAST that are 
layered below TUScheduler. But fundamentally we can't avoid this without 
somehow obfuscating the data structure we're storing).



Comment at: clang-tools-extra/clangd/TUScheduler.cpp:851
+Signals.Symbols[ID] += 1;
+  // FIXME: Do not count the primary namespace as a related namespace.
+  // Eg. clang::clangd:: for this file.

why not?



Comment at: clang-tools-extra/clangd/TUScheduler.cpp:853
+  // Eg. clang::clangd:: for this file.
+  if (const auto *NSD = dyn_cast(ND->getDeclContext()))
+if (!ND->isInAnonymousNamespace()) {

as mentioned above, you may want to do this only if the per-symbol-count was 
incremented from 0 to 1.
You'd have to ignore namespaces for symbols with no symbolID, but that doesn't 
matter.



Comment at: clang-tools-extra/clangd/TUScheduler.cpp:854
+  if (const auto *NSD = dyn_cast(ND->getDeclContext()))
+if (!ND->isInAnonymousNamespace()) {
+  std::string NS;

why not NSD->isAnonymous()?

(and generally prefer early continue rather than indenting the whole loop body)



Comment at: clang-tools-extra/clangd/TUScheduler.cpp:855
+if (!ND->isInAnonymousNamespace()) {
+  std::string NS;
+  llvm::raw_string_ostream OS(NS);

rather than checking/printing the namespace every time it's encountered, 
collect a `DenseMap` and then run through them once 
at the end?



Comment at: clang-tools-extra/clangd/TUScheduler.cpp:857
+  llvm::raw_string_ostream OS(NS);
+  NSD->printQualifiedName(OS);
+  if (!OS.str().empty()) {

use printNamespaceScope() from AST.h, which correctly handles inline namespace, 
adds trailing "::" etc.



Comment at: clang-tools-extra/clangd/TUScheduler.cpp:866
+  // read is completed. The last reader deletes the old ASTSignals.
+  std::lock_guard Lock(Mutex);
+  LatestASTSignals = std::make_shared(std::move(Signals));

nit: to minimize the length of the locked section:

- move the new signals into the shared_ptr first (here I think you can just 
allocate it with make_shared in the first place). This avoids locking the 
allocation + move constructor.
- introduce a new scope for the locked section, and std::swap the shared_ptrs 
rather than moving. Together, this avoids locking the destructor of the old 
signals (it runs when the pointer you swapped it into goes out of scope, 
instead).




Comment at: clang-tools-extra/clangd/TUScheduler.h:38
 
+/// Signals derived from a valid AST of a file.
+struct ASTSignals {

Neither the comment or the name really explain what this is or what's unusual 
about it.
I can't think of a great name, but the comment should mention:
 - the purpose (provide information that can only be extracted from the AST to 
actions that can't access an AST)
 - the limitations (may be absent, always stale)
 - example usage (information about what declarations are used in a file 
aff

[PATCH] D94337: Add cuda header type for cuh files

2021-01-13 Thread Ryan Greenblatt via Phabricator via cfe-commits
rgreenblatt added a comment.

In D94337#2496329 , @tra wrote:

> We were talking about the case where clang can't expand CUDA-specific macros.

Somehow I totally forgot about or missed this context.

> I think this kind of compilation pipeline restructuring is a bit premature.

Yeah for sure. I was trying to make `clang++ file.cuh ...` do something same - 
this isn't at all needed for tooling. Also I was mostly doing this to improve 
my understanding of what is going on in Driver.cpp wrt. cuda compilation.

Sorry about missing or misunderstanding a lot of what you're saying and saying 
obvious things.

>> However, the fact that the preprocessor includes depend on arch
>> means that the __clang_cuda_standalone_defs.h approach won't always be 
>> perfectly
>> correct.
>
> `...` The goal of `__clang_cuda_standalone_defs.h` is to make it possible to 
> parse CUDA sources at all w/o having to rely on CUDA SDK. `...`

Should `__clang_cuda_standalone_defs.h` depend on the arch? For example, 
`__match_all_sync` doesn't exist in sm_35 but does exist in sm_75.
For tooling this might not matter because the host cuda includes don't depend 
on the arch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94337

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


[PATCH] D94237: [clang] Use SourceLocations in unions [NFCI]

2021-01-13 Thread David Blaikie via Phabricator via cfe-commits
dblaikie accepted this revision.
dblaikie added a comment.
This revision is now accepted and ready to land.

Sounds good


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94237

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


[PATCH] D80391: [Driver] Don't make -gsplit-dwarf imply -g2

2021-01-13 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In D80391#2496583 , @thakis wrote:

> Do we emit a warning if we see `-gsplit-dwarf` alone? Should we?

`{gcc,clang} -gcolumn-info -c a.c` does not warn about unused -gcolumn-info. 
Not having a warning makes such toggle flags more independent. Users can add 
them as default without checking about -g levels.

> This apparently bit us (chromium) in thinlto configs. Could this here be more 
> explicit that -gsplit-dwarf now needs an explicit -g2 in cflags, and if using 
> thinlto, in ldflags as well?

(I CCed you in a message half a year ago. My apologies, I probably should 
notified you again)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80391

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


[PATCH] D80391: [Driver] Don't make -gsplit-dwarf imply -g2

2021-01-13 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added inline comments.



Comment at: clang/docs/ReleaseNotes.rst:120
   `nonnull` attribute on `this` for configurations that need it to be nullable.
+- ``-gsplit-dwarf`` no longer implies ``-g2``.
 

thakis wrote:
> This apparently bit us (chromium) in thinlto configs. Could this here be more 
> explicit that `-gsplit-dwarf` now needs an explicit `-g2` in cflags, and if 
> using thinlto, in ldflags as well?
Arguably I think maybe it should be fixed/made to work for (thin)lto with -g2 
in cflags and -gsplit-dwarf in ldflags, without the need to specify -g2 in 
ldflags (if that's what you're saying is currently required). Since the -gN 
level would hopefully at best be ignored (because the IR carries the N in -gN 
with it, and it'd be unfortunate it enabling split dwarf meant you had to 
ignore all your per-file -gN levels, or that the -gN is ignored except for 
allowing -gsplit-dwarf to be respected).

@MaskRay ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80391

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


[PATCH] D80391: [Driver] Don't make -gsplit-dwarf imply -g2

2021-01-13 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added inline comments.



Comment at: clang/docs/ReleaseNotes.rst:120
   `nonnull` attribute on `this` for configurations that need it to be nullable.
+- ``-gsplit-dwarf`` no longer implies ``-g2``.
 

dblaikie wrote:
> thakis wrote:
> > This apparently bit us (chromium) in thinlto configs. Could this here be 
> > more explicit that `-gsplit-dwarf` now needs an explicit `-g2` in cflags, 
> > and if using thinlto, in ldflags as well?
> Arguably I think maybe it should be fixed/made to work for (thin)lto with -g2 
> in cflags and -gsplit-dwarf in ldflags, without the need to specify -g2 in 
> ldflags (if that's what you're saying is currently required). Since the -gN 
> level would hopefully at best be ignored (because the IR carries the N in -gN 
> with it, and it'd be unfortunate it enabling split dwarf meant you had to 
> ignore all your per-file -gN levels, or that the -gN is ignored except for 
> allowing -gsplit-dwarf to be respected).
> 
> @MaskRay ?
LLD LTO does not have debug related options. `ld -g` is an ignored 
compatibility option. LLD somewhat inherited that from GNU ld. I don't think 
`-gsplit-dwarf` or `-g` can be separately controlled in ldflags.

@thakis Can you share the crbug.com discussion thread?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80391

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


[PATCH] D80391: [Driver] Don't make -gsplit-dwarf imply -g2

2021-01-13 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added inline comments.



Comment at: clang/docs/ReleaseNotes.rst:120
   `nonnull` attribute on `this` for configurations that need it to be nullable.
+- ``-gsplit-dwarf`` no longer implies ``-g2``.
 

MaskRay wrote:
> dblaikie wrote:
> > thakis wrote:
> > > This apparently bit us (chromium) in thinlto configs. Could this here be 
> > > more explicit that `-gsplit-dwarf` now needs an explicit `-g2` in cflags, 
> > > and if using thinlto, in ldflags as well?
> > Arguably I think maybe it should be fixed/made to work for (thin)lto with 
> > -g2 in cflags and -gsplit-dwarf in ldflags, without the need to specify -g2 
> > in ldflags (if that's what you're saying is currently required). Since the 
> > -gN level would hopefully at best be ignored (because the IR carries the N 
> > in -gN with it, and it'd be unfortunate it enabling split dwarf meant you 
> > had to ignore all your per-file -gN levels, or that the -gN is ignored 
> > except for allowing -gsplit-dwarf to be respected).
> > 
> > @MaskRay ?
> LLD LTO does not have debug related options. `ld -g` is an ignored 
> compatibility option. LLD somewhat inherited that from GNU ld. I don't think 
> `-gsplit-dwarf` or `-g` can be separately controlled in ldflags.
> 
> @thakis Can you share the crbug.com discussion thread?
Hmm, I guess the thing that bit Chromium would've been the need to add -g2 to 
cflags where previously it might've been just -gsplit-dwarf for cflags and 
ldflags.

But it doesn't look like -g2 is needed in ldflags, only passing it to the 
compilation seems sufficient, then the -gsplit-dwarf passed to the link step is 
respected:
```
$ clang++-tot -flto=thin test.cpp -g -c && clang++-tot -flto=thin -fuse-ld=lld 
-gsplit-dwarf test.o && llvm-dwarfdump-tot a.out
a.out:  file format elf64-x86-64

.debug_info contents:
0x: Compile Unit: length = 0x002c, format = DWARF32, version = 
0x0004, abbr_offset = 0x, addr_size = 0x08 (next unit at 0x0030)

0x000b: DW_TAG_compile_unit
  DW_AT_stmt_list   (0x)
  DW_AT_comp_dir("/usr/local/google/home/blaikie/dev/scratch")
  DW_AT_GNU_dwo_name("a.out_dwo/1.dwo")
  DW_AT_GNU_dwo_id  (0xf29563d7c812deae)
  DW_AT_low_pc  (0x00201730)
  DW_AT_high_pc (0x00201738)
  DW_AT_GNU_addr_base   (0x)
$ clang++-tot -flto=thin test.cpp -g -c && clang++-tot -flto=thin -fuse-ld=lld  
test.o && llvm-dwarfdump-tot a.out
a.out:  file format elf64-x86-64

.debug_info contents:
0x: Compile Unit: length = 0x0047, format = DWARF32, version = 
0x0004, abbr_offset = 0x, addr_size = 0x08 (next unit at 0x004b)

0x000b: DW_TAG_compile_unit
  DW_AT_producer("clang version 12.0.0 
(g...@github.com:llvm/llvm-project.git 
0d88d7d82bc44b211a8187650a06c6cd3492186a)")
  DW_AT_language(DW_LANG_C_plus_plus_14)
  DW_AT_name("test.cpp")
  DW_AT_stmt_list   (0x)
  DW_AT_comp_dir("/usr/local/google/home/blaikie/dev/scratch")
  DW_AT_low_pc  (0x00201730)
  DW_AT_high_pc (0x00201738)

0x002a:   DW_TAG_subprogram
DW_AT_low_pc(0x00201730)
DW_AT_high_pc   (0x00201738)
DW_AT_frame_base(DW_OP_reg6 RBP)
DW_AT_name  ("main")
DW_AT_decl_file 
("/usr/local/google/home/blaikie/dev/scratch/test.cpp")
DW_AT_decl_line (3)
DW_AT_type  (0x0043 "int")
DW_AT_external  (true)

0x0043:   DW_TAG_base_type
DW_AT_name  ("int")
DW_AT_encoding  (DW_ATE_signed)
DW_AT_byte_size (0x04)

0x004a:   NULL
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80391

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


[PATCH] D94337: Add cuda header type for cuh files

2021-01-13 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment.

In D94337#2496627 , @rgreenblatt wrote:

>> `...` The goal of `__clang_cuda_standalone_defs.h` is to make it possible to 
>> parse CUDA sources at all w/o having to rely on CUDA SDK. `...`
>
> Should `__clang_cuda_standalone_defs.h` depend on the arch? For example, 
> `__match_all_sync` doesn't exist in sm_35 but does exist in sm_75.
> For tooling this might not matter because the host cuda includes don't depend 
> on the arch.

It's open for discussion.

At the very minimum we need the standard CUDA macros, builtin variables, and, 
maybe, few decls for things compiler expects from CUDA runtime. 
This would be a good starting point: 
https://github.com/llvm/llvm-project/blob/master/clang/test/SemaCUDA/Inputs/cuda.h
It will allow stand-alone CUDA parsing in general.

Arch-dependent things in CUDA headers are largely dealing with compiler 
builtins, so if they are missing, it should not be a very big deal. I believe 
tooling can deal with missing function declarations.
Missing types, if there are any may cause more issues, but I can't think of 
anything interesting types in CUDA headers that are type-dependent. Maybe 
bfloat16/tfloat32 for sm_8x+. It should not be a showstopper either.
In any case, stand-alone mode is unlikely to be very useful for a real CUDA 
compilation, so I'm not too worried about some missing pieces.

Tooling can then pass `-x cuda[-header] -nocudainc --cuda-host-only -include 
__clang_cuda_standalone_defs.h` when it processes CUDA files. 
Then we'll need to test this stand-alone header and see if we need anything 
else to extract for reasonably complete and correct AST from CUDA sources & 
headers. Augment the stand-alone wrapper as necessary and repeat.

If standalone mode turns out to be useful  beyond tooling, we may consider how 
to expose it to the end-users. Maybe a `--cuda-path=none` or some other flag to 
tell it to pre-include the stand-alone variant of the wrapper.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94337

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


[clang-tools-extra] fb98a1b - Fix the warnings on unused variables (NFC)

2021-01-13 Thread Kazu Hirata via cfe-commits

Author: Kazu Hirata
Date: 2021-01-13T13:32:40-08:00
New Revision: fb98a1be43645c87fff089c4cc9555ca2400268c

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

LOG: Fix the warnings on unused variables (NFC)

Added: 


Modified: 
clang-tools-extra/clangd/AST.cpp
lld/MachO/InputSection.cpp
llvm/lib/Transforms/Coroutines/CoroFrame.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/AST.cpp 
b/clang-tools-extra/clangd/AST.cpp
index 8af4cbb19a3d..aecaf7e6b8f7 100644
--- a/clang-tools-extra/clangd/AST.cpp
+++ b/clang-tools-extra/clangd/AST.cpp
@@ -116,6 +116,7 @@ getQualification(ASTContext &Context, const DeclContext 
*DestContext,
 if (auto *TD = llvm::dyn_cast(CurContext)) {
   // There can't be any more tag parents after hitting a namespace.
   assert(!ReachedNS);
+  (void)ReachedNS;
   NNS = NestedNameSpecifier::Create(Context, nullptr, false,
 TD->getTypeForDecl());
 } else {

diff  --git a/lld/MachO/InputSection.cpp b/lld/MachO/InputSection.cpp
index 4cb322a058f9..9287d49dae3c 100644
--- a/lld/MachO/InputSection.cpp
+++ b/lld/MachO/InputSection.cpp
@@ -50,7 +50,7 @@ void InputSection::writeTo(uint8_t *buf) {
 // relative to the start of the thread-local data memory area, which
 // is initialized via copying all the TLV data sections (which are all
 // contiguous).
-if (auto *defined = dyn_cast(referentSym))
+if (isa(referentSym))
   referentVA -= firstTLVDataSection->addr;
   }
 } else if (auto *referentIsec = r.referent.dyn_cast()) {

diff  --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp 
b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
index 4823eea4154f..84b78fce3f44 100644
--- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
@@ -1538,6 +1538,7 @@ static void rewritePHIs(BasicBlock &BB) {
 // CleanupPad with a CatchSwitch predecessor: therefore this is an
 // unwind destination that needs to be handle specially.
 assert(CS->getUnwindDest() == &BB);
+(void)CS;
 rewritePHIsForCleanupPad(&BB, CleanupPad);
 return;
   }



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


[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2021-01-13 Thread Albertas Vyšniauskas via Phabricator via cfe-commits
thezbyg updated this revision to Diff 316511.
thezbyg added a comment.

Renamed DontModify enum to Leave.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93846

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/include/clang/Format/Format.h
  clang/lib/Format/Format.cpp
  clang/lib/Format/UnwrappedLineFormatter.cpp
  clang/test/Format/access-modifiers.cpp
  clang/unittests/Format/FormatTest.cpp

Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -8887,6 +8887,292 @@
getLLVMStyle());
 }
 
+TEST_F(FormatTest, FormatsAccessModifiers) {
+  verifyFormat("struct foo {\n"
+   "private:\n"
+   "  void f() {}\n"
+   "\n"
+   "private:\n"
+   "  int i;\n"
+   "\n"
+   "protected:\n"
+   "  int j;\n"
+   "};\n");
+  verifyFormat("struct foo {\n"
+   "private:\n"
+   "  void f() {}\n"
+   "\n"
+   "private:\n"
+   "  int i;\n"
+   "\n"
+   "protected:\n"
+   "  int j;\n"
+   "};\n",
+   "struct foo {\n"
+   "private:\n"
+   "  void f() {}\n"
+   "private:\n"
+   "  int i;\n"
+   "protected:\n"
+   "  int j;\n"
+   "};\n");
+  verifyFormat("struct foo { /* comment */\n"
+   "private:\n"
+   "  int i;\n"
+   "  // comment\n"
+   "private:\n"
+   "  int j;\n"
+   "};\n");
+  verifyFormat("struct foo {\n"
+   "#ifdef FOO\n"
+   "#endif\n"
+   "private:\n"
+   "  int i;\n"
+   "#ifdef FOO\n"
+   "private:\n"
+   "#endif\n"
+   "  int j;\n"
+   "};\n");
+  FormatStyle Style = getLLVMStyle();
+  Style.EmptyLineBeforeAccessModifier = FormatStyle::ELBAMS_Never;
+  verifyFormat("struct foo {\n"
+   "private:\n"
+   "  void f() {}\n"
+   "private:\n"
+   "  int i;\n"
+   "protected:\n"
+   "  int j;\n"
+   "};\n",
+   Style);
+  verifyFormat("struct foo {\n"
+   "private:\n"
+   "  void f() {}\n"
+   "private:\n"
+   "  int i;\n"
+   "protected:\n"
+   "  int j;\n"
+   "};\n",
+   "struct foo {\n"
+   "\n"
+   "private:\n"
+   "  void f() {}\n"
+   "\n"
+   "private:\n"
+   "  int i;\n"
+   "\n"
+   "protected:\n"
+   "  int j;\n"
+   "};\n",
+   Style);
+  verifyFormat("struct foo { /* comment */\n"
+   "private:\n"
+   "  int i;\n"
+   "  // comment\n"
+   "private:\n"
+   "  int j;\n"
+   "};\n",
+   "struct foo { /* comment */\n"
+   "\n"
+   "private:\n"
+   "  int i;\n"
+   "  // comment\n"
+   "\n"
+   "private:\n"
+   "  int j;\n"
+   "};\n",
+   Style);
+  verifyFormat("struct foo {\n"
+   "#ifdef FOO\n"
+   "#endif\n"
+   "private:\n"
+   "  int i;\n"
+   "#ifdef FOO\n"
+   "private:\n"
+   "#endif\n"
+   "  int j;\n"
+   "};\n",
+   "struct foo {\n"
+   "#ifdef FOO\n"
+   "#endif\n"
+   "\n"
+   "private:\n"
+   "  int i;\n"
+   "#ifdef FOO\n"
+   "\n"
+   "private:\n"
+   "#endif\n"
+   "  int j;\n"
+   "};\n",
+   Style);
+  Style.EmptyLineBeforeAccessModifier = FormatStyle::ELBAMS_Always;
+  verifyFormat("struct foo {\n"
+   "private:\n"
+   "  void f() {}\n"
+   "\n"
+   "private:\n"
+   "  int i;\n"
+   "\n"
+   "protected:\n"
+   "  int j;\n"
+   "};\n",
+   Style);
+  verifyFormat("struct foo {\n"
+   "private:\n"
+   "  void f() {}\n"
+   "\n"
+   "private:\n"
+   "  int i;\n"
+   "\n"
+   "protected:\n"
+   "  int j;\n"
+   "};\n",
+   "struct foo {\n"
+   "private:\n"
+   "  void f() {}\n"
+   "private:\n"
+   "  int i;\n"
+   

[PATCH] D94381: [test] Add Clang side tests for -fdebug-info-for-profiling

2021-01-13 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

Verified with @wmi offline this is good. Committing...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94381

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


[clang] 74a42ae - [test] Add Clang side tests for -fdebug-info-for-profiling

2021-01-13 Thread Fangrui Song via cfe-commits

Author: Fangrui Song
Date: 2021-01-13T14:27:39-08:00
New Revision: 74a42aedfe14938e01d128456c76cede2ccbc26c

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

LOG: [test] Add Clang side tests for -fdebug-info-for-profiling

There is currently a driver test but no test for its effect on linkageName & 
pass pipeline.

Reviewed By: dblaikie

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

Added: 
clang/test/CodeGenCXX/fdebug-info-for-profiling.cpp

Modified: 


Removed: 




diff  --git a/clang/test/CodeGenCXX/fdebug-info-for-profiling.cpp 
b/clang/test/CodeGenCXX/fdebug-info-for-profiling.cpp
new file mode 100644
index ..0a66818b23be
--- /dev/null
+++ b/clang/test/CodeGenCXX/fdebug-info-for-profiling.cpp
@@ -0,0 +1,21 @@
+/// Normally -g1 does not add linkageName. -fdebug-info-for-profiling adds 
linkageName.
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple 
-debug-info-kind=line-tables-only %s -o - | FileCheck %s --check-prefix=LINE
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple 
-debug-info-kind=line-tables-only -fdebug-info-for-profiling %s -o - | 
FileCheck %s
+
+// LINE: = distinct !DISubprogram(name: "foo", scope:
+
+// CHECK: = distinct !DICompileUnit({{.*}}, debugInfoForProfiling: true,
+// CHECK: = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope:
+
+/// Add a DWARF discriminators pass for PGO.
+// RUN: %clang_cc1 -emit-llvm -fno-legacy-pass-manager -fdebug-pass-manager 
-O1 -fprofile-instrument-path=a.profdata %s -o - 2>&1 | FileCheck %s 
--check-prefix=NODISCR
+// RUN: %clang_cc1 -emit-llvm -fno-legacy-pass-manager -fdebug-pass-manager 
-O1 -fprofile-instrument-path=a.profdata -fdebug-info-for-profiling %s -o - 
2>&1 | FileCheck %s --check-prefix=DISCR
+
+// RUN: echo > %t.proftext
+// RUN: llvm-profdata merge %t.proftext -o %t.profdata
+// RUN: %clang_cc1 -emit-llvm -fno-legacy-pass-manager -fdebug-pass-manager 
-O1 -fprofile-instrument-use-path=%t.profdata -fdebug-info-for-profiling %s -o 
- 2>&1 | FileCheck %s --check-prefix=DISCR
+
+// NODISCR-NOT: Running pass: AddDiscriminatorsPass
+// DISCR:   Running pass: AddDiscriminatorsPass on {{.*}}
+
+void foo() {}



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


[PATCH] D94381: [test] Add Clang side tests for -fdebug-info-for-profiling

2021-01-13 Thread Fangrui Song via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG74a42aedfe14: [test] Add Clang side tests for 
-fdebug-info-for-profiling (authored by MaskRay).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94381

Files:
  clang/test/CodeGenCXX/fdebug-info-for-profiling.cpp


Index: clang/test/CodeGenCXX/fdebug-info-for-profiling.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/fdebug-info-for-profiling.cpp
@@ -0,0 +1,21 @@
+/// Normally -g1 does not add linkageName. -fdebug-info-for-profiling adds 
linkageName.
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple 
-debug-info-kind=line-tables-only %s -o - | FileCheck %s --check-prefix=LINE
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple 
-debug-info-kind=line-tables-only -fdebug-info-for-profiling %s -o - | 
FileCheck %s
+
+// LINE: = distinct !DISubprogram(name: "foo", scope:
+
+// CHECK: = distinct !DICompileUnit({{.*}}, debugInfoForProfiling: true,
+// CHECK: = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope:
+
+/// Add a DWARF discriminators pass for PGO.
+// RUN: %clang_cc1 -emit-llvm -fno-legacy-pass-manager -fdebug-pass-manager 
-O1 -fprofile-instrument-path=a.profdata %s -o - 2>&1 | FileCheck %s 
--check-prefix=NODISCR
+// RUN: %clang_cc1 -emit-llvm -fno-legacy-pass-manager -fdebug-pass-manager 
-O1 -fprofile-instrument-path=a.profdata -fdebug-info-for-profiling %s -o - 
2>&1 | FileCheck %s --check-prefix=DISCR
+
+// RUN: echo > %t.proftext
+// RUN: llvm-profdata merge %t.proftext -o %t.profdata
+// RUN: %clang_cc1 -emit-llvm -fno-legacy-pass-manager -fdebug-pass-manager 
-O1 -fprofile-instrument-use-path=%t.profdata -fdebug-info-for-profiling %s -o 
- 2>&1 | FileCheck %s --check-prefix=DISCR
+
+// NODISCR-NOT: Running pass: AddDiscriminatorsPass
+// DISCR:   Running pass: AddDiscriminatorsPass on {{.*}}
+
+void foo() {}


Index: clang/test/CodeGenCXX/fdebug-info-for-profiling.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/fdebug-info-for-profiling.cpp
@@ -0,0 +1,21 @@
+/// Normally -g1 does not add linkageName. -fdebug-info-for-profiling adds linkageName.
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -debug-info-kind=line-tables-only %s -o - | FileCheck %s --check-prefix=LINE
+// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -debug-info-kind=line-tables-only -fdebug-info-for-profiling %s -o - | FileCheck %s
+
+// LINE: = distinct !DISubprogram(name: "foo", scope:
+
+// CHECK: = distinct !DICompileUnit({{.*}}, debugInfoForProfiling: true,
+// CHECK: = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope:
+
+/// Add a DWARF discriminators pass for PGO.
+// RUN: %clang_cc1 -emit-llvm -fno-legacy-pass-manager -fdebug-pass-manager -O1 -fprofile-instrument-path=a.profdata %s -o - 2>&1 | FileCheck %s --check-prefix=NODISCR
+// RUN: %clang_cc1 -emit-llvm -fno-legacy-pass-manager -fdebug-pass-manager -O1 -fprofile-instrument-path=a.profdata -fdebug-info-for-profiling %s -o - 2>&1 | FileCheck %s --check-prefix=DISCR
+
+// RUN: echo > %t.proftext
+// RUN: llvm-profdata merge %t.proftext -o %t.profdata
+// RUN: %clang_cc1 -emit-llvm -fno-legacy-pass-manager -fdebug-pass-manager -O1 -fprofile-instrument-use-path=%t.profdata -fdebug-info-for-profiling %s -o - 2>&1 | FileCheck %s --check-prefix=DISCR
+
+// NODISCR-NOT: Running pass: AddDiscriminatorsPass
+// DISCR:   Running pass: AddDiscriminatorsPass on {{.*}}
+
+void foo() {}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D94639: [DebugInfo][CodeView] Change in line tables only mode to emit type information for function scopes, rather than using the qualified name.

2021-01-13 Thread Amy Huang via Phabricator via cfe-commits
akhuang created this revision.
akhuang added reviewers: rnk, dblaikie.
Herald added a subscriber: hiraditya.
akhuang requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

In line-tables-only mode, we used to emit qualified function names
since the function name was the only thing differentiating different
functions.
If we switch to emitting forward declarations for the  types that
appear in function scopes, the total object file size becomes slightly smaller
and the display name also becomes more consistent.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94639

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp
  clang/test/CodeGenCXX/debug-info-codeview-scopes.cpp
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  llvm/test/DebugInfo/COFF/function-display-name.ll

Index: llvm/test/DebugInfo/COFF/function-display-name.ll
===
--- /dev/null
+++ llvm/test/DebugInfo/COFF/function-display-name.ll
@@ -0,0 +1,51 @@
+; RUN: llc -mtriple=i686-pc-win32 -o - -O0 -filetype=obj < %s \
+; RUN:   | llvm-readobj --codeview - | FileCheck %s
+
+; Check that we removed templated args from the display name in full debug mode
+; but not with line tables only.
+
+; CHECK:   FuncId (0x1002) {
+; CHECK-NEXT:TypeLeafKind: LF_FUNC_ID ({{.*}})
+; CHECK-NEXT:ParentScope: 0x0
+; CHECK-NEXT:FunctionType: void () ({{.*}})
+; CHECK-NEXT:Name: Test()
+
+; CHECK:   FuncId (0x1003) {
+; CHECK-NEXT:TypeLeafKind: LF_FUNC_ID ({{.*}})
+; CHECK-NEXT:ParentScope: 0x0
+; CHECK-NEXT:FunctionType: void () ({{.*}})
+; CHECK-NEXT:Name: Test
+
+; ModuleID = 't.cpp'
+source_filename = "t.cpp"
+target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-msvc"
+
+define i32 @"?Test1"() !dbg !7 {
+entry:
+  ret i32 0, !dbg !10
+}
+
+define i32 @"?Test2"() !dbg !13 {
+entry:
+  ret i32 0, !dbg !12
+}
+
+!llvm.dbg.cu = !{!0, !11}
+!llvm.module.flags = !{!3, !4, !5}
+!llvm.ident = !{!6}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 12.0.0 (https://github.com/llvm/llvm-project.git b93410cbeaa48fec9a15a23e4770be10abc04d4e)", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2, nameTableKind: None)
+!1 = !DIFile(filename: "", directory: "C:\\src\\tests", checksumkind: CSK_MD5, checksum: "a28f11090424d4b37acdde65a98985a1")
+!2 = !{}
+!3 = !{i32 2, !"CodeView", i32 1}
+!4 = !{i32 2, !"Debug Info Version", i32 3}
+!5 = !{i32 1, !"wchar_size", i32 2}
+!6 = !{!"clang version 12.0.0 (https://github.com/llvm/llvm-project.git b93410cbeaa48fec9a15a23e4770be10abc04d4e)"}
+!7 = distinct !DISubprogram(name: "Test()", scope: !8, file: !8, line: 19, type: !9, scopeLine: 19, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
+!8 = !DIFile(filename: "t.cpp", directory: "C:\\src\\tests", checksumkind: CSK_MD5, checksum: "a28f11090424d4b37acdde65a98985a1")
+!9 = !DISubroutineType(types: !2)
+!10 = !DILocation(line: 25, column: 3, scope: !7)
+!11 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
+!12 = !DILocation(line: 0, column: 0, scope: !13)
+!13 = distinct !DISubprogram(name: "Test", scope: !8, file: !8, line: 1, type: !9, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !11, retainedNodes: !2)
Index: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
===
--- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -367,8 +367,10 @@
 return I->second;
 
   // The display name includes function template arguments. Drop them to match
-  // MSVC.
-  StringRef DisplayName = SP->getName().split('<').first;
+  // MSVC, if not using line tables only.
+  StringRef DisplayName = SP->getName();
+  if (SP->getUnit()->getEmissionKind() != DICompileUnit::LineTablesOnly)
+DisplayName = SP->getName().split('<').first;
 
   const DIScope *Scope = SP->getScope();
   TypeIndex TI;
Index: clang/test/CodeGenCXX/debug-info-codeview-scopes.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/debug-info-codeview-scopes.cpp
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -debug-info-kind=line-tables-only -S -emit-llvm -std=c++11 -o - %s | FileCheck --check-prefix LINUX %s
+// RUN: %clang_cc1 -triple x86_64-windows-msvc -debug-info-kind=line-tables-only -gcodeview -S -emit-llvm -std=c++11 -o - %s | FileCheck --check-prefix MSVC %s
+
+// Check that we emit type information for function scopes in line tables for
+// Co

[PATCH] D94639: [DebugInfo][CodeView] Change in line tables only mode to emit type information for function scopes, rather than using the qualified name.

2021-01-13 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

What parts of this are motivated by CodeView requirements (do functions have to 
have unique names in CV?)?
It'd be a bit unfortunate if we have divergence in -gmlt behavior between DWARF 
and CodeView due to different usage requirements, rather than format 
requirements - gmlt in DWARF I think uses only the unqualified name, though 
eventually combined with -fdebug-info-for-profiling which put the mangled name 
on such functions to make it clear for profilers. (though the unqualified name 
only behavior is still handy for the sanitizers - where the 
unqualified/ambiguous name is a "good enough" point for size V accuracy)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94639

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


[PATCH] D94639: [DebugInfo][CodeView] Change in line tables only mode to emit type information for function scopes, rather than using the qualified name.

2021-01-13 Thread Amy Huang via Phabricator via cfe-commits
akhuang added a comment.

In D94639#2496892 , @dblaikie wrote:

> What parts of this are motivated by CodeView requirements (do functions have 
> to have unique names in CV?)?
> It'd be a bit unfortunate if we have divergence in -gmlt behavior between 
> DWARF and CodeView due to different usage requirements, rather than format 
> requirements - gmlt in DWARF I think uses only the unqualified name, though 
> eventually combined with -fdebug-info-for-profiling which put the mangled 
> name on such functions to make it clear for profilers. (though the 
> unqualified name only behavior is still handy for the sanitizers - where the 
> unqualified/ambiguous name is a "good enough" point for size V accuracy)

This was kind of motivated by the issue in 
https://bugs.llvm.org/show_bug.cgi?id=48432, even though this patch doesn't 
solve that particular bug. I guess the general issue is that in CV the only way 
to make the functions unique is by their display name or type. So previously we 
were going in the direction of differentiating functions by the display name 
(like using the qualified name), but it seems like it's more size-efficient to 
use types instead, which is what this patch does.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94639

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


[PATCH] D94639: [DebugInfo][CodeView] Change in line tables only mode to emit type information for function scopes, rather than using the qualified name.

2021-01-13 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

In D94639#2496923 , @akhuang wrote:

> In D94639#2496892 , @dblaikie wrote:
>
>> What parts of this are motivated by CodeView requirements (do functions have 
>> to have unique names in CV?)?
>> It'd be a bit unfortunate if we have divergence in -gmlt behavior between 
>> DWARF and CodeView due to different usage requirements, rather than format 
>> requirements - gmlt in DWARF I think uses only the unqualified name, though 
>> eventually combined with -fdebug-info-for-profiling which put the mangled 
>> name on such functions to make it clear for profilers. (though the 
>> unqualified name only behavior is still handy for the sanitizers - where the 
>> unqualified/ambiguous name is a "good enough" point for size V accuracy)
>
> This was kind of motivated by the issue in 
> https://bugs.llvm.org/show_bug.cgi?id=48432, even though this patch doesn't 
> solve that particular bug. I guess the general issue is that in CV the only 
> way to make the functions unique is by their display name or type. So 
> previously we were going in the direction of differentiating functions by the 
> display name (like using the qualified name), but it seems like it's more 
> size-efficient to use types instead, which is what this patch does.

OK - thanks for walking me through it, that sounds good to me.

Might be worth rephrasing from "emit type information for function scopes" to 
"emit parent/context scopes for functions, using declarations for any scopes 
that are types". (my own fault, but reading this quickly, I assumed it was 
about emitting type information for the parameters (DWARF gmlt drops the 
parameters/types))

How does any of this deal with overloading? I guess for either solution 
(qualified name or real scopes) you have to include all the parameter type info 
too to avoid the functions being treated as identical/duplicate by CV?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94639

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


[PATCH] D94500: Rework Whitesmiths mode to use line-level values in UnwrappedLineParser

2021-01-13 Thread Tim Wojtulewicz via Phabricator via cfe-commits
timwoj added inline comments.



Comment at: clang/lib/Format/TokenAnalyzer.cpp:71
Env.getFirstStartColumn(), Style, Encoding, Allocator,
-
IdentTable);

HazardyKnusperkeks wrote:
> Unrelated change (although I think it's good one).
Should I split that into a separate commit?



Comment at: clang/unittests/Format/FormatTest.cpp:13528
"namespace B\n"
-   "  {\n"
+   "{\n"
"class C;\n"

HazardyKnusperkeks wrote:
> So until now it has formatted that always wrong?
Hm, that's a good question. I'll have to think about that one. I guess for 
Whitesmiths and it's always wanting to indent braces, this should be fixed back 
to way that it was.



Comment at: clang/unittests/Format/FormatTest.cpp:13707
WhitesmithsBraceStyle);
 
   verifyFormat("enum X\n"

MyDeveloperDay wrote:
> any reason why this is being removed?
This is an artifact of there not being any sort of actual guide for 
Whitesmiths. I have it set now to always indent the case labels (and it should 
just ignore the IndentCaseLabels option entirely, like it does for 
IndentCaseBlocks). I can certainly fix that option to work again though.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94500

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


[libunwind] c82deed - [libunwind] Unwind through aarch64/Linux sigreturn frame

2021-01-13 Thread Ryan Prichard via cfe-commits

Author: Ryan Prichard
Date: 2021-01-13T16:38:36-08:00
New Revision: c82deed6764cbc63966374baf9721331901ca958

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

LOG: [libunwind] Unwind through aarch64/Linux sigreturn frame

An AArch64 sigreturn trampoline frame can't currently be described
in a DWARF .eh_frame section, because the AArch64 DWARF spec currently
doesn't define a constant for the PC register. (PC and LR may need to
be restored to different values.)

Instead, use the same technique as libgcc or github.com/libunwind and
detect the sigreturn frame by looking for the sigreturn instructions:

mov x8, #0x8b
svc #0x0

If a sigreturn frame is detected, libunwind restores all the GPRs by
assuming that sp points at an rt_sigframe Linux kernel struct. This
behavior is a fallback mode that is only used if there is no ordinary
unwind info for sigreturn.

If libunwind can't find unwind info for a PC, it assumes that the PC is
readable, and would crash if it isn't. This could happen if:
 - The PC points at a function compiled without unwind info, and which
   is part of an execute-only mapping (e.g. using -Wl,--execute-only).
 - The PC is invalid and happens to point to unreadable or unmapped
   memory.

In the tests, ignore a failed dladdr call so that the tests can run on
user-mode qemu for AArch64, which uses a stack-allocated trampoline
instead of a vDSO.

Reviewed By: danielkiss, compnerd, #libunwind

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

Added: 


Modified: 
libunwind/include/__libunwind_config.h
libunwind/src/UnwindCursor.hpp
libunwind/test/signal_unwind.pass.cpp
libunwind/test/unwind_leaffunction.pass.cpp

Removed: 




diff  --git a/libunwind/include/__libunwind_config.h 
b/libunwind/include/__libunwind_config.h
index 71d77ca65118..80be357496c4 100644
--- a/libunwind/include/__libunwind_config.h
+++ b/libunwind/include/__libunwind_config.h
@@ -27,6 +27,9 @@
 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_RISCV 64
 
 #if defined(_LIBUNWIND_IS_NATIVE_ONLY)
+# if defined(__linux__)
+#  define _LIBUNWIND_TARGET_LINUX 1
+# endif
 # if defined(__i386__)
 #  define _LIBUNWIND_TARGET_I386
 #  define _LIBUNWIND_CONTEXT_SIZE 8

diff  --git a/libunwind/src/UnwindCursor.hpp b/libunwind/src/UnwindCursor.hpp
index 9f8fa65107b4..e537ed84dd93 100644
--- a/libunwind/src/UnwindCursor.hpp
+++ b/libunwind/src/UnwindCursor.hpp
@@ -925,6 +925,25 @@ class UnwindCursor : public AbstractUnwindCursor{
   }
 #endif
 
+#if defined(_LIBUNWIND_TARGET_LINUX) && defined(_LIBUNWIND_TARGET_AARCH64)
+  bool setInfoForSigReturn() {
+R dummy;
+return setInfoForSigReturn(dummy);
+  }
+  int stepThroughSigReturn() {
+R dummy;
+return stepThroughSigReturn(dummy);
+  }
+  bool setInfoForSigReturn(Registers_arm64 &);
+  int stepThroughSigReturn(Registers_arm64 &);
+  template  bool setInfoForSigReturn(Registers &) {
+return false;
+  }
+  template  int stepThroughSigReturn(Registers &) {
+return UNW_STEP_END;
+  }
+#endif
+
 #if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
   bool getInfoFromFdeCie(const typename CFI_Parser::FDE_Info &fdeInfo,
  const typename CFI_Parser::CIE_Info &cieInfo,
@@ -1179,6 +1198,9 @@ class UnwindCursor : public AbstractUnwindCursor{
   unw_proc_info_t  _info;
   bool _unwindInfoMissing;
   bool _isSignalFrame;
+#if defined(_LIBUNWIND_TARGET_LINUX) && defined(_LIBUNWIND_TARGET_AARCH64)
+  bool _isSigReturn = false;
+#endif
 };
 
 
@@ -1873,7 +1895,11 @@ bool UnwindCursor::getInfoFromSEH(pint_t pc) {
 
 template 
 void UnwindCursor::setInfoBasedOnIPRegister(bool isReturnAddress) {
-  pint_t pc = (pint_t)this->getReg(UNW_REG_IP);
+#if defined(_LIBUNWIND_TARGET_LINUX) && defined(_LIBUNWIND_TARGET_AARCH64)
+  _isSigReturn = false;
+#endif
+
+  pint_t pc = static_cast(this->getReg(UNW_REG_IP));
 #if defined(_LIBUNWIND_ARM_EHABI)
   // Remove the thumb bit so the IP represents the actual instruction address.
   // This matches the behaviour of _Unwind_GetIP on arm.
@@ -1971,10 +1997,77 @@ void UnwindCursor::setInfoBasedOnIPRegister(bool 
isReturnAddress) {
   }
 #endif // #if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
 
+#if defined(_LIBUNWIND_TARGET_LINUX) && defined(_LIBUNWIND_TARGET_AARCH64)
+  if (setInfoForSigReturn())
+return;
+#endif
+
   // no unwind info, flag that we can't reliably unwind
   _unwindInfoMissing = true;
 }
 
+#if defined(_LIBUNWIND_TARGET_LINUX) && defined(_LIBUNWIND_TARGET_AARCH64)
+template 
+bool UnwindCursor::setInfoForSigReturn(Registers_arm64 &) {
+  // Look for the sigreturn trampoline. The trampoline's body is two
+  // specific instructions (see below). Typically the trampoline comes from the
+  // vDSO[1] (i.e. the __kernel_rt_sigreturn func

[PATCH] D94639: [DebugInfo][CodeView] Change in line tables only mode to emit type information for function scopes, rather than using the qualified name.

2021-01-13 Thread Amy Huang via Phabricator via cfe-commits
akhuang added a comment.

In D94639#2496950 , @dblaikie wrote:

> In D94639#2496923 , @akhuang wrote:
>
>> In D94639#2496892 , @dblaikie wrote:
>>
>>> What parts of this are motivated by CodeView requirements (do functions 
>>> have to have unique names in CV?)?
>
> Might be worth rephrasing from "emit type information for function scopes" to 
> "emit parent/context scopes for functions, using declarations for any scopes 
> that are types". (my own fault, but reading this quickly, I assumed it was 
> about emitting type information for the parameters (DWARF gmlt drops the 
> parameters/types))

That sounds good

> How does any of this deal with overloading? I guess for either solution 
> (qualified name or real scopes) you have to include all the parameter type 
> info too to avoid the functions being treated as identical/duplicate by CV?

Yep, this patch doesn't deal with overloading or lambdas. For lambdas I have a 
separate patch, and for overloading I haven't really thought much about yet. 
Seems like we'd have to include all the parameter type info somehow (or include 
all the parameters in the display name).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94639

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


[clang] cd4c55c - Fix grammar in diagnostic for wrong arity in a structured binding.

2021-01-13 Thread Richard Smith via cfe-commits

Author: Richard Smith
Date: 2021-01-13T17:41:09-08:00
New Revision: cd4c55c97402246099ae865a66517a36af5c3a7c

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

LOG: Fix grammar in diagnostic for wrong arity in a structured binding.

Added: 


Modified: 
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaDeclCXX.cpp
clang/test/SemaCXX/cxx1z-decomposition.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index b387736832a9..7d36397a7993 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -470,8 +470,9 @@ def err_decomp_decl_not_alone : Error<
 def err_decomp_decl_requires_init : Error<
   "decomposition declaration %0 requires an initializer">;
 def err_decomp_decl_wrong_number_bindings : Error<
-  "type %0 decomposes into %2 elements, but %select{only |}3%1 "
-  "names were provided">;
+  "type %0 decomposes into %3 %plural{1:element|:elements}2, but "
+  "%select{%plural{0:no|:only %1}1|%1}4 "
+  "%plural{1:name was|:names were}1 provided">;
 def err_decomp_decl_unbindable_type : Error<
   "cannot decompose %select{union|non-class, non-array}1 type %2">;
 def err_decomp_decl_multiple_bases_with_members : Error<

diff  --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 0df022f036f2..27679ac6f8d3 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -902,7 +902,8 @@ static bool checkSimpleDecomposition(
 llvm::function_ref GetInit) {
   if ((int64_t)Bindings.size() != NumElems) {
 S.Diag(Src->getLocation(), diag::err_decomp_decl_wrong_number_bindings)
-<< DecompType << (unsigned)Bindings.size() << NumElems.toString(10)
+<< DecompType << (unsigned)Bindings.size()
+<< (unsigned)NumElems.getLimitedValue(UINT_MAX) << 
NumElems.toString(10)
 << (NumElems < Bindings.size());
 return true;
   }
@@ -1148,8 +1149,9 @@ static bool checkTupleLikeDecomposition(Sema &S,
 const llvm::APSInt &TupleSize) {
   if ((int64_t)Bindings.size() != TupleSize) {
 S.Diag(Src->getLocation(), diag::err_decomp_decl_wrong_number_bindings)
-<< DecompType << (unsigned)Bindings.size() << TupleSize.toString(10)
-<< (TupleSize < Bindings.size());
+<< DecompType << (unsigned)Bindings.size()
+<< (unsigned)TupleSize.getLimitedValue(UINT_MAX)
+<< TupleSize.toString(10) << (TupleSize < Bindings.size());
 return true;
   }
 
@@ -1373,7 +1375,7 @@ static bool checkMemberDecomposition(Sema &S, 
ArrayRef Bindings,
   [](FieldDecl *FD) { return !FD->isUnnamedBitfield(); });
 assert(Bindings.size() != NumFields);
 S.Diag(Src->getLocation(), diag::err_decomp_decl_wrong_number_bindings)
-<< DecompType << (unsigned)Bindings.size() << NumFields
+<< DecompType << (unsigned)Bindings.size() << NumFields << NumFields
 << (NumFields < Bindings.size());
 return true;
   };

diff  --git a/clang/test/SemaCXX/cxx1z-decomposition.cpp 
b/clang/test/SemaCXX/cxx1z-decomposition.cpp
index 45a062a916f3..1ce75fe48db3 100644
--- a/clang/test/SemaCXX/cxx1z-decomposition.cpp
+++ b/clang/test/SemaCXX/cxx1z-decomposition.cpp
@@ -4,6 +4,21 @@ void use_from_own_init() {
   auto [a] = a; // expected-error {{binding 'a' cannot appear in the 
initializer of its own decomposition declaration}}
 }
 
+void num_elems() {
+  struct A0 {} a0;
+  int a1[1], a2[2];
+
+  auto [] = a0; // expected-warning {{does not allow a decomposition group to 
be empty}}
+  auto [v1] = a0; // expected-error {{type 'A0' decomposes into 0 elements, 
but 1 name was provided}}
+  auto [] = a1; // expected-error {{type 'int [1]' decomposes into 1 element, 
but no names were provided}} expected-warning {{empty}}
+  auto [v2] = a1;
+  auto [v3, v4] = a1; // expected-error {{type 'int [1]' decomposes into 1 
element, but 2 names were provided}}
+  auto [] = a2; // expected-error {{type 'int [2]' decomposes into 2 elements, 
but no names were provided}} expected-warning {{empty}}
+  auto [v5] = a2; // expected-error {{type 'int [2]' decomposes into 2 
elements, but only 1 name was provided}}
+  auto [v6, v7] = a2;
+  auto [v8, v9, v10] = a2; // expected-error {{type 'int [2]' decomposes into 
2 elements, but 3 names were provided}}
+}
+
 // As a Clang extension, _Complex can be decomposed.
 float decompose_complex(_Complex float cf) {
   static _Complex float scf;



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


[PATCH] D94639: [DebugInfo][CodeView] Change in line tables only mode to emit parent/context scopes for functions, using declarations for types

2021-01-13 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

In D94639#2496969 , @akhuang wrote:

> In D94639#2496950 , @dblaikie wrote:
>
>> How does any of this deal with overloading? I guess for either solution 
>> (qualified name or real scopes) you have to include all the parameter type 
>> info too to avoid the functions being treated as identical/duplicate by CV?
>
> Yep, this patch doesn't deal with overloading or lambdas. For lambdas I have 
> a separate patch, and for overloading I haven't really thought much about 
> yet. Seems like we'd have to include all the parameter type info somehow (or 
> include all the parameters in the display name).

Yes, I encouraged Amy to approach this incrementally:

- emit forward declarations for types used in function scopes (this patch)
- make lambda type names more unique (next)
- try discarding the linkage name from our type info to save size
- add overload type information

In particular, I wanted to measure the size impact of adding function type info 
in isolation. I suspect that the type info we need to make overload signatures 
unique is very small. My theory is that most debug info size comes from 
complete descriptions of class types.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94639

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


[PATCH] D80391: [Driver] Don't make -gsplit-dwarf imply -g2

2021-01-13 Thread Bob Haarman via Phabricator via cfe-commits
inglorion added a comment.

For Chrome on Chrome OS, this is https://crbug.com/1158215

Here, we saw our links fail with "output file too large". Investigation 
revealed that debug info was being included in the binary, instead of in .dwo 
files as expected. That turned out to be caused by this change.

It seems that there are cases where -gsplit-dwarf is passed, but it does not 
take effect because there isn't also a -g (or -g) option:

  clang -c -fthinlto-index=foo.o.thinlto.bc -gsplit-dwarf foo.o -o foo.bin.o

Shows no .dwo file and debug info in foo.bin.o, whereas

  clang -c -fthinlto-index=foo.o.thinlto.bc -gsplit-dwarf -g foo.o -o foo.bin.o

shows a .dwo file which is referenced from foo.bin.o

The only thing that is different here is that the latter command has "-g" 
whereas the former doesn't.

In other words, the new implementation still doesn't make -g and -gsplit-dwarf 
fully orthogonal; instead of -gsplit-dwarf always turning on debug fission, it 
*only* turns it on when there is also a -g or -g option - at least in 
distributed ThinLTO code generation.

It seems that orthogonality was the motivation for this change, and that 
-gsplit-dwarf without -g is supposed to work in the linker (per MaskRay's 
comment about -g being ignored by the linker).

Can we make it so that -gsplit-dwarf turns on debug fission and we then use 
that even if no -g options were passed?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80391

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


[PATCH] D94639: [DebugInfo][CodeView] Change in line tables only mode to emit parent/context scopes for functions, using declarations for types

2021-01-13 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added inline comments.



Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:1050-1052
+  // Don't include a linkage name in line tables only.
+  if (CGM.getCodeGenOpts().hasReducedDebugInfo())
+Identifier = getTypeIdentifier(Ty, CGM, TheCU);

I see Amy included the linkage name step as part of this patch, so disregard 
that comment.



Comment at: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:370-373
+  // MSVC, if not using line tables only.
+  StringRef DisplayName = SP->getName();
+  if (SP->getUnit()->getEmissionKind() != DICompileUnit::LineTablesOnly)
+DisplayName = SP->getName().split('<').first;

Do we still need the LLVM part of this? We needed it before because we were 
operating on strings like `foooperator()`. Can we leave it as 
is for now, or handle it as a separate patch?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94639

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


[PATCH] D94639: [DebugInfo][CodeView] Change in line tables only mode to emit parent/context scopes for functions, using declarations for types

2021-01-13 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

(I'm generally good with this - llvm & clang changes should be committed 
separately & maybe the linkage part too)

I'll leave the rest of the review/final approval up to @rnk


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94639

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


[PATCH] D80391: [Driver] Don't make -gsplit-dwarf imply -g2

2021-01-13 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

In D80391#2497018 , @inglorion wrote:

> For Chrome on Chrome OS, this is https://crbug.com/1158215
>
> Here, we saw our links fail with "output file too large". Investigation 
> revealed that debug info was being included in the binary, instead of in .dwo 
> files as expected. That turned out to be caused by this change.
>
> It seems that there are cases where -gsplit-dwarf is passed, but it does not 
> take effect because there isn't also a -g (or -g) option:
>
>   clang -c -fthinlto-index=foo.o.thinlto.bc -gsplit-dwarf foo.o -o foo.bin.o
>
> Shows no .dwo file and debug info in foo.bin.o, whereas
>
>   clang -c -fthinlto-index=foo.o.thinlto.bc -gsplit-dwarf -g foo.o -o 
> foo.bin.o
>
> shows a .dwo file which is referenced from foo.bin.o
>
> The only thing that is different here is that the latter command has "-g" 
> whereas the former doesn't.
>
> In other words, the new implementation still doesn't make -g and 
> -gsplit-dwarf fully orthogonal; instead of -gsplit-dwarf always turning on 
> debug fission, it *only* turns it on when there is also a -g or -g 
> option - at least in distributed ThinLTO code generation.
>
> It seems that orthogonality was the motivation for this change, and that 
> -gsplit-dwarf without -g is supposed to work in the linker (per MaskRay's 
> comment about -g being ignored by the linker).
>
> Can we make it so that -gsplit-dwarf turns on debug fission and we then use 
> that even if no -g options were passed?

Ah, sorry - I assumed you were using implicit thinlto rather than explicit 
thinlto.

Yes, I think you've demonstrated a bug here - hopefully @Maskray can look 
into/fix this so that only -gN is required when the IR is generated and only 
-gsplit-dwarf is required when real object files are generated - without 
needing both files even when only one of those operations (IR generation or 
object generation) is being performed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80391

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


[PATCH] D94403: [RISCV] Implement new architecture extension macros

2021-01-13 Thread Hsiangkai Wang via Phabricator via cfe-commits
HsiangKai added a comment.

LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94403

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


[PATCH] D93452: [clangd] Trim memory periodically

2021-01-13 Thread Nathan James via Phabricator via cfe-commits
njames93 added a comment.

A little follow up, but I've noticed if I have a lot of tabs open in my editor 
(usually happens as I forget to close them).
When clangd starts (or restarts) , in the first minute, memory usage will shoot 
right up as it starts to do its thing.
I've regularly seen it go over 15GB before the first trim call is made and it 
drops back down and settling at ~2GB. For reference clangd typically reports 
its usage is ~1.5GB when I'm working on LLVM.
This does result in some noticeable hanging of my system, which while not 
workstation level, its got more horsepower than a chromebook, no offence to 
anyone who works at Google :).

Maybe we should trim more aggressively in maybe the first couple of minutes of 
the process, which is typically when most allocations seem to happen. Then fall 
back to the once a minute.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93452

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


[PATCH] D80391: [Driver] Don't make -gsplit-dwarf imply -g2

2021-01-13 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In D80391#2497018 , @inglorion wrote:

> For Chrome on Chrome OS, this is https://crbug.com/1158215
>
> Here, we saw our links fail with "output file too large". Investigation 
> revealed that debug info was being included in the binary, instead of in .dwo 
> files as expected. That turned out to be caused by this change.
>
> It seems that there are cases where -gsplit-dwarf is passed, but it does not 
> take effect because there isn't also a -g (or -g) option:
>
>   clang -c -fthinlto-index=foo.o.thinlto.bc -gsplit-dwarf foo.o -o foo.bin.o
>
> Shows no .dwo file and debug info in foo.bin.o, whereas
>
>   clang -c -fthinlto-index=foo.o.thinlto.bc -gsplit-dwarf -g foo.o -o 
> foo.bin.o
>
> shows a .dwo file which is referenced from foo.bin.o
>
> The only thing that is different here is that the latter command has "-g" 
> whereas the former doesn't.
>
> In other words, the new implementation still doesn't make -g and 
> -gsplit-dwarf fully orthogonal; instead of -gsplit-dwarf always turning on 
> debug fission, it *only* turns it on when there is also a -g or -g 
> option - at least in distributed ThinLTO code generation.
>
> It seems that orthogonality was the motivation for this change, and that 
> -gsplit-dwarf without -g is supposed to work in the linker (per MaskRay's 
> comment about -g being ignored by the linker).
>
> Can we make it so that -gsplit-dwarf turns on debug fission and we then use 
> that even if no -g options were passed?

I am still confused what the problem is. I added some comments to the following 
distributed ThinLTO example.
Both -gsplit-dwarf and -g are needed for the ThinLTO backend compile step 
(`-fthinlto-index=`):

  cat > ./a.c < ./b.c
  cat > ./Makefile 

[PATCH] D94364: [clang] Allow specifying the aapcs and aapcs-vfp for windows on arm

2021-01-13 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

I don't see how supporting this attribute would break interop with MSVC. MSVC 
doesn't support these attributes, only GCC and Clang do. Presumably in the wine 
environment, some headers using these _GNUC extensions are being included 
somewhere, and IMO we should accept the attributes and honor them.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94364

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


Re: [PATCH] D80391: [Driver] Don't make -gsplit-dwarf imply -g2

2021-01-13 Thread David Blaikie via cfe-commits
On Wed, Jan 13, 2021 at 6:26 PM Fangrui Song via Phabricator <
revi...@reviews.llvm.org> wrote:

> MaskRay added a comment.
>
> In D80391#2497018 , @inglorion
> wrote:
>
> > For Chrome on Chrome OS, this is https://crbug.com/1158215
> >
> > Here, we saw our links fail with "output file too large". Investigation
> revealed that debug info was being included in the binary, instead of in
> .dwo files as expected. That turned out to be caused by this change.
> >
> > It seems that there are cases where -gsplit-dwarf is passed, but it does
> not take effect because there isn't also a -g (or -g) option:
> >
> >   clang -c -fthinlto-index=foo.o.thinlto.bc -gsplit-dwarf foo.o -o
> foo.bin.o
> >
> > Shows no .dwo file and debug info in foo.bin.o, whereas
> >
> >   clang -c -fthinlto-index=foo.o.thinlto.bc -gsplit-dwarf -g foo.o -o
> foo.bin.o
> >
> > shows a .dwo file which is referenced from foo.bin.o
> >
> > The only thing that is different here is that the latter command has
> "-g" whereas the former doesn't.
> >
> > In other words, the new implementation still doesn't make -g and
> -gsplit-dwarf fully orthogonal; instead of -gsplit-dwarf always turning on
> debug fission, it *only* turns it on when there is also a -g or -g
> option - at least in distributed ThinLTO code generation.
> >
> > It seems that orthogonality was the motivation for this change, and that
> -gsplit-dwarf without -g is supposed to work in the linker (per MaskRay's
> comment about -g being ignored by the linker).
> >
> > Can we make it so that -gsplit-dwarf turns on debug fission and we then
> use that even if no -g options were passed?
>
> I am still confused what the problem is. I added some comments to the
> following distributed ThinLTO example.
> Both -gsplit-dwarf and -g are needed for the ThinLTO backend compile step
> (`-fthinlto-index=`)


^ this I would consider to be a bug. -g should be needed to generate debug
info into the IR, and -gsplit-dwarf should be needed to choose how debug
info already in the IR should be placed into object files or dwo files.

Usually (non-LTO) these two steps are in the same compile, so -g and
-gsplit-dwarf go together. But for LTO cases, I think it's suitable for -g
to be needed for IR generation, and -gsplit-dwarf to be needed for object
code generation, without needing -g as well in that latter step (the -g was
already specified at IR generation time, and that shoul be enough).

We can see that behavior I'm describing as desirable in implicit ThinLTO I
showed earlier in the thread.

I suggest this should be the desired behavior, because -g generally has no
effect on IR->object code generation, so it seems strange/unnecessary to me
to gate -gsplit-dwarf behind -g in that case. The -g was already specified
and used during IR generation (& the -gN level, -gmlt behavior-etc has all
been handled in IR generation (or embedded in the IR for use later) - so to
me, specifying -g again during object code generation would be/is strange,
because any special values would be ignored (-g1/g2/g3/etc would not be
respected - the N value would only be respected when passed to the IR
generation step))


> :
>
>   cat > ./a.c <   int foo();
>   int main() { return foo();}
>   eof
>   echo 'int foo() {return 42; }' > ./b.c
>   cat > ./Makefile <   clang := /tmp/RelA/bin/clang
>   all: final_link
>
>   compile a.o b.o a.indexing.o b.indexing.o: a.c b.c
>   # -gsplit-dwarf in the initial compile is a no-op.
>   $(clang) -gsplit-dwarf -g -O2 -c -flto=thin
> -fthin-link-bitcode=a.indexing.o a.c
>   $(clang) -gsplit-dwarf -g -O2 -c -flto=thin
> -fthin-link-bitcode=b.indexing.o b.c
>
>   thin_link lto/a.o.thinlto.bc lto/b.o.thinlto.bc a.rsp: a.indexing.o
> b.indexing.o
>   $(clang) -fuse-ld=lld -Wl,--thinlto-index-only=a.rsp
> -Wl,--thinlto-prefix-replace=';lto/'
> -Wl,--thinlto-object-suffix-replace='.indexing.o;.o' a.indexing.o
> b.indexing.o
>
>   thinlto_backend lto/a.o lto/b.o: a.o b.o lto/a.o.thinlto.bc
> lto/b.o.thinlto.bc
>   # This does not produce lto/a.dwo
>   # Both -gsplit-dwarf and -g are needed to get lto/a.dwo
>   $(clang) -g -O2 -c -fthinlto-index=lto/a.o.thinlto.bc a.o -o
> lto/a.o
>   $(clang) -g -O2 -c -fthinlto-index=lto/b.o.thinlto.bc b.o -o
> lto/b.o
>
>   final_link exe: lto/a.o lto/b.o a.rsp
>   $(clang) -fuse-ld=lld @a.rsp -o exe
>
>   clean:
>   $(RM) -f *.o lto/*.o lto/*.bc lto/*.dwo
>   eof
>   mkdir -p ./lto
>
>
> Repository:
>   rG LLVM Github Monorepo
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D80391/new/
>
> https://reviews.llvm.org/D80391
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D94614: [FPEnv][X86] Platform builtins edition: clang should get from the AST the metadata for constrained FP builtins

2021-01-13 Thread Pengfei Wang via Phabricator via cfe-commits
pengfei added a comment.

Hi Kevin, what's the intention of adding constrained FP metadata for target 
dependent builtins? I believe the middle-end passes always ignore these 
builtins. What's more, will it imply user these builtins have different 
behaviors under different FP model? But it's not true for most platform 
builtins, since they are just representative of given instructions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94614

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


[PATCH] D80391: [Driver] Don't make -gsplit-dwarf imply -g2

2021-01-13 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

From @dblaikie's email reply:

> ^ this I would consider to be a bug. -g should be needed to generate debug 
> info into the IR, and -gsplit-dwarf should be needed to choose how debug info 
> already in the IR should be placed into object files or dwo files.
>
> Usually (non-LTO) these two steps are in the same compile, so -g and 
> -gsplit-dwarf go together. But for LTO cases, I think it's suitable for -g to 
> be needed for IR generation, and -gsplit-dwarf to be needed for object code 
> generation, without needing -g as well in that latter step (the -g was 
> already specified at IR generation time, and that shoul be enough).
>
> We can see that behavior I'm describing as desirable in implicit ThinLTO I 
> showed earlier in the thread.
>
> I suggest this should be the desired behavior, because -g generally has no 
> effect on IR->object code generation, so it seems strange/unnecessary to me 
> to gate -gsplit-dwarf behind -g in that case. The -g was already specified 
> and used during IR generation (& the -gN level, -gmlt behavior-etc has all 
> been handled in IR generation (or embedded in the IR for use later) - so to 
> me, specifying -g again during object code generation would be/is strange, 
> because any special values would be ignored (-g1/g2/g3/etc would not be 
> respected - the N value would only be respected when passed to the IR 
> generation step))

Got it. `-fthinlto-index=` (thinlto backend compile) operates on bitcode files 
and does not IR generation. It isn't suitable for `-g` to be needed to use.
-gsplit-dwarf is both an IR generation option and a code generation option. It 
is needed for thinlto backend compiles.

In Bazel, I think a typical configuration's `LTO Backend Compile` includes 
almost every option in the initial compile, so I did not notice the issue. I am 
working on a patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80391

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


[PATCH] D80391: [Driver] Don't make -gsplit-dwarf imply -g2

2021-01-13 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

In D80391#2497073 , @MaskRay wrote:

> From @dblaikie's email reply:
>
>> ^ this I would consider to be a bug. -g should be needed to generate debug 
>> info into the IR, and -gsplit-dwarf should be needed to choose how debug 
>> info already in the IR should be placed into object files or dwo files.
>>
>> Usually (non-LTO) these two steps are in the same compile, so -g and 
>> -gsplit-dwarf go together. But for LTO cases, I think it's suitable for -g 
>> to be needed for IR generation, and -gsplit-dwarf to be needed for object 
>> code generation, without needing -g as well in that latter step (the -g was 
>> already specified at IR generation time, and that shoul be enough).
>>
>> We can see that behavior I'm describing as desirable in implicit ThinLTO I 
>> showed earlier in the thread.
>>
>> I suggest this should be the desired behavior, because -g generally has no 
>> effect on IR->object code generation, so it seems strange/unnecessary to me 
>> to gate -gsplit-dwarf behind -g in that case. The -g was already specified 
>> and used during IR generation (& the -gN level, -gmlt behavior-etc has all 
>> been handled in IR generation (or embedded in the IR for use later) - so to 
>> me, specifying -g again during object code generation would be/is strange, 
>> because any special values would be ignored (-g1/g2/g3/etc would not be 
>> respected - the N value would only be respected when passed to the IR 
>> generation step))
>
> Got it. `-fthinlto-index=` (thinlto backend compile) operates on bitcode 
> files and does not IR generation. It isn't suitable for `-g` to be needed to 
> use.
> -gsplit-dwarf is both an IR generation option and an object file generation 
> option. It is needed for thinlto backend compiles.

(sounds like we're mostly on the same page now - minor note though: I don't 
think -gsplit-dwarf is an IR generation option. I don't think it has any effect 
on IR generation - I believe the IR is exactly the same whether it ends up 
being used with split or unsplit DWARF generation)

> In Bazel, I think a typical configuration's `LTO Backend Compile` includes 
> almost every option in the initial compile, so I did not notice the issue. I 
> am working on a patch.

Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80391

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


[PATCH] D94644: [Inliner] Inline alwaysinline calls first

2021-01-13 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks created this revision.
Herald added subscribers: wenlei, steven_wu, hiraditya, eraman.
aeubanks requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

And revert much of D91567 .
D91567  ended up putting the mandatory 
inlining pass in a different CGSCC
pipeline than the function simplification pipeline, causing alwaysinline
functions to not be optimized when inlined into another function,
causing PR48734. Much of the design of D91567  
was to potentially support
future work to run the function simplification pipeline twice, once
before inlining. However, that hasn't happened yet and can be revisited
in the future.

This sorts the initial list of CallBases so that we handle alwaysinline
calls first. Since we want to process as many calls in one functions at
a time, we have to use a stable sort.

This actually doesn't handle all alwaysinline cases properly. For
example, within an SCC, if an alwaysinline function contains another
alwaysinline call and is inlined, the newly inlined alwaysinline call
will be processed after other calls since it was not in the initial list
of CallBases.  Then we can end up with another case of PR46945 where an
alwaysinline function can't be inlined because a mutually recursive
function was inlined first.  However, it seems rare enough to not bother
with this case.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94644

Files:
  clang/test/CodeGen/thinlto-distributed-newpm.ll
  clang/test/Frontend/optimization-remark-line-directive.c
  clang/test/Frontend/optimization-remark-new-pm.c
  clang/test/Frontend/optimization-remark-with-hotness-new-pm.c
  clang/test/Frontend/optimization-remark.c
  llvm/include/llvm/Passes/PassBuilder.h
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/IPO/Inliner.cpp
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-lto-defaults.ll
  llvm/test/Other/new-pm-module-inliner-wrapper.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
  llvm/test/Transforms/Inline/inline_stats.ll
  llvm/test/Transforms/Inline/pr46945.ll

Index: llvm/test/Transforms/Inline/pr46945.ll
===
--- llvm/test/Transforms/Inline/pr46945.ll
+++ llvm/test/Transforms/Inline/pr46945.ll
@@ -1,12 +1,6 @@
-; RUN: opt %s -o - -S -passes=always-inliner-wrapper | FileCheck %s
-; RUN: opt %s -o - -S -passes='default' | FileCheck %s
-; RUN: opt %s -o - -S -passes=inliner-wrapper | FileCheck %s -check-prefix=BASELINE
+; RUN: opt < %s -S -passes=inline | FileCheck %s
+; RUN: opt < %s -S -passes='default' -debug-pass-manager 2>&1 | FileCheck %s
 
-; In the baseline case, a will be first inlined into b, which makes c recursive,
-; and, thus, un-inlinable. We need a baseline case to make sure intra-SCC order
-; is as expected: b first, then a.
-
-; BASELINE: call void @b()
 ; CHECK-NOT: call void @b()
 define void @b() alwaysinline {
 entry:
Index: llvm/test/Transforms/Inline/inline_stats.ll
===
--- llvm/test/Transforms/Inline/inline_stats.ll
+++ llvm/test/Transforms/Inline/inline_stats.ll
@@ -9,9 +9,6 @@
 ; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s --check-prefixes=CHECK-BASIC,CHECK
 ; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s --check-prefixes="CHECK-VERBOSE",CHECK
 
-; RUN: opt -S -passes=always-inliner-wrapper,inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER
-; RUN: opt -S -passes=always-inliner-wrapper,inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s --check-prefixes=WRAPPER-VERBOSE,WRAPPER
-
 ; CHECK: --- Dumping inliner stats for [] ---
 ; CHECK-BASIC-NOT: -- List of inlined functions:
 ; CHECK-BASIC-NOT: -- Inlined not imported function
Index: llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
===
--- llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
+++ llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
@@ -69,21 +69,14 @@
 ; CHECK-O-NEXT: Finished {{.*}}Function pass manager run
 ; CHECK-O-NEXT: Running pass: ModuleInlinerWrapperPass
 ; CHECK-O-NEXT: Running analysis: InlineAdvisorAnalysis
-; CHECK-O-NEXT: Starting {{.*}}Module pass manager run.
-; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
-; CHECK-O-NEXT: Running analysis: LazyCallGraphAnalysis
-; CHECK-O-NEXT: Running analysis:

[PATCH] D94644: [Inliner] Inline alwaysinline calls first

2021-01-13 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks updated this revision to Diff 316550.
aeubanks added a comment.

test fix


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94644

Files:
  clang/test/CodeGen/thinlto-distributed-newpm.ll
  clang/test/Frontend/optimization-remark-line-directive.c
  clang/test/Frontend/optimization-remark-new-pm.c
  clang/test/Frontend/optimization-remark-with-hotness-new-pm.c
  clang/test/Frontend/optimization-remark.c
  llvm/include/llvm/Passes/PassBuilder.h
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/IPO/Inliner.cpp
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-lto-defaults.ll
  llvm/test/Other/new-pm-module-inliner-wrapper.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
  llvm/test/Transforms/Inline/inline_stats.ll
  llvm/test/Transforms/Inline/pr46945.ll

Index: llvm/test/Transforms/Inline/pr46945.ll
===
--- llvm/test/Transforms/Inline/pr46945.ll
+++ llvm/test/Transforms/Inline/pr46945.ll
@@ -1,12 +1,6 @@
-; RUN: opt %s -o - -S -passes=always-inliner-wrapper | FileCheck %s
-; RUN: opt %s -o - -S -passes='default' | FileCheck %s
-; RUN: opt %s -o - -S -passes=inliner-wrapper | FileCheck %s -check-prefix=BASELINE
+; RUN: opt < %s -S -passes=inline | FileCheck %s
+; RUN: opt < %s -S -passes='default' | FileCheck %s
 
-; In the baseline case, a will be first inlined into b, which makes c recursive,
-; and, thus, un-inlinable. We need a baseline case to make sure intra-SCC order
-; is as expected: b first, then a.
-
-; BASELINE: call void @b()
 ; CHECK-NOT: call void @b()
 define void @b() alwaysinline {
 entry:
Index: llvm/test/Transforms/Inline/inline_stats.ll
===
--- llvm/test/Transforms/Inline/inline_stats.ll
+++ llvm/test/Transforms/Inline/inline_stats.ll
@@ -9,9 +9,6 @@
 ; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s --check-prefixes=CHECK-BASIC,CHECK
 ; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s --check-prefixes="CHECK-VERBOSE",CHECK
 
-; RUN: opt -S -passes=always-inliner-wrapper,inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER
-; RUN: opt -S -passes=always-inliner-wrapper,inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s --check-prefixes=WRAPPER-VERBOSE,WRAPPER
-
 ; CHECK: --- Dumping inliner stats for [] ---
 ; CHECK-BASIC-NOT: -- List of inlined functions:
 ; CHECK-BASIC-NOT: -- Inlined not imported function
Index: llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
===
--- llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
+++ llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
@@ -69,21 +69,14 @@
 ; CHECK-O-NEXT: Finished {{.*}}Function pass manager run
 ; CHECK-O-NEXT: Running pass: ModuleInlinerWrapperPass
 ; CHECK-O-NEXT: Running analysis: InlineAdvisorAnalysis
-; CHECK-O-NEXT: Starting {{.*}}Module pass manager run.
-; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
-; CHECK-O-NEXT: Running analysis: LazyCallGraphAnalysis
-; CHECK-O-NEXT: Running analysis: FunctionAnalysisManagerCGSCCProxy
-; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy<{{.*}}LazyCallGraph::SCC{{.*}}>
-; CHECK-O-NEXT: Running pass: DevirtSCCRepeatedPass
-; CHECK-O-NEXT: Starting CGSCC pass manager run.
-; CHECK-O-NEXT: Running pass: InlinerPass
-; CHECK-O-NEXT: Finished CGSCC pass manager run.
-; CHECK-O-NEXT: Finished llvm::Module pass manager run.
-; CHECK-O-NEXT: Running pass: ModuleInlinerWrapperPass
 ; CHECK-O-NEXT: Starting llvm::Module pass manager run.
 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA
 ; CHECK-O-NEXT: Running analysis: GlobalsAA
 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}ProfileSummaryAnalysis
+; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
+; CHECK-O-NEXT: Running analysis: LazyCallGraphAnalysis
+; CHECK-O-NEXT: Running analysis: FunctionAnalysisManagerCGSCCProxy on (foo)
+; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy
 ; CHECK-O-NEXT: Running pass: DevirtSCCRepeatedPass
 ; CHECK-O-NEXT: Starting CGSCC pass manager run.
 ; CHECK-O-NEXT: Running pass: InlinerPass
Index: llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
===
--- llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
+++ llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
@@ -89,22 +89,15 @@
 ; CHECK-O-

[PATCH] D94646: [clang][MSVC] Fix missing MSInheritanceAttr in template specialization.

2021-01-13 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu created this revision.
zequanwu added a reviewer: rnk.
zequanwu requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Fix PR48687.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94646

Files:
  clang/lib/Sema/SemaTemplate.cpp
  clang/test/CodeGenCXX/microsoft-abi-member-pointers.cpp


Index: clang/test/CodeGenCXX/microsoft-abi-member-pointers.cpp
===
--- clang/test/CodeGenCXX/microsoft-abi-member-pointers.cpp
+++ clang/test/CodeGenCXX/microsoft-abi-member-pointers.cpp
@@ -148,6 +148,15 @@
 // CHECK-SAME:  %"struct.pr43803::C" { { i32, i32, i32 } { i32 8, i32 0, i32 0 
}, [4 x i8] undef }]
 }
 
+namespace pr48687 {
+template  struct A {
+  T value;
+  static constexpr auto address = &A::value;
+};
+extern template class A;
+template class A;
+}
+
 struct PR26313_Y;
 typedef void (PR26313_Y::*PR26313_FUNC)();
 struct PR26313_X {
Index: clang/lib/Sema/SemaTemplate.cpp
===
--- clang/lib/Sema/SemaTemplate.cpp
+++ clang/lib/Sema/SemaTemplate.cpp
@@ -9764,6 +9764,12 @@
   dllExportImportClassTemplateSpecialization(*this, Def);
 }
 
+if (Context.getTargetInfo().getCXXABI().isMicrosoft() &&
+Def->hasAttr()) {
+  Specialization->addAttr(Def->getAttr());
+  Consumer.AssignInheritanceModel(Specialization);
+}
+
 // Set the template specialization kind. Make sure it is set before
 // instantiating the members which will trigger ASTConsumer callbacks.
 Specialization->setTemplateSpecializationKind(TSK);


Index: clang/test/CodeGenCXX/microsoft-abi-member-pointers.cpp
===
--- clang/test/CodeGenCXX/microsoft-abi-member-pointers.cpp
+++ clang/test/CodeGenCXX/microsoft-abi-member-pointers.cpp
@@ -148,6 +148,15 @@
 // CHECK-SAME:  %"struct.pr43803::C" { { i32, i32, i32 } { i32 8, i32 0, i32 0 }, [4 x i8] undef }]
 }
 
+namespace pr48687 {
+template  struct A {
+  T value;
+  static constexpr auto address = &A::value;
+};
+extern template class A;
+template class A;
+}
+
 struct PR26313_Y;
 typedef void (PR26313_Y::*PR26313_FUNC)();
 struct PR26313_X {
Index: clang/lib/Sema/SemaTemplate.cpp
===
--- clang/lib/Sema/SemaTemplate.cpp
+++ clang/lib/Sema/SemaTemplate.cpp
@@ -9764,6 +9764,12 @@
   dllExportImportClassTemplateSpecialization(*this, Def);
 }
 
+if (Context.getTargetInfo().getCXXABI().isMicrosoft() &&
+Def->hasAttr()) {
+  Specialization->addAttr(Def->getAttr());
+  Consumer.AssignInheritanceModel(Specialization);
+}
+
 // Set the template specialization kind. Make sure it is set before
 // instantiating the members which will trigger ASTConsumer callbacks.
 Specialization->setTemplateSpecializationKind(TSK);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D94646: [clang][MSVC] Fix missing MSInheritanceAttr in template specialization.

2021-01-13 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu added inline comments.



Comment at: clang/test/CodeGenCXX/microsoft-abi-member-pointers.cpp:151-159
+namespace pr48687 {
+template  struct A {
+  T value;
+  static constexpr auto address = &A::value;
+};
+extern template class A;
+template class A;

I tried to put the following CHECK for this, it never works no matter where I 
put namespace pr48687 nor changing `CHECK` to `CHECK-DAG` works.
`// CHECK: @"?address@?$A@M@pr48687@@2QQ12@MQ12@" = weak_odr dso_local constant 
i32 0, comdat, align 1`

So, as long as it does not crash/error, it might be fine.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94646

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


[PATCH] D94644: [Inliner] Inline alwaysinline calls first

2021-01-13 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

Would running the function simplification pipeline after the always inline pass 
address the issue?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94644

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


[PATCH] D94647: [Driver] -gsplit-dwarf: Produce .dwo regardless of -gN if -fthinlto-index= is specified

2021-01-13 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay created this revision.
MaskRay added reviewers: dblaikie, inglorion, thakis.
Herald added a subscriber: arphaman.
MaskRay requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

-g is an IR generation option while -gsplit-dwarf is an object file generation 
option.
-gsplit-dwarf should not be needed for ThinLTO backend compile, which does 
object file generation.

`-fthinlto-index= -gsplit-dwarf` emits .dwo even in the absence of -g.
This should fix https://crbug.com/1158215

  // Distributed ThinLTO usage
  clang -g -O2 -c -flto=thin -fthin-link-bitcode=a.indexing.o a.c
  clang -g -O2 -c -flto=thin -fthin-link-bitcode=b.indexing.o b.c
  clang -fuse-ld=lld -Wl,--thinlto-index-only=a.rsp 
-Wl,--thinlto-prefix-replace=';lto/' 
-Wl,--thinlto-object-suffix-replace='.indexing.o;.o' a.indexing.o b.indexing.o
  clang -gsplit-dwarf -O2 -c -fthinlto-index=lto/a.o.thinlto.bc a.o -o lto/a.o
  clang -gsplit-dwarf -O2 -c -fthinlto-index=lto/b.o.thinlto.bc b.o -o lto/b.o
  clang -fuse-ld=lld @a.rsp -o exe


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94647

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/split-debug.c


Index: clang/test/Driver/split-debug.c
===
--- clang/test/Driver/split-debug.c
+++ clang/test/Driver/split-debug.c
@@ -24,6 +24,14 @@
 /// -gsplit-dwarf is a no-op if no -g is specified.
 // RUN: %clang -### -c -target x86_64 -gsplit-dwarf %s 2>&1 | FileCheck %s 
--check-prefix=G0
 
+/// ... unless -fthinlto-index= is specified.
+// RUN: echo > %t.bc
+// RUN: %clang -### -c -target x86_64 -fthinlto-index=dummy -gsplit-dwarf 
%t.bc 2>&1 | FileCheck %s --check-prefix=THINLTO
+
+// THINLTO-NOT:  "-debug-info-kind=
+// THINLTO:  "-ggnu-pubnames"
+// THINLTO-SAME: "-split-dwarf-file" "{{.*}}.dwo" "-split-dwarf-output" 
"{{.*}}.dwo"
+
 /// -gno-split-dwarf disables debug fission.
 // RUN: %clang -### -c -target x86_64 -gsplit-dwarf -g -gno-split-dwarf %s 
2>&1 | FileCheck %s --check-prefix=NOSPLIT
 // RUN: %clang -### -c -target x86_64 -gsplit-dwarf=single -g -gno-split-dwarf 
%s 2>&1 | FileCheck %s --check-prefix=NOSPLIT
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -3754,7 +3754,11 @@
   Args.hasFlag(options::OPT_fsplit_dwarf_inlining,
options::OPT_fno_split_dwarf_inlining, false);
 
-  if (const Arg *A = Args.getLastArg(options::OPT_g_Group)) {
+  // Normally -gsplit-dwarf is only useful with -g. -fthinlto-index= reads in
+  // bitcode files (which may be compiled with -g) and emits an object file.
+  // Allow -gsplit-dwarf with -fthinlto-index= as well.
+  if (Args.hasArg(options::OPT_g_Group) ||
+  Args.hasArg(options::OPT_fthinlto_index_EQ)) {
 Arg *SplitDWARFArg;
 DwarfFission = getDebugFissionKind(D, Args, SplitDWARFArg);
 if (DwarfFission != DwarfFissionKind::None &&
@@ -3762,7 +3766,8 @@
   DwarfFission = DwarfFissionKind::None;
   SplitDWARFInlining = false;
 }
-
+  }
+  if (const Arg *A = Args.getLastArg(options::OPT_g_Group)) {
 DebugInfoKind = codegenoptions::LimitedDebugInfo;
 
 // If the last option explicitly specified a debug-info level, use it.


Index: clang/test/Driver/split-debug.c
===
--- clang/test/Driver/split-debug.c
+++ clang/test/Driver/split-debug.c
@@ -24,6 +24,14 @@
 /// -gsplit-dwarf is a no-op if no -g is specified.
 // RUN: %clang -### -c -target x86_64 -gsplit-dwarf %s 2>&1 | FileCheck %s --check-prefix=G0
 
+/// ... unless -fthinlto-index= is specified.
+// RUN: echo > %t.bc
+// RUN: %clang -### -c -target x86_64 -fthinlto-index=dummy -gsplit-dwarf %t.bc 2>&1 | FileCheck %s --check-prefix=THINLTO
+
+// THINLTO-NOT:  "-debug-info-kind=
+// THINLTO:  "-ggnu-pubnames"
+// THINLTO-SAME: "-split-dwarf-file" "{{.*}}.dwo" "-split-dwarf-output" "{{.*}}.dwo"
+
 /// -gno-split-dwarf disables debug fission.
 // RUN: %clang -### -c -target x86_64 -gsplit-dwarf -g -gno-split-dwarf %s 2>&1 | FileCheck %s --check-prefix=NOSPLIT
 // RUN: %clang -### -c -target x86_64 -gsplit-dwarf=single -g -gno-split-dwarf %s 2>&1 | FileCheck %s --check-prefix=NOSPLIT
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -3754,7 +3754,11 @@
   Args.hasFlag(options::OPT_fsplit_dwarf_inlining,
options::OPT_fno_split_dwarf_inlining, false);
 
-  if (const Arg *A = Args.getLastArg(options::OPT_g_Group)) {
+  // Normally -gsplit-dwarf is only useful with -g. -fthinlto-index= reads in
+  // bitcode files (which may be compiled with -g) and emits an object file.
+  // Allow -gsplit-dwarf with -fthinlto-ind

[PATCH] D94647: [Driver] -gsplit-dwarf: Produce .dwo regardless of -gN if -fthinlto-index= is specified

2021-01-13 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay updated this revision to Diff 316558.
MaskRay added a comment.

improve code comment


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94647

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/split-debug.c


Index: clang/test/Driver/split-debug.c
===
--- clang/test/Driver/split-debug.c
+++ clang/test/Driver/split-debug.c
@@ -24,6 +24,14 @@
 /// -gsplit-dwarf is a no-op if no -g is specified.
 // RUN: %clang -### -c -target x86_64 -gsplit-dwarf %s 2>&1 | FileCheck %s 
--check-prefix=G0
 
+/// ... unless -fthinlto-index= is specified.
+// RUN: echo > %t.bc
+// RUN: %clang -### -c -target x86_64 -fthinlto-index=dummy -gsplit-dwarf 
%t.bc 2>&1 | FileCheck %s --check-prefix=THINLTO
+
+// THINLTO-NOT:  "-debug-info-kind=
+// THINLTO:  "-ggnu-pubnames"
+// THINLTO-SAME: "-split-dwarf-file" "{{.*}}.dwo" "-split-dwarf-output" 
"{{.*}}.dwo"
+
 /// -gno-split-dwarf disables debug fission.
 // RUN: %clang -### -c -target x86_64 -gsplit-dwarf -g -gno-split-dwarf %s 
2>&1 | FileCheck %s --check-prefix=NOSPLIT
 // RUN: %clang -### -c -target x86_64 -gsplit-dwarf=single -g -gno-split-dwarf 
%s 2>&1 | FileCheck %s --check-prefix=NOSPLIT
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -3754,7 +3754,12 @@
   Args.hasFlag(options::OPT_fsplit_dwarf_inlining,
options::OPT_fno_split_dwarf_inlining, false);
 
-  if (const Arg *A = Args.getLastArg(options::OPT_g_Group)) {
+  // Normally -gsplit-dwarf is only useful with -g. For -gsplit-dwarf in 
ThinLTO
+  // backend phase which does object file generation and no IR generation, -g
+  // should not be needed. So allow -gsplit-dwarf with either -g or
+  // -fthinlto-index=.
+  if (Args.hasArg(options::OPT_g_Group) ||
+  Args.hasArg(options::OPT_fthinlto_index_EQ)) {
 Arg *SplitDWARFArg;
 DwarfFission = getDebugFissionKind(D, Args, SplitDWARFArg);
 if (DwarfFission != DwarfFissionKind::None &&
@@ -3762,7 +3767,8 @@
   DwarfFission = DwarfFissionKind::None;
   SplitDWARFInlining = false;
 }
-
+  }
+  if (const Arg *A = Args.getLastArg(options::OPT_g_Group)) {
 DebugInfoKind = codegenoptions::LimitedDebugInfo;
 
 // If the last option explicitly specified a debug-info level, use it.


Index: clang/test/Driver/split-debug.c
===
--- clang/test/Driver/split-debug.c
+++ clang/test/Driver/split-debug.c
@@ -24,6 +24,14 @@
 /// -gsplit-dwarf is a no-op if no -g is specified.
 // RUN: %clang -### -c -target x86_64 -gsplit-dwarf %s 2>&1 | FileCheck %s --check-prefix=G0
 
+/// ... unless -fthinlto-index= is specified.
+// RUN: echo > %t.bc
+// RUN: %clang -### -c -target x86_64 -fthinlto-index=dummy -gsplit-dwarf %t.bc 2>&1 | FileCheck %s --check-prefix=THINLTO
+
+// THINLTO-NOT:  "-debug-info-kind=
+// THINLTO:  "-ggnu-pubnames"
+// THINLTO-SAME: "-split-dwarf-file" "{{.*}}.dwo" "-split-dwarf-output" "{{.*}}.dwo"
+
 /// -gno-split-dwarf disables debug fission.
 // RUN: %clang -### -c -target x86_64 -gsplit-dwarf -g -gno-split-dwarf %s 2>&1 | FileCheck %s --check-prefix=NOSPLIT
 // RUN: %clang -### -c -target x86_64 -gsplit-dwarf=single -g -gno-split-dwarf %s 2>&1 | FileCheck %s --check-prefix=NOSPLIT
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -3754,7 +3754,12 @@
   Args.hasFlag(options::OPT_fsplit_dwarf_inlining,
options::OPT_fno_split_dwarf_inlining, false);
 
-  if (const Arg *A = Args.getLastArg(options::OPT_g_Group)) {
+  // Normally -gsplit-dwarf is only useful with -g. For -gsplit-dwarf in ThinLTO
+  // backend phase which does object file generation and no IR generation, -g
+  // should not be needed. So allow -gsplit-dwarf with either -g or
+  // -fthinlto-index=.
+  if (Args.hasArg(options::OPT_g_Group) ||
+  Args.hasArg(options::OPT_fthinlto_index_EQ)) {
 Arg *SplitDWARFArg;
 DwarfFission = getDebugFissionKind(D, Args, SplitDWARFArg);
 if (DwarfFission != DwarfFissionKind::None &&
@@ -3762,7 +3767,8 @@
   DwarfFission = DwarfFissionKind::None;
   SplitDWARFInlining = false;
 }
-
+  }
+  if (const Arg *A = Args.getLastArg(options::OPT_g_Group)) {
 DebugInfoKind = codegenoptions::LimitedDebugInfo;
 
 // If the last option explicitly specified a debug-info level, use it.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D94647: [Driver] -gsplit-dwarf: Produce .dwo regardless of -gN if -fthinlto-index= is specified

2021-01-13 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

In implicit thinlto this seemed to work for me without any changes:

  $ clang++-tot -flto=thin test.cpp -g -c
  $ clang++-tot -flto=thin -fuse-ld=lld -gsplit-dwarf test.o && 
llvm-dwarfdump-tot a.out
  a.out:  file format elf64-x86-64
  
  .debug_info contents:
  0x: Compile Unit: length = 0x002c, format = DWARF32, version = 
0x0004, abbr_offset = 0x, addr_size = 0x08 (next unit at 0x0030)
  
  0x000b: DW_TAG_compile_unit
DW_AT_stmt_list   (0x)
DW_AT_comp_dir("/usr/local/google/home/blaikie/dev/scratch")
DW_AT_GNU_dwo_name("a.out_dwo/1.dwo")
DW_AT_GNU_dwo_id  (0xf29563d7c812deae)
DW_AT_low_pc  (0x00201730)
DW_AT_high_pc (0x00201738)
DW_AT_GNU_addr_base   (0x)

Any idea why that worked without the need for a special case/changes? Might be 
nice if both these use cases (implicit and explicit thinlto) somehow managed to 
use more common code generation options. But I guess that's too different - 
probably some generic "take all the clang flags and pass them through to the 
linker to pass back to the compiler", which isn't really relevant to this... 
well, maybe (if they're being passed back to the compiler in implicit thin lto, 
how does implicit thin lto work correctly without the -g flag?)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94647

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


  1   2   >