[PATCH] D114887: [Analyzer][solver] Simplification: Do a fixpoint iteration before the eq class merge

2022-05-18 Thread Mikael Holmén via Phabricator via cfe-commits
uabelho added a comment.
Herald added a project: All.

Hello,

I wrote an issue about a crash with this patch:
 https://github.com/llvm/llvm-project/issues/55546


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114887

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


[PATCH] D124816: [LibTooling] use ToolFileManager to store file managers for each CWD

2022-05-18 Thread Shi Chen via Phabricator via cfe-commits
Kale updated this revision to Diff 430268.
Kale added a comment.

1. Use BaseFS as the condition to judge whether to invalidate previous file 
managers
2. Use WorkingDir as a parameter for getOrCreateFileManager


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124816

Files:
  clang-tools-extra/clang-include-fixer/IncludeFixer.cpp
  clang-tools-extra/clang-include-fixer/IncludeFixer.h
  clang-tools-extra/clang-tidy/ClangTidy.cpp
  clang-tools-extra/clangd/indexer/IndexerMain.cpp
  clang-tools-extra/clangd/unittests/IndexActionTests.cpp
  clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
  clang-tools-extra/unittests/clang-include-fixer/IncludeFixerTest.cpp
  
clang-tools-extra/unittests/clang-include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
  clang-tools-extra/unittests/clang-tidy/ClangTidyTest.h
  clang/include/clang/Tooling/DependencyScanning/DependencyScanningWorker.h
  clang/include/clang/Tooling/Tooling.h
  clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
  clang/lib/Tooling/Tooling.cpp
  
clang/test/Tooling/multiple-source-include-different-header-with-same-relative-path.cpp
  clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp
  clang/unittests/Tooling/DependencyScannerTest.cpp
  clang/unittests/Tooling/ToolingTest.cpp

Index: clang/unittests/Tooling/ToolingTest.cpp
===
--- clang/unittests/Tooling/ToolingTest.cpp
+++ clang/unittests/Tooling/ToolingTest.cpp
@@ -179,8 +179,8 @@
   llvm::IntrusiveRefCntPtr InMemoryFileSystem(
   new llvm::vfs::InMemoryFileSystem);
   OverlayFileSystem->pushOverlay(InMemoryFileSystem);
-  llvm::IntrusiveRefCntPtr Files(
-  new FileManager(FileSystemOptions(), OverlayFileSystem));
+  llvm::IntrusiveRefCntPtr Files(
+  new ToolFileManager(FileSystemOptions(), OverlayFileSystem));
   std::vector Args;
   Args.push_back("tool-executable");
   Args.push_back("-Idef");
@@ -205,8 +205,8 @@
   llvm::IntrusiveRefCntPtr InMemoryFileSystem(
   new llvm::vfs::InMemoryFileSystem);
   OverlayFileSystem->pushOverlay(InMemoryFileSystem);
-  llvm::IntrusiveRefCntPtr Files(
-  new FileManager(FileSystemOptions(), OverlayFileSystem));
+  llvm::IntrusiveRefCntPtr Files(
+  new ToolFileManager(FileSystemOptions(), OverlayFileSystem));
   std::vector Args;
   Args.push_back("tool-executable");
   Args.push_back("-Idef");
@@ -231,8 +231,8 @@
   llvm::IntrusiveRefCntPtr InMemoryFileSystem(
   new llvm::vfs::InMemoryFileSystem);
   OverlayFileSystem->pushOverlay(InMemoryFileSystem);
-  llvm::IntrusiveRefCntPtr Files(
-  new FileManager(FileSystemOptions(), OverlayFileSystem));
+  llvm::IntrusiveRefCntPtr Files(
+  new ToolFileManager(FileSystemOptions(), OverlayFileSystem));
 
   std::vector Args;
   Args.push_back("tool-executable");
@@ -260,8 +260,8 @@
   llvm::IntrusiveRefCntPtr InMemoryFileSystem(
   new llvm::vfs::InMemoryFileSystem);
   OverlayFileSystem->pushOverlay(InMemoryFileSystem);
-  llvm::IntrusiveRefCntPtr Files(
-  new FileManager(FileSystemOptions(), OverlayFileSystem));
+  llvm::IntrusiveRefCntPtr Files(
+  new ToolFileManager(FileSystemOptions(), OverlayFileSystem));
 
   std::vector Args;
   Args.push_back("tool-executable");
@@ -306,8 +306,8 @@
   llvm::IntrusiveRefCntPtr InMemoryFileSystem(
   new llvm::vfs::InMemoryFileSystem);
   OverlayFileSystem->pushOverlay(InMemoryFileSystem);
-  llvm::IntrusiveRefCntPtr Files(
-  new FileManager(FileSystemOptions(), OverlayFileSystem));
+  llvm::IntrusiveRefCntPtr Files(
+  new ToolFileManager(FileSystemOptions(), OverlayFileSystem));
   std::vector Args;
   Args.push_back("tool-executable");
   // Note: intentional error; user probably meant -ferror-limit=0.
