[PATCH] D151610: [Docs] Fix Sphinx documentation formatting issues in LanguageExtensions.rst

2023-05-27 Thread M. Zeeshan Siddiqui via Phabricator via cfe-commits
codemzs updated this revision to Diff 526246.
codemzs retitled this revision from "[Docs] Fix formatting issues in 
LanguageExtensions.rst" to "[Docs] Fix Sphinx documentation formatting issues 
in LanguageExtensions.rst".
codemzs edited the summary of this revision.
codemzs added a reviewer: rjmccall.
codemzs added a subscriber: rjmccall.
codemzs added a comment.

Fix indentation and spacing.

Hi @pengfei and @rjmccall,

In the previous commit, the Sphinx documentation issues were overlooked due to 
an unexpected build error and the Sphinx build did not run as part of pre-build 
check. This was compounded by my unfamiliarity with the documentation 
generation process.

In this revision, I've addressed the indentation and spacing issues in the 
`.rst` files. The fixes have been validated locally using `ninja 
docs-clang-html` and `ninja docs-llvm-html`.

Apologies for the confusion in the previous submission. I look forward to your 
feedback on this revision.


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

https://reviews.llvm.org/D151610

Files:
  clang/docs/LanguageExtensions.rst


Index: clang/docs/LanguageExtensions.rst
===
--- clang/docs/LanguageExtensions.rst
+++ clang/docs/LanguageExtensions.rst
@@ -784,8 +784,8 @@
 to ``float``; see below for more information on this emulation.
 
 * ``__fp16`` is supported on all targets. The special semantics of this
-type mean that no arithmetic is ever performed directly on ``__fp16`` values;
-see below.
+  type mean that no arithmetic is ever performed directly on ``__fp16`` values;
+  see below.
 
 * ``_Float16`` is supported on the following targets:
   * 32-bit ARM (natively on some architecture versions)
@@ -809,7 +809,7 @@
 exponent range as `float`, just with greatly reduced precision.
 
 ``_Float16`` and ``__bf16`` follow the usual rules for arithmetic
-floating-point types.  Most importantly, this means that arithmetic operations
+floating-point types. Most importantly, this means that arithmetic operations
 on operands of these types are formally performed in the type and produce
 values of the type. ``__fp16`` does not follow those rules: most operations
 immediately promote operands of type ``__fp16`` to ``float``, and so
@@ -833,28 +833,29 @@
 
 The use of excess precision can be independently controlled for these two
 types with the ``-ffloat16-excess-precision=`` and
-``-fbfloat16-excess-precision=`` options.  Valid values include:
-- ``none`` (meaning to perform strict operation-by-operation emulation)
-- ``standard`` (meaning that excess precision is permitted under the rules
-  described in the standard, i.e. never across explicit casts or statements)
-- ``fast`` (meaning that excess precision is permitted whenever the
+``-fbfloat16-excess-precision=`` options. Valid values include:
+
+* ``none``: meaning to perform strict operation-by-operation emulation
+* ``standard``: meaning that excess precision is permitted under the rules
+  described in the standard, i.e. never across explicit casts or statements
+* ``fast``: meaning that excess precision is permitted whenever the
   optimizer sees an opportunity to avoid truncations; currently this has no
-  effect beyond ``standard``)
+  effect beyond ``standard``
 
-The ``_Float16`` type is an interchange floating type specified in
- ISO/IEC TS 18661-3:2015 ("Floating-point extensions for C").  It will
+The ``_Float16`` type is an interchange floating type specified in 
+ISO/IEC TS 18661-3:2015 ("Floating-point extensions for C"). It will
 be supported on more targets as they define ABIs for it.
 
 The ``__bf16`` type is a non-standard extension, but it generally follows
 the rules for arithmetic interchange floating types from ISO/IEC TS
-18661-3:2015.  In previous versions of Clang, it was a storage-only type
-that forbade arithmetic operations.  It will be supported on more targets
+18661-3:2015. In previous versions of Clang, it was a storage-only type
+that forbade arithmetic operations. It will be supported on more targets
 as they define ABIs for it.
 
 The ``__fp16`` type was originally an ARM extension and is specified
 by the `ARM C Language Extensions 
`_.
 Clang uses the ``binary16`` format from IEEE 754-2008 for ``__fp16``,
-not the ARM alternative format.  Operators that expect arithmetic operands
+not the ARM alternative format. Operators that expect arithmetic operands
 immediately promote ``__fp16`` operands to ``float``.
 
 It is recommended that portable code use ``_Float16`` instead of ``__fp16``,
@@ -870,7 +871,7 @@
 
 Because default argument promotion only applies to the standard floating-point
 types, ``_Float16`` values are not promoted to ``double`` when passed as 
variadic
-or untyped arguments.  As a consequence, some caution must be taken when using
+or untyped arguments. As a consequence, some caution must be taken when using
 certain libra

[PATCH] D138278: TableGen: honor LLVM_LINK_LLVM_DYLIB by default

2023-05-27 Thread Tobias Grosser via Phabricator via cfe-commits
grosser added a comment.
Herald added subscribers: bviyer, asb.

@nhaehnle, I wanted to check in briefly if you are getting the same error 
messages?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138278

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


[clang] ddeab07 - [clang-repl][CUDA] Re-land: Initial interactive CUDA support for clang-repl

2023-05-27 Thread Anubhab Ghosh via cfe-commits

Author: Anubhab Ghosh
Date: 2023-05-27T13:54:42+05:30
New Revision: ddeab07ca63235f8d952e1171b56fdb0f2d761c9

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

LOG: [clang-repl][CUDA] Re-land: Initial interactive CUDA support for clang-repl

CUDA support can be enabled in clang-repl with --cuda flag.
Device code linking is not yet supported. inline must be used with all
__device__ functions.

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

Added: 
clang/lib/Interpreter/DeviceOffload.cpp
clang/lib/Interpreter/DeviceOffload.h
clang/test/Interpreter/CUDA/device-function-template.cu
clang/test/Interpreter/CUDA/device-function.cu
clang/test/Interpreter/CUDA/host-and-device.cu
clang/test/Interpreter/CUDA/lit.local.cfg
clang/test/Interpreter/CUDA/memory.cu
clang/test/Interpreter/CUDA/sanity.cu

Modified: 
clang/include/clang/Interpreter/Interpreter.h
clang/lib/CodeGen/CGCUDANV.cpp
clang/lib/CodeGen/CodeGenAction.cpp
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/CodeGen/ModuleBuilder.cpp
clang/lib/Interpreter/CMakeLists.txt
clang/lib/Interpreter/IncrementalParser.cpp
clang/lib/Interpreter/IncrementalParser.h
clang/lib/Interpreter/Interpreter.cpp
clang/test/lit.cfg.py
clang/tools/clang-repl/ClangRepl.cpp
clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp
clang/unittests/Interpreter/IncrementalProcessingTest.cpp
clang/unittests/Interpreter/InterpreterTest.cpp

Removed: 




diff  --git a/clang/include/clang/Interpreter/Interpreter.h 
b/clang/include/clang/Interpreter/Interpreter.h
index e680218452d1c..43573fb1a4b89 100644
--- a/clang/include/clang/Interpreter/Interpreter.h
+++ b/clang/include/clang/Interpreter/Interpreter.h
@@ -42,8 +42,34 @@ class IncrementalParser;
 /// Create a pre-configured \c CompilerInstance for incremental processing.
 class IncrementalCompilerBuilder {
 public:
+  IncrementalCompilerBuilder() {}
+
+  void SetCompilerArgs(const std::vector &Args) {
+UserArgs = Args;
+  }
+
+  // General C++
+  llvm::Expected> CreateCpp();
+
+  // Offload options
+  void SetOffloadArch(llvm::StringRef Arch) { OffloadArch = Arch; };
+
+  // CUDA specific
+  void SetCudaSDK(llvm::StringRef path) { CudaSDKPath = path; };
+
+  llvm::Expected> CreateCudaHost();
+  llvm::Expected> CreateCudaDevice();
+
+private:
   static llvm::Expected>
   create(std::vector &ClangArgv);
+
+  llvm::Expected> createCuda(bool device);
+
+  std::vector UserArgs;
+
+  llvm::StringRef OffloadArch;
+  llvm::StringRef CudaSDKPath;
 };
 
 /// Provides top-level interfaces for incremental compilation and execution.
