[PATCH] D96538: [SYCL] Ignore file-scope asm during device-side SYCL compilation.

2021-02-11 Thread Artur Gainullin via Phabricator via cfe-commits
ArturGainullin created this revision.
ArturGainullin added reviewers: bader, elizabethandrews.
Herald added subscribers: Anastasia, ebevhan, yaxunl.
ArturGainullin 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/D96538

Files:
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/test/CodeGenSYCL/filescope_asm.c


Index: clang/test/CodeGenSYCL/filescope_asm.c
===
--- /dev/null
+++ clang/test/CodeGenSYCL/filescope_asm.c
@@ -0,0 +1,6 @@
+// RUN:  %clang_cc1 -fsycl -fsycl-is-device -triple 
spir64-unknown-unknown-sycldevice -emit-llvm %s -o - | FileCheck %s
+//
+// Check that file-scope asm is ignored during device-side SYCL compilation.
+//
+// CHECK-NOT: module asm "foo"
+__asm__("foo");
Index: clang/lib/CodeGen/CodeGenModule.cpp
===
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -5672,6 +5672,9 @@
 // File-scope asm is ignored during device-side OpenMP compilation.
 if (LangOpts.OpenMPIsDevice)
   break;
+// File-scope asm is ignored during device-side SYCL compilation.
+if (LangOpts.SYCLIsDevice)
+  break;
 auto *AD = cast(D);
 getModule().appendModuleInlineAsm(AD->getAsmString()->getString());
 break;


Index: clang/test/CodeGenSYCL/filescope_asm.c
===
--- /dev/null
+++ clang/test/CodeGenSYCL/filescope_asm.c
@@ -0,0 +1,6 @@
+// RUN:  %clang_cc1 -fsycl -fsycl-is-device -triple spir64-unknown-unknown-sycldevice -emit-llvm %s -o - | FileCheck %s
+//
+// Check that file-scope asm is ignored during device-side SYCL compilation.
+//
+// CHECK-NOT: module asm "foo"
+__asm__("foo");
Index: clang/lib/CodeGen/CodeGenModule.cpp
===
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -5672,6 +5672,9 @@
 // File-scope asm is ignored during device-side OpenMP compilation.
 if (LangOpts.OpenMPIsDevice)
   break;
+// File-scope asm is ignored during device-side SYCL compilation.
+if (LangOpts.SYCLIsDevice)
+  break;
 auto *AD = cast(D);
 getModule().appendModuleInlineAsm(AD->getAsmString()->getString());
 break;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D96538: [SYCL] Ignore file-scope asm during device-side SYCL compilation.

2021-02-12 Thread Artur Gainullin via Phabricator via cfe-commits
ArturGainullin updated this revision to Diff 323456.
ArturGainullin added a comment.

Rebase for retesting.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96538

Files:
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/test/CodeGenSYCL/filescope_asm.c


Index: clang/test/CodeGenSYCL/filescope_asm.c
===
--- /dev/null
+++ clang/test/CodeGenSYCL/filescope_asm.c
@@ -0,0 +1,6 @@
+// RUN:  %clang_cc1 -fsycl -fsycl-is-device -triple 
spir64-unknown-unknown-sycldevice -emit-llvm %s -o - | FileCheck %s
+//
+// Check that file-scope asm is ignored during device-side SYCL compilation.
+//
+// CHECK-NOT: module asm "foo"
+__asm__("foo");
Index: clang/lib/CodeGen/CodeGenModule.cpp
===
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -5672,6 +5672,9 @@
 // File-scope asm is ignored during device-side OpenMP compilation.
 if (LangOpts.OpenMPIsDevice)
   break;
+// File-scope asm is ignored during device-side SYCL compilation.
+if (LangOpts.SYCLIsDevice)
+  break;
 auto *AD = cast(D);
 getModule().appendModuleInlineAsm(AD->getAsmString()->getString());
 break;


