[PATCH] D151620: [clang-repl] Fix REPL_EXTERNAL_VISIBILITY and building libclang-cpp.dll for MinGW configurations

2023-05-28 Thread Jun Zhang via Phabricator via cfe-commits
junaire accepted this revision.
junaire 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/D151620/new/

https://reviews.llvm.org/D151620

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


[clang] 9efa4cd - [Clang][RISCV] Reduce boilerplate under RVVEmitter::createHeader. NFC

2023-05-28 Thread via cfe-commits

Author: eopXD
Date: 2023-05-28T01:29:49-07:00
New Revision: 9efa4cdb5169ef77e6250473574980e7438fcf42

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

LOG: [Clang][RISCV] Reduce boilerplate under RVVEmitter::createHeader. NFC

Signed-off by: eop Chen 

Added: 


Modified: 
clang/utils/TableGen/RISCVVEmitter.cpp

Removed: 




diff  --git a/clang/utils/TableGen/RISCVVEmitter.cpp 
b/clang/utils/TableGen/RISCVVEmitter.cpp
index c9f454a4ea323..35b2203cecf34 100644
--- a/clang/utils/TableGen/RISCVVEmitter.cpp
+++ b/clang/utils/TableGen/RISCVVEmitter.cpp
@@ -377,25 +377,13 @@ void RVVEmitter::createHeader(raw_ostream &OS) {
 }
   }
 