@@ -52,6 +78,9 @@ class Interpreter {
   std::unique_ptr IncrParser;
   std::unique_ptr IncrExecutor;
 
+  // An optional parser for CUDA offloading
+  std::unique_ptr DeviceParser;
+
   Interpreter(std::unique_ptr CI, llvm::Error &Err);
 
   llvm::Error CreateExecutor();
@@ -66,6 +95,9 @@ class Interpreter {
   ~Interpreter();
   static llvm::Expected>
   create(std::unique_ptr CI);
+  static llvm::Expected>
+  createWithCUDA(std::unique_ptr CI,
+ std::unique_ptr DCI);
   const ASTContext &getASTContext() const;
   ASTContext &getASTContext();
   const CompilerInstance *getCompilerInstance() const;

diff  --git a/clang/lib/CodeGen/CGCUDANV.cpp b/clang/lib/CodeGen/CGCUDANV.cpp
index 1f429e4305790..c30a08a5722dc 100644
--- a/clang/lib/CodeGen/CGCUDANV.cpp
+++ b/clang/lib/CodeGen/CGCUDANV.cpp
@@ -24,6 +24,7 @@
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/ReplaceConstant.h"
 #include "llvm/Support/Format.h"
+#include "llvm/Support/VirtualFileSystem.h"
 
 using namespace clang;
 using namespace CodeGen;
@@ -721,8 +722,9 @@ llvm::Function *CGNVCUDARuntime::makeModuleCtorFunction() {
   // handle so CUDA runtime can figure out what to call on the GPU side.
   std::unique_ptr CudaGpuBinary = nullptr;
   if (!CudaGpuBinaryFileName.empty()) {
-llvm::ErrorOr> CudaGpuBinaryOrErr =
-llvm::MemoryBuffer::getFileOrSTDIN(CudaGpuBinaryFileName);
+auto VFS = CGM.getFileSystem();
+auto CudaGpuBinaryOrErr =
+VFS->getBufferForFile(CudaGpuBinaryFileName, -1, false);
 if (std::error_code EC = CudaGpuBinaryOrErr.getError()) {
   CGM.getDiags().Report(diag::err_cannot_open_file)
   << CudaGpuBinaryFileName << EC.message();

diff  --git a/clang/lib/CodeGen/CodeGenAction.cpp 
b/clang/lib/CodeGen/CodeGenAction.cpp
index 29adf88acd704..784ff77c61727 100644
--- a/clang/lib/CodeGen/CodeGenAction.cpp
+++ b/clang/lib/CodeGen/CodeGenAction.cpp
@@ -264,6 +264,7 @@ namespace clang {
 // Links each entry in LinkModules into our module.  Returns true on error.
 bool LinkInModules() {
   for (auto &LM : LinkModules) {
+assert(LM.Module && "

[PATCH] D146389: [clang-repl][CUDA] Initial interactive CUDA support for clang-repl

2023-05-27 Thread Anubhab Ghosh via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGddeab07ca632: [clang-repl][CUDA] Re-land: Initial 
interactive CUDA support for clang-repl (authored by argentite).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146389

Files:
  clang/include/clang/Interpreter/Interpreter.h
  clang/lib/CodeGen/CGCUDANV.cpp
  clang/lib/CodeGen/CodeGenAction.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/ModuleBuilder.cpp
  clang/lib/Interpreter/CMakeLists.txt
  clang/lib/Interpreter/DeviceOffload.cpp
  clang/lib/Interpreter/DeviceOffload.h
  clang/lib/Interpreter/IncrementalParser.cpp
  clang/lib/Interpreter/IncrementalParser.h
  clang/lib/Interpreter/Interpreter.cpp
  clang/test/Interpreter/CUDA/device-function-template.cu
  clang/test/Interpreter/CUDA/device-function.cu
  clang/test/Interpreter/CUDA/host-and-device.cu
  clang/test/Interpreter/CUDA/lit.local.cfg
  clang/test/Interpreter/CUDA/memory.cu
  clang/test/Interpreter/CUDA/sanity.cu
  clang/test/lit.cfg.py
  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
@@ -46,7 +46,9 @@
   DiagnosticConsumer *Client = nullptr) {
   Args ClangArgs = {"-Xclang", "-emit-llvm-only"};
   ClangArgs.insert(ClangArgs.end(), ExtraArgs.begin(), ExtraArgs.end());
-  auto CI = cantFail(clang::IncrementalCompilerBuilder::create(ClangArgs));
+  auto CB = clang::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)));
Index: clang/unittests/Interpreter/IncrementalProcessingTest.cpp
===
--- clang/unittests/Interpreter/IncrementalProcessingTest.cpp
+++ clang/unittests/Interpreter/IncrementalProcessingTest.cpp
@@ -52,7 +52,9 @@
 
 TEST(IncrementalProcessing, EmitCXXGlobalInitFunc) {
   std::vector ClangArgv = {"-Xclang", "-emit-llvm-only"};
-  auto CI = llvm::cantFail(IncrementalCompilerBuilder::create(ClangArgv));
+  auto CB = clang::IncrementalCompilerBuilder();
+  CB.SetCompilerArgs(ClangArgv);
+  auto CI = cantFail(CB.CreateCpp());
   auto Interp = llvm::cantFail(Interpreter::create(std::move(CI)));
 
   std::array PTUs;
Index: clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp
===
--- clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp
+++ clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp
@@ -38,7 +38,9 @@
   DiagnosticConsumer *Client = nullptr) {
   Args ClangArgs = {"-Xclang", "-emit-llvm-only"};
   ClangArgs.insert(ClangArgs.end(), ExtraArgs.begin(), ExtraArgs.end());
-  auto CI = cantFail(clang::IncrementalCompilerBuilder::create(ClangArgs));
+  auto CB = clang::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)));
Index: clang/tools/clang-repl/ClangRepl.cpp
===
--- clang/tools/clang-repl/ClangRepl.cpp
+++ clang/tools/clang-repl/ClangRepl.cpp
@@ -20,9 +20,13 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/ManagedStatic.h" // llvm_shutdown
 #include "llvm/Support/Signals.h"
-#include "llvm/Support/TargetSelect.h" // llvm::Initialize*
+#include "llvm/Support/TargetSelect.h"
 #include 
 
+static llvm::cl::opt CudaEnabled("cuda", llvm::cl::Hidden);
+static llvm::cl::opt CudaPath("cuda-path", llvm::cl::Hidden);
+static llvm::cl::opt OffloadArch("offload-arch", llvm::cl::Hidden);
+
 static llvm::cl::list
 ClangArgs("Xcc",
   llvm::cl::desc("Argument to pass to the CompilerInvocation"),
@@ -76,8 +80,11 @@
   std::vector ClangArgv(ClangArgs.size());
   std::transform(ClangArgs.begin(), ClangArgs.end(), ClangArgv.begin(),
  [](const std::string &s) -> const char * { return s.data(); });
-  llvm::InitializeNativeTarget();
-  llvm::InitializeNativeTargetAsmPrinter();
+  // Initialize all targets (required for device offloading)
+  llvm::InitializeAllTargetInfos();
+  llvm::InitializeAllTargets();
+  llvm::InitializeAllTargetMCs();
+  llvm::InitializeAllAsmPrinters();
 
   if (OptHostSupportsJit) {
 auto J = llvm::orc::LLJITBuilder().create(

[PATCH] D151610: [Docs] Fix Sphinx documentation formatting issues in LanguageExtensions.rst

2023-05-27 Thread Phoebe Wang via Phabricator via cfe-commits
pengfei accepted this revision.
pengfei added a comment.
This revision is now accepted and ready to land.

LGTM.


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

https://reviews.llvm.org/D151610

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


[clang] dd2e681 - [Docs] Fix Sphinx documentation formatting issues in LanguageExtensions.rst

2023-05-27 Thread Phoebe Wang via cfe-commits

Author: M. Zeeshan Siddiqui
Date: 2023-05-27T16:45:21+08:00
New Revision: dd2e681612f1f09d92abc9e16f5f65293e3fe725

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

LOG: [Docs] Fix Sphinx documentation formatting issues in LanguageExtensions.rst

Fix indentation and spacing.

Reviewed By: pengfei

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

Added: 


Modified: 
clang/docs/LanguageExtensions.rst

Removed: 




diff  --git a/clang/docs/LanguageExtensions.rst 
b/clang/docs/LanguageExtensions.rst
index e5b725e15d08..f57549d83218 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -784,8 +784,8 @@ supported if the compiler can emulate arithmetic on the 
type by promoting
 to ``float``; see below for more information on this emulation.
 
 * ``__fp16`` is supported on all targets. The special semantics of this
-type mean that no arithmetic is ever performed directly on ``__fp16`` values;
-see below.
+  type mean that no arithmetic is ever performed directly on ``__fp16`` values;
+  see below.
 
 * ``_Float16`` is supported on the following targets:
   * 32-bit ARM (natively on some architecture versions)
@@ -809,7 +809,7 @@ which provides an 8-bit exponent and an 8-bit significand; 
this is the same
 exponent range as `float`, just with greatly reduced precision.
 
 ``_Float16`` and ``__bf16`` follow the usual rules for arithmetic
-floating-point types.  Most importantly, this means that arithmetic operations
+floating-point types. Most importantly, this means that arithmetic operations
 on operands of these types are formally performed in the type and produce
 values of the type. ``__fp16`` does not follow those rules: most operations
 immediately promote operands of type ``__fp16`` to ``float``, and so
@@ -833,28 +833,29 @@ the C++ standard.
 
 The use of excess precision can be independently controlled for these two
 types with the ``-ffloat16-excess-precision=`` and
-``-fbfloat16-excess-precision=`` options.  Valid values include:
-- ``none`` (meaning to perform strict operation-by-operation emulation)
-- ``standard`` (meaning that excess precision is permitted under the rules
-  described in the standard, i.e. never across explicit casts or statements)
-- ``fast`` (meaning that excess precision is permitted whenever the
+``-fbfloat16-excess-precision=`` options. Valid values include:
+
+* ``none``: meaning to perform strict operation-by-operation emulation
+* ``standard``: meaning that excess precision is permitted under the rules
+  described in the standard, i.e. never across explicit casts or statements
+* ``fast``: meaning that excess precision is permitted whenever the
   optimizer sees an opportunity to avoid truncations; currently this has no
-  effect beyond ``standard``)
+  effect beyond ``standard``
 
 The ``_Float16`` type is an interchange floating type specified in
- ISO/IEC TS 18661-3:2015 ("Floating-point extensions for C").  It will
+ISO/IEC TS 18661-3:2015 ("Floating-point extensions for C"). It will
 be supported on more targets as they define ABIs for it.
 
 The ``__bf16`` type is a non-standard extension, but it generally follows
 the rules for arithmetic interchange floating types from ISO/IEC TS
-18661-3:2015.  In previous versions of Clang, it was a storage-only type
-that forbade arithmetic operations.  It will be supported on more targets
+18661-3:2015. In previous versions of Clang, it was a storage-only type
+that forbade arithmetic operations. It will be supported on more targets
 as they define ABIs for it.
 
 The ``__fp16`` type was originally an ARM extension and is specified
 by the `ARM C Language Extensions 
`_.
 Clang uses the ``binary16`` format from IEEE 754-2008 for ``__fp16``,
-not the ARM alternative format.  Operators that expect arithmetic operands
+not the ARM alternative format. Operators that expect arithmetic operands
 immediately promote ``__fp16`` operands to ``float``.
 
 It is recommended that portable code use ``_Float16`` instead of ``__fp16``,
@@ -870,7 +871,7 @@ A literal can be given ``_Float16`` type using the suffix 
``f16``. For example,
 
 Because default argument promotion only applies to the standard floating-point
 types, ``_Float16`` values are not promoted to ``double`` when passed as 
variadic
-or untyped arguments.  As a consequence, some caution must be taken when using
+or untyped arguments. As a consequence, some caution must be taken when using
 certain library facilities with ``_Float16``; for example, there is no 
``printf`` format
 specifier for ``_Float16``, and (unlike ``float``) it will not be implicitly 
promoted to
 ``double`` when passed to ``printf``, so the programmer must explicitly cast 
it to


  

[PATCH] D151610: [Docs] Fix Sphinx documentation formatting issues in LanguageExtensions.rst

2023-05-27 Thread Phoebe Wang 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 rGdd2e681612f1: [Docs] Fix Sphinx documentation formatting 
issues in LanguageExtensions.rst (authored by codemzs, committed by pengfei).

Changed prior to commit:
  https://reviews.llvm.org/D151610?vs=526246&id=526248#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151610

Files:
  clang/docs/LanguageExtensions.rst


Index: clang/docs/LanguageExtensions.rst
===
--- clang/docs/LanguageExtensions.rst
+++ clang/docs/LanguageExtensions.rst
@@ -784,8 +784,8 @@
 to ``float``; see below for more information on this emulation.
 
 * ``__fp16`` is supported on all targets. The special semantics of this
-type mean that no arithmetic is ever performed directly on ``__fp16`` values;
-see below.
+  type mean that no arithmetic is ever performed directly on ``__fp16`` values;
+  see below.
 
 * ``_Float16`` is supported on the following targets:
   * 32-bit ARM (natively on some architecture versions)
@@ -809,7 +809,7 @@
 exponent range as `float`, just with greatly reduced precision.
 
 ``_Float16`` and ``__bf16`` follow the usual rules for arithmetic
-floating-point types.  Most importantly, this means that arithmetic operations
+floating-point types. Most importantly, this means that arithmetic operations
 on operands of these types are formally performed in the type and produce
 values of the type. ``__fp16`` does not follow those rules: most operations
 immediately promote operands of type ``__fp16`` to ``float``, and so
@@ -833,28 +833,29 @@
 
 The use of excess precision can be independently controlled for these two
 types with the ``-ffloat16-excess-precision=`` and
-``-fbfloat16-excess-precision=`` options.  Valid values include:
-- ``none`` (meaning to perform strict operation-by-operation emulation)
-- ``standard`` (meaning that excess precision is permitted under the rules
-  described in the standard, i.e. never across explicit casts or statements)
-- ``fast`` (meaning that excess precision is permitted whenever the
+``-fbfloat16-excess-precision=`` options. Valid values include:
+
+* ``none``: meaning to perform strict operation-by-operation emulation
+* ``standard``: meaning that excess precision is permitted under the rules
+  described in the standard, i.e. never across explicit casts or statements
+* ``fast``: meaning that excess precision is permitted whenever the
   optimizer sees an opportunity to avoid truncations; currently this has no
-  effect beyond ``standard``)
+  effect beyond ``standard``
 
 The ``_Float16`` type is an interchange floating type specified in
- ISO/IEC TS 18661-3:2015 ("Floating-point extensions for C").  It will
+ISO/IEC TS 18661-3:2015 ("Floating-point extensions for C"). It will
 be supported on more targets as they define ABIs for it.
 
 The ``__bf16`` type is a non-standard extension, but it generally follows
 the rules for arithmetic interchange floating types from ISO/IEC TS
-18661-3:2015.  In previous versions of Clang, it was a storage-only type
-that forbade arithmetic operations.  It will be supported on more targets
+18661-3:2015. In previous versions of Clang, it was a storage-only type
+that forbade arithmetic operations. It will be supported on more targets
 as they define ABIs for it.
 
 The ``__fp16`` type was originally an ARM extension and is specified
 by the `ARM C Language Extensions 
`_.
 Clang uses the ``binary16`` format from IEEE 754-2008 for ``__fp16``,
-not the ARM alternative format.  Operators that expect arithmetic operands
+not the ARM alternative format. Operators that expect arithmetic operands
 immediately promote ``__fp16`` operands to ``float``.
 
 It is recommended that portable code use ``_Float16`` instead of ``__fp16``,
@@ -870,7 +871,7 @@
 
 Because default argument promotion only applies to the standard floating-point
 types, ``_Float16`` values are not promoted to ``double`` when passed as 
variadic
-or untyped arguments.  As a consequence, some caution must be taken when using
+or untyped arguments. As a consequence, some caution must be taken when using
 certain library facilities with ``_Float16``; for example, there is no 
``printf`` format
 specifier for ``_Float16``, and (unlike ``float``) it will not be implicitly 
promoted to
 ``double`` when passed to ``printf``, so the programmer must explicitly cast 
it to


Index: clang/docs/LanguageExtensions.rst
===
--- clang/docs/LanguageExtensions.rst
+++ clang/docs/LanguageExtensions.rst
@@ -784,8 +784,8 @@
 to ``float``; see below for more information on this emulation.
 
 * ``__fp16`` is supported on all targets. The special semantics of this
-type mean that no arithmetic is ev

[PATCH] D151607: [AST] Remove unused function removeLocalCVRQualifiers

2023-05-27 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin accepted this revision.
cor3ntin added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151607

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


[PATCH] D151344: Reland "[CMake] Bumps minimum version to 3.20.0.

2023-05-27 Thread Mark de Wever via Phabricator via cfe-commits
Mordante accepted this revision.
Mordante marked 3 inline comments as done.
Mordante added a comment.

In D151344#4368926 , @MaskRay wrote:

> Thank you for making another try for the treewide change (which is admittedly 
> very painful and not many people do such work).

Thanks. And it indeed takes quite a lot of effort.

> Can you include the original patch description to the summary? That is the 
> main part and the message "This reverts commit " is secondary. Readers should 
> not need to trace through the revert history to obtain the original 
> motivation.

Good suggestion I've updated the message.

Since @glandium and @hans seem happy with the changes I'll land this patch.




Comment at: libunwind/src/CMakeLists.txt:28-35
 
 # See add_asm_sources() in compiler-rt for explanation of this workaround.
 # CMake doesn't work correctly with assembly on AIX. Workaround by compiling
 # as C files as well.
 if((APPLE AND CMAKE_VERSION VERSION_LESS 3.19) OR
-   (MINGW AND CMAKE_VERSION VERSION_LESS 3.17) OR
-   (${CMAKE_SYSTEM_NAME} MATCHES "AIX"))
+   (MINGW AND CMAKE_VERSION VERSION_LESS 3.17))
   set_source_files_properties(${LIBUNWIND_ASM_SOURCES} PROPERTIES LANGUAGE C)

h-vetinari wrote:
> mstorsjo wrote:
> > h-vetinari wrote:
> > > Shouldn't it be possible to remove that entire block (as it only fires 
> > > for CMake <3.20)?
> > The intention was to do such cleanups in a later patch, as mentioned in the 
> > original commit message in https://reviews.llvm.org/D144509. (I guess it 
> > would be good to bring the original commit message along with the reland 
> > attempts too.)
> Well sure, but "workarounds" is a broad term. It makes sense to not try to 
> clean up everything that newer CMake enables, but this PR does remove a lot 
> of (all?) other lines with `CMAKE_VERSION VERSION_LESS ` where x<3.20. On 
> top of that, since this line is already being changed (which is why I noticed 
> in the first place), I'd suggest to just remove it. But I don't feel strongly 
> about this, just thought I'd point it out.
Yes the intention is to do these cleanups later. The patch does more than I'd 
like already. However that is due to the original patch and followups being 
reverted.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151344

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


[libclc] cbaa359 - Reland "[CMake] Bumps minimum version to 3.20.0.

2023-05-27 Thread Mark de Wever via cfe-commits

Author: Mark de Wever
Date: 2023-05-27T12:51:21+02:00
New Revision: cbaa3597aaf6273e66b3f445ed36a6458143fe6a

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

LOG: Reland "[CMake] Bumps minimum version to 3.20.0.

This reverts commit d763c6e5e2d0a6b34097aa7dabca31e9aff9b0b6.

Adds the patch by @hans from
https://github.com/llvm/llvm-project/issues/62719
This patch fixes the Windows build.

d763c6e5e2d0a6b34097aa7dabca31e9aff9b0b6 reverted the reviews

D144509 [CMake] Bumps minimum version to 3.20.0.

This partly undoes D137724.

This change has been discussed on discourse
https://discourse.llvm.org/t/rfc-upgrading-llvms-minimum-required-cmake-version/66193

Note this does not remove work-arounds for older CMake versions, that
will be done in followup patches.

D150532 [OpenMP] Compile assembly files as ASM, not C

Since CMake 3.20, CMake explicitly passes "-x c" (or equivalent)
when compiling a file which has been set as having the language
C. This behaviour change only takes place if "cmake_minimum_required"
is set to 3.20 or newer, or if the policy CMP0119 is set to new.

Attempting to compile assembly files with "-x c" fails, however
this is workarounded in many cases, as OpenMP overrides this with
"-x assembler-with-cpp", however this is only added for non-Windows
targets.

Thus, after increasing cmake_minimum_required to 3.20, this breaks
compiling the GNU assembly for Windows targets; the GNU assembly is
used for ARM and AArch64 Windows targets when building with Clang.
This patch unbreaks that.

D150688 [cmake] Set CMP0091 to fix Windows builds after the 
cmake_minimum_required bump

The build uses other mechanism to select the runtime.

Fixes #62719

Reviewed By: #libc, Mordante

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

Added: 


Modified: 
bolt/runtime/CMakeLists.txt
clang/CMakeLists.txt
clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt
cmake/Modules/CMakePolicy.cmake
compiler-rt/CMakeLists.txt
compiler-rt/lib/builtins/CMakeLists.txt
compiler-rt/lib/crt/CMakeLists.txt
flang/CMakeLists.txt
flang/lib/Decimal/CMakeLists.txt
flang/runtime/CMakeLists.txt
libc/CMakeLists.txt
libc/examples/hello_world/CMakeLists.txt
libclc/CMakeLists.txt
libcxx/CMakeLists.txt
libcxxabi/CMakeLists.txt
libunwind/CMakeLists.txt
libunwind/src/CMakeLists.txt
lld/CMakeLists.txt
lldb/CMakeLists.txt
lldb/tools/debugserver/CMakeLists.txt
llvm-libgcc/CMakeLists.txt
llvm/CMakeLists.txt
llvm/docs/CMake.rst
llvm/docs/GettingStarted.rst
llvm/docs/ReleaseNotes.rst
mlir/CMakeLists.txt
mlir/examples/standalone/CMakeLists.txt
openmp/CMakeLists.txt
openmp/cmake/DetectTestCompiler/CMakeLists.txt
openmp/docs/SupportAndFAQ.rst
openmp/libompd/src/CMakeLists.txt
openmp/libomptarget/plugins/remote/src/CMakeLists.txt
openmp/runtime/src/CMakeLists.txt
openmp/tools/Modules/FindOpenMPTarget.cmake
openmp/tools/Modules/README.rst
polly/CMakeLists.txt
pstl/CMakeLists.txt
runtimes/CMakeLists.txt

Removed: 




diff  --git a/bolt/runtime/CMakeLists.txt b/bolt/runtime/CMakeLists.txt
index 6aa8edb8424a3..8472ce00b4137 100644
--- a/bolt/runtime/CMakeLists.txt
+++ b/bolt/runtime/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.13.4)
+cmake_minimum_required(VERSION 3.20.0)
 include(CheckIncludeFiles)
 include(GNUInstallDirs)
 

diff  --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 4aa0545e8d733..8220a9dbfd4db 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.13.4)
+cmake_minimum_required(VERSION 3.20.0)
 
 if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
   set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
@@ -11,13 +11,6 @@ include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake
 if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
   project(Clang)
   set(CLANG_BUILT_STANDALONE TRUE)
-  if ("${CMAKE_VERSION}" VERSION_LESS "3.20.0")
-message(WARNING
-  "Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 17.0.0, the "
-  "minimum version of CMake required to build LLVM will become 3.20.0, and 
"
-  "using an older CMake will become an error. Please upgrade your CMake to 
"
-  "at least 3.20.0 now to avoid issues in the future!")
-  endif()
 endif()
 
 # Must go below project(..)

diff  --git a/clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt 
b/clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt
index 007ad4530d6dc..95c6fdb610e0f 100644
--- a/clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt
+++ b/clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt
@@ -1,6 +1,6 @@
 project(exec C)
 

[PATCH] D151344: Reland "[CMake] Bumps minimum version to 3.20.0.

2023-05-27 Thread Mark de Wever via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Mordante marked an inline comment as done.
Closed by commit rGcbaa3597aaf6: Reland "[CMake] Bumps minimum version to 
3.20.0. (authored by Mordante).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151344

Files:
  bolt/runtime/CMakeLists.txt
  clang/CMakeLists.txt
  clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt
  cmake/Modules/CMakePolicy.cmake
  compiler-rt/CMakeLists.txt
  compiler-rt/lib/builtins/CMakeLists.txt
  compiler-rt/lib/crt/CMakeLists.txt
  flang/CMakeLists.txt
  flang/lib/Decimal/CMakeLists.txt
  flang/runtime/CMakeLists.txt
  libc/CMakeLists.txt
  libc/examples/hello_world/CMakeLists.txt
  libclc/CMakeLists.txt
  libcxx/CMakeLists.txt
  libcxxabi/CMakeLists.txt
  libunwind/CMakeLists.txt
  libunwind/src/CMakeLists.txt
  lld/CMakeLists.txt
  lldb/CMakeLists.txt
  lldb/tools/debugserver/CMakeLists.txt
  llvm-libgcc/CMakeLists.txt
  llvm/CMakeLists.txt
  llvm/docs/CMake.rst
  llvm/docs/GettingStarted.rst
  llvm/docs/ReleaseNotes.rst
  mlir/CMakeLists.txt
  mlir/examples/standalone/CMakeLists.txt
  openmp/CMakeLists.txt
  openmp/cmake/DetectTestCompiler/CMakeLists.txt
  openmp/docs/SupportAndFAQ.rst
  openmp/libompd/src/CMakeLists.txt
  openmp/libomptarget/plugins/remote/src/CMakeLists.txt
  openmp/runtime/src/CMakeLists.txt
  openmp/tools/Modules/FindOpenMPTarget.cmake
  openmp/tools/Modules/README.rst
  polly/CMakeLists.txt
  pstl/CMakeLists.txt
  runtimes/CMakeLists.txt

Index: runtimes/CMakeLists.txt
===
--- runtimes/CMakeLists.txt
+++ runtimes/CMakeLists.txt
@@ -1,16 +1,13 @@
 # This file handles building LLVM runtime sub-projects.
-cmake_minimum_required(VERSION 3.13.4)
-if ("${CMAKE_VERSION}" VERSION_LESS "3.20.0")
-  message(WARNING
-"Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 17.0.0, the "
-"minimum version of CMake required to build LLVM will become 3.20.0, and "
-"using an older CMake will become an error. Please upgrade your CMake to "
-"at least 3.20.0 now to avoid issues in the future!")
-endif()
-project(Runtimes C CXX ASM)
+cmake_minimum_required(VERSION 3.20.0)
 
 # Add path for custom and the LLVM build's modules to the CMake module path.
 set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
+include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake
+  NO_POLICY_SCOPE)
+
+project(Runtimes C CXX ASM)
+
 list(INSERT CMAKE_MODULE_PATH 0
   "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
   "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
Index: pstl/CMakeLists.txt
===
--- pstl/CMakeLists.txt
+++ pstl/CMakeLists.txt
@@ -5,7 +5,7 @@
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 #
 #===--===##
-cmake_minimum_required(VERSION 3.13.4)
+cmake_minimum_required(VERSION 3.20.0)
 
 set(PARALLELSTL_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/include/pstl/internal/pstl_config.h")
 file(STRINGS "${PARALLELSTL_VERSION_FILE}" PARALLELSTL_VERSION_SOURCE REGEX "#define _PSTL_VERSION .*$")
Index: polly/CMakeLists.txt
===
--- polly/CMakeLists.txt
+++ polly/CMakeLists.txt
@@ -1,14 +1,7 @@
 # Check if this is a in tree build.
 if (NOT DEFINED LLVM_MAIN_SRC_DIR)
   project(Polly)
-  cmake_minimum_required(VERSION 3.13.4)
-  if ("${CMAKE_VERSION}" VERSION_LESS "3.20.0")
-message(WARNING
-  "Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 17.0.0, the "
-  "minimum version of CMake required to build LLVM will become 3.20.0, and "
-  "using an older CMake will become an error. Please upgrade your CMake to "
-  "at least 3.20.0 now to avoid issues in the future!")
-  endif()
+  cmake_minimum_required(VERSION 3.20.0)
   set(POLLY_STANDALONE_BUILD TRUE)
 endif()
 
Index: openmp/tools/Modules/README.rst
===
--- openmp/tools/Modules/README.rst
+++ openmp/tools/Modules/README.rst
@@ -26,7 +26,7 @@
 
 .. code-block:: cmake
 
-  cmake_minimum_required(VERSION 3.13.4)
+  cmake_minimum_required(VERSION 3.20.0)
   project(offloadTest VERSION 1.0 LANGUAGES CXX)
 
   list(APPEND CMAKE_MODULE_PATH "${PATH_TO_OPENMP_INSTALL}/lib/cmake/openmp")
@@ -37,7 +37,7 @@
   target_link_libraries(offload PRIVATE OpenMPTarget::OpenMPTarget_NVPTX)
   target_sources(offload PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/Main.cpp)
 
-Using this module requires at least CMake version 3.13.4. Supported languages
+Using this module requires at least CMake version 3.20.0. Supported languages
 are C and C++ with Fortran support planned in the future. If your application
 requires building for a specif

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

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

Rebase


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)));
+Interp = ExitOnErr(cla

[PATCH] D151606: [NFC][CLANG] Fix Static Code Analyzer Concerns with bad bit right shift operation in getNVPTXLaneID()

2023-05-27 Thread Soumi Manna via Phabricator via cfe-commits
Manna updated this revision to Diff 526259.
Manna added a comment.

I have updated patch.


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

https://reviews.llvm.org/D151606

Files:
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp


Index: clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
===
--- clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
+++ clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
@@ -528,6 +528,7 @@
   CGBuilderTy &Bld = CGF.Builder;
   unsigned LaneIDBits =
   llvm::Log2_32(CGF.getTarget().getGridValue().GV_Warp_Size);
+  assert(LaneIDBits < 32 && "Invalid LaneIDBits size in NVPTX device.");
   unsigned LaneIDMask = ~0u >> (32u - LaneIDBits);
   auto &RT = static_cast(CGF.CGM.getOpenMPRuntime());
   return Bld.CreateAnd(RT.getGPUThreadID(CGF), Bld.getInt32(LaneIDMask),


Index: clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
===
--- clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
+++ clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
@@ -528,6 +528,7 @@
   CGBuilderTy &Bld = CGF.Builder;
   unsigned LaneIDBits =
   llvm::Log2_32(CGF.getTarget().getGridValue().GV_Warp_Size);
+  assert(LaneIDBits < 32 && "Invalid LaneIDBits size in NVPTX device.");
   unsigned LaneIDMask = ~0u >> (32u - LaneIDBits);
   auto &RT = static_cast(CGF.CGM.getOpenMPRuntime());
   return Bld.CreateAnd(RT.getGPUThreadID(CGF), Bld.getInt32(LaneIDMask),
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D150985: [clang] Allow fp in atomic fetch max/min builtins

2023-05-27 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 526258.
yaxunl marked 2 inline comments as done.
yaxunl added a comment.

revised by Artem's comments


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

https://reviews.llvm.org/D150985

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/CodeGen/CGAtomic.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGenCUDA/amdgpu-atomic-ops.cu
  clang/test/Sema/atomic-ops.c
  clang/test/SemaOpenCL/atomic-ops.cl

Index: clang/test/SemaOpenCL/atomic-ops.cl
===
--- clang/test/SemaOpenCL/atomic-ops.cl
+++ clang/test/SemaOpenCL/atomic-ops.cl
@@ -61,8 +61,10 @@
 
   __opencl_atomic_fetch_min(i, 1, memory_order_seq_cst, memory_scope_work_group);
   __opencl_atomic_fetch_max(i, 1, memory_order_seq_cst, memory_scope_work_group);
-  __opencl_atomic_fetch_min(f, 1, memory_order_seq_cst, memory_scope_work_group); // expected-error {{address argument to atomic operation must be a pointer to atomic integer ('__generic atomic_float *' (aka '__generic _Atomic(float) *') invalid)}}
-  __opencl_atomic_fetch_max(f, 1, memory_order_seq_cst, memory_scope_work_group); // expected-error {{address argument to atomic operation must be a pointer to atomic integer ('__generic atomic_float *' (aka '__generic _Atomic(float) *') invalid)}}
+  __opencl_atomic_fetch_min(f, 1, memory_order_seq_cst, memory_scope_work_group);
+  __opencl_atomic_fetch_max(f, 1, memory_order_seq_cst, memory_scope_work_group);
+  __opencl_atomic_fetch_min(d, 1, memory_order_seq_cst, memory_scope_work_group);
+  __opencl_atomic_fetch_max(d, 1, memory_order_seq_cst, memory_scope_work_group);
 
   bool cmpexch_1 = __opencl_atomic_compare_exchange_strong(i, I, 1, memory_order_seq_cst, memory_order_seq_cst, memory_scope_work_group);
   bool cmpexch_2 = __opencl_atomic_compare_exchange_strong(p, P, 1, memory_order_seq_cst, memory_order_seq_cst, memory_scope_work_group);
Index: clang/test/Sema/atomic-ops.c
===
--- clang/test/Sema/atomic-ops.c
+++ clang/test/Sema/atomic-ops.c
@@ -199,14 +199,24 @@
   __c11_atomic_fetch_add(f, 1.0f, memory_order_seq_cst);
   __c11_atomic_fetch_add(d, 1.0, memory_order_seq_cst);
   __c11_atomic_fetch_add(ld, 1.0, memory_order_seq_cst); // fp80-error {{must be a pointer to atomic integer, pointer or supported floating point type}}
+  __c11_atomic_fetch_min(i, 1, memory_order_seq_cst);
+  __c11_atomic_fetch_min(p, 1, memory_order_seq_cst); // expected-error {{must be a pointer to atomic integer or supported floating point type}}
+  __c11_atomic_fetch_min(f, 1.0f, memory_order_seq_cst);
+  __c11_atomic_fetch_min(d, 1.0, memory_order_seq_cst);
+  __c11_atomic_fetch_min(ld, 1.0, memory_order_seq_cst); // fp80-error {{must be a pointer to atomic integer or supported floating point type}}
+  __c11_atomic_fetch_max(i, 1, memory_order_seq_cst);
+  __c11_atomic_fetch_max(p, 1, memory_order_seq_cst); // expected-error {{must be a pointer to atomic integer or supported floating point type}}
+  __c11_atomic_fetch_max(f, 1.0f, memory_order_seq_cst);
+  __c11_atomic_fetch_max(d, 1.0, memory_order_seq_cst);
+  __c11_atomic_fetch_max(ld, 1.0, memory_order_seq_cst); // fp80-error {{must be a pointer to atomic integer or supported floating point type}}
 
   __atomic_fetch_add(i, 3, memory_order_seq_cst); // expected-error {{pointer to integer, pointer or supported floating point type}}
   __atomic_fetch_sub(I, 3, memory_order_seq_cst);
   __atomic_fetch_sub(P, 3, memory_order_seq_cst);
   __atomic_fetch_sub(D, 3, memory_order_seq_cst);
   __atomic_fetch_sub(s1, 3, memory_order_seq_cst); // expected-error {{must be a pointer to integer, pointer or supported floating point type}}
-  __atomic_fetch_min(D, 3, memory_order_seq_cst); // expected-error {{must be a pointer to integer}}
-  __atomic_fetch_max(P, 3, memory_order_seq_cst); // expected-error {{must be a pointer to integer}}
+  __atomic_fetch_min(D, 3, memory_order_seq_cst);
+  __atomic_fetch_max(P, 3, memory_order_seq_cst); // expected-error {{must be a pointer to integer or supported floating point type}}
   __atomic_fetch_max(p, 3);   // expected-error {{too few arguments to function call, expected 3, have 2}}
 
   __c11_atomic_fetch_and(i, 1, memory_order_seq_cst);
Index: clang/test/CodeGenCUDA/amdgpu-atomic-ops.cu
===
--- clang/test/CodeGenCUDA/amdgpu-atomic-ops.cu
+++ clang/test/CodeGenCUDA/amdgpu-atomic-ops.cu
@@ -1,29 +1,98 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - -triple=amdgcn-amd-amdhsa \
+// RUN: %clang_cc1 -x hip %s -emit-llvm -o - -triple=amdgcn-amd-amdhsa \
 // RUN:   -fcuda-is-device -target-cpu gfx906 -fnative-half-type \
 // RUN:   -fnative-half-arguments-and-returns | FileCheck %s
 
+// RUN: %clang_cc1 -x hip %s -O3 -S -o - -triple=amdgcn-amd-amdhsa \
+// RUN:   -fcuda-is-device -target-cpu gfx1100 -fnative-h

[PATCH] D151349: [HIP] emit macro `__HIP_NO_IMAGE_SUPPORT`

2023-05-27 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 526263.
yaxunl added a comment.

using ISA version to determine whether image is supported


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

https://reviews.llvm.org/D151349

Files:
  clang/include/clang/Basic/TargetInfo.h
  clang/lib/Basic/Targets/AMDGPU.cpp
  clang/lib/Basic/Targets/AMDGPU.h
  clang/lib/Frontend/InitPreprocessor.cpp
  clang/test/Driver/hip-macros.hip


Index: clang/test/Driver/hip-macros.hip
===
--- clang/test/Driver/hip-macros.hip
+++ clang/test/Driver/hip-macros.hip
@@ -42,3 +42,16 @@
 // WARN-CUMODE-NOT: warning: ignoring '-mno-cumode' option as it is not 
currently supported for processor 'gfx906' [-Woption-ignored]
 // CUMODE-ON-DAG: #define __AMDGCN_CUMODE__ 1
 // CUMODE-OFF-DAG: #define __AMDGCN_CUMODE__ 0
+
+// RUN: %clang -E -dM --offload-arch=gfx90a --cuda-device-only -nogpuinc 
-nogpulib \
+// RUN:   %s 2>&1 | FileCheck --check-prefix=IMAGE %s
+// RUN: %clang -E -dM --offload-arch=gfx1100 --cuda-device-only -nogpuinc 
-nogpulib \
+// RUN:   %s 2>&1 | FileCheck --check-prefix=IMAGE %s
+// RUN: %clang -E -dM --offload-arch=gfx940 --cuda-device-only -nogpuinc 
-nogpulib \
+// RUN:   %s 2>&1 | FileCheck --check-prefix=NOIMAGE %s
+// RUN: %clang -E -dM --offload-arch=gfx941 --cuda-device-only -nogpuinc 
-nogpulib \
+// RUN:   %s 2>&1 | FileCheck --check-prefix=NOIMAGE %s
+// RUN: %clang -E -dM --offload-arch=gfx942 --cuda-device-only -nogpuinc 
-nogpulib \
+// RUN:   %s 2>&1 | FileCheck --check-prefix=NOIMAGE %s
+// IMAGE-NOT: #define __HIP_NO_IMAGE_SUPPORT
+// NOIMAGE: #define __HIP_NO_IMAGE_SUPPORT 1
Index: clang/lib/Frontend/InitPreprocessor.cpp
===
--- clang/lib/Frontend/InitPreprocessor.cpp
+++ clang/lib/Frontend/InitPreprocessor.cpp
@@ -583,8 +583,11 @@
 Builder.defineMacro("__HIP_MEMORY_SCOPE_WORKGROUP", "3");
 Builder.defineMacro("__HIP_MEMORY_SCOPE_AGENT", "4");
 Builder.defineMacro("__HIP_MEMORY_SCOPE_SYSTEM", "5");
-if (LangOpts.CUDAIsDevice)
+if (LangOpts.CUDAIsDevice) {
   Builder.defineMacro("__HIP_DEVICE_COMPILE__");
+  if (!TI.hasHIPImageSupport())
+Builder.defineMacro("__HIP_NO_IMAGE_SUPPORT", "1");
+}
 if (LangOpts.GPUDefaultStream ==
 LangOptions::GPUDefaultStreamKind::PerThread)
   Builder.defineMacro("HIP_API_PER_THREAD_DEFAULT_STREAM");
Index: clang/lib/Basic/Targets/AMDGPU.h
===
--- clang/lib/Basic/Targets/AMDGPU.h
+++ clang/lib/Basic/Targets/AMDGPU.h
@@ -46,6 +46,9 @@
   /// Whether to use cumode or WGP mode. True for cumode. False for WGP mode.
   bool CUMode;
 
+  /// Whether having image instructions.
+  bool HasImage;
+
   /// Target ID is device name followed by optional feature name postfixed
   /// by plus or minus sign delimitted by colon, e.g. gfx908:xnack+:sramecc-.
   /// If the target ID contains feature+, map it to true.
@@ -470,6 +473,8 @@
 return getCanonicalTargetID(getArchNameAMDGCN(GPUKind),
 OffloadArchFeatures);
   }
+
+  bool hasHIPImageSupport() const override { return HasImage; }
 };
 
 } // namespace targets