Index: clang/unittests/Tooling/DependencyScannerTest.cpp
===
--- clang/unittests/Tooling/DependencyScannerTest.cpp
+++ clang/unittests/Tooling/DependencyScannerTest.cpp
@@ -51,18 +51,18 @@
   TestDependencyScanningAction(std::vector &Deps) : Deps(Deps) {}
 
   bool runInvocation(std::shared_ptr Invocation,
- FileManager *FileMgr,
+ ToolFileManager *FileMgr,
  std::shared_ptr PCHContainerOps,
  DiagnosticConsumer *DiagConsumer) override {
 CompilerInstance Compiler(std::move(PCHContainerOps));
 Compiler.setInvocation(std::move(Invocation));
-Compiler.setFileManager(FileMgr);
+Compiler.setFileManager(FileMgr->getOrCreateFileManager().get());
 
 Compiler.createDiagnostics(DiagConsumer, /*ShouldOwnClient=*/false);
 if (!Compiler.hasDiagnostics())
   return false;
 
-Compiler.createSourceManager(*FileMgr);
+Compiler.createSourceManager(*FileMgr->getOrCreateFileManager());
 Compiler.addDependencyCollector(std::make_shared(
 Compiler.getInvocation().getDepende

[PATCH] D125859: [clang][deps] stop reusing FileManager in DependencyScanningAction

2022-05-18 Thread Shi Chen via Phabricator via cfe-commits
Kale created this revision.
Herald added a project: All.
Kale requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

DepFS already provides necessary caching, so explicitly stop reusing the 
FileMgr for possibly cache conflict.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125859

Files:
  clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp


Index: clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
===
--- clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
+++ clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
@@ -7,6 +7,7 @@
 
//===--===//
 
 #include "clang/Tooling/DependencyScanning/DependencyScanningWorker.h"
+#include "clang/Basic/FileManager.h"
 #include "clang/CodeGen/ObjectFilePCHContainerOperations.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/CompilerInvocation.h"
@@ -197,10 +198,14 @@
   for (const auto &F : ScanInstance.getHeaderSearchOpts().VFSOverlayFiles)
 DepFS->disableMinimization(F);
 
-  // Support for virtual file system overlays on top of the caching
-  // filesystem.
-  FileMgr->setVirtualFileSystem(createVFSFromCompilerInvocation(
-  ScanInstance.getInvocation(), ScanInstance.getDiagnostics(), DepFS));
+  // DepFS already provides caching, so we don't need to reuse FileManager.
+  // The provided FileManger is abandoned for possibly invalid caches 
caused
+  // by the change of VFS.
+  auto VFS = createVFSFromCompilerInvocation(
+  ScanInstance.getInvocation(), ScanInstance.getDiagnostics(), DepFS);
+  FileMgr = new FileManager(FileMgr->getFileSystemOpts(), VFS);
+  ScanInstance.setFileManager(FileMgr);
+  ScanInstance.createSourceManager(*FileMgr);
 
   // Pass the skip mappings which should speed up excluded conditional 
block
   // skipping in the preprocessor.


Index: clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
===
--- clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
+++ clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
@@ -7,6 +7,7 @@
 //===--===//
 
 #include "clang/Tooling/DependencyScanning/DependencyScanningWorker.h"
+#include "clang/Basic/FileManager.h"
 #include "clang/CodeGen/ObjectFilePCHContainerOperations.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/CompilerInvocation.h"
@@ -197,10 +198,14 @@
   for (const auto &F : ScanInstance.getHeaderSearchOpts().VFSOverlayFiles)
 DepFS->disableMinimization(F);
 
-  // Support for virtual file system overlays on top of the caching
-  // filesystem.
-  FileMgr->setVirtualFileSystem(createVFSFromCompilerInvocation(
-  ScanInstance.getInvocation(), ScanInstance.getDiagnostics(), DepFS));
+  // DepFS already provides caching, so we don't need to reuse FileManager.
+  // The provided FileManger is abandoned for possibly invalid caches caused
+  // by the change of VFS.
+  auto VFS = createVFSFromCompilerInvocation(
+  ScanInstance.getInvocation(), ScanInstance.getDiagnostics(), DepFS);
+  FileMgr = new FileManager(FileMgr->getFileSystemOpts(), VFS);
+  ScanInstance.setFileManager(FileMgr);
+  ScanInstance.createSourceManager(*FileMgr);
 
   // Pass the skip mappings which should speed up excluded conditional block
   // skipping in the preprocessor.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D125860: [clang] Only use major version in resource dir

2022-05-18 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision.
tbaeder added a reviewer: tstellar.
Herald added a subscriber: mgorny.
Herald added a reviewer: bollu.
Herald added a project: All.
tbaeder requested review of this revision.
Herald added subscribers: llvm-commits, openmp-commits, lldb-commits, 
Sanitizers, cfe-commits, MaskRay.
Herald added projects: clang, Sanitizers, LLDB, OpenMP, LLVM.

As discussed in 
https://discourse.llvm.org/t/should-we-continue-embed-the-full-llvm-version-in-lib-clang/62094/8

Release note update still missing of course.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125860

Files:
  clang/include/clang/Basic/Version.inc.in
  clang/lib/Driver/Driver.cpp
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Tooling/CMakeLists.txt
  clang/runtime/CMakeLists.txt
  compiler-rt/cmake/base-config-ix.cmake
  lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
  lldb/unittests/Expression/ClangParserTest.cpp
  llvm/cmake/modules/LLVMExternalProjectUtils.cmake
  openmp/runtime/src/CMakeLists.txt
  polly/lib/External/isl/interface/extract_interface.cc

Index: polly/lib/External/isl/interface/extract_interface.cc
===
--- polly/lib/External/isl/interface/extract_interface.cc
+++ polly/lib/External/isl/interface/extract_interface.cc
@@ -109,7 +109,7 @@
 	llvm::cl::value_desc("name"));
 
 static const char *ResourceDir =
-	CLANG_PREFIX "/lib/clang/" CLANG_VERSION_STRING;
+CLANG_PREFIX "/lib/clang/" CLANG_VERSION_MAJOR_STRING;
 
 /* Does decl have an attribute of the following form?
  *
Index: openmp/runtime/src/CMakeLists.txt
===
--- openmp/runtime/src/CMakeLists.txt
+++ openmp/runtime/src/CMakeLists.txt
@@ -353,7 +353,7 @@
   set(LIBOMP_HEADERS_INSTALL_PATH "${CMAKE_INSTALL_INCLUDEDIR}")
 else()
   string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION ${PACKAGE_VERSION})
-  set(LIBOMP_HEADERS_INSTALL_PATH "${OPENMP_INSTALL_LIBDIR}/clang/${CLANG_VERSION}/include")
+  set(LIBOMP_HEADERS_INSTALL_PATH "${OPENMP_INSTALL_LIBDIR}/clang/${CLANG_VERSION_MAJOR}/include")
 endif()
 if(WIN32)
   install(TARGETS omp RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
Index: llvm/cmake/modules/LLVMExternalProjectUtils.cmake
===
--- llvm/cmake/modules/LLVMExternalProjectUtils.cmake
+++ llvm/cmake/modules/LLVMExternalProjectUtils.cmake
@@ -259,7 +259,7 @@
 if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
   string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
  ${PACKAGE_VERSION})
-  set(resource_dir "${LLVM_LIBRARY_DIR}/clang/${CLANG_VERSION}")
+  set(resource_dir "${LLVM_LIBRARY_DIR}/clang/${CLANG_VERSION_MAJOR}")
   set(flag_types ASM C CXX MODULE_LINKER SHARED_LINKER EXE_LINKER)
   foreach(type ${flag_types})
 set(${type}_flag -DCMAKE_${type}_FLAGS=-resource-dir=${resource_dir})
Index: lldb/unittests/Expression/ClangParserTest.cpp
===
--- lldb/unittests/Expression/ClangParserTest.cpp
+++ lldb/unittests/Expression/ClangParserTest.cpp
@@ -37,10 +37,12 @@
 TEST_F(ClangHostTest, ComputeClangResourceDirectory) {
 #if !defined(_WIN32)
   std::string path_to_liblldb = "/foo/bar/lib/";
-  std::string path_to_clang_dir = "/foo/bar/lib" LLDB_LIBDIR_SUFFIX "/clang/" CLANG_VERSION_STRING;
+  std::string path_to_clang_dir =
+  "/foo/bar/lib" LLDB_LIBDIR_SUFFIX "/clang/" CLANG_VERSION_MAJOR_STRING;
 #else
   std::string path_to_liblldb = "C:\\foo\\bar\\lib";
-  std::string path_to_clang_dir = "C:\\foo\\bar\\lib\\clang\\" CLANG_VERSION_STRING;
+  std::string path_to_clang_dir =
+  "C:\\foo\\bar\\lib\\clang\\" CLANG_VERSION_MAJOR_STRING;
 #endif
   EXPECT_EQ(ComputeClangResourceDir(path_to_liblldb), path_to_clang_dir);
 
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
@@ -54,8 +54,8 @@
 
   static const llvm::StringRef kResourceDirSuffixes[] = {
   // LLVM.org's build of LLDB uses the clang resource directory placed
-  // in $install_dir/lib{,64}/clang/$clang_version.
-  "lib" CLANG_LIBDIR_SUFFIX "/clang/" CLANG_VERSION_STRING,
+  // in $install_dir/lib{,64}/clang/$clang_major_version.
+  "lib" CLANG_LIBDIR_SUFFIX "/clang/" CLANG_VERSION_MAJOR_STRING,
   // swift-lldb uses the clang resource directory copied from swift, which
   // by default is placed in $install_dir/lib{,64}/lldb/clang. LLDB places
   // it there, so we use LLDB_LIBDIR_SUFFIX.
Index: compiler-rt/cmake/base-config-ix.cmake
===
--- compiler-rt/cmake/base-config-ix.cmake
+++ compiler-rt/cmake/base-config-ix.cmake
@@ -43,9 +43,9 @@
   string(REGEX M

[PATCH] D123773: [clang][analyzer][ctu] Make CTU a two phase analysis

2022-05-18 Thread Gabor Marton via Phabricator via cfe-commits
martong marked an inline comment as done.
martong added inline comments.



Comment at: clang/docs/ReleaseNotes.rst:352
+  reports are lost compared to single-TU analysis, the lost reports are highly
+  likely to be false positives.
 

xazax.hun wrote:
> I wonder if you also want to mention that this still finds most of the CTU 
> findings in most cases.
Yes, I do, thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123773

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


[PATCH] D125604: [FileCheck] Catch missspelled directives.

2022-05-18 Thread Thomas Preud'homme via Phabricator via cfe-commits
thopre added inline comments.



Comment at: llvm/lib/FileCheck/FileCheck.cpp:1774-1781
+static std::pair
+FindCheckType(const FileCheckRequest &Req, StringRef Buffer, StringRef Prefix) 
{
+  bool Misspelled = false;
+  auto Res = FindCheckType(Req, Buffer, Prefix, Misspelled);
+  if (Res.first != Check::CheckNone && Misspelled)
+return {Check::CheckMisspelled, Res.second};
+  return Res;

kosarev wrote:
> thopre wrote:
> > kosarev wrote:
> > > thopre wrote:
> > > > Instead of introducing a new wrapper, why don't you change all the 
> > > > return to call a constructor method (e.g. `make_check_type()`) that 
> > > > does what this wrapper do? Then there would not be any FindCheckType 
> > > > that take a Misspelled parameter.
> > > > 
> > > > I'm also not sure about Misspelled being a check kind. It feels 
> > > > conceptually wrong but on the other hand I guess it makes the 
> > > > implementation simpler.
> > > Tried that. Replacing the returned pair with a new `CheckLine` kind of 
> > > object implementing the misspelled-related logic seems to add a lot of 
> > > extra clutter such as the definition of the new structure itself, but 
> > > especially all the repetitive mentions of `Misspelled` on every `return`. 
> > > Feels like having it as a reference parameter works better, as we only 
> > > need to alter the flag occasionally.
> > > 
> > > Regarding `CheckMisspelled`, now that we have `CheckBadNot` and 
> > > `CheckBadCount`, this looks the usual way of propagating the information 
> > > about our spelling-related concerns. Might be not the best design and may 
> > > be worth looking into at some point, but at least doesn' seem to be 
> > > specific to this patch?
> > I was thinking something along the line of:
> > 
> > return getRealCheckType(CHECK::CheckBadCount, Rest, Misspelled); with:
> > 
> > ```static std::pair
> > getRealCheckType(Check::FileCheckType CheckType, StringRef Rest, bool 
> > Misspelled) {
> >   if (CheckType != Check::CheckNone && Misspelled)
> > return {Check::CheckMisspelled, Rest};
> >   return {CheckType, Rest};
> > }```
> > 
> > Fair enough for CheckMisspelled, there is indeeed precedent.
> That unfortunately wouldn't eliminate the repetitive `return 
> getRealCheckType(..., Misspelled)` bits, thus adding a significant amount of 
> clutter -- all for the sake of a single assignment where we raise the flag, 
> while also making the code more fragile as the compiler wouldn't then be able 
> to catch `return`s without calling `getRealCheckType()`. And if that's not 
> enough, then the name of the function sounds like we introduce one of the 
> most irritating kinds of concepts -- the 'real' ones. :-)
Fair enough. LGTM for the FileCheck part then. Have you sent a message to 
discourse to ask test authors for help on the TODO?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125604

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


[PATCH] D125084: [test, x86] Fix spurious x86-target-features.c failure

2022-05-18 Thread Thomas Preud'homme via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7e65ffaa8bb6: [test, x86] Fix spurious x86-target-features.c 
failure (authored by thopre).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125084

Files:
  clang/test/Driver/x86-target-features.c


Index: clang/test/Driver/x86-target-features.c
===
--- clang/test/Driver/x86-target-features.c
+++ clang/test/Driver/x86-target-features.c
@@ -170,7 +170,7 @@
 // RUN: %clang -target i386-linux-gnu -mlvi-hardening %s -### -o %t.o 2>&1 | 
FileCheck -check-prefix=LVIHARDENING %s
 // RUN: %clang -target i386-linux-gnu -mno-lvi-hardening %s -### -o %t.o 2>&1 
| FileCheck -check-prefix=NO-LVIHARDENING %s
 // LVIHARDENING: "-target-feature" "+lvi-load-hardening" "-target-feature" 
"+lvi-cfi"
-// NO-LVIHARDENING-NOT: lvi
+// NO-LVIHARDENING-NOT: "+lvi-
 
 // RUN: %clang -target i386-linux-gnu -mlvi-hardening 
-mspeculative-load-hardening %s -### -o %t.o 2>&1 | FileCheck 
-check-prefix=LVIHARDENING-SLH %s
 // LVIHARDENING-SLH: error: invalid argument 'mspeculative-load-hardening' not 
allowed with 'mlvi-hardening'


Index: clang/test/Driver/x86-target-features.c
===
--- clang/test/Driver/x86-target-features.c
+++ clang/test/Driver/x86-target-features.c
@@ -170,7 +170,7 @@
 // RUN: %clang -target i386-linux-gnu -mlvi-hardening %s -### -o %t.o 2>&1 | FileCheck -check-prefix=LVIHARDENING %s
 // RUN: %clang -target i386-linux-gnu -mno-lvi-hardening %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-LVIHARDENING %s
 // LVIHARDENING: "-target-feature" "+lvi-load-hardening" "-target-feature" "+lvi-cfi"
-// NO-LVIHARDENING-NOT: lvi
+// NO-LVIHARDENING-NOT: "+lvi-
 
 // RUN: %clang -target i386-linux-gnu -mlvi-hardening -mspeculative-load-hardening %s -### -o %t.o 2>&1 | FileCheck -check-prefix=LVIHARDENING-SLH %s
 // LVIHARDENING-SLH: error: invalid argument 'mspeculative-load-hardening' not allowed with 'mlvi-hardening'
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 7e65ffa - [test, x86] Fix spurious x86-target-features.c failure

2022-05-18 Thread Thomas Preud'homme via cfe-commits

Author: Thomas Preud'homme
Date: 2022-05-18T09:27:32+01:00
New Revision: 7e65ffaa8bb65adc0324ccbea1fef56cab6eafe1

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

LOG: [test, x86] Fix spurious x86-target-features.c failure

x86-target-features.c can spuriously fail when checking for absence of
the string "lvi" in the compiler output due to the temporary path used
for the output file. For example:
"-o" "/tmp/lit-tmp-981j7lvi/x86-target-features-670b86.o"
will make the test fail. This commit checks specifically for lvi as a
target feature, in a similar way to the positive CHECK directive just
above.

Test Plan: fails when using -mlvi-hardening and pass otherwise

Reviewed By: pengfei

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

Added: 


Modified: 
clang/test/Driver/x86-target-features.c

Removed: 




diff  --git a/clang/test/Driver/x86-target-features.c 
b/clang/test/Driver/x86-target-features.c
index 42385dd5f0a48..078680c1ea81b 100644
--- a/clang/test/Driver/x86-target-features.c
+++ b/clang/test/Driver/x86-target-features.c
@@ -170,7 +170,7 @@
 // RUN: %clang -target i386-linux-gnu -mlvi-hardening %s -### -o %t.o 2>&1 | 
FileCheck -check-prefix=LVIHARDENING %s
 // RUN: %clang -target i386-linux-gnu -mno-lvi-hardening %s -### -o %t.o 2>&1 
| FileCheck -check-prefix=NO-LVIHARDENING %s
 // LVIHARDENING: "-target-feature" "+lvi-load-hardening" "-target-feature" 
"+lvi-cfi"
-// NO-LVIHARDENING-NOT: lvi
+// NO-LVIHARDENING-NOT: "+lvi-
 
 // RUN: %clang -target i386-linux-gnu -mlvi-hardening 
-mspeculative-load-hardening %s -### -o %t.o 2>&1 | FileCheck 
-check-prefix=LVIHARDENING-SLH %s
 // LVIHARDENING-SLH: error: invalid argument 'mspeculative-load-hardening' not 
allowed with 'mlvi-hardening'



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


[clang] 25ac078 - [clang][ASTImporter] Add isNewDecl

2022-05-18 Thread Gabor Marton via cfe-commits

Author: Gabor Marton
Date: 2022-05-18T10:35:52+02:00
New Revision: 25ac078a961de91522e5b5afaa6d4ffdd0dd05c4

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

LOG: [clang][ASTImporter] Add isNewDecl

Summary:
Add a new function with which we can query if a Decl had been newly
created during the import process. This feature is a must if we want to
have a different static analysis strategy for such newly created
declarations.

This is a dependent patch that is needed for the new CTU implementation
discribed at
https://discourse.llvm.org/t/rfc-much-faster-cross-translation-unit-ctu-analysis-implementation/61728

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

Added: 


Modified: 
clang/include/clang/AST/ASTImporterSharedState.h
clang/lib/AST/ASTImporter.cpp
clang/unittests/AST/ASTImporterTest.cpp

Removed: 




diff  --git a/clang/include/clang/AST/ASTImporterSharedState.h 
b/clang/include/clang/AST/ASTImporterSharedState.h
index 7be6f1460a856..a64c9d6be455f 100644
--- a/clang/include/clang/AST/ASTImporterSharedState.h
+++ b/clang/include/clang/AST/ASTImporterSharedState.h
@@ -38,6 +38,9 @@ class ASTImporterSharedState {
   /// never cleared (like ImportedFromDecls).
   llvm::DenseMap ImportErrors;
 
+  /// Set of the newly created declarations.
+  llvm::DenseSet NewDecls;
+
   // FIXME put ImportedFromDecls here!
   // And from that point we can better encapsulate the lookup table.
 
@@ -73,6 +76,10 @@ class ASTImporterSharedState {
   void setImportDeclError(Decl *To, ImportError Error) {
 ImportErrors[To] = Error;
   }
+
+  bool isNewDecl(const Decl *ToD) const { return NewDecls.count(ToD); }
+
+  void markAsNewDecl(Decl *ToD) { NewDecls.insert(ToD); }
 };
 
 } // namespace clang

diff  --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp
index e2294088908c5..9c4f60511fb2f 100644
--- a/clang/lib/AST/ASTImporter.cpp
+++ b/clang/lib/AST/ASTImporter.cpp
@@ -285,6 +285,7 @@ namespace clang {
   ToD = CreateFun(std::forward(args)...);
   // Keep track of imported Decls.
   Importer.RegisterImportedDecl(FromD, ToD);
+  Importer.SharedState->markAsNewDecl(ToD);
   InitializeImportedDecl(FromD, ToD);
   return false; // A new Decl is created.
 }

diff  --git a/clang/unittests/AST/ASTImporterTest.cpp 
b/clang/unittests/AST/ASTImporterTest.cpp
index 856010cd4d036..896e3cb7a956c 100644
--- a/clang/unittests/AST/ASTImporterTest.cpp
+++ b/clang/unittests/AST/ASTImporterTest.cpp
@@ -7698,6 +7698,38 @@ TEST_P(ASTImporterOptionSpecificTestBase,
   EXPECT_TRUE(ToX->getInClassInitializer());
 }
 
+TEST_P(ASTImporterOptionSpecificTestBase, isNewDecl) {
+  Decl *FromTU = getTuDecl(
+  R"(
+  int bar() {
+return 0;
+  }
+  void other() {
+bar();
+  }
+  )",
+  Lang_CXX11);
+  Decl *ToTU = getToTuDecl(
+  R"(
+  int bar() {
+return 0;
+  }
+  )",
+  Lang_CXX11);
+  auto *FromOther = FirstDeclMatcher().match(
+  FromTU, functionDecl(hasName("other")));
+  ASSERT_TRUE(FromOther);
+
+  auto *ToOther = Import(FromOther, Lang_CXX11);
+  ASSERT_TRUE(ToOther);
+
+  auto *ToBar = FirstDeclMatcher().match(
+  ToTU, functionDecl(hasName("bar")));
+
+  EXPECT_TRUE(SharedStatePtr->isNewDecl(ToOther));
+  EXPECT_FALSE(SharedStatePtr->isNewDecl(ToBar));
+}
+
 INSTANTIATE_TEST_SUITE_P(ParameterizedTests, ASTImporterLookupTableTest,
  DefaultTestValuesForRunOptions);
 



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


[clang] 56b9b97 - [clang][analyzer][ctu] Make CTU a two phase analysis

2022-05-18 Thread Gabor Marton via cfe-commits

Author: Gabor Marton
Date: 2022-05-18T10:35:52+02:00
New Revision: 56b9b97c1ef594f218eb06d2e62daa85cc238500

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

LOG: [clang][analyzer][ctu] Make CTU a two phase analysis

This new CTU implementation is the natural extension of the normal single TU
analysis. The approach consists of two analysis phases. During the first phase,
we do a normal single TU analysis. During this phase, if we find a foreign
function (that could be inlined from another TU) then we don’t inline that
immediately, we rather mark that to be analysed later.
When the first phase is finished then we start the second phase, the CTU phase.
In this phase, we continue the analysis from that point (exploded node)
which had been enqueued during the first phase. We gradually extend the
exploded graph of the single TU analysis with the new node that was
created by the inlining of the foreign function.

We count the number of analysis steps of the first phase and we limit the
second (ctu) phase with this number.

This new implementation makes it convenient for the users to run the
single-TU and the CTU analysis in one go, they don't need to run the two
analysis separately. Thus, we name this new implementation as "onego" CTU.

Discussion:
https://discourse.llvm.org/t/rfc-much-faster-cross-translation-unit-ctu-analysis-implementation/61728

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

Added: 
clang/test/Analysis/Inputs/ctu-onego-existingdef-other.cpp

clang/test/Analysis/Inputs/ctu-onego-existingdef-other.cpp.externalDefMap.ast-dump.txt
clang/test/Analysis/Inputs/ctu-onego-indirect-other.cpp

clang/test/Analysis/Inputs/ctu-onego-indirect-other.cpp.externalDefMap.ast-dump.txt
clang/test/Analysis/Inputs/ctu-onego-small-other.cpp

clang/test/Analysis/Inputs/ctu-onego-small-other.cpp.externalDefMap.ast-dump.txt
clang/test/Analysis/Inputs/ctu-onego-toplevel-other.cpp

clang/test/Analysis/Inputs/ctu-onego-toplevel-other.cpp.externalDefMap.ast-dump.txt
clang/test/Analysis/ctu-onego-existingdef.cpp
clang/test/Analysis/ctu-onego-indirect.cpp
clang/test/Analysis/ctu-onego-small.cpp
clang/test/Analysis/ctu-onego-toplevel.cpp

Modified: 
clang/docs/ReleaseNotes.rst
clang/include/clang/CrossTU/CrossTranslationUnit.h
clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
clang/lib/CrossTU/CrossTranslationUnit.cpp
clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
clang/lib/StaticAnalyzer/Core/CallEvent.cpp
clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
clang/test/Analysis/analyzer-config.c
clang/test/Analysis/ctu-implicit.c
clang/test/Analysis/ctu-main.c
clang/test/Analysis/ctu-main.cpp
clang/test/Analysis/ctu-on-demand-parsing.c
clang/test/Analysis/ctu-on-demand-parsing.cpp

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 2477a80d79381..20920942c2075 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -479,6 +479,13 @@ libclang
 
 Static Analyzer
 ---
+- `New CTU implementation
+  
`_
+  that keeps the slow-down around 2x compared to the single-TU analysis, even
+  in case of complex C++ projects. Still, it finds the majority of the "old"
+  CTU findings. Besides, not more than ~3% of the bug reports are lost compared
+  to single-TU analysis, the lost reports are highly likely to be false
+  positives.
 
 - Added a new checker ``alpha.unix.cstring.UninitializedRead`` this will check 
for uninitialized reads
   from common memory copy/manipulation functions such as ``memcpy``, 
``mempcpy``, ``memmove``, ``memcmp``, `

diff  --git a/clang/include/clang/CrossTU/CrossTranslationUnit.h 
b/clang/include/clang/CrossTU/CrossTranslationUnit.h
index f94f246e6e32a..3a0178ad651aa 100644
--- a/clang/include/clang/CrossTU/CrossTranslationUnit.h
+++ b/clang/include/clang/CrossTU/CrossTranslationUnit.h
@@ -197,6 +197,14 @@ class CrossTranslationUnitContext {
   getMacroExpansionContextForSourceLocation(
   const clang::SourceLocation &ToLoc) const;
 
+  /// Returns true if the given Decl is newly created during the import.
+  bool isImportedAsNew(const Decl *ToDecl) const;
+
+ 

[PATCH] D123685: [clang][ASTImporter] Add isNewDecl

2022-05-18 Thread Gabor Marton 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 rG25ac078a961d: [clang][ASTImporter] Add isNewDecl (authored 
by martong).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123685

Files:
  clang/include/clang/AST/ASTImporterSharedState.h
  clang/lib/AST/ASTImporter.cpp
  clang/unittests/AST/ASTImporterTest.cpp


Index: clang/unittests/AST/ASTImporterTest.cpp
===
--- clang/unittests/AST/ASTImporterTest.cpp
+++ clang/unittests/AST/ASTImporterTest.cpp
@@ -7698,6 +7698,38 @@
   EXPECT_TRUE(ToX->getInClassInitializer());
 }
 
+TEST_P(ASTImporterOptionSpecificTestBase, isNewDecl) {
+  Decl *FromTU = getTuDecl(
+  R"(
+  int bar() {
+return 0;
+  }
+  void other() {
+bar();
+  }
+  )",
+  Lang_CXX11);
+  Decl *ToTU = getToTuDecl(
+  R"(
+  int bar() {
+return 0;
+  }
+  )",
+  Lang_CXX11);
+  auto *FromOther = FirstDeclMatcher().match(
+  FromTU, functionDecl(hasName("other")));
+  ASSERT_TRUE(FromOther);
+
+  auto *ToOther = Import(FromOther, Lang_CXX11);
+  ASSERT_TRUE(ToOther);
+
+  auto *ToBar = FirstDeclMatcher().match(
+  ToTU, functionDecl(hasName("bar")));
+
+  EXPECT_TRUE(SharedStatePtr->isNewDecl(ToOther));
+  EXPECT_FALSE(SharedStatePtr->isNewDecl(ToBar));
+}
+
 INSTANTIATE_TEST_SUITE_P(ParameterizedTests, ASTImporterLookupTableTest,
  DefaultTestValuesForRunOptions);
 
Index: clang/lib/AST/ASTImporter.cpp
===
--- clang/lib/AST/ASTImporter.cpp
+++ clang/lib/AST/ASTImporter.cpp
@@ -285,6 +285,7 @@
   ToD = CreateFun(std::forward(args)...);
   // Keep track of imported Decls.
   Importer.RegisterImportedDecl(FromD, ToD);
+  Importer.SharedState->markAsNewDecl(ToD);
   InitializeImportedDecl(FromD, ToD);
   return false; // A new Decl is created.
 }
Index: clang/include/clang/AST/ASTImporterSharedState.h
===
--- clang/include/clang/AST/ASTImporterSharedState.h
+++ clang/include/clang/AST/ASTImporterSharedState.h
@@ -38,6 +38,9 @@
   /// never cleared (like ImportedFromDecls).
   llvm::DenseMap ImportErrors;
 
+  /// Set of the newly created declarations.
+  llvm::DenseSet NewDecls;
+
   // FIXME put ImportedFromDecls here!
   // And from that point we can better encapsulate the lookup table.
 
@@ -73,6 +76,10 @@
   void setImportDeclError(Decl *To, ImportError Error) {
 ImportErrors[To] = Error;
   }
+
+  bool isNewDecl(const Decl *ToD) const { return NewDecls.count(ToD); }
+
+  void markAsNewDecl(Decl *ToD) { NewDecls.insert(ToD); }
 };
 
 } // namespace clang


Index: clang/unittests/AST/ASTImporterTest.cpp
===
--- clang/unittests/AST/ASTImporterTest.cpp
+++ clang/unittests/AST/ASTImporterTest.cpp
@@ -7698,6 +7698,38 @@
   EXPECT_TRUE(ToX->getInClassInitializer());
 }
 
+TEST_P(ASTImporterOptionSpecificTestBase, isNewDecl) {
+  Decl *FromTU = getTuDecl(
+  R"(
+  int bar() {
+return 0;
+  }
+  void other() {
+bar();
+  }
+  )",
+  Lang_CXX11);
+  Decl *ToTU = getToTuDecl(
+  R"(
+  int bar() {
+return 0;
+  }
+  )",
+  Lang_CXX11);
+  auto *FromOther = FirstDeclMatcher().match(
+  FromTU, functionDecl(hasName("other")));
+  ASSERT_TRUE(FromOther);
+
+  auto *ToOther = Import(FromOther, Lang_CXX11);
+  ASSERT_TRUE(ToOther);
+
+  auto *ToBar = FirstDeclMatcher().match(
+  ToTU, functionDecl(hasName("bar")));
+
+  EXPECT_TRUE(SharedStatePtr->isNewDecl(ToOther));
+  EXPECT_FALSE(SharedStatePtr->isNewDecl(ToBar));
+}
+
 INSTANTIATE_TEST_SUITE_P(ParameterizedTests, ASTImporterLookupTableTest,
  DefaultTestValuesForRunOptions);
 
Index: clang/lib/AST/ASTImporter.cpp
===
--- clang/lib/AST/ASTImporter.cpp
+++ clang/lib/AST/ASTImporter.cpp
@@ -285,6 +285,7 @@
   ToD = CreateFun(std::forward(args)...);
   // Keep track of imported Decls.
   Importer.RegisterImportedDecl(FromD, ToD);
+  Importer.SharedState->markAsNewDecl(ToD);
   InitializeImportedDecl(FromD, ToD);
   return false; // A new Decl is created.
 }
Index: clang/include/clang/AST/ASTImporterSharedState.h
===
--- clang/include/clang/AST/ASTImporterSharedState.h
+++ clang/include/clang/AST/ASTImporterSharedState.h
@@ -38,6 +38,9 @@
   /// never cleared (like ImportedFromDecls).
   llvm::DenseMap ImportErrors;
 
+  /// Set of the newly created declarations.
+  llvm::DenseSet NewDecls;
+
   // FIXME put ImportedFromDecls here!
   // And f

[PATCH] D123773: [clang][analyzer][ctu] Make CTU a two phase analysis

2022-05-18 Thread Gabor Marton via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
martong marked an inline comment as done.
Closed by commit rG56b9b97c1ef5: [clang][analyzer][ctu] Make CTU a two phase 
analysis (authored by martong).

Changed prior to commit:
  https://reviews.llvm.org/D123773?vs=430047&id=430273#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123773

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/CrossTU/CrossTranslationUnit.h
  clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
  clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
  clang/lib/CrossTU/CrossTranslationUnit.cpp
  clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
  clang/lib/StaticAnalyzer/Core/CallEvent.cpp
  clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
  clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
  clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
  clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
  clang/test/Analysis/Inputs/ctu-onego-existingdef-other.cpp
  
clang/test/Analysis/Inputs/ctu-onego-existingdef-other.cpp.externalDefMap.ast-dump.txt
  clang/test/Analysis/Inputs/ctu-onego-indirect-other.cpp
  
clang/test/Analysis/Inputs/ctu-onego-indirect-other.cpp.externalDefMap.ast-dump.txt
  clang/test/Analysis/Inputs/ctu-onego-small-other.cpp
  
clang/test/Analysis/Inputs/ctu-onego-small-other.cpp.externalDefMap.ast-dump.txt
  clang/test/Analysis/Inputs/ctu-onego-toplevel-other.cpp
  
clang/test/Analysis/Inputs/ctu-onego-toplevel-other.cpp.externalDefMap.ast-dump.txt
  clang/test/Analysis/analyzer-config.c
  clang/test/Analysis/ctu-implicit.c
  clang/test/Analysis/ctu-main.c
  clang/test/Analysis/ctu-main.cpp
  clang/test/Analysis/ctu-on-demand-parsing.c
  clang/test/Analysis/ctu-on-demand-parsing.cpp
  clang/test/Analysis/ctu-onego-existingdef.cpp
  clang/test/Analysis/ctu-onego-indirect.cpp
  clang/test/Analysis/ctu-onego-small.cpp
  clang/test/Analysis/ctu-onego-toplevel.cpp

Index: clang/test/Analysis/ctu-onego-toplevel.cpp
===
--- /dev/null
+++ clang/test/Analysis/ctu-onego-toplevel.cpp
@@ -0,0 +1,54 @@
+// RUN: rm -rf %t && mkdir %t
+// RUN: mkdir -p %t/ctudir
+// RUN: %clang_cc1 -std=c++14 -triple x86_64-pc-linux-gnu \
+// RUN:   -emit-pch -o %t/ctudir/ctu-onego-toplevel-other.cpp.ast %S/Inputs/ctu-onego-toplevel-other.cpp
+// RUN: cp %S/Inputs/ctu-onego-toplevel-other.cpp.externalDefMap.ast-dump.txt %t/ctudir/externalDefMap.txt
+
+// RUN: %clang_analyze_cc1 -std=c++14 -triple x86_64-pc-linux-gnu \
+// RUN:   -analyzer-checker=core,debug.ExprInspection \
+// RUN:   -analyzer-config eagerly-assume=false \
+// RUN:   -analyzer-config experimental-enable-naive-ctu-analysis=true \
+// RUN:   -analyzer-config ctu-dir=%t/ctudir \
+// RUN:   -analyzer-config ctu-phase1-inlining=none \
+// RUN:   -verify=ctu %s
+
+// RUN: %clang_analyze_cc1 -std=c++14 -triple x86_64-pc-linux-gnu \
+// RUN:   -analyzer-checker=core,debug.ExprInspection \
+// RUN:   -analyzer-config eagerly-assume=false \
+// RUN:   -analyzer-config experimental-enable-naive-ctu-analysis=true \
+// RUN:   -analyzer-config ctu-dir=%t/ctudir \
+// RUN:   -analyzer-config ctu-phase1-inlining=none \
+// RUN:   -analyzer-config display-ctu-progress=true \
+// RUN:   -analyzer-display-progress \
+// RUN:   -verify=ctu %s 2>&1 | FileCheck %s
+
+// CallGraph: c->b
+// topological sort: c, b
+// Note that `other` calls into `b` but that is not visible in the CallGraph
+// because that happens in another TU.
+
+// During the onego CTU analysis, we start with c() as top level function.
+// Then we visit b() as non-toplevel during the processing of the FWList, thus
+// that would not be visited as toplevel without special care.
+
+// `c` is analyzed as toplevel and during that the other TU is loaded:
+// CHECK: ANALYZE (Path,  Inline_Regular): {{.*}} c(int){{.*}}CTU loaded AST file
+// next, `b` is analyzed as toplevel:
+// CHECK: ANALYZE (Path,  Inline_Regular): {{.*}} b(int)
+
+void b(int x);
+void other(int y);
+void c(int y) {
+  other(y);
+  return;
+  // The below call is here to form the proper CallGraph, but will not be
+  // analyzed.
+  b(1);
+}
+
+void b(int x) {
+  if (x == 0)
+(void)(1 / x);
+// ctu-warning@-1{{Division by zero}}
+// We receive the above warning only if `b` is analyzed as top-level.
+}
Index: clang/test/Analysis/ctu-onego-small.cpp
===
--- /dev/null
+++ clang/test/Analysis/ctu-onego-small.cpp
@@ -0,0 +1,51 @@
+// RUN: rm -rf %t && mkdir %t
+// RUN: mkdir -p %t/ctudir
+// RUN: %clang_cc1 -std=c++14 -triple x86_64-pc-linux-gnu \

[PATCH] D125765: [RISCV] Add type aliases float16_t, float32_t and float64_t

2022-05-18 Thread Wang Pengcheng via Phabricator via cfe-commits
pcwang-thead added a comment.

Besides, should we add `vread_csr` and `vwrite_csr` like what in GCC 
?
These two functions doesn't exist in RVV intrinsics doc, is it a historical 
problem?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125765

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


[PATCH] D125862: [clang][driver] Add gcc-toolset/devtoolset 12 to prefixes

2022-05-18 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision.
tbaeder added reviewers: tstellar, phosek.
Herald added a project: All.
tbaeder requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.

This makes it possible to use the newest gcc-toolset/devtoolset on RHEL.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125862

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


Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2150,8 +2150,10 @@
   // Non-Solaris is much simpler - most systems just go with "/usr".
   if (SysRoot.empty() && TargetTriple.getOS() == llvm::Triple::Linux) {
 // Yet, still look for RHEL/CentOS devtoolsets and gcc-toolsets.
+Prefixes.push_back("/opt/rh/gcc-toolset-12/root/usr");
 Prefixes.push_back("/opt/rh/gcc-toolset-11/root/usr");
 Prefixes.push_back("/opt/rh/gcc-toolset-10/root/usr");
+Prefixes.push_back("/opt/rh/devtoolset-12/root/usr");
 Prefixes.push_back("/opt/rh/devtoolset-11/root/usr");
 Prefixes.push_back("/opt/rh/devtoolset-10/root/usr");
 Prefixes.push_back("/opt/rh/devtoolset-9/root/usr");


Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2150,8 +2150,10 @@
   // Non-Solaris is much simpler - most systems just go with "/usr".
   if (SysRoot.empty() && TargetTriple.getOS() == llvm::Triple::Linux) {
 // Yet, still look for RHEL/CentOS devtoolsets and gcc-toolsets.
+Prefixes.push_back("/opt/rh/gcc-toolset-12/root/usr");
 Prefixes.push_back("/opt/rh/gcc-toolset-11/root/usr");
 Prefixes.push_back("/opt/rh/gcc-toolset-10/root/usr");
+Prefixes.push_back("/opt/rh/devtoolset-12/root/usr");
 Prefixes.push_back("/opt/rh/devtoolset-11/root/usr");
 Prefixes.push_back("/opt/rh/devtoolset-10/root/usr");
 Prefixes.push_back("/opt/rh/devtoolset-9/root/usr");
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D125788: [flang][driver] Rename `flang-new` as `flang`

2022-05-18 Thread Kiran Chandramohan via Phabricator via cfe-commits
kiranchandramohan accepted this revision.
kiranchandramohan added a comment.
This revision is now accepted and ready to land.

LGTM. In the call on Monday, it was mentioned that the original users of the 
flang script have moved on to using a custom driver.

It will be a good idea to,
-> wait for the author of the original script and the throwaway driver, 
@sscalpone.
-> clarify that execution is still restricted to developers via a flag. We hope 
to open it to users later in the year.

My personal preference for the renaming is `flang-to-external-fc` since it is 
not specific to gfortran.




Comment at: flang/tools/flang-driver/CMakeLists.txt:51
 
-install(TARGETS flang-new DESTINATION "${CMAKE_INSTALL_BINDIR}")
+# For backwords compatibility
+add_flang_symlink(flang-new flang)

Nit: backwords -> backwards


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125788

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


[PATCH] D125765: [RISCV] Add type aliases float16_t, float32_t and float64_t

2022-05-18 Thread Wang Pengcheng via Phabricator via cfe-commits
pcwang-thead updated this revision to Diff 430285.
pcwang-thead added a comment.

Move to separate RVVHeader.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125765

Files:
  clang/include/clang/Basic/riscv_vector.td
  clang/test/CodeGen/RISCV/rvv-type-aliases.c

Index: clang/test/CodeGen/RISCV/rvv-type-aliases.c
===
--- /dev/null
+++ clang/test/CodeGen/RISCV/rvv-type-aliases.c
@@ -0,0 +1,155 @@
+// RUN: %clang_cc1 -triple riscv64 -target-feature +f -target-feature +d -target-feature +v \
+// RUN: -target-feature +zfh -target-feature +experimental-zvfh \
+// RUN: -fsyntax-only -verify -ast-dump %s | FileCheck %s
+
+#include 
+
+// expected-no-diagnostics
+void bar(void) {
+  // CHECK: f16 'float16_t':'_Float16'
+  float16_t f16;
+  // CHECK: f32 'float32_t':'float'
+  float32_t f32;
+  // CHECK: f64 'float64_t':'double'
+  float64_t f64;
+
+  // CHECK: b1 'vbool1_t':'__rvv_bool1_t'
+  vbool1_t b1;
+  // CHECK: b2 'vbool2_t':'__rvv_bool2_t'
+  vbool2_t b2;
+  // CHECK: b4 'vbool4_t':'__rvv_bool4_t'
+  vbool4_t b4;
+  // CHECK: b8 'vbool8_t':'__rvv_bool8_t'
+  vbool8_t b8;
+  // CHECK: b16 'vbool16_t':'__rvv_bool16_t'
+  vbool16_t b16;
+  // CHECK: b32 'vbool32_t':'__rvv_bool32_t'
+  vbool32_t b32;
+  // CHECK: b64 'vbool64_t':'__rvv_bool64_t'
+  vbool64_t b64;
+
+  // CHECK: i8mf8 'vint8mf8_t':'__rvv_int8mf8_t'
+  vint8mf8_t i8mf8;
+  // CHECK: u8mf8 'vuint8mf8_t':'__rvv_uint8mf8_t'
+  vuint8mf8_t u8mf8;
+  // CHECK: i8mf4 'vint8mf4_t':'__rvv_int8mf4_t'
+  vint8mf4_t i8mf4;
+  // CHECK: u8mf4 'vuint8mf4_t':'__rvv_uint8mf4_t'
+  vuint8mf4_t u8mf4;
+  // CHECK: i8mf2 'vint8mf2_t':'__rvv_int8mf2_t'
+  vint8mf2_t i8mf2;
+  // CHECK: u8mf2 'vuint8mf2_t':'__rvv_uint8mf2_t'
+  vuint8mf2_t u8mf2;
+  // CHECK: i8m1 'vint8m1_t':'__rvv_int8m1_t'
+  vint8m1_t i8m1;
+  // CHECK: u8m1 'vuint8m1_t':'__rvv_uint8m1_t'
+  vuint8m1_t u8m1;
+  // CHECK: i8m2 'vint8m2_t':'__rvv_int8m2_t'
+  vint8m2_t i8m2;
+  // CHECK: u8m2 'vuint8m2_t':'__rvv_uint8m2_t'
+  vuint8m2_t u8m2;
+  // CHECK: i8m4 'vint8m4_t':'__rvv_int8m4_t'
+  vint8m4_t i8m4;
+  // CHECK: u8m4 'vuint8m4_t':'__rvv_uint8m4_t'
+  vuint8m4_t u8m4;
+  // CHECK: i8m8 'vint8m8_t':'__rvv_int8m8_t'
+  vint8m8_t i8m8;
+  // CHECK: u8m8 'vuint8m8_t':'__rvv_uint8m8_t'
+  vuint8m8_t u8m8;
+
+  // CHECK: i16mf4 'vint16mf4_t':'__rvv_int16mf4_t'
+  vint16mf4_t i16mf4;
+  // CHECK: u16mf4 'vuint16mf4_t':'__rvv_uint16mf4_t'
+  vuint16mf4_t u16mf4;
+  // CHECK: i16mf2 'vint16mf2_t':'__rvv_int16mf2_t'
+  vint16mf2_t i16mf2;
+  // CHECK: u16mf2 'vuint16mf2_t':'__rvv_uint16mf2_t'
+  vuint16mf2_t u16mf2;
+  // CHECK: i16m1 'vint16m1_t':'__rvv_int16m1_t'
+  vint16m1_t i16m1;
+  // CHECK: u16m1 'vuint16m1_t':'__rvv_uint16m1_t'
+  vuint16m1_t u16m1;
+  // CHECK: i16m2 'vint16m2_t':'__rvv_int16m2_t'
+  vint16m2_t i16m2;
+  // CHECK: u16m2 'vuint16m2_t':'__rvv_uint16m2_t'
+  vuint16m2_t u16m2;
+  // CHECK: i16m4 'vint16m4_t':'__rvv_int16m4_t'
+  vint16m4_t i16m4;
+  // CHECK: u16m4 'vuint16m4_t':'__rvv_uint16m4_t'
+  vuint16m4_t u16m4;
+  // CHECK: i16m8 'vint16m8_t':'__rvv_int16m8_t'
+  vint16m8_t i16m8;
+  // CHECK: u16m8 'vuint16m8_t':'__rvv_uint16m8_t'
+  vuint16m8_t u16m8;
+
+  // CHECK: i32mf2 'vint32mf2_t':'__rvv_int32mf2_t'
+  vint32mf2_t i32mf2;
+  // CHECK: u32mf2 'vuint32mf2_t':'__rvv_uint32mf2_t'
+  vuint32mf2_t u32mf2;
+  // CHECK: i32m1 'vint32m1_t':'__rvv_int32m1_t'
+  vint32m1_t i32m1;
+  // CHECK: u32m1 'vuint32m1_t':'__rvv_uint32m1_t'
+  vuint32m1_t u32m1;
+  // CHECK: i32m2 'vint32m2_t':'__rvv_int32m2_t'
+  vint32m2_t i32m2;
+  // CHECK: u32m2 'vuint32m2_t':'__rvv_uint32m2_t'
+  vuint32m2_t u32m2;
+  // CHECK: i32m4 'vint32m4_t':'__rvv_int32m4_t'
+  vint32m4_t i32m4;
+  // CHECK: u32m4 'vuint32m4_t':'__rvv_uint32m4_t'
+  vuint32m4_t u32m4;
+  // CHECK: i32m8 'vint32m8_t':'__rvv_int32m8_t'
+  vint32m8_t i32m8;
+  // CHECK: u32m8 'vuint32m8_t':'__rvv_uint32m8_t'
+  vuint32m8_t u32m8;
+
+  // CHECK: i64m1 'vint64m1_t':'__rvv_int64m1_t'
+  vint64m1_t i64m1;
+  // CHECK: u64m1 'vuint64m1_t':'__rvv_uint64m1_t'
+  vuint64m1_t u64m1;
+  // CHECK: i64m2 'vint64m2_t':'__rvv_int64m2_t'
+  vint64m2_t i64m2;
+  // CHECK: u64m2 'vuint64m2_t':'__rvv_uint64m2_t'
+  vuint64m2_t u64m2;
+  // CHECK: i64m4 'vint64m4_t':'__rvv_int64m4_t'
+  vint64m4_t i64m4;
+  // CHECK: u64m4 'vuint64m4_t':'__rvv_uint64m4_t'
+  vuint64m4_t u64m4;
+  // CHECK: i64m8 'vint64m8_t':'__rvv_int64m8_t'
+  vint64m8_t i64m8;
+  // CHECK: u64m8 'vuint64m8_t':'__rvv_uint64m8_t'
+  vuint64m8_t u64m8;
+
+  // CHECK: f16mf4 'vfloat16mf4_t':'__rvv_float16mf4_t'
+  vfloat16mf4_t f16mf4;
+  // CHECK: f16mf2 'vfloat16mf2_t':'__rvv_float16mf2_t'
+  vfloat16mf2_t f16mf2;
+  // CHECK: f16m1 'vfloat16m1_t':'__rvv_float16m1_t'
+  vfloat16m1_t f16m1;
+  // CHECK: f16m2 'vfloat16m2_t':'__rvv_float16m2_t'
+  vfloat16m2_t f16m2;
+  // CHECK: f16m4 'vfloat16m4_t':'__rvv_float16m4_t'

[PATCH] D125771: [clang-tidy] Add a useful note about -std=c++11-or-later

2022-05-18 Thread Whisperity via Phabricator via cfe-commits
whisperity added a comment.

In D125771#3519606 , 
@LegalizeAdulthood wrote:

> I thought there wasn't any support for validating fixits applied to header 
> files?

It is not specifically about the fixits, but diagnostics as a whole. It was not 
clear that if you say `-std=c++11-or-later` it will actually run **multiple** 
executions without giving you the ability to observe the contents of the files.

Technically, you can always match a diagnostic that is positioned into a header 
from the TU that is producing that diagnostic, because `// CHECK-MESSAGES:` 
does a regular expression-like matching. For example, `misc-unused-parameters` 
does the following 
:

  #include "header.h"
  // CHECK-MESSAGES: header.h:1:38: warning

And because LIT can execute arbitrary commands, you can always go about your 
way running `FileCheck` and everything else manually.

But it is good to be reminded early on that `-or-later` will result in 
execution of potentially changed code outside of your (test file's) control. 
Saves the debugging time which we had to endure!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125771

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


[PATCH] D125863: [clangd] Dont mark terminating PP-directives as skipped

2022-05-18 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet created this revision.
kadircet added reviewers: sammccall, hokein.
Herald added subscribers: usaxena95, arphaman.
Herald added a project: All.
kadircet requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.

PP-callback includes the terminating PP-directive
(else/elifdef/elifndef/endif) in the skipped source range. This results in
confusion as in theory that PP-directive is not skipped.
This patch changes the end location to be start of the line containing the
termination directive. That way clangd can keep highlightings for macro names in
the terminating directive as well.
This patch doesn't change the semantics of the PP-callback, as the range
possibly contains comments etc. trailing the termination directive. It's unclear
how useful that's for applications (only coverage mapping makes use of the full
range, rest always uses the endifloc for termination location), but it
definitely looks like a more intrusive change than just handling in clangd.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125863

Files:
  clang-tools-extra/clangd/CollectMacros.h
  clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp


Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
===
--- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
+++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
@@ -441,10 +441,10 @@
   #define $Macro_decl[[test]]
   #undef $Macro[[test]]
 $InactiveCode[[#ifdef test]]
-$InactiveCode[[#endif]]
+#endif
 
 $InactiveCode[[#if defined(test)]]
-$InactiveCode[[#endif]]
+#endif
 )cpp",
   R"cpp(
   struct $Class_decl[[S]] {
@@ -551,8 +551,8 @@
   R"cpp(
   // Code in the preamble.
   // Inactive lines get an empty InactiveCode token at the beginning.
-$InactiveCode[[#ifdef test]]
-$InactiveCode[[#endif]]
+$InactiveCode[[#ifdef test // With comment]]
+#endif
 
   // A declaration to cause the preamble to end.
   int $Variable_decl[[EndPreamble]];
@@ -563,11 +563,11 @@
   #define $Macro_decl[[test2]]
 $InactiveCode[[#if defined(test)]]
 $InactiveCode[[int Inactive2;]]
-$InactiveCode[[#elif defined(test2)]]
+#elif defined($Macro[[test2]])
   int $Variable_decl[[Active1]];
 $InactiveCode[[#else]]
 $InactiveCode[[int Inactive3;]]
-$InactiveCode[[#endif]]
+#endif
 
   #ifndef $Macro[[test]]
   int $Variable_decl[[Active2]];
@@ -575,7 +575,7 @@
 
 $InactiveCode[[#ifdef test]]
 $InactiveCode[[int Inactive4;]]
-$InactiveCode[[#else]]
+#else
   int $Variable_decl[[Active3]];
   #endif
 )cpp",
Index: clang-tools-extra/clangd/CollectMacros.h
===
--- clang-tools-extra/clangd/CollectMacros.h
+++ clang-tools-extra/clangd/CollectMacros.h
@@ -85,7 +85,9 @@
 if (!InMainFile)
   return;
 Position Begin = sourceLocToPosition(SM, R.getBegin());
-Position End = sourceLocToPosition(SM, R.getEnd());
+Position End = sourceLocToPosition(SM, EndifLoc);
+// Don't mark the terminating PP-directive as skipped.
+End.character = 0;
 Out.SkippedRanges.push_back(Range{Begin, End});
   }
 


Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
===
--- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
+++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
@@ -441,10 +441,10 @@
   #define $Macro_decl[[test]]
   #undef $Macro[[test]]
 $InactiveCode[[#ifdef test]]
-$InactiveCode[[#endif]]
+#endif
 
 $InactiveCode[[#if defined(test)]]
-$InactiveCode[[#endif]]
+#endif
 )cpp",
   R"cpp(
   struct $Class_decl[[S]] {
@@ -551,8 +551,8 @@
   R"cpp(
   // Code in the preamble.
   // Inactive lines get an empty InactiveCode token at the beginning.
-$InactiveCode[[#ifdef test]]
-$InactiveCode[[#endif]]
+$InactiveCode[[#ifdef test // With comment]]
+#endif
 
   // A declaration to cause the preamble to end.
   int $Variable_decl[[EndPreamble]];
@@ -563,11 +563,11 @@
   #define $Macro_decl[[test2]]
 $InactiveCode[[#if defined(test)]]
 $InactiveCode[[int Inactive2;]]
-$InactiveCode[[#elif defined(test2)]]
+#elif defined($Macro[[test2]])
   int $Variable_decl[[Active1]];
 $InactiveCode[[#else]]
 $InactiveCode[[int Inactive3;]]
-$InactiveCode[[#endif]]
+#endif
 
   #ifndef $Macro[[test]]
   int $Variable_decl[[Active2]];
@@ -575,7 +575,7 @@
 
 $InactiveCode[[#ifdef test]]
 $InactiveCode[[int Inactive4;]]
-$InactiveCode[[#else]]
+#else
   int $Variable_decl[[Active3]];
   #endif
 )cpp",
Index: clang-tools-extra/clangd/CollectMacros.h
===
--- clang-tools-extra/clangd/CollectMacros.h
+++ clang-tools-extra/clangd/CollectMacros.h

[PATCH] D125209: [clang-tidy] modernize-deprecated-headers check should respect extern "C" blocks

2022-05-18 Thread Balázs Benics via Phabricator via cfe-commits
steakhal updated this revision to Diff 430295.
steakhal marked an inline comment as done.
steakhal added a comment.

- Move all the `details` stuff into an anonymous namespace.
- Pass the `std::vector &IncludesToBeProcessed` directly to the 
callbacks.
- Sink the `IncludeMarker` definition into the public part of 
`DeprecatedHeadersCheck`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125209

Files:
  clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp
  clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/modernize-deprecated-headers/mylib.h
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/modernize-deprecated-headers/mysystemlib.h
  
clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp
@@ -0,0 +1,66 @@
+
+// Copy the 'mylib.h' to a directory under the build directory. This is
+// required, since the relative order of the emitted diagnostics depends on the
+// absolute file paths which is sorted by clang-tidy prior emitting.
+//
+// RUN: mkdir -p %t/sys && mkdir -p %t/usr \
+// RUN:   && cp %S/Inputs/modernize-deprecated-headers/mysystemlib.h %t/sys/mysystemlib.h \
+// RUN:   && cp %S/Inputs/modernize-deprecated-headers/mylib.h   %t/usr/mylib.h
+
+// RUN: %check_clang_tidy -std=c++11 %s modernize-deprecated-headers %t \
+// RUN:   --header-filter='.*' --system-headers \
+// RUN:   -- -I %t/usr -isystem %t/sys -isystem %S/Inputs/modernize-deprecated-headers
+
+// REQUIRES: system-linux
+
+#define EXTERN_C extern "C"
+
+extern "C++" {
+// We should still have the warnings here.
+#include 
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it [modernize-deprecated-headers]
+}
+
+#include 
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers]
+
+#include 
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it [modernize-deprecated-headers]
+
+#include  // FIXME: We should have no warning into system headers.
+// CHECK-MESSAGES: mysystemlib.h:1:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers]
+
+#include 
+// CHECK-MESSAGES: mylib.h:1:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers]
+
+namespace wrapping {
+extern "C" {
+#include   // no-warning
+#include// no-warning
+#include  // no-warning
+}
+} // namespace wrapping
+
+extern "C" {
+namespace wrapped {
+#include   // no-warning
+#include// no-warning
+#include  // no-warning
+} // namespace wrapped
+}
+
+namespace wrapping {
+extern "C" {
+namespace wrapped {
+#include   // no-warning
+#include// no-warning
+#include  // no-warning
+} // namespace wrapped
+}
+} // namespace wrapping
+
+EXTERN_C {
+#include   // no-warning
+#include// no-warning
+#include  // no-warning
+}
Index: clang-tools-extra/test/clang-tidy/checkers/Inputs/modernize-deprecated-headers/mysystemlib.h
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/Inputs/modernize-deprecated-headers/mysystemlib.h
@@ -0,0 +1 @@
+#include 
Index: clang-tools-extra/test/clang-tidy/checkers/Inputs/modernize-deprecated-headers/mylib.h
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/Inputs/modernize-deprecated-headers/mylib.h
@@ -0,0 +1 @@
+#include 
Index: clang-tools-extra/docs/ReleaseNotes.rst
===
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -170,6 +170,11 @@
   ` involving assignments in
   conditions. This fixes `Issue 35853 `_.
 
+- Fixed a false positive in :doc:`modernize-deprecated-headers
+  ` involving including
+  C header files from C++ files wrapped by ``extern "C" { ... }`` blocks.
+  Such includes will be ignored by now.
+
 - Improved :doc:`performance-inefficient-vector-operation
   ` to work when
   the vector is a member of a structure.
Index: clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.h
===
--- clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.h
+++ clang-tools-extra/clang-tidy/modernize/DeprecatedHeade

[PATCH] D125769: [clang-tidy] Introduce the WarnIntoHeaders option to modernize-deprecated-headers

2022-05-18 Thread Balázs Benics via Phabricator via cfe-commits
steakhal updated this revision to Diff 430297.
steakhal added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125769

Files:
  clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp
  clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  
clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp
@@ -8,6 +8,13 @@
 // RUN:   && cp %S/Inputs/modernize-deprecated-headers/mylib.h   %t/usr/mylib.h
 
 // RUN: %check_clang_tidy -std=c++11 %s modernize-deprecated-headers %t \
+// RUN:   -check-suffixes=DEFAULT \
+// RUN:   --header-filter='.*' --system-headers \
+// RUN:   -- -I %t/usr -isystem %t/sys -isystem %S/Inputs/modernize-deprecated-headers
+
+// RUN: %check_clang_tidy -std=c++11 %s modernize-deprecated-headers %t \
+// RUN:   -check-suffixes=DEFAULT,WARN-INTO-HEADERS \
+// RUN:   -config="{CheckOptions: [{key: modernize-deprecated-headers.WarnIntoHeaders, value: 'true'}]}" \
 // RUN:   --header-filter='.*' --system-headers \
 // RUN:   -- -I %t/usr -isystem %t/sys -isystem %S/Inputs/modernize-deprecated-headers
 
@@ -18,20 +25,20 @@
 extern "C++" {
 // We should still have the warnings here.
 #include 
-// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it [modernize-deprecated-headers]
+// CHECK-MESSAGES-DEFAULT: :[[@LINE-1]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it [modernize-deprecated-headers]
 }
 
 #include 
-// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers]
+// CHECK-MESSAGES-DEFAULT: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers]
 
 #include 
-// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it [modernize-deprecated-headers]
+// CHECK-MESSAGES-DEFAULT: :[[@LINE-1]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it [modernize-deprecated-headers]
 
 #include  // FIXME: We should have no warning into system headers.
-// CHECK-MESSAGES: mysystemlib.h:1:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers]
+// CHECK-MESSAGES-WARN-INTO-HEADERS: mysystemlib.h:1:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers]
 
 #include 
-// CHECK-MESSAGES: mylib.h:1:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers]
+// CHECK-MESSAGES-WARN-INTO-HEADERS: mylib.h:1:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers]
 
 namespace wrapping {
 extern "C" {
Index: clang-tools-extra/docs/ReleaseNotes.rst
===
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -174,6 +174,10 @@
   ` involving including
   C header files from C++ files wrapped by ``extern "C" { ... }`` blocks.
   Such includes will be ignored by now.
+  By default now it doesn't warn for including deprecated headers from header
+  files, since that header file might be used from C source files. By passing
+  the ``WarnIntoHeaders=true`` option if header files of the project only
+  included by c++ source files.
 
 - Improved :doc:`performance-inefficient-vector-operation
   ` to work when
Index: clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.h
===
--- clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.h
+++ clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.h
@@ -38,6 +38,7 @@
   bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
 return LangOpts.CPlusPlus;
   }
+  void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
   void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
Preprocessor *ModuleExpanderPP) override;
   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
@@ -53,6 +54,7 @@
 
 private:
   std::vector IncludesToBeProcessed;
+  bool WarnIntoHeaders;
 };
 
 } // namespace modernize
Index: clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp
===

[PATCH] D125769: [clang-tidy] Introduce the WarnIntoHeaders option to modernize-deprecated-headers

2022-05-18 Thread Whisperity via Phabricator via cfe-commits
whisperity added inline comments.



Comment at: clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.h:63
   std::vector IncludesToBeProcessed;
+  bool WarnIntoHeaders;
 };

LegalizeAdulthood wrote:
> 1) How is this different from the clang-tidy option that specifies whether or 
> not fixits are applied to header files?
> 
>   As an owner of a code base, I would know which header files are included 
> from C source files and I would set my header-file regex (honestly, not a fan 
> of a regex for that option; I'd prefer white/black lists, but that's another 
> discussion) to exclude header files that are known to be included in C source 
> files.
> 
> 2) Assuming that the header-file regex is somehow insufficient to cover this 
> scenario, I like the functionality but the name of this option feels "off".  
> (Naming things is hard.)  Elsewhere we have options that say `HeaderFile` not 
> `Headers` and `Into` just doesn't sound like the way normal conversation 
> would state the situation.  Something like `CheckHeaderFile` would be more 
> consistent with existing options.
I do not know the answer to question //1//, but as an owner of a code-base, I 
would not want to know or deal with keeping additional lists (be it 
file-by-file, glob expressions, or regex...) specific to what headers are 
includable from C and what aren't. Especially considering that every C header 
could be included from C++. (Note how LLVM uses `.h` instead of `.hpp` for its 
headers, even though >90% of our headers would never compile in C mode...) If a 
check is misbehaving for my codebase, I'd just simply disable that check (1 
line of code) and go on with my life, instead of creating a curated list, that 
is //at least// 2 LoC in a config file, //and// has to be maintained down the 
line...

Moreover, the `-header-filter` regex and `-system-headers` are Tidy-level 
global flags. This means that I would either have to let go of EVERY potential 
diagnostic that might be placed in headers, or tinker with my environment to 
run multiple instances of Clang-Tidy with different configurations.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125769

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


[PATCH] D125209: [clang-tidy] modernize-deprecated-headers check should respect extern "C" blocks

2022-05-18 Thread Balázs Benics via Phabricator via cfe-commits
steakhal marked an inline comment as done.
steakhal added inline comments.



Comment at: clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp:90
+  // to the `ASTContext`.
+  Finder->addMatcher(ast_matchers::translationUnitDecl().bind("TU"), this);
+}

LegalizeAdulthood wrote:
> In modernize-macro-to-enum I had to similarly discard macros defined inside a 
> top-level decl.  I did `decl(hasParent(translationUnitDecl()))` to match the 
> top-level decls.  Would that simplify your check as well?
The problem is that `extern "C" {...}` blocks might be within some namespace 
declarations.
https://godbolt.org/z/vr5jYx5az



Comment at: 
clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp:123
 
-IncludeModernizePPCallbacks::IncludeModernizePPCallbacks(ClangTidyCheck &Check,
- LangOptions LangOpts)
+detail::IncludeModernizePPCallbacks::IncludeModernizePPCallbacks(
+DeprecatedHeadersCheck &Check, LangOptions LangOpts)

LegalizeAdulthood wrote:
> IMO it's poor style to define entities that are declared within a namespace 
> outside the namespace within which they were declared.
> 
> Is there some reason this isn't defined with the rest of the methods on the 
> callback class?
I eradicated the use of `detail` namespace.
It indeed looks better.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125209

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


[PATCH] D125769: [clang-tidy] Introduce the CheckHeaderFile option to modernize-deprecated-headers

2022-05-18 Thread Balázs Benics via Phabricator via cfe-commits
steakhal updated this revision to Diff 430303.
steakhal retitled this revision from "[clang-tidy] Introduce the 
WarnIntoHeaders option to modernize-deprecated-headers" to "[clang-tidy] 
Introduce the CheckHeaderFile option to modernize-deprecated-headers".
steakhal edited the summary of this revision.
steakhal added a comment.

- Renamed `WarnIntoHeaders` -> `CheckHeaderFile`
- I forgot to extend the check's docs about this option. I've addressed that 
one too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125769

Files:
  clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp
  clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/modernize-deprecated-headers.rst
  
clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp
@@ -8,6 +8,13 @@
 // RUN:   && cp %S/Inputs/modernize-deprecated-headers/mylib.h   %t/usr/mylib.h
 
 // RUN: %check_clang_tidy -std=c++11 %s modernize-deprecated-headers %t \
+// RUN:   -check-suffixes=DEFAULT \
+// RUN:   --header-filter='.*' --system-headers \
+// RUN:   -- -I %t/usr -isystem %t/sys -isystem %S/Inputs/modernize-deprecated-headers
+
+// RUN: %check_clang_tidy -std=c++11 %s modernize-deprecated-headers %t \
+// RUN:   -check-suffixes=DEFAULT,CHECK-HEADER-FILE \
+// RUN:   -config="{CheckOptions: [{key: modernize-deprecated-headers.CheckHeaderFile, value: 'true'}]}" \
 // RUN:   --header-filter='.*' --system-headers \
 // RUN:   -- -I %t/usr -isystem %t/sys -isystem %S/Inputs/modernize-deprecated-headers
 
@@ -18,20 +25,20 @@
 extern "C++" {
 // We should still have the warnings here.
 #include 
-// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it [modernize-deprecated-headers]
+// CHECK-MESSAGES-DEFAULT: :[[@LINE-1]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it [modernize-deprecated-headers]
 }
 
 #include 
-// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers]
+// CHECK-MESSAGES-DEFAULT: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers]
 
 #include 
-// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it [modernize-deprecated-headers]
+// CHECK-MESSAGES-DEFAULT: :[[@LINE-1]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it [modernize-deprecated-headers]
 
 #include  // FIXME: We should have no warning into system headers.
-// CHECK-MESSAGES: mysystemlib.h:1:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers]
+// CHECK-MESSAGES-CHECK-HEADER-FILE: mysystemlib.h:1:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers]
 
 #include 
-// CHECK-MESSAGES: mylib.h:1:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers]
+// CHECK-MESSAGES-CHECK-HEADER-FILE: mylib.h:1:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers]
 
 namespace wrapping {
 extern "C" {
Index: clang-tools-extra/docs/clang-tidy/checks/modernize-deprecated-headers.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/modernize-deprecated-headers.rst
+++ clang-tools-extra/docs/clang-tidy/checks/modernize-deprecated-headers.rst
@@ -10,6 +10,17 @@
 This check replaces C standard library headers with their C++ alternatives and
 removes redundant ones.
 
+.. code-block:: c++
+
+  // C++ source file...
+  #include 
+  #include 
+
+  // becomes
+
+  #include 
+  // No 'stdbool.h' here.
+
 Important note: the Standard doesn't guarantee that the C++ headers declare all
 the same functions in the global namespace. The check in its current form can
 break the code that uses library symbols from the global namespace.
@@ -47,3 +58,26 @@
 * ``
 * ``
 * ``
+
+The checker ignores `include` directives within `extern "C" { ... }` blocks,
+since a library might want to expose some API for C and C++ libraries.
+
+.. code-block:: c++
+
+  // C++ source file...
+  extern "C" {
+  #include   // Left intact.
+  #include  // Left intact.
+  }
+
+Options
+---
+
+.. option:: CheckHead

[PATCH] D124446: [clang-tidy] Add the misc-discarded-return-value check

2022-05-18 Thread Whisperity via Phabricator via cfe-commits
whisperity added inline comments.



Comment at: clang-tools-extra/clang-tidy/misc/DiscardedReturnValueCheck.cpp:181
+
+  static const auto Decltype = decltypeType(hasUnderlyingExpr(Call));
+  static const auto TemplateArg =

aaron.ballman wrote:
> aaron.ballman wrote:
> > whisperity wrote:
> > > whisperity wrote:
> > > > whisperity wrote:
> > > > > aaron.ballman wrote:
> > > > > > So, I'm not super keen on this approach of having to try to 
> > > > > > identify every single place in which an expression is considered to 
> > > > > > be "used" -- this is going to be fragile because we'll miss places 
> > > > > > and it's going to be a maintenance burden because new places will 
> > > > > > be added as the languages evolve.
> > > > > > 
> > > > > > For example, if we're handling `decltype` as a use, why not 
> > > > > > `noexcept`? Or conditional `explicit`? What about a `co_return` 
> > > > > > statement?
> > > > > > 
> > > > > > I'm not certain what we can do to improve this, but I think it's 
> > > > > > worth trying to explore options to see if we can generalize what 
> > > > > > constitutes a use so that we can write a few custom matchers to do 
> > > > > > the heavy lifting instead of trying to play whack-a-mole.
> > > > > I've been having other thoughts about this `decltype` here... 
> > > > > Actually, neither `decltype` nor `noexcept` should be handled as a 
> > > > > //"use"// at all, while `co_return` should be the same as a `return` 
> > > > > -- however, I think it was due to lack of projects where such could 
> > > > > be meaningfully measured as a missed case was why implementing that 
> > > > > failed.
> > > > > 
> > > > > For `decltype`, `typedef`, and `noexcept` (and perhaps several 
> > > > > others), the good solution would be having a third route: calls that 
> > > > > //should not be counted//. Neither as a "consumed call", nor as a 
> > > > > "bare call". Ignored, from both calculations. Maybe even for template 
> > > > > arguments below.
> > > > As for better matching... Unfortunately, types in the AST are so varied 
> > > > and `hasDescendant` is too generic to express something like 
> > > > `stmt(anyOf(ifStmt(), forStmt(), switchStmt()), hasDescendant(Call))` 
> > > > to express in a single expression matching uses... The conditions are 
> > > > not always direct children of the outer node, while `hasDescendant` 
> > > > will match not just the condition but the entire tree... resulting in 
> > > > things like //both// functions in
> > > > 
> > > > ```lang=cpp
> > > > if (foo())
> > > >   bar()
> > > > ```
> > > > 
> > > > matching.
> > > > 
> > > > Well... generalisation... I can throw in a formal fluke:
> > > > 
> > > > > A **use** is a //context// for a specific `CallExpr C` in which we 
> > > > > can reasonably assume that the value produced by evaluating `C` is 
> > > > > loaded by another expression.
> > > > 
> > > > Now what I found is `-Wunused-result`, aka 
> > > > `SemaDiagnostics::warn_unused_expr`, which is triggered in the function 
> > > > `ExprResult Sema::ActOnFinishFullExpr(Expr* FE, SourceLocation CC, bool 
> > > > DiscardedValue, bool IsConstexpr);`. Now this function itself does 
> > > > //some// heuristics inside (with a **lot** of `FIXME`s as of 
> > > > rGdab5e10ea5dbc2e6314e0e7ce54a9c51fbcb44bd), but notably, 
> > > > `DiscardedValue` is a parameter. According to a quick search, this 
> > > > function (and its overloads) have **82** callsites within `Sema`, with 
> > > > many of them just tougher to decipher than others. Some of the other 
> > > > ways this function is called, e.g. `ActOnStmtExprResult`, have codes 
> > > > like this:
> > > > 
> > > > ```lang=cpp
> > > > IsStmtExprResult = GetLookAheadToken(LookAhead).is(tok::r_brace) && 
> > > > GetLookAheadToken(LookAhead + 1).is(tok::r_paren);
> > > > ```
> > > > 
> > > > So I would say most of the logic there is **very** parsing specific, 
> > > > and requires information that is only available during the parsing 
> > > > descent, and not later when someone tries to consume a `const AST`.
> > > @aaron.ballman There is a `bugprone-unused-return-value` since mid 2018, 
> > > in which the matched function set is configurable with a hardcoded 
> > > default, and the matching logic is also... verbose.
> > > 
> > > [[ 
> > > http://github.com/llvm/llvm-project/blob/c1a9d14982f887355da1959eba3a47b952fc6e7a/clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp#L144-L165
> > >  | Source ]]
> > > 
> > > ```lang=cpp
> > > auto UnusedInIfStmt =
> > >   ifStmt(eachOf(hasThen(MatchedCallExpr), hasElse(MatchedCallExpr)));
> > >   auto UnusedInWhileStmt = whileStmt(hasBody(MatchedCallExpr));
> > >   auto UnusedInDoStmt = doStmt(hasBody(MatchedCallExpr));
> > > ```
> > > 
> > > Agreed, this is seemingly a subset of the inverse match.
> > > For decltype, typedef, and noexcept (and perhaps several others), the 
> > > good solution would be having a third route: calls that shou

[PATCH] D124446: [clang-tidy] Add the misc-discarded-return-value check

2022-05-18 Thread Whisperity via Phabricator via cfe-commits
whisperity added inline comments.



Comment at: clang-tools-extra/clang-tidy/misc/DiscardedReturnValueCheck.cpp:181
+
+  static const auto Decltype = decltypeType(hasUnderlyingExpr(Call));
+  static const auto TemplateArg =

whisperity wrote:
> aaron.ballman wrote:
> > aaron.ballman wrote:
> > > whisperity wrote:
> > > > whisperity wrote:
> > > > > whisperity wrote:
> > > > > > aaron.ballman wrote:
> > > > > > > So, I'm not super keen on this approach of having to try to 
> > > > > > > identify every single place in which an expression is considered 
> > > > > > > to be "used" -- this is going to be fragile because we'll miss 
> > > > > > > places and it's going to be a maintenance burden because new 
> > > > > > > places will be added as the languages evolve.
> > > > > > > 
> > > > > > > For example, if we're handling `decltype` as a use, why not 
> > > > > > > `noexcept`? Or conditional `explicit`? What about a `co_return` 
> > > > > > > statement?
> > > > > > > 
> > > > > > > I'm not certain what we can do to improve this, but I think it's 
> > > > > > > worth trying to explore options to see if we can generalize what 
> > > > > > > constitutes a use so that we can write a few custom matchers to 
> > > > > > > do the heavy lifting instead of trying to play whack-a-mole.
> > > > > > I've been having other thoughts about this `decltype` here... 
> > > > > > Actually, neither `decltype` nor `noexcept` should be handled as a 
> > > > > > //"use"// at all, while `co_return` should be the same as a 
> > > > > > `return` -- however, I think it was due to lack of projects where 
> > > > > > such could be meaningfully measured as a missed case was why 
> > > > > > implementing that failed.
> > > > > > 
> > > > > > For `decltype`, `typedef`, and `noexcept` (and perhaps several 
> > > > > > others), the good solution would be having a third route: calls 
> > > > > > that //should not be counted//. Neither as a "consumed call", nor 
> > > > > > as a "bare call". Ignored, from both calculations. Maybe even for 
> > > > > > template arguments below.
> > > > > As for better matching... Unfortunately, types in the AST are so 
> > > > > varied and `hasDescendant` is too generic to express something like 
> > > > > `stmt(anyOf(ifStmt(), forStmt(), switchStmt()), hasDescendant(Call))` 
> > > > > to express in a single expression matching uses... The conditions are 
> > > > > not always direct children of the outer node, while `hasDescendant` 
> > > > > will match not just the condition but the entire tree... resulting in 
> > > > > things like //both// functions in
> > > > > 
> > > > > ```lang=cpp
> > > > > if (foo())
> > > > >   bar()
> > > > > ```
> > > > > 
> > > > > matching.
> > > > > 
> > > > > Well... generalisation... I can throw in a formal fluke:
> > > > > 
> > > > > > A **use** is a //context// for a specific `CallExpr C` in which we 
> > > > > > can reasonably assume that the value produced by evaluating `C` is 
> > > > > > loaded by another expression.
> > > > > 
> > > > > Now what I found is `-Wunused-result`, aka 
> > > > > `SemaDiagnostics::warn_unused_expr`, which is triggered in the 
> > > > > function `ExprResult Sema::ActOnFinishFullExpr(Expr* FE, 
> > > > > SourceLocation CC, bool DiscardedValue, bool IsConstexpr);`. Now this 
> > > > > function itself does //some// heuristics inside (with a **lot** of 
> > > > > `FIXME`s as of rGdab5e10ea5dbc2e6314e0e7ce54a9c51fbcb44bd), but 
> > > > > notably, `DiscardedValue` is a parameter. According to a quick 
> > > > > search, this function (and its overloads) have **82** callsites 
> > > > > within `Sema`, with many of them just tougher to decipher than 
> > > > > others. Some of the other ways this function is called, e.g. 
> > > > > `ActOnStmtExprResult`, have codes like this:
> > > > > 
> > > > > ```lang=cpp
> > > > > IsStmtExprResult = GetLookAheadToken(LookAhead).is(tok::r_brace) && 
> > > > > GetLookAheadToken(LookAhead + 1).is(tok::r_paren);
> > > > > ```
> > > > > 
> > > > > So I would say most of the logic there is **very** parsing specific, 
> > > > > and requires information that is only available during the parsing 
> > > > > descent, and not later when someone tries to consume a `const AST`.
> > > > @aaron.ballman There is a `bugprone-unused-return-value` since mid 
> > > > 2018, in which the matched function set is configurable with a 
> > > > hardcoded default, and the matching logic is also... verbose.
> > > > 
> > > > [[ 
> > > > http://github.com/llvm/llvm-project/blob/c1a9d14982f887355da1959eba3a47b952fc6e7a/clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp#L144-L165
> > > >  | Source ]]
> > > > 
> > > > ```lang=cpp
> > > > auto UnusedInIfStmt =
> > > >   ifStmt(eachOf(hasThen(MatchedCallExpr), 
> > > > hasElse(MatchedCallExpr)));
> > > >   auto UnusedInWhileStmt = whileStmt(hasBody(MatchedCallExpr));
> > > >   auto UnusedInDoStmt = doStmt(hasBody(MatchedCallExpr));
> > > > ```
> > > > 
> >

[PATCH] D125769: [clang-tidy] Introduce the CheckHeaderFile option to modernize-deprecated-headers

2022-05-18 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added inline comments.



Comment at: 
clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp:2-4
 // Copy the 'mylib.h' to a directory under the build directory. This is
 // required, since the relative order of the emitted diagnostics depends on the
 // absolute file paths which is sorted by clang-tidy prior emitting.

LegalizeAdulthood wrote:
> IMO, all of this hackery is simply ducking the issue, which is that 
> `check_clang_tidy.py` doesn't have proper support for validating fixits 
> applied to header files.
> 
> See https://reviews.llvm.org/D17482
I agree that this is nasty, but this was the only way I found to still test the 
feature I'm about to introduce.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125769

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


[PATCH] D125770: [clang-tidy] modernize-deprecated-headers should ignore system headers

2022-05-18 Thread Balázs Benics via Phabricator via cfe-commits
steakhal updated this revision to Diff 430305.
steakhal marked an inline comment as done.
steakhal retitled this revision from "[clang-tidy] modernize-deprecated-headers 
should ignore  system headers" to "[clang-tidy] modernize-deprecated-headers 
should ignore system headers".
steakhal added a comment.

Rebased after changing the name of the option.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125770

Files:
  clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp
  
clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp


Index: 
clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp
===
--- 
clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp
+++ 
clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp
@@ -34,8 +34,7 @@
 #include 
 // CHECK-MESSAGES-DEFAULT: :[[@LINE-1]]:10: warning: including 'stdbool.h' has 
no effect in C++; consider removing it [modernize-deprecated-headers]
 
-#include  // FIXME: We should have no warning into system 
headers.
-// CHECK-MESSAGES-CHECK-HEADER-FILE: mysystemlib.h:1:10: warning: inclusion of 
deprecated C++ header 'assert.h'; consider using 'cassert' instead 
[modernize-deprecated-headers]
+#include  // no-warning: Don't warn into system headers.
 
 #include 
 // CHECK-MESSAGES-CHECK-HEADER-FILE: mylib.h:1:10: warning: inclusion of 
deprecated C++ header 'assert.h'; consider using 'cassert' instead 
[modernize-deprecated-headers]
Index: clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp
===
--- clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp
+++ clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp
@@ -188,6 +188,10 @@
   if (!CheckHeaderFile && !SM.isInMainFile(HashLoc))
 return;
 
+  // Ignore system headers.
+  if (SM.isInSystemHeader(HashLoc))
+return;
+
   // FIXME: Take care of library symbols from the global namespace.
   //
   // Reasonable options for the check:


Index: clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp
@@ -34,8 +34,7 @@
 #include 
 // CHECK-MESSAGES-DEFAULT: :[[@LINE-1]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it [modernize-deprecated-headers]
 
-#include  // FIXME: We should have no warning into system headers.
-// CHECK-MESSAGES-CHECK-HEADER-FILE: mysystemlib.h:1:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers]
+#include  // no-warning: Don't warn into system headers.
 
 #include 
 // CHECK-MESSAGES-CHECK-HEADER-FILE: mylib.h:1:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers]
Index: clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp
===
--- clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp
+++ clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp
@@ -188,6 +188,10 @@
   if (!CheckHeaderFile && !SM.isInMainFile(HashLoc))
 return;
 
+  // Ignore system headers.
+  if (SM.isInSystemHeader(HashLoc))
+return;
+
   // FIXME: Take care of library symbols from the global namespace.
   //
   // Reasonable options for the check:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D125770: [clang-tidy] modernize-deprecated-headers should ignore system headers

2022-05-18 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added inline comments.



Comment at: 
clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp:37
 
-#include  // FIXME: We should have no warning into system 
headers.
-// CHECK-MESSAGES-WARN-INTO-HEADERS: mysystemlib.h:1:10: warning: inclusion of 
deprecated C++ header 'assert.h'; consider using 'cassert' instead 
[modernize-deprecated-headers]
+#include  // no-warning: Don't warn into system headers.
 

LegalizeAdulthood wrote:
> Where is this file?  I can't find it in my tree.
> 
> ```
> D:\legalize\llvm\llvm-project\clang-tools-extra
> > dir/s/b mysystemlib.h
> File Not Found
> ```
> 
> Does this patch depend on some other unsubmitted patch?
D125209 should have included this file at 
`clang-tools-extra/test/clang-tidy/checkers/Inputs/modernize-deprecated-headers/mysystemlib.h`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125770

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


[PATCH] D125868: [Driver] Recognize -std=gnu++20 enables C++ modules

2022-05-18 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov created this revision.
ilya-biryukov added a reviewer: sammccall.
Herald added a project: All.
ilya-biryukov requested review of this revision.
Herald added a subscriber: MaskRay.
Herald added a project: clang.

In addition to -std=c++20.
This used to result in wrong -cc1 flags produced by Driver


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125868

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/cpp20-header-module.cpp
  clang/test/Modules/cxx20-and-header-modules.cpp


Index: clang/test/Modules/cxx20-and-header-modules.cpp
===
--- clang/test/Modules/cxx20-and-header-modules.cpp
+++ clang/test/Modules/cxx20-and-header-modules.cpp
@@ -2,9 +2,12 @@
 //
 // Check header modules are disabled by default in C++20 mode.
 // RUN: %clang -std=c++20 -fsyntax-only -fno-implicit-modules 
-fmodules-cache-path=%t -I%S/Inputs/cxx20-and-header-modules 
-fmodule-map-file=%S/Inputs/cxx20-and-header-modules/a.map %s
+// RUN: %clang -std=gnu++20 -fsyntax-only -fno-implicit-modules 
-fmodules-cache-path=%t -I%S/Inputs/cxx20-and-header-modules 
-fmodule-map-file=%S/Inputs/cxx20-and-header-modules/a.map %s
 //
 // Also run in the header modules mode.
 // RUN: %clang -std=c++20 -DBUILDING_MODULE -fmodules -fimplicit-modules 
-fmodules-cache-path=%t -I%S/Inputs/cxx20-and-header-modules 
-fmodule-map-file=%S/Inputs/cxx20-and-header-modules/a.map %s
+// RUN: rm -rf %t
+// RUN: %clang -std=gnu++20 -DBUILDING_MODULE -fmodules -fimplicit-modules 
-fmodules-cache-path=%t -I%S/Inputs/cxx20-and-header-modules 
-fmodule-map-file=%S/Inputs/cxx20-and-header-modules/a.map %s
 
 #define INCLUDING 1
 #include "a.h"
Index: clang/test/Driver/cpp20-header-module.cpp
===
--- clang/test/Driver/cpp20-header-module.cpp
+++ clang/test/Driver/cpp20-header-module.cpp
@@ -3,7 +3,11 @@
 // RUN: %clang -fmodules-ts -std=c++20 -fsyntax-only -v %s 2>&1 | FileCheck %s 
--check-prefix=NO_HEADER_MODULES
 // RUN: %clang -std=c++20 -fsyntax-only -v %s 2>&1 | FileCheck %s 
--check-prefix=NO_HEADER_MODULES
 // RUN: %clang -std=c++2a -fsyntax-only -v %s 2>&1 | FileCheck %s 
--check-prefix=NO_HEADER_MODULES
+// RUN: %clang -std=c++2b -fsyntax-only -v %s 2>&1 | FileCheck %s 
--check-prefix=NO_HEADER_MODULES
 // RUN: %clang_cl /std:c++latest /Zs -v %s 2>&1 | FileCheck %s 
--check-prefix=NO_HEADER_MODULES
+// RUN: %clang -std=gnu++20 -fsyntax-only -v %s 2>&1 | FileCheck %s 
--check-prefix=NO_HEADER_MODULES
+// RUN: %clang -std=gnu++2a -fsyntax-only -v %s 2>&1 | FileCheck %s 
--check-prefix=NO_HEADER_MODULES
+// RUN: %clang -std=gnu++2b -fsyntax-only -v %s 2>&1 | FileCheck %s 
--check-prefix=NO_HEADER_MODULES
 //
 // NO_HEADER_MODULES-NOT: -fheader-modules
 // NO_HEADER_MODULES: -cc1
@@ -13,6 +17,10 @@
 // RUN: %clang -fmodules -fmodules-ts -fsyntax-only -v %s 2>&1 | FileCheck %s 
--check-prefix=HAS_HEADER_MODULES
 // RUN: %clang -fmodules -std=c++20 -fsyntax-only -v %s 2>&1 | FileCheck %s 
--check-prefix=HAS_HEADER_MODULES
 // RUN: %clang -fmodules -std=c++2a -fsyntax-only -v %s 2>&1 | FileCheck %s 
--check-prefix=HAS_HEADER_MODULES
+// RUN: %clang -fmodules -std=c++2b -fsyntax-only -v %s 2>&1 | FileCheck %s 
--check-prefix=HAS_HEADER_MODULES
+// RUN: %clang -fmodules -std=gnu++20 -fsyntax-only -v %s 2>&1 | FileCheck %s 
--check-prefix=HAS_HEADER_MODULES
+// RUN: %clang -fmodules -std=gnu++2a -fsyntax-only -v %s 2>&1 | FileCheck %s 
--check-prefix=HAS_HEADER_MODULES
+// RUN: %clang -fmodules -std=gnu++2b -fsyntax-only -v %s 2>&1 | FileCheck %s 
--check-prefix=HAS_HEADER_MODULES
 //
 // HAS_HEADER_MODULES-NOT: -fno-header-modules
 // HAS_HEADER_MODULES: -cc1
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -6537,9 +6537,12 @@
 
   // FIXME: Find a better way to determine whether the language has modules
   // support by default, or just assume that all languages do.
-  bool HaveModules =
-  Std && (Std->containsValue("c++2a") || Std->containsValue("c++20") ||
-  Std->containsValue("c++latest"));
+  bool HaveModules = Std && llvm::any_of(Std->getValues(), [](const char *S) {
+   constexpr llvm::StringRef CPP_MODULES_STD[] = {
+   "c++2a",   "c++20",   "c++2b",  "c++latest",
+   "gnu++2a", "gnu++20", "gnu++2b"};
+   return llvm::is_contained(CPP_MODULES_STD, S);
+ });
   RenderModulesOptions(C, D, Args, Input, Output, CmdArgs, HaveModules);
 
   if (Args.hasFlag(options::OPT_fpch_validate_input_files_content,


Index: clang/test/Modules/cxx20-and-header-modules.cpp
===
--- clang/test/Modules/cxx20-and-header-modules.cpp
+++ clang/test/Modules/cxx20-and-header-mo

[PATCH] D125683: [runtimes] Replace LIBCXX_ENABLE_STATIC_ABI_LIBRARY & friends by a new LIBCXX_CXX_ABI choice

2022-05-18 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo added inline comments.



Comment at: libcxx/cmake/caches/MinGW.cmake:3
 
-set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "")
+set(LIBCXX_CXX_ABI libcxxabi-objects CACHE STRING "")
 set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")

Unfortunately, setting `LIBCXX_CXX_ABI=libcxxabi-objects` here in the cache 
file doesn't have any effect, because the `run-buildbot` script invokes cmake 
with a different parameter:
```
function generate-cmake() {
generate-cmake-base \
  -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
  -DLIBCXX_CXX_ABI=libcxxabi \
  "${@}"
}
```
A cmake parameter explicitly set on the command line always overrides what's 
set in a cache file.



Comment at: libcxxabi/CMakeLists.txt:254
   # line or via a cache file), use its expected default value (enabled).
-  if ((LIBCXX_ENABLE_SHARED OR NOT DEFINED LIBCXX_ENABLE_SHARED) AND 
LIBCXX_ENABLE_STATIC_ABI_LIBRARY)
+  if ((LIBCXX_ENABLE_SHARED OR NOT DEFINED LIBCXX_ENABLE_SHARED) AND 
LIBCXX_CXX_ABI STREQUAL libcxxabi-objects)
 # Building libcxxabi statically, but intending for it to be statically

The fallback handling (checking `LIBCXX_ENABLE_STATIC_ABI_LIBRARY`, updating 
`LIBCXX_CXX_ABI` based on that) in libcxx doesn't have any effect here, since 
libcxxabi is processed strictly before libcxx, so here we only see the original 
values of the options.

However, luckily enough, I've posted D125715 a couple days ago, which lets us 
get rid of this whole problematic piece of code altogether (together with 
fixing a couple other issues), now that we have object libraries in palce!



Comment at: llvm/docs/HowToBuildWindowsItaniumPrograms.rst:159
 
-* ``-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON``
 * ``-DLIBCXX_CXX_ABI=libcxxabi``
 * ``-DLIBCXX_CXX_ABI_INCLUDE_PATHS=/include``

If the example instructions used to say `LIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON` 
before, you should update the `LIBCXX_CXX_ABI` setting here to 
`libcxxabi-objects` too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125683

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


[PATCH] D124244: [analyzer] add StoreToImmutable and ModelConstQualifiedReturn checkers

2022-05-18 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment.

I found this report at `vim/src/term.c` (https://github.com/vim/vim.git at 
`v8.2.1920`):
F23102904: image.png 

I'm not sure what the exact type of `BC` global variable is but I think it's 
declared as either `extern char *BC;` or just `char *BC;`.
`empty_option` is declared as either `extern unsigned char *empty_option;` or 
`unsigned char *empty_option = (unsigned char *)"";`

Could you please have a look at this FP @zukatsinadze?




Comment at: clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt:68-70
   MIGChecker.cpp
+  cert/ModelConstQualifiedReturnChecker.cpp
   MoveChecker.cpp

zukatsinadze wrote:
> steakhal wrote:
> > Put this in the right alphabetical place.
> I think it is in the right alphabetical place not considering cert/ (other 
> certs are in similar order), but maybe I should remove the cert directory, 
> what do you think? 
> It was created by me a few years ago, but I don't see a point now anymore.
Leave it here.



Comment at: clang/lib/StaticAnalyzer/Checkers/StoreToImmutableChecker.cpp:52
+  ImmutableMemoryBind, "modifying immutable memory", ErrorNode);
+  Report->markInteresting(R);
+  C.emitReport(std::move(Report));

zukatsinadze wrote:
> NoQ wrote:
> > I also recommend `trackExpressionValue` to make sure we have all 
> > reassignments highlighted as the value gets bounced between pointer 
> > variables. The user will need proof that the pointer actually points to 
> > const memory.
> What expression should I use for tracking? I tried to simply cast `S` to 
> `Expr`, but it didn't really work. 
> Then I came up with something ugly: cast `S` to `BinaryOperator` -> `getLHS` 
> -> `getSubExpr` -> `ignoreImpCasts`.  
Transitive interestingness might be related to this: D125362


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

https://reviews.llvm.org/D124244

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


[PATCH] D107082: [X86][RFC] Enable `_Float16` type support on X86 following the psABI

2022-05-18 Thread Phoebe Wang via Phabricator via cfe-commits
pengfei updated this revision to Diff 430314.
pengfei added a comment.

Use 32-bit spill slot for half type. Others still on going.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107082

Files:
  llvm/docs/ReleaseNotes.rst
  llvm/lib/Target/X86/X86FastISel.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/lib/Target/X86/X86InstrAVX512.td
  llvm/lib/Target/X86/X86InstrCompiler.td
  llvm/lib/Target/X86/X86InstrInfo.cpp
  llvm/lib/Target/X86/X86InstrSSE.td
  llvm/lib/Target/X86/X86InstrVecCompiler.td
  llvm/lib/Target/X86/X86InstructionSelector.cpp
  llvm/lib/Target/X86/X86RegisterInfo.td
  llvm/test/Analysis/CostModel/X86/fptoi_sat.ll
  llvm/test/CodeGen/MIR/X86/inline-asm-registers.mir
  llvm/test/CodeGen/X86/atomic-non-integer.ll
  llvm/test/CodeGen/X86/avx512-insert-extract.ll
  llvm/test/CodeGen/X86/avx512-masked_memop-16-8.ll
  llvm/test/CodeGen/X86/callbr-asm-bb-exports.ll
  llvm/test/CodeGen/X86/cvt16-2.ll
  llvm/test/CodeGen/X86/cvt16.ll
  llvm/test/CodeGen/X86/fastmath-float-half-conversion.ll
  llvm/test/CodeGen/X86/fmf-flags.ll
  llvm/test/CodeGen/X86/fp-round.ll
  llvm/test/CodeGen/X86/fp-roundeven.ll
  llvm/test/CodeGen/X86/fp128-cast-strict.ll
  llvm/test/CodeGen/X86/fpclamptosat.ll
  llvm/test/CodeGen/X86/fpclamptosat_vec.ll
  llvm/test/CodeGen/X86/fptosi-sat-scalar.ll
  llvm/test/CodeGen/X86/fptosi-sat-vector-128.ll
  llvm/test/CodeGen/X86/fptoui-sat-scalar.ll
  llvm/test/CodeGen/X86/fptoui-sat-vector-128.ll
  llvm/test/CodeGen/X86/freeze.ll
  llvm/test/CodeGen/X86/half-constrained.ll
  llvm/test/CodeGen/X86/half.ll
  llvm/test/CodeGen/X86/pr31088.ll
  llvm/test/CodeGen/X86/pr38533.ll
  llvm/test/CodeGen/X86/pr47000.ll
  llvm/test/CodeGen/X86/scheduler-asm-moves.mir
  llvm/test/CodeGen/X86/shuffle-extract-subvector.ll
  llvm/test/CodeGen/X86/stack-folding-fp-avx512fp16-fma.ll
  llvm/test/CodeGen/X86/stack-folding-fp-avx512fp16.ll
  llvm/test/CodeGen/X86/statepoint-invoke-ra-enter-at-end.mir
  llvm/test/CodeGen/X86/vec_fp_to_int.ll
  llvm/test/CodeGen/X86/vector-half-conversions.ll
  llvm/test/CodeGen/X86/vector-reduce-fmax-nnan.ll
  llvm/test/CodeGen/X86/vector-reduce-fmin-nnan.ll
  llvm/test/MC/X86/x86_64-asm-match.s

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


[PATCH] D125871: [analyzer] Delete alpha.deadcode.UnreachableCode checker

2022-05-18 Thread Gabor Marton via Phabricator via cfe-commits
martong created this revision.
martong added reviewers: NoQ, steakhal, Szelethus.
Herald added subscribers: manas, ASDenysPetrov, gamesh411, dkrupp, donat.nagy, 
mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun, 
mgorny.
Herald added a project: All.
martong requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This checker is fundamentally flawed, because this problem requires
all-path data-flow analysis.
This checker relies on the paths that have been visited during the
exploration of the exploded graph. There are no guarantees that the
symbolic execution will explore all paths. What's more, in practice,
most of the time it does not. Thus, we see way too many annoying false
positives.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125871

Files:
  clang/docs/analyzer/checkers.rst
  clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
  clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt
  clang/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
  clang/test/Analysis/malloc-annotations.c
  clang/test/Analysis/malloc-annotations.cpp
  clang/test/Analysis/malloc.c
  clang/test/Analysis/malloc.cpp
  clang/test/Analysis/qt_malloc.cpp
  clang/test/Analysis/unreachable-code-path.c
  clang/www/analyzer/alpha_checks.html

Index: clang/www/analyzer/alpha_checks.html
===
--- clang/www/analyzer/alpha_checks.html
+++ clang/www/analyzer/alpha_checks.html
@@ -447,48 +447,6 @@
 
 
 
-
-
-Dead Code Alpha Checkers
-
-
-Name, DescriptionExample
-
-
-
-alpha.deadcode.UnreachableCode
-(C, C++, ObjC)
-Check unreachable code.
-
-
-// C
-int test() {
-  int x = 1;
-  while(x);
-  return x; // warn
-}
-
-
-// C++
-void test() {
-  int a = 2;
-
-  while (a > 1)
-a--;
-
-  if (a > 1)
-a++; // warn
-}
-
-
-// Objective-C
-void test(id x) {
-  return;
-  [x retain]; // warn
-}
-
-
-
 
 LLVM Checkers
 
Index: clang/test/Analysis/unreachable-code-path.c
===
--- clang/test/Analysis/unreachable-code-path.c
+++ /dev/null
@@ -1,226 +0,0 @@
-// RUN: %clang_analyze_cc1 -analyzer-checker=core,deadcode.DeadStores,alpha.deadcode.UnreachableCode -verify -analyzer-opt-analyze-nested-blocks -Wno-unused-value %s
-
-extern void foo(int a);
-
-// The first few tests are non-path specific - we should be able to find them
-
-void test(unsigned a) {
-  switch (a) {
-a += 5; // expected-warning{{never executed}}
-  case 2:
-a *= 10;
-  case 3:
-a %= 2;
-  }
-  foo(a);
-}
-
-void test2(unsigned a) {
- help:
-  if (a > 0)
-return;
-  if (a == 0)
-return;
-  foo(a); // expected-warning{{never executed}}
-  goto help;
-}
-
-void test3(unsigned a) {
-  while(1);
-  if (a > 5) { // expected-warning{{never executed}}
-return;
-  }
-}
-
-// These next tests are path-sensitive
-
-void test4(void) {
-  int a = 5;
-
-  while (a > 1)
-a -= 2;
-
-  if (a > 1) {
-a = a + 56; // expected-warning{{never executed}}
-  }
-
-  foo(a);
-}
-
-extern void bar(char c);
-
-void test5(const char *c) {
-  foo(c[0]);
-
-  if (!c) {
-bar(1); // expected-warning{{never executed}}
-  }
-}
-
-// These next tests are false positives and should not generate warnings
-
-void test6(const char *c) {
-  if (c) return;
-  if (!c) return;
-  __builtin_unreachable(); // no-warning
-  __builtin_assume(0); // no-warning
-}
-
-// Compile-time constant false positives
-#define CONSTANT 0
-enum test_enum { Off, On };
-void test7(void) {
-  if (CONSTANT)
-return; // no-warning
-
-  if (sizeof(int))
-return; // no-warning
-
-  if (Off)
-return; // no-warning
-}
-
-void test8(void) {
-  static unsigned a = 0;
-
-  if (a)
-a = 123; // no-warning
-
-  a = 5;
-}
-
-// Check for bugs where multiple statements are reported
-void test9(unsigned a) {
-  switch (a) {
-if (a) // expected-warning{{never executed}}
-  foo(a + 5); // no-warning
-else  // no-warning
-  foo(a); // no-warning
-case 1:
-case 2:
-  break;
-default:
-  break;
-  }
-}
-
-// Tests from flow-sensitive version
-void test10(void) {
-  goto c;
-  d:
-  goto e; // expected-warning {{never executed}}
-  c: ;
-  int i;
-  return;
-  goto b; // expected-warning {{never executed}}
-  goto a; // expected-warning {{never executed}}
-  b:
-  i = 1; // no-warning
-  a:
-  i = 2;  // no-warning
-  goto f;
-  e:
-  goto d;
-  f: ;
-}
-
-// test11: we can actually end up in the default case, even if it is not
-// obvious: there might be something wrong with the given argument.
-enum foobar { FOO, BAR };
-extern void error(void);
-void test11(enum foobar fb) {
-  switch (fb) {
-case FOO:
-  break;
-case BAR:
-  break;
-default:
-  error(); // no-warning
-  return;
-  error(); // expected-warning {{never executed}}
-  }
-}
-
-void inlined(int condition) {
-  if (condition) {
-foo(5); //

[PATCH] D125871: [analyzer] Delete alpha.deadcode.UnreachableCode checker

2022-05-18 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments.



Comment at: clang/include/clang/StaticAnalyzer/Checkers/Checkers.td:847
 
-let ParentPackage = DeadCodeAlpha in {
-

TODO, update the ReleseNotes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125871

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


[PATCH] D125684: [clangd] Support UnresolvedUsingTypeLoc AST node in FindTarget.

2022-05-18 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.

thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125684

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


[PATCH] D125684: [clangd] Support UnresolvedUsingTypeLoc AST node in FindTarget.

2022-05-18 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added inline comments.



Comment at: clang-tools-extra/clangd/FindTarget.cpp:384
   }
+  void VisitUnresolvedUsingType(const UnresolvedUsingType * UUT) {
+Outer.add(UUT->getDecl(), Flags);

nit: formatting around `*`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125684

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


[PATCH] D125604: [FileCheck] Catch missspelled directives.

2022-05-18 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev added inline comments.



Comment at: llvm/lib/FileCheck/FileCheck.cpp:1774-1781
+static std::pair
+FindCheckType(const FileCheckRequest &Req, StringRef Buffer, StringRef Prefix) 
{
+  bool Misspelled = false;
+  auto Res = FindCheckType(Req, Buffer, Prefix, Misspelled);
+  if (Res.first != Check::CheckNone && Misspelled)
+return {Check::CheckMisspelled, Res.second};
+  return Res;

thopre wrote:
> kosarev wrote:
> > thopre wrote:
> > > kosarev wrote:
> > > > thopre wrote:
> > > > > Instead of introducing a new wrapper, why don't you change all the 
> > > > > return to call a constructor method (e.g. `make_check_type()`) that 
> > > > > does what this wrapper do? Then there would not be any FindCheckType 
> > > > > that take a Misspelled parameter.
> > > > > 
> > > > > I'm also not sure about Misspelled being a check kind. It feels 
> > > > > conceptually wrong but on the other hand I guess it makes the 
> > > > > implementation simpler.
> > > > Tried that. Replacing the returned pair with a new `CheckLine` kind of 
> > > > object implementing the misspelled-related logic seems to add a lot of 
> > > > extra clutter such as the definition of the new structure itself, but 
> > > > especially all the repetitive mentions of `Misspelled` on every 
> > > > `return`. Feels like having it as a reference parameter works better, 
> > > > as we only need to alter the flag occasionally.
> > > > 
> > > > Regarding `CheckMisspelled`, now that we have `CheckBadNot` and 
> > > > `CheckBadCount`, this looks the usual way of propagating the 
> > > > information about our spelling-related concerns. Might be not the best 
> > > > design and may be worth looking into at some point, but at least doesn' 
> > > > seem to be specific to this patch?
> > > I was thinking something along the line of:
> > > 
> > > return getRealCheckType(CHECK::CheckBadCount, Rest, Misspelled); with:
> > > 
> > > ```static std::pair
> > > getRealCheckType(Check::FileCheckType CheckType, StringRef Rest, bool 
> > > Misspelled) {
> > >   if (CheckType != Check::CheckNone && Misspelled)
> > > return {Check::CheckMisspelled, Rest};
> > >   return {CheckType, Rest};
> > > }```
> > > 
> > > Fair enough for CheckMisspelled, there is indeeed precedent.
> > That unfortunately wouldn't eliminate the repetitive `return 
> > getRealCheckType(..., Misspelled)` bits, thus adding a significant amount 
> > of clutter -- all for the sake of a single assignment where we raise the 
> > flag, while also making the code more fragile as the compiler wouldn't then 
> > be able to catch `return`s without calling `getRealCheckType()`. And if 
> > that's not enough, then the name of the function sounds like we introduce 
> > one of the most irritating kinds of concepts -- the 'real' ones. :-)
> Fair enough. LGTM for the FileCheck part then. Have you sent a message to 
> discourse to ask test authors for help on the TODO?
https://discourse.llvm.org/t/help-wanted-with-fixing-misspelled-filecheck-directives/62593

Thanks for the idea!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125604

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


[PATCH] D125874: [clang-tidy] Fix readability-simplify-boolean-expr when Ifs have an init statement or condition variable

2022-05-18 Thread Nathan James via Phabricator via cfe-commits
njames93 created this revision.
njames93 added reviewers: aaron.ballman, alexfh, LegalizeAdulthood.
Herald added subscribers: carlosgalvezp, xazax.hun.
Herald added a project: All.
njames93 requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

Fixes https://github.com/llvm/llvm-project/issues/3.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125874

Files:
  clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
  
clang-tools-extra/test/clang-tidy/checkers/readability-simplify-bool-expr-cxx17.cpp
  clang-tools-extra/test/clang-tidy/checkers/readability-simplify-bool-expr.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/readability-simplify-bool-expr.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/readability-simplify-bool-expr.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/readability-simplify-bool-expr.cpp
@@ -478,6 +478,13 @@
   // CHECK-FIXES-NEXT: {{^}}  };{{$}}
 }
 
+bool condition_variable_return_stmt(int i) {
+  if (bool Res = i == 0)
+return true;
+  else
+return false;
+}
+
 void simple_conditional_assignment_statements(int i) {
   bool b;
   if (i > 10)
@@ -594,6 +601,13 @@
 h = true;
   } else
 h = false;
+
+  // Unchanged: condition variable.
+  bool k;
+  if (bool Res = j > 10)
+k = true;
+  else
+k = false;
 }
 
 // Unchanged: chained return statements, but ChainedConditionalReturn not set.
Index: clang-tools-extra/test/clang-tidy/checkers/readability-simplify-bool-expr-cxx17.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/readability-simplify-bool-expr-cxx17.cpp
@@ -0,0 +1,19 @@
+// RUN: clang-tidy %s -checks='-*,readability-simplify-boolean-expr' -- -std=c++17 | count 0
+struct RAII {};
+bool foo(bool Cond) {
+  bool Result;
+
+  if (RAII Object; Cond)
+Result = true;
+  else
+Result = false;
+
+  if (bool X = Cond; X)
+Result = true;
+  else
+Result = false;
+
+  if (bool X = Cond; X)
+return true;
+  return false;
+}
Index: clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
===
--- clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
+++ clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
@@ -386,6 +386,9 @@
   }
 
   bool VisitIfStmt(IfStmt *If) {
+// Skip any if's that have a condition var or an init statement.
+if (If->hasInitStorage() || If->hasVarStorage())
+  return true;
 /*
  * if (true) ThenStmt(); -> ThenStmt();
  * if (false) ThenStmt(); -> ;
@@ -496,14 +499,17 @@
  * if (Cond) return false; return true; -> return !Cond;
  */
 auto *If = cast(*First);
-ExprAndBool ThenReturnBool =
-checkSingleStatement(If->getThen(), parseReturnLiteralBool);
-if (ThenReturnBool && ThenReturnBool.Bool != TrailingReturnBool.Bool) {
-  if (Check->ChainedConditionalReturn ||
-  (!PrevIf && If->getElse() == nullptr)) {
-Check->replaceCompoundReturnWithCondition(
-Context, cast(*Second), TrailingReturnBool.Bool,
-If);
+if (!If->hasInitStorage() && !If->hasVarStorage()) {
+  ExprAndBool ThenReturnBool =
+  checkSingleStatement(If->getThen(), parseReturnLiteralBool);
+  if (ThenReturnBool &&
+  ThenReturnBool.Bool != TrailingReturnBool.Bool) {
+if (Check->ChainedConditionalReturn ||
+(!PrevIf && If->getElse() == nullptr)) {
+  Check->replaceCompoundReturnWithCondition(
+  Context, cast(*Second), TrailingReturnBool.Bool,
+  If);
+}
   }
 }
   } else if (isa(*First)) {
@@ -516,7 +522,8 @@
 : isa(*First) ? cast(*First)->getSubStmt()
 : cast(*First)->getSubStmt();
 auto *SubIf = dyn_cast(SubStmt);
-if (SubIf && !SubIf->getElse()) {
+if (SubIf && !SubIf->getElse() && !SubIf->hasInitStorage() &&
+!SubIf->hasVarStorage()) {
   ExprAndBool ThenReturnBool =
   checkSingleStatement(SubIf->getThen(), parseReturnLiteralBool);
   if (ThenReturnBool &&
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D125875: [RISCV] Add vread_csr and vwrite_csr to riscv_vector.h

2022-05-18 Thread Wang Pengcheng via Phabricator via cfe-commits
pcwang-thead created this revision.
pcwang-thead added reviewers: asb, luismarques, kito-cheng, craig.topper.
Herald added subscribers: sunshaoce, VincentWu, luke957, StephenFan, vkmr, 
frasercrmck, evandro, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, 
jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, 
zzheng, jrtc27, shiva0217, niosHD, sabuasal, simoncook, johnrusso, rbar, 
arichardson.
Herald added a project: All.
pcwang-thead requested review of this revision.
Herald added subscribers: cfe-commits, eopXD, MaskRay.
Herald added a project: clang.

These two functions are described in RVV intrinsics doc
to read/write RVV CSRs. This matches what GCC does.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125875

Files:
  clang/include/clang/Basic/riscv_vector.td
  clang/test/CodeGen/RISCV/rvv-vread-csr.c
  clang/test/CodeGen/RISCV/rvv-vwrite-csr.c

Index: clang/test/CodeGen/RISCV/rvv-vwrite-csr.c
===
--- /dev/null
+++ clang/test/CodeGen/RISCV/rvv-vwrite-csr.c
@@ -0,0 +1,41 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
+// RUN: %clang_cc1 -triple riscv64 -target-feature +v -disable-O0-optnone -emit-llvm %s -o - \
+// RUN: | opt -S -O2 | FileCheck  %s
+
+#include 
+
+// CHECK-LABEL: @vwrite_csr_vstart(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:tail call void asm sideeffect "csrw\09vstart, ${0:z}", "rJ,~{memory}"(i64 [[VALUE:%.*]]) #[[ATTR1:[0-9]+]], !srcloc !4
+// CHECK-NEXT:ret void
+//
+void vwrite_csr_vstart(unsigned long value) {
+  vwrite_csr(RVV_VSTART, value);
+}
+
+// CHECK-LABEL: @vwrite_csr_vxsat(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:tail call void asm sideeffect "csrw\09vxsat, ${0:z}", "rJ,~{memory}"(i64 [[VALUE:%.*]]) #[[ATTR1]], !srcloc !5
+// CHECK-NEXT:ret void
+//
+void vwrite_csr_vxsat(unsigned long value) {
+  vwrite_csr(RVV_VXSAT, value);
+}
+
+// CHECK-LABEL: @vwrite_csr_vxrm(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:tail call void asm sideeffect "csrw\09vxrm, ${0:z}", "rJ,~{memory}"(i64 [[VALUE:%.*]]) #[[ATTR1]], !srcloc !6
+// CHECK-NEXT:ret void
+//
+void vwrite_csr_vxrm(unsigned long value) {
+  vwrite_csr(RVV_VXRM, value);
+}
+
+// CHECK-LABEL: @vwrite_csr_vcsr(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:tail call void asm sideeffect "csrw\09vcsr, ${0:z}", "rJ,~{memory}"(i64 [[VALUE:%.*]]) #[[ATTR1]], !srcloc !7
+// CHECK-NEXT:ret void
+//
+void vwrite_csr_vcsr(unsigned long value) {
+  vwrite_csr(RVV_VCSR, value);
+}
Index: clang/test/CodeGen/RISCV/rvv-vread-csr.c
===
--- /dev/null
+++ clang/test/CodeGen/RISCV/rvv-vread-csr.c
@@ -0,0 +1,41 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
+// RUN: %clang_cc1 -triple riscv64 -target-feature +v -disable-O0-optnone -emit-llvm %s -o - \
+// RUN: | opt -S -O2 | FileCheck  %s
+
+#include 
+
+// CHECK-LABEL: @vread_csr_vstart(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = tail call i64 asm sideeffect "csrr\09$0, vstart", "=r,~{memory}"() #[[ATTR1:[0-9]+]], !srcloc !4
+// CHECK-NEXT:ret i64 [[TMP0]]
+//
+unsigned long vread_csr_vstart(void) {
+  return vread_csr(RVV_VSTART);
+}
+
+// CHECK-LABEL: @vread_csr_vxsat(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = tail call i64 asm sideeffect "csrr\09$0, vxsat", "=r,~{memory}"() #[[ATTR1]], !srcloc !5
+// CHECK-NEXT:ret i64 [[TMP0]]
+//
+unsigned long vread_csr_vxsat(void) {
+  return vread_csr(RVV_VXSAT);
+}
+
+// CHECK-LABEL: @vread_csr_vxrm(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = tail call i64 asm sideeffect "csrr\09$0, vxrm", "=r,~{memory}"() #[[ATTR1]], !srcloc !6
+// CHECK-NEXT:ret i64 [[TMP0]]
+//
+unsigned long vread_csr_vxrm(void) {
+  return vread_csr(RVV_VXRM);
+}
+
+// CHECK-LABEL: @vread_csr_vcsr(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = tail call i64 asm sideeffect "csrr\09$0, vcsr", "=r,~{memory}"() #[[ATTR1]], !srcloc !7
+// CHECK-NEXT:ret i64 [[TMP0]]
+//
+unsigned long vread_csr_vcsr(void) {
+  return vread_csr(RVV_VCSR);
+}
Index: clang/include/clang/Basic/riscv_vector.td
===
--- clang/include/clang/Basic/riscv_vector.td
+++ clang/include/clang/Basic/riscv_vector.td
@@ -1497,6 +1497,58 @@
   }
 }
 
+// Define vread_csr&vwrite_csr described in RVV intrinsics doc.
+let HeaderCode =
+[{
+enum RVV_CSR {
+  RVV_VSTART = 0,
+  RVV_VXSAT,
+  RVV_VXRM,
+  RVV_VCSR,
+};
+
+__extension__ extern __inline
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+unsigned long vread_csr(enum RVV_CSR csr) {
+  unsigned long rv = 0;
+  switch (csr) {
+case RVV_VSTART:
+  __asm__ __volatile__ ("csrr\t%0, vstart" : "=r"(rv) : : "memory");
+  break;
+case RVV_VXSAT:
+  __asm__ __volatile__ ("csrr\t%0, vxsat" : "=r"(rv) : : "memory");
+  break;
+   

[PATCH] D125604: [FileCheck] Catch missspelled directives.

2022-05-18 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev updated this revision to Diff 430322.
kosarev added a comment.
Herald added a reviewer: bollu.

Add Polly fixes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125604

Files:
  clang/test/CodeGen/cmse-clear-return.c
  clang/test/CodeGenCXX/attr-mustprogress.cpp
  clang/test/CodeGenCXX/eh-aggregate-copy-destroy.cpp
  clang/test/CodeGenCXX/inheriting-constructor.cpp
  clang/test/CodeGenObjC/non-runtime-protocol.m
  clang/test/OpenMP/master_taskloop_private_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_private_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_private_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_private_codegen.cpp
  clang/test/OpenMP/task_private_codegen.cpp
  clang/test/OpenMP/taskgroup_task_reduction_codegen.cpp
  clang/test/OpenMP/taskloop_private_codegen.cpp
  clang/test/OpenMP/taskloop_simd_private_codegen.cpp
  llvm/include/llvm/FileCheck/FileCheck.h
  llvm/lib/FileCheck/FileCheck.cpp
  llvm/test/Analysis/MemorySSA/phi-translation.ll
  llvm/test/Analysis/RegionInfo/infinite_loop_4.ll
  llvm/test/CodeGen/AArch64/fp16-v8-instructions.ll
  llvm/test/CodeGen/AArch64/neon-vmull-high-p64.ll
  llvm/test/CodeGen/AMDGPU/divergence-driven-bfe-isel.ll
  llvm/test/CodeGen/AMDGPU/hoist-cond.ll
  llvm/test/CodeGen/AMDGPU/llvm.amdgcn.ps.live.ll
  llvm/test/CodeGen/AMDGPU/mode-register.mir
  llvm/test/CodeGen/AMDGPU/phi-vgpr-input-moveimm.mir
  llvm/test/CodeGen/AMDGPU/smrd.ll
  llvm/test/CodeGen/ARM/cmpxchg-O0-be.ll
  llvm/test/CodeGen/AVR/atomics/fence.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-middle-chain.ll
  llvm/test/CodeGen/MIR/AMDGPU/extra-imm-operand.mir
  llvm/test/CodeGen/MIR/AMDGPU/extra-reg-operand.mir
  llvm/test/CodeGen/Thumb2/thumb2-execute-only-prologue.ll
  llvm/test/CodeGen/WebAssembly/libcalls.ll
  llvm/test/CodeGen/X86/GlobalISel/select-ext.mir
  llvm/test/CodeGen/X86/coalesce-dead-lanes.mir
  llvm/test/CodeGen/X86/copy-propagation.ll
  llvm/test/CodeGen/X86/lvi-hardening-indirectbr.ll
  llvm/test/CodeGen/X86/statepoint-vreg-details.ll
  llvm/test/DebugInfo/NVPTX/debug-info.ll
  llvm/test/DebugInfo/X86/debug-info-template-parameter.ll
  llvm/test/FileCheck/missspelled-directive.txt
  llvm/test/MC/AMDGPU/data.s
  llvm/test/MC/AsmParser/directive_file-g.s
  llvm/test/MC/PowerPC/ppc64-reloc-directive-pcrel.s
  llvm/test/MC/WebAssembly/unnamed-data.ll
  llvm/test/Transforms/Inline/inline-strictfp.ll
  llvm/test/Transforms/LoopVectorize/X86/gather-vs-interleave.ll
  llvm/test/Transforms/MergeFunc/alias.ll
  llvm/test/Transforms/PGOProfile/PR41279.ll
  llvm/test/Transforms/PGOProfile/memop_clone.ll
  llvm/test/Transforms/PGOProfile/memop_size_from_strlen.ll
  llvm/test/tools/llvm-dwp/X86/tu_units_v5.s
  llvm/test/tools/llvm-dwp/X86/type_dedup_v5.test
  llvm/test/tools/llvm-objdump/MachO/disassemble-all.test
  llvm/test/tools/llvm-readobj/COFF/unwind-arm64-windows.test
  mlir/test/Conversion/MemRefToSPIRV/alloc.mlir
  mlir/test/Dialect/Affine/loop-coalescing.mlir
  mlir/test/Dialect/Linalg/fuse-with-reshape-by-collapsing.mlir
  mlir/test/Dialect/Linalg/tile-and-fuse-no-fuse.mlir
  mlir/test/Dialect/MemRef/canonicalize.mlir
  mlir/test/Dialect/SPIRV/IR/memory-ops.mlir
  mlir/test/Dialect/Vector/vector-transfer-full-partial-split.mlir
  mlir/test/IR/dynamic.mlir
  mlir/test/mlir-tblgen/op-decl-and-defs.td
  polly/test/ScopDetect/dot-scops-npm.ll

Index: polly/test/ScopDetect/dot-scops-npm.ll
===
--- polly/test/ScopDetect/dot-scops-npm.ll
+++ polly/test/ScopDetect/dot-scops-npm.ll
@@ -30,35 +30,35 @@
 ; CHECK-NEXT: Node0x[[OUTER_EXIT]] -> Node0x[[RETURN_ID:.*]];
 ; CHECK-NEXT: Node0x[[RETURN_ID]] [shape=record,label="{return:
 ; CHECK-NEXT: colorscheme = "paired12"
-; CHECK_NEXT: subgraph cluster_0x[[:.*]] {
-; CHECK_NEXT: label = "";
-; CHECK_NEXT: style = solid;
-; CHECK_NEXT: color = 1
-; CHECK_NEXT: subgraph cluster_0x[[:.*]] {
-; CHECK_NEXT: label = "";
-; CHECK_NEXT: style = filled;
-; CHECK_NEXT: color = 3subgraph cluster_0x7152c40 {
-; CHECK_NEXT: label = "";
-; CHECK_NEXT: style = solid;
-; CHECK_NEXT: color = 5
-; CHECK_NEXT: subgraph cluster_0x[[:.*]] {
-; CHECK_NEXT: label = "";
-; CHECK_NEXT: style = solid;
-; CHECK_NEXT: color = 7
-; CHECK_NEXT: Node0x[[INNER_FOR_ID]];
-; CHECK_NEXT: Node0x[[BABY1_ID]];
-; CHECK_NEXT: Node0x[[INNER_INC_ID]];
-; CHECK_NEXT: }
-; CHECK_NEXT: Node0x[[OUTER_FOR_ID]];
-; CHECK_NEXT: Node0x[[INNER_EXIT_ID]];
-; CHECK_NEXT: Node0x[[OUTER_INC_ID]];
-; CHECK_NEXT: }
-; CHECK_NEXT: Node0x[[OUTER_EXIT]];
-; CHECK_NEXT: }
-; CHECK_NEXT: Node0x[[EntryID]];
-; CHECK_NEXT: Node0x[[RETURN_ID]];
-; CHECK_NEXT: }
-; CHECK_NEXT: }
+; CHECK-NEXT: subgraph cluster_0x{{.*}} {
+; CHECK-NEXT: label = "";
+; CHECK-NEXT: style = solid;
+; CHECK-NEXT: color = 1
+; CHECK-NEXT: subgraph cluster_0x{{.*}} {
+; CHECK-NEXT: label = "";
+; CHECK-NEXT: style = filled;
+; CHECK-

[PATCH] D125094: [ARM][Thumb] Command-line option to ensure AAPCS compliant Frame Records

2022-05-18 Thread Lucas Prates via Phabricator via cfe-commits
pratlucas updated this revision to Diff 430324.
pratlucas marked an inline comment as done.
pratlucas added a comment.

Fix incorrect use of r11 on load/store instructions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125094

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/Arch/ARM.cpp
  llvm/lib/Target/ARM/ARM.td
  llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp
  llvm/lib/Target/ARM/ARMCallingConv.td
  llvm/lib/Target/ARM/ARMFrameLowering.cpp
  llvm/lib/Target/ARM/ARMMachineFunctionInfo.h
  llvm/lib/Target/ARM/ARMSubtarget.h
  llvm/lib/Target/ARM/Thumb1FrameLowering.cpp
  llvm/lib/Target/ARM/ThumbRegisterInfo.cpp
  llvm/test/CodeGen/ARM/frame-chain-reserved-fp.ll
  llvm/test/CodeGen/ARM/frame-chain.ll
  llvm/test/CodeGen/Thumb/frame-access.ll
  llvm/test/CodeGen/Thumb/frame-chain-reserved-fp.ll
  llvm/test/CodeGen/Thumb/frame-chain.ll

Index: llvm/test/CodeGen/Thumb/frame-chain.ll
===
--- /dev/null
+++ llvm/test/CodeGen/Thumb/frame-chain.ll
@@ -0,0 +1,305 @@
+; RUN: llc -mtriple thumb-arm-none-eabi -filetype asm -o - %s -frame-pointer=all | FileCheck %s --check-prefixes=FP,LEAF-FP
+; RUN: llc -mtriple thumb-arm-none-eabi -filetype asm -o - %s -frame-pointer=all -mattr=+aapcs-frame-chain | FileCheck %s --check-prefixes=FP-AAPCS,LEAF-FP
+; RUN: llc -mtriple thumb-arm-none-eabi -filetype asm -o - %s -frame-pointer=all -mattr=+aapcs-frame-chain-leaf | FileCheck %s --check-prefixes=FP-AAPCS,LEAF-FP-AAPCS
+; RUN: llc -mtriple thumb-arm-none-eabi -filetype asm -o - %s -frame-pointer=non-leaf | FileCheck %s --check-prefixes=FP,LEAF-NOFP
+; RUN: llc -mtriple thumb-arm-none-eabi -filetype asm -o - %s -frame-pointer=non-leaf -mattr=+aapcs-frame-chain | FileCheck %s --check-prefixes=FP-AAPCS,LEAF-NOFP
+; RUN: llc -mtriple thumb-arm-none-eabi -filetype asm -o - %s -frame-pointer=non-leaf -mattr=+aapcs-frame-chain-leaf | FileCheck %s --check-prefixes=FP-AAPCS,LEAF-NOFP-AAPCS
+; RUN: llc -mtriple thumb-arm-none-eabi -filetype asm -o - %s -frame-pointer=none | FileCheck %s --check-prefixes=NOFP,LEAF-NOFP
+; RUN: llc -mtriple thumb-arm-none-eabi -filetype asm -o - %s -frame-pointer=none -mattr=+aapcs-frame-chain | FileCheck %s --check-prefixes=NOFP-AAPCS,LEAF-NOFP
+; RUN: llc -mtriple thumb-arm-none-eabi -filetype asm -o - %s -frame-pointer=none -mattr=+aapcs-frame-chain-leaf | FileCheck %s --check-prefixes=NOFP-AAPCS,LEAF-NOFP-AAPCS
+
+define dso_local noundef i32 @leaf(i32 noundef %0) {
+; LEAF-FP-LABEL: leaf:
+; LEAF-FP:   @ %bb.0:
+; LEAF-FP-NEXT:.pad #4
+; LEAF-FP-NEXT:sub sp, #4
+; LEAF-FP-NEXT:str r0, [sp]
+; LEAF-FP-NEXT:adds r0, r0, #4
+; LEAF-FP-NEXT:add sp, #4
+; LEAF-FP-NEXT:bx lr
+;
+; LEAF-FP-AAPCS-LABEL: leaf:
+; LEAF-FP-AAPCS:   @ %bb.0:
+; LEAF-FP-AAPCS-NEXT:.save {lr}
+; LEAF-FP-AAPCS-NEXT:push {lr}
+; LEAF-FP-AAPCS-NEXT:mov lr, r11
+; LEAF-FP-AAPCS-NEXT:.save {r11}
+; LEAF-FP-AAPCS-NEXT:push {lr}
+; LEAF-FP-AAPCS-NEXT:.setfp r11, sp
+; LEAF-FP-AAPCS-NEXT:add r11, sp, #0
+; LEAF-FP-AAPCS-NEXT:.pad #4
+; LEAF-FP-AAPCS-NEXT:sub sp, #4
+; LEAF-FP-AAPCS-NEXT:str r0, [sp]
+; LEAF-FP-AAPCS-NEXT:adds r0, r0, #4
+; LEAF-FP-AAPCS-NEXT:add sp, #4
+; LEAF-FP-AAPCS-NEXT:pop {lr}
+; LEAF-FP-AAPCS-NEXT:mov r11, lr
+; LEAF-FP-AAPCS-NEXT:pop {r1}
+; LEAF-FP-AAPCS-NEXT:bx r1
+;
+; LEAF-NOFP-LABEL: leaf:
+; LEAF-NOFP:   @ %bb.0:
+; LEAF-NOFP-NEXT:.pad #4
+; LEAF-NOFP-NEXT:sub sp, #4
+; LEAF-NOFP-NEXT:str r0, [sp]
+; LEAF-NOFP-NEXT:adds r0, r0, #4
+; LEAF-NOFP-NEXT:add sp, #4
+; LEAF-NOFP-NEXT:bx lr
+;
+; LEAF-NOFP-AAPCS-LABEL: leaf:
+; LEAF-NOFP-AAPCS:   @ %bb.0:
+; LEAF-NOFP-AAPCS-NEXT:.save {lr}
+; LEAF-NOFP-AAPCS-NEXT:push {lr}
+; LEAF-NOFP-AAPCS-NEXT:mov lr, r11
+; LEAF-NOFP-AAPCS-NEXT:.save {r11}
+; LEAF-NOFP-AAPCS-NEXT:push {lr}
+; LEAF-NOFP-AAPCS-NEXT:.setfp r11, sp
+; LEAF-NOFP-AAPCS-NEXT:add r11, sp, #0
+; LEAF-NOFP-AAPCS-NEXT:.pad #4
+; LEAF-NOFP-AAPCS-NEXT:sub sp, #4
+; LEAF-NOFP-AAPCS-NEXT:str r0, [sp]
+; LEAF-NOFP-AAPCS-NEXT:adds r0, r0, #4
+; LEAF-NOFP-AAPCS-NEXT:add sp, #4
+; LEAF-NOFP-AAPCS-NEXT:pop {lr}
+; LEAF-NOFP-AAPCS-NEXT:mov r11, lr
+; LEAF-NOFP-AAPCS-NEXT:pop {r1}
+; LEAF-NOFP-AAPCS-NEXT:bx r1
+  %2 = alloca i32, align 4
+  store i32 %0, i32* %2, align 4
+  %3 = load i32, i32* %2, align 4
+  %4 = add nsw i32 %3, 4
+  ret i32 %4
+}
+
+define dso_local noundef i32 @non_leaf(i32 noundef %0) {
+; FP-LABEL: non_leaf:
+; FP:   @ %bb.0:
+; FP-NEXT:.save {r7, lr}
+; FP-NEXT:push {r7, lr}
+; FP-NEXT:.setfp r7, sp
+; FP-NEXT:add r7, sp, #0
+; FP-NEXT:.pad #8
+; FP-NEXT:sub sp, #8
+; FP-NEXT:str r0, [sp, #4]
+; FP-NEXT:bl leaf
+; FP-NEXT:adds r0, r0, #1
+; FP-NEXT:add sp, #8
+; FP-NEXT:pop {r7}
+; 

[PATCH] D125814: Fix strict prototype diagnostic wording for definitions

2022-05-18 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman updated this revision to Diff 430325.
aaron.ballman added a comment.

Went with a more simple implementation approach and the diagnostic results seem 
to be a mild improvement in terms of wording and behavior.


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

https://reviews.llvm.org/D125814

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDecl.cpp
  clang/test/CodeGen/2009-06-01-addrofknr.c
  clang/test/Parser/declarators.c
  clang/test/Sema/arg-duplicate.c
  clang/test/Sema/knr-def-call.c
  clang/test/Sema/knr-variadic-def.c
  clang/test/Sema/warn-deprecated-non-prototype.c
  clang/test/Sema/warn-strict-prototypes.c

Index: clang/test/Sema/warn-strict-prototypes.c
===
--- clang/test/Sema/warn-strict-prototypes.c
+++ clang/test/Sema/warn-strict-prototypes.c
@@ -48,7 +48,7 @@
 }
 
 // K&R function definition not preceded by full prototype
-int foo9(a, b) // expected-warning {{a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x}}
+int foo9(a, b) // expected-warning {{a function definition without a prototype is deprecated in all versions of C and is not supported in C2x}}
   int a, b;
 {
   return a + b;
@@ -56,17 +56,17 @@
 
 // Function declaration with no types
 void foo10(); // expected-warning {{a function declaration without a prototype is deprecated in all versions of C}} \
- expected-note {{a function declaration without a prototype is not supported in C2x}}
+ expected-warning {{a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x}}
   // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:12-[[@LINE-2]]:12}:"void"
 // K&R function definition with incomplete param list declared
-void foo10(p, p2) void *p; {} // expected-warning {{a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x}} \
+void foo10(p, p2) void *p; {} // expected-warning {{a function definition without a prototype is deprecated in all versions of C and is not supported in C2x}} \
  expected-warning {{parameter 'p2' was not declared, defaults to 'int'; ISO C99 and later do not support implicit int}}
 
 void foo11(int p, int p2);
-void foo11(p, p2) int p; int p2; {} // expected-warning {{a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x}}
+void foo11(p, p2) int p; int p2; {} // expected-warning {{a function definition without a prototype is deprecated in all versions of C and is not supported in C2x}}
 
 // PR31020
-void __attribute__((cdecl)) foo12(d) // expected-warning {{a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x}}
+void __attribute__((cdecl)) foo12(d) // expected-warning {{a function definition without a prototype is deprecated in all versions of C and is not supported in C2x}}
   short d;
 {}
 
Index: clang/test/Sema/warn-deprecated-non-prototype.c
===
--- clang/test/Sema/warn-deprecated-non-prototype.c
+++ clang/test/Sema/warn-deprecated-non-prototype.c
@@ -23,15 +23,14 @@
 void again() {} // strict-warning {{a function declaration without a prototype is deprecated in all versions of C}}
 
 // On by default warnings
-void func(); // expected-warning {{a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x}} \
-strict-warning {{a function declaration without a prototype is deprecated in all versions of C}} \
-strict-note {{a function declaration without a prototype is not supported in C2x}}
-void func(a, b) int a, b; {} // both-warning {{a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x}}
+void func(); // both-warning {{a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x}} \
+strict-warning {{a function declaration without a prototype is deprecated in all versions of C}}
+void func(a, b) int a, b; {} // both-warning {{a function definition without a prototype is deprecated in all versions of C and is not supported in C2x}}
 
-void one_more(a, b) int a, b; {} // both-warning {{a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x}}
+void one_more(a, b) int a, b; {} // both-warning {{a function definition without a prototype is deprecated in all versions of C and is not supported in C2x}}
 
 void sheesh(int a);
-void sheesh(a) int a; {} // both-warning {{a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x}}
+void sheesh(a) in

[PATCH] D125604: [FileCheck] Catch missspelled directives.

2022-05-18 Thread Simon Pilgrim via Phabricator via cfe-commits
RKSimon added a comment.

Thanks @kosarev - CodeGen\X86 should be clean now!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125604

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


[PATCH] D125604: [FileCheck] Catch missspelled directives.

2022-05-18 Thread Simon Pilgrim via Phabricator via cfe-commits
RKSimon added inline comments.



Comment at: llvm/test/DebugInfo/X86/debug-info-template-parameter.ll:36
 ; CHECK-NEXT: DW_AT_name {{.*}} "i"
-; CHECK_NEXT: DW_AT_default_value {{.*}} true
+; TODO-NEXT: DW_AT_default_value {{.*}} true
 

Should be fixed by rGf718664866ab


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125604

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


[PATCH] D125259: [C11] Diagnose unreachable generic selection associations

2022-05-18 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D125259#3520544 , @tahonermann 
wrote:

>> I'm questioning the benefit to supporting _Generic in C++ and starting to 
>> wonder if perhaps we should pull this extension back.
>
> I imagine it may be used in shared system headers. E.g., implementations of 
> `tgmath.h` that don't use the builtins.

That's a good thought! I'm not seeing much evidence of that, at least from my 
code searches: 
https://sourcegraph.com/search?q=context:global+file:tgmath%5C.h+_Generic+AND+%28%23ifdef+__cplusplus+OR+%23if+defined%5C%28__cplusplus%5C%29%29&patternType=literal&case=yes

You can definitely find cases of `#ifndef __cplusplus` in the same code search 
though (which I've seen protecting uses of `_Generic` in the file). Also, our 
own tgmath.h implementation is not using `_Generic` (we use 
`__attribute__((overloadable))` instead).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125259

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


[PATCH] D125604: [FileCheck] Catch missspelled directives.

2022-05-18 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev added subscribers: chill, momchil.velikov, az, alex-t, 
keith.walker.arm, plotfi, aivchenk, zer0, awanpand, levivic, zlei.
kosarev added a comment.

Tagging more people in hope to add visibility.




Comment at: clang/test/CodeGen/cmse-clear-return.c:235
 // CHECK-BE-NOPT-NEXT: [[AND:%.+]] = and i32 [[R]], -1
-// CHECK_NEXT: ret i32 [[AND]]
+// TODO-NEXT: ret i32 [[AND]]
 

@momchil.velikov @chill 



Comment at: llvm/test/CodeGen/AArch64/fp16-v8-instructions.ll:682-688
+; TODO-CVT-DAG:   fcvtl   [[LO:v[0-9]+\.4s]], v0.4h
+; TODO-CVT-DAG:   fcvtl2  [[HI:v[0-9]+\.4s]], v0.8h
+; TODO-CVT-DAG:   fcvtzs  [[LOF32:v[0-9]+\.4s]], [[LO]]
+; TODO-CVT-DAG:   xtn [[I16:v[0-9]+]].4h, [[LOF32]]
+; TODO-CVT-DAG:   fcvtzs  [[HIF32:v[0-9]+\.4s]], [[HI]]
+; TODO-CVT-DAG:   xtn2[[I16]].8h, [[HIF32]]
+; TODO-NEXT:  ret

@az 



Comment at: llvm/test/CodeGen/AMDGPU/phi-vgpr-input-moveimm.mir:3-5
+# GCN-LABEL: phi_moveimm_input
 # GCN-NOT: %{{[0-9]+}}:vgpr_32 = PHI %{{[0-9]+}}, %bb.3, %{{[0-9]+}}, %bb.1
+# TODO: %{{[0-9]+}}:sreg_32 = PHI %{{[0-9]+}}, %bb.3, %{{[0-9]+}}, %bb.1

@alex-t 



Comment at: llvm/test/CodeGen/Thumb2/thumb2-execute-only-prologue.ll:13
 ; CHECK: .LCPI0_0:
-; CHECK_NEXT:long   4294963196
+; TODO-NEXT: long   4294963196
+

@keith.walker.arm 



Comment at: llvm/test/CodeGen/WebAssembly/libcalls.ll:52-53
   ; Basic ops should be expanded
-  ; CHECK_NOT: call
+  ; CHECK: .local
+  ; CHECK-NOT: call
   %a = add i128 %x, %y

@dschuff 



Comment at: llvm/test/CodeGen/X86/GlobalISel/select-ext.mir:69-72
+# ALL-NEXT: %1:gr8 = COPY %0.sub_8bit
+# ALL-NEXT: %2:gr8 = AND8ri %1, 1, implicit-def $eflags
+# ALL-NEXT: $al = COPY %2
+# ALL-NEXT: RET 0, implicit $al

@aivchenk @plotfi @zer0 



Comment at: llvm/test/DebugInfo/X86/debug-info-template-parameter.ll:33-36
+; TODO-NEXT: DW_AT_default_value {{.*}} true
 ; CHECK: DW_AT_type {{.*}} "int"
 ; CHECK-NEXT: DW_AT_name {{.*}} "i"
+; TODO-NEXT: DW_AT_default_value {{.*}} true

@awanpand 



Comment at: mlir/test/Conversion/MemRefToSPIRV/alloc.mlir:44
 //  CHECK-SAME:   !spv.ptr)>, Workgroup>
-// CHECK_LABEL: spv.func @alloc_dealloc_workgroup_mem
+//  TODO-LABEL: spv.func @alloc_dealloc_workgroup_mem
 //   CHECK:   %[[VAR:.+]] = spv.mlir.addressof @__workgroup_mem__0

@antiagainst @levivic @zlei 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125604

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


[PATCH] D125749: [analyzer][NFC] Introduce SVal::isa

2022-05-18 Thread Balázs Benics via Phabricator via cfe-commits
steakhal updated this revision to Diff 430326.
steakhal marked an inline comment as done.
steakhal edited the summary of this revision.
steakhal added a comment.

- Prefer `V.isUndef()` to `V.isa()`.
- Remove tautologically true assertions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125749

Files:
  clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
  clang/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp
  clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
  clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/GTestChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/Iterator.cpp
  clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
  clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/ObjCAtSyncChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/STLAlgorithmModeling.cpp
  clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
  
clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp
  clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp
  clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
  clang/lib/StaticAnalyzer/Core/CallEvent.cpp
  clang/lib/StaticAnalyzer/Core/CheckerContext.cpp
  clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
  clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp
  clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
  clang/lib/StaticAnalyzer/Core/ProgramState.cpp
  clang/lib/StaticAnalyzer/Core/RegionStore.cpp
  clang/lib/StaticAnalyzer/Core/SValBuilder.cpp
  clang/lib/StaticAnalyzer/Core/SVals.cpp
  clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
  clang/lib/StaticAnalyzer/Core/Store.cpp

Index: clang/lib/StaticAnalyzer/Core/Store.cpp
===
--- clang/lib/StaticAnalyzer/Core/Store.cpp
+++ clang/lib/StaticAnalyzer/Core/Store.cpp
@@ -459,10 +459,10 @@
   // FIXME: For absolute pointer addresses, we just return that value back as
   //  well, although in reality we should return the offset added to that
   //  value. See also the similar FIXME in getLValueFieldOrIvar().
-  if (Base.isUnknownOrUndef() || Base.getAs())
+  if (Base.isUnknownOrUndef() || Base.isa())
 return Base;
 
-  if (Base.getAs())
+  if (Base.isa())
 return UnknownVal();
 
   const SubRegion *BaseRegion =
@@ -488,7 +488,7 @@
 
   SVal BaseIdx = ElemR->getIndex();
 
-  if (!BaseIdx.getAs())
+  if (!BaseIdx.isa())
 return UnknownVal();
 
   const llvm::APSInt &BaseIdxI =
@@ -497,7 +497,7 @@
   // Only allow non-integer offsets if the base region has no offset itself.
   // FIXME: This is a somewhat arbitrary restriction. We should be using
   // SValBuilder here to add the two offsets without checking their types.
-  if (!Offset.getAs()) {
+  if (!Offset.isa()) {
 if (isa(BaseRegion->StripCasts()))
   return UnknownVal();
 
Index: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
===
--- clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
+++ clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
@@ -865,7 +865,7 @@
   if (Optional Result = ResultVal.getAs())
 return evalCast(*Result, resultTy, QualType{});
 
-  assert(!ResultVal.getAs() && "Loc-Loc ops should not produce Locs");
+  assert(!ResultVal.isa() && "Loc-Loc ops should not produce Locs");
   return UnknownVal();
 }
 
@@ -873,7 +873,7 @@
 // This must come after the test if the RHS is a symbol, which is used to
 // build constraints. The address of any non-symbolic region is guaranteed
 // to be non-NULL, as is any label.
-assert(rhs.getAs() || rhs.getAs());
+assert((rhs.isa()));
 if (lhs.isZeroConstant()) {
   switch (op) {
   default:
Index: clang/lib/StaticAnalyzer/Core/SVals.cpp
===
--- clang/lib/StaticAnalyzer/Core/SVals.cpp
+++ clang/lib/StaticAnalyzer/Core/SVals.cpp
@@ -46,7 +46,7 @@
 bool SVal::hasConjuredSymbol() const {
   if (Optional SV = getAs()) {
 SymbolRef sym = SV->getSymbol();
-if (isa(sym))
+if (llvm::isa(sym))
   return true;
   }
 
@@ -54,7 +54,7 @@
 const MemRegion *R = RV->getRegion();
   

[PATCH] D125403: [Serialization] Delta-encode consecutive SourceLocations in TypeLoc

2022-05-18 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision.
ilya-biryukov added a comment.
This revision is now accepted and ready to land.

NIT: typo in the change description

> Randam-access

Rand**o**m

LGTM overall, the improvements in PCH and PCM sizes seem worthwhile. Please see 
the NIT about the naming before landing, maybe there are better opions.




Comment at: clang/include/clang/Serialization/SourceLocationEncoding.h:144
+  // enclosing sequence instead of establishing a new one.
+  Root(SourceLocationSequence *Parent = nullptr)
+  : Seq(Parent ? Parent->State : State) {}

NIT: Naming feels a bit confusing here.
`Root` that may have `Parent` seems a bit weird to me conceptually.

One idea that I have in mind is `Sequence::State` that allows to continue an 
existing sequence or establish a new one. Note that we will need to do 
something about the clashing private member.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125403

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


[PATCH] D125775: [ARM] Don't Enable AES Pass for Generic Cores

2022-05-18 Thread John Brawn via Phabricator via cfe-commits
john.brawn accepted this revision.
john.brawn added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125775

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


[PATCH] D125709: [analyzer][Casting] Support isa, cast, dyn_cast of SVals

2022-05-18 Thread Balázs Benics via Phabricator via cfe-commits
steakhal updated this revision to Diff 430327.
steakhal added a comment.

- Added uses for `dyn_cast` and `cast` of the new specialization.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125709

Files:
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
  clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp


Index: clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
+++ clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
@@ -446,7 +446,7 @@
 
   // FIXME: We really should allow ranges of valid theType values, and
   //   bifurcate the state appropriately.
-  Optional V = TheTypeVal.getAs();
+  Optional V = dyn_cast(TheTypeVal);
   if (!V)
 return;
 
@@ -907,7 +907,7 @@
 
   // Go ahead and assume the value is non-nil.
   SVal Val = State->getSVal(*ElementLoc);
-  return State->assume(Val.castAs(), true);
+  return State->assume(cast(Val), true);
 }
 
 /// Returns NULL state if the collection is known to contain elements
Index: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
===
--- clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
+++ clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
@@ -98,19 +98,12 @@
 
   /// Convert to the specified SVal type, asserting that this SVal is of
   /// the desired type.
-  template
-  T castAs() const {
-assert(T::classof(*this));
-return *static_cast(this);
-  }
+  template  T castAs() const { return llvm::cast(*this); }
 
   /// Convert to the specified SVal type, returning None if this SVal is
   /// not of the desired type.
-  template
-  Optional getAs() const {
-if (!T::classof(*this))
-  return None;
-return *static_cast(this);
+  template  Optional getAs() const {
+return llvm::dyn_cast(*this);
   }
 
   unsigned getRawKind() const { return Kind; }
@@ -571,4 +564,28 @@
 } // namespace ento
 } // namespace clang
 
+namespace llvm {
+template 
+struct CastInfo<
+To, From,
+std::enable_if_t::value>>
+: public CastIsPossible {
+  using Self = CastInfo<
+  To, From,
+  std::enable_if_t::value>>;
+  static bool isPossible(const From &V) {
+return To::classof(*static_cast(&V));
+  }
+  static Optional castFailed() { return Optional{}; }
+  static To doCast(const From &f) {
+return *static_cast(cast<::clang::ento::SVal>(&f));
+  }
+  static Optional doCastIfPossible(const From &f) {
+if (!Self::isPossible(f))
+  return Self::castFailed();
+return doCast(f);
+  }
+};
+} // namespace llvm
+
 #endif // LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SVALS_H


Index: clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
+++ clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
@@ -446,7 +446,7 @@
 
   // FIXME: We really should allow ranges of valid theType values, and
   //   bifurcate the state appropriately.
-  Optional V = TheTypeVal.getAs();
+  Optional V = dyn_cast(TheTypeVal);
   if (!V)
 return;
 
@@ -907,7 +907,7 @@
 
   // Go ahead and assume the value is non-nil.
   SVal Val = State->getSVal(*ElementLoc);
-  return State->assume(Val.castAs(), true);
+  return State->assume(cast(Val), true);
 }
 
 /// Returns NULL state if the collection is known to contain elements
Index: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
===
--- clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
+++ clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
@@ -98,19 +98,12 @@
 
   /// Convert to the specified SVal type, asserting that this SVal is of
   /// the desired type.
-  template
-  T castAs() const {
-assert(T::classof(*this));
-return *static_cast(this);
-  }
+  template  T castAs() const { return llvm::cast(*this); }
 
   /// Convert to the specified SVal type, returning None if this SVal is
   /// not of the desired type.
-  template
-  Optional getAs() const {
-if (!T::classof(*this))
-  return None;
-return *static_cast(this);
+  template  Optional getAs() const {
+return llvm::dyn_cast(*this);
   }
 
   unsigned getRawKind() const { return Kind; }
@@ -571,4 +564,28 @@
 } // namespace ento
 } // namespace clang
 
+namespace llvm {
+template 
+struct CastInfo<
+To, From,
+std::enable_if_t::value>>
+: public CastIsPossible {
+  using Self = CastInfo<
+  To, From,
+  std::enable_if_t::value>>;
+  static bool isPossible(const From &V) {
+return To::classof(*static_cast(&V));
+  }
+  static Optional castFailed() { return Optional{}; }
+  static To doCas

[PATCH] D125709: [analyzer][Casting] Support isa, cast, dyn_cast of SVals

2022-05-18 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment.

In D125709#3519850 , @xazax.hun wrote:

> While not having tests might be OK, but I'd prefer to introduce at least a 
> couple uses of the new facilities so existing tests cover them.

I've added a use of the new `dyn_cast` and `cast` free function specializations.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125709

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


[PATCH] D125871: [analyzer] Delete alpha.deadcode.UnreachableCode checker

2022-05-18 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added inline comments.



Comment at: clang/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp:53-54
-
-  if (Eng.hasWorkRemaining())
-return;
-

I thought this check guards this checker to be meaningful. @martong


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125871

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


[PATCH] D125871: [analyzer] Delete alpha.deadcode.UnreachableCode checker

2022-05-18 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment.

Could you please give a few examples of these FPs for the record?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125871

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


[clang] 21c29a8 - [OpenCL] Add cl_khr_subgroup_rotate builtins

2022-05-18 Thread Sven van Haastregt via cfe-commits

Author: Sven van Haastregt
Date: 2022-05-18T13:02:17+01:00
New Revision: 21c29a8ae053cb436141ee636333c4f816cc20c4

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

LOG: [OpenCL] Add cl_khr_subgroup_rotate builtins

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

Added: 


Modified: 
clang/lib/Headers/opencl-c-base.h
clang/lib/Headers/opencl-c.h
clang/lib/Sema/OpenCLBuiltins.td
clang/test/Headers/opencl-c-header.cl

Removed: 




diff  --git a/clang/lib/Headers/opencl-c-base.h 
b/clang/lib/Headers/opencl-c-base.h
index 4e87afad84bf..20048d97bc74 100644
--- a/clang/lib/Headers/opencl-c-base.h
+++ b/clang/lib/Headers/opencl-c-base.h
@@ -21,6 +21,7 @@
 #define cl_khr_subgroup_shuffle 1
 #define cl_khr_subgroup_shuffle_relative 1
 #define cl_khr_subgroup_clustered_reduce 1
+#define cl_khr_subgroup_rotate 1
 #define cl_khr_extended_bit_ops 1
 #define cl_khr_integer_dot_product 1
 #define __opencl_c_integer_dot_product_input_4x8bit 1

diff  --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h
index 8d9af5248195..69e2c85610ba 100644
--- a/clang/lib/Headers/opencl-c.h
+++ b/clang/lib/Headers/opencl-c.h
@@ -17275,6 +17275,40 @@ int __ovld __cnfn dot_acc_sat_4x8packed_us_int(uint, 
uint, int);
 int __ovld __cnfn dot_acc_sat_4x8packed_su_int(uint, uint, int);
 #endif // __opencl_c_integer_dot_product_input_4x8bit_packed
 
+#if defined(cl_khr_subgroup_rotate)
+char __ovld __conv sub_group_rotate(char, int);
+uchar __ovld __conv sub_group_rotate(uchar, int);
+short __ovld __conv sub_group_rotate(short, int);
+ushort __ovld __conv sub_group_rotate(ushort, int);
+int __ovld __conv sub_group_rotate(int, int);
+uint __ovld __conv sub_group_rotate(uint, int);
+long __ovld __conv sub_group_rotate(long, int);
+ulong __ovld __conv sub_group_rotate(ulong, int);
+float __ovld __conv sub_group_rotate(float, int);
+#if defined(cl_khr_fp64)
+double __ovld __conv sub_group_rotate(double, int);
+#endif // cl_khr_fp64
+#if defined(cl_khr_fp16)
+half __ovld __conv sub_group_rotate(half, int);
+#endif // cl_khr_fp16
+
+char __ovld __conv sub_group_clustered_rotate(char, int, uint);
+uchar __ovld __conv sub_group_clustered_rotate(uchar, int, uint);
+short __ovld __conv sub_group_clustered_rotate(short, int, uint);
+ushort __ovld __conv sub_group_clustered_rotate(ushort, int, uint);
+int __ovld __conv sub_group_clustered_rotate(int, int, uint);
+uint __ovld __conv sub_group_clustered_rotate(uint, int, uint);
+long __ovld __conv sub_group_clustered_rotate(long, int, uint);
+ulong __ovld __conv sub_group_clustered_rotate(ulong, int, uint);
+float __ovld __conv sub_group_clustered_rotate(float, int, uint);
+#if defined(cl_khr_fp64)
+double __ovld __conv sub_group_clustered_rotate(double, int, uint);
+#endif // cl_khr_fp64
+#if defined(cl_khr_fp16)
+half __ovld __conv sub_group_clustered_rotate(half, int, uint);
+#endif // cl_khr_fp16
+#endif // cl_khr_subgroup_rotate
+
 #if defined(cl_intel_subgroups)
 // Intel-Specific Sub Group Functions
 float   __ovld __conv intel_sub_group_shuffle( float , uint );

diff  --git a/clang/lib/Sema/OpenCLBuiltins.td 
b/clang/lib/Sema/OpenCLBuiltins.td
index 220daf05acf9..75cea2ffc19c 100644
--- a/clang/lib/Sema/OpenCLBuiltins.td
+++ b/clang/lib/Sema/OpenCLBuiltins.td
@@ -1845,6 +1845,12 @@ let Extension = 
FunctionExtension<"__opencl_c_integer_dot_product_input_4x8bit_p
   def : Builtin<"dot_acc_sat_4x8packed_su_int", [Int, UInt, UInt, Int], 
Attr.Const>;
 }
 
+// Section 48.3 - cl_khr_subgroup_rotate
+let Extension = FunctionExtension<"cl_khr_subgroup_rotate"> in {
+  def : Builtin<"sub_group_rotate", [AGenType1, AGenType1, Int], 
Attr.Convergent>;
+  def : Builtin<"sub_group_clustered_rotate", [AGenType1, AGenType1, Int, 
UInt], Attr.Convergent>;
+}
+
 //
 // Arm extensions.
 let Extension = ArmIntegerDotProductInt8 in {

diff  --git a/clang/test/Headers/opencl-c-header.cl 
b/clang/test/Headers/opencl-c-header.cl
index be185ff8dcf1..455842412fd0 100644
--- a/clang/test/Headers/opencl-c-header.cl
+++ b/clang/test/Headers/opencl-c-header.cl
@@ -127,6 +127,9 @@ global atomic_int z = ATOMIC_VAR_INIT(99);
 #if cl_khr_subgroup_clustered_reduce != 1
 #error "Incorrectly defined cl_khr_subgroup_clustered_reduce"
 #endif
+#if cl_khr_subgroup_rotate != 1
+#error "Incorrectly defined cl_khr_subgroup_rotate"
+#endif
 #if cl_khr_extended_bit_ops != 1
 #error "Incorrectly defined cl_khr_extended_bit_ops"
 #endif
@@ -208,6 +211,9 @@ global atomic_int z = ATOMIC_VAR_INIT(99);
 #ifdef cl_khr_subgroup_clustered_reduce
 #error "Incorrect cl_khr_subgroup_clustered_reduce define"
 #endif
+#ifdef cl_khr_subgroup_rotate
+#error "Incorrect cl_khr_subgroup_rotate define"
+#endif
 #ifdef cl_khr_extende

[PATCH] D124256: [OpenCL] Add cl_khr_subgroup_rotate builtins

2022-05-18 Thread Sven van Haastregt via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG21c29a8ae053: [OpenCL] Add cl_khr_subgroup_rotate builtins 
(authored by svenvh).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124256

Files:
  clang/lib/Headers/opencl-c-base.h
  clang/lib/Headers/opencl-c.h
  clang/lib/Sema/OpenCLBuiltins.td
  clang/test/Headers/opencl-c-header.cl


Index: clang/test/Headers/opencl-c-header.cl
===
--- clang/test/Headers/opencl-c-header.cl
+++ clang/test/Headers/opencl-c-header.cl
@@ -127,6 +127,9 @@
 #if cl_khr_subgroup_clustered_reduce != 1
 #error "Incorrectly defined cl_khr_subgroup_clustered_reduce"
 #endif
+#if cl_khr_subgroup_rotate != 1
+#error "Incorrectly defined cl_khr_subgroup_rotate"
+#endif
 #if cl_khr_extended_bit_ops != 1
 #error "Incorrectly defined cl_khr_extended_bit_ops"
 #endif
@@ -208,6 +211,9 @@
 #ifdef cl_khr_subgroup_clustered_reduce
 #error "Incorrect cl_khr_subgroup_clustered_reduce define"
 #endif
+#ifdef cl_khr_subgroup_rotate
+#error "Incorrect cl_khr_subgroup_rotate define"
+#endif
 #ifdef cl_khr_extended_bit_ops
 #error "Incorrect cl_khr_extended_bit_ops define"
 #endif
Index: clang/lib/Sema/OpenCLBuiltins.td
===
--- clang/lib/Sema/OpenCLBuiltins.td
+++ clang/lib/Sema/OpenCLBuiltins.td
@@ -1845,6 +1845,12 @@
   def : Builtin<"dot_acc_sat_4x8packed_su_int", [Int, UInt, UInt, Int], 
Attr.Const>;
 }
 
+// Section 48.3 - cl_khr_subgroup_rotate
+let Extension = FunctionExtension<"cl_khr_subgroup_rotate"> in {
+  def : Builtin<"sub_group_rotate", [AGenType1, AGenType1, Int], 
Attr.Convergent>;
+  def : Builtin<"sub_group_clustered_rotate", [AGenType1, AGenType1, Int, 
UInt], Attr.Convergent>;
+}
+
 //
 // Arm extensions.
 let Extension = ArmIntegerDotProductInt8 in {
Index: clang/lib/Headers/opencl-c.h
===
--- clang/lib/Headers/opencl-c.h
+++ clang/lib/Headers/opencl-c.h
@@ -17275,6 +17275,40 @@
 int __ovld __cnfn dot_acc_sat_4x8packed_su_int(uint, uint, int);
 #endif // __opencl_c_integer_dot_product_input_4x8bit_packed
 
+#if defined(cl_khr_subgroup_rotate)
+char __ovld __conv sub_group_rotate(char, int);
+uchar __ovld __conv sub_group_rotate(uchar, int);
+short __ovld __conv sub_group_rotate(short, int);
+ushort __ovld __conv sub_group_rotate(ushort, int);
+int __ovld __conv sub_group_rotate(int, int);
+uint __ovld __conv sub_group_rotate(uint, int);
+long __ovld __conv sub_group_rotate(long, int);
+ulong __ovld __conv sub_group_rotate(ulong, int);
+float __ovld __conv sub_group_rotate(float, int);
+#if defined(cl_khr_fp64)
+double __ovld __conv sub_group_rotate(double, int);
+#endif // cl_khr_fp64
+#if defined(cl_khr_fp16)
+half __ovld __conv sub_group_rotate(half, int);
+#endif // cl_khr_fp16
+
+char __ovld __conv sub_group_clustered_rotate(char, int, uint);
+uchar __ovld __conv sub_group_clustered_rotate(uchar, int, uint);
+short __ovld __conv sub_group_clustered_rotate(short, int, uint);
+ushort __ovld __conv sub_group_clustered_rotate(ushort, int, uint);
+int __ovld __conv sub_group_clustered_rotate(int, int, uint);
+uint __ovld __conv sub_group_clustered_rotate(uint, int, uint);
+long __ovld __conv sub_group_clustered_rotate(long, int, uint);
+ulong __ovld __conv sub_group_clustered_rotate(ulong, int, uint);
+float __ovld __conv sub_group_clustered_rotate(float, int, uint);
+#if defined(cl_khr_fp64)
+double __ovld __conv sub_group_clustered_rotate(double, int, uint);
+#endif // cl_khr_fp64
+#if defined(cl_khr_fp16)
+half __ovld __conv sub_group_clustered_rotate(half, int, uint);
+#endif // cl_khr_fp16
+#endif // cl_khr_subgroup_rotate
+
 #if defined(cl_intel_subgroups)
 // Intel-Specific Sub Group Functions
 float   __ovld __conv intel_sub_group_shuffle( float , uint );
Index: clang/lib/Headers/opencl-c-base.h
===
--- clang/lib/Headers/opencl-c-base.h
+++ clang/lib/Headers/opencl-c-base.h
@@ -21,6 +21,7 @@
 #define cl_khr_subgroup_shuffle 1
 #define cl_khr_subgroup_shuffle_relative 1
 #define cl_khr_subgroup_clustered_reduce 1
+#define cl_khr_subgroup_rotate 1
 #define cl_khr_extended_bit_ops 1
 #define cl_khr_integer_dot_product 1
 #define __opencl_c_integer_dot_product_input_4x8bit 1


Index: clang/test/Headers/opencl-c-header.cl
===
--- clang/test/Headers/opencl-c-header.cl
+++ clang/test/Headers/opencl-c-header.cl
@@ -127,6 +127,9 @@
 #if cl_khr_subgroup_clustered_reduce != 1
 #error "Incorrectly defined cl_khr_subgroup_clustered_reduce"
 #endif
+#if cl_khr_subgroup_rotate != 1
+#error "Incorrectly defined cl_khr_subgroup_rotate"
+#endif
 #if cl_khr_extended_bit_ops != 1
 #er

[PATCH] D125877: [clang-tidy] Fix readability-simplify-boolean-expr crash with implicit cast in return.

2022-05-18 Thread Nathan James via Phabricator via cfe-commits
njames93 created this revision.
njames93 added reviewers: aaron.ballman, alexfh, LegalizeAdulthood.
Herald added subscribers: carlosgalvezp, xazax.hun.
Herald added a project: All.
njames93 requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

Fixes https://github.com/llvm/llvm-project/issues/7


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125877

Files:
  clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
  clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.h
  clang-tools-extra/unittests/clang-tidy/ReadabilityModuleTest.cpp

Index: clang-tools-extra/unittests/clang-tidy/ReadabilityModuleTest.cpp
===
--- clang-tools-extra/unittests/clang-tidy/ReadabilityModuleTest.cpp
+++ clang-tools-extra/unittests/clang-tidy/ReadabilityModuleTest.cpp
@@ -2,6 +2,7 @@
 #include "ClangTidyTest.h"
 #include "readability/BracesAroundStatementsCheck.h"
 #include "readability/NamespaceCommentCheck.h"
+#include "readability/SimplifyBooleanExprCheck.h"
 #include "gtest/gtest.h"
 
 namespace clang {
@@ -10,6 +11,7 @@
 
 using readability::BracesAroundStatementsCheck;
 using readability::NamespaceCommentCheck;
+using readability::SimplifyBooleanExprCheck;
 using namespace ast_matchers;
 
 // Copied from ASTMatchersTests
@@ -533,6 +535,16 @@
 runCheckOnCode(Input));
 }
 
+TEST(SimplifyBooleanExprCheckTest, CodeWithError) {
+  // Fixes PR7
+  // Need to downgrade Wreturn-type from error as runCheckOnCode will fatal_exit
+  // if any errors occur.
+  EXPECT_EQ("void foo(bool b){ return b; }",
+runCheckOnCode(
+"void foo(bool b){ if (b) return true; return false; }",
+nullptr, "input.cc", {"-Wno-error=return-type"}));
+}
+
 } // namespace test
 } // namespace tidy
 } // namespace clang
Index: clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.h
===
--- clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.h
+++ clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.h
@@ -55,7 +55,8 @@
 
   void replaceCompoundReturnWithCondition(const ASTContext &Context,
   const ReturnStmt *Ret, bool Negated,
-  const IfStmt *If);
+  const IfStmt *If,
+  const Expr *ThenReturn);
 
   void issueDiag(const ASTContext &Result, SourceLocation Loc,
  StringRef Description, SourceRange ReplacementRange,
Index: clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
===
--- clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
+++ clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
@@ -236,41 +236,6 @@
   return asBool(getText(Context, *E), NeedsStaticCast);
 }
 
-static const Expr *stmtReturnsBool(const ReturnStmt *Ret, bool Negated) {
-  if (const auto *Bool = dyn_cast(Ret->getRetValue())) {
-if (Bool->getValue() == !Negated)
-  return Bool;
-  }
-  if (const auto *Unary = dyn_cast(Ret->getRetValue())) {
-if (Unary->getOpcode() == UO_LNot) {
-  if (const auto *Bool =
-  dyn_cast(Unary->getSubExpr())) {
-if (Bool->getValue() == Negated)
-  return Bool;
-  }
-}
-  }
-
-  return nullptr;
-}
-
-static const Expr *stmtReturnsBool(const IfStmt *IfRet, bool Negated) {
-  if (IfRet->getElse() != nullptr)
-return nullptr;
-
-  if (const auto *Ret = dyn_cast(IfRet->getThen()))
-return stmtReturnsBool(Ret, Negated);
-
-  if (const auto *Compound = dyn_cast(IfRet->getThen())) {
-if (Compound->size() == 1) {
-  if (const auto *CompoundRet = dyn_cast(Compound->body_back()))
-return stmtReturnsBool(CompoundRet, Negated);
-}
-  }
-
-  return nullptr;
-}
-
 static bool containsDiscardedTokens(const ASTContext &Context,
 CharSourceRange CharRange) {
   std::string ReplacementText =
@@ -502,8 +467,8 @@
   if (Check->ChainedConditionalReturn ||
   (!PrevIf && If->getElse() == nullptr)) {
 Check->replaceCompoundReturnWithCondition(
-Context, cast(*Second), TrailingReturnBool.Bool,
-If);
+Context, cast(*Second), TrailingReturnBool.Bool, If,
+ThenReturnBool.Item);
   }
 }
   } else if (isa(*First)) {
@@ -523,7 +488,7 @@
   ThenReturnBool.Bool != TrailingReturnBool.Bool) {
 Check->replaceCompoundReturnWithCondition(
 Context, cast(*Second), TrailingReturnBool.Bool,
-SubIf);
+SubIf, ThenReturnBool.Item);
   }
 }
   }
@@ -689,11 +654,11

[PATCH] D125863: [clangd] Dont mark terminating PP-directives as skipped

2022-05-18 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment.

sorry, I might be lack of the context, where is the user complaint? I'm not 
sure which cases are improved with this patch.

Ideally we would not mark PP directives as inactive regions, but we never do 
that (FIXME 
),
 I think we're trying to fix that?




Comment at: clang-tools-extra/clangd/CollectMacros.h:90
+// Don't mark the terminating PP-directive as skipped.
+End.character = 0;
 Out.SkippedRanges.push_back(Range{Begin, End});

This looks like a  semantic-highlight-specific change, instead of doing it 
here, would it make more sense to do it in the `SemanticHighlighting.cpp`?



Comment at: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp:447
 $InactiveCode[[#if defined(test)]]
-$InactiveCode[[#endif]]
+#endif
 )cpp",

It seems to me that the new behavior of these cases is worse --  `#ifedf` will 
not be highlighted while the paired `#endif` will,  this inconsistency probably 
gives weird and confusing UI experience to users. 

I think it is important to have a consistent decision -- highlight both or 
not-highlight both.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125863

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


[clang] 2321c36 - [ARM] Don't Enable AES Pass for Generic Cores

2022-05-18 Thread Archibald Elliott via cfe-commits

Author: Archibald Elliott
Date: 2022-05-18T13:10:31+01:00
New Revision: 2321c36fbf763e273ed78b4209168ce783b5cf96

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

LOG: [ARM] Don't Enable AES Pass for Generic Cores

This brings clang/llvm into line with GCC. The Pass is still enabled for
the affected cores, but is now opt-in when using `-march=`.

I also took the opportunity to add release notes for this change.

Reviewed By: john.brawn

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

Added: 


Modified: 
clang/docs/ReleaseNotes.rst
llvm/docs/ReleaseNotes.rst
llvm/lib/Target/ARM/ARM.td

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 20920942c207..4fb4c662d71b 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -265,6 +265,11 @@ New Compiler Flags
   the parameter list were ``void``. There is no ``-fknr-functions`` or
   ``-fno-no-knr-functions`` flag; this feature cannot be disabled in language
   modes where it is required, such as C++ or C2x.
+- A new ARM pass to workaround Cortex-A57 Erratum 1742098 and Cortex-A72 
Erratum
+  1655431 can be enabled using ``-mfix-cortex-a57-aes-1742098`` or
+  ``-mfix-cortex-a72-aes-1655431``. The pass is enabled when using either of
+  these cpus with ``-mcpu=`` and can be disabled using
+  ``-mno-fix-cortex-a57-aes-1742098`` or ``-mno-fix-cortex-a72-aes-1655431``.
 
 Deprecated Compiler Flags
 -

diff  --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index 54f2029aa25d..8529bb76e13e 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -99,6 +99,8 @@ Changes to the ARM Backend
   warnings will be generated and -mrestrict-it is now always off by default.
   Previously it was on by default for Armv8 and off for all other architecture
   versions.
+* Added a pass to workaround Cortex-A57 Erratum 1742098 and Cortex-A72
+  Erratum 1655431. This is enabled by default when targeting either CPU.
 
 Changes to the AVR Backend
 --

diff  --git a/llvm/lib/Target/ARM/ARM.td b/llvm/lib/Target/ARM/ARM.td
index de5dea1b2b2e..e8970b916a5f 100644
--- a/llvm/lib/Target/ARM/ARM.td
+++ b/llvm/lib/Target/ARM/ARM.td
@@ -1161,7 +1161,7 @@ include "ARMScheduleM7.td"
 // ARM processors
 //
 // Dummy CPU, used to target architectures
-def : ProcessorModel<"generic", CortexA8Model,  
[FeatureFixCortexA57AES1742098]>;
+def : ProcessorModel<"generic", CortexA8Model,  []>;
 
 // FIXME: Several processors below are not using their own scheduler
 // model, but one of similar/previous processor. These should be fixed.



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


[PATCH] D125775: [ARM] Don't Enable AES Pass for Generic Cores

2022-05-18 Thread Sam Elliott 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 rG2321c36fbf76: [ARM] Don't Enable AES Pass for Generic 
Cores (authored by lenary).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125775

Files:
  clang/docs/ReleaseNotes.rst
  llvm/docs/ReleaseNotes.rst
  llvm/lib/Target/ARM/ARM.td


Index: llvm/lib/Target/ARM/ARM.td
===
--- llvm/lib/Target/ARM/ARM.td
+++ llvm/lib/Target/ARM/ARM.td
@@ -1161,7 +1161,7 @@
 // ARM processors
 //
 // Dummy CPU, used to target architectures
-def : ProcessorModel<"generic", CortexA8Model,  
[FeatureFixCortexA57AES1742098]>;
+def : ProcessorModel<"generic", CortexA8Model,  []>;
 
 // FIXME: Several processors below are not using their own scheduler
 // model, but one of similar/previous processor. These should be fixed.
Index: llvm/docs/ReleaseNotes.rst
===
--- llvm/docs/ReleaseNotes.rst
+++ llvm/docs/ReleaseNotes.rst
@@ -99,6 +99,8 @@
   warnings will be generated and -mrestrict-it is now always off by default.
   Previously it was on by default for Armv8 and off for all other architecture
   versions.
+* Added a pass to workaround Cortex-A57 Erratum 1742098 and Cortex-A72
+  Erratum 1655431. This is enabled by default when targeting either CPU.
 
 Changes to the AVR Backend
 --
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -265,6 +265,11 @@
   the parameter list were ``void``. There is no ``-fknr-functions`` or
   ``-fno-no-knr-functions`` flag; this feature cannot be disabled in language
   modes where it is required, such as C++ or C2x.
+- A new ARM pass to workaround Cortex-A57 Erratum 1742098 and Cortex-A72 
Erratum
+  1655431 can be enabled using ``-mfix-cortex-a57-aes-1742098`` or
+  ``-mfix-cortex-a72-aes-1655431``. The pass is enabled when using either of
+  these cpus with ``-mcpu=`` and can be disabled using
+  ``-mno-fix-cortex-a57-aes-1742098`` or ``-mno-fix-cortex-a72-aes-1655431``.
 
 Deprecated Compiler Flags
 -


Index: llvm/lib/Target/ARM/ARM.td
===
--- llvm/lib/Target/ARM/ARM.td
+++ llvm/lib/Target/ARM/ARM.td
@@ -1161,7 +1161,7 @@
 // ARM processors
 //
 // Dummy CPU, used to target architectures
-def : ProcessorModel<"generic", CortexA8Model,  [FeatureFixCortexA57AES1742098]>;
+def : ProcessorModel<"generic", CortexA8Model,  []>;
 
 // FIXME: Several processors below are not using their own scheduler
 // model, but one of similar/previous processor. These should be fixed.
Index: llvm/docs/ReleaseNotes.rst
===
--- llvm/docs/ReleaseNotes.rst
+++ llvm/docs/ReleaseNotes.rst
@@ -99,6 +99,8 @@
   warnings will be generated and -mrestrict-it is now always off by default.
   Previously it was on by default for Armv8 and off for all other architecture
   versions.
+* Added a pass to workaround Cortex-A57 Erratum 1742098 and Cortex-A72
+  Erratum 1655431. This is enabled by default when targeting either CPU.
 
 Changes to the AVR Backend
 --
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -265,6 +265,11 @@
   the parameter list were ``void``. There is no ``-fknr-functions`` or
   ``-fno-no-knr-functions`` flag; this feature cannot be disabled in language
   modes where it is required, such as C++ or C2x.
+- A new ARM pass to workaround Cortex-A57 Erratum 1742098 and Cortex-A72 Erratum
+  1655431 can be enabled using ``-mfix-cortex-a57-aes-1742098`` or
+  ``-mfix-cortex-a72-aes-1655431``. The pass is enabled when using either of
+  these cpus with ``-mcpu=`` and can be disabled using
+  ``-mno-fix-cortex-a57-aes-1742098`` or ``-mno-fix-cortex-a72-aes-1655431``.
 
 Deprecated Compiler Flags
 -
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D125868: [Driver] Recognize -std=gnu++20 enables C++ modules

2022-05-18 Thread Sam McCall via Phabricator via cfe-commits
sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

LG, but can you change the patch description as you're bringing the set up to 
date rather than just adding gnu++20


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125868

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


[PATCH] D107082: [X86][RFC] Enable `_Float16` type support on X86 following the psABI

2022-05-18 Thread Phoebe Wang via Phabricator via cfe-commits
pengfei updated this revision to Diff 430349.
pengfei added a comment.

Replace __gnu_f2h_ieee/__gnu_h2f_ieee with __truncsfhf2/__extendhfsf2 to match 
with GCC.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107082

Files:
  llvm/docs/ReleaseNotes.rst
  llvm/lib/Target/X86/X86FastISel.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/lib/Target/X86/X86InstrAVX512.td
  llvm/lib/Target/X86/X86InstrCompiler.td
  llvm/lib/Target/X86/X86InstrInfo.cpp
  llvm/lib/Target/X86/X86InstrSSE.td
  llvm/lib/Target/X86/X86InstrVecCompiler.td
  llvm/lib/Target/X86/X86InstructionSelector.cpp
  llvm/lib/Target/X86/X86RegisterInfo.td
  llvm/test/Analysis/CostModel/X86/fptoi_sat.ll
  llvm/test/CodeGen/MIR/X86/inline-asm-registers.mir
  llvm/test/CodeGen/X86/atomic-non-integer.ll
  llvm/test/CodeGen/X86/avx512-insert-extract.ll
  llvm/test/CodeGen/X86/avx512-masked_memop-16-8.ll
  llvm/test/CodeGen/X86/callbr-asm-bb-exports.ll
  llvm/test/CodeGen/X86/cvt16-2.ll
  llvm/test/CodeGen/X86/cvt16.ll
  llvm/test/CodeGen/X86/fastmath-float-half-conversion.ll
  llvm/test/CodeGen/X86/fmf-flags.ll
  llvm/test/CodeGen/X86/fp-round.ll
  llvm/test/CodeGen/X86/fp-roundeven.ll
  llvm/test/CodeGen/X86/fp128-cast-strict.ll
  llvm/test/CodeGen/X86/fpclamptosat.ll
  llvm/test/CodeGen/X86/fpclamptosat_vec.ll
  llvm/test/CodeGen/X86/fptosi-sat-scalar.ll
  llvm/test/CodeGen/X86/fptosi-sat-vector-128.ll
  llvm/test/CodeGen/X86/fptoui-sat-scalar.ll
  llvm/test/CodeGen/X86/fptoui-sat-vector-128.ll
  llvm/test/CodeGen/X86/freeze.ll
  llvm/test/CodeGen/X86/half-constrained.ll
  llvm/test/CodeGen/X86/half.ll
  llvm/test/CodeGen/X86/pr31088.ll
  llvm/test/CodeGen/X86/pr38533.ll
  llvm/test/CodeGen/X86/pr47000.ll
  llvm/test/CodeGen/X86/scheduler-asm-moves.mir
  llvm/test/CodeGen/X86/shuffle-extract-subvector.ll
  llvm/test/CodeGen/X86/stack-folding-fp-avx512fp16-fma.ll
  llvm/test/CodeGen/X86/stack-folding-fp-avx512fp16.ll
  llvm/test/CodeGen/X86/statepoint-invoke-ra-enter-at-end.mir
  llvm/test/CodeGen/X86/vec_fp_to_int.ll
  llvm/test/CodeGen/X86/vector-half-conversions.ll
  llvm/test/CodeGen/X86/vector-reduce-fmax-nnan.ll
  llvm/test/CodeGen/X86/vector-reduce-fmin-nnan.ll
  llvm/test/MC/X86/x86_64-asm-match.s

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


[PATCH] D125667: [pseudo] A basic implementation of compiling cxx grammar at build time.

2022-05-18 Thread Sam McCall via Phabricator via cfe-commits
sammccall added inline comments.



Comment at: clang-tools-extra/pseudo/CMakeLists.txt:1
+set(CLANG_PSEUDO_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
+

I think these variables shared across CMakeLists.txt files generally add more 
confusion than value, it doesn't seem to be needed here - can we use relative 
paths instead?



Comment at: clang-tools-extra/pseudo/gen/cxx_gen.cmake:1
+# The cxx.bnf grammar file
+set(cxx_bnf ${CMAKE_CURRENT_SOURCE_DIR}/../lib/cxx.bnf)

why is this a textually included *.cmake file that adds rules, instead of a 
CMakeLists.txt file or a *.cmake file that provides functions?



Comment at: clang-tools-extra/pseudo/include/CMakeLists.txt:1
+# We put an empty cmake file here so that cmake can create an include directory
+# in the build directory, the include directory is the home for generated 
source

it seems to me the build rules for files that end up in the include/ directory 
should go here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125667

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


[PATCH] D125802: Fix std::has_unique_object_representations for _BitInt types with padding bits

2022-05-18 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang/lib/AST/ASTContext.cpp:2689
+  // A _BitInt type may not be unique if it has padding bits
+  // but if it is a bitfield the padding bits are not used
+  bool IsBitIntType =





Comment at: clang/lib/AST/ASTContext.cpp:2690-2691
+  // but if it is a bitfield the padding bits are not used
+  bool IsBitIntType =
+  !Field->getType()->isReferenceType() && Field->getType()->isBitIntType();
+  if (!Field->getType()->isReferenceType() && !IsBitIntType &&

A type can't be both a `_BitInt` and a reference at the same time, so I think 
you can drop the !reference type check here.



Comment at: clang/lib/AST/ASTContext.cpp:2809
+  if (Ty->isIntegralOrEnumerationType()) {
+// Except _BitInt types that have padding bits
+if (const auto *BIT = dyn_cast(Ty))




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125802

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


[PATCH] D124701: [clang] Honor __attribute__((no_builtin("foo"))) on functions

2022-05-18 Thread Hans Wennborg via Phabricator via cfe-commits
hans added a comment.

Just one more comment, then I'm happy :)




Comment at: clang/lib/CodeGen/CGExpr.cpp:5067
+// recursion. Honor __attribute__((no_builtin("foo"))) or
+// __attribute((no_builtin("*"))) on the current function unless foo is
+// not a predefined library function which means we must generate the

The comment needs updating too (for the wildcard thing).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124701

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


[PATCH] D116088: [compiler-rt] Implement ARM atomic operations for architectures without SMP support

2022-05-18 Thread Pavel Kosov via Phabricator via cfe-commits
kpdev42 added a comment.

In D116088#3393350 , @efriedma wrote:

> D120026  is merged now, which addresses the 
> issue of the compiler generating __sync calls where it isn't supposed to.
>
> Does anyone want to continue discussing what changes to compiler-rt would be 
> appropriate?  I didn't mean to completely shut down discussion with my 
> comment.

@efriedma

Imagine we have the following piece of code in the program:

  volatile int G;
  int foo() { return __sync_add_and_fetch(&G, 1); }

Now we want having this built and running on armv5 platform. At the moment the 
only option we have is to use libgcc. Unfortunately this have one big 
disadvantage: we're only limited to Linux, because call to __sync_add_and_fetch 
boils down to Linux kernel user helper. We want this to work on other platforms 
also, and here is what compiler-rt good for.

However sync ops operations in compiler-rt use memory barriers, which doesn't 
work on armv5: any attempt to use memory barrier on the latter will result in 
SIGILL. As armv5 doesn't support SMP (but still supports preemptive 
multitasking) it's possible in out opinion to implement sync ops as a compare 
and swap loop without memory barriers. What's your opinion on this?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116088

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


[PATCH] D125882: Correct the diagnostic behavior for unreachable _Generic associations in C++

2022-05-18 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman created this revision.
aaron.ballman added reviewers: erichkeane, tahonermann, aeubanks, 
clang-language-wg.
Herald added a project: All.
aaron.ballman requested review of this revision.
Herald added a project: clang.

New diagnostics were added for unreachable generic selection expression 
associations in ca75ac5f04f269def97e6844c2f5c9596b29c84c 
, but it 
did not account for a difference in behavior between C and C++ regarding lvalue 
to rvalue conversions. So we would issue diagnostics about a selection being 
unreachable and then reach it. This corrects the diagnostic behavior in that 
case.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125882

Files:
  clang/lib/Sema/SemaExpr.cpp
  clang/test/Sema/generic-selection.c
  clang/test/SemaCXX/generic-selection.cpp


Index: clang/test/SemaCXX/generic-selection.cpp
===
--- clang/test/SemaCXX/generic-selection.cpp
+++ clang/test/SemaCXX/generic-selection.cpp
@@ -44,3 +44,28 @@
 static_assert(TypeMask::result == 7, "fail");
 static_assert(TypeMask::result == 12, "fail");
 static_assert(TypeMask::result == 9, "fail");
+
+
+struct Test {
+  int i;
+};
+
+void unreachable_associations(const int i, const Test t) {
+  // FIXME: it's not clear to me whether we intended to deviate from the C
+  // semantics in terms of how qualifiers are handled, so this documents the
+  // existing behavior but perhaps not the desired behavior.
+  static_assert(
+_Generic(i,
+  const int : 1,// expected-warning {{due to lvalue conversion of the 
controlling expression, association of type 'const int' will never be selected 
because it is qualified}}
+  volatile int : 2, // expected-warning {{due to lvalue conversion of the 
controlling expression, association of type 'volatile int' will never be 
selected because it is qualified}}
+  int[12] : 3,  // expected-warning {{due to lvalue conversion of the 
controlling expression, association of type 'int[12]' will never be selected 
because it is of array type}}
+  int : 4,
+  default : 5
+) == 4, "we had better pick int, not const int!");
+  static_assert(
+_Generic(t,
+  Test : 1,
+  const Test : 2,  // Ok in C++, warned in C
+  default : 3
+) == 2, "we had better pick const Test, not Test!"); // C++-specific result
+}
Index: clang/test/Sema/generic-selection.c
===
--- clang/test/Sema/generic-selection.c
+++ clang/test/Sema/generic-selection.c
@@ -58,7 +58,11 @@
 ), int : 0);
 }
 
-void unreachable_associations(const int i) {
+struct Test {
+  int i;
+};
+
+void unreachable_associations(const int i, const struct Test t) {
   _Static_assert( // ext-warning {{'_Static_assert' is a C11 extension}}
 _Generic(i, // ext-warning {{'_Generic' is a C11 extension}}
   const int : 1,// expected-warning {{due to lvalue conversion of the 
controlling expression, association of type 'const int' will never be selected 
because it is qualified}}
@@ -67,4 +71,10 @@
   int : 4,
   default : 5
 ) == 4, "we had better pick int!");
+  _Static_assert( // ext-warning {{'_Static_assert' is a C11 extension}}
+_Generic(t, // ext-warning {{'_Generic' is a C11 extension}}
+  struct Test : 1,
+  const struct Test : 2, // expected-warning {{due to lvalue conversion of 
the controlling expression, association of type 'const struct Test' will never 
be selected because it is qualified}}
+  default : 3
+) == 1, "we had better pick struct Test, not const struct Test!"); // 
C-specific result
 }
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -1692,11 +1692,17 @@
   // reached. We will warn about this so users are less surprised by
   // the unreachable association. However, we don't have to handle
   // function types; that's not an object type, so it's handled above.