Index: clang/test/CodeGenSYCL/filescope_asm.c
===
--- /dev/null
+++ clang/test/CodeGenSYCL/filescope_asm.c
@@ -0,0 +1,6 @@
+// RUN:  %clang_cc1 -fsycl -fsycl-is-device -triple spir64-unknown-unknown-sycldevice -emit-llvm %s -o - | FileCheck %s
+//
+// Check that file-scope asm is ignored during device-side SYCL compilation.
+//
+// CHECK-NOT: module asm "foo"
+__asm__("foo");
Index: clang/lib/CodeGen/CodeGenModule.cpp
===
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -5672,6 +5672,9 @@
 // File-scope asm is ignored during device-side OpenMP compilation.
 if (LangOpts.OpenMPIsDevice)
   break;
+// File-scope asm is ignored during device-side SYCL compilation.
+if (LangOpts.SYCLIsDevice)
+  break;
 auto *AD = cast(D);
 getModule().appendModuleInlineAsm(AD->getAsmString()->getString());
 break;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D96538: [SYCL] Ignore file-scope asm during device-side SYCL compilation.

2021-02-12 Thread Artur Gainullin via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGff50b121e336: [SYCL] Ignore file-scope asm during 
device-side SYCL compilation. (authored by ArturGainullin).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96538

Files:
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/test/CodeGenSYCL/filescope_asm.c


Index: clang/test/CodeGenSYCL/filescope_asm.c
===
--- /dev/null
+++ clang/test/CodeGenSYCL/filescope_asm.c
@@ -0,0 +1,6 @@
+// RUN:  %clang_cc1 -fsycl -fsycl-is-device -triple 
spir64-unknown-unknown-sycldevice -emit-llvm %s -o - | FileCheck %s
+//
+// Check that file-scope asm is ignored during device-side SYCL compilation.
+//
+// CHECK-NOT: module asm "foo"
+__asm__("foo");
Index: clang/lib/CodeGen/CodeGenModule.cpp
===
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -5672,6 +5672,9 @@
 // File-scope asm is ignored during device-side OpenMP compilation.
 if (LangOpts.OpenMPIsDevice)
   break;
+// File-scope asm is ignored during device-side SYCL compilation.
+if (LangOpts.SYCLIsDevice)
+  break;
 auto *AD = cast(D);
 getModule().appendModuleInlineAsm(AD->getAsmString()->getString());
 break;


Index: clang/test/CodeGenSYCL/filescope_asm.c
===
--- /dev/null
+++ clang/test/CodeGenSYCL/filescope_asm.c
@@ -0,0 +1,6 @@
+// RUN:  %clang_cc1 -fsycl -fsycl-is-device -triple spir64-unknown-unknown-sycldevice -emit-llvm %s -o - | FileCheck %s
+//
+// Check that file-scope asm is ignored during device-side SYCL compilation.
+//
+// CHECK-NOT: module asm "foo"
+__asm__("foo");
Index: clang/lib/CodeGen/CodeGenModule.cpp
===
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -5672,6 +5672,9 @@
 // File-scope asm is ignored during device-side OpenMP compilation.
 if (LangOpts.OpenMPIsDevice)
   break;
+// File-scope asm is ignored during device-side SYCL compilation.
+if (LangOpts.SYCLIsDevice)
+  break;
 auto *AD = cast(D);
 getModule().appendModuleInlineAsm(AD->getAsmString()->getString());
 break;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D149165: [clangd] Deduplicate missing-include findings

2023-04-30 Thread Artur Gainullin via Phabricator via cfe-commits
ArturGainullin added a comment.

Hello! After this change IncludeCleaner.GenerateMissingHeaderDiags unit test 
from ClangdTests.exe is failing on Windows for Debug build.  Could you please 
take a look.
It looks like error appears because comparator doesn't satisfy strict weak 
ordering.
I.e. it fails on verification of the comparator (with "invalid comparator" 
message) at the following line:

  MissingIncludes.erase(llvm::unique(MissingIncludes), MissingIncludes.end());



  [--] 1 test from IncludeCleaner
  [ RUN  ] IncludeCleaner.GenerateMissingHeaderDiags
  Built preamble of size 193724 for file C:\clangd-test\foo.cpp version null in 