-  for (int Log2LMUL : Log2LMULs) {
-auto T = TypeCache.computeType(BasicType::Float16, Log2LMUL,
-   PrototypeDescriptor::Vector);
-if (T)
-  printType(*T);
-  }
-
-  for (int Log2LMUL : Log2LMULs) {
-auto T = TypeCache.computeType(BasicType::Float32, Log2LMUL,
-   PrototypeDescriptor::Vector);
-if (T)
-  printType(*T);
-  }
-
-  for (int Log2LMUL : Log2LMULs) {
-auto T = TypeCache.computeType(BasicType::Float64, Log2LMUL,
-   PrototypeDescriptor::Vector);
-if (T)
-  printType(*T);
+  for (BasicType BT :
+   {BasicType::Float16, BasicType::Float32, BasicType::Float64}) {
+for (int Log2LMUL : Log2LMULs) {
+  auto T = TypeCache.computeType(BT, Log2LMUL, 
PrototypeDescriptor::Vector);
+  if (T)
+printType(*T);
+}
   }
 
   OS << "#define __riscv_v_intrinsic_overloading 1\n";



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


[PATCH] D150579: [*]: fix syntax errors in HTML files

2023-05-28 Thread Mohammed Keyvanzadeh via Phabricator via cfe-commits
VoltrexMaster updated this revision to Diff 526316.
VoltrexMaster added a comment.

Pull upstream changes to fix build failures


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150579

Files:
  clang-tools-extra/docs/_templates/clangd_redirect.html
  clang/docs/LibASTMatchersReference.html
  clang/www/OpenProjects.html
  clang/www/analyzer/alpha_checks.html
  clang/www/analyzer/available_checks.html
  clang/www/analyzer/checker_dev_manual.html
  clang/www/analyzer/codechecker.html
  clang/www/analyzer/command-line.html
  clang/www/analyzer/faq.html
  clang/www/analyzer/implicit_checks.html
  clang/www/analyzer/open_projects.html
  clang/www/analyzer/potential_checkers.html
  clang/www/analyzer/release_notes.html
  clang/www/analyzer/scan-build.html
  clang/www/c_dr_status.html
  clang/www/c_status.html
  clang/www/compatibility.html
  clang/www/cxx_status.html
  clang/www/diagnostics.html
  compiler-rt/www/index.html
  libclc/www/index.html
  llvm/test/tools/llvm-original-di-preservation/Inputs/expected-compressed.html
  llvm/test/tools/llvm-original-di-preservation/Inputs/expected-sample.html
  llvm/test/tools/llvm-original-di-preservation/Inputs/expected-skipped.html
  llvm/test/tools/opt-viewer/Outputs/basic/basic_or.c.html
  llvm/test/tools/opt-viewer/Outputs/basic/basic_or.h.html
  llvm/test/tools/opt-viewer/Outputs/basic/index.html
  llvm/test/tools/opt-viewer/Outputs/filter/basic_or.c.html
  llvm/test/tools/opt-viewer/Outputs/filter/basic_or.h.html
  llvm/test/tools/opt-viewer/Outputs/filter/index.html
  llvm/test/tools/opt-viewer/Outputs/suppress/index.html
  llvm/test/tools/opt-viewer/Outputs/suppress/s.swift.html
  llvm/test/tools/opt-viewer/Outputs/unicode-function-name/index.html
  llvm/test/tools/opt-viewer/Outputs/unicode-function-name/s.swift.html
  llvm/tools/opt-viewer/opt-viewer.py
  llvm/utils/llvm-original-di-preservation.py
  polly/www/changelog.html
  polly/www/get_started.html
  polly/www/index.html
  polly/www/publications.html
  polly/www/todo.html

Index: polly/www/todo.html
===
--- polly/www/todo.html
+++ polly/www/todo.html
@@ -24,7 +24,7 @@
 Phase 1 - Get Something Working (Finished October 2010)
 
 
- Individual Phases
+ Individual Phases
 
  Phase 4
 
@@ -43,6 +43,7 @@
 
 
 
+
      - Add isl C++ bindings generator to isl
  Open
 
@@ -60,6 +61,7 @@
 
 
 
+
      - Optimize isl_int for small integers
  Done
 
@@ -71,6 +73,7 @@
 
 
 
+
      - Reconsider pass-ordering (move Polly later)
  Open
 
@@ -182,7 +185,7 @@
 integer wrapping
  Done
  Johannes
-
 
  
  Optimize Julia
@@ -194,6 +197,7 @@
Owner 
 
 
+
 
 Integrate Polly into Julia
  Open
@@ -211,6 +215,7 @@
 
 
 
+
      - Actually eliminate statements
  Done
 
@@ -226,6 +231,7 @@
Owner 
 
 
+
 
 Multi-level tiling
  Open
@@ -243,6 +249,7 @@
  Done
 
 
+
 
 Loop interchange after vectorization to maximize stride-one accesses
  Open
@@ -431,7 +438,7 @@
 
  Tobias, Andreas
 
-
+
 
 
 
@@ -553,36 +560,37 @@
Owner 
 
 
+
  Region detection
- Done
+ Done
 Ether
 
 
  Access Functions
- Done
+ Done
 John, Ether
 
 
  Alias sets
- Done
+ Done
 Ether
 
 
  Scalar evolution to affine expression
- Done
+ Done
 
 
 Ether
 
 
  SCoP extraction
- Done
+ Done
 Tobias, Ether
 
 
 
  SCoPs to polyhedral model
- Done
+ Done
 Tobias, Ether
 
  
@@ -594,7 +602,7 @@
 
 
  Define polyhedral description
- Done
+ Done
 Tobias
 
 
@@ -607,7 +615,7 @@
 
 
  Create LLVM-IR using CLooG
- Done
+ Done
  Tobias
 
 
@@ -621,12 +629,12 @@
 
  Setup git repositories
 
- Done
+ Done
  Tobias
 
 
  Add CLooG/isl to build system
- Done
+ Done
  Tobias
 
 
Index: polly/www/publications.html
===
--- polly/www/publications.html
+++ polly/www/publications.html
@@ -183,7 +183,7 @@
   Muthu Manikandan Baskaran, J. Ramanujam and P. Sadayappan
   CC 2010
   
-  Putting Automatic Polyhedral Compilation for GPGPU to Work
+  Putting Automatic Polyhedral Compilation for GPGPU to Work
   Soufiane Baghdadi, Armin Größlinger, and Albert Cohen. 
   In Proc. of Compilers for Parallel Computers (CPC), 2010.
   
Index: polly/www/index.html
===
--- polly/www/index.html
+++ polly/www/index.html
@@ -57,6 +57,7 @@
 The performance evaluation of GEMM
 
   
+  
   2017
   January
   
@@ -95,23 +96,23 @@
   Schedule trees: A tree-based mathematical program description
   that enables us to perform loop transformations on an abstract level,
   while issues like the generation of the correct loop structure and loop
-  bounds will be taken care of by our AST generator.
+  bounds will be taken care of by our AST generator.
   Polyhedral unrolling: We discuss techniques that allow the
   unrolling of non-trivial loops in the context of parameteric loop bounds,
   co

[PATCH] D151627: [clang][c++20][NFC] `ComparisonCategoryType` - updated comment, removed `std:*_equality`

2023-05-28 Thread Hristo Hristov via Phabricator via cfe-commits
H-G-Hristov created this revision.
Herald added a project: All.
H-G-Hristov requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

`weak_equality` and `strong_equality` are removed from the standard:

- https://wg21.link/P1959R0
- https://eel.is/c++draft/cmp.categories.pre


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151627

Files:
  clang/include/clang/AST/ComparisonCategories.h


Index: clang/include/clang/AST/ComparisonCategories.h
===
--- clang/include/clang/AST/ComparisonCategories.h
+++ clang/include/clang/AST/ComparisonCategories.h
@@ -39,9 +39,8 @@
 /// An enumeration representing the different comparison categories
 /// types.
 ///
-/// C++2a [cmp.categories.pre] The types weak_equality, strong_equality,
-/// partial_ordering, weak_ordering, and strong_ordering are collectively
-/// termed the comparison category types.
+/// C++20 [cmp.categories.pre] The types partial_ordering, weak_ordering, and
+/// strong_ordering are collectively termed the comparison category types.
 enum class ComparisonCategoryType : unsigned char {
   PartialOrdering,
   WeakOrdering,


Index: clang/include/clang/AST/ComparisonCategories.h
===
--- clang/include/clang/AST/ComparisonCategories.h
+++ clang/include/clang/AST/ComparisonCategories.h
@@ -39,9 +39,8 @@
 /// An enumeration representing the different comparison categories
 /// types.
 ///
-/// C++2a [cmp.categories.pre] The types weak_equality, strong_equality,
-/// partial_ordering, weak_ordering, and strong_ordering are collectively
-/// termed the comparison category types.
+/// C++20 [cmp.categories.pre] The types partial_ordering, weak_ordering, and
+/// strong_ordering are collectively termed the comparison category types.
 enum class ComparisonCategoryType : unsigned char {
   PartialOrdering,
   WeakOrdering,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 592e935 - [clang-repl] Fix REPL_EXTERNAL_VISIBILITY and building libclang-cpp.dll for MinGW configurations

2023-05-28 Thread Martin Storsjö via cfe-commits

Author: Martin Storsjö
Date: 2023-05-28T13:16:53+03:00
New Revision: 592e935e115ffb451eb9b782376711dab6558fe0

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

LOG: [clang-repl] Fix REPL_EXTERNAL_VISIBILITY and building libclang-cpp.dll 
for MinGW configurations

This fixes two issues that are observed after
5111286f06e1e10f24745007a45a830760f1790c:

For builds with GCC with LLVM_LINK_LLVM_DYLIB=ON, we previously got
build errors, as libclang-cpp.dll suddenly only contained the
functions that were marked dllexport via REPL_EXTERNAL_VISIBILITY,
instead of all symbols as expected.

For MinGW builds with Clang, building previously succeeded (as it
used either the __attribute__((visibility("default"))) annotation or
nothing at all), and the functions were exported from libclang-cpp.dll
if that was built, but the unit test failed (as neither of those cases
made the functions exported from an EXE).

Don't use the visibility attributes on MinGW targets for these purposes;
setting default visibility only makes a difference if building with
e.g. -fvisibility=hidden, but it doesn't make the symbols exported
from an EXE.

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

Added: 


Modified: 
clang/include/clang/Interpreter/Value.h
clang/tools/clang-shlib/CMakeLists.txt

Removed: 




diff  --git a/clang/include/clang/Interpreter/Value.h 
b/clang/include/clang/Interpreter/Value.h
index 4df4367030ecd..c380cd91550de 100644
--- a/clang/include/clang/Interpreter/Value.h
+++ b/clang/include/clang/Interpreter/Value.h
@@ -52,18 +52,24 @@ class ASTContext;
 class Interpreter;
 class QualType;
 
-#if __has_attribute(visibility) && 
\
-(!(defined(_WIN32) || defined(__CYGWIN__)) ||  
\
- (defined(__MINGW32__) && defined(__clang__)))
+#if defined(_WIN32)
+// REPL_EXTERNAL_VISIBILITY are symbols that we need to be able to locate
+// at runtime. On Windows, this requires them to be exported from any of the
+// modules loaded at runtime. Marking them as dllexport achieves this; both
+// for DLLs (that normally export symbols as part of their interface) and for
+// EXEs (that normally don't export anything).
+// For a build with libclang-cpp.dll, this doesn't make any 
diff erence - the
+// functions would have been exported anyway. But for cases when these are
+// statically linked into an EXE, it makes sure that they're exported.
+#define REPL_EXTERNAL_VISIBILITY __declspec(dllexport)
+#elif __has_attribute(visibility)
 #if defined(LLVM_BUILD_LLVM_DYLIB) || defined(LLVM_BUILD_SHARED_LIBS)
 #define REPL_EXTERNAL_VISIBILITY __attribute__((visibility("default")))
 #else
 #define REPL_EXTERNAL_VISIBILITY
 #endif
 #else
-#if defined(_WIN32)
-#define REPL_EXTERNAL_VISIBILITY __declspec(dllexport)
-#endif
+#define REPL_EXTERNAL_VISIBILITY
 #endif
 
 #define REPL_BUILTIN_TYPES 
\

diff  --git a/clang/tools/clang-shlib/CMakeLists.txt 
b/clang/tools/clang-shlib/CMakeLists.txt
index de9daba6716a9..aa7fcd1efed45 100644
--- a/clang/tools/clang-shlib/CMakeLists.txt
+++ b/clang/tools/clang-shlib/CMakeLists.txt
@@ -53,3 +53,11 @@ add_clang_library(clang-cpp
 if (NOT APPLE AND NOT MINGW)
   target_link_options(clang-cpp PRIVATE LINKER:-Bsymbolic-functions)
 endif()
+if (MINGW OR CYGWIN)
+  # The clang-cpp DLL is supposed to export all symbols (except for ones
+  # that are explicitly hidden). Normally, this is what happens anyway, but
+  # if there are symbols that are marked explicitly as dllexport, we'd only
+  # export them and nothing else. Therefore, add --export-all-symbols to
+  # make sure we export all symbols despite potential dllexports.
+  target_link_options(clang-cpp PRIVATE LINKER:--export-all-symbols)
+endif()



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


[PATCH] D151620: [clang-repl] Fix REPL_EXTERNAL_VISIBILITY and building libclang-cpp.dll for MinGW configurations

2023-05-28 Thread Martin Storsjö via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG592e935e115f: [clang-repl] Fix REPL_EXTERNAL_VISIBILITY and 
building libclang-cpp.dll for… (authored by mstorsjo).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151620

Files:
  clang/include/clang/Interpreter/Value.h
  clang/tools/clang-shlib/CMakeLists.txt


Index: clang/tools/clang-shlib/CMakeLists.txt
===
--- clang/tools/clang-shlib/CMakeLists.txt
+++ clang/tools/clang-shlib/CMakeLists.txt
@@ -53,3 +53,11 @@
 if (NOT APPLE AND NOT MINGW)
   target_link_options(clang-cpp PRIVATE LINKER:-Bsymbolic-functions)
 endif()
+if (MINGW OR CYGWIN)
+  # The clang-cpp DLL is supposed to export all symbols (except for ones
+  # that are explicitly hidden). Normally, this is what happens anyway, but
+  # if there are symbols that are marked explicitly as dllexport, we'd only
+  # export them and nothing else. Therefore, add --export-all-symbols to
+  # make sure we export all symbols despite potential dllexports.
+  target_link_options(clang-cpp PRIVATE LINKER:--export-all-symbols)
+endif()
Index: clang/include/clang/Interpreter/Value.h
===
--- clang/include/clang/Interpreter/Value.h
+++ clang/include/clang/Interpreter/Value.h
@@ -52,18 +52,24 @@
 class Interpreter;
 class QualType;
 
-#if __has_attribute(visibility) && 
\
-(!(defined(_WIN32) || defined(__CYGWIN__)) ||  
\
- (defined(__MINGW32__) && defined(__clang__)))
+#if defined(_WIN32)
+// REPL_EXTERNAL_VISIBILITY are symbols that we need to be able to locate
+// at runtime. On Windows, this requires them to be exported from any of the
+// modules loaded at runtime. Marking them as dllexport achieves this; both
+// for DLLs (that normally export symbols as part of their interface) and for
+// EXEs (that normally don't export anything).
+// For a build with libclang-cpp.dll, this doesn't make any difference - the
+// functions would have been exported anyway. But for cases when these are
+// statically linked into an EXE, it makes sure that they're exported.
+#define REPL_EXTERNAL_VISIBILITY __declspec(dllexport)
+#elif __has_attribute(visibility)
 #if defined(LLVM_BUILD_LLVM_DYLIB) || defined(LLVM_BUILD_SHARED_LIBS)
 #define REPL_EXTERNAL_VISIBILITY __attribute__((visibility("default")))
 #else
 #define REPL_EXTERNAL_VISIBILITY
 #endif
 #else
-#if defined(_WIN32)
-#define REPL_EXTERNAL_VISIBILITY __declspec(dllexport)
-#endif
+#define REPL_EXTERNAL_VISIBILITY
 #endif
 
 #define REPL_BUILTIN_TYPES 
\


Index: clang/tools/clang-shlib/CMakeLists.txt
===
--- clang/tools/clang-shlib/CMakeLists.txt
+++ clang/tools/clang-shlib/CMakeLists.txt
@@ -53,3 +53,11 @@
 if (NOT APPLE AND NOT MINGW)
   target_link_options(clang-cpp PRIVATE LINKER:-Bsymbolic-functions)
 endif()
+if (MINGW OR CYGWIN)
+  # The clang-cpp DLL is supposed to export all symbols (except for ones
+  # that are explicitly hidden). Normally, this is what happens anyway, but
+  # if there are symbols that are marked explicitly as dllexport, we'd only
+  # export them and nothing else. Therefore, add --export-all-symbols to
+  # make sure we export all symbols despite potential dllexports.
+  target_link_options(clang-cpp PRIVATE LINKER:--export-all-symbols)
+endif()
Index: clang/include/clang/Interpreter/Value.h
===
--- clang/include/clang/Interpreter/Value.h
+++ clang/include/clang/Interpreter/Value.h
@@ -52,18 +52,24 @@
 class Interpreter;
 class QualType;
 
-#if __has_attribute(visibility) && \
-(!(defined(_WIN32) || defined(__CYGWIN__)) ||  \
- (defined(__MINGW32__) && defined(__clang__)))
+#if defined(_WIN32)
+// REPL_EXTERNAL_VISIBILITY are symbols that we need to be able to locate
+// at runtime. On Windows, this requires them to be exported from any of the
+// modules loaded at runtime. Marking them as dllexport achieves this; both
+// for DLLs (that normally export symbols as part of their interface) and for
+// EXEs (that normally don't export anything).
+// For a build with libclang-cpp.dll, this doesn't make any difference - the
+// functions would have been exported anyway. But for cases when these are
+// statically linked into an EXE, it makes sure that they're exported.
+#define REPL_EXTERNAL_VISIBILITY __declspec(dllexport)
+#elif __has_attribute(visibility)
 #if defined(LLVM_BUILD_LLVM_DYLIB) || defined(LLVM_BUILD_SHARED_LIBS)
 #define REPL_EXTERNAL_VISIBILITY __attribute__((visibility("default")))
 #else
 #define REPL_EXTERNAL_VISIBILITY
 #endif
 #else

[clang] f8536fb - [clang][HeaderSearch] Fix implicit module when using header maps

2023-05-28 Thread Ivan Murashko via cfe-commits

Author: Ivan Murashko
Date: 2023-05-28T11:49:51+01:00
New Revision: f8536fb11e3d71d009c9002b5aa2ef32983ac7dc

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

LOG: [clang][HeaderSearch] Fix implicit module when using header maps

Previously, if a header was found via in a header map, and not just remapped.
we wouldn't also find the module it maps to when using implicit modules (for
module maps that were explicitly loaded).

This diff just updates these code paths to also locate the owning module via
`findUsableModuleForHeader`.

Reviewed By: benlangmuir

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

Added: 
clang/test/Modules/implicit-module-header-maps.cpp

Modified: 
clang/lib/Lex/HeaderSearch.cpp

Removed: 




diff  --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp
index a650bbea1e488..d09d3ae12f581 100644
--- a/clang/lib/Lex/HeaderSearch.cpp
+++ b/clang/lib/Lex/HeaderSearch.cpp
@@ -491,7 +491,8 @@ OptionalFileEntryRef DirectoryLookup::LookupFile(
 
   IsInHeaderMap = true;
 
-  auto FixupSearchPath = [&]() {
+  auto FixupSearchPathAndFindUsableModule =
+  [&](auto File) -> OptionalFileEntryRef {
 if (SearchPath) {
   StringRef SearchPathRef(getName());
   SearchPath->clear();
@@ -501,6 +502,12 @@ OptionalFileEntryRef DirectoryLookup::LookupFile(
   RelativePath->clear();
   RelativePath->append(Filename.begin(), Filename.end());
 }
+if (!HS.findUsableModuleForHeader(
+&File.getFileEntry(), File.getFileEntry().getDir(),
+RequestingModule, SuggestedModule, isSystemHeaderDirectory())) {
+  return std::nullopt;
+}
+return File;
   };
 
   // Check if the headermap maps the filename to a framework include
@@ -513,8 +520,7 @@ OptionalFileEntryRef DirectoryLookup::LookupFile(
   }
 
   if (auto Res = HS.getFileMgr().getOptionalFileRef(Dest, OpenFile)) {
-FixupSearchPath();
-return *Res;
+return FixupSearchPathAndFindUsableModule(*Res);
   }
 
   // Header maps need to be marked as used whenever the filename matches.

diff  --git a/clang/test/Modules/implicit-module-header-maps.cpp 
b/clang/test/Modules/implicit-module-header-maps.cpp
new file mode 100644
index 0..a190ff78f306f
--- /dev/null
+++ b/clang/test/Modules/implicit-module-header-maps.cpp
@@ -0,0 +1,54 @@
+// UNSUPPORTED: system-windows
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+// RUN: cd %t
+//
+// RUN: %hmaptool write a.hmap.json hmap
+//
+// RUN: %clang -Rmodule-build -fmodules -fimplicit-modules 
-fimplicit-module-maps -fmodule-map-file=module.modulemap -fsyntax-only -I hmap 
-fmodules-cache-path=%t test.cpp
+//
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+// RUN: cd %t
+//
+// RUN: sed -e "s|OUTPUTS_DIR|%t|g" b.hmap.json > hmap.json
+// RUN: %hmaptool write hmap.json hmap
+//
+// RUN: %clang -Rmodule-build -fmodules -fimplicit-modules 
-fimplicit-module-maps -fmodule-map-file=module.modulemap -fsyntax-only -I hmap 
-fmodules-cache-path=%t test.cpp
+
+//--- After/Mapping.h
+#ifdef FOO
+#error foo
+#endif
+
+//--- a.hmap.json
+{
+  "mappings" :
+{
+ "Before/Mapping.h" : "After/Mapping.h",
+ "After/Mapping.h" : "After/Mapping.h"
+}
+}
+
+//--- b.hmap.json
+{
+  "mappings" :
+{
+ "Before/Mapping.h" : "OUTPUTS_DIR/After/Mapping.h"
+}
+}
+
+//--- module.modulemap
+module a {
+  header "After/Mapping.h"
+}
+
+
+//--- test.cpp
+#define FOO
+// This include will fail if:
+// 1) modules are't used, as the `FOO` define will propagate into the included
+//header and trip a `#error`, or
+// 2) header maps aren't used, as the header name doesn't exist and relies on
+//the header map to remap it to the real header.
+#include "Before/Mapping.h"



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


[PATCH] D103930: [clang][HeaderSearch] Fix implicit module when using header maps

2023-05-28 Thread Ivan Murashko via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf8536fb11e3d: [clang][HeaderSearch] Fix implicit module when 
using header maps (authored by ivanmurashko).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103930

Files:
  clang/lib/Lex/HeaderSearch.cpp
  clang/test/Modules/implicit-module-header-maps.cpp


Index: clang/test/Modules/implicit-module-header-maps.cpp
===
--- /dev/null
+++ clang/test/Modules/implicit-module-header-maps.cpp
@@ -0,0 +1,54 @@
+// UNSUPPORTED: system-windows
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+// RUN: cd %t
+//
+// RUN: %hmaptool write a.hmap.json hmap
+//
+// RUN: %clang -Rmodule-build -fmodules -fimplicit-modules 
-fimplicit-module-maps -fmodule-map-file=module.modulemap -fsyntax-only -I hmap 
-fmodules-cache-path=%t test.cpp
+//
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+// RUN: cd %t
+//
+// RUN: sed -e "s|OUTPUTS_DIR|%t|g" b.hmap.json > hmap.json
+// RUN: %hmaptool write hmap.json hmap
+//
+// RUN: %clang -Rmodule-build -fmodules -fimplicit-modules 
-fimplicit-module-maps -fmodule-map-file=module.modulemap -fsyntax-only -I hmap 
-fmodules-cache-path=%t test.cpp
+
+//--- After/Mapping.h
+#ifdef FOO
+#error foo
+#endif
+
+//--- a.hmap.json
+{
+  "mappings" :
+{
+ "Before/Mapping.h" : "After/Mapping.h",
+ "After/Mapping.h" : "After/Mapping.h"
+}
+}
+
+//--- b.hmap.json
+{
+  "mappings" :
+{
+ "Before/Mapping.h" : "OUTPUTS_DIR/After/Mapping.h"
+}
+}
+
+//--- module.modulemap
+module a {
+  header "After/Mapping.h"
+}
+
+
+//--- test.cpp
+#define FOO
+// This include will fail if:
+// 1) modules are't used, as the `FOO` define will propagate into the included
+//header and trip a `#error`, or
+// 2) header maps aren't used, as the header name doesn't exist and relies on
+//the header map to remap it to the real header.
+#include "Before/Mapping.h"
Index: clang/lib/Lex/HeaderSearch.cpp
===
--- clang/lib/Lex/HeaderSearch.cpp
+++ clang/lib/Lex/HeaderSearch.cpp
@@ -491,7 +491,8 @@
 
   IsInHeaderMap = true;
 
-  auto FixupSearchPath = [&]() {
+  auto FixupSearchPathAndFindUsableModule =
+  [&](auto File) -> OptionalFileEntryRef {
 if (SearchPath) {
   StringRef SearchPathRef(getName());
   SearchPath->clear();
@@ -501,6 +502,12 @@
   RelativePath->clear();
   RelativePath->append(Filename.begin(), Filename.end());
 }
+if (!HS.findUsableModuleForHeader(
+&File.getFileEntry(), File.getFileEntry().getDir(),
+RequestingModule, SuggestedModule, isSystemHeaderDirectory())) {
+  return std::nullopt;
+}
+return File;
   };
 
   // Check if the headermap maps the filename to a framework include
@@ -513,8 +520,7 @@
   }
 
   if (auto Res = HS.getFileMgr().getOptionalFileRef(Dest, OpenFile)) {
-FixupSearchPath();
-return *Res;
+return FixupSearchPathAndFindUsableModule(*Res);
   }
 
   // Header maps need to be marked as used whenever the filename matches.


Index: clang/test/Modules/implicit-module-header-maps.cpp
===
--- /dev/null
+++ clang/test/Modules/implicit-module-header-maps.cpp
@@ -0,0 +1,54 @@
+// UNSUPPORTED: system-windows
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+// RUN: cd %t
+//
+// RUN: %hmaptool write a.hmap.json hmap
+//
+// RUN: %clang -Rmodule-build -fmodules -fimplicit-modules -fimplicit-module-maps -fmodule-map-file=module.modulemap -fsyntax-only -I hmap -fmodules-cache-path=%t test.cpp
+//
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+// RUN: cd %t
+//
+// RUN: sed -e "s|OUTPUTS_DIR|%t|g" b.hmap.json > hmap.json
+// RUN: %hmaptool write hmap.json hmap
+//
+// RUN: %clang -Rmodule-build -fmodules -fimplicit-modules -fimplicit-module-maps -fmodule-map-file=module.modulemap -fsyntax-only -I hmap -fmodules-cache-path=%t test.cpp
+
+//--- After/Mapping.h
+#ifdef FOO
+#error foo
+#endif
+
+//--- a.hmap.json
+{
+  "mappings" :
+{
+ "Before/Mapping.h" : "After/Mapping.h",
+ "After/Mapping.h" : "After/Mapping.h"
+}
+}
+
+//--- b.hmap.json
+{
+  "mappings" :
+{
+ "Before/Mapping.h" : "OUTPUTS_DIR/After/Mapping.h"
+}
+}
+
+//--- module.modulemap
+module a {
+  header "After/Mapping.h"
+}
+
+
+//--- test.cpp
+#define FOO
+// This include will fail if:
+// 1) modules are't used, as the `FOO` define will propagate into the included
+//header and trip a `#error`, or
+// 2) header maps aren't used, as the header name doesn't exist and relies on
+//the header map to remap it to the real header.
+#include "Before/Mapping.h"
Index: clang/lib/Lex/HeaderSearch.cpp
===
--- clang/lib/Lex/HeaderSearch.cpp
+++ clang/lib/Lex/HeaderSearch.cpp
@@ -491,7 +491

[PATCH] D146809: [clang-repl] Implement Value pretty printing

2023-05-28 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev added inline comments.



Comment at: clang/include/clang/Interpreter/Interpreter.h:113
   llvm::Expected CompileDtorCall(CXXRecordDecl 
*CXXRD);
+  std::string CreateUniqName(std::string Base);
 

We should move this routine to its user in maybe ValuePrinter.cpp.



Comment at: clang/tools/clang-repl/CMakeLists.txt:40
+  ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@PEBX@Z
+  
??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z
+  
??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@D@Z

v.g.vassilev wrote:
> We should check if there is a better way to export a subset of symbols 
> through the llvm build system. Maybe @lhames, @sunho or @sgraenitz know how.
I wonder if that's related to https://reviews.llvm.org/D151620 in some way? 
That is, does D151620 fix our exports and this section becomes redundant?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146809

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


[PATCH] D148697: [clang-tidy] Add more checks for functions which should be noexcept

2023-05-28 Thread André Schackier via Phabricator via cfe-commits
AMS21 added a comment.

Bumping to ask for reviews


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148697

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


[PATCH] D150185: [include-cleaner] Allow multiple strategies for spelling includes.

2023-05-28 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added a comment.

thanks a lot! outline seems good. mostly some comments on implementation 
details.




Comment at: 
clang-tools-extra/include-cleaner/include/clang-include-cleaner/Analysis.h:92
+
+  virtual std::string operator()(llvm::StringRef HeaderPhysicalPath) const = 0;
+};

we should have some comments explaining the semantics and rationale. maybe 
something like:
```
An extension point to let applications introduce custom spelling strategies for 
physical headers.
It takes in absolute path to a source file and should return a verbatim include 
spelling (with angles/quotes) or an empty string to indicate no customizations 
are needed.
```



Comment at: 
clang-tools-extra/include-cleaner/include/clang-include-cleaner/Analysis.h:97
+const FileEntry *Main,
+const IncludeSpeller *CustomSpeller);
+

we can change the interface here to just a functor now, e.g. 
`llvm::function_ref MapHeader`. 

we should also add some comments to explain the contract:
```
Generates a spelling for `H` that can be directly included in `Main`.
When `H` is a physical header, prefers the spelling provided by `MapHeader` if 
any, otherwise uses header search info to generate shortest spelling.
```



Comment at: 
clang-tools-extra/include-cleaner/include/clang-include-cleaner/Analysis.h:99
+
+typedef llvm::Registry IncludeSpellingStrategy;
+

let's move this closer to interface definition.



Comment at: 
clang-tools-extra/include-cleaner/include/clang-include-cleaner/Analysis.h:101
+
+class ApplyFirstIncludeSpeller : public IncludeSpeller {
+public:

let's move this into the source file and maybe expose with something like:
```
/// A header mapper that iterates over all registered include spelling 
strategies.
/// Note that when there are multiple strategies iteration order is not 
specified.
std::function defaultHeaderMapper();
```

you can also make this the default for `mapHeader` parameter in `spellHeader`.



Comment at: 
clang-tools-extra/include-cleaner/include/clang-include-cleaner/Analysis.h:104
+  ApplyFirstIncludeSpeller() {
+for (const auto &Strategy :
+ include_cleaner::IncludeSpellingStrategy::entries()) {

instead of a constructor you can have:
```
static auto *Strategies = []{
  auto *Result = new 
llvm::SmallVector>;
  for(auto &Strategy: include_cleaner::IncludeSpellingStrategy::entries()) {
   Result->push_back(Strategy.instantiate());
  }
}();
```

in the functor implementation.



Comment at: clang-tools-extra/include-cleaner/lib/Analysis.cpp:64
+const IncludeSpeller *CustomSpeller) {
+  if (H.kind() == Header::Standard) {
 return H.standard().name().str();

let's keep the switch here, as it'll trigger a warning when there's a 
non-matched kind during compiles.



Comment at: clang-tools-extra/include-cleaner/lib/Analysis.cpp:85
+  bool IsSystem = false;
+  std::string Path = HS.suggestPathToFileForDiagnostics(
+  H.physical(), Main->tryGetRealPathName(), &IsSystem);

you can use `FinalSpelling` here



Comment at: clang-tools-extra/include-cleaner/lib/Analysis.cpp:110
+ Ref.RT == RefType::Explicit) {
+   ApplyFirstIncludeSpeller Speller;
+   Missing.insert(

we should instantiate this outside the callback instead (to make sure we do it 
once). it would become obsolete if you're to use a static variable to store the 
strategies though.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150185

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


[clang] 5b4fed6 - [clang][NFC] Update latest released Clang versions in make_cxx_dr_status

2023-05-28 Thread Vlad Serebrennikov via cfe-commits

Author: Vlad Serebrennikov
Date: 2023-05-28T15:58:52+03:00
New Revision: 5b4fed66efe245bb0cc246755a669ab3a17de9ed

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

LOG: [clang][NFC] Update latest released Clang versions in make_cxx_dr_status

This changes a handful of recently implemented DRs from "unreleased" to "full" 
styling in cxx_dr_status.html

Added: 


Modified: 
clang/www/cxx_dr_status.html
clang/www/make_cxx_dr_status

Removed: 




diff  --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index cf4cdbb19a7e2..59a0b0c05295c 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -1382,7 +1382,7 @@ C++ defect report implementation 
status
 https://cplusplus.github.io/CWG/issues/224.html";>224
 CD1
 Definition of dependent names
-Clang 16
+Clang 16
   
   
 https://cplusplus.github.io/CWG/issues/225.html";>225
@@ -4193,7 +4193,7 @@ C++ defect report implementation 
status
 https://cplusplus.github.io/CWG/issues/692.html";>692
 C++11
 Partial ordering of variadic class template partial 
specializations
-Clang 16
+Clang 16
   
   
 https://cplusplus.github.io/CWG/issues/693.html";>693
@@ -8177,7 +8177,7 @@ C++ defect report implementation 
status
 https://cplusplus.github.io/CWG/issues/1395.html";>1395
 C++17
 Partial ordering of variadic templates reconsidered
-Clang 16
+Clang 16
   
   
 https://cplusplus.github.io/CWG/issues/1396.html";>1396
@@ -8399,7 +8399,7 @@ C++ defect report implementation 
status
 https://cplusplus.github.io/CWG/issues/1432.html";>1432
 C++17
 Newly-ambiguous variadic template expansions
-Clang 16
+Clang 16
   
   
 https://cplusplus.github.io/CWG/issues/1433.html";>1433
@@ -13955,7 +13955,7 @@ C++ defect report implementation 
status
 https://cplusplus.github.io/CWG/issues/2358.html";>2358
 CD5
 Explicit capture of value
-Clang 16
+Clang 16
   
   
 https://cplusplus.github.io/CWG/issues/2359.html";>2359
@@ -15197,7 +15197,7 @@ C++ defect report implementation 
status
 https://cplusplus.github.io/CWG/issues/2565.html";>2565
 open
 Invalid types in the parameter-declaration-clause of a 
requires-expression
-Clang 16
+Clang 16
   
   
 https://cplusplus.github.io/CWG/issues/2566.html";>2566
@@ -15593,7 +15593,7 @@ C++ defect report implementation 
status
 https://cplusplus.github.io/CWG/issues/2631.html";>2631
 DRWP
 Immediate function evaluations in default arguments
-Clang 16
+Clang 16
   
   
 https://cplusplus.github.io/CWG/issues/2632.html";>2632
@@ -15617,7 +15617,7 @@ C++ defect report implementation 
status
 https://cplusplus.github.io/CWG/issues/2635.html";>2635
 DRWP
 Constrained structured bindings
-Clang 16
+Clang 16
   
   
 https://cplusplus.github.io/CWG/issues/2636.html";>2636
@@ -15647,7 +15647,7 @@ C++ defect report implementation 
status
 https://cplusplus.github.io/CWG/issues/2640.html";>2640
 WP
 Allow more characters in an n-char sequence
-Clang 16
+Clang 16
   
   
 https://cplusplus.github.io/CWG/issues/2641.html";>2641
@@ -15731,7 +15731,7 @@ C++ defect report implementation 
status
 https://cplusplus.github.io/CWG/issues/2654.html";>2654
 DRWP
 Un-deprecation of compound volatile assignments
-Clang 16
+Clang 16
   
   
 https://cplusplus.github.io/CWG/issues/2655.html";>2655

diff  --git a/clang/www/make_cxx_dr_status b/clang/www/make_cxx_dr_status
index 11b17f0444373..afb7189c0ecec 100755
--- a/clang/www/make_cxx_dr_status
+++ b/clang/www/make_cxx_dr_status
@@ -122,7 +122,7 @@ out_file.write('''\
 Available in Clang?
   ''')
 
-latest_release = 15
+latest_release = 16
 
 def availability(issue):
   status = status_map.get(issue, 'unknown')



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


[PATCH] D148697: [clang-tidy] Add more checks for functions which should be noexcept

2023-05-28 Thread Piotr Zegar via Phabricator via cfe-commits
PiotrZSL accepted this revision.
PiotrZSL added a comment.
This revision is now accepted and ready to land.

On first glance, looks fine, but I didn't check it too deep.
Leave it open for 1-2 weeks. I will try to check it more deeply.

One thing that I see and do not like is duplication, maybe we could extract 
some "base check" from those 3 (in next step).




Comment at: 
clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/noexcept-move-constructor.rst:5
+
+cppcoreguidelines-noexcept-move-constructor
+===

maybe then it should be called cppcoreguidelines-noexcept-move-operations



Comment at: clang-tools-extra/docs/clang-tidy/checks/list.rst:486
`cppcoreguidelines-non-private-member-variables-in-classes 
`_, 
`misc-non-private-member-variables-in-classes 
`_,
-   `cppcoreguidelines-use-default-member-init 
`_, 
`modernize-use-default-member-init `_,
+   `cppcoreguidelines-use-default-member-init 
`_, 
`modernize-use-default-member-init `_, 
"Yes"
`fuchsia-header-anon-namespaces `_, 
`google-build-namespaces `_,

this is out of scope of this change, verify this


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148697

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


[PATCH] D148697: [clang-tidy] Add more checks for functions which should be noexcept

2023-05-28 Thread André Schackier via Phabricator via cfe-commits
AMS21 updated this revision to Diff 526326.
AMS21 marked 2 inline comments as done.
AMS21 added a comment.

Rename `cppcoreguidelines-noexcept-move-constructor` to 
`cppcoreguidelines-noexcept-move-operations`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148697

Files:
  clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
  clang-tools-extra/clang-tidy/performance/CMakeLists.txt
  clang-tools-extra/clang-tidy/performance/NoexceptDestructorCheck.cpp
  clang-tools-extra/clang-tidy/performance/NoexceptDestructorCheck.h
  clang-tools-extra/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp
  clang-tools-extra/clang-tidy/performance/NoexceptMoveConstructorCheck.h
  clang-tools-extra/clang-tidy/performance/NoexceptSwapCheck.cpp
  clang-tools-extra/clang-tidy/performance/NoexceptSwapCheck.h
  clang-tools-extra/clang-tidy/performance/PerformanceTidyModule.cpp
  clang-tools-extra/clang-tidy/utils/ExceptionSpecAnalyzer.cpp
  clang-tools-extra/clang-tidy/utils/LexerUtils.cpp
  clang-tools-extra/clang-tidy/utils/LexerUtils.h
  clang-tools-extra/docs/ReleaseNotes.rst
  
clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/noexcept-destructor.rst
  
clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/noexcept-move-operations.rst
  clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/noexcept-swap.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/docs/clang-tidy/checks/performance/noexcept-destructor.rst
  clang-tools-extra/docs/clang-tidy/checks/performance/noexcept-swap.rst
  clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-destructor.cpp
  
clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-move-constructor.cpp
  clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-swap.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-swap.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-swap.cpp
@@ -0,0 +1,203 @@
+// RUN: %check_clang_tidy %s performance-noexcept-swap %t -- -- -fexceptions
+
+void throwing_function() noexcept(false);
+void noexcept_function() noexcept;
+
+template 
+struct TemplateNoexceptWithInt {
+  static void f() {}
+};
+
+template <>
+struct TemplateNoexceptWithInt {
+  static void f() noexcept {}
+};
+
+class A {
+  void swap(A &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: swap functions should be marked noexcept [performance-noexcept-swap]
+  // CHECK-FIXES: void swap(A &) noexcept ;
+};
+
+void swap(A &, A &);
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: swap functions should be marked noexcept [performance-noexcept-swap]
+// CHECK-FIXES: void swap(A &, A &) noexcept ;
+
+struct B {
+  static constexpr bool kFalse = false;
+  void swap(B &) noexcept(kFalse);
+  // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: noexcept specifier on swap function evaluates to 'false' [performance-noexcept-swap]
+};
+
+void swap(B &, B &) noexcept(B::kFalse);
+// CHECK-MESSAGES: :[[@LINE-1]]:30: warning: noexcept specifier on swap function evaluates to 'false' [performance-noexcept-swap]
+
+template 
+struct C {
+  void swap(C&);
+  // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: swap functions should be marked noexcept [performance-noexcept-swap]
+  // CHECK-FIXES: void swap(C&) noexcept ;
+};
+
+template 
+void swap(C&, C&);
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: swap functions should be marked noexcept [performance-noexcept-swap]
+// CHECK-FIXES: void swap(C&, C&) noexcept ;
+void swap(C&, C&);
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: swap functions should be marked noexcept [performance-noexcept-swap]
+// CHECK-FIXES: void swap(C&, C&) noexcept ;
+
+template 
+struct D {
+  static constexpr bool kFalse = false;
+  void swap(D &) noexcept(kFalse);
+  // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: noexcept specifier on swap function evaluates to 'false' [performance-noexcept-swap]
+};
+
+template 
+void swap(D &, D &) noexcept(D::kFalse);
+// CHECK-MESSAGES: :[[@LINE-1]]:36: warning: noexcept specifier on swap function evaluates to 'false' [performance-noexcept-swap]
+void swap(D &, D &) noexcept(D::kFalse);
+// CHECK-MESSAGES: :[[@LINE-1]]:40: warning: noexcept specifier on swap function evaluates to 'false' [performance-noexcept-swap]
+
+struct E {
+  void swap(E &) noexcept(noexcept(throwing_function()));
+  // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: noexcept specifier on swap function evaluates to 'false' [performance-noexcept-swap]
+};
+
+void swap(E &, E &) noexcept(noexcept(throwing_function()));
+// CHECK-MESSAGES: :[[@LINE-1]]:30: warning: noexcept specifier on swap function evaluates to 'false' [performance-noexcept-swap]
+
+template 
+struct F {
+  void swap(F &) noexcept(noexcept(throwing_function()));
+  // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: noexcept specifier on swap f

[PATCH] D148697: [clang-tidy] Add more checks for functions which should be noexcept

2023-05-28 Thread André Schackier via Phabricator via cfe-commits
AMS21 updated this revision to Diff 526327.
AMS21 added a comment.

Removed unrelated change


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148697

Files:
  clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
  clang-tools-extra/clang-tidy/performance/CMakeLists.txt
  clang-tools-extra/clang-tidy/performance/NoexceptDestructorCheck.cpp
  clang-tools-extra/clang-tidy/performance/NoexceptDestructorCheck.h
  clang-tools-extra/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp
  clang-tools-extra/clang-tidy/performance/NoexceptMoveConstructorCheck.h
  clang-tools-extra/clang-tidy/performance/NoexceptSwapCheck.cpp
  clang-tools-extra/clang-tidy/performance/NoexceptSwapCheck.h
  clang-tools-extra/clang-tidy/performance/PerformanceTidyModule.cpp
  clang-tools-extra/clang-tidy/utils/ExceptionSpecAnalyzer.cpp
  clang-tools-extra/clang-tidy/utils/LexerUtils.cpp
  clang-tools-extra/clang-tidy/utils/LexerUtils.h
  clang-tools-extra/docs/ReleaseNotes.rst
  
clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/noexcept-destructor.rst
  
clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/noexcept-move-operations.rst
  clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/noexcept-swap.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/docs/clang-tidy/checks/performance/noexcept-destructor.rst
  clang-tools-extra/docs/clang-tidy/checks/performance/noexcept-swap.rst
  clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-destructor.cpp
  
clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-move-constructor.cpp
  clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-swap.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-swap.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-swap.cpp
@@ -0,0 +1,203 @@
+// RUN: %check_clang_tidy %s performance-noexcept-swap %t -- -- -fexceptions
+
+void throwing_function() noexcept(false);
+void noexcept_function() noexcept;
+
+template 
+struct TemplateNoexceptWithInt {
+  static void f() {}
+};
+
+template <>
+struct TemplateNoexceptWithInt {
+  static void f() noexcept {}
+};
+
+class A {
+  void swap(A &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: swap functions should be marked noexcept [performance-noexcept-swap]
+  // CHECK-FIXES: void swap(A &) noexcept ;
+};
+
+void swap(A &, A &);
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: swap functions should be marked noexcept [performance-noexcept-swap]
+// CHECK-FIXES: void swap(A &, A &) noexcept ;
+
+struct B {
+  static constexpr bool kFalse = false;
+  void swap(B &) noexcept(kFalse);
+  // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: noexcept specifier on swap function evaluates to 'false' [performance-noexcept-swap]
+};
+
+void swap(B &, B &) noexcept(B::kFalse);
+// CHECK-MESSAGES: :[[@LINE-1]]:30: warning: noexcept specifier on swap function evaluates to 'false' [performance-noexcept-swap]
+
+template 
+struct C {
+  void swap(C&);
+  // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: swap functions should be marked noexcept [performance-noexcept-swap]
+  // CHECK-FIXES: void swap(C&) noexcept ;
+};
+
+template 
+void swap(C&, C&);
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: swap functions should be marked noexcept [performance-noexcept-swap]
+// CHECK-FIXES: void swap(C&, C&) noexcept ;
+void swap(C&, C&);
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: swap functions should be marked noexcept [performance-noexcept-swap]
+// CHECK-FIXES: void swap(C&, C&) noexcept ;
+
+template 
+struct D {
+  static constexpr bool kFalse = false;
+  void swap(D &) noexcept(kFalse);
+  // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: noexcept specifier on swap function evaluates to 'false' [performance-noexcept-swap]
+};
+
+template 
+void swap(D &, D &) noexcept(D::kFalse);
+// CHECK-MESSAGES: :[[@LINE-1]]:36: warning: noexcept specifier on swap function evaluates to 'false' [performance-noexcept-swap]
+void swap(D &, D &) noexcept(D::kFalse);
+// CHECK-MESSAGES: :[[@LINE-1]]:40: warning: noexcept specifier on swap function evaluates to 'false' [performance-noexcept-swap]
+
+struct E {
+  void swap(E &) noexcept(noexcept(throwing_function()));
+  // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: noexcept specifier on swap function evaluates to 'false' [performance-noexcept-swap]
+};
+
+void swap(E &, E &) noexcept(noexcept(throwing_function()));
+// CHECK-MESSAGES: :[[@LINE-1]]:30: warning: noexcept specifier on swap function evaluates to 'false' [performance-noexcept-swap]
+
+template 
+struct F {
+  void swap(F &) noexcept(noexcept(throwing_function()));
+  // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: noexcept specifier on swap function evaluates to 'false' [performance-noexcept-swap]
+};
+
+template 
+void swap(F &, F &) noexcept(noexcept(thro

[PATCH] D151632: [clang-format] Parse the Verilog language option in configuration

2023-05-28 Thread sstwcw via Phabricator via cfe-commits
sstwcw created this revision.
Herald added projects: All, clang, clang-format.
Herald added a subscriber: cfe-commits.
Herald added reviewers: rymiel, HazardyKnusperkeks, owenpan, MyDeveloperDay.
sstwcw requested review of this revision.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151632

Files:
  clang/lib/Format/Format.cpp
  clang/unittests/Format/ConfigParseTest.cpp


Index: clang/unittests/Format/ConfigParseTest.cpp
===
--- clang/unittests/Format/ConfigParseTest.cpp
+++ clang/unittests/Format/ConfigParseTest.cpp
@@ -1022,6 +1022,23 @@
 ParseError::Error);
 
   EXPECT_EQ(FormatStyle::LK_Cpp, Style.Language);
+
+  Style.Language = FormatStyle::LK_Verilog;
+  CHECK_PARSE("---\n"
+  "Language: Verilog\n"
+  "IndentWidth: 12\n"
+  "---\n"
+  "Language: Cpp\n"
+  "IndentWidth: 34\n"
+  "...\n",
+  IndentWidth, 12u);
+  CHECK_PARSE("---\n"
+  "IndentWidth: 78\n"
+  "---\n"
+  "Language: Verilog\n"
+  "IndentWidth: 56\n"
+  "...\n",
+  IndentWidth, 56u);
 }
 
 TEST(ConfigParseTest, UsesLanguageForBasedOnStyle) {
Index: clang/lib/Format/Format.cpp
===
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -375,6 +375,7 @@
 IO.enumCase(Value, "TextProto", FormatStyle::LK_TextProto);
 IO.enumCase(Value, "CSharp", FormatStyle::LK_CSharp);
 IO.enumCase(Value, "Json", FormatStyle::LK_Json);
+IO.enumCase(Value, "Verilog", FormatStyle::LK_Verilog);
   }
 };
 


Index: clang/unittests/Format/ConfigParseTest.cpp
===
--- clang/unittests/Format/ConfigParseTest.cpp
+++ clang/unittests/Format/ConfigParseTest.cpp
@@ -1022,6 +1022,23 @@
 ParseError::Error);
 
   EXPECT_EQ(FormatStyle::LK_Cpp, Style.Language);
+
+  Style.Language = FormatStyle::LK_Verilog;
+  CHECK_PARSE("---\n"
+  "Language: Verilog\n"
+  "IndentWidth: 12\n"
+  "---\n"
+  "Language: Cpp\n"
+  "IndentWidth: 34\n"
+  "...\n",
+  IndentWidth, 12u);
+  CHECK_PARSE("---\n"
+  "IndentWidth: 78\n"
+  "---\n"
+  "Language: Verilog\n"
+  "IndentWidth: 56\n"
+  "...\n",
+  IndentWidth, 56u);
 }
 
 TEST(ConfigParseTest, UsesLanguageForBasedOnStyle) {
Index: clang/lib/Format/Format.cpp
===
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -375,6 +375,7 @@
 IO.enumCase(Value, "TextProto", FormatStyle::LK_TextProto);
 IO.enumCase(Value, "CSharp", FormatStyle::LK_CSharp);
 IO.enumCase(Value, "Json", FormatStyle::LK_Json);
+IO.enumCase(Value, "Verilog", FormatStyle::LK_Verilog);
   }
 };
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151121: [Clang][UBSan] Fix the crash caused by __builtin_assume_aligned with -no-opaque-pointers enabled

2023-05-28 Thread Yurong via Phabricator via cfe-commits
yronglin added a comment.

The col number in diagnostic message seems not correct 
https://godbolt.org/z/jnG5orhYW


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151121

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


[PATCH] D125171: [clang-format] Add a new clang-format option AlwaysBreakBeforeFunctionParameters

2023-05-28 Thread Hristo Hristov via Phabricator via cfe-commits
H-G-Hristov added inline comments.



Comment at: clang/unittests/Format/FormatTest.cpp:25716
+   "int param2,\n"
+   "int param3);\n",
+   Style);

Does this work with `BAS_BlockIndent`? I don't see any related tests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125171

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


[clang] e2cc293 - [Serialization] Remove unused declaration ReadExplicitTemplateArgumentList

2023-05-28 Thread Kazu Hirata via cfe-commits

Author: Kazu Hirata
Date: 2023-05-28T12:11:26-07:00
New Revision: e2cc2939a30b9e61e8533ef95f818a7b22bd465f

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

LOG: [Serialization] Remove unused declaration ReadExplicitTemplateArgumentList

The function was renamed to ReadTemplateKWAndArgsInfo, but the
original declaration remained:

  commit 7945c981b974f58c021762e77f13cd4859ac447b
  Author: Abramo Bagnara 
  Date:   Fri Jan 27 09:46:47 2012 +

Added: 


Modified: 
clang/lib/Serialization/ASTReaderStmt.cpp

Removed: 




diff  --git a/clang/lib/Serialization/ASTReaderStmt.cpp 
b/clang/lib/Serialization/ASTReaderStmt.cpp
index c3ccb6744ff6..c6738ded4af4 100644
--- a/clang/lib/Serialization/ASTReaderStmt.cpp
+++ b/clang/lib/Serialization/ASTReaderStmt.cpp
@@ -115,10 +115,6 @@ namespace clang {
TemplateArgumentLoc *ArgsLocArray,
unsigned NumTemplateArgs);
 
-/// Read and initialize a ExplicitTemplateArgumentList structure.
-void ReadExplicitTemplateArgumentList(ASTTemplateArgumentListInfo &ArgList,
-  unsigned NumTemplateArgs);
-
 void VisitStmt(Stmt *S);
 #define STMT(Type, Base) \
 void Visit##Type(Type *);



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


[clang] c194a5e - [Driver] Remove unused declaration AddStaticDeviceLibsPostLinking

2023-05-28 Thread Kazu Hirata via cfe-commits

Author: Kazu Hirata
Date: 2023-05-28T12:11:25-07:00
New Revision: c194a5efb8c1122892d9f4a8441c237fd83dbd27

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

LOG: [Driver] Remove unused declaration AddStaticDeviceLibsPostLinking

The corresponding function definition was removed by:

  commit 6f96dadb7a5b1593a0b6348539f66f7e945f2561
  Author: Joseph Huber 
  Date:   Mon Jan 23 07:13:33 2023 -0600

Added: 


Modified: 
clang/lib/Driver/ToolChains/CommonArgs.h

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/CommonArgs.h 
b/clang/lib/Driver/ToolChains/CommonArgs.h
index 6fffec93436b..c196cbc28e21 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.h
+++ b/clang/lib/Driver/ToolChains/CommonArgs.h
@@ -59,11 +59,6 @@ void AddStaticDeviceLibsLinking(Compilation &C, const Tool 
&T,
 llvm::opt::ArgStringList &CmdArgs,
 StringRef Arch, StringRef Target,
 bool isBitCodeSDL, bool postClangLink);
-void AddStaticDeviceLibsPostLinking(const Driver &D,
-const llvm::opt::ArgList &DriverArgs,
-llvm::opt::ArgStringList &CmdArgs,
-StringRef Arch, StringRef Target,
-bool isBitCodeSDL, bool postClangLink);
 void AddStaticDeviceLibs(Compilation *C, const Tool *T, const JobAction *JA,
  const InputInfoList *Inputs, const Driver &D,
  const llvm::opt::ArgList &DriverArgs,



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


[clang] d0e4119 - [CodeGen] Remove unused declaration getOrCreateRelativeStub

2023-05-28 Thread Kazu Hirata via cfe-commits

Author: Kazu Hirata
Date: 2023-05-28T12:11:28-07:00
New Revision: d0e4119d848bbb8df6a7fa303ad8302a770fbab8

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

LOG: [CodeGen] Remove unused declaration getOrCreateRelativeStub

The corresponding function definition was removed by:

  commit cf8ff75bade763b054476321dcb82dcb2e7744c7
  Author: Leonard Chan 
  Date:   Tue Jul 14 14:56:38 2020 -0700

Added: 


Modified: 
clang/lib/CodeGen/CGVTables.h

Removed: 




diff  --git a/clang/lib/CodeGen/CGVTables.h b/clang/lib/CodeGen/CGVTables.h
index e7b59d94f257..9d4223547050 100644
--- a/clang/lib/CodeGen/CGVTables.h
+++ b/clang/lib/CodeGen/CGVTables.h
@@ -75,16 +75,6 @@ class CodeGenVTables {
 bool vtableHasLocalLinkage,
 bool isCompleteDtor) const;
 
-  /// Create a dso_local stub that will be used for a relative reference in the
-  /// relative vtable layout. This stub will just be a tail call to the 
original
-  /// function and propagate any function attributes from the original. If the
-  /// original function is already dso_local, the original is returned instead
-  /// and a stub is not created.
-  llvm::Function *
-  getOrCreateRelativeStub(llvm::Function *func,
-  llvm::GlobalValue::LinkageTypes stubLinkage,
-  bool isCompleteDtor) const;
-
   bool useRelativeLayout() const;
 
   llvm::Type *getVTableComponentType() const;



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


[clang] fb250b8 - [clang][c++20][NFC] `ComparisonCategoryType` - updated comment, removed `std:*_equality`

2023-05-28 Thread Hristo Hristov via cfe-commits

Author: Hristo Hristov
Date: 2023-05-28T22:25:16+03:00
New Revision: fb250b8295b9f65590017c5b13d6de0b4f4617c1

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

LOG: [clang][c++20][NFC] `ComparisonCategoryType` - updated comment, removed 
`std:*_equality`

`weak_equality` and `strong_equality` are removed from the standard:
- https://wg21.link/P1959R0
- https://eel.is/c++draft/cmp.categories.pre

Reviewed By: rsmith

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

Added: 


Modified: 
clang/include/clang/AST/ComparisonCategories.h

Removed: 




diff  --git a/clang/include/clang/AST/ComparisonCategories.h 
b/clang/include/clang/AST/ComparisonCategories.h
index 1c94cee4b7c4..b4ad37e394ce 100644
--- a/clang/include/clang/AST/ComparisonCategories.h
+++ b/clang/include/clang/AST/ComparisonCategories.h
@@ -39,9 +39,8 @@ class NamespaceDecl;
 /// An enumeration representing the 
diff erent comparison categories
 /// types.
 ///
-/// C++2a [cmp.categories.pre] The types weak_equality, strong_equality,
-/// partial_ordering, weak_ordering, and strong_ordering are collectively
-/// termed the comparison category types.
+/// C++20 [cmp.categories.pre] The types partial_ordering, weak_ordering, and
+/// strong_ordering are collectively termed the comparison category types.
 enum class ComparisonCategoryType : unsigned char {
   PartialOrdering,
   WeakOrdering,



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


[PATCH] D151627: [clang][c++20][NFC] `ComparisonCategoryType` - updated comment, removed `std:*_equality`

2023-05-28 Thread Hristo Hristov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfb250b8295b9: [clang][c++20][NFC] `ComparisonCategoryType` - 
updated comment, removed `std… (authored by Zingam).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151627

Files:
  clang/include/clang/AST/ComparisonCategories.h


Index: clang/include/clang/AST/ComparisonCategories.h
===
--- clang/include/clang/AST/ComparisonCategories.h
+++ clang/include/clang/AST/ComparisonCategories.h
@@ -39,9 +39,8 @@
 /// An enumeration representing the different comparison categories
 /// types.
 ///
-/// C++2a [cmp.categories.pre] The types weak_equality, strong_equality,
-/// partial_ordering, weak_ordering, and strong_ordering are collectively
-/// termed the comparison category types.
+/// C++20 [cmp.categories.pre] The types partial_ordering, weak_ordering, and
+/// strong_ordering are collectively termed the comparison category types.
 enum class ComparisonCategoryType : unsigned char {
   PartialOrdering,
   WeakOrdering,


Index: clang/include/clang/AST/ComparisonCategories.h
===
--- clang/include/clang/AST/ComparisonCategories.h
+++ clang/include/clang/AST/ComparisonCategories.h
@@ -39,9 +39,8 @@
 /// An enumeration representing the different comparison categories
 /// types.
 ///
-/// C++2a [cmp.categories.pre] The types weak_equality, strong_equality,
-/// partial_ordering, weak_ordering, and strong_ordering are collectively
-/// termed the comparison category types.
+/// C++20 [cmp.categories.pre] The types partial_ordering, weak_ordering, and
+/// strong_ordering are collectively termed the comparison category types.
 enum class ComparisonCategoryType : unsigned char {
   PartialOrdering,
   WeakOrdering,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151634: [clang] Add test for CWG253

2023-05-28 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill created this revision.
Endill added reviewers: clang-language-wg, shafik.
Herald added a project: All.
Endill requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Also mark CWG78 as "no". CWG253 is the only issue that references 78, and they 
reference the same paragraph, so I guess that's the issue Richard thought that 
supersedes 78.

I think they are different, though: 78 is concerned about initialization of 
static objectы when no initializer is specified, whereas 253 is concerned with 
users required to explicitly declare defaulted default constructor when they 
want to declare local object without initializer, when there's nothing to 
initialize (e.g. a struct without non-static data members).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151634

Files:
  clang/test/CXX/drs/dr0xx.cpp
  clang/test/CXX/drs/dr2xx.cpp


Index: clang/test/CXX/drs/dr2xx.cpp
===
--- clang/test/CXX/drs/dr2xx.cpp
+++ clang/test/CXX/drs/dr2xx.cpp
@@ -4,6 +4,7 @@
 // RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors
 // RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors
 // RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors
+// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors
 
 // PR13819 -- __SIZE_TYPE__ is incompatible.
 typedef __SIZE_TYPE__ size_t; // expected-error 0-1 {{extension}}
@@ -682,6 +683,17 @@
   G::~G() {}
 }
 
+namespace dr253 { // dr253: 3.9
+struct Z {
+  operator int() const { return 0; }
+};
+
+void f() {
+  const Z z1;  
+  const Z z2 = { };
+}
+} // namespace dr253
+
 namespace dr254 { // dr254: yes
   template struct A {
 typedef typename T::type type; // ok even if this is a typedef-name, 
because
Index: clang/test/CXX/drs/dr0xx.cpp
===
--- clang/test/CXX/drs/dr0xx.cpp
+++ clang/test/CXX/drs/dr0xx.cpp
@@ -4,6 +4,7 @@
 // RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors -triple %itanium_abi_triple
 // RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors -triple %itanium_abi_triple
 // RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors -triple %itanium_abi_triple
+// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors -triple %itanium_abi_triple
 
 namespace dr1 { // dr1: no
   namespace X { extern "C" void dr1_f(int a = 1); }
@@ -1018,7 +1019,7 @@
   };
 }
 
-namespace dr78 { // dr78: sup 
+namespace dr78 { // dr78: no
   // Under DR78, this is valid, because 'k' has static storage duration, so is
   // zero-initialized.
   const int k; // expected-error {{default initialization of an object of 
const}}


Index: clang/test/CXX/drs/dr2xx.cpp
===
--- clang/test/CXX/drs/dr2xx.cpp
+++ clang/test/CXX/drs/dr2xx.cpp
@@ -4,6 +4,7 @@
 // RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 
 // PR13819 -- __SIZE_TYPE__ is incompatible.
 typedef __SIZE_TYPE__ size_t; // expected-error 0-1 {{extension}}
@@ -682,6 +683,17 @@
   G::~G() {}
 }
 
+namespace dr253 { // dr253: 3.9
+struct Z {
+  operator int() const { return 0; }
+};
+
+void f() {
+  const Z z1;  
+  const Z z2 = { };
+}
+} // namespace dr253
+
 namespace dr254 { // dr254: yes
   template struct A {
 typedef typename T::type type; // ok even if this is a typedef-name, because
Index: clang/test/CXX/drs/dr0xx.cpp
===
--- clang/test/CXX/drs/dr0xx.cpp
+++ clang/test/CXX/drs/dr0xx.cpp
@@ -4,6 +4,7 @@
 // RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
 // RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
 // RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
+// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
 
 namespace dr1 { // dr1: no
   namespace X { extern "C" void dr1_f(int a = 1); }
@@ -1018,7 +1019,7 @@
   };
 }
 
-namespace dr78 { // dr78: sup 
+namespace dr78 { // dr78: no
   // Under DR78, this is valid, because 'k' has static storage duration, so is
   // zero-initialized.
   const int k; // expected-error {{default initialization of an object of const}}
___

[PATCH] D151634: [clang] Add test for CWG253

2023-05-28 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill updated this revision to Diff 526342.
Endill added a comment.

Update cxx_dr_status.html


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151634

Files:
  clang/test/CXX/drs/dr0xx.cpp
  clang/test/CXX/drs/dr2xx.cpp
  clang/www/cxx_dr_status.html


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -505,7 +505,7 @@
 https://cplusplus.github.io/CWG/issues/78.html";>78
 CD1
 Section 8.5 paragraph 9 should state it only applies to non-static 
objects
-Superseded by 
+No
   
   
 https://cplusplus.github.io/CWG/issues/79.html";>79
@@ -1556,7 +1556,7 @@
 https://cplusplus.github.io/CWG/issues/253.html";>253
 C++17
 Why must empty or fully-initialized const objects be initialized?
-Unknown
+Clang 3.9
   
   
 https://cplusplus.github.io/CWG/issues/254.html";>254
@@ -3021,7 +3021,7 @@
 https://cplusplus.github.io/CWG/issues/497.html";>497
 CD1
 Missing required initialization in example
-Superseded by 253
+Superseded by 253
   
   
 https://cplusplus.github.io/CWG/issues/498.html";>498
Index: clang/test/CXX/drs/dr2xx.cpp
===
--- clang/test/CXX/drs/dr2xx.cpp
+++ clang/test/CXX/drs/dr2xx.cpp
@@ -4,6 +4,7 @@
 // RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors
 // RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors
 // RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors
+// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors
 
 // PR13819 -- __SIZE_TYPE__ is incompatible.
 typedef __SIZE_TYPE__ size_t; // expected-error 0-1 {{extension}}
@@ -682,6 +683,17 @@
   G::~G() {}
 }
 
+namespace dr253 { // dr253: 3.9
+struct Z {
+  operator int() const { return 0; }
+};
+
+void f() {
+  const Z z1;  
+  const Z z2 = { };
+}
+} // namespace dr253
+
 namespace dr254 { // dr254: yes
   template struct A {
 typedef typename T::type type; // ok even if this is a typedef-name, 
because
Index: clang/test/CXX/drs/dr0xx.cpp
===
--- clang/test/CXX/drs/dr0xx.cpp
+++ clang/test/CXX/drs/dr0xx.cpp
@@ -4,6 +4,7 @@
 // RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors -triple %itanium_abi_triple
 // RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors -triple %itanium_abi_triple
 // RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors -triple %itanium_abi_triple
+// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions 
-pedantic-errors -triple %itanium_abi_triple
 
 namespace dr1 { // dr1: no
   namespace X { extern "C" void dr1_f(int a = 1); }
@@ -1018,7 +1019,7 @@
   };
 }
 
-namespace dr78 { // dr78: sup 
+namespace dr78 { // dr78: no
   // Under DR78, this is valid, because 'k' has static storage duration, so is
   // zero-initialized.
   const int k; // expected-error {{default initialization of an object of 
const}}


Index: clang/www/cxx_dr_status.html
===
--- clang/www/cxx_dr_status.html
+++ clang/www/cxx_dr_status.html
@@ -505,7 +505,7 @@
 https://cplusplus.github.io/CWG/issues/78.html";>78
 CD1
 Section 8.5 paragraph 9 should state it only applies to non-static objects
-Superseded by 
+No
   
   
 https://cplusplus.github.io/CWG/issues/79.html";>79
@@ -1556,7 +1556,7 @@
 https://cplusplus.github.io/CWG/issues/253.html";>253
 C++17
 Why must empty or fully-initialized const objects be initialized?
-Unknown
+Clang 3.9
   
   
 https://cplusplus.github.io/CWG/issues/254.html";>254
@@ -3021,7 +3021,7 @@
 https://cplusplus.github.io/CWG/issues/497.html";>497
 CD1
 Missing required initialization in example
-Superseded by 253
+Superseded by 253
   
   
 https://cplusplus.github.io/CWG/issues/498.html";>498
Index: clang/test/CXX/drs/dr2xx.cpp
===
--- clang/test/CXX/drs/dr2xx.cpp
+++ clang/test/CXX/drs/dr2xx.cpp
@@ -4,6 +4,7 @@
 // RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 
 // PR13819 -- __SIZE_TYPE__ is incompatible.
 typedef __SIZE_TYPE__ size_t; // expected-error 0-1 {{extension}}
@@ -682,6 +683,17 @@
   G::~G() {}
 }
 
+namespace dr253 { // dr253: 3.9
+str

[clang-tools-extra] a82f2b2 - Fix typos in documentation

2023-05-28 Thread Kazu Hirata via cfe-commits

Author: Kazu Hirata
Date: 2023-05-28T13:13:12-07:00
New Revision: a82f2b2db34c58f18d7abbdbe7af51cc1e7ec3aa

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

LOG: Fix typos in documentation

Added: 


Modified: 
clang-tools-extra/docs/pp-trace.rst
clang/docs/LanguageExtensions.rst
clang/docs/ReleaseNotes.rst
compiler-rt/docs/BuildingCompilerRT.rst
lld/docs/ELF/start-stop-gc.rst
llvm/docs/CodingStandards.rst
openmp/docs/design/Runtimes.rst

Removed: 




diff  --git a/clang-tools-extra/docs/pp-trace.rst 
b/clang-tools-extra/docs/pp-trace.rst
index 7339d8084c34e..1e520bb4ef0b6 100644
--- a/clang-tools-extra/docs/pp-trace.rst
+++ b/clang-tools-extra/docs/pp-trace.rst
@@ -44,7 +44,7 @@ Command Line Options
 
   This option specifies a comma-separated list of globs describing the list of
   callbacks that should be traced. Globs are processed in order of appearance.
-  Positive globs add matched callbacks to the set, netative globs (those with
+  Positive globs add matched callbacks to the set, negative globs (those with
   the '-' prefix) remove callacks from the set.
 
   * FileChanged

diff  --git a/clang/docs/LanguageExtensions.rst 
b/clang/docs/LanguageExtensions.rst
index f57549d832188..ae93bb99c3527 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -3558,7 +3558,7 @@ The third argument is one of the memory ordering 
specifiers ``__ATOMIC_RELAXED``
 ``__ATOMIC_CONSUME``, ``__ATOMIC_ACQUIRE``, ``__ATOMIC_RELEASE``,
 ``__ATOMIC_ACQ_REL``, or ``__ATOMIC_SEQ_CST`` following C++11 memory model 
semantics.
 
-In terms or aquire-release ordering barriers these two operations are always
+In terms of acquire-release ordering barriers these two operations are always
 considered as operations with *load-store* semantics, even when the original 
value
 is not actually modified after comparison.
 

diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 4387f9b3145be..8a9dd04cda5bb 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -207,7 +207,7 @@ Non-comprehensive list of changes in this release
   ``memcmp(&lhs, &rhs, sizeof(T)) == 0``.
 - Clang now ignores null directives outside of the include guard when deciding
   whether a file can be enabled for the multiple-include optimization.
-- Clang now support ``__builtin_FUNCSIG()`` which retruns the same information
+- Clang now support ``__builtin_FUNCSIG()`` which returns the same information
   as the ``__FUNCSIG__`` macro (available only with ``-fms-extensions`` flag).
   This fixes (`#58951 `_).
 

diff  --git a/compiler-rt/docs/BuildingCompilerRT.rst 
b/compiler-rt/docs/BuildingCompilerRT.rst
index 2ab6f083fc6ab..b10685c027261 100644
--- a/compiler-rt/docs/BuildingCompilerRT.rst
+++ b/compiler-rt/docs/BuildingCompilerRT.rst
@@ -10,7 +10,7 @@ Building Compiler-RT
 .. _build instructions:
 
 The instructions on this page are aimed at vendors who ship Compiler-RT as 
part of an
-operating system distribution, a toolchain or similar shipping vehicules. If 
you
+operating system distribution, a toolchain or similar shipping vehicles. If you
 are a user merely trying to use Compiler-RT in your program, you most likely 
want to
 refer to your vendor's documentation, or to the general documentation for using
 LLVM, Clang, the various santizers, etc.

diff  --git a/lld/docs/ELF/start-stop-gc.rst b/lld/docs/ELF/start-stop-gc.rst
index 0baa1cae246ab..acbc3c9b49e7f 100644
--- a/lld/docs/ELF/start-stop-gc.rst
+++ b/lld/docs/ELF/start-stop-gc.rst
@@ -10,7 +10,7 @@ If your ``-Wl,--gc-sections`` build fail with a linker error 
like this:
 it is likely your C identifier name sections are not properly annotated to
 suffice under ``--gc-sections``.
 
-``__start_meta`` and ``__stop_meta`` are sometimed called encapsulation
+``__start_meta`` and ``__stop_meta`` are sometimes called encapsulation
 symbols. In October 2015, GNU ld switched behavior and made a ``__start_meta``
 reference from a live section retain all ``meta`` input sections. This
 conservative behavior works for existing code which does not take GC into fair

diff  --git a/llvm/docs/CodingStandards.rst b/llvm/docs/CodingStandards.rst
index 9f0316bd49393..6d8ed3366aaa9 100644
--- a/llvm/docs/CodingStandards.rst
+++ b/llvm/docs/CodingStandards.rst
@@ -117,7 +117,7 @@ outlined in `PEP-8 `_.
 
 For consistency and to limit churn, code should be automatically formatted 
with the
 `black `_ utility. Black allows changing the 
formatting
-rules based on major version. In order to avoid unecessary churn in the 
formatting rules
+rules based on major version. In order to av

[PATCH] D150579: [*]: fix syntax errors in HTML files

2023-05-28 Thread Mohammed Keyvanzadeh via Phabricator via cfe-commits
VoltrexMaster added a comment.

Does anyone know how to change the utils/tools to generate HTML with correct 
syntax? I tried but there are test failures caused by them.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150579

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


[PATCH] D127910: [Clang][AArch64][SME] Add vector load/store (ld1/st1) intrinsics

2023-05-28 Thread Bryan Chan 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 rG9f6250f59105: [Clang][AArch64][SME] Add vector load/store 
(ld1/st1) intrinsics (authored by bryanpkc).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127910

Files:
  clang/include/clang/Basic/BuiltinsAArch64.def
  clang/include/clang/Basic/BuiltinsARM.def
  clang/include/clang/Basic/BuiltinsNEON.def
  clang/include/clang/Basic/BuiltinsSME.def
  clang/include/clang/Basic/CMakeLists.txt
  clang/include/clang/Basic/TargetBuiltins.h
  clang/include/clang/Basic/arm_sme.td
  clang/include/clang/Basic/arm_sve.td
  clang/include/clang/Basic/arm_sve_sme_incl.td
  clang/lib/Basic/Targets/AArch64.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ld1.c
  clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ld1_vnum.c
  clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_st1.c
  clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_st1_vnum.c
  clang/test/Sema/aarch64-sme-intrinsics/acle_sme_imm.cpp
  clang/test/Sema/aarch64-sme-intrinsics/acle_sme_target.c
  clang/utils/TableGen/SveEmitter.cpp
  clang/utils/TableGen/TableGen.cpp
  clang/utils/TableGen/TableGenBackends.h

Index: clang/utils/TableGen/TableGenBackends.h
===
--- clang/utils/TableGen/TableGenBackends.h
+++ clang/utils/TableGen/TableGenBackends.h
@@ -101,6 +101,11 @@
 void EmitSveTypeFlags(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
 void EmitSveRangeChecks(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
 
+void EmitSmeHeader(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
+void EmitSmeBuiltins(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
+void EmitSmeBuiltinCG(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
+void EmitSmeRangeChecks(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
+
 void EmitMveHeader(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
 void EmitMveBuiltinDef(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
 void EmitMveBuiltinSema(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
Index: clang/utils/TableGen/TableGen.cpp
===
--- clang/utils/TableGen/TableGen.cpp
+++ clang/utils/TableGen/TableGen.cpp
@@ -82,6 +82,10 @@
   GenArmSveBuiltinCG,
   GenArmSveTypeFlags,
   GenArmSveRangeChecks,
+  GenArmSmeHeader,
+  GenArmSmeBuiltins,
+  GenArmSmeBuiltinCG,
+  GenArmSmeRangeChecks,
   GenArmCdeHeader,
   GenArmCdeBuiltinDef,
   GenArmCdeBuiltinSema,
@@ -226,6 +230,14 @@
"Generate arm_sve_typeflags.inc for clang"),
 clEnumValN(GenArmSveRangeChecks, "gen-arm-sve-sema-rangechecks",
"Generate arm_sve_sema_rangechecks.inc for clang"),
+clEnumValN(GenArmSmeHeader, "gen-arm-sme-header",
+   "Generate arm_sme.h for clang"),
+clEnumValN(GenArmSmeBuiltins, "gen-arm-sme-builtins",
+   "Generate arm_sme_builtins.inc for clang"),
+clEnumValN(GenArmSmeBuiltinCG, "gen-arm-sme-builtin-codegen",
+   "Generate arm_sme_builtin_cg_map.inc for clang"),
+clEnumValN(GenArmSmeRangeChecks, "gen-arm-sme-sema-rangechecks",
+   "Generate arm_sme_sema_rangechecks.inc for clang"),
 clEnumValN(GenArmMveHeader, "gen-arm-mve-header",
"Generate arm_mve.h for clang"),
 clEnumValN(GenArmMveBuiltinDef, "gen-arm-mve-builtin-def",
@@ -454,6 +466,18 @@
   case GenArmSveRangeChecks:
 EmitSveRangeChecks(Records, OS);
 break;
+  case GenArmSmeHeader:
+EmitSmeHeader(Records, OS);
+break;
+  case GenArmSmeBuiltins:
+EmitSmeBuiltins(Records, OS);
+break;
+  case GenArmSmeBuiltinCG:
+EmitSmeBuiltinCG(Records, OS);
+break;
+  case GenArmSmeRangeChecks:
+EmitSmeRangeChecks(Records, OS);
+break;
   case GenArmCdeHeader:
 EmitCdeHeader(Records, OS);
 break;
Index: clang/utils/TableGen/SveEmitter.cpp
===
--- clang/utils/TableGen/SveEmitter.cpp
+++ clang/utils/TableGen/SveEmitter.cpp
@@ -228,7 +228,7 @@
   }
 
   /// Emits the intrinsic declaration to the ostream.
-  void emitIntrinsic(raw_ostream &OS) const;
+  void emitIntrinsic(raw_ostream &OS, SVEEmitter &Emitter) const;
 
 private:
   std::string getMergeSuffix() const { return MergeSuffix; }
@@ -347,8 +347,21 @@
   /// Create the SVETypeFlags used in CGBuiltins
   void createTypeFlags(raw_ostream &o);
 
+  /// Emit arm_sme.h.
+  void createSMEHeader(raw_ostream &o);
+
+  /// Emit all the SME __builtin prototypes and code needed by Sema.
+  void createSMEBuiltins(raw_ostream &o);
+

[PATCH] D134677: [Clang][AArch64][SME] Add ZA zeroing intrinsics

2023-05-28 Thread Bryan Chan via Phabricator via cfe-commits
bryanpkc updated this revision to Diff 526351.

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

https://reviews.llvm.org/D134677

Files:
  clang/include/clang/Basic/TargetBuiltins.h
  clang/include/clang/Basic/arm_sme.td
  clang/include/clang/Basic/arm_sve_sme_incl.td
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_zero.c
  clang/test/Sema/aarch64-sme-intrinsics/acle_sme_imm.cpp

Index: clang/test/Sema/aarch64-sme-intrinsics/acle_sme_imm.cpp
===
--- clang/test/Sema/aarch64-sme-intrinsics/acle_sme_imm.cpp
+++ clang/test/Sema/aarch64-sme-intrinsics/acle_sme_imm.cpp
@@ -203,6 +203,14 @@
   SVE_ACLE_FUNC(svwrite_ver_za8, _s8, _m,)(0, -1, 16, pg, svundef_s8());
 }
 
+ARM_STREAMING_ATTR
+void test_range_0_255(svbool_t pg, void *ptr) {
+  // expected-error@+1 {{argument value 256 is outside the valid range [0, 255]}}
+  SVE_ACLE_FUNC(svzero_mask_za,,,)(256);
+  // expected-error@+1 {{argument value 18446744073709551615 is outside the valid range [0, 255]}}
+  SVE_ACLE_FUNC(svzero_mask_za,,,)(-1);
+}
+
 ARM_STREAMING_ATTR
 void test_constant(uint64_t u64, svbool_t pg, void *ptr) {
   SVE_ACLE_FUNC(svld1_hor_za8,,,)(u64, u64, 0, pg, ptr);  // expected-error {{argument to 'svld1_hor_za8' must be a constant integer}}
Index: clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_zero.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_zero.c
@@ -0,0 +1,46 @@
+// REQUIRES: aarch64-registered-target
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -o /dev/null %s
+
+#include 
+
+// CHECK-C-LABEL: @test_svzero_mask_za(
+// CHECK-CXX-LABEL: @_Z19test_svzero_mask_zav(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:tail call void @llvm.aarch64.sme.zero(i32 0)
+// CHECK-NEXT:ret void
+//
+void test_svzero_mask_za() {
+  svzero_mask_za(0);
+}
+
+// CHECK-C-LABEL: @test_svzero_mask_za_1(
+// CHECK-CXX-LABEL: @_Z21test_svzero_mask_za_1v(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:tail call void @llvm.aarch64.sme.zero(i32 176)
+// CHECK-NEXT:ret void
+//
+void test_svzero_mask_za_1() {
+  svzero_mask_za(176);
+}
+
+// CHECK-C-LABEL: @test_svzero_mask_za_2(
+// CHECK-CXX-LABEL: @_Z21test_svzero_mask_za_2v(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:tail call void @llvm.aarch64.sme.zero(i32 255)
+// CHECK-NEXT:ret void
+//
+void test_svzero_mask_za_2() {
+  svzero_mask_za(255);
+}
+
+// CHECK-C-LABEL: @test_svzero_za(
+// CHECK-CXX-LABEL: @_Z14test_svzero_zav(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:tail call void @llvm.aarch64.sme.zero(i32 255)
+// CHECK-NEXT:ret void
+//
+void test_svzero_za() {
+  svzero_za();
+}
Index: clang/lib/Sema/SemaChecking.cpp
===
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -2992,6 +2992,10 @@
   if (SemaBuiltinConstantArgRange(TheCall, ArgNum, 0, 15))
 HasError = true;
   break;
+case SVETypeFlags::ImmCheck0_255:
+  if (SemaBuiltinConstantArgRange(TheCall, ArgNum, 0, 255))
+HasError = true;
+  break;
 }
   }
 
Index: clang/lib/CodeGen/CodeGenFunction.h
===
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -4267,6 +4267,9 @@
   llvm::Value *EmitSMEReadWrite(SVETypeFlags TypeFlags,
 llvm::SmallVectorImpl &Ops,
 unsigned IntID);
+  llvm::Value *EmitSMEZero(SVETypeFlags TypeFlags,
+   llvm::SmallVectorImpl &Ops,
+   unsigned IntID);
   llvm::Value *EmitAArch64SMEBuiltinExpr(unsigned BuiltinID, const CallExpr *E);
 
   llvm::Value *EmitAArch64BuiltinExpr(unsigned BuiltinID, const CallExpr *E,
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -9448,6 +9448,16 @@
   return Builder.CreateCall(F, Ops);
 }
 
+Value *CodeGenFunction::EmitSMEZero(SVETypeFlags TypeFlags,
+SmallVectorImpl &Ops,
+unsigned IntID) {
+  // svzero_za() intrinsic zeros the entire za tile and has no paramters.
+  if (Ops.size() == 0)
+Ops.push_back(llvm::ConstantInt::get(Int32Ty, 255));
+  Function *F = CGM.

[PATCH] D147417: [clang-tidy] Do not emit bugprone-exception-escape warnings from coroutines

2023-05-28 Thread Deniz Evrenci via Phabricator via cfe-commits
denizevrenci updated this revision to Diff 526359.
denizevrenci added a comment.

Add tests for co_yield and co_await


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147417

Files:
  clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp
  clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-coro.cpp
  clang/include/clang/AST/StmtCXX.h

Index: clang/include/clang/AST/StmtCXX.h
===
--- clang/include/clang/AST/StmtCXX.h
+++ clang/include/clang/AST/StmtCXX.h
@@ -443,6 +443,17 @@
NumParams);
   }
 
+  child_range childrenExclBody() {
+return child_range(getStoredStmts() + SubStmt::Body + 1,
+   getStoredStmts() + SubStmt::FirstParamMove + NumParams);
+  }
+
+  const_child_range childrenExclBody() const {
+return const_child_range(getStoredStmts() + SubStmt::Body + 1,
+ getStoredStmts() + SubStmt::FirstParamMove +
+ NumParams);
+  }
+
   static bool classof(const Stmt *T) {
 return T->getStmtClass() == CoroutineBodyStmtClass;
   }
Index: clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-coro.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-coro.cpp
@@ -0,0 +1,779 @@
+// RUN: %check_clang_tidy -std=c++20 %s bugprone-exception-escape %t -- \
+// RUN: -- -fexceptions
+
+namespace std {
+
+template  struct enable_if {};
+
+template  struct enable_if {
+  typedef T type;
+};
+
+template 
+using enable_if_t = typename enable_if::type;
+
+template  struct is_same {
+  static constexpr bool value = false;
+};
+
+template  struct is_same {
+  static constexpr bool value = false;
+};
+
+template 
+inline constexpr bool is_same_v = is_same::value;
+
+template  struct coroutine_traits {
+  using promise_type = typename Ret::promise_type;
+};
+
+template  struct coroutine_handle {
+  static coroutine_handle from_address(void *) noexcept;
+  static coroutine_handle from_promise(Promise &promise);
+  constexpr void *address() const noexcept;
+};
+
+template <> struct coroutine_handle {
+  template 
+  coroutine_handle(coroutine_handle) noexcept;
+  static coroutine_handle from_address(void *);
+  constexpr void *address() const noexcept;
+};
+
+struct suspend_always {
+  bool await_ready() noexcept { return false; }
+  void await_suspend(coroutine_handle<>) noexcept {}
+  void await_resume() noexcept {}
+};
+
+struct suspend_never {
+  bool await_ready() noexcept { return true; }
+  void await_suspend(coroutine_handle<>) noexcept {}
+  void await_resume() noexcept {}
+};
+
+} // namespace std
+
+template 
+struct Promise;
+
+template <
+typename T, bool ThrowInTaskConstructor = false,
+bool ThrowInPromiseConstructor = false, bool ThrowInInitialSuspend = false,
+bool ThrowInGetReturnObject = false, bool ThrowInUnhandledException = false>
+struct Task {
+  using promise_type =
+  Promise;
+
+  explicit Task(promise_type &p) {
+if constexpr (ThrowInTaskConstructor) {
+  throw 1;
+}
+
+p.return_val = this;
+  }
+
+  bool await_ready() { return true; }
+
+  void await_suspend(std::coroutine_handle<> h) {}
+
+  void await_resume() {}
+
+  T value;
+};
+
+template 
+struct Task {
+  using promise_type =
+  Promise;
+
+  explicit Task(promise_type &p) {
+if constexpr (ThrowInTaskConstructor) {
+  throw 1;
+}
+
+p.return_val = this;
+  }
+
+  bool await_ready() { return true; }
+
+  void await_suspend(std::coroutine_handle<> h) {}
+
+  void await_resume() {}
+};
+
+template 
+struct Promise {
+  Promise() {
+if constexpr (ThrowInPromiseConstructor) {
+  throw 1;
+}
+  }
+
+  Task get_return_object() {
+if constexpr (ThrowInGetReturnObject) {
+  throw 1;
+}
+
+return Task{*this};
+  }
+
+  std::suspend_never initial_suspend() const {
+if constexpr (ThrowInInitialSuspend) {
+  throw 1;
+}
+
+return {};
+  }
+
+  std::suspend_never final_suspend() const noexcept { return {}; }
+
+  template  void return_value(U &&val) {
+return_val->value = static_cast(val);
+  }
+
+  template  std::suspend_never yield_value(U &&val) {
+return_val->value = static_cast(val);
+return {};
+  }
+
+  void unhandled_exception() {
+if constexpr (ThrowInUnhandledException) {
+  throw 1;
+}
+  }
+
+  Task *return_val;
+};
+
+template 
+struct Promise {
+  Promise() {
+if constexpr (ThrowInPromiseConstructor) {
+  throw 1;
+}
+  }
+
+  Task get_return_object() {
+if constexpr (ThrowInGetReturnObject) {
+  throw 1;
+}
+
+return Task{*this};
+  }
+
+  std::suspend_never initial_suspend() const {
+if constexpr (ThrowInInitialSuspend) {
+  throw 1;
+}
+
+return {};
+  }

[PATCH] D147417: [clang-tidy] Do not emit bugprone-exception-escape warnings from coroutines

2023-05-28 Thread Deniz Evrenci via Phabricator via cfe-commits
denizevrenci added a comment.

@PiotrZSL & @ChuanqiXu may I request a re-review? I addressed all comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147417

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


[clang] b6a5aea - [NFC][CLANG] Fix issue with dereference null return value in EvaluateBuiltinClassifyType()

2023-05-28 Thread via cfe-commits

Author: Manna, Soumi
Date: 2023-05-28T20:09:09-07:00
New Revision: b6a5aeadb5588dedc09eacc3b98b0278d6d53529

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

LOG: [NFC][CLANG] Fix issue with dereference null return value in 
EvaluateBuiltinClassifyType()

This patch uses cast instead of dyn_cast which will assert if the type doesn't 
match.

Reviewed By: erichkeane

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

Added: 


Modified: 
clang/lib/AST/ExprConstant.cpp

Removed: 




diff  --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 1df992cc4ce2f..f2517de4abb7d 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -11290,7 +11290,6 @@ EvaluateBuiltinClassifyType(QualType T, const 
LangOptions &LangOpts) {
   assert(!T->isDependentType() && "unexpected dependent type");
 
   QualType CanTy = T.getCanonicalType();
-  const BuiltinType *BT = dyn_cast(CanTy);
 
   switch (CanTy->getTypeClass()) {
 #define TYPE(ID, BASE)
@@ -11303,7 +11302,7 @@ EvaluateBuiltinClassifyType(QualType T, const 
LangOptions &LangOpts) {
   llvm_unreachable("unexpected non-canonical or dependent type");
 
   case Type::Builtin:
-switch (BT->getKind()) {
+  switch (cast(CanTy)->getKind()) {
 #define BUILTIN_TYPE(ID, SINGLETON_ID)
 #define SIGNED_TYPE(ID, SINGLETON_ID) \
 case BuiltinType::ID: return GCCTypeClass::Integer;



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


[PATCH] D151469: [NFC][CLANG] Fix issue with dereference null return value in EvaluateBuiltinClassifyType()

2023-05-28 Thread Soumi Manna via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb6a5aeadb558: [NFC][CLANG] Fix issue with dereference null 
return value in… (authored by Manna).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151469

Files:
  clang/lib/AST/ExprConstant.cpp


Index: clang/lib/AST/ExprConstant.cpp
===
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -11290,7 +11290,6 @@
   assert(!T->isDependentType() && "unexpected dependent type");
 
   QualType CanTy = T.getCanonicalType();
-  const BuiltinType *BT = dyn_cast(CanTy);
 
   switch (CanTy->getTypeClass()) {
 #define TYPE(ID, BASE)
@@ -11303,7 +11302,7 @@
   llvm_unreachable("unexpected non-canonical or dependent type");
 
   case Type::Builtin:
-switch (BT->getKind()) {
+  switch (cast(CanTy)->getKind()) {
 #define BUILTIN_TYPE(ID, SINGLETON_ID)
 #define SIGNED_TYPE(ID, SINGLETON_ID) \
 case BuiltinType::ID: return GCCTypeClass::Integer;


Index: clang/lib/AST/ExprConstant.cpp
===
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -11290,7 +11290,6 @@
   assert(!T->isDependentType() && "unexpected dependent type");
 
   QualType CanTy = T.getCanonicalType();
-  const BuiltinType *BT = dyn_cast(CanTy);
 
   switch (CanTy->getTypeClass()) {
 #define TYPE(ID, BASE)
@@ -11303,7 +11302,7 @@
   llvm_unreachable("unexpected non-canonical or dependent type");
 
   case Type::Builtin:
-switch (BT->getKind()) {
+  switch (cast(CanTy)->getKind()) {
 #define BUILTIN_TYPE(ID, SINGLETON_ID)
 #define SIGNED_TYPE(ID, SINGLETON_ID) \
 case BuiltinType::ID: return GCCTypeClass::Integer;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D134678: [Clang][AArch64][SME] Add intrinsics for ZA array load/store (LDR/STR)

2023-05-28 Thread Bryan Chan via Phabricator via cfe-commits
bryanpkc updated this revision to Diff 526361.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134678

Files:
  clang/include/clang/Basic/TargetBuiltins.h
  clang/include/clang/Basic/arm_sme.td
  clang/include/clang/Basic/arm_sve_sme_incl.td
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ldr.c
  clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_str.c
  clang/test/Sema/aarch64-sme-intrinsics/acle_sme_imm.cpp

Index: clang/test/Sema/aarch64-sme-intrinsics/acle_sme_imm.cpp
===
--- clang/test/Sema/aarch64-sme-intrinsics/acle_sme_imm.cpp
+++ clang/test/Sema/aarch64-sme-intrinsics/acle_sme_imm.cpp
@@ -185,6 +185,11 @@
   // expected-error@+1 {{argument value 16 is outside the valid range [0, 15]}}
   SVE_ACLE_FUNC(svst1_ver_vnum_za8,,,)(0, -1, 16, pg, ptr, 1);
 
+  // expected-error@+1 {{argument value 16 is outside the valid range [0, 15]}}
+  SVE_ACLE_FUNC(svldr_vnum_za,,,)(-1, 16, ptr);
+  // expected-error@+1 {{argument value 18446744073709551615 is outside the valid range [0, 15]}}
+  SVE_ACLE_FUNC(svstr_vnum_za,,,)(-1, -1, ptr);
+
   // expected-error@+1 {{argument value 18446744073709551615 is outside the valid range [0, 15]}}
   SVE_ACLE_FUNC(svread_hor_za128, _s8, _m,)(svundef_s8(), pg, -1, -1, 0);
   // expected-error@+1 {{argument value 16 is outside the valid range [0, 15]}}
@@ -222,6 +227,9 @@
   SVE_ACLE_FUNC(svst1_hor_vnum_za32,,,)(u64, u64, 0, pg, ptr, u64); // expected-error {{argument to 'svst1_hor_vnum_za32' must be a constant integer}}
   SVE_ACLE_FUNC(svst1_ver_vnum_za64,,,)(0, u64, u64, pg, ptr, u64); // expected-error {{argument to 'svst1_ver_vnum_za64' must be a constant integer}}
 
+  SVE_ACLE_FUNC(svldr_vnum_za,,,)(u64, u64, ptr); // expected-error {{argument to 'svldr_vnum_za' must be a constant integer}}
+  SVE_ACLE_FUNC(svstr_vnum_za,,,)(u64, u64, ptr); // expected-error {{argument to 'svstr_vnum_za' must be a constant integer}}
+
   SVE_ACLE_FUNC(svread_hor_za8, _s8, _m,)(svundef_s8(), pg, 0, u64, u64); // expected-error-re {{argument to 'svread_hor_za8{{.*}}_m' must be a constant integer}}
   SVE_ACLE_FUNC(svread_ver_za16, _s16, _m,)(svundef_s16(), pg, u64, u64, 0);  // expected-error-re {{argument to 'svread_ver_za16{{.*}}_m' must be a constant integer}}
   SVE_ACLE_FUNC(svwrite_hor_za32, _s32, _m,)(0, u64, u64, pg, svundef_s32()); // expected-error-re {{argument to 'svwrite_hor_za32{{.*}}_m' must be a constant integer}}
Index: clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_str.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_str.c
@@ -0,0 +1,29 @@
+// REQUIRES: aarch64-registered-target
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -o /dev/null %s
+
+#include 
+
+// CHECK-C-LABEL: @test_svstr_vnum_za(
+// CHECK-CXX-LABEL: @_Z18test_svstr_vnum_zajPv(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:tail call void @llvm.aarch64.sme.str(i32 [[SLICE_BASE:%.*]], ptr [[PTR:%.*]])
+// CHECK-NEXT:ret void
+//
+void test_svstr_vnum_za(uint32_t slice_base, void *ptr) {
+  svstr_vnum_za(slice_base, 0, ptr);
+}
+
+// CHECK-C-LABEL: @test_svstr_vnum_za_1(
+// CHECK-CXX-LABEL: @_Z20test_svstr_vnum_za_1jPv(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[VSCALE:%.*]] = tail call i64 @llvm.vscale.i64()
+// CHECK-NEXT:[[MULVL:%.*]] = mul nuw nsw i64 [[VSCALE]], 240
+// CHECK-NEXT:[[TMP0:%.*]] = getelementptr i8, ptr [[PTR:%.*]], i64 [[MULVL]]
+// CHECK-NEXT:tail call void @llvm.aarch64.sme.str(i32 [[SLICE_BASE:%.*]], ptr [[TMP0]])
+// CHECK-NEXT:ret void
+//
+void test_svstr_vnum_za_1(uint32_t slice_base, void *ptr) {
+  svstr_vnum_za(slice_base, 15, ptr);
+}
Index: clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ldr.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ldr.c
@@ -0,0 +1,29 @@
+// REQUIRES: aarch64-registered-target
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S 

[PATCH] D146418: Support for OpenMP 5.0 sec 2.12.7 - Declare Target initializer expressions

2023-05-28 Thread Ritanya via Phabricator via cfe-commits
RitanyaB updated this revision to Diff 526377.

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

https://reviews.llvm.org/D146418

Files:
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/OpenMP/declare_target_messages.cpp
  clang/test/OpenMP/declare_target_variables_ast_print.cpp
  clang/test/OpenMP/nvptx_target_exceptions_messages.cpp

Index: clang/test/OpenMP/nvptx_target_exceptions_messages.cpp
===
--- clang/test/OpenMP/nvptx_target_exceptions_messages.cpp
+++ clang/test/OpenMP/nvptx_target_exceptions_messages.cpp
@@ -95,7 +95,7 @@
 int (*D)() = C; // expected-note {{used here}}
 // host-note@-1 {{used here}}
 #pragma omp end declare target
-int foobar3() { throw 1; }
+int foobar3() { throw 1; } // expected-error {{cannot use 'throw' with exceptions disabled}}
 
 // Check no infinite recursion in deferred diagnostic emitter.
 long E = (long)&E;
Index: clang/test/OpenMP/declare_target_variables_ast_print.cpp
===
--- /dev/null
+++ clang/test/OpenMP/declare_target_variables_ast_print.cpp
@@ -0,0 +1,112 @@
+// RUN: %clang_cc1 -w -verify -fopenmp -I %S/Inputs -ast-print %s | FileCheck %s --check-prefix=CHECK
+// expected-no-diagnostics
+
+static int variable = 100;
+static float variable1 = 200;
+static float variable2 = variable1;
+
+static int var = 1;
+
+static int var1 = 10;
+static int *var2 = &var1;
+static int **ptr1 = &var2;
+
+int arr[2] = {1,2};
+int (*arrptr)[2] = &arr;
+
+class declare{
+  public: int x;
+  void print();
+};
+declare obj1;
+declare *obj2 = &obj1;
+
+struct target{
+  int x;
+  void print();
+};
+static target S;
+
+#pragma omp declare target
+int target_var = variable;
+float target_var1 = variable2;
+int *ptr = &var;
+int ***ptr2 = &ptr1;
+int (**ptr3)[2] = &arrptr;
+declare **obj3 = &obj2;
+target *S1 = &S;
+#pragma omp end declare target
+// CHECK: #pragma omp declare target
+// CHECK-NEXT: static int variable = 100;
+// CHECK-NEXT: #pragma omp end declare target
+
+// CHECK-NEXT: #pragma omp declare target
+// CHECK-NEXT: static float variable1 = 200;
+// CHECK-NEXT: #pragma omp end declare target
+// CHECK-NEXT: #pragma omp declare target
+// CHECK-NEXT: static float variable2 = variable1;
+// CHECK-NEXT: #pragma omp end declare target
+
+// CHECK: #pragma omp declare target
+// CHECK-NEXT: static int var = 1;
+// CHECK-NEXT: #pragma omp end declare target
+
+// CHECK-NEXT: #pragma omp declare target
+// CHECK-NEXT: static int var1 = 10;
+// CHECK-NEXT: #pragma omp end declare target
+// CHECK-NEXT: #pragma omp declare target
+// CHECK-NEXT: static int *var2 = &var1;
+// CHECK-NEXT: #pragma omp end declare target
+// CHECK-NEXT: #pragma omp declare target
+// CHECK-NEXT: static int **ptr1 = &var2;
+// CHECK-NEXT: #pragma omp end declare target
+
+// CHECK-NEXT: #pragma omp declare target
+// CHECK-NEXT: int arr[2] = {1, 2};
+// CHECK-NEXT: #pragma omp end declare target
+// CHECK-NEXT: #pragma omp declare target
+// CHECK-NEXT: int (*arrptr)[2] = &arr;
+// CHECK-NEXT: #pragma omp end declare target
+
+// CHECK-NEXT: class declare {
+// CHECK-NEXT: public:
+// CHECK-NEXT:  int x;
+// CHECK-NEXT:  void print();
+// CHECK-NEXT: };
+// CHECK-NEXT: #pragma omp declare target
+// CHECK-NEXT: declare obj1;
+// CHECK-NEXT: #pragma omp end declare target
+// CHECK-NEXT: #pragma omp declare target
+// CHECK-NEXT: declare *obj2 = &obj1;
+// CHECK-NEXT: #pragma omp end declare target
+
+// CHECK-NEXT: struct target {
+// CHECK-NEXT:  int x;
+// CHECK-NEXT:  void print();
+// CHECK-NEXT: };
+// CHECK-NEXT: #pragma omp declare target
+// CHECK-NEXT: static target S;
+// CHECK-NEXT: #pragma omp end declare target
+
+// CHECK-NEXT: #pragma omp declare target
+// CHECK-NEXT: int target_var = variable;
+// CHECK-NEXT: #pragma omp end declare target
+// CHECK-NEXT: #pragma omp declare target
+// CHECK-NEXT: float target_var1 = variable2;
+// CHECK-NEXT: #pragma omp end declare target
+// CHECK-NEXT: #pragma omp declare target
+// CHECK-NEXT: int *ptr = &var;
+// CHECK-NEXT: #pragma omp end declare target
+// CHECK-NEXT: #pragma omp declare target
+// CHECK-NEXT: int ***ptr2 = &ptr1;
+// CHECK-NEXT: #pragma omp end declare target
+// CHECK-NEXT: #pragma omp declare target
+// CHECK-NEXT: int (**ptr3)[2] = &arrptr;
+// CHECK-NEXT: #pragma omp end declare target
+// CHECK-NEXT: #pragma omp declare target
+// CHECK-NEXT: declare **obj3 = &obj2;
+// CHECK-NEXT: #pragma omp end declare target
+// CHECK-NEXT: #pragma omp declare target
+// CHECK-NEXT: target *S1 = &S;
+// CHECK-NEXT: #pragma omp end declare target
+
Index: clang/test/OpenMP/declare_target_messages.cpp
===
--- clang/test/OpenMP/declare_target_messages.cpp
+++ clang/test/OpenMP/declare_target_messages.cpp
@@ -233,6 +233,42 @@
 #pragma omp declare 

[PATCH] D134679: [Clang][AArch64][SME] Add intrinsics for reading streaming vector length

2023-05-28 Thread Bryan Chan via Phabricator via cfe-commits
bryanpkc updated this revision to Diff 526379.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134679

Files:
  clang/include/clang/Basic/arm_sme.td
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_cnt.c


Index: clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_cnt.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_cnt.c
@@ -0,0 +1,46 @@
+// REQUIRES: aarch64-registered-target
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme 
-target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s 
-check-prefixes=CHECK,CHECK-C
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme 
-target-feature +sve -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s 
-check-prefixes=CHECK,CHECK-CXX
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme 
-target-feature +sve -S -O1 -Werror -o /dev/null %s
+
+#include 
+
+// CHECK-C-LABEL: @test_svcntsb(
+// CHECK-CXX-LABEL: @_Z12test_svcntsbv(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = tail call i64 @llvm.aarch64.sme.cntsb()
+// CHECK-NEXT:ret i64 [[TMP0]]
+//
+uint64_t test_svcntsb() {
+  return svcntsb();
+}
+
+// CHECK-C-LABEL: @test_svcntsh(
+// CHECK-CXX-LABEL: @_Z12test_svcntshv(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = tail call i64 @llvm.aarch64.sme.cntsh()
+// CHECK-NEXT:ret i64 [[TMP0]]
+//
+uint64_t test_svcntsh() {
+  return svcntsh();
+}
+
+// CHECK-C-LABEL: @test_svcntsw(
+// CHECK-CXX-LABEL: @_Z12test_svcntswv(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = tail call i64 @llvm.aarch64.sme.cntsw()
+// CHECK-NEXT:ret i64 [[TMP0]]
+//
+uint64_t test_svcntsw() {
+  return svcntsw();
+}
+
+// CHECK-C-LABEL: @test_svcntsd(
+// CHECK-CXX-LABEL: @_Z12test_svcntsdv(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = tail call i64 @llvm.aarch64.sme.cntsd()
+// CHECK-NEXT:ret i64 [[TMP0]]
+//
+uint64_t test_svcntsd() {
+  return svcntsd();
+}
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -9923,6 +9923,7 @@
   getContext().GetBuiltinType(BuiltinID, Error, &ICEArguments);
   assert(Error == ASTContext::GE_None && "Should not codegen an error");
 
+  llvm::Type *Ty = ConvertType(E->getType());
   llvm::SmallVector Ops;
   for (unsigned i = 0, e = E->getNumArgs(); i != e; i++) {
 if ((ICEArguments & (1 << i)) == 0)
@@ -9953,6 +9954,12 @@
 return EmitSMEZero(TypeFlags, Ops, Builtin->LLVMIntrinsic);
   else if (TypeFlags.isLoadReg() || TypeFlags.isStoreReg())
 return EmitSMELdrStr(TypeFlags, Ops, Builtin->LLVMIntrinsic);
+  else if (Builtin->LLVMIntrinsic != 0) {
+Function *F = CGM.getIntrinsic(Builtin->LLVMIntrinsic,
+   getSVEOverloadTypes(TypeFlags, Ty, Ops));
+Value *Call = Builder.CreateCall(F, Ops);
+return Call;
+  }
 
   /// Should not happen
   return nullptr;
Index: clang/include/clang/Basic/arm_sme.td
===
--- clang/include/clang/Basic/arm_sme.td
+++ clang/include/clang/Basic/arm_sme.td
@@ -135,3 +135,19 @@
   def SVZERO_ZA  : SInst<"svzero_za", "v", "", MergeNone, 
"aarch64_sme_zero",
  [IsZero, IsOverloadNone, IsStreamingCompatible, 
IsSharedZA]>;
 }
+
+
+// SME - Counting elements in a streaming vector
+
+multiclass ZACount {
+  let TargetGuard = "sme" in {
+def NAME : SInst<"sv" # n_suffix, "nv", "", MergeNone,
+  "aarch64_sme_" # n_suffix,
+  [IsOverloadNone, IsStreamingCompatible, IsPreservesZA]>;
+  }
+}
+
+defm SVCNTSB : ZACount<"cntsb">;
+defm SVCNTSH : ZACount<"cntsh">;
+defm SVCNTSW : ZACount<"cntsw">;
+defm SVCNTSD : ZACount<"cntsd">;


Index: clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_cnt.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_cnt.c
@@ -0,0 +1,46 @@
+// REQUIRES: aarch64-registered-target
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -o /dev/null %s
+
+#include 
+
+// CHECK-C-LABEL: @test_svcntsb(
+// CHECK-CXX-LABEL: @_Z12test_svcntsbv(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = tail c

[PATCH] D146809: [clang-repl] Implement Value pretty printing

2023-05-28 Thread Jun Zhang via Phabricator via cfe-commits
junaire updated this revision to Diff 526383.
junaire added a comment.

Make CreateUniqName a static helper


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146809

Files:
  clang/include/clang/Interpreter/Interpreter.h
  clang/include/clang/Interpreter/PartialTranslationUnit.h
  clang/include/clang/Interpreter/Value.h
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Headers/__clang_interpreter_runtime_printvalue.h
  clang/lib/Interpreter/CMakeLists.txt
  clang/lib/Interpreter/DeviceOffload.cpp
  clang/lib/Interpreter/DeviceOffload.h
  clang/lib/Interpreter/IncrementalExecutor.cpp
  clang/lib/Interpreter/IncrementalExecutor.h
  clang/lib/Interpreter/IncrementalParser.cpp
  clang/lib/Interpreter/IncrementalParser.h
  clang/lib/Interpreter/Interpreter.cpp
  clang/lib/Interpreter/InterpreterUtils.cpp
  clang/lib/Interpreter/InterpreterUtils.h
  clang/lib/Interpreter/Value.cpp
  clang/lib/Interpreter/ValuePrinter.cpp
  clang/test/Interpreter/pretty-print.cpp
  clang/tools/clang-repl/CMakeLists.txt
  clang/tools/clang-repl/ClangRepl.cpp
  clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp
  clang/unittests/Interpreter/IncrementalProcessingTest.cpp
  clang/unittests/Interpreter/InterpreterTest.cpp

Index: clang/unittests/Interpreter/InterpreterTest.cpp
===
--- clang/unittests/Interpreter/InterpreterTest.cpp
+++ clang/unittests/Interpreter/InterpreterTest.cpp
@@ -29,6 +29,7 @@
 #include "gtest/gtest.h"
 
 using namespace clang;
+using namespace caas;
 
 #if defined(_AIX)
 #define CLANG_INTERPRETER_NO_SUPPORT_EXEC
@@ -46,12 +47,12 @@
   DiagnosticConsumer *Client = nullptr) {
   Args ClangArgs = {"-Xclang", "-emit-llvm-only"};
   ClangArgs.insert(ClangArgs.end(), ExtraArgs.begin(), ExtraArgs.end());
-  auto CB = clang::IncrementalCompilerBuilder();
+  auto CB = clang::caas::IncrementalCompilerBuilder();
   CB.SetCompilerArgs(ClangArgs);
   auto CI = cantFail(CB.CreateCpp());
   if (Client)
 CI->getDiagnostics().setClient(Client, /*ShouldOwnClient=*/false);
-  return cantFail(clang::Interpreter::create(std::move(CI)));
+  return cantFail(clang::caas::Interpreter::create(std::move(CI)));
 }
 
 static size_t DeclsSize(TranslationUnitDecl *PTUDecl) {
Index: clang/unittests/Interpreter/IncrementalProcessingTest.cpp
===
--- clang/unittests/Interpreter/IncrementalProcessingTest.cpp
+++ clang/unittests/Interpreter/IncrementalProcessingTest.cpp
@@ -27,6 +27,7 @@
 
 using namespace llvm;
 using namespace clang;
+using namespace clang::caas;
 
 namespace {
 
@@ -52,12 +53,12 @@
 
 TEST(IncrementalProcessing, EmitCXXGlobalInitFunc) {
   std::vector ClangArgv = {"-Xclang", "-emit-llvm-only"};
-  auto CB = clang::IncrementalCompilerBuilder();
+  auto CB = clang::caas::IncrementalCompilerBuilder();
   CB.SetCompilerArgs(ClangArgv);
   auto CI = cantFail(CB.CreateCpp());
   auto Interp = llvm::cantFail(Interpreter::create(std::move(CI)));
 
-  std::array PTUs;
+  std::array PTUs;
 
   PTUs[0] = &llvm::cantFail(Interp->Parse(TestProgram1));
   ASSERT_TRUE(PTUs[0]->TheModule);
Index: clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp
===
--- clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp
+++ clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp
@@ -30,6 +30,7 @@
 #include "gtest/gtest.h"
 
 using namespace clang;
+using namespace clang::caas;
 
 namespace {
 using Args = std::vector;
@@ -38,12 +39,12 @@
   DiagnosticConsumer *Client = nullptr) {
   Args ClangArgs = {"-Xclang", "-emit-llvm-only"};
   ClangArgs.insert(ClangArgs.end(), ExtraArgs.begin(), ExtraArgs.end());
-  auto CB = clang::IncrementalCompilerBuilder();
+  auto CB = clang::caas::IncrementalCompilerBuilder();
   CB.SetCompilerArgs(ClangArgs);
   auto CI = cantFail(CB.CreateCpp());
   if (Client)
 CI->getDiagnostics().setClient(Client, /*ShouldOwnClient=*/false);
-  return cantFail(clang::Interpreter::create(std::move(CI)));
+  return cantFail(clang::caas::Interpreter::create(std::move(CI)));
 }
 
 TEST(InterpreterTest, CatchException) {
Index: clang/tools/clang-repl/ClangRepl.cpp
===
--- clang/tools/clang-repl/ClangRepl.cpp
+++ clang/tools/clang-repl/ClangRepl.cpp
@@ -97,7 +97,7 @@
 return 0;
   }
 
-  clang::IncrementalCompilerBuilder CB;
+  clang::caas::IncrementalCompilerBuilder CB;
   CB.SetCompilerArgs(ClangArgv);
 
   std::unique_ptr DeviceCI;
@@ -132,10 +132,10 @@
   if (CudaEnabled)
 DeviceCI->LoadRequestedPlugins();
 
-  std::unique_ptr Interp;
+  std::unique_ptr Interp;
   if (CudaEnabled) {
-Interp = ExitOnErr(
-clang::Interpreter::createWithCUDA(std::move(CI), std::move(DeviceCI)))

[PATCH] D146809: [clang-repl] Implement Value pretty printing

2023-05-28 Thread Jun Zhang via Phabricator via cfe-commits
junaire added inline comments.



Comment at: clang/tools/clang-repl/CMakeLists.txt:40
+  ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@PEBX@Z
+  
??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z
+  
??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@D@Z

v.g.vassilev wrote:
> v.g.vassilev wrote:
> > We should check if there is a better way to export a subset of symbols 
> > through the llvm build system. Maybe @lhames, @sunho or @sgraenitz know how.
> I wonder if that's related to https://reviews.llvm.org/D151620 in some way? 
> That is, does D151620 fix our exports and this section becomes redundant?
I haven't tested that but I don't think so. The patch you posted is about 
fixing issues on particular platforms like MinGW.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146809

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


[PATCH] D148490: [AIX] use system assembler for assembly files

2023-05-28 Thread ChenZheng via Phabricator via cfe-commits
shchenz added a comment.

gentle ping


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148490

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


[PATCH] D146809: [clang-repl] Implement Value pretty printing

2023-05-28 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev added inline comments.



Comment at: clang/lib/Interpreter/IncrementalParser.h:86
 
+  Parser &getParser() { return *P; }
+

Is that used?



Comment at: clang/lib/Interpreter/ValuePrinter.cpp:262
+
+static llvm::Expected CompileDecl(Interpreter &Interp,
+   Decl *D) {

Let's add a FIXME here. The problem `CompileDecl` and `GenModule` intends to 
solve is that when we synthesize AST we need to inform the rest of the Clang 
infrastructure about it and attach the produced `llvm::Module` to the JIT so 
that it can resolve symbols from it.

In cling that is solved with a RAII object which marks a scope where the 
synthesis happens and takes care to inform the rest of the infrastructure. We 
need something similar and a little more robust maybe. Something like 
`ASTSynthesisRAII` which ultimately hides this machinery especially from the 
public API.



Comment at: clang/lib/Interpreter/ValuePrinter.cpp:442
+
+REPL_EXTERNAL_VISIBILITY std::string PrintValueRuntime(const char *const *Val) 
{
+  return PrintString(Val);

All of the `PrintValueRuntime` seem to be duplicating code. We could use the 
preprocessor to expand these to but it would require some changes which I 
believe could be done as a separate patch:

* Perhaps we should be compatible with cling here in terms of naming as that's 
a public API - there I believe we use `printValue`.
* We should try to leverage `TemplateBase.cpp::printIntegral` for integral 
types.
* We should not return `std::string` here but a `const char*` and we should 
provide somewhere storage for them. That would probably make porting to 
embedded systems easier since on many the  header is hard to support. 

I believe it would be enough to have a fixme for now.



Comment at: clang/lib/Interpreter/ValuePrinter.cpp:473
+  else if (auto *BT = DesugaredTy.getCanonicalType()->getAs()) {
+switch (BT->getKind()) {
+case BuiltinType::Bool: {

We could use the preprocessor the way we do in `Value.cpp` to expand this 
dispatcher.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146809

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


[PATCH] D146809: [clang-repl] Implement Value pretty printing

2023-05-28 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev added inline comments.



Comment at: clang/lib/Interpreter/ValuePrinter.cpp:1
+#include "InterpreterUtils.h"
+#include "clang/AST/ASTContext.h"

Please add the llvm preamble. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146809

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