Index: clang/lib/Basic/Targets/AMDGPU.cpp
===
--- clang/lib/Basic/Targets/AMDGPU.cpp
+++ clang/lib/Basic/Targets/AMDGPU.cpp
@@ -244,6 +244,8 @@
 
   MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
   CUMode = !(GPUFeatures & llvm::AMDGPU::FEATURE_WGP);
+  auto ISAVer = llvm::AMDGPU::getIsaVersion(Opts.CPU);
+  HasImage = ISAVer.Major != 9 || ISAVer.Minor != 4;
 }
 
 void AMDGPUTargetInfo::adjust(DiagnosticsEngine &Diags, LangOptions &Opts) {
Index: clang/include/clang/Basic/TargetInfo.h
===
--- clang/include/clang/Basic/TargetInfo.h
+++ clang/include/clang/Basic/TargetInfo.h
@@ -1704,6 +1704,9 @@
: std::optional();
   }
 
+  /// Whether to support HIP image/texture API's.
+  virtual bool hasHIPImageSupport() const { return true; }
+
 protected:
   /// Copy type and layout related info.
   void copyAuxTarget(const TargetInfo *Aux);


Index: clang/test/Driver/hip-macros.hip
===
--- clang/test/Driver/hip-macros.hip
+++ clang/test/Driver/hip-macros.hip
@@ -42,3 +42,16 @@
 // WARN-CUMODE-NOT: warning: ignoring '-mno-cumode' option as it is not currently supported for processor 'gfx906' [-Woption-ignored]
 // CUMODE-ON-DAG: #define __AMDGCN_CUMODE__ 1
 // CUMODE-OFF-DAG: #define __AMDGCN_CUMODE__ 0