0.07 seconds
  Exception Code: 0x8003
  0x7FF66CA142FE, 
C:\iusers\againull\llvm-project\build\tools\clang\tools\extra\clangd\unittests\ClangdTests.exe(0x7FF666CE)
 + 0x5D342FE byte(s), 
std::_Debug_lt_pred<`clang::clangd::computeIncludeCleanerFindings'::`2'::
 &,clang::clangd::MissingIncludeDiagInfo 
&,clang::clangd::MissingIncludeDiagInfo &,0>() + 0x8E byte(s), C:\Program 
Files\Microsoft Visual 
Studio\2022\Professional\VC\Tools\MSVC\14.33.31629\include\xutility, line 1532 
+ 0x55 byte(s)
  0x7FF66CA1645F, 
C:\iusers\againull\llvm-project\build\tools\clang\tools\extra\clangd\unittests\ClangdTests.exe(0x7FF666CE)
 + 0x5D3645F byte(s), 
std::_Insertion_sort_unchecked >() + 0xAF 
byte(s), C:\Program Files\Microsoft Visual 
Studio\2022\Professional\VC\Tools\MSVC\14.33.31629\include\algorithm, line 7154 
+ 0x1A byte(s)
  0x7FF66CA19D05, 
C:\iusers\againull\llvm-project\build\tools\clang\tools\extra\clangd\unittests\ClangdTests.exe(0x7FF666CE)
 + 0x5D39D05 byte(s), 
std::stable_sort
 > >,`clang::clangd::computeIncludeCleanerFindings'::`2':: >() + 0xC5 
byte(s), C:\Program Files\Microsoft Visual 
Studio\2022\Professional\VC\Tools\MSVC\14.33.31629\include\algorithm, line 7714 
+ 0x0 byte(s)
  0x7FF66CA19C18, 
C:\iusers\againull\llvm-project\build\tools\clang\tools\extra\clangd\unittests\ClangdTests.exe(0x7FF666CE)
 + 0x5D39C18 byte(s), 
llvm::stable_sort
 > &,`clang::clangd::computeIncludeCleanerFindings'::`2':: >() + 0x68 
byte(s), C:\iusers\againull\llvm-project\llvm\include\llvm\ADT\STLExtras.h, 
line 2070 + 0x0 byte(s)
  0x7FF66CA0CC3A, 
C:\iusers\againull\llvm-project\build\tools\clang\tools\extra\clangd\unittests\ClangdTests.exe(0x7FF666CE)
 + 0x5D2CC3A byte(s), clang::clangd::computeIncludeCleanerFindings() + 0x3FA 
byte(s), 
C:\iusers\againull\llvm-project\clang-tools-extra\clangd\IncludeCleaner.cpp, 
line 433 + 0x0 byte(s)
  0x7FF66CA0CF74, 
C:\iusers\againull\llvm-project\build\tools\clang\tools\extra\clangd\unittests\ClangdTests.exe(0x7FF666CE)
 + 0x5D2CF74 byte(s), clang::clangd::issueIncludeCleanerDiagnostics() + 0xF4 
byte(s), 
C:\iusers\againull\llvm-project\clang-tools-extra\clangd\IncludeCleaner.cpp, 
line 561 + 0x15 byte(s)
  0x7FF66C1E2385, 
C:\iusers\againull\llvm-project\build\tools\clang\tools\extra\clangd\unittests\ClangdTests.exe(0x7FF666CE)
 + 0x5502385 byte(s), clang::clangd::ParsedAST::build() + 0x2C15 byte(s),
  C:\iusers\againull\llvm-project\clang-tools-extra\clangd\ParsedAST.cpp, line 
691 + 0x88 byte(s)
  ...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149165

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