+  //
+  // The logic is somewhat different for C++ because C++ has different
+  // lvalue to rvalue conversion rules than C. [conv.lvalue]p1 says,
+  // If T is a non-class type, the type of the prvalue is the cv-
+  // unqualified version of T. Otherwise, the type of the prvalue is T.
   unsigned Reason = 0;
   QualType QT = Types[i]->getType();
   if (QT->isArrayType())
 Reason = 1;
-  else if (QT.hasQualifiers())
+  else if (QT.hasQualifiers() &&
+   (!LangOpts.CPlusPlus || !QT->isRecordType()))
 Reason = 2;
 
   if (Reason)


Index: clang/test/SemaCXX/generic-selection.cpp
===
--- clang/test/SemaCXX/generic-selection.cpp
+++ clang/test/Sem

[PATCH] D125259: [C11] Diagnose unreachable generic selection associations

2022-05-18 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D125259#3520118 , @aaron.ballman 
wrote:

> In D125259#3519947 , @aaron.ballman 
> wrote:
>
>> Oh wow, good catch! I'll correct this.
>
> Oof, the plot thickens... the diagnostic is correct for some types, but is 
> incorrect for others: https://godbolt.org/z/fahzx53W6. I also discovered a 
> parsing issue in C++ where we get confused by elaborated type specifiers: 
> https://godbolt.org/z/1ejxqd9ss.