+
+// RUN: %clang -E -dM --offload-arch=gfx90a --cuda-device-only -nogpuinc -nogpulib \
+// RUN:   %s 2>&1 | FileCheck --check-prefix=IMAGE %s
+// RUN: %clang -E -dM --offload-arch=gfx1100 --cuda-device-only -nogpuinc -nogpulib \
+// RUN:   %s 2>&1 | FileCheck --check-prefix=IMAGE %s
+// RUN: %clang -E

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

2023-05-27 Thread Soumi Manna via Phabricator via cfe-commits
Manna updated this revision to Diff 526264.
Manna added a comment.

Fix clang-format error


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


[clang] f59795b - [NFC][CLANG] Fix nullptr dereference issue in CodeGenModule::GetConstantArrayFromStringLiteral()

2023-05-27 Thread via cfe-commits

Author: Manna, Soumi
Date: 2023-05-27T07:16:31-07:00
New Revision: f59795b2b703d5a782e4c29c0e786ee01942f16a

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

LOG: [NFC][CLANG] Fix nullptr dereference issue in 
CodeGenModule::GetConstantArrayFromStringLiteral()

This patch adds an assert.

Reviewed By: erichkeane

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

Added: 


Modified: 
clang/lib/CodeGen/CodeGenModule.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CodeGenModule.cpp 
b/clang/lib/CodeGen/CodeGenModule.cpp
index d2a28b66cac9..49b670487749 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -5888,6 +5888,7 @@ CodeGenModule::GetConstantArrayFromStringLiteral(const 
StringLiteral *E) {
 
 // Resize the string to the right size, which is indicated by its type.
 const ConstantArrayType *CAT = 
Context.getAsConstantArrayType(E->getType());
+assert(CAT && "String literal not of constant array type!");
 Str.resize(CAT->getSize().getZExtValue());
 return llvm::ConstantDataArray::getString(VMContext, Str, false);
   }



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