[PATCH] D149165: [clangd] Deduplicate missing-include findings

2023-05-01 Thread Artur Gainullin via Phabricator via cfe-commits
ArturGainullin added a comment.

In D149165#4309463 , @kadircet wrote:

> Thanks @ArturGainullin ! you're right, i've sent out 
> 5e74a3dc2da879d98204f2360e2e33571b93b91b 
> .

@kadircet Thanks a lot!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149165

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


[PATCH] D100361: [Driver] Make the findVCToolChainViaEnvironment case-insensitive

2021-04-12 Thread Artur Gainullin via Phabricator via cfe-commits
ArturGainullin created this revision.
ArturGainullin added reviewers: rnk, hamzasood.
ArturGainullin requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

PATH usage on Windows is case-insensitive. There could be situations
when toolchain path can't be obtained from PATH because of
case-sensitivity of the findVCToolChainViaEnvironment.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100361

Files:
  clang/lib/Driver/ToolChains/MSVC.cpp


Index: clang/lib/Driver/ToolChains/MSVC.cpp
===
--- clang/lib/Driver/ToolChains/MSVC.cpp
+++ clang/lib/Driver/ToolChains/MSVC.cpp
@@ -190,13 +190,15 @@
   if (IsBin) {
 llvm::StringRef ParentPath = llvm::sys::path::parent_path(TestPath);
 llvm::StringRef ParentFilename = llvm::sys::path::filename(ParentPath);
-if (ParentFilename == "VC") {
+if (ParentFilename.equals_lower("VC")) {
   Path = std::string(ParentPath);
   VSLayout = MSVCToolChain::ToolsetLayout::OlderVS;
   return true;
 }
-if (ParentFilename == "x86ret" || ParentFilename == "x86chk"
-  || ParentFilename == "amd64ret" || ParentFilename == "amd64chk") {
+if (ParentFilename.equals_lower("x86ret") ||
+ParentFilename.equals_lower("x86chk") ||
+ParentFilename.equals_lower("amd64ret") ||
+ParentFilename.equals_lower("amd64chk")) {
   Path = std::string(ParentPath);
   VSLayout = MSVCToolChain::ToolsetLayout::DevDivInternal;
   return true;
@@ -215,7 +217,7 @@
 for (llvm::StringRef Prefix : ExpectedPrefixes) {
   if (It == End)
 goto NotAToolChain;
-  if (!It->startswith(Prefix))
+  if (!It->startswith_lower(Prefix))
 goto NotAToolChain;
   ++It;
 }


Index: clang/lib/Driver/ToolChains/MSVC.cpp
===
--- clang/lib/Driver/ToolChains/MSVC.cpp
+++ clang/lib/Driver/ToolChains/MSVC.cpp
@@ -190,13 +190,15 @@
   if (IsBin) {
 llvm::StringRef ParentPath = llvm::sys::path::parent_path(TestPath);
 llvm::StringRef ParentFilename = llvm::sys::path::filename(ParentPath);
-if (ParentFilename == "VC") {
+if (ParentFilename.equals_lower("VC")) {
   Path = std::string(ParentPath);
   VSLayout = MSVCToolChain::ToolsetLayout::OlderVS;
   return true;
 }
-if (ParentFilename == "x86ret" || ParentFilename == "x86chk"
-  || ParentFilename == "amd64ret" || ParentFilename == "amd64chk") {
+if (ParentFilename.equals_lower("x86ret") ||
+ParentFilename.equals_lower("x86chk") ||
+ParentFilename.equals_lower("amd64ret") ||
+ParentFilename.equals_lower("amd64chk")) {
   Path = std::string(ParentPath);
   VSLayout = MSVCToolChain::ToolsetLayout::DevDivInternal;
   return true;
@@ -215,7 +217,7 @@
 for (llvm::StringRef Prefix : ExpectedPrefixes) {
   if (It == End)
 goto NotAToolChain;
-  if (!It->startswith(Prefix))
+  if (!It->startswith_lower(Prefix))
 goto NotAToolChain;
   ++It;
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D100361: [Driver] Make the findVCToolChainViaEnvironment case-insensitive

2021-04-13 Thread Artur Gainullin via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG192c6023e1e2: [Driver] Make the 
findVCToolChainViaEnvironment case-insensitive (authored by ArturGainullin).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100361

Files:
  clang/lib/Driver/ToolChains/MSVC.cpp


Index: clang/lib/Driver/ToolChains/MSVC.cpp
===
--- clang/lib/Driver/ToolChains/MSVC.cpp
+++ clang/lib/Driver/ToolChains/MSVC.cpp
@@ -190,13 +190,15 @@
   if (IsBin) {
 llvm::StringRef ParentPath = llvm::sys::path::parent_path(TestPath);
 llvm::StringRef ParentFilename = llvm::sys::path::filename(ParentPath);
-if (ParentFilename == "VC") {
+if (ParentFilename.equals_lower("VC")) {
   Path = std::string(ParentPath);
   VSLayout = MSVCToolChain::ToolsetLayout::OlderVS;
   return true;
 }
-if (ParentFilename == "x86ret" || ParentFilename == "x86chk"
-  || ParentFilename == "amd64ret" || ParentFilename == "amd64chk") {
+if (ParentFilename.equals_lower("x86ret") ||
+ParentFilename.equals_lower("x86chk") ||
+ParentFilename.equals_lower("amd64ret") ||
+ParentFilename.equals_lower("amd64chk")) {
   Path = std::string(ParentPath);
   VSLayout = MSVCToolChain::ToolsetLayout::DevDivInternal;
   return true;
@@ -215,7 +217,7 @@
 for (llvm::StringRef Prefix : ExpectedPrefixes) {
   if (It == End)
 goto NotAToolChain;
-  if (!It->startswith(Prefix))
+  if (!It->startswith_lower(Prefix))
 goto NotAToolChain;
   ++It;
 }


Index: clang/lib/Driver/ToolChains/MSVC.cpp
===
--- clang/lib/Driver/ToolChains/MSVC.cpp
+++ clang/lib/Driver/ToolChains/MSVC.cpp
@@ -190,13 +190,15 @@
   if (IsBin) {
 llvm::StringRef ParentPath = llvm::sys::path::parent_path(TestPath);
 llvm::StringRef ParentFilename = llvm::sys::path::filename(ParentPath);
-if (ParentFilename == "VC") {
+if (ParentFilename.equals_lower("VC")) {
   Path = std::string(ParentPath);
   VSLayout = MSVCToolChain::ToolsetLayout::OlderVS;
   return true;
 }
-if (ParentFilename == "x86ret" || ParentFilename == "x86chk"
-  || ParentFilename == "amd64ret" || ParentFilename == "amd64chk") {
+if (ParentFilename.equals_lower("x86ret") ||
+ParentFilename.equals_lower("x86chk") ||
+ParentFilename.equals_lower("amd64ret") ||
+ParentFilename.equals_lower("amd64chk")) {
   Path = std::string(ParentPath);
   VSLayout = MSVCToolChain::ToolsetLayout::DevDivInternal;
   return true;
@@ -215,7 +217,7 @@
 for (llvm::StringRef Prefix : ExpectedPrefixes) {
   if (It == End)
 goto NotAToolChain;
-  if (!It->startswith(Prefix))
+  if (!It->startswith_lower(Prefix))
 goto NotAToolChain;
   ++It;
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D100361: [Driver] Make the findVCToolChainViaEnvironment case-insensitive

2021-04-13 Thread Artur Gainullin via Phabricator via cfe-commits
ArturGainullin added a comment.

In D100361#2686823 , @rnk wrote:

> Example: 
> https://github.com/llvm/llvm-project/blob/main/clang/unittests/Driver/ToolChainTest.cpp#L29

Thank you for the example! I will take a look and may consider adding a test as 
a follow up commit.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100361

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