https://reviews.llvm.org/D125882 addresses the diagnostic behavior for the 
unreachable warning.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125259

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


[clang-tools-extra] ca87553 - Reland(2) "[clangd] Indexing of standard library"

2022-05-18 Thread Sam McCall via cfe-commits

Author: Sam McCall
Date: 2022-05-18T15:30:37+02:00
New Revision: ca875539f788c8063e243ce9ceb877a0d2ad9115

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

LOG: Reland(2) "[clangd] Indexing of standard library"

This reverts commit 6aabf60f2fb7589430c0ecc8fe95913c973fa248.

Added: 
clang-tools-extra/clangd/index/StdLib.cpp
clang-tools-extra/clangd/index/StdLib.h
clang-tools-extra/clangd/unittests/StdLibTests.cpp

Modified: 
clang-tools-extra/clangd/CMakeLists.txt
clang-tools-extra/clangd/ClangdServer.cpp
clang-tools-extra/clangd/ClangdServer.h
clang-tools-extra/clangd/Config.h
clang-tools-extra/clangd/ConfigCompile.cpp
clang-tools-extra/clangd/ConfigFragment.h
clang-tools-extra/clangd/ConfigYAML.cpp
clang-tools-extra/clangd/TUScheduler.cpp
clang-tools-extra/clangd/TUScheduler.h
clang-tools-extra/clangd/index/FileIndex.cpp
clang-tools-extra/clangd/index/FileIndex.h
clang-tools-extra/clangd/index/SymbolOrigin.cpp
clang-tools-extra/clangd/index/SymbolOrigin.h
clang-tools-extra/clangd/unittests/CMakeLists.txt
clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/CMakeLists.txt 
b/clang-tools-extra/clangd/CMakeLists.txt
index 9c37cfe7b7001..7cfbd6f95750e 100644
--- a/clang-tools-extra/clangd/CMakeLists.txt
+++ b/clang-tools-extra/clangd/CMakeLists.txt
@@ -119,6 +119,7 @@ add_clang_library(clangDaemon
   index/Ref.cpp
   index/Relation.cpp
   index/Serialization.cpp
+  index/StdLib.cpp
   index/Symbol.cpp
   index/SymbolCollector.cpp
   index/SymbolID.cpp

diff  --git a/clang-tools-extra/clangd/ClangdServer.cpp 
b/clang-tools-extra/clangd/ClangdServer.cpp
index 80d7d5c5ece19..69a0f63972aae 100644
--- a/clang-tools-extra/clangd/ClangdServer.cpp
+++ b/clang-tools-extra/clangd/ClangdServer.cpp
@@ -26,6 +26,7 @@
 #include "index/CanonicalIncludes.h"
 #include "index/FileIndex.h"
 #include "index/Merge.h"
+#include "index/StdLib.h"
 #include "refactor/Rename.h"
 #include "refactor/Tweak.h"
 #include "support/Cancellation.h"
@@ -59,16 +60,39 @@ namespace {
 // Update the FileIndex with new ASTs and plumb the diagnostics responses.
 struct UpdateIndexCallbacks : public ParsingCallbacks {
   UpdateIndexCallbacks(FileIndex *FIndex,
-   ClangdServer::Callbacks *ServerCallbacks)
-  : FIndex(FIndex), ServerCallbacks(ServerCallbacks) {}
+   ClangdServer::Callbacks *ServerCallbacks,
+   const ThreadsafeFS &TFS, AsyncTaskRunner *Tasks)
+  : FIndex(FIndex), ServerCallbacks(ServerCallbacks), TFS(TFS),
+Tasks(Tasks) {}
 
-  void onPreambleAST(PathRef Path, llvm::StringRef Version, ASTContext &Ctx,
+  void onPreambleAST(PathRef Path, llvm::StringRef Version,
+ const CompilerInvocation &CI, ASTContext &Ctx,
  Preprocessor &PP,
  const CanonicalIncludes &CanonIncludes) override {
+// If this preamble uses a standard library we haven't seen yet, index it.
+if (FIndex)
+  if (auto Loc = Stdlib.add(*CI.getLangOpts(), PP.getHeaderSearchInfo()))
+indexStdlib(CI, std::move(*Loc));
+
 if (FIndex)
   FIndex->updatePreamble(Path, Version, Ctx, PP, CanonIncludes);
   }
 
+  void indexStdlib(const CompilerInvocation &CI, StdLibLocation Loc) {
+auto Task = [this, LO(*CI.getLangOpts()), Loc(std::move(Loc)),
+ CI(std::make_unique(CI))]() mutable {
+  IndexFileIn IF;
+  IF.Symbols = indexStandardLibrary(std::move(CI), Loc, TFS);
+  if (Stdlib.isBest(LO))
+FIndex->updatePreamble(std::move(IF));
+};
+if (Tasks)
+  // This doesn't have a semaphore to enforce -j, but it's rare.
+  Tasks->runAsync("IndexStdlib", std::move(Task));
+else
+  Task();
+  }
+
   void onMainAST(PathRef Path, ParsedAST &AST, PublishFn Publish) override {
 if (FIndex)
   FIndex->updateMain(Path, AST);
@@ -103,6 +127,9 @@ struct UpdateIndexCallbacks : public ParsingCallbacks {
 private:
   FileIndex *FIndex;
   ClangdServer::Callbacks *ServerCallbacks;
+  const ThreadsafeFS &TFS;
+  StdLibSet Stdlib;
+  AsyncTaskRunner *Tasks;
 };
 
 class DraftStoreFS : public ThreadsafeFS {
@@ -154,12 +181,15 @@ ClangdServer::ClangdServer(const 
GlobalCompilationDatabase &CDB,
   Transient(Opts.ImplicitCancellation ? TUScheduler::InvalidateOnUpdate
   : TUScheduler::NoInvalidation),
   DirtyFS(std::make_unique(TFS, DraftMgr)) {
+  if (Opts.AsyncThreadsCount != 0)
+IndexTasks.emplace();
   // Pass a callback into `WorkScheduler` to extract symbols from a newly
   // parsed file and rebuild the file index synchronously each time an AST
   // is parsed.
-  WorkSchedul

[PATCH] D125885: bugprone-argument-comment: Ignore calls to user-defined literals

2022-05-18 Thread Joachim Priesner via Phabricator via cfe-commits
jspam created this revision.
Herald added a subscriber: carlosgalvezp.
Herald added a project: All.
jspam requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

Without this change, code such as "f(/*param=*/1_op)" will check the
comment twice, once for the parameter of f (correct) and once for
the parameter of operator""_op (likely incorrect). The change removes
only the second check.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125885

Files:
  clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
  clang-tools-extra/test/clang-tidy/checkers/bugprone-argument-comment.cpp


Index: clang-tools-extra/test/clang-tidy/checkers/bugprone-argument-comment.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/bugprone-argument-comment.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/bugprone-argument-comment.cpp
@@ -5,6 +5,8 @@
 
 void (int , int );
 
+int operator""_op(unsigned long long val);
+
 void f(int x, int y);
 void g() {
   // CHECK-NOTES: [[@LINE+4]]:5: warning: argument name 'y' in comment does 
not match parameter name 'x'
@@ -14,7 +16,15 @@
   f(/*y=*/0, /*z=*/0);
   // CHECK-FIXES: {{^}}  f(/*y=*/0, /*z=*/0);
 
+  // CHECK-NOTES: [[@LINE+4]]:5: warning: argument name 'y' in comment does 
not match parameter name 'x'
+  // CHECK-NOTES: [[@LINE-10]]:12: note: 'x' declared here
+  // CHECK-NOTES: [[@LINE+2]]:14: warning: argument name 'z' in comment does 
not match parameter name 'y'
+  // CHECK-NOTES: [[@LINE-12]]:19: note: 'y' declared here
+  f(/*y=*/0_op, /*z=*/0_op);
+  // CHECK-FIXES: {{^}}  f(/*y=*/0_op, /*z=*/0_op);
+
   f(/*x=*/1, /*y=*/1);
+  f(/*x=*/1_op, /*y=*/1_op);
 
   (0 /*=*/, /**/ 0); // Unsupported formats.
 }
Index: clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
===
--- clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
+++ clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
@@ -60,7 +60,7 @@
 
 void ArgumentCommentCheck::registerMatchers(MatchFinder *Finder) {
   Finder->addMatcher(
-  callExpr(unless(cxxOperatorCallExpr()),
+  callExpr(unless(cxxOperatorCallExpr()), unless(userDefinedLiteral()),
// NewCallback's arguments relate to the pointed function,
// don't check them against NewCallback's parameter names.
// FIXME: Make this configurable.


Index: clang-tools-extra/test/clang-tidy/checkers/bugprone-argument-comment.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/bugprone-argument-comment.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/bugprone-argument-comment.cpp
@@ -5,6 +5,8 @@
 
 void (int , int );
 
+int operator""_op(unsigned long long val);
+
 void f(int x, int y);
 void g() {
   // CHECK-NOTES: [[@LINE+4]]:5: warning: argument name 'y' in comment does not match parameter name 'x'
@@ -14,7 +16,15 @@
   f(/*y=*/0, /*z=*/0);
   // CHECK-FIXES: {{^}}  f(/*y=*/0, /*z=*/0);
 
+  // CHECK-NOTES: [[@LINE+4]]:5: warning: argument name 'y' in comment does not match parameter name 'x'
+  // CHECK-NOTES: [[@LINE-10]]:12: note: 'x' declared here
+  // CHECK-NOTES: [[@LINE+2]]:14: warning: argument name 'z' in comment does not match parameter name 'y'
+  // CHECK-NOTES: [[@LINE-12]]:19: note: 'y' declared here
+  f(/*y=*/0_op, /*z=*/0_op);
+  // CHECK-FIXES: {{^}}  f(/*y=*/0_op, /*z=*/0_op);
+
   f(/*x=*/1, /*y=*/1);
+  f(/*x=*/1_op, /*y=*/1_op);
 
   (0 /*=*/, /**/ 0); // Unsupported formats.
 }
Index: clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
===
--- clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
+++ clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
@@ -60,7 +60,7 @@
 
 void ArgumentCommentCheck::registerMatchers(MatchFinder *Finder) {
   Finder->addMatcher(
-  callExpr(unless(cxxOperatorCallExpr()),
+  callExpr(unless(cxxOperatorCallExpr()), unless(userDefinedLiteral()),
// NewCallback's arguments relate to the pointed function,
// don't check them against NewCallback's parameter names.
// FIXME: Make this configurable.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D125886: [RISCV][NFC] Rename variable in RISCVVEmitter.cpp

2022-05-18 Thread Kito Cheng via Phabricator via cfe-commits
kito-cheng created this revision.
Herald added subscribers: sunshaoce, VincentWu, luke957, vkmr, frasercrmck, 
evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, 
jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, 
zzheng, jrtc27, shiva0217, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, 
arichardson.
Herald added a project: All.
kito-cheng requested review of this revision.
Herald added subscribers: cfe-commits, pcwang-thead, eopXD, MaskRay.
Herald added a project: clang.

- Use `Overloaded` rather than `Mangled`.
- Use `Prototype` or `Desc` rather than `Seq`, it's not just a string sequence.
  - `Prototype` for those PrototypeDescriptor will used to evaluate as argument 
type.
  - `Desc` for those PrototypeDescriptor will


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125886

Files:
  clang/utils/TableGen/RISCVVEmitter.cpp

Index: clang/utils/TableGen/RISCVVEmitter.cpp
===
--- clang/utils/TableGen/RISCVVEmitter.cpp
+++ clang/utils/TableGen/RISCVVEmitter.cpp
@@ -387,8 +387,8 @@
   for (auto *R : RV) {
 StringRef Name = R->getValueAsString("Name");
 StringRef SuffixProto = R->getValueAsString("Suffix");
-StringRef MangledName = R->getValueAsString("MangledName");
-StringRef MangledSuffixProto = R->getValueAsString("MangledSuffix");
+StringRef OverloadedName = R->getValueAsString("MangledName");
+StringRef OverloadedSuffixProto = R->getValueAsString("MangledSuffix");
 StringRef Prototypes = R->getValueAsString("Prototype");
 StringRef TypeRange = R->getValueAsString("TypeRange");
 bool HasMasked = R->getValueAsBit("HasMasked");
@@ -414,30 +414,30 @@
 unsigned NF = R->getValueAsInt("NF");
 
 // Parse prototype and create a list of primitive type with transformers
-// (operand) in ProtoSeq. ProtoSeq[0] is output operand.
-SmallVector ProtoSeq = parsePrototypes(Prototypes);
+// (operand) in Prototype. Prototype[0] is output operand.
+SmallVector Prototype = parsePrototypes(Prototypes);
 
-SmallVector SuffixProtoSeq =
-parsePrototypes(SuffixProto);
-SmallVector MangledSuffixProtoSeq =
-parsePrototypes(MangledSuffixProto);
+SmallVector SuffixDesc = parsePrototypes(SuffixProto);
+SmallVector OverloadedSuffixDesc =
+parsePrototypes(OverloadedSuffixProto);
 
 // Compute Builtin types
-SmallVector ProtoMaskSeq = ProtoSeq;
+SmallVector MaskedPrototype = Prototype;
 if (HasMasked) {
   // If HasMaskedOffOperand, insert result type as first input operand.
   if (HasMaskedOffOperand) {
 if (NF == 1) {
-  ProtoMaskSeq.insert(ProtoMaskSeq.begin() + 1, ProtoSeq[0]);
+  MaskedPrototype.insert(MaskedPrototype.begin() + 1, Prototype[0]);
 } else {
   // Convert
   // (void, op0 address, op1 address, ...)
   // to
   // (void, op0 address, op1 address, ..., maskedoff0, maskedoff1, ...)
-  PrototypeDescriptor MaskoffType = ProtoSeq[1];
+  PrototypeDescriptor MaskoffType = Prototype[1];
   MaskoffType.TM &= ~static_cast(TypeModifier::Pointer);
   for (unsigned I = 0; I < NF; ++I)
-ProtoMaskSeq.insert(ProtoMaskSeq.begin() + NF + 1, MaskoffType);
+MaskedPrototype.insert(MaskedPrototype.begin() + NF + 1,
+   MaskoffType);
 }
   }
   if (HasMaskedOffOperand && NF > 1) {
@@ -446,18 +446,18 @@
 // to
 // (void, op0 address, op1 address, ..., mask, maskedoff0, maskedoff1,
 // ...)
-ProtoMaskSeq.insert(ProtoMaskSeq.begin() + NF + 1,
-PrototypeDescriptor::Mask);
+MaskedPrototype.insert(MaskedPrototype.begin() + NF + 1,
+   PrototypeDescriptor::Mask);
   } else {
 // If HasMasked, insert PrototypeDescriptor:Mask as first input operand.
-ProtoMaskSeq.insert(ProtoMaskSeq.begin() + 1,
-PrototypeDescriptor::Mask);
+MaskedPrototype.insert(MaskedPrototype.begin() + 1,
+   PrototypeDescriptor::Mask);
   }
 }
 // If HasVL, append PrototypeDescriptor:VL to last operand
 if (HasVL) {
-  ProtoSeq.push_back(PrototypeDescriptor::VL);
-  ProtoMaskSeq.push_back(PrototypeDescriptor::VL);
+  Prototype.push_back(PrototypeDescriptor::VL);
+  MaskedPrototype.push_back(PrototypeDescriptor::VL);
 }
 
 // Create Intrinsics for each type and LMUL.
@@ -465,18 +465,17 @@
   for (int Log2LMUL : Log2LMULList) {
 BasicType BT = ParseBasicType(I);
 Optional Types =
-RVVType::computeTypes(BT, Log2LMUL, NF, ProtoSeq);
+RVVType::computeTypes(BT, Log2LMUL, NF, Prototype);
 // Ignored to create new intrinsic if there are any illegal types.
 if (!Types.hasValue())
   cont

[PATCH] D125882: Correct the diagnostic behavior for unreachable _Generic associations in C++

2022-05-18 Thread Erich Keane via Phabricator via cfe-commits
erichkeane accepted this revision.
erichkeane added a comment.
This revision is now accepted and ready to land.

Took me a bit to get the prose, but I think I got it now.  PERHAPS there is use 
to 'finish the thought' on the outcome there?  Either way, LGTM.




Comment at: clang/lib/Sema/SemaExpr.cpp:1699
+  // If T is a non-class type, the type of the prvalue is the cv-
+  // unqualified version of T. Otherwise, the type of the prvalue is T.
   unsigned Reason = 0;

This seems like it is a sentence short (or perhaps I'm a few synapses short?). 

The fallout from these rules is that "Non-class-types" never have qualifiers, 
thus cannot match a qualified type, but a class-type can, because it keeps its 
qualifiers?

 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125882

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


[PATCH] D125889: clang-cl: Move /Zc: tests from cl-options.c to cl-zc.cpp

2022-05-18 Thread Nico Weber via Phabricator via cfe-commits
thakis created this revision.
thakis added a reviewer: hans.
Herald added a project: All.
thakis requested review of this revision.

Since we already have a dedicated file for testing the /Zc: flags,
let's be consistent about putting /Zc: tests there.

No behavior change.


https://reviews.llvm.org/D125889

Files:
  clang/test/Driver/cl-options.c
  clang/test/Driver/cl-zc.cpp

Index: clang/test/Driver/cl-zc.cpp
===
--- clang/test/Driver/cl-zc.cpp
+++ clang/test/Driver/cl-zc.cpp
@@ -64,10 +64,54 @@
 // RUN: %clang_cl /c -### /Zc:ternary- -- %s 2>&1 | FileCheck -check-prefix=TERNARY-OFF %s
 // TERNARY-OFF: argument unused during compilation
 
+// thread safe statics are off for versions < 19.
+// RUN: %clang_cl /c -### -fms-compatibility-version=18 -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
+// RUN: %clang_cl /Zc:threadSafeInit /Zc:threadSafeInit- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
+// NoThreadSafeStatics: "-fno-threadsafe-statics"
+
+// RUN: %clang_cl /Zc:threadSafeInit /c -### -- %s 2>&1 | FileCheck -check-prefix=ThreadSafeStatics %s
+// ThreadSafeStatics-NOT: "-fno-threadsafe-statics"
+
+// RUN: %clang_cl /Zc:dllexportInlines- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoDllExportInlines %s
+// NoDllExportInlines: "-fno-dllexport-inlines"
+// RUN: %clang_cl /Zc:dllexportInlines /c -### -- %s 2>&1 | FileCheck -check-prefix=DllExportInlines %s
+// DllExportInlines-NOT: "-fno-dllexport-inlines"
+
+// We recognize -f[no-]delayed-template-parsing.
+// /Zc:twoPhase[-] has the opposite meaning.
+// RUN: %clang_cl -c -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDDEFAULT %s
+// DELAYEDDEFAULT: "-fdelayed-template-parsing"
+// RUN: %clang_cl -c -fdelayed-template-parsing -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDON %s
+// RUN: %clang_cl -c /Zc:twoPhase- -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDON %s
+// DELAYEDON: "-fdelayed-template-parsing"
+// RUN: %clang_cl -c -fno-delayed-template-parsing -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDOFF %s
+// RUN: %clang_cl -c /Zc:twoPhase -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDOFF %s
+// DELAYEDOFF-NOT: "-fdelayed-template-parsing"
+
+// RUN: %clang_cl -c -### /std:c++latest -- %s 2>&1 | FileCheck -check-prefix CHECK-LATEST-CHAR8_T %s
+// CHECK-LATEST-CHAR8_T-NOT: "-fchar8_t"
+// RUN: %clang_cl -c -### /Zc:char8_t -- %s 2>&1 | FileCheck -check-prefix CHECK-CHAR8_T %s
+// CHECK-CHAR8_T: "-fchar8_t"
+// RUN: %clang_cl -c -### /Zc:char8_t- -- %s 2>&1 | FileCheck -check-prefix CHECK-CHAR8_T_ %s
+// CHECK-CHAR8_T_: "-fno-char8_t"
+
+
 
 // These never warn, but don't have an effect yet.
 
-// RUN: %clang_cl /c -### /Zc:rvalueCast -- %s 2>&1 | FileCheck -check-prefix=RVALUECAST-ON %s
-// RVALUECAST-ON-NOT: argument unused during compilation
-// RUN: %clang_cl /c -### /Zc:rvalueCast- -- %s 2>&1 | FileCheck -check-prefix=RVALUECAST-OFF %s
-// RVALUECAST-OFF: argument unused during compilation
+// RUN: %clang_cl /c \
+// RUN:   /Zc:__cplusplus \
+// RUN:   /Zc:auto \
+// RUN:   /Zc:forScope \
+// RUN:   /Zc:inline \
+// RUN:   /Zc:rvalueCast \
+// RUN:   /Zc:ternary \
+// RUN:   -### -- %s 2>&1 | FileCheck -check-prefix=IGNORED %s
+// IGNORED-NOT: argument unused during compilation
+// IGNORED-NOT: no such file or directory
+
+// Negated form warns:
+// RUN: %clang_cl /c \
+// RUN:   /Zc:rvalueCast- \
+// RUN:   -### -- %s 2>&1 | FileCheck -check-prefix=NOTIGNORED %s
+// NOTIGNORED: argument unused during compilation
Index: clang/test/Driver/cl-options.c
===
--- clang/test/Driver/cl-options.c
+++ clang/test/Driver/cl-options.c
@@ -336,24 +336,6 @@
 // RUN: %clang_cl -c -fno-delete-null-pointer-checks -### -- %s 2>&1 | FileCheck -check-prefix=NONULL %s
 // NONULL: "-fno-delete-null-pointer-checks"
 
-// We recognize -f[no-]delayed-template-parsing.
-// /Zc:twoPhase[-] has the opposite meaning.
-// RUN: %clang_cl -c -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDDEFAULT %s
-// DELAYEDDEFAULT: "-fdelayed-template-parsing"
-// RUN: %clang_cl -c -fdelayed-template-parsing -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDON %s
-// RUN: %clang_cl -c /Zc:twoPhase- -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDON %s
-// DELAYEDON: "-fdelayed-template-parsing"
-// RUN: %clang_cl -c -fno-delayed-template-parsing -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDOFF %s
-// RUN: %clang_cl -c /Zc:twoPhase -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDOFF %s
-// DELAYEDOFF-NOT: "-fdelayed-template-parsing"
-
-// RUN: %clang_cl -c -### /std:c++latest -- %s 2>&1 | FileCheck -check-prefix CHECK-LATEST-CHAR8_T %s
-// CHECK-LATEST-CHAR8_T-NOT: "-fchar8_t"
-// RUN: %clang_cl -c -### /Zc:char8_t -- %s 2>&1 | FileCheck -check-prefix CHECK-CHAR8_T %s
-// CHECK-CHAR8_T: "-fchar8_t"
-// RUN: %clang_cl -c -### /Zc:char8_t- -- %s 2>&1 | FileCheck -check-prefix CHECK-CHAR8_T_ %s
-// CHECK-CHAR8_T_

[PATCH] D124701: [clang] Honor __attribute__((no_builtin("foo"))) on functions

2022-05-18 Thread Stephen Long via Phabricator via cfe-commits
steplong updated this revision to Diff 430365.
steplong added a comment.

- Fixed comment about __attribute__((no_builtin))


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124701

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/AttrDocs.td
  clang/lib/CodeGen/CGExpr.cpp
  clang/test/CodeGen/no-builtin-2.c

Index: clang/test/CodeGen/no-builtin-2.c
===
--- /dev/null
+++ clang/test/CodeGen/no-builtin-2.c
@@ -0,0 +1,63 @@
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+
+typedef typeof(sizeof(0)) size_t;
+
+void bar(char *s);
+void *memset(void *s, int c, size_t n);
+void *memcpy(void *d, const void *s, size_t n);
+void *memmove(void *d, const void *s, size_t n);
+
+// CHECK: define{{.*}} void @foo1({{.*}}) #[[NO_NOBUILTIN:[0-9]+]]
+// CHECK:   call void @bar
+// CHECK:   call void @llvm.memset
+// CHECK:   call void @llvm.memcpy
+// CHECK:   call void @llvm.memmove
+void foo1(char *s, char *d, size_t n) {
+  bar(s);
+  memset(s, 0, n);
+  memcpy(d, s, n);
+  memmove(d, s, n);
+}
+
+// CHECK: define{{.*}} void @foo2({{.*}}) #[[NOBUILTIN_MEMSET:[0-9]+]]
+// CHECK:   call void @bar
+// CHECK:   {{.*}}call {{.*}} @memset
+// CHECK:   call void @llvm.memcpy
+// CHECK:   call void @llvm.memmove
+void foo2(char *s, char *d, size_t n) __attribute__((no_builtin("memset"))) {
+  bar(s);
+  memset(s, 1, n);
+  memcpy(d, s, n);
+  memmove(d, s, n);
+}
+
+// CHECK: define{{.*}} void @foo3({{.*}}) #[[NOBUILTIN_MEMSET_MEMCPY:[0-9]+]]
+// CHECK:   call void @bar
+// CHECK:   {{.*}}call {{.*}} @memset
+// CHECK:   {{.*}}call {{.*}} @memcpy
+// CHECK:   call void @llvm.memmove
+void foo3(char *s, char *d, size_t n) __attribute__((no_builtin("memset", "memcpy"))) {
+  bar(s);
+  memset(s, 2, n);
+  memcpy(d, s, n);
+  memmove(d, s, n);
+}
+
+// CHECK: define{{.*}} void @foo4({{.*}}) #[[NOBUILTINS:[0-9]+]]
+// CHECK:   call void @bar
+// CHECK:   {{.*}}call {{.*}} @memset
+// CHECK:   {{.*}}call {{.*}} @memcpy
+// CHECK:   {{.*}}call {{.*}} @memmove
+void foo4(char *s, char *d, size_t n) __attribute__((no_builtin)) {
+  bar(s);
+  memset(s, 2, n);
+  memcpy(d, s, n);
+  memmove(s, d, n);
+}
+
+// CHECK-NOT: attributes #[[NO_NOBUILTIN]] = {{{.*}}"no-builtin-memset"{{.*}}}
+// CHECK-NOT: attributes #[[NO_NOBUILTIN]] = {{{.*}}"no-builtin-memcpy"{{.*}}"no-builtin-memset"{{.*}}}
+// CHECK-NOT: attributes #[[NO_NOBUILTIN]] = {{{.*}}"no-builtins"{{.*}}}
+// CHECK: attributes #[[NOBUILTIN_MEMSET]] = {{{.*}}"no-builtin-memset"{{.*}}}
+// CHECK: attributes #[[NOBUILTIN_MEMSET_MEMCPY]] = {{{.*}}"no-builtin-memcpy"{{.*}}"no-builtin-memset"{{.*}}}
+// CHECK: attributes #[[NOBUILTINS]] = {{{.*}}"no-builtins"{{.*}}}
Index: clang/lib/CodeGen/CGExpr.cpp
===
--- clang/lib/CodeGen/CGExpr.cpp
+++ clang/lib/CodeGen/CGExpr.cpp
@@ -5034,7 +5034,16 @@
   const FunctionDecl *FD = cast(GD.getDecl());
 
   if (auto builtinID = FD->getBuiltinID()) {
+std::string NoBuiltinFD = ("no-builtin-" + FD->getName()).str();
+std::string NoBuiltins = "no-builtins";
 std::string FDInlineName = (FD->getName() + ".inline").str();
+
+bool IsPredefinedLibFunction =
+CGF.getContext().BuiltinInfo.isPredefinedLibFunction(builtinID);
+bool HasAttributeNoBuiltin =
+CGF.CurFn->getAttributes().hasFnAttr(NoBuiltinFD) ||
+CGF.CurFn->getAttributes().hasFnAttr(NoBuiltins);
+
 // When directing calling an inline builtin, call it through it's mangled
 // name to make it clear it's not the actual builtin.
 if (CGF.CurFn->getName() != FDInlineName &&
@@ -5054,8 +5063,11 @@
 
 // Replaceable builtins provide their own implementation of a builtin. If we
 // are in an inline builtin implementation, avoid trivial infinite
-// recursion.
-else
+// recursion. Honor __attribute__((no_builtin("foo"))) or
+// __attribute__((no_builtin)) on the current function unless foo is
+// not a predefined library function which means we must generate the
+// builtin no matter what.
+else if (!IsPredefinedLibFunction || !HasAttributeNoBuiltin)
   return CGCallee::forBuiltin(builtinID, FD);
   }
 
Index: clang/include/clang/Basic/AttrDocs.td
===
--- clang/include/clang/Basic/AttrDocs.td
+++ clang/include/clang/Basic/AttrDocs.td
@@ -6000,9 +6000,6 @@
 def NoBuiltinDocs : Documentation {
   let Category = DocCatFunction;
   let Content = [{
-.. Note:: This attribute is not yet fully implemented, it is validated but has
-  no effect on the generated code.
-
 The ``__attribute__((no_builtin))`` is similar to the ``-fno-builtin`` flag
 except it is specific to the body of a function. The attribute may also be
 applied to a virtual function but has no effect on the behavior of overriding
Index: clang/doc

[PATCH] D125604: [FileCheck] Catch missspelled directives.

2022-05-18 Thread Dave Green via Phabricator via cfe-commits
dmgreen added inline comments.



Comment at: llvm/test/CodeGen/AArch64/fp16-v8-instructions.ll:682-688
+; TODO-CVT-DAG:   fcvtl   [[LO:v[0-9]+\.4s]], v0.4h
+; TODO-CVT-DAG:   fcvtl2  [[HI:v[0-9]+\.4s]], v0.8h
+; TODO-CVT-DAG:   fcvtzs  [[LOF32:v[0-9]+\.4s]], [[LO]]
+; TODO-CVT-DAG:   xtn [[I16:v[0-9]+]].4h, [[LOF32]]
+; TODO-CVT-DAG:   fcvtzs  [[HIF32:v[0-9]+\.4s]], [[HI]]
+; TODO-CVT-DAG:   xtn2[[I16]].8h, [[HIF32]]
+; TODO-NEXT:  ret

kosarev wrote:
> @az 
These lines should be removed. The were accidentally left in as the file was 
update_llc_test_check'd



Comment at: llvm/test/CodeGen/Thumb2/thumb2-execute-only-prologue.ll:13
 ; CHECK: .LCPI0_0:
-; CHECK_NEXT:long   4294963196
+; TODO-NEXT: long   4294963196
+

kosarev wrote:
> @keith.walker.arm 
I think `; CHECK-NEXT:  .long 4294965696` should be OK. That looks like it 
would match up with the code.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125604

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


[PATCH] D125604: [FileCheck] Catch missspelled directives.

2022-05-18 Thread Simon Pilgrim via Phabricator via cfe-commits
RKSimon added inline comments.



Comment at: llvm/test/CodeGen/AArch64/fp16-v8-instructions.ll:682-688
+; TODO-CVT-DAG:   fcvtl   [[LO:v[0-9]+\.4s]], v0.4h
+; TODO-CVT-DAG:   fcvtl2  [[HI:v[0-9]+\.4s]], v0.8h
+; TODO-CVT-DAG:   fcvtzs  [[LOF32:v[0-9]+\.4s]], [[LO]]
+; TODO-CVT-DAG:   xtn [[I16:v[0-9]+]].4h, [[LOF32]]
+; TODO-CVT-DAG:   fcvtzs  [[HIF32:v[0-9]+\.4s]], [[HI]]
+; TODO-CVT-DAG:   xtn2[[I16]].8h, [[HIF32]]
+; TODO-NEXT:  ret

dmgreen wrote:
> kosarev wrote:
> > @az 
> These lines should be removed. The were accidentally left in as the file was 
> update_llc_test_check'd
This was fixed in rG1584b2c74e4c804a2c85d760a1a2c10b33465f2e


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125604

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


[PATCH] D125506: [PowerPC] Implement XL compat __fnabs and __fnabss builtins.

2022-05-18 Thread Amy Kwan via Phabricator via cfe-commits
amyk updated this revision to Diff 430249.
amyk added a comment.

Address review comments:

- Remove `-no-opaque-pointers` and updates CHECKs
- Simplify runs and checks of C and IR test files


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125506

Files:
  clang/include/clang/Basic/BuiltinsPPC.def
  clang/lib/Basic/Targets/PPC.cpp
  clang/test/CodeGen/PowerPC/builtins-ppc-xlcompat-fnabs.c
  llvm/include/llvm/IR/IntrinsicsPowerPC.td
  llvm/lib/Target/PowerPC/P10InstrResources.td
  llvm/lib/Target/PowerPC/P9InstrResources.td
  llvm/lib/Target/PowerPC/PPCBack2BackFusion.def
  llvm/lib/Target/PowerPC/PPCInstrInfo.td
  llvm/lib/Target/PowerPC/PPCInstrVSX.td
  llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-fnabs.ll

Index: llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-fnabs.ll
===
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-fnabs.ll
@@ -0,0 +1,79 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
+; RUN:   -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names -mcpu=pwr8 < %s | \
+; RUN: FileCheck %s --check-prefix=CHECK-DEFAULT
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \
+; RUN:   -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names -mcpu=pwr8 < %s | \
+; RUN: FileCheck %s --check-prefix=CHECK-DEFAULT
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-aix -mcpu=pwr8 \
+; RUN:   -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names < %s | FileCheck %s \
+; RUN:   --check-prefix=CHECK-DEFAULT
+; RUN: llc -verify-machineinstrs -mtriple=powerpc-unknown-aix -mcpu=pwr8 < %s \
+; RUN:   -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names | FileCheck %s \
+; RUN:   --check-prefix=CHECK-DEFAULT
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-aix -mcpu=pwr7 \
+; RUN:   -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names < %s | FileCheck %s \
+; RUN:   --check-prefix=CHECK-DEFAULT
+; RUN: llc -verify-machineinstrs -mtriple=powerpc-unknown-aix -mcpu=pwr7 \
+; RUN:   -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names < %s | FileCheck %s \
+; RUN:   --check-prefix=CHECK-DEFAULT
+
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
+; RUN:   -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names -mcpu=pwr6 < %s | \
+; RUN: FileCheck %s --check-prefix=CHECK-NOVSX
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \
+; RUN:   -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names -mcpu=pwr6 < %s | \
+; RUN: FileCheck %s --check-prefix=CHECK-NOVSX
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-aix \
+; RUN:   -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names -mcpu=pwr6 < %s | \
+; RUN: FileCheck %s --check-prefix=CHECK-NOVSX
+; RUN: llc -verify-machineinstrs -mtriple=powerpc-unknown-aix \
+; RUN:   -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names -mcpu=pwr6 < %s | \
+; RUN: FileCheck %s --check-prefix=CHECK-NOVSX
+
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
+; RUN:   -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names -mcpu=pwr8 \
+; RUN:   -mattr=-vsx < %s | FileCheck %s --check-prefix=CHECK-NOVSX
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \
+; RUN:   -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names -mcpu=pwr8 \
+; RUN:   -mattr=-vsx < %s | FileCheck %s --check-prefix=CHECK-NOVSX
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-aix \
+; RUN:   -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names -mcpu=pwr8 \
+; RUN:   -mattr=-vsx < %s | FileCheck %s --check-prefix=CHECK-NOVSX
+; RUN: llc -verify-machineinstrs -mtriple=powerpc-unknown-aix \
+; RUN:   -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names -mcpu=pwr8 \
+; RUN:   -mattr=-vsx < %s | FileCheck %s --check-prefix=CHECK-NOVSX
+
+declare double @llvm.ppc.fnabs(double)
+declare float @llvm.ppc.fnabss(float)
+
+define double @test_fnabs2(double %d) {
+; CHECK-DEFAULT-LABEL: test_fnabs2:
+; CHECK-DEFAULT:   # %bb.0: # %entry
+; CHECK-DEFAULT-NEXT:xsnabsdp f1, f1
+; CHECK-DEFAULT-NEXT:blr
+;
+; CHECK-NOVSX-LABEL: test_fnabs2:
+; CHECK-NOVSX:   # %bb.0: # %entry
+; CHECK-NOVSX-NEXT:fnabs f1, f1
+; CHECK-NOVSX-NEXT:blr
+entry:
+  %0 = tail call double @llvm.ppc.fnabs(double %d)
+  ret double %0
+}
+
+define float @test_fnabss(float %f) {
+; CHECK-DEFAULT-LABEL: test_fnabss:
+; CHECK-DEFAULT:   # %bb.0: # %entry
+; CHECK-DEFAULT-NEXT:xsnabsdp f1, f1
+; CHECK-DEFAULT-NEXT:blr
+;
+; CHECK-NOVSX-LABEL: test_fnabss:
+; CHECK-NOVSX:   # %bb.0: # %entry
+; CHECK-NOVSX-NEXT:fnabs f1, f1
+; CHECK-NOVSX-NEXT:blr
+entry:
+  %0 = tail call float @llvm.ppc.fnabss(float %f)
+  ret float %0
+}
+
Index: llvm/lib/Target/PowerPC/PPCInstrVSX.td
===
--- llvm/lib/Target/PowerPC/PPCInstrVSX.td
+++ llvm/lib/Target/PowerPC/PPCInstrVSX.td
@@ -703,6 +703,1

[PATCH] D125788: [flang][driver] Rename `flang-new` as `flang`

2022-05-18 Thread Andrzej Warzynski via Phabricator via cfe-commits
awarzynski added a comment.

In D125788#3519403 , @DavidSpickett 
wrote:

> Sounds good to me. https://reviews.llvm.org/D125796 for the bot side, let me 
> know if/when the first half of the change goes in.

https://reviews.llvm.org/D125832 for "patch 1".

In D125788#3521487 , 
@kiranchandramohan wrote:

> It will be a good idea to,
> -> wait for the author of the original script and the throwaway driver, 
> @sscalpone.

👍🏻

> -> clarify that execution is still restricted to developers via a flag.

👍🏻  Nothing changes with regard to the compiler flags (there are no functional 
changes here, just the renaming).

> My personal preference for the renaming is `flang-to-external-fc` since it is 
> not specific to gfortran.

Makes sense, I can rename it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125788

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


[PATCH] D125802: Fix std::has_unique_object_representations for _BitInt types with padding bits

2022-05-18 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok updated this revision to Diff 430373.
MitalAshok added a comment.

Removed useless isReferenceType check


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125802

Files:
  clang/docs/ReleaseNotes.rst
  clang/lib/AST/ASTContext.cpp
  clang/test/SemaCXX/has_unique_object_reps_bitint.cpp

Index: clang/test/SemaCXX/has_unique_object_reps_bitint.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/has_unique_object_reps_bitint.cpp
@@ -0,0 +1,86 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify -std=c++17 -Wno-bitfield-width %s
+//  expected-no-diagnostics
+
+static_assert(__has_unique_object_representations(_BitInt(8)));
+static_assert(__has_unique_object_representations(unsigned _BitInt(8)));
+static_assert(__has_unique_object_representations(_BitInt(sizeof(int) * 8u)));
+// sizeof(_BitInt(24)) may be 4 to align it to the next greater integer type, in which case it would have 8 padding bits.
+static_assert(__has_unique_object_representations(_BitInt(24)) == (sizeof(_BitInt(24)) == 3));
+
+static_assert(!__has_unique_object_representations(_BitInt(7)));
+static_assert(!__has_unique_object_representations(unsigned _BitInt(7)));
+static_assert(!__has_unique_object_representations(_BitInt(2)));
+static_assert(!__has_unique_object_representations(unsigned _BitInt(1)));
+
+template 
+constexpr bool check() {
+  if constexpr (N <= __BITINT_MAXWIDTH__) {
+static_assert(__has_unique_object_representations(_BitInt(N)) == (sizeof(_BitInt(N)) * 8u == N));
+static_assert(__has_unique_object_representations(unsigned _BitInt(N)) == (sizeof(unsigned _BitInt(N)) * 8u == N));
+  }
+  return true;
+}
+
+template 
+constexpr bool do_check = (check() && ...);
+
+static_assert(do_check<2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18>);
+static_assert(do_check<15, 16, 17, 23, 24, 25, 31, 32, 33>);
+static_assert(do_check<39, 40, 41, 47, 48, 49>);
+static_assert(do_check<127, 128, 129, 255, 256, 257, 383, 384, 385>);
+
+template 
+struct in_struct {
+  _BitInt(N) x;
+  static constexpr bool check() {
+return __has_unique_object_representations(in_struct) == __has_unique_object_representations(_BitInt(N));
+  }
+};
+
+static_assert(in_struct<8>::check());
+static_assert(in_struct<7>::check());
+
+struct bit_fields_1 {
+  _BitInt(7) x : 7;
+  unsigned _BitInt(1) y : 1;
+};
+
+static_assert(__has_unique_object_representations(bit_fields_1) == (sizeof(bit_fields_1) == 1));
+
+struct bit_fields_2 {
+  _BitInt(8) x : 7;
+};
+
+static_assert(!__has_unique_object_representations(bit_fields_2));
+
+struct bit_fields_3 {
+  _BitInt(15) x : 8;
+};
+
+static_assert(__has_unique_object_representations(bit_fields_3) == (sizeof(bit_fields_3) == 1));
+
+#if __BITINT_MAXWIDTH__ >= 129
+struct bit_fields_4 {
+  _BitInt(129) x : 128;
+};
+
+static_assert(__has_unique_object_representations(bit_fields_4) == (sizeof(bit_fields_4) == 128 / 8));
+#endif
+
+struct bit_fields_5 {
+  _BitInt(2) x : 8;
+};
+
+static_assert(!__has_unique_object_representations(bit_fields_5));
+
+template 
+struct ref_member {
+  _BitInt(N) & x;
+};
+
+struct int_ref_member {
+  int &x;
+};
+
+static_assert(__has_unique_object_representations(ref_member<7>) == __has_unique_object_representations(ref_member<8>));
+static_assert(__has_unique_object_representations(ref_member<8>) == __has_unique_object_representations(int_ref_member));
Index: clang/lib/AST/ASTContext.cpp
===
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -2684,7 +2684,11 @@
 if (!RD->isUnion())
   return structHasUniqueObjectRepresentations(Context, RD);
   }
-  if (!Field->getType()->isReferenceType() &&
+
+  // A _BitInt type may not be unique if it has padding bits
+  // but if it is a bitfield the padding bits are not used.
+  bool IsBitIntType = Field->getType()->isBitIntType();
+  if (!Field->getType()->isReferenceType() && !IsBitIntType &&
   !Context.hasUniqueObjectRepresentations(Field->getType()))
 return llvm::None;
 
@@ -2692,9 +2696,17 @@
   Context.toBits(Context.getTypeSizeInChars(Field->getType()));
   if (Field->isBitField()) {
 int64_t BitfieldSize = Field->getBitWidthValue(Context);
-if (BitfieldSize > FieldSizeInBits)
+if (IsBitIntType) {
+  if ((unsigned)BitfieldSize >
+  cast(Field->getType())->getNumBits())
+return llvm::None;
+} else if (BitfieldSize > FieldSizeInBits) {
   return llvm::None;
+}
 FieldSizeInBits = BitfieldSize;
+  } else if (IsBitIntType &&
+ !Context.hasUniqueObjectRepresentations(Field->getType())) {
+return llvm::None;
   }
   return FieldSizeInBits;
 }
@@ -2792,8 +2804,13 @@
 return false;
 
   // All integrals and enums are unique.
-  if (Ty->isIntegralOrEnumerationType())
+  if (Ty->isIntegralOrEnumera

[PATCH] D125885: [clang-tidy] bugprone-argument-comment: Ignore calls to user-defined literals

2022-05-18 Thread Joachim Priesner via Phabricator via cfe-commits
jspam updated this revision to Diff 430375.
jspam added a comment.

Fix test


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125885

Files:
  clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
  clang-tools-extra/test/clang-tidy/checkers/bugprone-argument-comment.cpp


Index: clang-tools-extra/test/clang-tidy/checkers/bugprone-argument-comment.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/bugprone-argument-comment.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/bugprone-argument-comment.cpp
@@ -5,6 +5,8 @@
 
 void (int , int );
 
+int operator""_op(unsigned long long val);
+
 void f(int x, int y);
 void g() {
   // CHECK-NOTES: [[@LINE+4]]:5: warning: argument name 'y' in comment does 
not match parameter name 'x'
@@ -14,7 +16,15 @@
   f(/*y=*/0, /*z=*/0);
   // CHECK-FIXES: {{^}}  f(/*y=*/0, /*z=*/0);
 
+  // CHECK-NOTES: [[@LINE+4]]:5: warning: argument name 'y' in comment does 
not match parameter name 'x'
+  // CHECK-NOTES: [[@LINE-10]]:12: note: 'x' declared here
+  // CHECK-NOTES: [[@LINE+2]]:17: warning: argument name 'z' in comment does 
not match parameter name 'y'
+  // CHECK-NOTES: [[@LINE-12]]:19: note: 'y' declared here
+  f(/*y=*/0_op, /*z=*/0_op);
+  // CHECK-FIXES: {{^}}  f(/*y=*/0_op, /*z=*/0_op);
+
   f(/*x=*/1, /*y=*/1);
+  f(/*x=*/1_op, /*y=*/1_op);
 
   (0 /*=*/, /**/ 0); // Unsupported formats.
 }
Index: clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
===
--- clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
+++ clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
@@ -60,7 +60,7 @@
 
 void ArgumentCommentCheck::registerMatchers(MatchFinder *Finder) {
   Finder->addMatcher(
-  callExpr(unless(cxxOperatorCallExpr()),
+  callExpr(unless(cxxOperatorCallExpr()), unless(userDefinedLiteral()),
// NewCallback's arguments relate to the pointed function,
// don't check them against NewCallback's parameter names.
// FIXME: Make this configurable.


Index: clang-tools-extra/test/clang-tidy/checkers/bugprone-argument-comment.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/bugprone-argument-comment.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/bugprone-argument-comment.cpp
@@ -5,6 +5,8 @@
 
 void (int , int );
 
+int operator""_op(unsigned long long val);
+
 void f(int x, int y);
 void g() {
   // CHECK-NOTES: [[@LINE+4]]:5: warning: argument name 'y' in comment does not match parameter name 'x'
@@ -14,7 +16,15 @@
   f(/*y=*/0, /*z=*/0);
   // CHECK-FIXES: {{^}}  f(/*y=*/0, /*z=*/0);
 
+  // CHECK-NOTES: [[@LINE+4]]:5: warning: argument name 'y' in comment does not match parameter name 'x'
+  // CHECK-NOTES: [[@LINE-10]]:12: note: 'x' declared here
+  // CHECK-NOTES: [[@LINE+2]]:17: warning: argument name 'z' in comment does not match parameter name 'y'
+  // CHECK-NOTES: [[@LINE-12]]:19: note: 'y' declared here
+  f(/*y=*/0_op, /*z=*/0_op);
+  // CHECK-FIXES: {{^}}  f(/*y=*/0_op, /*z=*/0_op);
+
   f(/*x=*/1, /*y=*/1);
+  f(/*x=*/1_op, /*y=*/1_op);
 
   (0 /*=*/, /**/ 0); // Unsupported formats.
 }
Index: clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
===
--- clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
+++ clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
@@ -60,7 +60,7 @@
 
 void ArgumentCommentCheck::registerMatchers(MatchFinder *Finder) {
   Finder->addMatcher(
-  callExpr(unless(cxxOperatorCallExpr()),
+  callExpr(unless(cxxOperatorCallExpr()), unless(userDefinedLiteral()),
// NewCallback's arguments relate to the pointed function,
// don't check them against NewCallback's parameter names.
// FIXME: Make this configurable.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D125863: [clangd] Dont mark terminating PP-directives as skipped

2022-05-18 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet marked an inline comment as done.
kadircet added a comment.

In D125863#3522025 , @hokein wrote:

> sorry, I might be lack of the context, where is the user complaint? I'm not 
> sure which cases are improved with this patch.

so the complaint was from an example with an active branch, eg:

  #if 1
  void foo();
  #else
  #endif

The user was complaining that `#endif` was inactive depending on first or 
second branch being active. Hence my initial thoughts were also around cases 
which had at least one "active" branch, but you're right this actually is 
confusing when there are no active branches.

> Ideally we would not mark PP directives as inactive regions, but we never do 
> that (FIXME 
> ),
>  I think we're trying to fix that?

Right, I wasn't aware of that fix me. I was deliberately only excluding the 
termination directive from the skipped range and not the beginning, as I think 
it's nice to directly observe the fact that the condition evaluated to 
false/skipped.
But as mentioned above, i think it's confusing and in theory a "lie". Because 
preprocessor is definitely not skipping those directives, they're still 
processed (even in the cases where we have else/elif directives that come after 
an active branch).
So I suppose the right thing here is actually to preserve both start and 
termination directive for each block, to be consistent and also to give the 
correct semantics around "this PP-directive wasn't skipped".
WDYT?




Comment at: clang-tools-extra/clangd/CollectMacros.h:90
+// Don't mark the terminating PP-directive as skipped.
+End.character = 0;
 Out.SkippedRanges.push_back(Range{Begin, End});

hokein wrote:
> This looks like a  semantic-highlight-specific change, instead of doing it 
> here, would it make more sense to do it in the `SemanticHighlighting.cpp`?
I wanted to perform the change here, because other consumers of skipped ranges 
should actually behave similar in clangd (not that we have more ATM).
We're definitely collecting information about PP-directives that 
start/terminate those skipped blocks, and special casing them in some places 
while not in others will probably result in bugs.

Do you see any reasons that we might actually want skipped ranges to include 
starting/terminating directives?



Comment at: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp:447
 $InactiveCode[[#if defined(test)]]
-$InactiveCode[[#endif]]
+#endif
 )cpp",

hokein wrote:
> It seems to me that the new behavior of these cases is worse --  `#ifedf` 
> will not be highlighted while the paired `#endif` will,  this inconsistency 
> probably gives weird and confusing UI experience to users. 
> 
> I think it is important to have a consistent decision -- highlight both or 
> not-highlight both.
> 
agreed see my main comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125863

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


[PATCH] D125506: [PowerPC] Implement XL compat __fnabs and __fnabss builtins.

2022-05-18 Thread Lei Huang via Phabricator via cfe-commits
lei added inline comments.



Comment at: llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-fnabs.ll:46
+; RUN:   -mattr=-vsx < %s | FileCheck %s --check-prefix=CHECK-NOVSX
+
+declare double @llvm.ppc.fnabs(double)

nit: same as before no need to test all combination for both pwr7 and pwr8.  
Just a mix of the 2 like in the clang test. What happens if we do pwr6 with 
`+vsx`?  Is this a possible combination?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125506

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


[PATCH] D125788: [flang][driver] Rename `flang-new` as `flang`

2022-05-18 Thread Andrzej Warzynski via Phabricator via cfe-commits
awarzynski updated this revision to Diff 430379.
awarzynski added a comment.

Rename `flang-to-gfortran` as `flang-to-external-fc`

I will also make this change depend on https://reviews.llvm.org/D125832


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125788

Files:
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChains/Flang.cpp
  clang/test/Driver/flang/flang.f90
  clang/test/Driver/flang/flang_ucase.F90
  clang/test/Driver/flang/multiple-inputs-mixed.f90
  clang/test/Driver/flang/multiple-inputs.f90
  flang/examples/FlangOmpReport/FlangOmpReport.cpp
  flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
  flang/test/CMakeLists.txt
  flang/test/Driver/disable-ext-name-interop.f90
  flang/test/Driver/driver-help-hidden.f90
  flang/test/Driver/driver-version.f90
  flang/test/Driver/escaped-backslash.f90
  flang/test/Driver/fdefault.f90
  flang/test/Driver/flarge-sizes.f90
  flang/test/Driver/frontend-forwarding.f90
  flang/test/Driver/intrinsic-module-path.f90
  flang/test/Driver/macro-def-undef.F90
  flang/test/Driver/missing-input.f90
  flang/test/Driver/predefined-macros-compiler-version.F90
  flang/test/Driver/std2018-wrong.f90
  flang/test/Driver/std2018.f90
  flang/test/Driver/use-module-error.f90
  flang/test/Driver/use-module.f90
  flang/test/Frontend/multiple-input-files.f90
  flang/test/Lower/Intrinsics/command_argument_count.f90
  flang/test/Lower/Intrinsics/exit.f90
  flang/test/Lower/Intrinsics/get_command_argument.f90
  flang/test/Lower/Intrinsics/get_environment_variable.f90
  flang/test/Lower/OpenACC/Todo/acc-declare.f90
  flang/test/Lower/OpenACC/Todo/acc-routine.f90
  flang/test/Lower/OpenMP/Todo/omp-declarative-allocate.f90
  flang/test/Lower/OpenMP/Todo/omp-declare-reduction.f90
  flang/test/Lower/OpenMP/Todo/omp-declare-simd.f90
  flang/test/Lower/OpenMP/Todo/omp-declare-target.f90
  flang/test/Lower/OpenMP/Todo/omp-threadprivate.f90
  flang/test/lit.cfg.py
  flang/tools/f18/CMakeLists.txt
  flang/tools/flang-driver/CMakeLists.txt
  flang/tools/flang-driver/driver.cpp

Index: flang/tools/flang-driver/driver.cpp
===
--- flang/tools/flang-driver/driver.cpp
+++ flang/tools/flang-driver/driver.cpp
@@ -80,7 +80,7 @@
   clang::driver::ParsedClangName targetandMode("flang", "--driver-mode=flang");
   std::string driverPath = getExecutablePath(args[0]);
 
-  // Check if flang-new is in the frontend mode
+  // Check if flang is in the frontend mode
   auto firstArg = std::find_if(
   args.begin() + 1, args.end(), [](const char *a) { return a != nullptr; });
   if (firstArg != args.end()) {
@@ -89,7 +89,7 @@
<< "Valid tools include '-fc1'.\n";
   return 1;
 }
-// Call flang-new frontend
+// Call flang frontend
 if (llvm::StringRef(args[1]).startswith("-fc1")) {
   return executeFC1Tool(args);
 }
Index: flang/tools/flang-driver/CMakeLists.txt
===
--- flang/tools/flang-driver/CMakeLists.txt
+++ flang/tools/flang-driver/CMakeLists.txt
@@ -10,7 +10,7 @@
   Support
 )
 
-add_flang_tool(flang-new
+add_flang_tool(flang
   driver.cpp
   fc1_main.cpp
 
@@ -23,23 +23,32 @@
   Fortran_main
 )
 
-target_link_libraries(flang-new
+target_link_libraries(flang
   PRIVATE
   flangFrontend
   flangFrontendTool
 )
 
-clang_target_link_libraries(flang-new
+clang_target_link_libraries(flang
   PRIVATE
   clangDriver
   clangBasic
 )
 
+if(WIN32 AND NOT CYGWIN)
+  # Prevent versioning if the buildhost is targeting for Win32.
+else()
+  set_target_properties(flang PROPERTIES VERSION ${FLANG_EXECUTABLE_VERSION})
+endif()
+
 option(FLANG_PLUGIN_SUPPORT "Build Flang with plugin support." ON)
 
-# Enable support for plugins, which need access to symbols from flang-new
+# Enable support for plugins, which need access to symbols from flang
 if(FLANG_PLUGIN_SUPPORT)
-  export_executable_symbols_for_plugins(flang-new)
+  export_executable_symbols_for_plugins(flang)
 endif()
 
-install(TARGETS flang-new DESTINATION "${CMAKE_INSTALL_BINDIR}")
+# For backwords compatibility
+add_flang_symlink(flang-new flang)
+
+install(TARGETS flang DESTINATION "${CMAKE_INSTALL_BINDIR}")
Index: flang/tools/f18/CMakeLists.txt
===
--- flang/tools/f18/CMakeLists.txt
+++ flang/tools/f18/CMakeLists.txt
@@ -35,9 +35,9 @@
   endif()
   add_custom_command(OUTPUT ${base}.mod
 COMMAND ${CMAKE_COMMAND} -E make_directory ${FLANG_INTRINSIC_MODULES_DIR}
-COMMAND flang-new -fc1 -fsyntax-only -module-dir ${FLANG_INTRINSIC_MODULES_DIR}
+COMMAND flang -fc1 -fsyntax-only -module-dir ${FLANG_INTRINSIC_MODULES_DIR}
   ${FLANG_SOURCE_DIR}/module/${filename}.f90
-DEPENDS flang-new ${FLANG_SOURCE_DIR}/module/${filename}.f90 ${depends}
+DEPENDS flang ${FLANG_SOURCE_DIR}/module/${filename}.f90 ${depends}
   )
   add_c

[PATCH] D125889: clang-cl: Move /Zc: tests from cl-options.c to cl-zc.cpp

2022-05-18 Thread Hans Wennborg via Phabricator via cfe-commits
hans accepted this revision.
hans added a comment.
This revision is now accepted and ready to land.

lgtm


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

https://reviews.llvm.org/D125889

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


[PATCH] D124701: [clang] Honor __attribute__((no_builtin("foo"))) on functions

2022-05-18 Thread Hans Wennborg via Phabricator via cfe-commits
hans accepted this revision.
hans added a comment.
This revision is now accepted and ready to land.

lgtm


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124701

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


[clang] d39928e - clang-cl: Move /Zc: tests from cl-options.c to cl-zc.cpp

2022-05-18 Thread Nico Weber via cfe-commits

Author: Nico Weber
Date: 2022-05-18T11:01:10-04:00
New Revision: d39928e2cc393a21c8367ef318019166124f4b56

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

LOG: clang-cl: Move /Zc: tests from cl-options.c to cl-zc.cpp

Since we already have a dedicated file for testing the /Zc: flags,
let's be consistent about putting /Zc: tests there.

No behavior change.

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

Added: 


Modified: 
clang/test/Driver/cl-options.c
clang/test/Driver/cl-zc.cpp

Removed: 




diff  --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c
index 4eae94b1bff20..1e518e0035ae8 100644
--- a/clang/test/Driver/cl-options.c
+++ b/clang/test/Driver/cl-options.c
@@ -336,24 +336,6 @@
 // RUN: %clang_cl -c -fno-delete-null-pointer-checks -### -- %s 2>&1 | 
FileCheck -check-prefix=NONULL %s
 // NONULL: "-fno-delete-null-pointer-checks"
 
-// We recognize -f[no-]delayed-template-parsing.
-// /Zc:twoPhase[-] has the opposite meaning.
-// RUN: %clang_cl -c -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDDEFAULT 
%s
-// DELAYEDDEFAULT: "-fdelayed-template-parsing"
-// RUN: %clang_cl -c -fdelayed-template-parsing -### -- %s 2>&1 | FileCheck 
-check-prefix=DELAYEDON %s
-// RUN: %clang_cl -c /Zc:twoPhase- -### -- %s 2>&1 | FileCheck 
-check-prefix=DELAYEDON %s
-// DELAYEDON: "-fdelayed-template-parsing"
-// RUN: %clang_cl -c -fno-delayed-template-parsing -### -- %s 2>&1 | FileCheck 
-check-prefix=DELAYEDOFF %s
-// RUN: %clang_cl -c /Zc:twoPhase -### -- %s 2>&1 | FileCheck 
-check-prefix=DELAYEDOFF %s
-// DELAYEDOFF-NOT: "-fdelayed-template-parsing"
-
-// RUN: %clang_cl -c -### /std:c++latest -- %s 2>&1 | FileCheck -check-prefix 
CHECK-LATEST-CHAR8_T %s
-// CHECK-LATEST-CHAR8_T-NOT: "-fchar8_t"
-// RUN: %clang_cl -c -### /Zc:char8_t -- %s 2>&1 | FileCheck -check-prefix 
CHECK-CHAR8_T %s
-// CHECK-CHAR8_T: "-fchar8_t"
-// RUN: %clang_cl -c -### /Zc:char8_t- -- %s 2>&1 | FileCheck -check-prefix 
CHECK-CHAR8_T_ %s
-// CHECK-CHAR8_T_: "-fno-char8_t"
-
 // RUN: %clang_cl -c -### /std:c11 -- %s 2>&1 | FileCheck -check-prefix 
CHECK-C11 %s
 // CHECK-C11: -std=c11
 
@@ -398,12 +380,6 @@
 // RUN:/wd1234 \
 // RUN:/Wv \
 // RUN:/Wv:17 \
-// RUN:/Zc:__cplusplus \
-// RUN:/Zc:auto \
-// RUN:/Zc:forScope \
-// RUN:/Zc:inline \
-// RUN:/Zc:rvalueCast \
-// RUN:/Zc:ternary \
 // RUN:/ZH:MD5 \
 // RUN:/ZH:SHA1 \
 // RUN:/ZH:SHA_256 \
@@ -553,19 +529,6 @@
 // RTTI-NOT: "-fno-rtti-data"
 // RTTI-NOT: "-fno-rtti"
 
-// thread safe statics are off for versions < 19.
-// RUN: %clang_cl /c -### -fms-compatibility-version=18 -- %s 2>&1 | FileCheck 
-check-prefix=NoThreadSafeStatics %s
-// RUN: %clang_cl /Zc:threadSafeInit /Zc:threadSafeInit- /c -### -- %s 2>&1 | 
FileCheck -check-prefix=NoThreadSafeStatics %s
-// NoThreadSafeStatics: "-fno-threadsafe-statics"
-
-// RUN: %clang_cl /Zc:threadSafeInit /c -### -- %s 2>&1 | FileCheck 
-check-prefix=ThreadSafeStatics %s
-// ThreadSafeStatics-NOT: "-fno-threadsafe-statics"
-
-// RUN: %clang_cl /Zc:dllexportInlines- /c -### -- %s 2>&1 | FileCheck 
-check-prefix=NoDllExportInlines %s
-// NoDllExportInlines: "-fno-dllexport-inlines"
-// RUN: %clang_cl /Zc:dllexportInlines /c -### -- %s 2>&1 | FileCheck 
-check-prefix=DllExportInlines %s
-// DllExportInlines-NOT: "-fno-dllexport-inlines"
-
 // RUN: %clang_cl /Zi /c -### -- %s 2>&1 | FileCheck -check-prefix=Zi %s
 // Zi: "-gcodeview"
 // Zi: "-debug-info-kind=constructor"

diff  --git a/clang/test/Driver/cl-zc.cpp b/clang/test/Driver/cl-zc.cpp
index 53d28dddefa73..077d22d2e3cd7 100644
--- a/clang/test/Driver/cl-zc.cpp
+++ b/clang/test/Driver/cl-zc.cpp
@@ -64,10 +64,54 @@
 // RUN: %clang_cl /c -### /Zc:ternary- -- %s 2>&1 | FileCheck 
-check-prefix=TERNARY-OFF %s
 // TERNARY-OFF: argument unused during compilation
 
+// thread safe statics are off for versions < 19.
+// RUN: %clang_cl /c -### -fms-compatibility-version=18 -- %s 2>&1 | FileCheck 
-check-prefix=NoThreadSafeStatics %s
+// RUN: %clang_cl /Zc:threadSafeInit /Zc:threadSafeInit- /c -### -- %s 2>&1 | 
FileCheck -check-prefix=NoThreadSafeStatics %s
+// NoThreadSafeStatics: "-fno-threadsafe-statics"
+
+// RUN: %clang_cl /Zc:threadSafeInit /c -### -- %s 2>&1 | FileCheck 
-check-prefix=ThreadSafeStatics %s
+// ThreadSafeStatics-NOT: "-fno-threadsafe-statics"
+
+// RUN: %clang_cl /Zc:dllexportInlines- /c -### -- %s 2>&1 | FileCheck 
-check-prefix=NoDllExportInlines %s
+// NoDllExportInlines: "-fno-dllexport-inlines"
+// RUN: %clang_cl /Zc:dllexportInlines /c -### -- %s 2>&1 | FileCheck 
-check-prefix=DllExportInlines %s
+// DllExportInlines-NOT: "-fno-dllexport-inlines"
+
+// We recognize -f[no-]delayed-template-parsing.
+// /Zc:twoPhase[-] has the opposite meaning.
+// RUN: %clang_c

[PATCH] D125889: clang-cl: Move /Zc: tests from cl-options.c to cl-zc.cpp

2022-05-18 Thread Nico Weber 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 rGd39928e2cc39: clang-cl: Move /Zc: tests from cl-options.c to 
cl-zc.cpp (authored by thakis).
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125889

Files:
  clang/test/Driver/cl-options.c
  clang/test/Driver/cl-zc.cpp

Index: clang/test/Driver/cl-zc.cpp
===
--- clang/test/Driver/cl-zc.cpp
+++ clang/test/Driver/cl-zc.cpp
@@ -64,10 +64,54 @@
 // RUN: %clang_cl /c -### /Zc:ternary- -- %s 2>&1 | FileCheck -check-prefix=TERNARY-OFF %s
 // TERNARY-OFF: argument unused during compilation
 
+// thread safe statics are off for versions < 19.
+// RUN: %clang_cl /c -### -fms-compatibility-version=18 -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
+// RUN: %clang_cl /Zc:threadSafeInit /Zc:threadSafeInit- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
+// NoThreadSafeStatics: "-fno-threadsafe-statics"
+
+// RUN: %clang_cl /Zc:threadSafeInit /c -### -- %s 2>&1 | FileCheck -check-prefix=ThreadSafeStatics %s
+// ThreadSafeStatics-NOT: "-fno-threadsafe-statics"
+
+// RUN: %clang_cl /Zc:dllexportInlines- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoDllExportInlines %s
+// NoDllExportInlines: "-fno-dllexport-inlines"
+// RUN: %clang_cl /Zc:dllexportInlines /c -### -- %s 2>&1 | FileCheck -check-prefix=DllExportInlines %s
+// DllExportInlines-NOT: "-fno-dllexport-inlines"
+
+// We recognize -f[no-]delayed-template-parsing.
+// /Zc:twoPhase[-] has the opposite meaning.
+// RUN: %clang_cl -c -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDDEFAULT %s
+// DELAYEDDEFAULT: "-fdelayed-template-parsing"
+// RUN: %clang_cl -c -fdelayed-template-parsing -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDON %s
+// RUN: %clang_cl -c /Zc:twoPhase- -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDON %s
+// DELAYEDON: "-fdelayed-template-parsing"
+// RUN: %clang_cl -c -fno-delayed-template-parsing -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDOFF %s
+// RUN: %clang_cl -c /Zc:twoPhase -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDOFF %s
+// DELAYEDOFF-NOT: "-fdelayed-template-parsing"
+
+// RUN: %clang_cl -c -### /std:c++latest -- %s 2>&1 | FileCheck -check-prefix CHECK-LATEST-CHAR8_T %s
+// CHECK-LATEST-CHAR8_T-NOT: "-fchar8_t"
+// RUN: %clang_cl -c -### /Zc:char8_t -- %s 2>&1 | FileCheck -check-prefix CHECK-CHAR8_T %s
+// CHECK-CHAR8_T: "-fchar8_t"
+// RUN: %clang_cl -c -### /Zc:char8_t- -- %s 2>&1 | FileCheck -check-prefix CHECK-CHAR8_T_ %s
+// CHECK-CHAR8_T_: "-fno-char8_t"
+
+
 
 // These never warn, but don't have an effect yet.
 
-// RUN: %clang_cl /c -### /Zc:rvalueCast -- %s 2>&1 | FileCheck -check-prefix=RVALUECAST-ON %s
-// RVALUECAST-ON-NOT: argument unused during compilation
-// RUN: %clang_cl /c -### /Zc:rvalueCast- -- %s 2>&1 | FileCheck -check-prefix=RVALUECAST-OFF %s
-// RVALUECAST-OFF: argument unused during compilation
+// RUN: %clang_cl /c \
+// RUN:   /Zc:__cplusplus \
+// RUN:   /Zc:auto \
+// RUN:   /Zc:forScope \
+// RUN:   /Zc:inline \
+// RUN:   /Zc:rvalueCast \
+// RUN:   /Zc:ternary \
+// RUN:   -### -- %s 2>&1 | FileCheck -check-prefix=IGNORED %s
+// IGNORED-NOT: argument unused during compilation
+// IGNORED-NOT: no such file or directory
+
+// Negated form warns:
+// RUN: %clang_cl /c \
+// RUN:   /Zc:rvalueCast- \
+// RUN:   -### -- %s 2>&1 | FileCheck -check-prefix=NOTIGNORED %s
+// NOTIGNORED: argument unused during compilation
Index: clang/test/Driver/cl-options.c
===
--- clang/test/Driver/cl-options.c
+++ clang/test/Driver/cl-options.c
@@ -336,24 +336,6 @@
 // RUN: %clang_cl -c -fno-delete-null-pointer-checks -### -- %s 2>&1 | FileCheck -check-prefix=NONULL %s
 // NONULL: "-fno-delete-null-pointer-checks"
 
-// We recognize -f[no-]delayed-template-parsing.
-// /Zc:twoPhase[-] has the opposite meaning.
-// RUN: %clang_cl -c -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDDEFAULT %s
-// DELAYEDDEFAULT: "-fdelayed-template-parsing"
-// RUN: %clang_cl -c -fdelayed-template-parsing -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDON %s
-// RUN: %clang_cl -c /Zc:twoPhase- -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDON %s
-// DELAYEDON: "-fdelayed-template-parsing"
-// RUN: %clang_cl -c -fno-delayed-template-parsing -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDOFF %s
-// RUN: %clang_cl -c /Zc:twoPhase -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDOFF %s
-// DELAYEDOFF-NOT: "-fdelayed-template-parsing"
-
-// RUN: %clang_cl -c -### /std:c++latest -- %s 2>&1 | FileCheck -check-prefix CHECK-LATEST-CHAR8_T %s
-// CHECK-LATEST-CHAR8_T-NOT: "-fchar8_t"
-// RUN: %clang_cl -c -### /Zc:char8_t -- %s 2>&1 | FileCheck -check-prefix CHECK-CHAR8_T %s
-// CHECK-CHAR8_T: "-fchar8_t"
-// RUN

[PATCH] D125892: [analyzer] Implement assumeInclusiveRange in terms of assumeInclusiveRangeDual

2022-05-18 Thread Gabor Marton via Phabricator via cfe-commits
martong created this revision.
martong added reviewers: steakhal, NoQ.
Herald added subscribers: manas, ASDenysPetrov, gamesh411, dkrupp, donat.nagy, 
Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, 
xazax.hun.
Herald added a reviewer: Szelethus.
Herald added a project: All.
martong requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This includes the refactoring of the common assumle*Dual logic into the
function template `assumeDualImpl`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125892

Files:
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h
  
clang/include/clang/StaticAnalyzer/Core/PathSensitive/SimpleConstraintManager.h
  clang/lib/StaticAnalyzer/Core/ConstraintManager.cpp
  clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp

Index: clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp
===
--- clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp
+++ clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp
@@ -91,7 +91,7 @@
   } // end switch
 }
 
-ProgramStateRef SimpleConstraintManager::assumeInclusiveRange(
+ProgramStateRef SimpleConstraintManager::assumeInclusiveRangeInternal(
 ProgramStateRef State, NonLoc Value, const llvm::APSInt &From,
 const llvm::APSInt &To, bool InRange) {
 
Index: clang/lib/StaticAnalyzer/Core/ConstraintManager.cpp
===
--- clang/lib/StaticAnalyzer/Core/ConstraintManager.cpp
+++ clang/lib/StaticAnalyzer/Core/ConstraintManager.cpp
@@ -42,12 +42,14 @@
   return {};
 }
 
+template 
 ConstraintManager::ProgramStatePair
-ConstraintManager::assumeDual(ProgramStateRef State, DefinedSVal Cond) {
-  ProgramStateRef StTrue = assumeInternal(State, Cond, true);
+ConstraintManager::assumeDualImpl(ProgramStateRef &State,
+  AssumeFunction &Assume) {
+  ProgramStateRef StTrue = Assume(true);
 
   if (!StTrue) {
-ProgramStateRef StFalse = assumeInternal(State, Cond, false);
+ProgramStateRef StFalse = Assume(false);
 if (LLVM_UNLIKELY(!StFalse)) { // both infeasible
   ProgramStateRef StInfeasible = State->cloneAsPosteriorlyOverconstrained();
   assert(StInfeasible->isPosteriorlyOverconstrained());
@@ -63,7 +65,7 @@
 return ProgramStatePair(nullptr, StFalse);
   }
 
-  ProgramStateRef StFalse = assumeInternal(State, Cond, false);
+  ProgramStateRef StFalse = Assume(false);
   if (!StFalse) {
 return ProgramStatePair(StTrue, nullptr);
   }
@@ -71,8 +73,35 @@
   return ProgramStatePair(StTrue, StFalse);
 }
 
+ConstraintManager::ProgramStatePair
+ConstraintManager::assumeDual(ProgramStateRef State, DefinedSVal Cond) {
+  auto AssumeFun = [&](bool Assumption) {
+return assumeInternal(State, Cond, Assumption);
+  };
+  return assumeDualImpl(State, AssumeFun);
+}
+
+ConstraintManager::ProgramStatePair
+ConstraintManager::assumeInclusiveRangeDual(ProgramStateRef State, NonLoc Value,
+const llvm::APSInt &From,
+const llvm::APSInt &To) {
+  auto AssumeFun = [&](bool Assumption) {
+return assumeInclusiveRangeInternal(State, Value, From, To, Assumption);
+  };
+  return assumeDualImpl(State, AssumeFun);
+}
+
 ProgramStateRef ConstraintManager::assume(ProgramStateRef State,
   DefinedSVal Cond, bool Assumption) {
   ConstraintManager::ProgramStatePair R = assumeDual(State, Cond);
   return Assumption ? R.first : R.second;
 }
+
+ProgramStateRef
+ConstraintManager::assumeInclusiveRange(ProgramStateRef State, NonLoc Value,
+const llvm::APSInt &From,
+const llvm::APSInt &To, bool InBound) {
+  ConstraintManager::ProgramStatePair R =
+  assumeInclusiveRangeDual(State, Value, From, To);
+  return InBound ? R.first : R.second;
+}
Index: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SimpleConstraintManager.h
===
--- clang/include/clang/StaticAnalyzer/Core/PathSensitive/SimpleConstraintManager.h
+++ clang/include/clang/StaticAnalyzer/Core/PathSensitive/SimpleConstraintManager.h
@@ -39,10 +39,11 @@
   ProgramStateRef assumeInternal(ProgramStateRef State, DefinedSVal Cond,
  bool Assumption) override;
 
-  ProgramStateRef assumeInclusiveRange(ProgramStateRef State, NonLoc Value,
-   const llvm::APSInt &From,
-   const llvm::APSInt &To,
-   bool InRange) override;
+  ProgramStateRef assumeInclusiveRangeInternal(ProgramStateRef State,
+   NonLoc Value,
+   const l

[PATCH] D125886: [RISCV][NFC] Rename variable in RISCVVEmitter.cpp

2022-05-18 Thread Zakk Chen via Phabricator via cfe-commits
khchen accepted this revision.
khchen added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125886

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


[clang] 1467e01 - [RISCV][NFC] Rename variable in RISCVVEmitter.cpp

2022-05-18 Thread Kito Cheng via cfe-commits

Author: Kito Cheng
Date: 2022-05-18T23:14:29+08:00
New Revision: 1467e01f8f699fa2a69937dd07e51325ba71a93b

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

LOG: [RISCV][NFC] Rename variable in RISCVVEmitter.cpp

- Use `Overloaded` rather than `Mangled`.
- Use `Prototype` or `Desc` rather than `Seq`, it's not just a string sequence.
  - `Prototype` for those PrototypeDescriptor will used to evaluate as argument 
type.
  - `Desc` for those PrototypeDescriptor will used to evaluate as part of 
function name.

Reviewed By: khchen

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

Added: 


Modified: 
clang/utils/TableGen/RISCVVEmitter.cpp

Removed: 




diff  --git a/clang/utils/TableGen/RISCVVEmitter.cpp 
b/clang/utils/TableGen/RISCVVEmitter.cpp
index 49282af3cbe4b..dc6cbcbbf4ed5 100644
--- a/clang/utils/TableGen/RISCVVEmitter.cpp
+++ b/clang/utils/TableGen/RISCVVEmitter.cpp
@@ -387,8 +387,8 @@ void RVVEmitter::createRVVIntrinsics(
   for (auto *R : RV) {
 StringRef Name = R->getValueAsString("Name");
 StringRef SuffixProto = R->getValueAsString("Suffix");
-StringRef MangledName = R->getValueAsString("MangledName");
-StringRef MangledSuffixProto = R->getValueAsString("MangledSuffix");
+StringRef OverloadedName = R->getValueAsString("MangledName");
+StringRef OverloadedSuffixProto = R->getValueAsString("MangledSuffix");
 StringRef Prototypes = R->getValueAsString("Prototype");
 StringRef TypeRange = R->getValueAsString("TypeRange");
 bool HasMasked = R->getValueAsBit("HasMasked");
@@ -414,30 +414,30 @@ void RVVEmitter::createRVVIntrinsics(
 unsigned NF = R->getValueAsInt("NF");
 
 // Parse prototype and create a list of primitive type with transformers
-// (operand) in ProtoSeq. ProtoSeq[0] is output operand.
-SmallVector ProtoSeq = parsePrototypes(Prototypes);
+// (operand) in Prototype. Prototype[0] is output operand.
+SmallVector Prototype = parsePrototypes(Prototypes);
 
-SmallVector SuffixProtoSeq =
-parsePrototypes(SuffixProto);
-SmallVector MangledSuffixProtoSeq =
-parsePrototypes(MangledSuffixProto);
+SmallVector SuffixDesc = parsePrototypes(SuffixProto);
+SmallVector OverloadedSuffixDesc =
+parsePrototypes(OverloadedSuffixProto);
 
 // Compute Builtin types
-SmallVector ProtoMaskSeq = ProtoSeq;
+SmallVector MaskedPrototype = Prototype;
 if (HasMasked) {
   // If HasMaskedOffOperand, insert result type as first input operand.
   if (HasMaskedOffOperand) {
 if (NF == 1) {
-  ProtoMaskSeq.insert(ProtoMaskSeq.begin() + 1, ProtoSeq[0]);
+  MaskedPrototype.insert(MaskedPrototype.begin() + 1, Prototype[0]);
 } else {
   // Convert
   // (void, op0 address, op1 address, ...)
   // to
   // (void, op0 address, op1 address, ..., maskedoff0, maskedoff1, ...)
-  PrototypeDescriptor MaskoffType = ProtoSeq[1];
+  PrototypeDescriptor MaskoffType = Prototype[1];
   MaskoffType.TM &= ~static_cast(TypeModifier::Pointer);
   for (unsigned I = 0; I < NF; ++I)
-ProtoMaskSeq.insert(ProtoMaskSeq.begin() + NF + 1, MaskoffType);
+MaskedPrototype.insert(MaskedPrototype.begin() + NF + 1,
+   MaskoffType);
 }
   }
   if (HasMaskedOffOperand && NF > 1) {
@@ -446,18 +446,18 @@ void RVVEmitter::createRVVIntrinsics(
 // to
 // (void, op0 address, op1 address, ..., mask, maskedoff0, maskedoff1,
 // ...)
-ProtoMaskSeq.insert(ProtoMaskSeq.begin() + NF + 1,
-PrototypeDescriptor::Mask);
+MaskedPrototype.insert(MaskedPrototype.begin() + NF + 1,
+   PrototypeDescriptor::Mask);
   } else {
 // If HasMasked, insert PrototypeDescriptor:Mask as first input 
operand.
-ProtoMaskSeq.insert(ProtoMaskSeq.begin() + 1,
-PrototypeDescriptor::Mask);
+MaskedPrototype.insert(MaskedPrototype.begin() + 1,
+   PrototypeDescriptor::Mask);
   }
 }
 // If HasVL, append PrototypeDescriptor:VL to last operand
 if (HasVL) {
-  ProtoSeq.push_back(PrototypeDescriptor::VL);
-  ProtoMaskSeq.push_back(PrototypeDescriptor::VL);
+  Prototype.push_back(PrototypeDescriptor::VL);
+  MaskedPrototype.push_back(PrototypeDescriptor::VL);
 }
 
 // Create Intrinsics for each type and LMUL.
@@ -465,18 +465,17 @@ void RVVEmitter::createRVVIntrinsics(
   for (int Log2LMUL : Log2LMULList) {
 BasicType BT = ParseBasicType(I);
 Optional Types =
-RVVType::computeTypes(BT, Log2LMUL, NF, ProtoSeq);
+RVVType

[PATCH] D125886: [RISCV][NFC] Rename variable in RISCVVEmitter.cpp

2022-05-18 Thread Kito Cheng via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1467e01f8f69: [RISCV][NFC] Rename variable in 
RISCVVEmitter.cpp (authored by kito-cheng).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125886

Files:
  clang/utils/TableGen/RISCVVEmitter.cpp

Index: clang/utils/TableGen/RISCVVEmitter.cpp
===
--- clang/utils/TableGen/RISCVVEmitter.cpp
+++ clang/utils/TableGen/RISCVVEmitter.cpp
@@ -387,8 +387,8 @@
   for (auto *R : RV) {
 StringRef Name = R->getValueAsString("Name");
 StringRef SuffixProto = R->getValueAsString("Suffix");
-StringRef MangledName = R->getValueAsString("MangledName");
-StringRef MangledSuffixProto = R->getValueAsString("MangledSuffix");
+StringRef OverloadedName = R->getValueAsString("MangledName");
+StringRef OverloadedSuffixProto = R->getValueAsString("MangledSuffix");
 StringRef Prototypes = R->getValueAsString("Prototype");
 StringRef TypeRange = R->getValueAsString("TypeRange");
 bool HasMasked = R->getValueAsBit("HasMasked");
@@ -414,30 +414,30 @@
 unsigned NF = R->getValueAsInt("NF");
 
 // Parse prototype and create a list of primitive type with transformers
-// (operand) in ProtoSeq. ProtoSeq[0] is output operand.
-SmallVector ProtoSeq = parsePrototypes(Prototypes);
+// (operand) in Prototype. Prototype[0] is output operand.
+SmallVector Prototype = parsePrototypes(Prototypes);
 
-SmallVector SuffixProtoSeq =
-parsePrototypes(SuffixProto);
-SmallVector MangledSuffixProtoSeq =
-parsePrototypes(MangledSuffixProto);
+SmallVector SuffixDesc = parsePrototypes(SuffixProto);
+SmallVector OverloadedSuffixDesc =
+parsePrototypes(OverloadedSuffixProto);
 
 // Compute Builtin types
-SmallVector ProtoMaskSeq = ProtoSeq;
+SmallVector MaskedPrototype = Prototype;
 if (HasMasked) {
   // If HasMaskedOffOperand, insert result type as first input operand.
   if (HasMaskedOffOperand) {
 if (NF == 1) {
-  ProtoMaskSeq.insert(ProtoMaskSeq.begin() + 1, ProtoSeq[0]);
+  MaskedPrototype.insert(MaskedPrototype.begin() + 1, Prototype[0]);
 } else {
   // Convert
   // (void, op0 address, op1 address, ...)
   // to
   // (void, op0 address, op1 address, ..., maskedoff0, maskedoff1, ...)
-  PrototypeDescriptor MaskoffType = ProtoSeq[1];
+  PrototypeDescriptor MaskoffType = Prototype[1];
   MaskoffType.TM &= ~static_cast(TypeModifier::Pointer);
   for (unsigned I = 0; I < NF; ++I)
-ProtoMaskSeq.insert(ProtoMaskSeq.begin() + NF + 1, MaskoffType);
+MaskedPrototype.insert(MaskedPrototype.begin() + NF + 1,
+   MaskoffType);
 }
   }
   if (HasMaskedOffOperand && NF > 1) {
@@ -446,18 +446,18 @@
 // to
 // (void, op0 address, op1 address, ..., mask, maskedoff0, maskedoff1,
 // ...)
-ProtoMaskSeq.insert(ProtoMaskSeq.begin() + NF + 1,
-PrototypeDescriptor::Mask);
+MaskedPrototype.insert(MaskedPrototype.begin() + NF + 1,
+   PrototypeDescriptor::Mask);
   } else {
 // If HasMasked, insert PrototypeDescriptor:Mask as first input operand.
-ProtoMaskSeq.insert(ProtoMaskSeq.begin() + 1,
-PrototypeDescriptor::Mask);
+MaskedPrototype.insert(MaskedPrototype.begin() + 1,
+   PrototypeDescriptor::Mask);
   }
 }
 // If HasVL, append PrototypeDescriptor:VL to last operand
 if (HasVL) {
-  ProtoSeq.push_back(PrototypeDescriptor::VL);
-  ProtoMaskSeq.push_back(PrototypeDescriptor::VL);
+  Prototype.push_back(PrototypeDescriptor::VL);
+  MaskedPrototype.push_back(PrototypeDescriptor::VL);
 }
 
 // Create Intrinsics for each type and LMUL.
@@ -465,18 +465,17 @@
   for (int Log2LMUL : Log2LMULList) {
 BasicType BT = ParseBasicType(I);
 Optional Types =
-RVVType::computeTypes(BT, Log2LMUL, NF, ProtoSeq);
+RVVType::computeTypes(BT, Log2LMUL, NF, Prototype);
 // Ignored to create new intrinsic if there are any illegal types.
 if (!Types.hasValue())
   continue;
 
-auto SuffixStr =
-RVVIntrinsic::getSuffixStr(BT, Log2LMUL, SuffixProtoSeq);
-auto MangledSuffixStr =
-RVVIntrinsic::getSuffixStr(BT, Log2LMUL, MangledSuffixProtoSeq);
+auto SuffixStr = RVVIntrinsic::getSuffixStr(BT, Log2LMUL, SuffixDesc);
+auto OverloadedSuffixStr =
+RVVIntrinsic::getSuffixStr(BT, Log2LMUL, OverloadedSuffixDesc);
 // Create a unmasked intrinsic
 Out.push_back(std::make_unique(
-Name, SuffixStr, MangledName, Man

[PATCH] D115232: [clangd] Indexing of standard library

2022-05-18 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

In D115232#3520461 , @sammccall wrote:

> Hmm, the test keeps crashing on the GN bot: 
> http://45.33.8.238/win/58316/step_9.txt
> Unfortunately the stacktrace is not symbolized, and I'm not seeing this 
> elsewhere (e.g. premerge bot).
>
> @thakis, any idea why unittests no longer manage to symbolize stack traces on 
> crash on the windows bot? I believe this used to work...

I do not know. Maybe related to the "run many unit tests in a single process" 
lit change from a month ago?

Anyways, looks like this relanded and broke tests yet again. Maybe find a win 
box before relanding the next time?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115232

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


[PATCH] D125893: [RISCV][NFC] Change interface of RVVIntrinsic::getSuffixStr

2022-05-18 Thread Kito Cheng via Phabricator via cfe-commits
kito-cheng created this revision.
kito-cheng added a reviewer: khchen.
Herald added subscribers: sunshaoce, VincentWu, luke957, vkmr, frasercrmck, 
evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, 
jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, 
zzheng, jrtc27, shiva0217, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, 
arichardson.
Herald added a project: All.
kito-cheng requested review of this revision.
Herald added subscribers: cfe-commits, pcwang-thead, eopXD, MaskRay.
Herald added a project: clang.

This NFC patch is splited from D111617 .

Using llvm::ArrayRef rather than llvm::SmallVector, ArrayRef is more generic
interface that could accept both llvm::ArrayRef and llvm::SmallVector.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125893

Files:
  clang/include/clang/Support/RISCVVIntrinsicUtils.h
  clang/lib/Support/RISCVVIntrinsicUtils.cpp


Index: clang/lib/Support/RISCVVIntrinsicUtils.cpp
===
--- clang/lib/Support/RISCVVIntrinsicUtils.cpp
+++ clang/lib/Support/RISCVVIntrinsicUtils.cpp
@@ -928,7 +928,7 @@
 
 std::string RVVIntrinsic::getSuffixStr(
 BasicType Type, int Log2LMUL,
-const llvm::SmallVector &PrototypeDescriptors) {
+const llvm::ArrayRef &PrototypeDescriptors) {
   SmallVector SuffixStrs;
   for (auto PD : PrototypeDescriptors) {
 auto T = RVVType::computeType(Type, Log2LMUL, PD);
Index: clang/include/clang/Support/RISCVVIntrinsicUtils.h
===
--- clang/include/clang/Support/RISCVVIntrinsicUtils.h
+++ clang/include/clang/Support/RISCVVIntrinsicUtils.h
@@ -341,9 +341,10 @@
   // Return the type string for a BUILTIN() macro in Builtins.def.
   std::string getBuiltinTypeStr() const;
 
-  static std::string getSuffixStr(
-  BasicType Type, int Log2LMUL,
-  const llvm::SmallVector &PrototypeDescriptors);
+  static std::string
+  getSuffixStr(BasicType Type, int Log2LMUL,
+   const llvm::ArrayRefSmallVector
+   &PrototypeDescriptors);
 };
 
 } // end namespace RISCV


Index: clang/lib/Support/RISCVVIntrinsicUtils.cpp
===
--- clang/lib/Support/RISCVVIntrinsicUtils.cpp
+++ clang/lib/Support/RISCVVIntrinsicUtils.cpp
@@ -928,7 +928,7 @@
 
 std::string RVVIntrinsic::getSuffixStr(
 BasicType Type, int Log2LMUL,
-const llvm::SmallVector &PrototypeDescriptors) {
+const llvm::ArrayRef &PrototypeDescriptors) {
   SmallVector SuffixStrs;
   for (auto PD : PrototypeDescriptors) {
 auto T = RVVType::computeType(Type, Log2LMUL, PD);
Index: clang/include/clang/Support/RISCVVIntrinsicUtils.h
===
--- clang/include/clang/Support/RISCVVIntrinsicUtils.h
+++ clang/include/clang/Support/RISCVVIntrinsicUtils.h
@@ -341,9 +341,10 @@
   // Return the type string for a BUILTIN() macro in Builtins.def.
   std::string getBuiltinTypeStr() const;
 
-  static std::string getSuffixStr(
-  BasicType Type, int Log2LMUL,
-  const llvm::SmallVector &PrototypeDescriptors);
+  static std::string
+  getSuffixStr(BasicType Type, int Log2LMUL,
+   const llvm::ArrayRefSmallVector
+   &PrototypeDescriptors);
 };
 
 } // end namespace RISCV
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D125770: [clang-tidy] modernize-deprecated-headers should ignore system headers

2022-05-18 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments.



Comment at: 
clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp:37
 
-#include  // FIXME: We should have no warning into system 
headers.
-// CHECK-MESSAGES-WARN-INTO-HEADERS: mysystemlib.h:1:10: warning: inclusion of 
deprecated C++ header 'assert.h'; consider using 'cassert' instead 
[modernize-deprecated-headers]
+#include  // no-warning: Don't warn into system headers.
 

steakhal wrote:
> LegalizeAdulthood wrote:
> > Where is this file?  I can't find it in my tree.
> > 
> > ```
> > D:\legalize\llvm\llvm-project\clang-tools-extra
> > > dir/s/b mysystemlib.h
> > File Not Found
> > ```
> > 
> > Does this patch depend on some other unsubmitted patch?
> D125209 should have included this file at 
> `clang-tools-extra/test/clang-tidy/checkers/Inputs/modernize-deprecated-headers/mysystemlib.h`.
OK, so it depends on D125209  why not just include these small changes in 
that?

Supposedly there is some way in phabricator to make one review dependent on 
another, but instead of being an expert in phabricator this change seems small 
enough to just fold into the other review, but perhaps opinions differ on that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125770

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


[PATCH] D125874: [clang-tidy] Fix readability-simplify-boolean-expr when Ifs have an init statement or condition variable

2022-05-18 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood accepted this revision.
LegalizeAdulthood added a comment.
This revision is now accepted and ready to land.

Good catch!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125874

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


[PATCH] D125871: [analyzer] Delete alpha.deadcode.UnreachableCode checker

2022-05-18 Thread Gabor Marton via Phabricator via cfe-commits
martong marked an inline comment as done.
martong added a comment.

In D125871#3521967 , @steakhal wrote:

> Could you please give a few examples of these FPs for the record?

Out of thin air I could come up with the following one below. Seems like `try` 
is not handled, but it is not attached to the fact of being non full-path. 
Maybe I was in too much rush, perhaps we should leave this checker here.
F23106602: image.png 

Besides, there is an annoying true positive which should be suppressed IMHO.
F23106640: image.png 




Comment at: clang/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp:53-54
-
-  if (Eng.hasWorkRemaining())
-return;
-

steakhal wrote:
> I thought this check guards this checker to be meaningful. @martong
To be honest, I missed this. So, at least the checker does not report, when the 
budge is out, i.e. when we definitely know for sure that we could not explore 
the whole graph. 

On the other hand, even if there is no work remaining for the engine, we still 
cannot be sure that all theoretical program paths have been covered can we?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125871

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


[PATCH] D125893: [RISCV][NFC] Change interface of RVVIntrinsic::getSuffixStr

2022-05-18 Thread Kito Cheng via Phabricator via cfe-commits
kito-cheng updated this revision to Diff 430390.
kito-cheng added a comment.

Changes:

- Fix dumb typo...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125893

Files:
  clang/include/clang/Support/RISCVVIntrinsicUtils.h
  clang/lib/Support/RISCVVIntrinsicUtils.cpp


Index: clang/lib/Support/RISCVVIntrinsicUtils.cpp
===
--- clang/lib/Support/RISCVVIntrinsicUtils.cpp
+++ clang/lib/Support/RISCVVIntrinsicUtils.cpp
@@ -928,7 +928,7 @@
 
 std::string RVVIntrinsic::getSuffixStr(
 BasicType Type, int Log2LMUL,
-const llvm::SmallVector &PrototypeDescriptors) {
+const llvm::ArrayRef &PrototypeDescriptors) {
   SmallVector SuffixStrs;
   for (auto PD : PrototypeDescriptors) {
 auto T = RVVType::computeType(Type, Log2LMUL, PD);
Index: clang/include/clang/Support/RISCVVIntrinsicUtils.h
===
--- clang/include/clang/Support/RISCVVIntrinsicUtils.h
+++ clang/include/clang/Support/RISCVVIntrinsicUtils.h
@@ -305,13 +305,15 @@
   unsigned NF = 1;
 
 public:
-  RVVIntrinsic(llvm::StringRef Name, llvm::StringRef Suffix, llvm::StringRef 
MangledName,
-   llvm::StringRef MangledSuffix, llvm::StringRef IRName, bool 
IsMasked,
-   bool HasMaskedOffOperand, bool HasVL, PolicyScheme Scheme,
-   bool HasUnMaskedOverloaded, bool HasBuiltinAlias,
-   llvm::StringRef ManualCodegen, const RVVTypes &Types,
+  RVVIntrinsic(llvm::StringRef Name, llvm::StringRef Suffix,
+   llvm::StringRef MangledName, llvm::StringRef MangledSuffix,
+   llvm::StringRef IRName, bool IsMasked, bool HasMaskedOffOperand,
+   bool HasVL, PolicyScheme Scheme, bool HasUnMaskedOverloaded,
+   bool HasBuiltinAlias, llvm::StringRef ManualCodegen,
+   const RVVTypes &Types,
const std::vector &IntrinsicTypes,
-   const std::vector &RequiredFeatures, unsigned 
NF);
+   const std::vector &RequiredFeatures,
+   unsigned NF);
   ~RVVIntrinsic() = default;
 
   RVVTypePtr getOutputType() const { return OutputType; }
@@ -341,9 +343,9 @@
   // Return the type string for a BUILTIN() macro in Builtins.def.
   std::string getBuiltinTypeStr() const;
 
-  static std::string getSuffixStr(
-  BasicType Type, int Log2LMUL,
-  const llvm::SmallVector &PrototypeDescriptors);
+  static std::string
+  getSuffixStr(BasicType Type, int Log2LMUL,
+   const llvm::ArrayRef 
&PrototypeDescriptors);
 };
 
 } // end namespace RISCV


Index: clang/lib/Support/RISCVVIntrinsicUtils.cpp
===
--- clang/lib/Support/RISCVVIntrinsicUtils.cpp
+++ clang/lib/Support/RISCVVIntrinsicUtils.cpp
@@ -928,7 +928,7 @@
 
 std::string RVVIntrinsic::getSuffixStr(
 BasicType Type, int Log2LMUL,
-const llvm::SmallVector &PrototypeDescriptors) {
+const llvm::ArrayRef &PrototypeDescriptors) {
   SmallVector SuffixStrs;
   for (auto PD : PrototypeDescriptors) {
 auto T = RVVType::computeType(Type, Log2LMUL, PD);
Index: clang/include/clang/Support/RISCVVIntrinsicUtils.h
===
--- clang/include/clang/Support/RISCVVIntrinsicUtils.h
+++ clang/include/clang/Support/RISCVVIntrinsicUtils.h
@@ -305,13 +305,15 @@
   unsigned NF = 1;
 
 public:
-  RVVIntrinsic(llvm::StringRef Name, llvm::StringRef Suffix, llvm::StringRef MangledName,
-   llvm::StringRef MangledSuffix, llvm::StringRef IRName, bool IsMasked,
-   bool HasMaskedOffOperand, bool HasVL, PolicyScheme Scheme,
-   bool HasUnMaskedOverloaded, bool HasBuiltinAlias,
-   llvm::StringRef ManualCodegen, const RVVTypes &Types,
+  RVVIntrinsic(llvm::StringRef Name, llvm::StringRef Suffix,
+   llvm::StringRef MangledName, llvm::StringRef MangledSuffix,
+   llvm::StringRef IRName, bool IsMasked, bool HasMaskedOffOperand,
+   bool HasVL, PolicyScheme Scheme, bool HasUnMaskedOverloaded,
+   bool HasBuiltinAlias, llvm::StringRef ManualCodegen,
+   const RVVTypes &Types,
const std::vector &IntrinsicTypes,
-   const std::vector &RequiredFeatures, unsigned NF);
+   const std::vector &RequiredFeatures,
+   unsigned NF);
   ~RVVIntrinsic() = default;
 
   RVVTypePtr getOutputType() const { return OutputType; }
@@ -341,9 +343,9 @@
   // Return the type string for a BUILTIN() macro in Builtins.def.
   std::string getBuiltinTypeStr() const;
 
-  static std::string getSuffixStr(
-  BasicType Type, int Log2LMUL,
-  const llvm::SmallVector &PrototypeDescriptors);
+  static std::string
+  getSuffixStr(BasicType Type, int Log2LMUL,
+   const llvm::ArrayRef &PrototypeDescriptors);
 

[PATCH] D125877: [clang-tidy] Fix readability-simplify-boolean-expr crash with implicit cast in return.

2022-05-18 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood accepted this revision.
LegalizeAdulthood added a comment.
This revision is now accepted and ready to land.

Another good catch!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125877

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


[PATCH] D125885: [clang-tidy] bugprone-argument-comment: Ignore calls to user-defined literals

2022-05-18 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood accepted this revision.
LegalizeAdulthood added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125885

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


[PATCH] D125893: [RISCV][NFC] Change interface of RVVIntrinsic::getSuffixStr

2022-05-18 Thread Kito Cheng via Phabricator via cfe-commits
kito-cheng updated this revision to Diff 430391.
kito-cheng added a comment.

Changes:

- clang-format has applied on unexpected part, remove that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125893

Files:
  clang/include/clang/Support/RISCVVIntrinsicUtils.h
  clang/lib/Support/RISCVVIntrinsicUtils.cpp


Index: clang/lib/Support/RISCVVIntrinsicUtils.cpp
===
--- clang/lib/Support/RISCVVIntrinsicUtils.cpp
+++ clang/lib/Support/RISCVVIntrinsicUtils.cpp
@@ -928,7 +928,7 @@
 
 std::string RVVIntrinsic::getSuffixStr(
 BasicType Type, int Log2LMUL,
-const llvm::SmallVector &PrototypeDescriptors) {
+const llvm::ArrayRef &PrototypeDescriptors) {
   SmallVector SuffixStrs;
   for (auto PD : PrototypeDescriptors) {
 auto T = RVVType::computeType(Type, Log2LMUL, PD);
Index: clang/include/clang/Support/RISCVVIntrinsicUtils.h
===
--- clang/include/clang/Support/RISCVVIntrinsicUtils.h
+++ clang/include/clang/Support/RISCVVIntrinsicUtils.h
@@ -341,9 +341,9 @@
   // Return the type string for a BUILTIN() macro in Builtins.def.
   std::string getBuiltinTypeStr() const;
 
-  static std::string getSuffixStr(
-  BasicType Type, int Log2LMUL,
-  const llvm::SmallVector &PrototypeDescriptors);
+  static std::string
+  getSuffixStr(BasicType Type, int Log2LMUL,
+   const llvm::ArrayRef 
&PrototypeDescriptors);
 };
 
 } // end namespace RISCV


Index: clang/lib/Support/RISCVVIntrinsicUtils.cpp
===
--- clang/lib/Support/RISCVVIntrinsicUtils.cpp
+++ clang/lib/Support/RISCVVIntrinsicUtils.cpp
@@ -928,7 +928,7 @@
 
 std::string RVVIntrinsic::getSuffixStr(
 BasicType Type, int Log2LMUL,
-const llvm::SmallVector &PrototypeDescriptors) {
+const llvm::ArrayRef &PrototypeDescriptors) {
   SmallVector SuffixStrs;
   for (auto PD : PrototypeDescriptors) {
 auto T = RVVType::computeType(Type, Log2LMUL, PD);
Index: clang/include/clang/Support/RISCVVIntrinsicUtils.h
===
--- clang/include/clang/Support/RISCVVIntrinsicUtils.h
+++ clang/include/clang/Support/RISCVVIntrinsicUtils.h
@@ -341,9 +341,9 @@
   // Return the type string for a BUILTIN() macro in Builtins.def.
   std::string getBuiltinTypeStr() const;
 
-  static std::string getSuffixStr(
-  BasicType Type, int Log2LMUL,
-  const llvm::SmallVector &PrototypeDescriptors);
+  static std::string
+  getSuffixStr(BasicType Type, int Log2LMUL,
+   const llvm::ArrayRef &PrototypeDescriptors);
 };
 
 } // end namespace RISCV
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D125604: [FileCheck] Catch missspelled directives.

2022-05-18 Thread Ivan Kosarev via Phabricator via cfe-commits
kosarev updated this revision to Diff 430392.
kosarev added a comment.
Herald added a project: Flang.

Added Flang fixes and rebased.

Thanks Simon for the quick turnaround!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125604

Files:
  clang/test/CodeGen/cmse-clear-return.c
  clang/test/CodeGenCXX/attr-mustprogress.cpp
  clang/test/CodeGenCXX/eh-aggregate-copy-destroy.cpp
  clang/test/CodeGenCXX/inheriting-constructor.cpp
  clang/test/CodeGenObjC/non-runtime-protocol.m
  clang/test/OpenMP/master_taskloop_private_codegen.cpp
  clang/test/OpenMP/master_taskloop_simd_private_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_private_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_private_codegen.cpp
  clang/test/OpenMP/task_private_codegen.cpp
  clang/test/OpenMP/taskgroup_task_reduction_codegen.cpp
  clang/test/OpenMP/taskloop_private_codegen.cpp
  clang/test/OpenMP/taskloop_simd_private_codegen.cpp
  flang/test/Fir/convert-to-llvm.fir
  flang/test/Lower/Intrinsics/not.f90
  llvm/include/llvm/FileCheck/FileCheck.h
  llvm/lib/FileCheck/FileCheck.cpp
  llvm/test/Analysis/MemorySSA/phi-translation.ll
  llvm/test/Analysis/RegionInfo/infinite_loop_4.ll
  llvm/test/CodeGen/AMDGPU/divergence-driven-bfe-isel.ll
  llvm/test/CodeGen/AMDGPU/hoist-cond.ll
  llvm/test/CodeGen/AMDGPU/llvm.amdgcn.ps.live.ll
  llvm/test/CodeGen/AMDGPU/mode-register.mir
  llvm/test/CodeGen/AMDGPU/phi-vgpr-input-moveimm.mir
  llvm/test/CodeGen/AMDGPU/smrd.ll
  llvm/test/CodeGen/ARM/cmpxchg-O0-be.ll
  llvm/test/CodeGen/AVR/atomics/fence.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-middle-chain.ll
  llvm/test/CodeGen/MIR/AMDGPU/extra-imm-operand.mir
  llvm/test/CodeGen/MIR/AMDGPU/extra-reg-operand.mir
  llvm/test/CodeGen/WebAssembly/libcalls.ll
  llvm/test/DebugInfo/NVPTX/debug-info.ll
  llvm/test/FileCheck/missspelled-directive.txt
  llvm/test/MC/AMDGPU/data.s
  llvm/test/MC/AsmParser/directive_file-g.s
  llvm/test/MC/PowerPC/ppc64-reloc-directive-pcrel.s
  llvm/test/MC/WebAssembly/unnamed-data.ll
  llvm/test/Transforms/Inline/inline-strictfp.ll
  llvm/test/Transforms/LoopVectorize/X86/gather-vs-interleave.ll
  llvm/test/Transforms/MergeFunc/alias.ll
  llvm/test/Transforms/PGOProfile/PR41279.ll
  llvm/test/Transforms/PGOProfile/memop_clone.ll
  llvm/test/Transforms/PGOProfile/memop_size_from_strlen.ll
  llvm/test/tools/llvm-dwp/X86/tu_units_v5.s
  llvm/test/tools/llvm-dwp/X86/type_dedup_v5.test
  llvm/test/tools/llvm-objdump/MachO/disassemble-all.test
  llvm/test/tools/llvm-readobj/COFF/unwind-arm64-windows.test
  mlir/test/Conversion/MemRefToSPIRV/alloc.mlir
  mlir/test/Dialect/Affine/loop-coalescing.mlir
  mlir/test/Dialect/Linalg/fuse-with-reshape-by-collapsing.mlir
  mlir/test/Dialect/Linalg/tile-and-fuse-no-fuse.mlir
  mlir/test/Dialect/MemRef/canonicalize.mlir
  mlir/test/Dialect/SPIRV/IR/memory-ops.mlir
  mlir/test/Dialect/Vector/vector-transfer-full-partial-split.mlir
  mlir/test/IR/dynamic.mlir
  mlir/test/mlir-tblgen/op-decl-and-defs.td
  polly/test/ScopDetect/dot-scops-npm.ll

Index: polly/test/ScopDetect/dot-scops-npm.ll
===
--- polly/test/ScopDetect/dot-scops-npm.ll
+++ polly/test/ScopDetect/dot-scops-npm.ll
@@ -30,35 +30,35 @@
 ; CHECK-NEXT: Node0x[[OUTER_EXIT]] -> Node0x[[RETURN_ID:.*]];
 ; CHECK-NEXT: Node0x[[RETURN_ID]] [shape=record,label="{return:
 ; CHECK-NEXT: colorscheme = "paired12"
-; CHECK_NEXT: subgraph cluster_0x[[:.*]] {
-; CHECK_NEXT: label = "";
-; CHECK_NEXT: style = solid;
-; CHECK_NEXT: color = 1
-; CHECK_NEXT: subgraph cluster_0x[[:.*]] {
-; CHECK_NEXT: label = "";
-; CHECK_NEXT: style = filled;
-; CHECK_NEXT: color = 3subgraph cluster_0x7152c40 {
-; CHECK_NEXT: label = "";
-; CHECK_NEXT: style = solid;
-; CHECK_NEXT: color = 5
-; CHECK_NEXT: subgraph cluster_0x[[:.*]] {
-; CHECK_NEXT: label = "";
-; CHECK_NEXT: style = solid;
-; CHECK_NEXT: color = 7
-; CHECK_NEXT: Node0x[[INNER_FOR_ID]];
-; CHECK_NEXT: Node0x[[BABY1_ID]];
-; CHECK_NEXT: Node0x[[INNER_INC_ID]];
-; CHECK_NEXT: }
-; CHECK_NEXT: Node0x[[OUTER_FOR_ID]];
-; CHECK_NEXT: Node0x[[INNER_EXIT_ID]];
-; CHECK_NEXT: Node0x[[OUTER_INC_ID]];
-; CHECK_NEXT: }
-; CHECK_NEXT: Node0x[[OUTER_EXIT]];
-; CHECK_NEXT: }
-; CHECK_NEXT: Node0x[[EntryID]];
-; CHECK_NEXT: Node0x[[RETURN_ID]];
-; CHECK_NEXT: }
-; CHECK_NEXT: }
+; CHECK-NEXT: subgraph cluster_0x{{.*}} {
+; CHECK-NEXT: label = "";
+; CHECK-NEXT: style = solid;
+; CHECK-NEXT: color = 1
+; CHECK-NEXT: subgraph cluster_0x{{.*}} {
+; CHECK-NEXT: label = "";
+; CHECK-NEXT: style = filled;
+; CHECK-NEXT: color = 3subgraph cluster_0x{{.*}} {
+; CHECK-NEXT: label = "";
+; CHECK-NEXT: style = solid;
+; CHECK-NEXT: color = 5
+; CHECK-NEXT: subgraph cluster_0x{{.*}} {
+; CHECK-NEXT: label = "";
+; CHECK-NEXT: style = solid;
+; CHECK-NEXT: color = 7
+; CHECK-NEXT: Node0x[[INNER_FOR_ID]];
+; CHECK-NEXT: Node0x[[BABY1_ID]];
+;

  1   2   3   >