[PATCH] D151480: [NFC][CLANG] Fix nullptr dereference issue in CodeGenModule::​GetConstantArrayFromStringLiteral()

2023-05-27 Thread Soumi Manna via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf59795b2b703: [NFC][CLANG] Fix nullptr dereference issue in 
CodeGenModule… (authored by Manna).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151480

Files:
  clang/lib/CodeGen/CodeGenModule.cpp


Index: clang/lib/CodeGen/CodeGenModule.cpp
===
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -5888,6 +5888,7 @@
 
 // Resize the string to the right size, which is indicated by its type.
 const ConstantArrayType *CAT = 
Context.getAsConstantArrayType(E->getType());
+assert(CAT && "String literal not of constant array type!");
 Str.resize(CAT->getSize().getZExtValue());
 return llvm::ConstantDataArray::getString(VMContext, Str, false);
   }


Index: clang/lib/CodeGen/CodeGenModule.cpp
===
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -5888,6 +5888,7 @@
 
 // Resize the string to the right size, which is indicated by its type.
 const ConstantArrayType *CAT = Context.getAsConstantArrayType(E->getType());
+assert(CAT && "String literal not of constant array type!");
 Str.resize(CAT->getSize().getZExtValue());
 return llvm::ConstantDataArray::getString(VMContext, Str, false);
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151320: [clang] Add `// expected-maybe-no-diagnostics` comment to VerifyDiagnosticConsumer

2023-05-27 Thread Joel E. Denny via Phabricator via cfe-commits
jdenny added inline comments.



Comment at: clang/lib/Frontend/VerifyDiagnosticConsumer.cpp:468
+Status = VerifyDiagnosticConsumer::HasExpectedMaybeNoDiagnostics;
+  continue;
+} else if (DToken.endswith(DType="-no-diagnostics")) {

Endill wrote:
> jdenny wrote:
> > Endill wrote:
> > > jdenny wrote:
> > > > Endill wrote:
> > > > > jdenny wrote:
> > > > > > This `continue` skips the prefix checking below, which is important 
> > > > > > when there are multiple prefixes active (e.g., `-verify=foo,bar`).  
> > > > > > That is, any old `BOGUS-maybe-no-diagnostics` will be effective 
> > > > > > then.
> > > > > This should be fixed now. Thank you for spotting this!
> > > > Thanks for the fix.  Please add a test so this bug doesn't pop up again.
> > > Done as A2 test
> > Does A2 trigger the original bug?  I think there must be multiple prefixes 
> > for this fix to matter.
> I think prefix checking below works for a single prefix as well: 
> https://github.com/llvm/llvm-project/blob/5217498dc88aa2de2b728462205ffa8b01d96cab/clang/lib/Frontend/CompilerInvocation.cpp#LL2382C47-L2382C47
I downloaded this version of your patch: 
.  That version has the bug 
discussed in this comment thread.

I applied that patch and added test A2.  A2 passed.  That means A2 does not 
reproduce the bug it was intended to reproduce.

Then I changed A2 to have `-verify=foo,bar`.  A2 then failed because it then 
reproduced the bug.  (And of course with the current version of your patch, it 
passes because you've fixed the bug.)

Please add such a test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151320

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


[clang] e396c37 - [AST] Remove unused function removeLocalCVRQualifiers

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

Author: Kazu Hirata
Date: 2023-05-27T10:29:23-07:00
New Revision: e396c375a108f9be491488b876ac57e889f5c752

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

LOG: [AST] Remove unused function removeLocalCVRQualifiers

The last use was removed by:

  commit 0eb06cb3aa2700508c20da28f22ff91e7b82a436
  Author: Roy Jacobson 
  Date:   Tue Mar 14 21:25:54 2023 +0200

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

Added: 


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

Removed: 




diff  --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index a95728bb6893..e60438a2c075 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -948,7 +948,6 @@ class QualType {
   void removeLocalConst();
   void removeLocalVolatile();
   void removeLocalRestrict();
-  void removeLocalCVRQualifiers(unsigned Mask);
 
   void removeLocalFastQualifiers() { Value.setInt(0); }
   void removeLocalFastQualifiers(unsigned Mask) {
@@ -6781,15 +6780,6 @@ inline void QualType::removeLocalVolatile() {
   removeLocalFastQualifiers(Qualifiers::Volatile);
 }
 
-inline void QualType::removeLocalCVRQualifiers(unsigned Mask) {
-  assert(!(Mask & ~Qualifiers::CVRMask) && "mask has non-CVR bits");
-  static_assert((int)Qualifiers::CVRMask == (int)Qualifiers::FastMask,
-"Fast bits 
diff er from CVR bits!");
-
-  // Fast path: we don't need to touch the slow qualifiers.
-  removeLocalFastQualifiers(Mask);
-}
-
 /// Check if this type has any address space qualifier.
 inline bool QualType::hasAddressSpace() const {
   return getQualifiers().hasAddressSpace();



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


[PATCH] D151607: [AST] Remove unused function removeLocalCVRQualifiers

2023-05-27 Thread Kazu Hirata 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 rGe396c375a108: [AST] Remove unused function 
removeLocalCVRQualifiers (authored by kazu).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151607

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


Index: clang/include/clang/AST/Type.h
===
--- clang/include/clang/AST/Type.h
+++ clang/include/clang/AST/Type.h
@@ -948,7 +948,6 @@
   void removeLocalConst();
   void removeLocalVolatile();
   void removeLocalRestrict();
-  void removeLocalCVRQualifiers(unsigned Mask);
 
   void removeLocalFastQualifiers() { Value.setInt(0); }
   void removeLocalFastQualifiers(unsigned Mask) {
@@ -6781,15 +6780,6 @@
   removeLocalFastQualifiers(Qualifiers::Volatile);
 }
 
-inline void QualType::removeLocalCVRQualifiers(unsigned Mask) {
-  assert(!(Mask & ~Qualifiers::CVRMask) && "mask has non-CVR bits");
-  static_assert((int)Qualifiers::CVRMask == (int)Qualifiers::FastMask,
-"Fast bits differ from CVR bits!");
-
-  // Fast path: we don't need to touch the slow qualifiers.
-  removeLocalFastQualifiers(Mask);
-}
-
 /// Check if this type has any address space qualifier.
 inline bool QualType::hasAddressSpace() const {
   return getQualifiers().hasAddressSpace();


Index: clang/include/clang/AST/Type.h
===
--- clang/include/clang/AST/Type.h
+++ clang/include/clang/AST/Type.h
@@ -948,7 +948,6 @@
   void removeLocalConst();
   void removeLocalVolatile();
   void removeLocalRestrict();
-  void removeLocalCVRQualifiers(unsigned Mask);
 
   void removeLocalFastQualifiers() { Value.setInt(0); }
   void removeLocalFastQualifiers(unsigned Mask) {
@@ -6781,15 +6780,6 @@
   removeLocalFastQualifiers(Qualifiers::Volatile);
 }
 
-inline void QualType::removeLocalCVRQualifiers(unsigned Mask) {
-  assert(!(Mask & ~Qualifiers::CVRMask) && "mask has non-CVR bits");
-  static_assert((int)Qualifiers::CVRMask == (int)Qualifiers::FastMask,
-"Fast bits differ from CVR bits!");
-
-  // Fast path: we don't need to touch the slow qualifiers.
-  removeLocalFastQualifiers(Mask);
-}
-
 /// Check if this type has any address space qualifier.
 inline bool QualType::hasAddressSpace() const {
   return getQualifiers().hasAddressSpace();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151320: [clang] Add `// expected-maybe-no-diagnostics` comment to VerifyDiagnosticConsumer

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

Replace A2 test with E1-E3 tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151320

Files:
  clang/include/clang/Basic/DiagnosticFrontendKinds.td
  clang/include/clang/Frontend/VerifyDiagnosticConsumer.h
  clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
  clang/test/Frontend/verify-maybe-no-diagnostics.c
  clang/test/Frontend/verify3.c

Index: clang/test/Frontend/verify3.c
===
--- clang/test/Frontend/verify3.c
+++ clang/test/Frontend/verify3.c
@@ -19,7 +19,7 @@
 // expected-no-diagnostics
 
 //  CHECK2: error: 'error' diagnostics seen but not expected:
-// CHECK2-NEXT:   Line 19: 'expected-no-diagnostics' directive cannot follow other expected directives
+// CHECK2-NEXT:   Line 19: 'expected-no-diagnostics' directive cannot follow directives that expect diagnostics
 // CHECK2-NEXT: 1 error generated.
 #endif
 
Index: clang/test/Frontend/verify-maybe-no-diagnostics.c
===
--- /dev/null
+++ clang/test/Frontend/verify-maybe-no-diagnostics.c
@@ -0,0 +1,161 @@
+// RUN: %clang_cc1 -DTEST_A1 -verify %s
+// RUN: not %clang_cc1 -DTEST_A2 -verify %s 2>&1 | FileCheck --check-prefix=A2-CHECK %s
+// RUN: %clang_cc1 -DTEST_B1 -verify %s
+// RUN: %clang_cc1 -DTEST_B2 -verify %s
+// RUN: %clang_cc1 -DTEST_C1 -verify %s
+// RUN: not %clang_cc1 -DTEST_C2 -verify %s 2>&1 | FileCheck --check-prefix=C2-CHECK %s
+// RUN: %clang_cc1 -DTEST_C3 -verify %s
+// RUN: not %clang_cc1 -DTEST_C4 -verify %s 2>&1 | FileCheck --check-prefix=C4-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D1 -verify %s 2>&1 | FileCheck --check-prefix=D1-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D2 -verify %s 2>&1 | FileCheck --check-prefix=D2-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D3 -verify %s 2>&1 | FileCheck --check-prefix=D3-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D4 -verify %s 2>&1 | FileCheck --check-prefix=D4-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D5 -verify %s 2>&1 | FileCheck --check-prefix=D5-CHECK %s
+// RUN: not %clang_cc1 -DTEST_D6 -verify %s 2>&1 | FileCheck --check-prefix=D6-CHECK %s
+// RUN: not %clang_cc1 -DTEST_E1 -verify %s 2>&1 | FileCheck --check-prefix=E1-CHECK %s
+// RUN: not %clang_cc1 -DTEST_E2 -verify %s 2>&1 | FileCheck --check-prefix=E2-CHECK %s
+// RUN: not %clang_cc1 -DTEST_E3 -verify %s 2>&1 | FileCheck --check-prefix=E3-CHECK %s
+// RUN: not %clang_cc1 -DTEST_E1 -verify=foo,bar %s 2>&1 | FileCheck --check-prefix=E1-CHECK %s
+// RUN: not %clang_cc1 -DTEST_E2 -verify=foo,bar %s 2>&1 | FileCheck --check-prefix=E2-CHECK %s
+// RUN: not %clang_cc1 -DTEST_E3 -verify=foo,bar %s 2>&1 | FileCheck --check-prefix=E3-CHECK %s
+
+#ifdef TEST_A1
+// expected-maybe-no-diagnostics
+#endif
+
+#ifdef TEST_A2
+// expected-maybe-no-diagnostics-re
+
+//  A2-CHECK: error: no expected directives found: consider use of 'expected-no-diagnostics'
+// A2-CHECK-NEXT: 1 error generated.
+#endif
+
+#ifdef TEST_B1
+// expected-maybe-no-diagnostics
+// expected-no-diagnostics
+#endif
+
+#ifdef TEST_B2
+// expected-no-diagnostics
+// expected-maybe-no-diagnostics
+#endif
+
+#ifdef TEST_C1
+// expected-maybe-no-diagnostics
+#error test_c1
+// expected-error@-1 {{test_c1}}
+#endif
+
+#ifdef TEST_C2
+// expected-maybe-no-diagnostics
+#error test_c2
+
+//  C2-CHECK: error: 'error' diagnostics seen but not expected:
+// C2-CHECK-NEXT:   {{test_c2}}
+// C2-CHECK-NEXT: 1 error generated.
+#endif
+
+#ifdef TEST_C3
+#error test_c3
+// expected-error@-1 {{test_c3}}
+// expected-maybe-no-diagnostics
+#endif
+
+#ifdef TEST_C4
+#error test_c4
+// expected-maybe-no-diagnostics
+
+//  C4-CHECK: error: 'error' diagnostics seen but not expected:
+// C4-CHECK-NEXT:   {{test_c4}}
+// C4-CHECK-NEXT: 1 error generated.
+#endif
+
+#ifdef TEST_D1
+// expected-maybe-no-diagnostics
+#error test_d1
+// expected-error@-1 {{test_d1}}
+// expected-no-diagnostics
+
+//  D1-CHECK: error: 'error' diagnostics seen but not expected:
+// D1-CHECK-NEXT:   {{.*}} 'expected-no-diagnostics' directive cannot follow directives that expect diagnostics
+// D1-CHECK-NEXT: 1 error generated.
+#endif
+
+#ifdef TEST_D2
+// expected-maybe-no-diagnostics
+// expected-no-diagnostics
+#error test_d2
+// expected-error@-1 {{test_d2}}
+
+//  D2-CHECK: error: 'error' diagnostics seen but not expected:
+// D2-CHECK-NEXT:   {{test_d2}}
+// D2-CHECK-NEXT:   {{.*}} expected directive cannot follow 'expected-no-diagnostics' directive
+// D2-CHECK-NEXT: 2 errors generated.
+#endif
+
+#ifdef TEST_D3
+// expected-no-diagnostics
+// expected-maybe-no-diagnostics
+#error test_d3
+// expected-error@-1 {{test_d3}}
+
+//  D3-CHECK: error: 'error' diagnostics seen but not expected:
+// D3-CHECK-NEXT:   {{test_d3}}
+// D3-CHECK-NEXT:   {{.*}} expected directive cannot follow 'expected-no-diagnostics' directive
+// D3-CHEC

[clang] 7954368 - [Serialization] Remove unused declaration SLocCursorForID

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

Author: Kazu Hirata
Date: 2023-05-27T10:45:17-07:00
New Revision: 795436889dce9a314dc7e18476d0f5f2fc68482c

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

LOG: [Serialization] Remove unused declaration SLocCursorForID

The corresponding function body was removed by:

  commit 925296b4c2cbb358c34323dfcffbea6d59eb9c1e
  Author: Douglas Gregor 
  Date:   Tue Jul 19 16:10:42 2011 +

Added: 


Modified: 
clang/include/clang/Serialization/ASTReader.h

Removed: 




diff  --git a/clang/include/clang/Serialization/ASTReader.h 
b/clang/include/clang/Serialization/ASTReader.h
index 1360ee1877c1a..85f31ed22aca9 100644
--- a/clang/include/clang/Serialization/ASTReader.h
+++ b/clang/include/clang/Serialization/ASTReader.h
@@ -1390,7 +1390,6 @@ class ASTReader
   void ReadModuleOffsetMap(ModuleFile &F) const;
   void ParseLineTable(ModuleFile &F, const RecordData &Record);
   llvm::Error ReadSourceManagerBlock(ModuleFile &F);
-  llvm::BitstreamCursor &SLocCursorForID(int ID);
   SourceLocation getImportLocation(ModuleFile *F);
   void readIncludedFiles(ModuleFile &F, StringRef Blob, Preprocessor &PP);
   ASTReadResult ReadModuleMapFileBlock(RecordData &Record, ModuleFile &F,



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


[clang] fffb389 - [Analysis] Remove unused declaration getCurrentLVarDefinition

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

Author: Kazu Hirata
Date: 2023-05-27T10:45:18-07:00
New Revision: fffb389c8b2ff29a7a05fd17addf23a50005b057

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

LOG: [Analysis] Remove unused declaration getCurrentLVarDefinition

The declaration was added without a corresponding function definition
by:

  commit ae497deddfd9c631380bc622fa3e184531c2600a
  Author: DeLesley Hutchins 
  Date:   Sat Apr 19 00:35:54 2014 +

Added: 


Modified: 
clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h

Removed: 




diff  --git a/clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h 
b/clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
index 9c73d65db2668..9d28325c1ea67 100644
--- a/clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
+++ b/clang/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
@@ -484,8 +484,6 @@ class SExprBuilder {
 SMap.insert(std::make_pair(S, E));
   }
 
-  til::SExpr *getCurrentLVarDefinition(const ValueDecl *VD);
-
   til::SExpr *addStatement(til::SExpr *E, const Stmt *S,
const ValueDecl *VD = nullptr);
   til::SExpr *lookupVarDecl(const ValueDecl *VD);



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


[PATCH] D151320: [clang] Add `// expected-maybe-no-diagnostics` comment to VerifyDiagnosticConsumer

2023-05-27 Thread Vlad Serebrennikov via Phabricator via cfe-commits
Endill added inline comments.



Comment at: clang/lib/Frontend/VerifyDiagnosticConsumer.cpp:468
+Status = VerifyDiagnosticConsumer::HasExpectedMaybeNoDiagnostics;
+  continue;
+} else if (DToken.endswith(DType="-no-diagnostics")) {

jdenny wrote:
> Endill wrote:
> > jdenny wrote:
> > > Endill wrote:
> > > > jdenny wrote:
> > > > > Endill wrote:
> > > > > > jdenny wrote:
> > > > > > > This `continue` skips the prefix checking below, which is 
> > > > > > > important when there are multiple prefixes active (e.g., 
> > > > > > > `-verify=foo,bar`).  That is, any old 
> > > > > > > `BOGUS-maybe-no-diagnostics` will be effective then.
> > > > > > This should be fixed now. Thank you for spotting this!
> > > > > Thanks for the fix.  Please add a test so this bug doesn't pop up 
> > > > > again.
> > > > Done as A2 test
> > > Does A2 trigger the original bug?  I think there must be multiple 
> > > prefixes for this fix to matter.
> > I think prefix checking below works for a single prefix as well: 
> > https://github.com/llvm/llvm-project/blob/5217498dc88aa2de2b728462205ffa8b01d96cab/clang/lib/Frontend/CompilerInvocation.cpp#LL2382C47-L2382C47
> I downloaded this version of your patch: 
> .  That version has the bug 
> discussed in this comment thread.
> 
> I applied that patch and added test A2.  A2 passed.  That means A2 does not 
> reproduce the bug it was intended to reproduce.
> 
> Then I changed A2 to have `-verify=foo,bar`.  A2 then failed because it then 
> reproduced the bug.  (And of course with the current version of your patch, 
> it passes because you've fixed the bug.)
> 
> Please add such a test.
I replaced A2 test with more comprehensive E set of tests.

Surprisingly to me, `-verify` and `-verify=foo,bar` work quite differently 
because of `PH.Search()` call 40 lines above. I can't say I have full 
understanding what's going on, so I wrote a more comprehensive set of tests. 
Does this address your concern?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151320

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


[PATCH] D151320: [clang] Add `// expected-maybe-no-diagnostics` comment to VerifyDiagnosticConsumer

2023-05-27 Thread Joel E. Denny via Phabricator via cfe-commits
jdenny accepted this revision.
jdenny added inline comments.



Comment at: clang/lib/Frontend/VerifyDiagnosticConsumer.cpp:468
+Status = VerifyDiagnosticConsumer::HasExpectedMaybeNoDiagnostics;
+  continue;
+} else if (DToken.endswith(DType="-no-diagnostics")) {

Endill wrote:
> jdenny wrote:
> > Endill wrote:
> > > jdenny wrote:
> > > > Endill wrote:
> > > > > jdenny wrote:
> > > > > > Endill wrote:
> > > > > > > jdenny wrote:
> > > > > > > > This `continue` skips the prefix checking below, which is 
> > > > > > > > important when there are multiple prefixes active (e.g., 
> > > > > > > > `-verify=foo,bar`).  That is, any old 
> > > > > > > > `BOGUS-maybe-no-diagnostics` will be effective then.
> > > > > > > This should be fixed now. Thank you for spotting this!
> > > > > > Thanks for the fix.  Please add a test so this bug doesn't pop up 
> > > > > > again.
> > > > > Done as A2 test
> > > > Does A2 trigger the original bug?  I think there must be multiple 
> > > > prefixes for this fix to matter.
> > > I think prefix checking below works for a single prefix as well: 
> > > https://github.com/llvm/llvm-project/blob/5217498dc88aa2de2b728462205ffa8b01d96cab/clang/lib/Frontend/CompilerInvocation.cpp#LL2382C47-L2382C47
> > I downloaded this version of your patch: 
> > .  That version has the 
> > bug discussed in this comment thread.
> > 
> > I applied that patch and added test A2.  A2 passed.  That means A2 does not 
> > reproduce the bug it was intended to reproduce.
> > 
> > Then I changed A2 to have `-verify=foo,bar`.  A2 then failed because it 
> > then reproduced the bug.  (And of course with the current version of your 
> > patch, it passes because you've fixed the bug.)
> > 
> > Please add such a test.
> I replaced A2 test with more comprehensive E set of tests.
> 
> Surprisingly to me, `-verify` and `-verify=foo,bar` work quite differently 
> because of `PH.Search()` call 40 lines above. I can't say I have full 
> understanding what's going on, so I wrote a more comprehensive set of tests. 
> Does this address your concern?
> Surprisingly to me, `-verify` and `-verify=foo,bar` work quite differently 
> because of `PH.Search()` call 40 lines above. I can't say I have full 
> understanding what's going on,

That line is optimized for the case of a single prefix: it ignores text without 
that prefix.  If there are multiple prefixes, then it searches for a more 
general pattern and waits until the `std::binary_search` call below to worry 
about the prefix.

> so I wrote a more comprehensive set of tests. Does this address your concern?

Yes, and thanks for the extra testing.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151320

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


[clang] 78b72d6 - [StaticAnalyzer] Remove unused declaration evalLoadCommon

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

Author: Kazu Hirata
Date: 2023-05-27T14:53:51-07:00
New Revision: 78b72d695ff8b61edfaec82a7d3ac8d5d52bc3bd

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

LOG: [StaticAnalyzer] Remove unused declaration evalLoadCommon

The corresponding function definition was removed by:

  commit e0fb481cc57f5a9fb4908ab0a871c49d7ee61382
  Author: Artem Dergachev 
  Date:   Fri May 4 23:01:10 2018 +

Added: 


Modified: 
clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h

Removed: 




diff  --git 
a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h 
b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
index 8c3d9120788d3..5e93a46b38892 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
@@ -773,15 +773,6 @@ class ExprEngine {
   void finishArgumentConstruction(ExplodedNodeSet &Dst, ExplodedNode *Pred,
   const CallEvent &Call);
 
-  void evalLoadCommon(ExplodedNodeSet &Dst,
-  const Expr *NodeEx,  /* Eventually will be a CFGStmt */
-  const Expr *BoundEx,
-  ExplodedNode *Pred,
-  ProgramStateRef St,
-  SVal location,
-  const ProgramPointTag *tag,
-  QualType LoadTy);
-
   void evalLocation(ExplodedNodeSet &Dst,
 const Stmt *NodeEx, /* This will eventually be a CFGStmt */
 const Stmt *BoundEx,



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


[clang] 156aafd - [StaticAnalyzer] Remove unused declaration findDirectConstructorForCurrentCFGElement

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

Author: Kazu Hirata
Date: 2023-05-27T14:53:53-07:00
New Revision: 156aafd0ed12792a4abef8f3f5374f195fe3387d

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

LOG: [StaticAnalyzer] Remove unused declaration 
findDirectConstructorForCurrentCFGElement

The corresponding definition was removed by:

  commit a84374dc0e4e756a92191dd55efca43165e3977d
  Author: Artem Dergachev 
  Date:   Thu Jun 14 01:40:49 2018 +

Added: 


Modified: 
clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h

Removed: 




diff  --git 
a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h 
b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
index 5e93a46b3889..cc3f675071e6 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
@@ -907,13 +907,6 @@ class ExprEngine {
   static SVal makeElementRegion(ProgramStateRef State, SVal LValue,
 QualType &Ty, bool &IsArray, unsigned Idx = 0);
 
-  /// For a DeclStmt or CXXInitCtorInitializer, walk backward in the current 
CFG
-  /// block to find the constructor expression that directly constructed into
-  /// the storage for this statement. Returns null if the constructor for this
-  /// statement created a temporary object region rather than directly
-  /// constructing into an existing region.
-  const CXXConstructExpr *findDirectConstructorForCurrentCFGElement();
-
   /// Common code that handles either a CXXConstructExpr or a
   /// CXXInheritedCtorInitExpr.
   void handleConstructor(const Expr *E, ExplodedNode *Pred,



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


[clang] bdc2771 - [StaticAnalyzer] Remove unused declaration handleLVectorSplat

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

Author: Kazu Hirata
Date: 2023-05-27T14:53:54-07:00
New Revision: bdc2771911cb181fe014480b4c19d94ff52e

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

LOG: [StaticAnalyzer] Remove unused declaration handleLVectorSplat

The corresponding function definition was removed by:

  commit 55662b24a4755680e4fd34dc22a3dd555fdb1291
  Author: Balazs Benics 
  Date:   Thu Jul 1 10:54:28 2021 +0200

Added: 


Modified: 
clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h

Removed: 




diff  --git 
a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h 
b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
index cc3f675071e6..6e1db128e918 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
@@ -607,12 +607,6 @@ class ExprEngine {
   StmtNodeBuilder &Bldr,
   ExplodedNode *Pred);
 
-  ProgramStateRef handleLVectorSplat(ProgramStateRef state,
- const LocationContext *LCtx,
- const CastExpr *CastE,
- StmtNodeBuilder &Bldr,
- ExplodedNode *Pred);
-
   void handleUOExtension(ExplodedNodeSet::iterator I,
  const UnaryOperator* U,
  StmtNodeBuilder &Bldr);



___
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-27 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo created this revision.
mstorsjo added reviewers: junaire, alvinhochun, mati865.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added a subscriber: bd1976llvm.
Herald added a project: clang.

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.


Repository:
  rG LLVM Github Monorepo

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__)))
+

[PATCH] D151048: [clang][ExtractAPI] Modify declaration fragment methods to add a new fragment at an arbitrary offset.

2023-05-27 Thread R4444 via Phabricator via cfe-commits
Ruturaj4 marked 3 inline comments as done.
Ruturaj4 added a comment.

Daniel, I made all the changes as you desired, thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151048

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


[PATCH] D151048: [clang][ExtractAPI] Modify declaration fragment methods to add a new fragment at an arbitrary offset.

2023-05-27 Thread R4444 via Phabricator via cfe-commits
Ruturaj4 updated this revision to Diff 526296.
Ruturaj4 added a comment.



1. Updating D151048 : [clang][ExtractAPI] 
Modify declaration fragment methods to add a new fragment at an arbitrary 
offset. #
2. Enter a brief description of the changes included in this update.
3. The first line is used as subject, next lines as comment. #
4. If you intended to create a new revision, use:
5. $ arc diff --create

I made all the suggested changes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151048

Files:
  clang/include/clang/ExtractAPI/DeclarationFragments.h
  clang/include/clang/ExtractAPI/ExtractAPIVisitor.h


Index: clang/include/clang/ExtractAPI/ExtractAPIVisitor.h
===
--- clang/include/clang/ExtractAPI/ExtractAPIVisitor.h
+++ clang/include/clang/ExtractAPI/ExtractAPIVisitor.h
@@ -110,16 +110,16 @@
 static void modifyRecords(const T &Records, const StringRef &Name) {
   for (const auto &Record : Records) {
 if (Name == Record.second.get()->Name) {
-  Record.second.get()
-  ->Declaration
-  .insertAtIndex(0, "typedef",
- DeclarationFragments::FragmentKind::Keyword, "",
- nullptr)
-  .insertAtIndex(1, " ", DeclarationFragments::FragmentKind::Text)
-  .insertAtIndex(-1, " { ... } ",
- DeclarationFragments::FragmentKind::Text)
-  .insertAtIndex(-1, Name,
- DeclarationFragments::FragmentKind::Identifier);
+  auto &DeclFragment = Record.second->Declaration;
+  DeclFragment.insert(DeclFragment.begin(), " ",
+  DeclarationFragments::FragmentKind::Text);
+  DeclFragment.insert(DeclFragment.begin(), "typedef",
+  DeclarationFragments::FragmentKind::Keyword, "",
+  nullptr);
+  DeclFragment.insert(--DeclFragment.end(), " { ... } ",
+  DeclarationFragments::FragmentKind::Text);
+  DeclFragment.insert(--DeclFragment.end(), Name,
+  DeclarationFragments::FragmentKind::Identifier);
   break;
 }
   }
Index: clang/include/clang/ExtractAPI/DeclarationFragments.h
===
--- clang/include/clang/ExtractAPI/DeclarationFragments.h
+++ clang/include/clang/ExtractAPI/DeclarationFragments.h
@@ -97,34 +97,32 @@
   Declaration(Declaration) {}
   };
 
+  using FragmentIterator = std::vector::iterator;
+  using ConstFragmentIterator = std::vector::const_iterator;
+
   const std::vector &getFragments() const { return Fragments; }
 
-  size_t calculateOffset(intmax_t Index) const {
-if (Index >= 0) {
-  size_t offset = static_cast(Index);
-  if (offset > Fragments.size()) {
-offset = Fragments.size();
-  }
-  return offset;
-}
-return Fragments.size() + static_cast(Index);
-  }
+  FragmentIterator begin() { return Fragments.begin(); }
+
+  FragmentIterator end() { return Fragments.end(); }
+
+  ConstFragmentIterator cbegin() const { return Fragments.cbegin(); }
+
+  ConstFragmentIterator cend() const { return Fragments.cend(); }
 
   // Add a new Fragment at an arbitrary offset.
-  DeclarationFragments &insertAtIndex(intmax_t Index, StringRef Spelling,
-  FragmentKind Kind,
-  StringRef PreciseIdentifier = "",
-  const Decl *Declaration = nullptr) {
-Fragments.insert(
-Fragments.begin() + calculateOffset(Index),
-std::move(Fragment(Spelling, Kind, PreciseIdentifier, Declaration)));
+  DeclarationFragments &insert(FragmentIterator It, StringRef Spelling,
+   FragmentKind Kind,
+   StringRef PreciseIdentifier = "",
+   const Decl *Declaration = nullptr) {
+Fragments.insert(It, std::move(Fragment(Spelling, Kind, PreciseIdentifier,
+Declaration)));
 return *this;
   }
 
-  DeclarationFragments &insertAtIndex(intmax_t Index,
-  DeclarationFragments &&Other) {
-Fragments.insert(Fragments.begin() + calculateOffset(Index),
- std::make_move_iterator(Other.Fragments.begin()),
+  DeclarationFragments &insert(FragmentIterator It,
+   DeclarationFragments &&Other) {
+Fragments.insert(It, std::make_move_iterator(Other.Fragments.begin()),
  std::make_move_iterator(Other.Fragments.end()));
 Other.Fragments.clear();
 return *this;


Index: clang/include/clang/ExtractAPI/ExtractAPIVisitor.h
===
--- clang/include/clang/ExtractAPI/ExtractAPIVisit

[PATCH] D151128: [clangd] Show size, offset and padding for bit fields on hover

2023-05-27 Thread SR_team via Phabricator via cfe-commits
SR_team added a comment.

@sammccall review my code please


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

https://reviews.llvm.org/D151128

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


[PATCH] D151623: [clang] Extend __is_trivially_equality_comparable to check for hidden friends

2023-05-27 Thread Nikolas Klauser via Phabricator via cfe-commits
philnik created this revision.
philnik added reviewers: aaron.ballman, erichkeane.
Herald added a project: All.
philnik requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This allows types to be considered trivially equality comparable if a defaulted 
hidden friend is used.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151623

Files:
  clang/lib/AST/Type.cpp
  clang/test/SemaCXX/type-traits.cpp

Index: clang/test/SemaCXX/type-traits.cpp
===
--- clang/test/SemaCXX/type-traits.cpp
+++ clang/test/SemaCXX/type-traits.cpp
@@ -3270,6 +3270,172 @@
 };
 static_assert(!__is_trivially_equality_comparable(NotTriviallyEqualityComparableHasEnum));
 
+namespace hidden_friend {
+
+struct TriviallyEqualityComparable {
+  int i;
+  int j;
+
+  void func();
+  bool operator==(int) const { return false; }
+
+  friend bool operator==(const TriviallyEqualityComparable&, const TriviallyEqualityComparable&) = default;
+};
+static_assert(__is_trivially_equality_comparable(TriviallyEqualityComparable), "");
+
+struct TriviallyEqualityComparableNonTriviallyCopyable {
+  TriviallyEqualityComparableNonTriviallyCopyable(const TriviallyEqualityComparableNonTriviallyCopyable&);
+  ~TriviallyEqualityComparableNonTriviallyCopyable();
+  friend bool operator==(const TriviallyEqualityComparableNonTriviallyCopyable&, const TriviallyEqualityComparableNonTriviallyCopyable&) = default;
+  int i;
+};
+static_assert(__is_trivially_equality_comparable(TriviallyEqualityComparableNonTriviallyCopyable));
+
+struct NotTriviallyEqualityComparableHasPadding {
+  short i;
+  int j;
+
+  friend bool operator==(const NotTriviallyEqualityComparableHasPadding&, const NotTriviallyEqualityComparableHasPadding&) = default;
+};
+static_assert(!__is_trivially_equality_comparable(NotTriviallyEqualityComparableHasPadding), "");
+
+struct NotTriviallyEqualityComparableHasFloat {
+  float i;
+  int j;
+
+  friend bool operator==(const NotTriviallyEqualityComparableHasFloat&, const NotTriviallyEqualityComparableHasFloat&) = default;
+};
+static_assert(!__is_trivially_equality_comparable(NotTriviallyEqualityComparableHasFloat), "");
+
+struct NotTriviallyEqualityComparableHasTailPadding {
+  int i;
+  char j;
+
+  friend bool operator==(const NotTriviallyEqualityComparableHasTailPadding&, const NotTriviallyEqualityComparableHasTailPadding&) = default;
+};
+static_assert(!__is_trivially_equality_comparable(NotTriviallyEqualityComparableHasTailPadding), "");
+
+struct NotTriviallyEqualityComparableBase : NotTriviallyEqualityComparableHasTailPadding {
+  char j;
+
+  friend bool operator==(const NotTriviallyEqualityComparableBase&, const NotTriviallyEqualityComparableBase&) = default;
+};
+static_assert(!__is_trivially_equality_comparable(NotTriviallyEqualityComparableBase), "");
+
+class TriviallyEqualityComparablePaddedOutBase {
+  int i;
+  char c;
+
+public:
+  friend bool operator==(const TriviallyEqualityComparablePaddedOutBase&, const TriviallyEqualityComparablePaddedOutBase&) = default;
+};
+static_assert(!__is_trivially_equality_comparable(TriviallyEqualityComparablePaddedOutBase), "");
+
+struct TriviallyEqualityComparablePaddedOut : TriviallyEqualityComparablePaddedOutBase {
+  char j[3];
+
+  friend bool operator==(const TriviallyEqualityComparablePaddedOut&, const TriviallyEqualityComparablePaddedOut&) = default;
+};
+static_assert(__is_trivially_equality_comparable(TriviallyEqualityComparablePaddedOut), "");
+
+struct TriviallyEqualityComparable1 {
+  char i;
+
+  friend bool operator==(const TriviallyEqualityComparable1&, const TriviallyEqualityComparable1&) = default;
+};
+static_assert(__is_trivially_equality_comparable(TriviallyEqualityComparable1));
+
+struct TriviallyEqualityComparable2 {
+  int i;
+
+  friend bool operator==(const TriviallyEqualityComparable2&, const TriviallyEqualityComparable2&) = default;
+};
+static_assert(__is_trivially_equality_comparable(TriviallyEqualityComparable2));
+
+struct NotTriviallyEqualityComparableTriviallyEqualityComparableBases
+: TriviallyEqualityComparable1, TriviallyEqualityComparable2 {
+  friend bool operator==(const NotTriviallyEqualityComparableTriviallyEqualityComparableBases&, const NotTriviallyEqualityComparableTriviallyEqualityComparableBases&) = default;
+};
+static_assert(!__is_trivially_equality_comparable(NotTriviallyEqualityComparableTriviallyEqualityComparableBases));
+
+struct NotTriviallyEqualityComparableBitfield {
+  int i : 1;
+
+  friend bool operator==(const NotTriviallyEqualityComparableBitfield&, const NotTriviallyEqualityComparableBitfield&) = default;
+};
+static_assert(!__is_trivially_equality_comparable(NotTriviallyEqualityComparableBitfield));
+
+// TODO: This is trivially equality comparable
+struct NotTriviallyEqualityComparableBitfieldFilled {
+  char i : __CHAR_BIT__;
+
+  friend bool operator==(const NotTriviallyEqualityComparableBitfiel

[PATCH] D151625: [clang] Add `clang::equality_operator_compares_members_lexicographically`

2023-05-27 Thread Nikolas Klauser via Phabricator via cfe-commits
philnik created this revision.
philnik added reviewers: aaron.ballman, erichkeane.
Herald added a subscriber: dschuff.
Herald added a project: All.
philnik requested review of this revision.
Herald added subscribers: cfe-commits, aheejin.
Herald added a project: clang.

This attribute is equivalent to a defaulted member equality comparison for the 
purposes of __is_trivially_equality_comparable. The difference is that it 
doesn't try to do ADL calls when instantiating a class template. We encountered 
this problem while trying to make classes in libc++ trivially equality 
comparable. It can be used to guarantee that enums are trivially equality 
comparable (which is more of a bonus than a good reason to add this attribute).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151625

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/lib/AST/Type.cpp
  
clang/test/SemaCXX/attr-equality-operator-compares-members-lexicographically.cpp

Index: clang/test/SemaCXX/attr-equality-operator-compares-members-lexicographically.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/attr-equality-operator-compares-members-lexicographically.cpp
@@ -0,0 +1,139 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++20
+
+void __attribute__((equality_operator_compares_members_lexicographically)) foo(); // expected-warning {{'equality_operator_compares_members_lexicographically' attribute only applies to classes and enums}}
+
+struct [[clang::equality_operator_compares_members_lexicographically]] TriviallyEqualityComparabe1 {
+  int i;
+};
+static_assert(__is_trivially_equality_comparable(TriviallyEqualityComparabe1));
+
+struct __attribute__((equality_operator_compares_members_lexicographically)) TriviallyEqualityComparabe2 {
+  int i;
+};
+static_assert(__is_trivially_equality_comparable(TriviallyEqualityComparabe2));
+
+struct [[clang::equality_operator_compares_members_lexicographically(1)]] TestMessage {}; // expected-error {{'equality_operator_compares_members_lexicographically' attribute takes no arguments}}
+
+
+struct [[clang::equality_operator_compares_members_lexicographically]] NotTriviallyEqualityComparableHasPadding {
+  short i;
+  int j;
+};
+static_assert(!__is_trivially_equality_comparable(NotTriviallyEqualityComparableHasPadding), "");
+
+struct [[clang::equality_operator_compares_members_lexicographically]] NotTriviallyEqualityComparableHasFloat {
+  float i;
+  int j;
+};
+static_assert(!__is_trivially_equality_comparable(NotTriviallyEqualityComparableHasFloat), "");
+
+struct [[clang::equality_operator_compares_members_lexicographically]] NotTriviallyEqualityComparableHasTailPadding {
+  int i;
+  char j;
+};
+static_assert(!__is_trivially_equality_comparable(NotTriviallyEqualityComparableHasTailPadding), "");
+
+struct [[clang::equality_operator_compares_members_lexicographically]] NotTriviallyEqualityComparableBase : NotTriviallyEqualityComparableHasTailPadding {
+  char j;
+};
+static_assert(!__is_trivially_equality_comparable(NotTriviallyEqualityComparableBase), "");
+
+class [[clang::equality_operator_compares_members_lexicographically]] TriviallyEqualityComparablePaddedOutBase {
+  int i;
+  char c;
+};
+static_assert(!__is_trivially_equality_comparable(TriviallyEqualityComparablePaddedOutBase), "");
+
+struct [[clang::equality_operator_compares_members_lexicographically]] TriviallyEqualityComparablePaddedOut : TriviallyEqualityComparablePaddedOutBase {
+  char j[3];
+};
+static_assert(__is_trivially_equality_comparable(TriviallyEqualityComparablePaddedOut), "");
+
+struct [[clang::equality_operator_compares_members_lexicographically]] TriviallyEqualityComparable1 {
+  char i;
+};
+static_assert(__is_trivially_equality_comparable(TriviallyEqualityComparable1));
+
+struct [[clang::equality_operator_compares_members_lexicographically]] TriviallyEqualityComparable2 {
+  int i;
+};
+static_assert(__is_trivially_equality_comparable(TriviallyEqualityComparable2));
+
+struct [[clang::equality_operator_compares_members_lexicographically]] NotTriviallyEqualityComparableTriviallyEqualityComparableBases
+: TriviallyEqualityComparable1, TriviallyEqualityComparable2 {
+};
+static_assert(!__is_trivially_equality_comparable(NotTriviallyEqualityComparableTriviallyEqualityComparableBases));
+
+struct [[clang::equality_operator_compares_members_lexicographically]] NotTriviallyEqualityComparableBitfield {
+  int i : 1;
+};
+static_assert(!__is_trivially_equality_comparable(NotTriviallyEqualityComparableBitfield));
+
+// TODO: This is trivially equality comparable
+struct [[clang::equality_operator_compares_members_lexicographically]] NotTriviallyEqualityComparableBitfieldFilled {
+  char i : __CHAR_BIT__;
+};
+static_assert(!__is_trivially_equality_comparable(NotTriviallyEqualityComparableBitfield));
+
+union [[clang::equality_operator_compares_members_lexicographically]] U {
+  int i;
+};
+
+struct [[cl

[PATCH] D151625: [clang] Add `clang::equality_operator_compares_members_lexicographically`

2023-05-27 Thread Nikolas Klauser via Phabricator via cfe-commits
philnik added a comment.

If anybody has a better name for this I'm all ears.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151625

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