[PATCH] D119409: [C++20] [Modules] Remain variable's definition in module interface

2022-02-09 Thread Chuanqi Xu via Phabricator via cfe-commits
ChuanqiXu created this revision.
ChuanqiXu added reviewers: rsmith, iains, urnathan, dblaikie.
ChuanqiXu added a project: clang.
ChuanqiXu requested review of this revision.
Herald added a subscriber: cfe-commits.

This fixes issue51873 . The 
issue reports that we couldn't run hello world example in C++20 module. Then I 
found that the reason is that libstdc++ uses static variable to initialize 
resources for streams like std::cout. And it would be good if we use libc++.

So the key point here is that wether or not the definition of static variables 
should be remained in module interface. First I thought the reduction makes 
sense. Since static variable shouldn't be able to be referred outside the 
module. Then @rsmith  pointed out that this one should be a bug.

This patch tries to remain variable's definition in the module interface no 
matter what the kind it is. This violates ModuleTS. It wouldn't define inline 
variables in the module. But I think we don't need to keep compatibility for 
ModuleTS. It would be deprecated someday.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119409

Files:
  clang/lib/Serialization/ASTWriterDecl.cpp
  clang/test/CXX/modules-ts/basic/basic.def.odr/p4/module.cpp
  clang/test/CXX/modules-ts/basic/basic.def.odr/p4/user.cpp
  clang/test/CodeGenCXX/static-variable-in-module.cpp


Index: clang/test/CodeGenCXX/static-variable-in-module.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/static-variable-in-module.cpp
@@ -0,0 +1,24 @@
+// RUN: rm -fr %t
+// RUN: mkdir %t
+// RUN: echo "struct S { S(); };" >> %t/foo.h
+// RUN: echo "static S s = S();" >> %t/foo.h
+// RUN: %clang -std=c++20 -I%t %s -S -emit-llvm -o - | FileCheck %s
+module;
+#include "foo.h"
+export module m;
+class A {
+public:
+A();
+};
+static A a = A();
+
+// CHECK: @_ZL1s = internal global %struct.S zeroinitializer
+// CHECK: @_ZW1mE1a = dso_local global %class.A zeroinitializer
+// CHECK: @llvm.global_ctors = appending 
global{{.*}}@_GLOBAL__sub_I_static_variable_in_module.cpp
+// CHECK: define {{.*}}__cxx_global_var_init[[SUFFIX:[^)]*]]
+// CHECK: call void @_ZN1SC1Ev
+// CHECK: define {{.*}}__cxx_global_var_init[[SUFFIX2:[^)]*]]
+// CHECK: call void @_ZW1mEN1AC1Ev
+// CHECK: define {{.*}}@_GLOBAL__sub_I_static_variable_in_module.cpp
+// CHECK: call void @__cxx_global_var_init[[SUFFIX]]
+// CHECK: call void @__cxx_global_var_init[[SUFFIX2]]
Index: clang/test/CXX/modules-ts/basic/basic.def.odr/p4/user.cpp
===
--- clang/test/CXX/modules-ts/basic/basic.def.odr/p4/user.cpp
+++ clang/test/CXX/modules-ts/basic/basic.def.odr/p4/user.cpp
@@ -2,7 +2,7 @@
 // RUN: %clang_cc1 -fmodules-ts %s -triple %itanium_abi_triple 
-fmodule-file=%t -emit-llvm -o - | FileCheck %s --implicit-check-not=unused 
--implicit-check-not=global_module
 
 // CHECK-DAG: @extern_var_exported = external {{(dso_local )?}}global
-// CHECK-DAG: @inline_var_exported = linkonce_odr {{(dso_local )?}}global
+// CHECK-DAG: @inline_var_exported = available_externally {{(dso_local 
)?}}global
 // CHECK-DAG: @const_var_exported = available_externally {{(dso_local 
)?}}constant i32 3
 
 import Module;
Index: clang/test/CXX/modules-ts/basic/basic.def.odr/p4/module.cpp
===
--- clang/test/CXX/modules-ts/basic/basic.def.odr/p4/module.cpp
+++ clang/test/CXX/modules-ts/basic/basic.def.odr/p4/module.cpp
@@ -2,11 +2,11 @@
 // RUN: %clang_cc1 -fmodules-ts %s -triple %itanium_abi_triple 
-fmodule-file=%t -emit-llvm -o - | FileCheck %s --implicit-check-not=unused 
--implicit-check-not=global_module
 
 // CHECK-DAG: @extern_var_exported = external {{(dso_local )?}}global
-// CHECK-DAG: @inline_var_exported = linkonce_odr {{(dso_local )?}}global
+// CHECK-DAG: @inline_var_exported = available_externally {{(dso_local 
)?}}global
 // CHECK-DAG: @const_var_exported = available_externally {{(dso_local 
)?}}constant i32 3,
 //
 // CHECK-DAG: @_ZW6ModuleE25extern_var_module_linkage = external {{(dso_local 
)?}}global
-// CHECK-DAG: @_ZW6ModuleE25inline_var_module_linkage = linkonce_odr 
{{(dso_local )?}}global
+// CHECK-DAG: @_ZW6ModuleE25inline_var_module_linkage = available_externally 
{{(dso_local )?}}global
 // CHECK-DAG: @_ZW6ModuleE25static_var_module_linkage = available_externally 
{{(dso_local )?}}global i32 0,
 // CHECK-DAG: @_ZW6ModuleE24const_var_module_linkage = available_externally 
{{(dso_local )?}}constant i32 3,
 
Index: clang/lib/Serialization/ASTWriterDecl.cpp
===
--- clang/lib/Serialization/ASTWriterDecl.cpp
+++ clang/lib/Serialization/ASTWriterDecl.cpp
@@ -1022,15 +1022,17 @@
 if (Writer.WritingModule &&
 !D->getDescribedVarTemplate() && !D->getMemberSpecializationInfo() &&
 !isa(D)) {
-  // When building a

[PATCH] D116015: [PowerPC] Add generic fnmsub intrinsic

2022-02-09 Thread Qiu Chaofan via Phabricator via cfe-commits
qiucf added a comment.

gentle ping


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116015

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


[PATCH] D119407: [PowerPC] [Clang] Add SSE4 and BMI compatible intrinsics implementation for PowerPC

2022-02-09 Thread Qiu Chaofan via Phabricator via cfe-commits
qiucf created this revision.
qiucf added reviewers: jsji, nemanjai, PowerPC, shchenz.
Herald added subscribers: kbarton, krytarowski.
qiucf requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119407

Files:
  clang/lib/Headers/ppc_wrappers/bmi2intrin.h
  clang/lib/Headers/ppc_wrappers/bmiintrin.h
  clang/lib/Headers/ppc_wrappers/emmintrin.h
  clang/lib/Headers/ppc_wrappers/immintrin.h
  clang/lib/Headers/ppc_wrappers/nmmintrin.h
  clang/lib/Headers/ppc_wrappers/pmmintrin.h
  clang/lib/Headers/ppc_wrappers/smmintrin.h
  clang/lib/Headers/ppc_wrappers/tmmintrin.h
  clang/lib/Headers/ppc_wrappers/x86gprintrin.h
  clang/lib/Headers/ppc_wrappers/x86intrin.h
  clang/lib/Headers/ppc_wrappers/xmmintrin.h

Index: clang/lib/Headers/ppc_wrappers/xmmintrin.h
===
--- clang/lib/Headers/ppc_wrappers/xmmintrin.h
+++ clang/lib/Headers/ppc_wrappers/xmmintrin.h
@@ -31,10 +31,8 @@
 #error "Please read comment above. Use -DNO_WARN_X86_INTRINSICS to disable this error."
 #endif
 
-#ifndef _XMMINTRIN_H_INCLUDED
-#define _XMMINTRIN_H_INCLUDED
-
-#if defined(__ppc64__) && (defined(__linux__) || defined(__FreeBSD__))
+#ifndef XMMINTRIN_H_
+#define XMMINTRIN_H_
 
 /* Define four value permute mask */
 #define _MM_SHUFFLE(w,x,y,z) (((w) << 6) | ((x) << 4) | ((y) << 2) | (z))
@@ -52,6 +50,8 @@
 #undef bool
 #endif
 
+#include 
+
 /* We need type definitions from the MMX header file.  */
 #include 
 
@@ -62,13 +62,14 @@
 
 /* The Intel API is flexible enough that we must allow aliasing with other
vector types, and their scalar components.  */
-typedef vector float __m128 __attribute__((__may_alias__));
+typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
 
 /* Unaligned version of the same type.  */
-typedef vector float __m128_u __attribute__((__may_alias__, __aligned__(1)));
+typedef float __m128_u __attribute__ ((__vector_size__ (16), __may_alias__,
+   __aligned__ (1)));
 
 /* Internal data types for implementing the intrinsics.  */
-typedef vector float __v4sf;
+typedef float __v4sf __attribute__ ((__vector_size__ (16)));
 
 /* Create an undefined vector.  */
 extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
@@ -89,6 +90,7 @@
 extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _mm_load_ps (float const *__P)
 {
+  assert(((unsigned long)__P & 0xfUL) == 0UL);
   return ((__m128)vec_ld(0, (__v4sf*)__P));
 }
 
@@ -145,6 +147,7 @@
 extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _mm_store_ps (float *__P, __m128 __A)
 {
+  assert(((unsigned long)__P & 0xfUL) == 0UL);
   vec_st((__v4sf)__A, 0, (__v4sf*)__P);
 }
 
@@ -881,7 +884,7 @@
 extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _mm_cvtss_si32 (__m128 __A)
 {
-  __m64 res = 0;
+  int res;
 #ifdef _ARCH_PWR8
   double dtmp;
   __asm__(
@@ -914,8 +917,8 @@
 extern __inline long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _mm_cvtss_si64 (__m128 __A)
 {
-  __m64 res = 0;
-#ifdef _ARCH_PWR8
+  long long res;
+#if defined (_ARCH_PWR8) && defined (__powerpc64__)
   double dtmp;
   __asm__(
 #ifdef __LITTLE_ENDIAN__
@@ -1328,6 +1331,9 @@
 extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _mm_movemask_ps (__m128  __A)
 {
+#ifdef _ARCH_PWR10
+  return vec_extractm ((__vector unsigned int) __A);
+#else
   __vector unsigned long long result;
   static const __vector unsigned int perm_mask =
 {
@@ -1347,6 +1353,7 @@
 #else
   return result[0];
 #endif
+#endif /* !_ARCH_PWR10 */
 }
 #endif /* _ARCH_PWR8 */
 
@@ -1553,6 +1560,7 @@
 extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _mm_movemask_pi8 (__m64 __A)
 {
+#ifdef __powerpc64__
   unsigned long long p =
 #ifdef __LITTLE_ENDIAN__
  0x0008101820283038UL; // permute control for sign bits
@@ -1560,6 +1568,18 @@
  0x3830282018100800UL; // permute control for sign bits
 #endif
   return __builtin_bpermd (p, __A);
+#else
+#ifdef __LITTLE_ENDIAN__
+  unsigned int mask = 0x20283038UL;
+  unsigned int r1 = __builtin_bpermd (mask, __A) & 0xf;
+  unsigned int r2 = __builtin_bpermd (mask, __A >> 32) & 0xf;
+#else
+  unsigned int mask = 0x38302820UL;
+  unsigned int r1 = __builtin_bpermd (mask, __A >> 32) & 0xf;
+  unsigned int r2 = __builtin_bpermd (mask, __A) & 0xf;
+#endif
+  return (r2 << 4) | r1;
+#endif
 }
 
 extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
@@ -1841,4 +1861,4 @@
 #endif /* defined(__ppc64__) && (defined(__linux__) || defined(__FreeBSD__))   \
 */
 
-#endif /* _XMMINTRIN_H_INCLUDED */
+#endif /* XMMINTRIN_H_ */
Index: clang/lib/Headers/ppc_wrappers/x86intrin.h
==

[PATCH] D119392: [Clang][OpenMP][Sema] Remove support for floating point values in atomic compare

2022-02-09 Thread Shilei Tian via Phabricator via cfe-commits
tianshilei1992 updated this revision to Diff 407387.
tianshilei1992 added a comment.

recover test cases removed by mistake


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119392

Files:
  clang/lib/Sema/SemaOpenMP.cpp

Index: clang/lib/Sema/SemaOpenMP.cpp
===
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -11007,8 +11007,6 @@
   Expr *C = nullptr;
   /// True if the cond expr is in the form of 'x ordop expr'.
   bool IsXBinopExpr = true;
-  /// The atomic compare operator.
-  OMPAtomicCompareOp Op;
 
   /// Check if it is a valid conditional update statement (cond-update-stmt).
   bool checkCondUpdateStmt(IfStmt *S, ErrorInfoTy &ErrorInfo);
@@ -11065,23 +11063,7 @@
   }
 
   switch (Cond->getOpcode()) {
-  case BO_EQ:
-Op = OMPAtomicCompareOp::EQ;
-break;
-  case BO_LT:
-Op = OMPAtomicCompareOp::MIN;
-break;
-  case BO_GT:
-Op = OMPAtomicCompareOp::MAX;
-break;
-  default:
-ErrorInfo.Error = ErrorTy::InvalidBinaryOp;
-ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = Cond->getExprLoc();
-ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Cond->getSourceRange();
-return false;
-  }
-
-  if (Cond->getOpcode() == BO_EQ) {
+  case BO_EQ: {
 C = Cond;
 D = BO->getRHS();
 if (checkIfTwoExprsAreSame(ContextRef, X, Cond->getLHS())) {
@@ -11094,7 +11076,10 @@
   ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Cond->getSourceRange();
   return false;
 }
-  } else {
+break;
+  }
+  case BO_LT:
+  case BO_GT: {
 E = BO->getRHS();
 if (checkIfTwoExprsAreSame(ContextRef, X, Cond->getLHS()) &&
 checkIfTwoExprsAreSame(ContextRef, E, Cond->getRHS())) {
@@ -11109,6 +11094,13 @@
   ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Cond->getSourceRange();
   return false;
 }
+break;
+  }
+  default:
+ErrorInfo.Error = ErrorTy::InvalidBinaryOp;
+ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = Cond->getExprLoc();
+ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Cond->getSourceRange();
+return false;
   }
 
   return true;
@@ -11159,23 +11151,7 @@
   }
 
   switch (Cond->getOpcode()) {
-  case BO_EQ:
-Op = OMPAtomicCompareOp::EQ;
-break;
-  case BO_LT:
-Op = OMPAtomicCompareOp::MIN;
-break;
-  case BO_GT:
-Op = OMPAtomicCompareOp::MAX;
-break;
-  default:
-ErrorInfo.Error = ErrorTy::InvalidBinaryOp;
-ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = Cond->getExprLoc();
-ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Cond->getSourceRange();
-return false;
-  }
-
-  if (Cond->getOpcode() == BO_EQ) {
+  case BO_EQ: {
 C = Cond;
 D = CO->getTrueExpr();
 if (checkIfTwoExprsAreSame(ContextRef, X, Cond->getLHS())) {
@@ -11188,7 +11164,10 @@
   ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Cond->getSourceRange();
   return false;
 }
-  } else {
+break;
+  }
+  case BO_LT:
+  case BO_GT: {
 E = CO->getTrueExpr();
 if (checkIfTwoExprsAreSame(ContextRef, X, Cond->getLHS()) &&
 checkIfTwoExprsAreSame(ContextRef, E, Cond->getRHS())) {
@@ -11203,6 +11182,13 @@
   ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Cond->getSourceRange();
   return false;
 }
+break;
+  }
+  default:
+ErrorInfo.Error = ErrorTy::InvalidBinaryOp;
+ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = Cond->getExprLoc();
+ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Cond->getSourceRange();
+return false;
   }
 
   return true;
@@ -11212,8 +11198,7 @@
   // 'x' and 'e' cannot be nullptr
   assert(X && E && "X and E cannot be nullptr");
 
-  auto CheckValue = [&ErrorInfo](const Expr *E, OMPAtomicCompareOp Op,
- bool ShouldBeLValue) {
+  auto CheckValue = [&ErrorInfo](const Expr *E, bool ShouldBeLValue) {
 if (ShouldBeLValue && !E->isLValue()) {
   ErrorInfo.Error = ErrorTy::XNotLValue;
   ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = E->getExprLoc();
@@ -11230,7 +11215,7 @@
 return false;
   }
 
-  if (Op != OMPAtomicCompareOp::EQ && !QTy->isIntegerType()) {
+  if (!QTy->isIntegerType()) {
 ErrorInfo.Error = ErrorTy::NotInteger;
 ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = E->getExprLoc();
 ErrorInfo.ErrorRange = ErrorInfo.NoteRange = E->getSourceRange();
@@ -11241,13 +11226,13 @@
 return true;
   };
 
-  if (!CheckValue(X, Op, true))
+  if (!CheckValue(X, true))
 return false;
 
-  if (!CheckValue(E, Op, false))
+  if (!CheckValue(E, false))
 return false;
 
-  if (D && !CheckValue(D, Op, false))
+  if (D && !CheckValue(D, false))
 return false;
 
   return true;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D118428: [clang-cl] Support the /JMC flag

2022-02-09 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen marked an inline comment as done.
ychen added inline comments.



Comment at: llvm/test/CodeGen/X86/jmc-instrument.ll:2
+; Check that the flag symbol is not full-qualified.
+; RUN: llc < %s -enable-jmc-instrument | FileCheck %s
+

hans wrote:
> ychen wrote:
> > hans wrote:
> > > hans wrote:
> > > > Since it's an IR pass, I think we don't need to have an llc test at all.
> > > I still think it's unusual to have an llc test for an IR pass. Are there 
> > > any other examples where we do something similar?
> > yes, it is pretty rare. I wanted to test the `CodeViewDebug.cpp` change, 
> > however, the code path only triggers when the JMC pass is run. Using `llc` 
> > came to mind. I'm open to any alternative.
> Oh, I see. But does the test check the right thing, then? I only see CHECKs 
> for instructions, not debug info.
> 
> And isn't it enough to use IR with a global variable in the .msvcjmc section 
> as input? I think the tighter the test, the better.
It turns out that the `CodeViewDebug.cpp` change is not needed anymore. Delete 
this test too. Thanks for help spotting this!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118428

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


[PATCH] D118428: [clang-cl] Support the /JMC flag

2022-02-09 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen updated this revision to Diff 407384.
ychen marked an inline comment as done.
ychen added a comment.

- Remove CodeViewDebug.cpp and the associated test. It was needed because the 
instrumented flag variables were scoped inside the associated method in the 
CodeView. The current patch puts them in the CU scope (which MSVC does). So the 
flag variable would never be decorated with qualified name.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118428

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/cl-options.c
  llvm/include/llvm/CodeGen/CommandFlags.h
  llvm/include/llvm/CodeGen/Passes.h
  llvm/include/llvm/InitializePasses.h
  llvm/include/llvm/LinkAllPasses.h
  llvm/include/llvm/Target/TargetOptions.h
  llvm/lib/CodeGen/CMakeLists.txt
  llvm/lib/CodeGen/CodeGen.cpp
  llvm/lib/CodeGen/CommandFlags.cpp
  llvm/lib/CodeGen/JMCInstrumenter.cpp
  llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
  llvm/lib/Target/ARM/ARMTargetMachine.cpp
  llvm/lib/Target/X86/X86TargetMachine.cpp
  llvm/test/Instrumentation/JustMyCode/jmc-instrument-x86.ll
  llvm/test/Instrumentation/JustMyCode/jmc-instrument.ll
  llvm/tools/opt/opt.cpp

Index: llvm/tools/opt/opt.cpp
===
--- llvm/tools/opt/opt.cpp
+++ llvm/tools/opt/opt.cpp
@@ -498,7 +498,8 @@
   "generic-to-nvvm",  "expandmemcmp",
   "loop-reduce",  "lower-amx-type",
   "pre-amx-config",   "lower-amx-intrinsics",
-  "polyhedral-info",  "replace-with-veclib"};
+  "polyhedral-info",  "replace-with-veclib",
+  "jmc-instrument"};
   for (const auto &P : PassNamePrefix)
 if (Pass.startswith(P))
   return true;
@@ -572,6 +573,7 @@
   initializeHardwareLoopsPass(Registry);
   initializeTypePromotionPass(Registry);
   initializeReplaceWithVeclibLegacyPass(Registry);
+  initializeJMCInstrumenterPass(Registry);
 
 #ifdef BUILD_EXAMPLES
   initializeExampleIRTransforms(Registry);
Index: llvm/test/Instrumentation/JustMyCode/jmc-instrument.ll
===
--- /dev/null
+++ llvm/test/Instrumentation/JustMyCode/jmc-instrument.ll
@@ -0,0 +1,120 @@
+; RUN: opt -jmc-instrument -mtriple=x86_64-pc-windows-msvc  -S < %s | FileCheck %s
+; RUN: opt -jmc-instrument -mtriple=aarch64-pc-windows-msvc -S < %s | FileCheck %s
+; RUN: opt -jmc-instrument -mtriple=arm-pc-windows-msvc -S < %s | FileCheck %s
+
+; CHECK: $__JustMyCode_Default = comdat any
+
+; CHECK: @"__7DF23CF5_x@c" = internal unnamed_addr global i8 1, section ".msvcjmc", align 1, !dbg !0
+; CHECK: @"__A85D9D03_x@c" = internal unnamed_addr global i8 1, section ".msvcjmc", align 1, !dbg !5
+; CHECK: @llvm.used = appending global [1 x i8*] [i8* bitcast (void (i8*)* @__JustMyCode_Default to i8*)], section "llvm.metadata"
+
+; CHECK: define void @l1() !dbg !13 {
+; CHECK:   call void @__CheckForDebuggerJustMyCode(i8* noundef @"__7DF23CF5_x@c")
+; CHECK:   ret void
+; CHECK: }
+
+; CHECK: define void @l2() !dbg !17 {
+; CHECK:   call void @__CheckForDebuggerJustMyCode(i8* noundef @"__7DF23CF5_x@c")
+; CHECK:   ret void
+; CHECK: }
+
+; CHECK: define void @w1() !dbg !19 {
+; CHECK:   call void @__CheckForDebuggerJustMyCode(i8* noundef @"__A85D9D03_x@c")
+; CHECK:   ret void
+; CHECK: }
+
+; CHECK: define void @w2() !dbg !20 {
+; CHECK:   call void @__CheckForDebuggerJustMyCode(i8* noundef @"__A85D9D03_x@c")
+; CHECK:   ret void
+; CHECK: }
+
+; CHECK: define void @w3() !dbg !22 {
+; CHECK:   call void @__CheckForDebuggerJustMyCode(i8* noundef @"__A85D9D03_x@c")
+; CHECK:   ret void
+; CHECK: }
+
+; CHECK: define void @w4() !dbg !24 {
+; CHECK:   call void @__CheckForDebuggerJustMyCode(i8* noundef @"__A85D9D03_x@c")
+; CHECK:   ret void
+; CHECK: }
+
+; CHECK: declare void @__CheckForDebuggerJustMyCode(i8* noundef) unnamed_addr
+
+; CHECK: define void @__JustMyCode_Default(i8* noundef %0) unnamed_addr comdat {
+; CHECK:   ret void
+; CHECK: }
+
+; CHECK: !llvm.linker.options = !{!12}
+
+; CHECK: !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
+; CHECK: !1 = distinct !DIGlobalVariable(name: "__7DF23CF5_x@c", scope: !2, file: !3, type: !8, isLocal: true, isDefinition: true)
+; CHECK: !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: None)
+; CHECK: !3 = !DIFile(filename: "a/x.c", directory: "/tmp")
+; CHECK: !4 = !{!0, !5}
+; CHECK: !5 = !DIGlobalVariableExpression(var: !6, expr: !DIExpression())
+; CHECK: !6 = distinct !DIGlobalVariable(name: "__A85D9D03_x@c", scope: !2, file: !7, type: !8, isLocal:

[PATCH] D119405: [Clang][Sema] Use C++ standard terminology in clang diagnostics.

2022-02-09 Thread Jun Zhang via Phabricator via cfe-commits
junaire created this revision.
junaire added reviewers: Quuxplusone, aaron.ballman.
junaire requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Clang diagnostics should say "floating-point literal" instead of 
"floating-point constant"
according to C++ standard.

Close #53100


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119405

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td


Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -113,10 +113,10 @@
   "predefined identifier is only valid inside function">,
   InGroup>;
 def warn_float_overflow : Warning<
-  "magnitude of floating-point constant too large for type %0; maximum is %1">,
+  "magnitude of floating-point literal too large for type %0; maximum is %1">,
InGroup;
 def warn_float_underflow : Warning<
-  "magnitude of floating-point constant too small for type %0; minimum is %1">,
+  "magnitude of floating-point literal too small for type %0; minimum is %1">,
   InGroup;
 def warn_double_const_requires_fp64 : Warning<
   "double precision constant requires %select{cl_khr_fp64|cl_khr_fp64 and 
__opencl_c_fp64}0, "


Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -113,10 +113,10 @@
   "predefined identifier is only valid inside function">,
   InGroup>;
 def warn_float_overflow : Warning<
-  "magnitude of floating-point constant too large for type %0; maximum is %1">,
+  "magnitude of floating-point literal too large for type %0; maximum is %1">,
InGroup;
 def warn_float_underflow : Warning<
-  "magnitude of floating-point constant too small for type %0; minimum is %1">,
+  "magnitude of floating-point literal too small for type %0; minimum is %1">,
   InGroup;
 def warn_double_const_requires_fp64 : Warning<
   "double precision constant requires %select{cl_khr_fp64|cl_khr_fp64 and __opencl_c_fp64}0, "
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D119383: [clang][CMake] Add a warning about the Standalone build being deprecated

2022-02-09 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In D119383#3309796 , @tstellar wrote:

> I would like to keep this supported upstream as this is how we build clang in 
> Fedora.  If some people find the stand-alone builds burdensome, then I think 
> it would be best to start a thread on Discourse so we can try to find a 
> solution that works for everyone.

I created 
https://discourse.llvm.org/t/standalone-build-for-clang-lld-fix-or-remove/59977


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119383

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


[PATCH] D93298: [RISCV] add the MC layer support of Zfinx extension

2022-02-09 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: llvm/lib/Target/RISCV/RISCVRegisterInfo.td:555
+def GPRF64  : RegisterClass<"RISCV", [f64], 64, (add GPR)>;
+def GPRPF64 : RegisterClass<"RISCV", [f64], 64, (add
+X10_PD, X12_PD, X14_PD, X16_PD,

Jim wrote:
> Is XLenRI correct for GPRPF64? RV32 has size 32.
I'm not sure the RegInfos are correct for the other classes either. The 
RegInfos override the register size, the spill size, and spill alignment. I 
think those should all be based on the FP type.

So I don't think any of these should have a RegInfos.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93298

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


[PATCH] D119383: [clang][CMake] Add a warning about the Standalone build being deprecated

2022-02-09 Thread Tom Stellard via Phabricator via cfe-commits
tstellar requested changes to this revision.
tstellar added a comment.
This revision now requires changes to proceed.

I would like to keep this supported upstream as this is how we build clang in 
Fedora.  If some people find the stand-alone builds burdensome, then I think it 
would be best to start a thread on Discourse so we can try to find a solution 
that works for everyone.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119383

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


[PATCH] D119398: [OpenCL] Guard atomic_double with cl_khr_int64_base_atomics and cl_khr_int64_extended_atomics

2022-02-09 Thread Yang Haonan via Phabricator via cfe-commits
haonanya created this revision.
haonanya added reviewers: Anastasia, svenvh.
haonanya added a project: clang.
Herald added subscribers: Naghasan, ldrumm, yaxunl.
haonanya requested review of this revision.
Herald added a subscriber: cfe-commits.

It is necessary to guard atomic_double type according to 
https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_C.html#_footnotedef_54.
Platform that disables cl_khr_int64_base_atomics and 
cl_khr_int64_extended_atomics will have compiling errors even if atomic_double 
is not used.

Compile the following OpenCL test with options clang++ -cc1 -emit-llvm -triple 
spir-unknown-unknown -finclude-default-header 
-cl-ext=+cl_khr_fp64,+__opencl_c_fp64,-cl_khr_int64_base_atomics  -cl-std=CL3.0 
test.cl
__kernel void test_kernel1() {}

use of type 'atomic_double' (aka '_Atomic(double)') requires 
cl_khr_int64_extended_atomics extension to be enabled


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119398

Files:
  clang/lib/Headers/opencl-c.h
  clang/lib/Sema/OpenCLBuiltins.td


Index: clang/lib/Sema/OpenCLBuiltins.td
===
--- clang/lib/Sema/OpenCLBuiltins.td
+++ clang/lib/Sema/OpenCLBuiltins.td
@@ -95,22 +95,22 @@
 def FuncExtFloatAtomicsFp16GenericLoadStore : 
FunctionExtension<"cl_ext_float_atomics 
__opencl_c_ext_fp16_global_atomic_load_store 
__opencl_c_ext_fp16_local_atomic_load_store">;
 def FuncExtFloatAtomicsFp16GlobalAdd : 
FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_global_atomic_add">;
 def FuncExtFloatAtomicsFp32GlobalAdd : 
FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp32_global_atomic_add">;
-def FuncExtFloatAtomicsFp64GlobalAdd : 
FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp64_global_atomic_add">;
+def FuncExtFloatAtomicsFp64GlobalAdd : 
FunctionExtension<"cl_ext_float_atomics cl_khr_int64_base_atomics 
cl_khr_int64_extended_atomics __opencl_c_ext_fp64_global_atomic_add">;
 def FuncExtFloatAtomicsFp16LocalAdd  : 
FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_local_atomic_add">;
 def FuncExtFloatAtomicsFp32LocalAdd  : 
FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp32_local_atomic_add">;
-def FuncExtFloatAtomicsFp64LocalAdd  : 
FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp64_local_atomic_add">;
+def FuncExtFloatAtomicsFp64LocalAdd  : 
FunctionExtension<"cl_ext_float_atomics cl_khr_int64_base_atomics 
cl_khr_int64_extended_atomics __opencl_c_ext_fp64_local_atomic_add">;
 def FuncExtFloatAtomicsFp16GenericAdd: 
FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_local_atomic_add 
__opencl_c_ext_fp16_global_atomic_add">;
 def FuncExtFloatAtomicsFp32GenericAdd: 
FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp32_local_atomic_add 
__opencl_c_ext_fp32_global_atomic_add">;
-def FuncExtFloatAtomicsFp64GenericAdd: 
FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp64_local_atomic_add 
__opencl_c_ext_fp64_global_atomic_add">;
+def FuncExtFloatAtomicsFp64GenericAdd: 
FunctionExtension<"cl_ext_float_atomics cl_khr_int64_base_atomics 
cl_khr_int64_extended_atomics __opencl_c_ext_fp64_local_atomic_add 
__opencl_c_ext_fp64_global_atomic_add">;
 def FuncExtFloatAtomicsFp16GlobalMinMax  : 
FunctionExtension<"cl_ext_float_atomics 
__opencl_c_ext_fp16_global_atomic_min_max">;
 def FuncExtFloatAtomicsFp32GlobalMinMax  : 
FunctionExtension<"cl_ext_float_atomics 
__opencl_c_ext_fp32_global_atomic_min_max">;
-def FuncExtFloatAtomicsFp64GlobalMinMax  : 
FunctionExtension<"cl_ext_float_atomics 
__opencl_c_ext_fp64_global_atomic_min_max">;
+def FuncExtFloatAtomicsFp64GlobalMinMax  : 
FunctionExtension<"cl_ext_float_atomics cl_khr_int64_base_atomics 
cl_khr_int64_extended_atomics __opencl_c_ext_fp64_global_atomic_min_max">;
 def FuncExtFloatAtomicsFp16LocalMinMax   : 
FunctionExtension<"cl_ext_float_atomics 
__opencl_c_ext_fp16_local_atomic_min_max">;
 def FuncExtFloatAtomicsFp32LocalMinMax   : 
FunctionExtension<"cl_ext_float_atomics 
__opencl_c_ext_fp32_local_atomic_min_max">;
-def FuncExtFloatAtomicsFp64LocalMinMax   : 
FunctionExtension<"cl_ext_float_atomics 
__opencl_c_ext_fp64_local_atomic_min_max">;
+def FuncExtFloatAtomicsFp64LocalMinMax   : 
FunctionExtension<"cl_ext_float_atomics cl_khr_int64_base_atomics 
cl_khr_int64_extended_atomics __opencl_c_ext_fp64_local_atomic_min_max">;
 def FuncExtFloatAtomicsFp16GenericMinMax : 
FunctionExtension<"cl_ext_float_atomics 
__opencl_c_ext_fp16_local_atomic_min_max 
__opencl_c_ext_fp16_global_atomic_min_max">;
 def FuncExtFloatAtomicsFp32GenericMinMax : 
FunctionExtension<"cl_ext_float_atomics 
__opencl_c_ext_fp32_local_atomic_min_max 
__opencl_c_ext_fp32_global_atomic_min_max">;
-def FuncExtFloatAtomicsFp64GenericMinMax : 
FunctionExtension<"cl_ext_float_atomics 
__opencl_c_ext_fp64_local_atomic_min_max 
__opencl_c_ext_fp64_global_atomic_min_max">;
+def FuncExtFloatAtomicsFp64GenericMinMax : 
Fu

[PATCH] D98110: [NFC][clangd] Use table to collect option aliases

2022-02-09 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen added inline comments.



Comment at: clang-tools-extra/clangd/CompileCommands.cpp:478
+   HELP, METAVAR, VALUES)  
\
+  {DriverID::OPT_##ID, DriverID::OPT_##ALIAS, (void *)ALIASARGS},
+#include "clang/Driver/Options.inc"

uabelho wrote:
> gcc warns about casting away "const" here.
> Would it break anything to simply change the type of AliasArgs in the 
> AliasTable to "const char *" and skip this void* cast?
> 
> gcc warns about casting away "const" here.
> Would it break anything to simply change the type of AliasArgs in the 
> AliasTable to "const char *" and skip this void* cast?
> 

Thanks for the report. Fixed in 4f30a5269696.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98110

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


[PATCH] D118437: [NFC] [Modules] Refactor ODR checking for default template argument in ASTReader

2022-02-09 Thread Chuanqi Xu 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 rG8c930cef0e4c: [NFC] [Modules] Refactor ODR checking for 
default template argument in (authored by ChuanqiXu).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118437

Files:
  clang/include/clang/Basic/DiagnosticSerializationKinds.td
  clang/lib/Serialization/ASTReader.cpp

Index: clang/lib/Serialization/ASTReader.cpp
===
--- clang/lib/Serialization/ASTReader.cpp
+++ clang/lib/Serialization/ASTReader.cpp
@@ -10134,13 +10134,6 @@
   assert(!FirstTemplate == !SecondTemplate &&
  "Both pointers should be null or non-null");
 
-  enum ODRTemplateDifference {
-ParamEmptyName,
-ParamName,
-ParamSingleDefaultArgument,
-ParamDifferentDefaultArgument,
-  };
-
   if (FirstTemplate && SecondTemplate) {
 DeclHashes FirstTemplateHashes;
 DeclHashes SecondTemplateHashes;
@@ -10166,155 +10159,60 @@
   if (FirstIt->second == SecondIt->second)
 continue;
 
-  auto ODRDiagTemplateError = [FirstRecord, &FirstModule, this](
-  SourceLocation Loc, SourceRange Range,
-  ODRTemplateDifference DiffType) {
-return Diag(Loc, diag::err_module_odr_violation_template_parameter)
-   << FirstRecord << FirstModule.empty() << FirstModule << Range
-   << DiffType;
-  };
-  auto ODRDiagTemplateNote = [&SecondModule, this](
- SourceLocation Loc, SourceRange Range,
- ODRTemplateDifference DiffType) {
-return Diag(Loc, diag::note_module_odr_violation_template_parameter)
-   << SecondModule << Range << DiffType;
-  };
-
   const NamedDecl* FirstDecl = cast(FirstIt->first);
   const NamedDecl* SecondDecl = cast(SecondIt->first);
 
   assert(FirstDecl->getKind() == SecondDecl->getKind() &&
  "Parameter Decl's should be the same kind.");
 
+  enum ODRTemplateDifference {
+ParamEmptyName,
+ParamName,
+ParamSingleDefaultArgument,
+ParamDifferentDefaultArgument,
+  };
+
+  auto hasDefaultArg = [](const NamedDecl *D) {
+if (auto *TTP = dyn_cast(D))
+  return TTP->hasDefaultArgument() &&
+  !TTP->defaultArgumentWasInherited();
+if (auto *NTTP = dyn_cast(D))
+  return NTTP->hasDefaultArgument() &&
+  !NTTP->defaultArgumentWasInherited();
+auto *TTP = cast(D);
+return TTP->hasDefaultArgument() &&
+!TTP->defaultArgumentWasInherited();
+  };
+  bool hasFirstArg = hasDefaultArg(FirstDecl);
+  bool hasSecondArg = hasDefaultArg(SecondDecl);
+
+  ODRTemplateDifference ErrDiffType;
+  ODRTemplateDifference NoteDiffType;
+
   DeclarationName FirstName = FirstDecl->getDeclName();
   DeclarationName SecondName = SecondDecl->getDeclName();
 
   if (FirstName != SecondName) {
-const bool FirstNameEmpty =
+bool FirstNameEmpty =
 FirstName.isIdentifier() && !FirstName.getAsIdentifierInfo();
-const bool SecondNameEmpty =
-SecondName.isIdentifier() && !SecondName.getAsIdentifierInfo();
-assert((!FirstNameEmpty || !SecondNameEmpty) &&
-   "Both template parameters cannot be unnamed.");
-ODRDiagTemplateError(FirstDecl->getLocation(),
- FirstDecl->getSourceRange(),
- FirstNameEmpty ? ParamEmptyName : ParamName)
-<< FirstName;
-ODRDiagTemplateNote(SecondDecl->getLocation(),
-SecondDecl->getSourceRange(),
-SecondNameEmpty ? ParamEmptyName : ParamName)
-<< SecondName;
-break;
-  }
-
-  switch (FirstDecl->getKind()) {
-  default:
-llvm_unreachable("Invalid template parameter type.");
-  case Decl::TemplateTypeParm: {
-const auto *FirstParam = cast(FirstDecl);
-const auto *SecondParam = cast(SecondDecl);
-const bool HasFirstDefaultArgument =
-FirstParam->hasDefaultArgument() &&
-!FirstParam->defaultArgumentWasInherited();
-const bool HasSecondDefaultArgument =
-SecondParam->hasDefaultArgument() &&
-!SecondParam->defaultArgumentWasInherited();
-
-if (HasFirstDefaultArgument != Has

[clang] 8c930ce - [NFC] [Modules] Refactor ODR checking for default template argument in

2022-02-09 Thread Chuanqi Xu via cfe-commits

Author: Chuanqi Xu
Date: 2022-02-10T10:10:10+08:00
New Revision: 8c930cef0e4c6d76fdb483051187c59d5aea6db7

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

LOG: [NFC] [Modules] Refactor ODR checking for default template argument in
ASTReader

This is a cleanup to reduce the lines of code to handle default template
argument in ASTReader.

Reviewed By: urnathan

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

Added: 


Modified: 
clang/include/clang/Basic/DiagnosticSerializationKinds.td
clang/lib/Serialization/ASTReader.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticSerializationKinds.td 
b/clang/include/clang/Basic/DiagnosticSerializationKinds.td
index f15a935d2af1b..3fcdb616bd21a 100644
--- a/clang/include/clang/Basic/DiagnosticSerializationKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSerializationKinds.td
@@ -154,16 +154,15 @@ def err_module_odr_violation_template_parameter : Error <
   "%select{definition in module '%2'|defined here}1 found "
   "%select{"
   "unnamed template parameter|"
-  "template parameter %4|"
+  "template parameter %5|"
   "template parameter with %select{no |}4default argument|"
   "template parameter with default argument}3">;
 
-
 def note_module_odr_violation_template_parameter : Note <
   "but in '%0' found "
   "%select{"
   "unnamed template parameter %2|"
-  "template parameter %2|"
+  "template parameter %3|"
   "template parameter with %select{no |}2default argument|"
   "template parameter with 
diff erent default argument}1">;
 

diff  --git a/clang/lib/Serialization/ASTReader.cpp 
b/clang/lib/Serialization/ASTReader.cpp
index d806fb9e19494..0ea904b275f25 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -10134,13 +10134,6 @@ void ASTReader::diagnoseOdrViolations() {
   assert(!FirstTemplate == !SecondTemplate &&
  "Both pointers should be null or non-null");
 
-  enum ODRTemplateDifference {
-ParamEmptyName,
-ParamName,
-ParamSingleDefaultArgument,
-ParamDifferentDefaultArgument,
-  };
-
   if (FirstTemplate && SecondTemplate) {
 DeclHashes FirstTemplateHashes;
 DeclHashes SecondTemplateHashes;
@@ -10166,155 +10159,60 @@ void ASTReader::diagnoseOdrViolations() {
   if (FirstIt->second == SecondIt->second)
 continue;
 
-  auto ODRDiagTemplateError = [FirstRecord, &FirstModule, this](
-  SourceLocation Loc, SourceRange 
Range,
-  ODRTemplateDifference DiffType) {
-return Diag(Loc, diag::err_module_odr_violation_template_parameter)
-   << FirstRecord << FirstModule.empty() << FirstModule << 
Range
-   << DiffType;
-  };
-  auto ODRDiagTemplateNote = [&SecondModule, this](
- SourceLocation Loc, SourceRange Range,
- ODRTemplateDifference DiffType) {
-return Diag(Loc, 
diag::note_module_odr_violation_template_parameter)
-   << SecondModule << Range << DiffType;
-  };
-
   const NamedDecl* FirstDecl = cast(FirstIt->first);
   const NamedDecl* SecondDecl = cast(SecondIt->first);
 
   assert(FirstDecl->getKind() == SecondDecl->getKind() &&
  "Parameter Decl's should be the same kind.");
 
+  enum ODRTemplateDifference {
+ParamEmptyName,
+ParamName,
+ParamSingleDefaultArgument,
+ParamDifferentDefaultArgument,
+  };
+
+  auto hasDefaultArg = [](const NamedDecl *D) {
+if (auto *TTP = dyn_cast(D))
+  return TTP->hasDefaultArgument() &&
+  !TTP->defaultArgumentWasInherited();
+if (auto *NTTP = dyn_cast(D))
+  return NTTP->hasDefaultArgument() &&
+  !NTTP->defaultArgumentWasInherited();
+auto *TTP = cast(D);
+return TTP->hasDefaultArgument() &&
+!TTP->defaultArgumentWasInherited();
+  };
+  bool hasFirstArg = hasDefaultArg(FirstDecl);
+  bool hasSecondArg = hasDefaultArg(SecondDecl);
+
+  ODRTemplateDifference ErrDiffType;
+  ODRTemplateDifference NoteDiffType;
+
   DeclarationName FirstName = FirstDecl->getDeclName();
   DeclarationName SecondName = SecondDecl->getDeclName();
 
   if (FirstName != SecondName) {
-const bool FirstNameEmpty =
+bool FirstNameEmpty =
 FirstName.isIdentifier() && !FirstName.getAsIdentifierInfo();
-const bool SecondNameEmpty =
- 

[clang-tools-extra] 4f30a52 - NFC: fix GCC warning -Wcast-qual

2022-02-09 Thread Yuanfang Chen via cfe-commits

Author: Yuanfang Chen
Date: 2022-02-09T18:03:25-08:00
New Revision: 4f30a5269696ff03fd600e756e934a44d4c71b46

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

LOG: NFC: fix GCC warning -Wcast-qual

Added: 


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

Removed: 




diff  --git a/clang-tools-extra/clangd/CompileCommands.cpp 
b/clang-tools-extra/clangd/CompileCommands.cpp
index df5f84c894e7b..f3103b21530c6 100644
--- a/clang-tools-extra/clangd/CompileCommands.cpp
+++ b/clang-tools-extra/clangd/CompileCommands.cpp
@@ -471,11 +471,11 @@ llvm::ArrayRef 
ArgStripper::rulesFor(llvm::StringRef Arg) {
 struct {
   DriverID ID;
   DriverID AliasID;
-  void *AliasArgs;
+  const void *AliasArgs;
 } AliasTable[] = {
 #define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM,  
\
HELP, METAVAR, VALUES)  
\
-  {DriverID::OPT_##ID, DriverID::OPT_##ALIAS, (void *)ALIASARGS},
+  {DriverID::OPT_##ID, DriverID::OPT_##ALIAS, ALIASARGS},
 #include "clang/Driver/Options.inc"
 #undef OPTION
 };



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


[PATCH] D119351: Update all LLVM documentation mentioning runtimes in LLVM_ENABLE_PROJECTS

2022-02-09 Thread Shilei Tian via Phabricator via cfe-commits
tianshilei1992 added inline comments.



Comment at: README.md:71
+  mlir, openmp, polly, or pstl. ``LLVM_ENABLE_RUNTIMES`` can include 
any of
+  libcxx, libcxxabi, libunwind, or compiler-rt.
 

FWIW, OpenMP can be put into either of them. In OpenMP doc 
(https://openmp.llvm.org/SupportAndFAQ.html#q-how-to-build-an-openmp-gpu-offload-capable-compiler),
 we recommend to use `LLVM_ENABLE_RUNTIMES` to build OpenMP if users would like 
to use offloading features.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119351

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


[PATCH] D119392: [Clang][OpenMP][Sema] Remove support for floating point values in atomic compare

2022-02-09 Thread Shilei Tian via Phabricator via cfe-commits
tianshilei1992 created this revision.
tianshilei1992 added reviewers: jdoerfert, ABataev.
Herald added subscribers: guansong, yaxunl.
tianshilei1992 requested review of this revision.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

This is a follow-up patch of D119378 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119392

Files:
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/OpenMP/atomic_messages.c

Index: clang/test/OpenMP/atomic_messages.c
===
--- clang/test/OpenMP/atomic_messages.c
+++ clang/test/OpenMP/atomic_messages.c
@@ -473,15 +473,5 @@
   x = e;
 d = e;
   }
-  float fx = 0.0f;
-  float fd = 0.0f;
-  float fe = 0.0f;
-// omp51-error@+5 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}}
-// omp51-note@+4 {{expect integer value}}
-#pragma omp atomic compare
-  {
-if (fx > fe)
-  fx = fe;
-  }
 }
 #endif
Index: clang/lib/Sema/SemaOpenMP.cpp
===
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -11007,8 +11007,6 @@
   Expr *C = nullptr;
   /// True if the cond expr is in the form of 'x ordop expr'.
   bool IsXBinopExpr = true;
-  /// The atomic compare operator.
-  OMPAtomicCompareOp Op;
 
   /// Check if it is a valid conditional update statement (cond-update-stmt).
   bool checkCondUpdateStmt(IfStmt *S, ErrorInfoTy &ErrorInfo);
@@ -11065,23 +11063,7 @@
   }
 
   switch (Cond->getOpcode()) {
-  case BO_EQ:
-Op = OMPAtomicCompareOp::EQ;
-break;
-  case BO_LT:
-Op = OMPAtomicCompareOp::MIN;
-break;
-  case BO_GT:
-Op = OMPAtomicCompareOp::MAX;
-break;
-  default:
-ErrorInfo.Error = ErrorTy::InvalidBinaryOp;
-ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = Cond->getExprLoc();
-ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Cond->getSourceRange();
-return false;
-  }
-
-  if (Cond->getOpcode() == BO_EQ) {
+  case BO_EQ: {
 C = Cond;
 D = BO->getRHS();
 if (checkIfTwoExprsAreSame(ContextRef, X, Cond->getLHS())) {
@@ -11094,7 +11076,10 @@
   ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Cond->getSourceRange();
   return false;
 }
-  } else {
+break;
+  }
+  case BO_LT:
+  case BO_GT: {
 E = BO->getRHS();
 if (checkIfTwoExprsAreSame(ContextRef, X, Cond->getLHS()) &&
 checkIfTwoExprsAreSame(ContextRef, E, Cond->getRHS())) {
@@ -11109,6 +11094,13 @@
   ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Cond->getSourceRange();
   return false;
 }
+break;
+  }
+  default:
+ErrorInfo.Error = ErrorTy::InvalidBinaryOp;
+ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = Cond->getExprLoc();
+ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Cond->getSourceRange();
+return false;
   }
 
   return true;
@@ -11159,23 +11151,7 @@
   }
 
   switch (Cond->getOpcode()) {
-  case BO_EQ:
-Op = OMPAtomicCompareOp::EQ;
-break;
-  case BO_LT:
-Op = OMPAtomicCompareOp::MIN;
-break;
-  case BO_GT:
-Op = OMPAtomicCompareOp::MAX;
-break;
-  default:
-ErrorInfo.Error = ErrorTy::InvalidBinaryOp;
-ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = Cond->getExprLoc();
-ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Cond->getSourceRange();
-return false;
-  }
-
-  if (Cond->getOpcode() == BO_EQ) {
+  case BO_EQ: {
 C = Cond;
 D = CO->getTrueExpr();
 if (checkIfTwoExprsAreSame(ContextRef, X, Cond->getLHS())) {
@@ -11188,7 +11164,10 @@
   ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Cond->getSourceRange();
   return false;
 }
-  } else {
+break;
+  }
+  case BO_LT:
+  case BO_GT: {
 E = CO->getTrueExpr();
 if (checkIfTwoExprsAreSame(ContextRef, X, Cond->getLHS()) &&
 checkIfTwoExprsAreSame(ContextRef, E, Cond->getRHS())) {
@@ -11203,6 +11182,13 @@
   ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Cond->getSourceRange();
   return false;
 }
+break;
+  }
+  default:
+ErrorInfo.Error = ErrorTy::InvalidBinaryOp;
+ErrorInfo.ErrorLoc = ErrorInfo.NoteLoc = Cond->getExprLoc();
+ErrorInfo.ErrorRange = ErrorInfo.NoteRange = Cond->getSourceRange();
+return false;
   }
 
   return true;
@@ -11212,8 +11198,7 @@
   // 'x' and 'e' cannot be nullptr
   assert(X && E && "X and E cannot be nullptr");
 
-  auto CheckValue = [&ErrorInfo](const Expr *E, OMPAtomicCompareOp Op,
- bool ShouldBeLValue) {
+  auto CheckValue = [&ErrorInfo](const Expr *E, bool ShouldBeLValue) {
 if (ShouldBeLValue && !E->isLVal

[PATCH] D119351: Update all LLVM documentation mentioning runtimes in LLVM_ENABLE_PROJECTS

2022-02-09 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay accepted this revision.
MaskRay added a comment.

Thanks  for improving the documentation. I occasionally see folks (and two 
today!) puzzled by LLVM_ENABLE_RUNTIMES and this patch should help them.

Personally I use the `-S -B` style (actually `-H`, but now I see that `-S` is 
documented I will switch).
I sometimes twiddle with a cmake file and spawn multiple builds.
Not changing the work directory makes my commands simpler, but I do see 
@Quuxplusone's point about `-DCMAKE_INSTALL_PREFIX=$(pwd)/install`.

I rarely use `CMAKE_INSTALL_PREFIX`. When I need it, I accept the slight 
inconvenience of duplicating the build directory twice for `-B` and 
`-DCMAKE_INSTALL_PREFIX`.

I have read the updated and they look good to me, but happy if we switch to 
@Quuxplusone's style.
I passes the link to some folks and hope that fresh eyes with less 
LLVM_ENABLE_RUNTIMES experience can make suggestions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119351

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


[PATCH] D119301: [AArch64][ARM] add -Wunaligned-access only for clang

2022-02-09 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen updated this revision to Diff 407336.
ychen added a comment.

- Handle ARM
- Add driver tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119301

Files:
  clang/lib/Driver/ToolChains/Arch/AArch64.cpp
  clang/lib/Driver/ToolChains/Arch/AArch64.h
  clang/lib/Driver/ToolChains/Arch/ARM.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/arm-alignment.c

Index: clang/test/Driver/arm-alignment.c
===
--- clang/test/Driver/arm-alignment.c
+++ clang/test/Driver/arm-alignment.c
@@ -86,8 +86,8 @@
 // RUN: %clang -target aarch64-unknown-openbsd -### %s 2> %t
 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
 
-// CHECK-ALIGNED-ARM: "-target-feature" "+strict-align"
-// CHECK-ALIGNED-AARCH64: "-target-feature" "+strict-align"
+// CHECK-ALIGNED-ARM: "-target-feature" "+strict-align" {{.*}} "-Wunaligned-access"
+// CHECK-ALIGNED-AARCH64: "-target-feature" "+strict-align" {{.*}} "-Wunaligned-access"
 
 // Make sure that v6M cores and v8M Baseline always trigger the unsupported
 // aligned accesses error for all supported architecture triples.
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -347,8 +347,7 @@
   case llvm::Triple::aarch64:
   case llvm::Triple::aarch64_32:
   case llvm::Triple::aarch64_be:
-aarch64::getAArch64TargetFeatures(D, Triple, Args, CmdArgs, Features,
-  ForAS);
+aarch64::getAArch64TargetFeatures(D, Triple, Args, Features, ForAS);
 break;
   case llvm::Triple::x86:
   case llvm::Triple::x86_64:
@@ -1625,6 +1624,16 @@
   CmdArgs.push_back("-target-abi");
   CmdArgs.push_back(ABIName);
 }
+
+void AddUnalignedAccessWarning(ArgStringList &CmdArgs) {
+  auto StrictAlignIter =
+  std::find_if(CmdArgs.rbegin(), CmdArgs.rend(), [](StringRef Arg) {
+return Arg == "+strict-align" || Arg == "-strict-align";
+  });
+  if (StrictAlignIter != CmdArgs.rend() &&
+  StringRef(*StrictAlignIter) == "+strict-align")
+CmdArgs.push_back("-Wunaligned-access");
+}
 }
 
 static void CollectARMPACBTIOptions(const ToolChain &TC, const ArgList &Args,
@@ -1720,6 +1729,8 @@
 
   // Enable/disable return address signing and indirect branch targets.
   CollectARMPACBTIOptions(getToolChain(), Args, CmdArgs, false /*isAArch64*/);
+
+  AddUnalignedAccessWarning(CmdArgs);
 }
 
 void Clang::RenderTargetOptions(const llvm::Triple &EffectiveTriple,
@@ -1893,6 +1904,8 @@
   CmdArgs.push_back(Args.MakeArgString(TuneCPU));
 }
   }
+
+  AddUnalignedAccessWarning(CmdArgs);
 }
 
 void Clang::AddMIPSTargetArgs(const ArgList &Args,
Index: clang/lib/Driver/ToolChains/Arch/ARM.cpp
===
--- clang/lib/Driver/ToolChains/Arch/ARM.cpp
+++ clang/lib/Driver/ToolChains/Arch/ARM.cpp
@@ -772,8 +772,6 @@
   // Kernel code has more strict alignment requirements.
   if (KernelOrKext) {
 Features.push_back("+strict-align");
-if (!ForAS)
-  CmdArgs.push_back("-Wunaligned-access");
   } else if (Arg *A = Args.getLastArg(options::OPT_mno_unaligned_access,
   options::OPT_munaligned_access)) {
 if (A->getOption().matches(options::OPT_munaligned_access)) {
@@ -784,11 +782,8 @@
   // access either.
   else if (Triple.getSubArch() == llvm::Triple::SubArchType::ARMSubArch_v8m_baseline)
 D.Diag(diag::err_target_unsupported_unaligned) << "v8m.base";
-} else {
+} else
   Features.push_back("+strict-align");
-  if (!ForAS)
-CmdArgs.push_back("-Wunaligned-access");
-}
   } else {
 // Assume pre-ARMv6 doesn't support unaligned accesses.
 //
@@ -807,23 +802,14 @@
 int VersionNum = getARMSubArchVersionNumber(Triple);
 if (Triple.isOSDarwin() || Triple.isOSNetBSD()) {
   if (VersionNum < 6 ||
-  Triple.getSubArch() == llvm::Triple::SubArchType::ARMSubArch_v6m) {
+  Triple.getSubArch() == llvm::Triple::SubArchType::ARMSubArch_v6m)
 Features.push_back("+strict-align");
-if (!ForAS)
-  CmdArgs.push_back("-Wunaligned-access");
-  }
 } else if (Triple.isOSLinux() || Triple.isOSNaCl() ||
Triple.isOSWindows()) {
-  if (VersionNum < 7) {
+  if (VersionNum < 7)
 Features.push_back("+strict-align");
-if (!ForAS)
-  CmdArgs.push_back("-Wunaligned-access");
-  }
-} else {
+} else
   Features.push_back("+strict-align");
-  if (!ForAS)
-CmdArgs.push_back("-Wunaligned-access");
-}
   }
 
   // llvm does not support reserving registers in general. There is support
Index: clang/lib/Driver/ToolChains/Arch/AArch64.h
===
--

[PATCH] D117809: [clang] Add an extract-api driver option

2022-02-09 Thread Zixu Wang via Phabricator via cfe-commits
zixuw added a comment.

In D117809#3306785 , @MaskRay wrote:

> Thanks for working on such tools but the patch order is not right.
> You should implement the functionality first, and in the last, add the driver 
> option.
> The driver option is user-facing and the availability makes users think the 
> functionality is ready when it actually isn't.

I see. I was working on the functionality at the same time with this driver 
option, but it took longer and more complicated than I expected so I decided to 
post this as an initial patch to keep things small and incremental. I do have 
another patch ready to post very shortly.

> I am also a bit unsure whether the option name should use the single-dash 
> `-e*` since `-e` is a short option taking a value, so a typo in 
> `-extract-api` cannot be detected.
> By convention a two-dash option should be used.
> (Yes, I know `-emit-llvm` is a violation.)

That's an interesting find, I'll look into it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117809

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


[PATCH] D119383: [clang][CMake] Add a warning about the Standalone build being deprecated

2022-02-09 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added inline comments.



Comment at: clang/CMakeLists.txt:16
 if(CLANG_BUILT_STANDALONE)
   set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
   set(CMAKE_CXX_STANDARD_REQUIRED YES)

For the main branch, we can delete this block.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119383

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


[PATCH] D119383: [clang][CMake] Add a warning about the Standalone build being deprecated

2022-02-09 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay created this revision.
MaskRay added reviewers: aaron.ballman, mstorsjo, rjmccall, rsmith.
Herald added a subscriber: mgorny.
MaskRay requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

For me, `cmake -Hclang -B/path/to/build` currently fails with

  CMake Error at CMakeLists.txt:122 (include):
include could not find requested file:
  
  GetErrcMessages
  
  -- Found Python3: /usr/bin/python3.9 (found version "3.9.9") found 
components: Interpreter
  CMake Error at /home/maskray/llvm/llvm/utils/llvm-lit/CMakeLists.txt:13 
(make_paths_relative):
Unknown CMake command "make_paths_relative".

Keeping the Standalone build working is now quite a bit of hassle and to
the best of my knowledge not any active contributor typically does. Let's
follow libc++/libc++abi/libunwind (D119341 ), 
deprecate and remove the build
mode. We will be able to remove much code related to `CLANG_BUILT_STANDALONE`.

To keep the disruption minimum, use `message(WARNING ...` for release/14.x and
`message(FATAL_ERROR ...` for main.

Similar to D119380  for lld.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119383

Files:
  clang/CMakeLists.txt


Index: clang/CMakeLists.txt
===
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -5,6 +5,8 @@
 if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
   project(Clang)
   set(CLANG_BUILT_STANDALONE TRUE)
+  message(WARNING "The Standalone build is deprecated in this release. Please
+use -DLLVM_ENABLE_PROJECTS='...;clang;...' to build clang.")
 endif()
 
 # Must go below project(..)


Index: clang/CMakeLists.txt
===
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -5,6 +5,8 @@
 if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
   project(Clang)
   set(CLANG_BUILT_STANDALONE TRUE)
+  message(WARNING "The Standalone build is deprecated in this release. Please
+use -DLLVM_ENABLE_PROJECTS='...;clang;...' to build clang.")
 endif()
 
 # Must go below project(..)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D118948: [MTE] Add -fsanitize=memtag* and friends.

2022-02-09 Thread Mitch Phillips via Phabricator via cfe-commits
hctim planned changes to this revision.
hctim marked 8 inline comments as done.
hctim added a comment.

Pushed the [1/3] ELF note parsing over to D119381 
. Will leave this review for the clang-side 
changes, and send a new patch for the LLD changes. All of your comments are 
completed in my internal branch, and I'll upload that after the lld changes are 
landed.




Comment at: clang/include/clang/Basic/DiagnosticDriverKinds.td:475
 def err_stack_tagging_requires_hardware_feature : Error<
-  "'-fsanitize=memtag' requires hardware support (+memtag)">;
+  "'-fsanitize=memtag-stack' requires hardware support (+memtag). For Armv8, "
+  "try compiling with -march=armv8a+memtag.">;

eugenis wrote:
> Split out renaming of memtag to memtag-stack first? This will remove a lot of 
> diff from this patch.
splitting into elf -> lld -> clang as per Ray's suggestion, should reduce the 
diff enough.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118948

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


[PATCH] D119301: [AArch64][ARM] add -Wunaligned-access only for clang

2022-02-09 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen updated this revision to Diff 407314.
ychen added a comment.

- update


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119301

Files:
  clang/lib/Driver/ToolChains/Arch/AArch64.cpp
  clang/lib/Driver/ToolChains/Arch/AArch64.h
  clang/lib/Driver/ToolChains/Arch/ARM.cpp
  clang/lib/Driver/ToolChains/Clang.cpp

Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -347,8 +347,7 @@
   case llvm::Triple::aarch64:
   case llvm::Triple::aarch64_32:
   case llvm::Triple::aarch64_be:
-aarch64::getAArch64TargetFeatures(D, Triple, Args, CmdArgs, Features,
-  ForAS);
+aarch64::getAArch64TargetFeatures(D, Triple, Args, Features, ForAS);
 break;
   case llvm::Triple::x86:
   case llvm::Triple::x86_64:
@@ -1893,6 +1892,14 @@
   CmdArgs.push_back(Args.MakeArgString(TuneCPU));
 }
   }
+
+  auto StrictAlignIter =
+  std::find_if(CmdArgs.rbegin(), CmdArgs.rend(), [](StringRef Arg) {
+return Arg == "+strict-align" || Arg == "-strict-align";
+  });
+  if (StrictAlignIter != CmdArgs.rend() &&
+  StringRef(*StrictAlignIter) == "+strict-align")
+CmdArgs.push_back("-Wunaligned-access");
 }
 
 void Clang::AddMIPSTargetArgs(const ArgList &Args,
Index: clang/lib/Driver/ToolChains/Arch/ARM.cpp
===
--- clang/lib/Driver/ToolChains/Arch/ARM.cpp
+++ clang/lib/Driver/ToolChains/Arch/ARM.cpp
@@ -772,8 +772,6 @@
   // Kernel code has more strict alignment requirements.
   if (KernelOrKext) {
 Features.push_back("+strict-align");
-if (!ForAS)
-  CmdArgs.push_back("-Wunaligned-access");
   } else if (Arg *A = Args.getLastArg(options::OPT_mno_unaligned_access,
   options::OPT_munaligned_access)) {
 if (A->getOption().matches(options::OPT_munaligned_access)) {
@@ -784,11 +782,8 @@
   // access either.
   else if (Triple.getSubArch() == llvm::Triple::SubArchType::ARMSubArch_v8m_baseline)
 D.Diag(diag::err_target_unsupported_unaligned) << "v8m.base";
-} else {
+} else
   Features.push_back("+strict-align");
-  if (!ForAS)
-CmdArgs.push_back("-Wunaligned-access");
-}
   } else {
 // Assume pre-ARMv6 doesn't support unaligned accesses.
 //
@@ -807,23 +802,14 @@
 int VersionNum = getARMSubArchVersionNumber(Triple);
 if (Triple.isOSDarwin() || Triple.isOSNetBSD()) {
   if (VersionNum < 6 ||
-  Triple.getSubArch() == llvm::Triple::SubArchType::ARMSubArch_v6m) {
+  Triple.getSubArch() == llvm::Triple::SubArchType::ARMSubArch_v6m)
 Features.push_back("+strict-align");
-if (!ForAS)
-  CmdArgs.push_back("-Wunaligned-access");
-  }
 } else if (Triple.isOSLinux() || Triple.isOSNaCl() ||
Triple.isOSWindows()) {
-  if (VersionNum < 7) {
+  if (VersionNum < 7)
 Features.push_back("+strict-align");
-if (!ForAS)
-  CmdArgs.push_back("-Wunaligned-access");
-  }
-} else {
+} else
   Features.push_back("+strict-align");
-  if (!ForAS)
-CmdArgs.push_back("-Wunaligned-access");
-}
   }
 
   // llvm does not support reserving registers in general. There is support
Index: clang/lib/Driver/ToolChains/Arch/AArch64.h
===
--- clang/lib/Driver/ToolChains/Arch/AArch64.h
+++ clang/lib/Driver/ToolChains/Arch/AArch64.h
@@ -22,7 +22,6 @@
 
 void getAArch64TargetFeatures(const Driver &D, const llvm::Triple &Triple,
   const llvm::opt::ArgList &Args,
-  llvm::opt::ArgStringList &CmdArgs,
   std::vector &Features,
   bool ForAS);
 
Index: clang/lib/Driver/ToolChains/Arch/AArch64.cpp
===
--- clang/lib/Driver/ToolChains/Arch/AArch64.cpp
+++ clang/lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -222,7 +222,6 @@
 void aarch64::getAArch64TargetFeatures(const Driver &D,
const llvm::Triple &Triple,
const ArgList &Args,
-   llvm::opt::ArgStringList &CmdArgs,
std::vector &Features,
bool ForAS) {
   Arg *A;
@@ -466,16 +465,10 @@
 
   if (Arg *A = Args.getLastArg(options::OPT_mno_unaligned_access,
options::OPT_munaligned_access)) {
-if (A->getOption().matches(options::OPT_mno_unaligned_access)) {
+if (A->getOption().matches(options::OPT_mno_unaligned_access))
   Features.push_back("+strict-align");
-  if (!ForA

[PATCH] D119301: [AArch64][ARM] add -Wunaligned-access only for clang

2022-02-09 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen added a comment.

In D119301#3309253 , @ychen wrote:

> In D119301#3309140 , @lenary wrote:
>
>> I don't fully understand the reasoning for the patch, and you haven't really 
>> explained it. I think what you are saying is that the `IsAux` argument to 
>> `getTargetFeatures` should be considered because it's `true` for offloading 
>> to another compiler, but I don't understand why we think the offload 
>> compiler is not clang-compatible, as the features added in 
>> `getAArch64TargetFeatures` and `getARMTargetFeatures` (and passed to the 
>> offloaded compiler) use the LLVM-specific internal names. I would like you 
>> to explain this further, and to document what `IsAux` implies in the code.
>
> Apologies for the lack of explanation. My point is that 
> `getAArch64TargetFeatures` / `getARMTargetFeatures` should only get the 
> TargetFeatures, not adding compiler flags as a side effect, which belongs to 
> clang's job construction. This makes code reuse harder.
>
>> That all said code given here is not equivalent to the feature as originally 
>> landed, because you've only re-added the `-Wunaligned-access` flag for the 
>> AArch64 target - please make the same addition in `Clang::AddARMTargetArgs` 
>> as we want the warning on both. I think this also makes `CmdArgs` unused in 
>> both `aarch64::getAArch64TargetFeatures` and `arm::getARMTargetFeatures` as 
>> I think that you don't actually want us adding to `CmdArgs` in those 
>> functions (again, I hope the full reasoning behind this will be explained 
>> when you explain why the whole patch is necessary).
>
> Will do the same thing for `Clang::AddARMTargetArgs`. Thanks. I've tested 
> this patch but not sure why the original test still passing without a 
> `Clang::AddARMTargetArgs` change.

NVM. I see why: there were no driver tests. I'll add those.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119301

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


[PATCH] D119301: [AArch64][ARM] add -Wunaligned-access only for clang

2022-02-09 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen updated this revision to Diff 407313.
ychen added a comment.

- update


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119301

Files:
  clang/test/Sema/test-wunaligned-access.c
  clang/test/Sema/test-wunaligned-access.cpp


Index: clang/test/Sema/test-wunaligned-access.cpp
===
--- clang/test/Sema/test-wunaligned-access.cpp
+++ clang/test/Sema/test-wunaligned-access.cpp
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 %s -triple=armv7-none-none-eabi -verify -Wunaligned-access 
-S -emit-llvm -o %t
-// RUN: %clang_cc1 %s -triple=armv8-none-none-eabi -verify -Wunaligned-access 
-S -emit-llvm -o %t
+// RUN: %clang_cc1 %s -triple=arm64-none-linux-gnu -verify -Wunaligned-access 
-S -emit-llvm -o %t
 // REQUIRES: arm-registered-target
 //
 // This test suite tests the warning triggered by the -Wunaligned-access 
option.
Index: clang/test/Sema/test-wunaligned-access.c
===
--- clang/test/Sema/test-wunaligned-access.c
+++ clang/test/Sema/test-wunaligned-access.c
@@ -2,7 +2,7 @@
 // RUN: rm -f %S/test-wunaligned-access.ll
 
 // RUN: %clang_cc1 %s -triple=armv7-none-none-eabi -verify -Wunaligned-access 
-S -emit-llvm -o %t
-// RUN: %clang_cc1 %s -triple=armv8-none-none-eabi -verify -Wunaligned-access 
-S -emit-llvm -o %t
+// RUN: %clang_cc1 %s -triple=arm64-none-linux-gnu -verify -Wunaligned-access 
-S -emit-llvm -o %t
 // REQUIRES: arm-registered-target
 //
 // This test suite tests the warning triggered by the -Wunaligned-access 
option.


Index: clang/test/Sema/test-wunaligned-access.cpp
===
--- clang/test/Sema/test-wunaligned-access.cpp
+++ clang/test/Sema/test-wunaligned-access.cpp
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 %s -triple=armv7-none-none-eabi -verify -Wunaligned-access -S -emit-llvm -o %t
-// RUN: %clang_cc1 %s -triple=armv8-none-none-eabi -verify -Wunaligned-access -S -emit-llvm -o %t
+// RUN: %clang_cc1 %s -triple=arm64-none-linux-gnu -verify -Wunaligned-access -S -emit-llvm -o %t
 // REQUIRES: arm-registered-target
 //
 // This test suite tests the warning triggered by the -Wunaligned-access option.
Index: clang/test/Sema/test-wunaligned-access.c
===
--- clang/test/Sema/test-wunaligned-access.c
+++ clang/test/Sema/test-wunaligned-access.c
@@ -2,7 +2,7 @@
 // RUN: rm -f %S/test-wunaligned-access.ll
 
 // RUN: %clang_cc1 %s -triple=armv7-none-none-eabi -verify -Wunaligned-access -S -emit-llvm -o %t
-// RUN: %clang_cc1 %s -triple=armv8-none-none-eabi -verify -Wunaligned-access -S -emit-llvm -o %t
+// RUN: %clang_cc1 %s -triple=arm64-none-linux-gnu -verify -Wunaligned-access -S -emit-llvm -o %t
 // REQUIRES: arm-registered-target
 //
 // This test suite tests the warning triggered by the -Wunaligned-access option.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D116261: [Clang][OpenMP] Add support for compare capture in parser

2022-02-09 Thread Shilei Tian via Phabricator via cfe-commits
tianshilei1992 updated this revision to Diff 407312.
tianshilei1992 added a comment.

cleanup


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116261

Files:
  clang/include/clang/AST/OpenMPClause.h
  clang/include/clang/AST/RecursiveASTVisitor.h
  clang/lib/AST/OpenMPClause.cpp
  clang/lib/AST/StmtProfile.cpp
  clang/lib/Basic/OpenMPKinds.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/Parse/ParseOpenMP.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/test/OpenMP/atomic_messages.cpp
  clang/tools/libclang/CIndex.cpp
  llvm/include/llvm/Frontend/OpenMP/OMP.td

Index: llvm/include/llvm/Frontend/OpenMP/OMP.td
===
--- llvm/include/llvm/Frontend/OpenMP/OMP.td
+++ llvm/include/llvm/Frontend/OpenMP/OMP.td
@@ -181,6 +181,10 @@
 def OMPC_Update : Clause<"update"> { let clangClass = "OMPUpdateClause"; }
 def OMPC_Capture : Clause<"capture"> { let clangClass = "OMPCaptureClause"; }
 def OMPC_Compare : Clause<"compare"> { let clangClass = "OMPCompareClause"; }
+// A dummy clause if compare and capture clauses are present.
+def OMPC_CompareCapture : Clause<"compare_capture"> {
+  let clangClass = "OMPCompareCaptureClause";
+}
 def OMPC_SeqCst : Clause<"seq_cst"> { let clangClass = "OMPSeqCstClause"; }
 def OMPC_AcqRel : Clause<"acq_rel"> { let clangClass = "OMPAcqRelClause"; }
 def OMPC_Acquire : Clause<"acquire"> { let clangClass = "OMPAcquireClause"; }
Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -2277,6 +2277,11 @@
 
 void OMPClauseEnqueue::VisitOMPCompareClause(const OMPCompareClause *) {}
 
+void OMPClauseEnqueue::VisitOMPCompareCaptureClause(
+const OMPCompareCaptureClause *) {
+  llvm_unreachable("OMPCompareCaptureClause should never be reached");
+}
+
 void OMPClauseEnqueue::VisitOMPSeqCstClause(const OMPSeqCstClause *) {}
 
 void OMPClauseEnqueue::VisitOMPAcqRelClause(const OMPAcqRelClause *) {}
Index: clang/test/OpenMP/atomic_messages.cpp
===
--- clang/test/OpenMP/atomic_messages.cpp
+++ clang/test/OpenMP/atomic_messages.cpp
@@ -958,3 +958,16 @@
   // expected-note@+1 {{in instantiation of function template specialization 'mixed' requested here}}
   return mixed();
 }
+
+#ifdef OMP51
+int compare_capture() {
+  int a, b, c, x;
+// omp51-error@+1 {{atomic compare capture is not supported for now}}
+#pragma omp atomic compare capture
+  {
+x = a;
+if (a == b)
+  a = c;
+  }
+}
+#endif
Index: clang/lib/Serialization/ASTWriter.cpp
===
--- clang/lib/Serialization/ASTWriter.cpp
+++ clang/lib/Serialization/ASTWriter.cpp
@@ -6295,6 +6295,10 @@
 
 void OMPClauseWriter::VisitOMPCompareClause(OMPCompareClause *) {}
 
+void OMPClauseWriter::VisitOMPCompareCaptureClause(OMPCompareCaptureClause *) {
+  llvm_unreachable("OMPCompareCaptureClause should never be reached");
+}
+
 void OMPClauseWriter::VisitOMPSeqCstClause(OMPSeqCstClause *) {}
 
 void OMPClauseWriter::VisitOMPAcqRelClause(OMPAcqRelClause *) {}
Index: clang/lib/Serialization/ASTReader.cpp
===
--- clang/lib/Serialization/ASTReader.cpp
+++ clang/lib/Serialization/ASTReader.cpp
@@ -11786,6 +11786,8 @@
   case llvm::omp::OMPC_compare:
 C = new (Context) OMPCompareClause();
 break;
+  case llvm::omp::OMPC_compare_capture:
+llvm_unreachable("OMPCompareCaptureClause should never be reached");
   case llvm::omp::OMPC_seq_cst:
 C = new (Context) OMPSeqCstClause();
 break;
@@ -12146,6 +12148,10 @@
 
 void OMPClauseReader::VisitOMPCompareClause(OMPCompareClause *) {}
 
+void OMPClauseReader::VisitOMPCompareCaptureClause(OMPCompareCaptureClause *) {
+  llvm_unreachable("OMPCompareCaptureClause should never be reached");
+}
+
 void OMPClauseReader::VisitOMPSeqCstClause(OMPSeqCstClause *) {}
 
 void OMPClauseReader::VisitOMPAcqRelClause(OMPAcqRelClause *) {}
Index: clang/lib/Sema/TreeTransform.h
===
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -9476,6 +9476,12 @@
   return C;
 }
 
+template 
+OMPClause *TreeTransform::TransformOMPCompareCaptureClause(
+OMPCompareCaptureClause *C) {
+  llvm_unreachable("OMPCompareCaptureClause should never be reached");
+}
+
 template 
 OMPClause *
 TreeTransform::TransformOMPSeqCstClause(OMPSeqCstClause *C) {
Index: clang/lib/Sema/SemaOpenMP.cpp
===
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -35,6 +35,7 @@
 #include "llvm/ADT/IndexedMap.h"
 

[PATCH] D119301: [AArch64][ARM] add -Wunaligned-access only for clang

2022-02-09 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen added a comment.

In D119301#3309140 , @lenary wrote:

> I don't fully understand the reasoning for the patch, and you haven't really 
> explained it. I think what you are saying is that the `IsAux` argument to 
> `getTargetFeatures` should be considered because it's `true` for offloading 
> to another compiler, but I don't understand why we think the offload compiler 
> is not clang-compatible, as the features added in `getAArch64TargetFeatures` 
> and `getARMTargetFeatures` (and passed to the offloaded compiler) use the 
> LLVM-specific internal names. I would like you to explain this further, and 
> to document what `IsAux` implies in the code.

Apologies for the lack of explanation. My point is that 
`getAArch64TargetFeatures` / `getARMTargetFeatures` should only get the 
TargetFeatures, not adding compiler flags as a side effect, which belongs to 
clang's job construction. This makes code reuse harder.

> That all said code given here is not equivalent to the feature as originally 
> landed, because you've only re-added the `-Wunaligned-access` flag for the 
> AArch64 target - please make the same addition in `Clang::AddARMTargetArgs` 
> as we want the warning on both. I think this also makes `CmdArgs` unused in 
> both `aarch64::getAArch64TargetFeatures` and `arm::getARMTargetFeatures` as I 
> think that you don't actually want us adding to `CmdArgs` in those functions 
> (again, I hope the full reasoning behind this will be explained when you 
> explain why the whole patch is necessary).

Will do the same thing for `Clang::AddARMTargetArgs`. Thanks. I've tested this 
patch but not sure why the original test still passing without a 
`Clang::AddARMTargetArgs` change.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119301

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


[PATCH] D116261: [Clang][OpenMP] Add support for compare capture in parser

2022-02-09 Thread Shilei Tian via Phabricator via cfe-commits
tianshilei1992 updated this revision to Diff 407309.
tianshilei1992 marked 2 inline comments as done.
tianshilei1992 added a comment.

use `LLVM_FALLTHROUGH`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116261

Files:
  clang/include/clang/AST/OpenMPClause.h
  clang/include/clang/AST/RecursiveASTVisitor.h
  clang/lib/AST/OpenMPClause.cpp
  clang/lib/AST/StmtProfile.cpp
  clang/lib/Basic/OpenMPKinds.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/Parse/ParseOpenMP.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/test/OpenMP/atomic_messages.cpp
  clang/tools/libclang/CIndex.cpp
  llvm/include/llvm/Frontend/OpenMP/OMP.td

Index: llvm/include/llvm/Frontend/OpenMP/OMP.td
===
--- llvm/include/llvm/Frontend/OpenMP/OMP.td
+++ llvm/include/llvm/Frontend/OpenMP/OMP.td
@@ -181,6 +181,10 @@
 def OMPC_Update : Clause<"update"> { let clangClass = "OMPUpdateClause"; }
 def OMPC_Capture : Clause<"capture"> { let clangClass = "OMPCaptureClause"; }
 def OMPC_Compare : Clause<"compare"> { let clangClass = "OMPCompareClause"; }
+// A dummy clause if compare and capture clauses are present.
+def OMPC_CompareCapture : Clause<"compare_capture"> {
+  let clangClass = "OMPCompareCaptureClause";
+}
 def OMPC_SeqCst : Clause<"seq_cst"> { let clangClass = "OMPSeqCstClause"; }
 def OMPC_AcqRel : Clause<"acq_rel"> { let clangClass = "OMPAcqRelClause"; }
 def OMPC_Acquire : Clause<"acquire"> { let clangClass = "OMPAcquireClause"; }
Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -2277,6 +2277,11 @@
 
 void OMPClauseEnqueue::VisitOMPCompareClause(const OMPCompareClause *) {}
 
+void OMPClauseEnqueue::VisitOMPCompareCaptureClause(
+const OMPCompareCaptureClause *) {
+  llvm_unreachable("OMPCompareCaptureClause should never be reached");
+}
+
 void OMPClauseEnqueue::VisitOMPSeqCstClause(const OMPSeqCstClause *) {}
 
 void OMPClauseEnqueue::VisitOMPAcqRelClause(const OMPAcqRelClause *) {}
Index: clang/test/OpenMP/atomic_messages.cpp
===
--- clang/test/OpenMP/atomic_messages.cpp
+++ clang/test/OpenMP/atomic_messages.cpp
@@ -958,3 +958,26 @@
   // expected-note@+1 {{in instantiation of function template specialization 'mixed' requested here}}
   return mixed();
 }
+
+#if _OPENMP >= 202011
+int compare() {
+  int a, b, c;
+// omp51-error@+1 {{atomic compare is not supported for now}}
+#pragma omp atomic compare
+  {
+if (a == b)
+  a = c;
+  }
+}
+
+int compare_capture() {
+  int a, b, c, x;
+// omp51-error@+1 {{atomic compare capture is not supported for now}}
+#pragma omp atomic compare capture
+  {
+x = a;
+if (a == b)
+  a = c;
+  }
+}
+#endif
Index: clang/lib/Serialization/ASTWriter.cpp
===
--- clang/lib/Serialization/ASTWriter.cpp
+++ clang/lib/Serialization/ASTWriter.cpp
@@ -6295,6 +6295,10 @@
 
 void OMPClauseWriter::VisitOMPCompareClause(OMPCompareClause *) {}
 
+void OMPClauseWriter::VisitOMPCompareCaptureClause(OMPCompareCaptureClause *) {
+  llvm_unreachable("OMPCompareCaptureClause should never be reached");
+}
+
 void OMPClauseWriter::VisitOMPSeqCstClause(OMPSeqCstClause *) {}
 
 void OMPClauseWriter::VisitOMPAcqRelClause(OMPAcqRelClause *) {}
Index: clang/lib/Serialization/ASTReader.cpp
===
--- clang/lib/Serialization/ASTReader.cpp
+++ clang/lib/Serialization/ASTReader.cpp
@@ -11786,6 +11786,8 @@
   case llvm::omp::OMPC_compare:
 C = new (Context) OMPCompareClause();
 break;
+  case llvm::omp::OMPC_compare_capture:
+llvm_unreachable("OMPCompareCaptureClause should never be reached");
   case llvm::omp::OMPC_seq_cst:
 C = new (Context) OMPSeqCstClause();
 break;
@@ -12146,6 +12148,10 @@
 
 void OMPClauseReader::VisitOMPCompareClause(OMPCompareClause *) {}
 
+void OMPClauseReader::VisitOMPCompareCaptureClause(OMPCompareCaptureClause *) {
+  llvm_unreachable("OMPCompareCaptureClause should never be reached");
+}
+
 void OMPClauseReader::VisitOMPSeqCstClause(OMPSeqCstClause *) {}
 
 void OMPClauseReader::VisitOMPAcqRelClause(OMPAcqRelClause *) {}
Index: clang/lib/Sema/TreeTransform.h
===
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -9476,6 +9476,12 @@
   return C;
 }
 
+template 
+OMPClause *TreeTransform::TransformOMPCompareCaptureClause(
+OMPCompareCaptureClause *C) {
+  llvm_unreachable("OMPCompareCaptureClause should never be reached");
+}
+
 template 
 OMPClause *
 TreeTransform::TransformOMPSeqCstClause(OMPSe

[PATCH] D116261: [Clang][OpenMP] Add support for compare capture in parser

2022-02-09 Thread Shilei Tian via Phabricator via cfe-commits
tianshilei1992 marked 3 inline comments as done.
tianshilei1992 added inline comments.



Comment at: clang/lib/AST/OpenMPClause.cpp:1804
+void OMPClausePrinter::VisitOMPCompareCaptureClause(OMPCompareCaptureClause *) 
{
+  // Do nothing as it is dummy.
+}

ABataev wrote:
> tianshilei1992 wrote:
> > ABataev wrote:
> > > Output?
> > I did it on purpose because `OMPCompareCaptureClause` is a dummy node. When 
> > it is visited (I really doubt if it can be visited because we don't create 
> > it explicitly), it should not output any thing. `compare` and `capture` are 
> > printed when visiting the two clauses.
> Why? I see ActOnOpenMPCompareCaptureClause, which creates such nodes.
I updated those functions. They should be unreachable.



Comment at: clang/lib/Sema/SemaOpenMP.cpp:11807-11812
+// TODO: For now we emit an error here and in emitOMPAtomicExpr we ignore
+// code gen.
+unsigned DiagID = Diags.getCustomDiagID(
+DiagnosticsEngine::Error,
+"atomic compare capture is not supported for now");
+Diag(AtomicKindLoc, DiagID);

ABataev wrote:
> Emit in codegen
Since we are lack of Sema, putting it in Sema for now sounds more reasonable.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116261

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


[PATCH] D119301: [AArch64][ARM] add -Wunaligned-access only for clang

2022-02-09 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen updated this revision to Diff 407308.
ychen added a comment.

- add ARM64 tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119301

Files:
  clang/test/Sema/test-wunaligned-access.c
  clang/test/Sema/test-wunaligned-access.cpp


Index: clang/test/Sema/test-wunaligned-access.cpp
===
--- clang/test/Sema/test-wunaligned-access.cpp
+++ clang/test/Sema/test-wunaligned-access.cpp
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 %s -triple=armv7-none-none-eabi -verify -Wunaligned-access 
-S -emit-llvm -o %t
+// RUN: %clang_cc1 %s -triple=armv8-none-none-eabi -verify -Wunaligned-access 
-S -emit-llvm -o %t
 // REQUIRES: arm-registered-target
 //
 // This test suite tests the warning triggered by the -Wunaligned-access 
option.
@@ -271,4 +272,4 @@
 struct U21 s21;
 struct U22 s22;
 struct U23 s23;
-struct U24 s24;
\ No newline at end of file
+struct U24 s24;
Index: clang/test/Sema/test-wunaligned-access.c
===
--- clang/test/Sema/test-wunaligned-access.c
+++ clang/test/Sema/test-wunaligned-access.c
@@ -2,6 +2,7 @@
 // RUN: rm -f %S/test-wunaligned-access.ll
 
 // RUN: %clang_cc1 %s -triple=armv7-none-none-eabi -verify -Wunaligned-access 
-S -emit-llvm -o %t
+// RUN: %clang_cc1 %s -triple=armv8-none-none-eabi -verify -Wunaligned-access 
-S -emit-llvm -o %t
 // REQUIRES: arm-registered-target
 //
 // This test suite tests the warning triggered by the -Wunaligned-access 
option.


Index: clang/test/Sema/test-wunaligned-access.cpp
===
--- clang/test/Sema/test-wunaligned-access.cpp
+++ clang/test/Sema/test-wunaligned-access.cpp
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 %s -triple=armv7-none-none-eabi -verify -Wunaligned-access -S -emit-llvm -o %t
+// RUN: %clang_cc1 %s -triple=armv8-none-none-eabi -verify -Wunaligned-access -S -emit-llvm -o %t
 // REQUIRES: arm-registered-target
 //
 // This test suite tests the warning triggered by the -Wunaligned-access option.
@@ -271,4 +272,4 @@
 struct U21 s21;
 struct U22 s22;
 struct U23 s23;
-struct U24 s24;
\ No newline at end of file
+struct U24 s24;
Index: clang/test/Sema/test-wunaligned-access.c
===
--- clang/test/Sema/test-wunaligned-access.c
+++ clang/test/Sema/test-wunaligned-access.c
@@ -2,6 +2,7 @@
 // RUN: rm -f %S/test-wunaligned-access.ll
 
 // RUN: %clang_cc1 %s -triple=armv7-none-none-eabi -verify -Wunaligned-access -S -emit-llvm -o %t
+// RUN: %clang_cc1 %s -triple=armv8-none-none-eabi -verify -Wunaligned-access -S -emit-llvm -o %t
 // REQUIRES: arm-registered-target
 //
 // This test suite tests the warning triggered by the -Wunaligned-access option.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D116261: [Clang][OpenMP] Add support for compare capture in parser

2022-02-09 Thread Shilei Tian via Phabricator via cfe-commits
tianshilei1992 updated this revision to Diff 407307.
tianshilei1992 marked 2 inline comments as done.
tianshilei1992 added a comment.

rebase and mark related functions as unreachable


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116261

Files:
  clang/include/clang/AST/OpenMPClause.h
  clang/include/clang/AST/RecursiveASTVisitor.h
  clang/lib/AST/OpenMPClause.cpp
  clang/lib/AST/StmtProfile.cpp
  clang/lib/Basic/OpenMPKinds.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/Parse/ParseOpenMP.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/test/OpenMP/atomic_messages.cpp
  clang/tools/libclang/CIndex.cpp
  llvm/include/llvm/Frontend/OpenMP/OMP.td

Index: llvm/include/llvm/Frontend/OpenMP/OMP.td
===
--- llvm/include/llvm/Frontend/OpenMP/OMP.td
+++ llvm/include/llvm/Frontend/OpenMP/OMP.td
@@ -181,6 +181,10 @@
 def OMPC_Update : Clause<"update"> { let clangClass = "OMPUpdateClause"; }
 def OMPC_Capture : Clause<"capture"> { let clangClass = "OMPCaptureClause"; }
 def OMPC_Compare : Clause<"compare"> { let clangClass = "OMPCompareClause"; }
+// A dummy clause if compare and capture clauses are present.
+def OMPC_CompareCapture : Clause<"compare_capture"> {
+  let clangClass = "OMPCompareCaptureClause";
+}
 def OMPC_SeqCst : Clause<"seq_cst"> { let clangClass = "OMPSeqCstClause"; }
 def OMPC_AcqRel : Clause<"acq_rel"> { let clangClass = "OMPAcqRelClause"; }
 def OMPC_Acquire : Clause<"acquire"> { let clangClass = "OMPAcquireClause"; }
Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -2277,6 +2277,11 @@
 
 void OMPClauseEnqueue::VisitOMPCompareClause(const OMPCompareClause *) {}
 
+void OMPClauseEnqueue::VisitOMPCompareCaptureClause(
+const OMPCompareCaptureClause *) {
+  llvm_unreachable("OMPCompareCaptureClause should never be reached");
+}
+
 void OMPClauseEnqueue::VisitOMPSeqCstClause(const OMPSeqCstClause *) {}
 
 void OMPClauseEnqueue::VisitOMPAcqRelClause(const OMPAcqRelClause *) {}
Index: clang/test/OpenMP/atomic_messages.cpp
===
--- clang/test/OpenMP/atomic_messages.cpp
+++ clang/test/OpenMP/atomic_messages.cpp
@@ -958,3 +958,26 @@
   // expected-note@+1 {{in instantiation of function template specialization 'mixed' requested here}}
   return mixed();
 }
+
+#if _OPENMP >= 202011
+int compare() {
+  int a, b, c;
+// omp51-error@+1 {{atomic compare is not supported for now}}
+#pragma omp atomic compare
+  {
+if (a == b)
+  a = c;
+  }
+}
+
+int compare_capture() {
+  int a, b, c, x;
+// omp51-error@+1 {{atomic compare capture is not supported for now}}
+#pragma omp atomic compare capture
+  {
+x = a;
+if (a == b)
+  a = c;
+  }
+}
+#endif
Index: clang/lib/Serialization/ASTWriter.cpp
===
--- clang/lib/Serialization/ASTWriter.cpp
+++ clang/lib/Serialization/ASTWriter.cpp
@@ -6295,6 +6295,10 @@
 
 void OMPClauseWriter::VisitOMPCompareClause(OMPCompareClause *) {}
 
+void OMPClauseWriter::VisitOMPCompareCaptureClause(OMPCompareCaptureClause *) {
+  llvm_unreachable("OMPCompareCaptureClause should never be reached");
+}
+
 void OMPClauseWriter::VisitOMPSeqCstClause(OMPSeqCstClause *) {}
 
 void OMPClauseWriter::VisitOMPAcqRelClause(OMPAcqRelClause *) {}
Index: clang/lib/Serialization/ASTReader.cpp
===
--- clang/lib/Serialization/ASTReader.cpp
+++ clang/lib/Serialization/ASTReader.cpp
@@ -11786,6 +11786,8 @@
   case llvm::omp::OMPC_compare:
 C = new (Context) OMPCompareClause();
 break;
+  case llvm::omp::OMPC_compare_capture:
+llvm_unreachable("OMPCompareCaptureClause should never be reached");
   case llvm::omp::OMPC_seq_cst:
 C = new (Context) OMPSeqCstClause();
 break;
@@ -12146,6 +12148,10 @@
 
 void OMPClauseReader::VisitOMPCompareClause(OMPCompareClause *) {}
 
+void OMPClauseReader::VisitOMPCompareCaptureClause(OMPCompareCaptureClause *) {
+  llvm_unreachable("OMPCompareCaptureClause should never be reached");
+}
+
 void OMPClauseReader::VisitOMPSeqCstClause(OMPSeqCstClause *) {}
 
 void OMPClauseReader::VisitOMPAcqRelClause(OMPAcqRelClause *) {}
Index: clang/lib/Sema/TreeTransform.h
===
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -9476,6 +9476,12 @@
   return C;
 }
 
+template 
+OMPClause *TreeTransform::TransformOMPCompareCaptureClause(
+OMPCompareCaptureClause *C) {
+  llvm_unreachable("OMPCompareCaptureClause should never be reached");
+}
+
 template 
 OMPClause *
 TreeTransform::Tran

[PATCH] D119199: replace clang LLVM_ENABLE_PLUGINS -> CLANG_PLUGIN_SUPPORT in tests

2022-02-09 Thread Jameson Nash via Phabricator via cfe-commits
vtjnash added a comment.

Thanks, if you encounter more issues next week, let me know, and I will 
continue trying to adjust it to work for all config option combinations.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119199

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


[clang] 76cad51 - replace clang LLVM_ENABLE_PLUGINS -> CLANG_PLUGIN_SUPPORT in tests

2022-02-09 Thread Jameson Nash via cfe-commits

Author: Jameson Nash
Date: 2022-02-09T17:31:34-05:00
New Revision: 76cad51ba700233d6e3492eddcbb466b6adbc2eb

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

LOG: replace clang LLVM_ENABLE_PLUGINS -> CLANG_PLUGIN_SUPPORT in tests

Ensure CLANG_PLUGIN_SUPPORT is compatible with llvm_add_library.
Fixes an issue noted in D00.

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

Added: 


Modified: 
clang-tools-extra/test/CMakeLists.txt
clang-tools-extra/test/lit.site.cfg.py.in
clang/CMakeLists.txt
clang/examples/AnnotateFunctions/CMakeLists.txt
clang/examples/Attribute/CMakeLists.txt
clang/examples/CallSuperAttribute/CMakeLists.txt
clang/examples/PluginsOrder/CMakeLists.txt
clang/examples/PrintFunctionNames/CMakeLists.txt
clang/lib/Analysis/plugins/CMakeLists.txt
clang/test/CMakeLists.txt
clang/test/lit.site.cfg.py.in
clang/tools/driver/CMakeLists.txt

Removed: 




diff  --git a/clang-tools-extra/test/CMakeLists.txt 
b/clang-tools-extra/test/CMakeLists.txt
index 9321457ae1a39..170e5f8bd197d 100644
--- a/clang-tools-extra/test/CMakeLists.txt
+++ b/clang-tools-extra/test/CMakeLists.txt
@@ -17,7 +17,7 @@ string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} 
CLANG_TOOLS_DIR ${LLVM_RUN
 
 llvm_canonicalize_cmake_booleans(
   CLANG_TIDY_ENABLE_STATIC_ANALYZER
-  LLVM_ENABLE_PLUGINS
+  CLANG_PLUGIN_SUPPORT
   LLVM_INSTALL_TOOLCHAIN_ONLY
   )
 
@@ -87,10 +87,19 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
   PLUGIN_TOOL clang-tidy
   DEPENDS clang-tidy-headers)
 
+  if(CLANG_BUILT_STANDALONE)
+# LLVMHello library is needed below
+if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Transforms/Hello
+   AND NOT TARGET LLVMHello)
+  add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Transforms/Hello
+lib/Transforms/Hello)
+endif()
+  endif()
+
   if(TARGET CTTestTidyModule)
   list(APPEND CLANG_TOOLS_TEST_DEPS CTTestTidyModule LLVMHello)
   target_include_directories(CTTestTidyModule PUBLIC BEFORE 
"${CLANG_TOOLS_SOURCE_DIR}")
-  if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
+  if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
 set(LLVM_LINK_COMPONENTS
   Support
 )

diff  --git a/clang-tools-extra/test/lit.site.cfg.py.in 
b/clang-tools-extra/test/lit.site.cfg.py.in
index e7db0e2ef2cb8..d30e6664816b7 100644
--- a/clang-tools-extra/test/lit.site.cfg.py.in
+++ b/clang-tools-extra/test/lit.site.cfg.py.in
@@ -12,7 +12,7 @@ config.clang_libs_dir = "@SHLIBDIR@"
 config.python_executable = "@Python3_EXECUTABLE@"
 config.target_triple = "@TARGET_TRIPLE@"
 config.clang_tidy_staticanalyzer = @CLANG_TIDY_ENABLE_STATIC_ANALYZER@
-config.has_plugins = @LLVM_ENABLE_PLUGINS@ & ~@LLVM_INSTALL_TOOLCHAIN_ONLY@
+config.has_plugins = @CLANG_PLUGIN_SUPPORT@ & ~@LLVM_INSTALL_TOOLCHAIN_ONLY@
 
 # Support substitution of the tools and libs dirs with user parameters. This is
 # used when we can't determine the tool dir at configuration time.

diff  --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 1cc9bacf4e5eb..4225c028e1794 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -476,6 +476,10 @@ add_definitions( -D_GNU_SOURCE )
 option(CLANG_BUILD_TOOLS
   "Build the Clang tools. If OFF, just generate build targets." ON)
 
+CMAKE_DEPENDENT_OPTION(CLANG_PLUGIN_SUPPORT
+  "Build clang with plugin support" ON
+  "LLVM_ENABLE_PLUGINS OR LLVM_EXPORT_SYMBOLS_FOR_PLUGINS" OFF)
+
 option(CLANG_ENABLE_ARCMT "Build ARCMT." ON)
 option(CLANG_ENABLE_STATIC_ANALYZER
   "Include static analyzer in clang binary." ON)

diff  --git a/clang/examples/AnnotateFunctions/CMakeLists.txt 
b/clang/examples/AnnotateFunctions/CMakeLists.txt
index e9850b64f08d7..e6541f7cc62a6 100644
--- a/clang/examples/AnnotateFunctions/CMakeLists.txt
+++ b/clang/examples/AnnotateFunctions/CMakeLists.txt
@@ -1,6 +1,6 @@
 add_llvm_library(AnnotateFunctions MODULE AnnotateFunctions.cpp PLUGIN_TOOL 
clang)
 
-if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
+if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
   set(LLVM_LINK_COMPONENTS
 Support
   )

diff  --git a/clang/examples/Attribute/CMakeLists.txt 
b/clang/examples/Attribute/CMakeLists.txt
index 42f04f5039bc7..5392ac0df1703 100644
--- a/clang/examples/Attribute/CMakeLists.txt
+++ b/clang/examples/Attribute/CMakeLists.txt
@@ -1,6 +1,6 @@
 add_llvm_library(Attribute MODULE Attribute.cpp PLUGIN_TOOL clang)
 
-if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
+if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
   target_link_libraries(Attribute PRIVATE
 clangAST
 clangBasic

diff  --git a/clang/examples/CallSuperAttribute/CMakeLists.txt 
b/clang/examples/CallSuperAttribute/CMakeLists.txt
index 922f0cfa797a8..f4284adf289e3 100644
--- a/clang/examples/CallSuperAttribute/CMakeLists.txt
+++ b/clang/exa

[PATCH] D119199: replace clang LLVM_ENABLE_PLUGINS -> CLANG_PLUGIN_SUPPORT in tests

2022-02-09 Thread Jameson Nash via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG76cad51ba700: replace clang LLVM_ENABLE_PLUGINS -> 
CLANG_PLUGIN_SUPPORT in tests (authored by vtjnash).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119199

Files:
  clang-tools-extra/test/CMakeLists.txt
  clang-tools-extra/test/lit.site.cfg.py.in
  clang/CMakeLists.txt
  clang/examples/AnnotateFunctions/CMakeLists.txt
  clang/examples/Attribute/CMakeLists.txt
  clang/examples/CallSuperAttribute/CMakeLists.txt
  clang/examples/PluginsOrder/CMakeLists.txt
  clang/examples/PrintFunctionNames/CMakeLists.txt
  clang/lib/Analysis/plugins/CMakeLists.txt
  clang/test/CMakeLists.txt
  clang/test/lit.site.cfg.py.in
  clang/tools/driver/CMakeLists.txt

Index: clang/tools/driver/CMakeLists.txt
===
--- clang/tools/driver/CMakeLists.txt
+++ clang/tools/driver/CMakeLists.txt
@@ -17,8 +17,6 @@
   Vectorize
   )
 
-option(CLANG_PLUGIN_SUPPORT "Build clang with plugin support" ON)
-
 # Support plugins.
 if(CLANG_PLUGIN_SUPPORT)
   set(support_plugins SUPPORT_PLUGINS)
Index: clang/test/lit.site.cfg.py.in
===
--- clang/test/lit.site.cfg.py.in
+++ clang/test/lit.site.cfg.py.in
@@ -34,7 +34,7 @@
 config.host_arch = "@HOST_ARCH@"
 config.python_executable = "@Python3_EXECUTABLE@"
 config.use_z3_solver = lit_config.params.get('USE_Z3_SOLVER', "@USE_Z3_SOLVER@")
-config.has_plugins = @LLVM_ENABLE_PLUGINS@
+config.has_plugins = @CLANG_PLUGIN_SUPPORT@
 config.clang_vendor_uti = "@CLANG_VENDOR_UTI@"
 config.llvm_external_lit = path(r"@LLVM_EXTERNAL_LIT@")
 
Index: clang/test/CMakeLists.txt
===
--- clang/test/CMakeLists.txt
+++ clang/test/CMakeLists.txt
@@ -14,12 +14,12 @@
   CLANG_DEFAULT_PIE_ON_LINUX
   CLANG_ENABLE_ARCMT
   CLANG_ENABLE_STATIC_ANALYZER
+  CLANG_PLUGIN_SUPPORT
   CLANG_SPAWN_CC1
   ENABLE_BACKTRACES
   LLVM_ENABLE_NEW_PASS_MANAGER
   LLVM_ENABLE_ZLIB
   LLVM_ENABLE_PER_TARGET_RUNTIME_DIR
-  LLVM_ENABLE_PLUGINS
   LLVM_ENABLE_THREADS
   LLVM_WITH_Z3
   )
@@ -146,7 +146,7 @@
 endif()
 
 if (CLANG_ENABLE_STATIC_ANALYZER)
-  if (LLVM_ENABLE_PLUGINS)
+  if (CLANG_PLUGIN_SUPPORT)
 list(APPEND CLANG_TEST_DEPS
   SampleAnalyzerPlugin
   CheckerDependencyHandlingAnalyzerPlugin
Index: clang/lib/Analysis/plugins/CMakeLists.txt
===
--- clang/lib/Analysis/plugins/CMakeLists.txt
+++ clang/lib/Analysis/plugins/CMakeLists.txt
@@ -1,4 +1,4 @@
-if(CLANG_ENABLE_STATIC_ANALYZER AND LLVM_ENABLE_PLUGINS)
+if(CLANG_ENABLE_STATIC_ANALYZER AND CLANG_PLUGIN_SUPPORT)
   add_subdirectory(SampleAnalyzer)
   add_subdirectory(CheckerDependencyHandling)
   add_subdirectory(CheckerOptionHandling)
Index: clang/examples/PrintFunctionNames/CMakeLists.txt
===
--- clang/examples/PrintFunctionNames/CMakeLists.txt
+++ clang/examples/PrintFunctionNames/CMakeLists.txt
@@ -11,7 +11,7 @@
 
 add_llvm_library(PrintFunctionNames MODULE PrintFunctionNames.cpp PLUGIN_TOOL clang)
 
-if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
+if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
   set(LLVM_LINK_COMPONENTS
 Support
   )
Index: clang/examples/PluginsOrder/CMakeLists.txt
===
--- clang/examples/PluginsOrder/CMakeLists.txt
+++ clang/examples/PluginsOrder/CMakeLists.txt
@@ -1,6 +1,6 @@
 add_llvm_library(PluginsOrder MODULE PluginsOrder.cpp PLUGIN_TOOL clang)
 
-if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
+if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
   set(LLVM_LINK_COMPONENTS
 Support
   )
Index: clang/examples/CallSuperAttribute/CMakeLists.txt
===
--- clang/examples/CallSuperAttribute/CMakeLists.txt
+++ clang/examples/CallSuperAttribute/CMakeLists.txt
@@ -1,6 +1,6 @@
 add_llvm_library(CallSuperAttr MODULE CallSuperAttrInfo.cpp PLUGIN_TOOL clang)
 
-if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
+if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
   set(LLVM_LINK_COMPONENTS
 Support
   )
Index: clang/examples/Attribute/CMakeLists.txt
===
--- clang/examples/Attribute/CMakeLists.txt
+++ clang/examples/Attribute/CMakeLists.txt
@@ -1,6 +1,6 @@
 add_llvm_library(Attribute MODULE Attribute.cpp PLUGIN_TOOL clang)
 
-if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
+if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
   target_link_libraries(Attribute PRIVATE
 clangAST
 clangBasic
Index: clang/examples/AnnotateFunctions/CMakeLists.txt
===
--- clang/examples/AnnotateFunctions/CMakeLists.txt
+++ clang/examples/Annot

[PATCH] D119370: [clang-tidy] add option performance-move-const-arg.CheckMoveToConstRef

2022-02-09 Thread Greg Miller via Phabricator via cfe-commits
devjgm updated this revision to Diff 407300.
devjgm added a comment.

- accepted ymandel's suggestion


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119370

Files:
  clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
  clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.h
  clang-tools-extra/docs/clang-tidy/checks/performance-move-const-arg.rst
  
clang-tools-extra/test/clang-tidy/checkers/performance-move-const-arg-const-ref.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/performance-move-const-arg-const-ref.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/performance-move-const-arg-const-ref.cpp
@@ -0,0 +1,80 @@
+// RUN: %check_clang_tidy %s performance-move-const-arg %t \
+// RUN: -config='{CheckOptions: \
+// RUN:  [{key: performance-move-const-arg.CheckMoveToConstRef, value: false}]}'
+
+namespace std {
+template 
+struct remove_reference;
+
+template 
+struct remove_reference {
+  typedef _Tp type;
+};
+
+template 
+struct remove_reference<_Tp &> {
+  typedef _Tp type;
+};
+
+template 
+struct remove_reference<_Tp &&> {
+  typedef _Tp type;
+};
+
+template 
+constexpr typename std::remove_reference<_Tp>::type &&move(_Tp &&__t) {
+  return static_cast::type &&>(__t);
+}
+
+template 
+constexpr _Tp &&
+forward(typename remove_reference<_Tp>::type &__t) noexcept {
+  return static_cast<_Tp &&>(__t);
+}
+
+} // namespace std
+
+struct TriviallyCopyable {
+  int i;
+};
+
+void f(TriviallyCopyable) {}
+
+void g() {
+  TriviallyCopyable obj;
+  // Some basic test to ensure that other warnings from
+  // performance-move-const-arg are still working and enabled.
+  f(std::move(obj));
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: std::move of the variable 'obj' of the trivially-copyable type 'TriviallyCopyable' has no effect; remove std::move() [performance-move-const-arg]
+  // CHECK-FIXES: f(obj);
+}
+
+class NoMoveSemantics {
+public:
+  NoMoveSemantics();
+  NoMoveSemantics(const NoMoveSemantics &);
+  NoMoveSemantics &operator=(const NoMoveSemantics &);
+};
+
+class MoveSemantics {
+public:
+  MoveSemantics();
+  MoveSemantics(MoveSemantics &&);
+
+  MoveSemantics &operator=(MoveSemantics &&);
+};
+
+void callByConstRef1(const NoMoveSemantics &);
+void callByConstRef2(const MoveSemantics &);
+
+void moveToConstReferencePositives() {
+  NoMoveSemantics a;
+
+  // This call is now allowed since CheckMoveToConstRef is false.
+  callByConstRef1(std::move(a));
+
+  MoveSemantics b;
+
+  // This call is now allowed since CheckMoveToConstRef is false.
+  callByConstRef2(std::move(b));
+}
Index: clang-tools-extra/docs/clang-tidy/checks/performance-move-const-arg.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/performance-move-const-arg.rst
+++ clang-tools-extra/docs/clang-tidy/checks/performance-move-const-arg.rst
@@ -35,3 +35,8 @@
 
If `true`, enables detection of trivially copyable types that do not
have a move constructor. Default is `true`.
+
+.. option:: CheckMoveToConstRef
+
+   If `true`, enables detection of `std::move()` passed as a const
+   reference argument. Default is `true`.
Index: clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.h
===
--- clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.h
+++ clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.h
@@ -18,16 +18,18 @@
 
 /// Find casts of calculation results to bigger type. Typically from int to
 ///
-/// There is one option:
+/// The options are
 ///
 ///   - `CheckTriviallyCopyableMove`: Whether to check for trivially-copyable
 //  types as their objects are not moved but copied. Enabled by default.
+//- `CheckMoveToConstRef`: Whether to check if a `std::move()` is passed
+//  as a const reference argument.
 class MoveConstArgCheck : public ClangTidyCheck {
 public:
   MoveConstArgCheck(StringRef Name, ClangTidyContext *Context)
-  : ClangTidyCheck(Name, Context),
-CheckTriviallyCopyableMove(
-Options.get("CheckTriviallyCopyableMove", true)) {}
+  : ClangTidyCheck(Name, Context), CheckTriviallyCopyableMove(Options.get(
+   "CheckTriviallyCopyableMove", true)),
+CheckMoveToConstRef(Options.get("CheckMoveToConstRef", true)) {}
   bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
 return LangOpts.CPlusPlus;
   }
@@ -37,6 +39,7 @@
 
 private:
   const bool CheckTriviallyCopyableMove;
+  const bool CheckMoveToConstRef;
   llvm::DenseSet AlreadyCheckedMoves;
 };
 
Index: clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
===
--- clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
+++ clang-to

[PATCH] D119363: [clang] Add `ObjCProtocolLoc` to represent protocol references

2022-02-09 Thread David Goldman via Phabricator via cfe-commits
dgoldman updated this revision to Diff 407295.
dgoldman added a comment.

Minor lint fixes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119363

Files:
  clang/include/clang/AST/ASTFwd.h
  clang/include/clang/AST/ASTTypeTraits.h
  clang/include/clang/AST/RecursiveASTVisitor.h
  clang/include/clang/AST/TypeLoc.h
  clang/lib/AST/ASTTypeTraits.cpp
  clang/lib/AST/ParentMapContext.cpp

Index: clang/lib/AST/ParentMapContext.cpp
===
--- clang/lib/AST/ParentMapContext.cpp
+++ clang/lib/AST/ParentMapContext.cpp
@@ -330,6 +330,9 @@
 DynTypedNode createDynTypedNode(const NestedNameSpecifierLoc &Node) {
   return DynTypedNode::create(Node);
 }
+template <> DynTypedNode createDynTypedNode(const ObjCProtocolLoc &Node) {
+  return DynTypedNode::create(Node);
+}
 /// @}
 
 /// A \c RecursiveASTVisitor that builds a map from nodes to their
@@ -433,6 +436,12 @@
 AttrNode, AttrNode, [&] { return VisitorBase::TraverseAttr(AttrNode); },
 &Map.PointerParents);
   }
+  bool TraverseObjCProtocolLoc(ObjCProtocolLoc ProtocolLocNode) {
+return TraverseNode(
+ProtocolLocNode, DynTypedNode::create(ProtocolLocNode),
+[&] { return VisitorBase::TraverseObjCProtocolLoc(ProtocolLocNode); },
+&Map.OtherParents);
+  }
 
   // Using generic TraverseNode for Stmt would prevent data-recursion.
   bool dataTraverseStmtPre(Stmt *StmtNode) {
Index: clang/lib/AST/ASTTypeTraits.cpp
===
--- clang/lib/AST/ASTTypeTraits.cpp
+++ clang/lib/AST/ASTTypeTraits.cpp
@@ -16,6 +16,7 @@
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Attr.h"
 #include "clang/AST/DeclCXX.h"
+#include "clang/AST/DeclObjC.h"
 #include "clang/AST/NestedNameSpecifier.h"
 #include "clang/AST/OpenMPClause.h"
 #include "clang/AST/TypeLoc.h"
@@ -52,6 +53,7 @@
 {NKI_None, "Attr"},
 #define ATTR(A) {NKI_Attr, #A "Attr"},
 #include "clang/Basic/AttrList.inc"
+{NKI_None, "ObjCProtocolLoc"},
 };
 
 bool ASTNodeKind::isBaseOf(ASTNodeKind Other, unsigned *Distance) const {
@@ -193,6 +195,8 @@
 QualType(T, 0).print(OS, PP);
   else if (const Attr *A = get())
 A->printPretty(OS, PP);
+  else if (const ObjCProtocolLoc *P = get())
+P->Protocol->print(OS, PP);
   else
 OS << "Unable to print values of type " << NodeKind.asStringRef() << "\n";
 }
@@ -228,5 +232,7 @@
 return CBS->getSourceRange();
   if (const auto *A = get())
 return A->getRange();
+  if (const ObjCProtocolLoc *P = get())
+return P->getSourceRange();
   return SourceRange();
 }
Index: clang/include/clang/AST/TypeLoc.h
===
--- clang/include/clang/AST/TypeLoc.h
+++ clang/include/clang/AST/TypeLoc.h
@@ -2607,6 +2607,20 @@
 : public InheritingConcreteTypeLoc {};
 
+class ObjCProtocolLoc {
+public:
+  const ObjCProtocolDecl *Protocol = nullptr;
+  SourceLocation Loc = SourceLocation();
+
+  /// Get the full source range.
+  SourceRange getSourceRange() const LLVM_READONLY {
+return SourceRange(Loc, Loc);
+  }
+
+  /// Evaluates true when this protocol loc is valid/non-empty.
+  explicit operator bool() const { return Protocol; }
+};
+
 } // namespace clang
 
 #endif // LLVM_CLANG_AST_TYPELOC_H
Index: clang/include/clang/AST/RecursiveASTVisitor.h
===
--- clang/include/clang/AST/RecursiveASTVisitor.h
+++ clang/include/clang/AST/RecursiveASTVisitor.h
@@ -324,6 +324,12 @@
   /// \returns false if the visitation was terminated early, true otherwise.
   bool TraverseConceptReference(const ConceptReference &C);
 
+  /// Recursively visit an Objective-C protocol reference with location
+  /// information.
+  ///
+  /// \returns false if the visitation was terminated early, true otherwise.
+  bool TraverseObjCProtocolLoc(ObjCProtocolLoc ProtocolLoc);
+
   //  Methods on Attrs 
 
   // Visit an attribute.
@@ -1340,7 +1346,14 @@
 DEF_TRAVERSE_TYPELOC(PackExpansionType,
  { TRY_TO(TraverseTypeLoc(TL.getPatternLoc())); })
 
-DEF_TRAVERSE_TYPELOC(ObjCTypeParamType, {})
+DEF_TRAVERSE_TYPELOC(ObjCTypeParamType, {
+  for (unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i) {
+ObjCProtocolLoc ProtocolLoc;
+ProtocolLoc.Protocol = TL.getProtocol(i);
+ProtocolLoc.Loc = TL.getProtocolLoc(i);
+TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
+  }
+})
 
 DEF_TRAVERSE_TYPELOC(ObjCInterfaceType, {})
 
@@ -1351,6 +1364,12 @@
 TRY_TO(TraverseTypeLoc(TL.getBaseLoc()));
   for (unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
 TRY_TO(TraverseTypeLoc(TL.getTypeArgTInfo(i)->getTypeLoc()));
+  for (unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i) {
+ObjCProtocolLoc ProtocolLoc;
+ProtocolLoc.Protocol = TL.getProtocol(i);
+ProtocolLoc.Loc = TL.getProtocolLoc(i);
+   

[PATCH] D119370: [clang-tidy] add option performance-move-const-arg.CheckMoveToConstRef

2022-02-09 Thread Greg Miller via Phabricator via cfe-commits
devjgm updated this revision to Diff 407288.
devjgm added a comment.

Accepted ymandel's suggestion.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119370

Files:
  clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp


Index: clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
===
--- clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
+++ clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
@@ -194,8 +194,8 @@
   << (InvocationParm->getFunctionScopeIndex() + 1) << FunctionName
   << *InvocationParmType << ExpectParmTypeName;
 }
-  } else if (ReceivingExpr) {
-if ((*InvocationParmType)->isRValueReferenceType() || !CheckMoveToConstRef)
+  } else if (ReceivingExpr && CheckMoveToConstRef) {
+if ((*InvocationParmType)->isRValueReferenceType())
   return;
 
 auto Diag = diag(FileMoveRange.getBegin(),


Index: clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
===
--- clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
+++ clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
@@ -194,8 +194,8 @@
   << (InvocationParm->getFunctionScopeIndex() + 1) << FunctionName
   << *InvocationParmType << ExpectParmTypeName;
 }
-  } else if (ReceivingExpr) {
-if ((*InvocationParmType)->isRValueReferenceType() || !CheckMoveToConstRef)
+  } else if (ReceivingExpr && CheckMoveToConstRef) {
+if ((*InvocationParmType)->isRValueReferenceType())
   return;
 
 auto Diag = diag(FileMoveRange.getBegin(),
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D119199: replace clang LLVM_ENABLE_PLUGINS -> CLANG_PLUGIN_SUPPORT in tests

2022-02-09 Thread Cristian Adam via Phabricator via cfe-commits
cristian.adam resigned from this revision.
cristian.adam added a comment.
This revision is now accepted and ready to land.

In D119199#3309117 , @vtjnash wrote:

> @cristian.adam Is this good now? You are blocking merging this, but I think 
> it is ready to land, and I would like to not hold it up for other people if 
> it is fixing their issues (and the issues you discovered too)

I did a rebase on `release/14.x`, applied this commit and, got the same error:

  -- SampleAnalyzerPlugin ignored -- Loadable modules not supported on this 
platform.
  CMake Error at 
C:/Projects/llvm-project/repo/clang/cmake/modules/AddClang.cmake:185 
(target_link_libraries):
Utility target "SampleAnalyzerPlugin" must not be used as the target of a
target_link_libraries call.
  Call Stack (most recent call first):

C:/Projects/llvm-project/repo/clang/lib/Analysis/plugins/SampleAnalyzer/CMakeLists.txt:8
 (clang_target_link_libraries)
  
  
  -- CheckerDependencyHandlingAnalyzerPlugin ignored -- Loadable modules not 
supported on this platform.
  CMake Error at 
C:/Projects/llvm-project/repo/clang/cmake/modules/AddClang.cmake:185 
(target_link_libraries):
Utility target "CheckerDependencyHandlingAnalyzerPlugin" must not be used
as the target of a target_link_libraries call.
  Call Stack (most recent call first):

C:/Projects/llvm-project/repo/clang/lib/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt:8
 (clang_target_link_libraries)
  
  
  -- CheckerOptionHandlingAnalyzerPlugin ignored -- Loadable modules not 
supported on this platform.
  CMake Error at 
C:/Projects/llvm-project/repo/clang/cmake/modules/AddClang.cmake:185 
(target_link_libraries):
Utility target "CheckerOptionHandlingAnalyzerPlugin" must not be used as
the target of a target_link_libraries call.
  Call Stack (most recent call first):

C:/Projects/llvm-project/repo/clang/lib/Analysis/plugins/CheckerOptionHandling/CMakeLists.txt:8
 (clang_target_link_libraries)
   

I'll be away for a week, so I won't be blocking anybody now. I'll have to deal 
with building LLVM/Clang 14 when I come back.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119199

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


[PATCH] D119301: [AArch64][ARM] add -Wunaligned-access only for clang

2022-02-09 Thread Sam Elliott via Phabricator via cfe-commits
lenary added a comment.

I don't fully understand the reasoning for the patch, and you haven't really 
explained it. I think what you are saying is that the `IsAux` argument to 
`getTargetFeatures` should be considered because it's `true` for offloading to 
another compiler, but I don't understand why we think the offload compiler is 
not clang-compatible, as the features added in `getAArch64TargetFeatures` and 
`getARMTargetFeatures` (and passed to the offloaded compiler) use the 
LLVM-specific internal names. I would like you to explain this further, and to 
document what `IsAux` implies in the code.

That all said code given here is not equivalent to the feature as originally 
landed, because you've only re-added the `-Wunaligned-access` flag for the 
AArch64 target - please make the same addition in `Clang::AddARMTargetArgs` as 
we want the warning on both. I think this also makes `CmdArgs` unused in both 
`aarch64::getAArch64TargetFeatures` and `arm::getARMTargetFeatures` as I think 
that you don't actually want us adding to `CmdArgs` in those functions (again, 
I hope the full reasoning behind this will be explained when you explain why 
the whole patch is necessary).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119301

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


[PATCH] D119366: [clangd] Use `ObjCProtocolLoc` for generalized ObjC protocol support

2022-02-09 Thread David Goldman via Phabricator via cfe-commits
dgoldman updated this revision to Diff 407287.
dgoldman added a comment.

Minor lint fixes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119366

Files:
  clang-tools-extra/clangd/FindTarget.cpp
  clang-tools-extra/clangd/Selection.cpp
  clang-tools-extra/clangd/unittests/FindTargetTests.cpp

Index: clang-tools-extra/clangd/unittests/FindTargetTests.cpp
===
--- clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -946,11 +946,9 @@
   EXPECT_DECLS("ObjCCategoryImplDecl", "@interface Foo(Ext)");
 
   Code = R"cpp(
-@protocol Foo
-@end
-void test([[id]] p);
+void test(id p);
   )cpp";
-  EXPECT_DECLS("ObjCObjectTypeLoc", "@protocol Foo");
+  EXPECT_DECLS("ParmVarDecl", "id p");
 
   Code = R"cpp(
 @class C;
@@ -966,7 +964,7 @@
 @end
 void test(C<[[Foo]]> *p);
   )cpp";
-  EXPECT_DECLS("ObjCObjectTypeLoc", "@protocol Foo");
+  EXPECT_DECLS("ObjCProtocolLoc", "@protocol Foo");
 
   Code = R"cpp(
 @class C;
@@ -976,8 +974,17 @@
 @end
 void test(C<[[Foo]], Bar> *p);
   )cpp";
-  // FIXME: We currently can't disambiguate between multiple protocols.
-  EXPECT_DECLS("ObjCObjectTypeLoc", "@protocol Foo", "@protocol Bar");
+  EXPECT_DECLS("ObjCProtocolLoc", "@protocol Foo");
+
+  Code = R"cpp(
+@class C;
+@protocol Foo
+@end
+@protocol Bar
+@end
+void test(C *p);
+  )cpp";
+  EXPECT_DECLS("ObjCProtocolLoc", "@protocol Bar");
 
   Code = R"cpp(
 @interface Foo
Index: clang-tools-extra/clangd/Selection.cpp
===
--- clang-tools-extra/clangd/Selection.cpp
+++ clang-tools-extra/clangd/Selection.cpp
@@ -684,6 +684,9 @@
 return traverseNode(
 &QX, [&] { return TraverseTypeLoc(QX.getUnqualifiedLoc()); });
   }
+  bool TraverseObjCProtocolLoc(ObjCProtocolLoc PL) {
+return traverseNode(&PL, [&] { return Base::TraverseObjCProtocolLoc(PL); });
+  }
   // Uninteresting parts of the AST that don't have locations within them.
   bool TraverseNestedNameSpecifier(NestedNameSpecifier *) { return true; }
   bool TraverseType(QualType) { return true; }
Index: clang-tools-extra/clangd/FindTarget.cpp
===
--- clang-tools-extra/clangd/FindTarget.cpp
+++ clang-tools-extra/clangd/FindTarget.cpp
@@ -453,15 +453,6 @@
   void VisitObjCInterfaceType(const ObjCInterfaceType *OIT) {
 Outer.add(OIT->getDecl(), Flags);
   }
-  void VisitObjCObjectType(const ObjCObjectType *OOT) {
-// Make all of the protocols targets since there's no child nodes for
-// protocols. This isn't needed for the base type, which *does* have a
-// child `ObjCInterfaceTypeLoc`. This structure is a hack, but it works
-// well for go-to-definition.
-unsigned NumProtocols = OOT->getNumProtocols();
-for (unsigned I = 0; I < NumProtocols; I++)
-  Outer.add(OOT->getProtocol(I), Flags);
-  }
 };
 Visitor(*this, Flags).Visit(T.getTypePtr());
   }
@@ -547,6 +538,8 @@
 Finder.add(TAL->getArgument(), Flags);
   else if (const CXXBaseSpecifier *CBS = N.get())
 Finder.add(CBS->getTypeSourceInfo()->getType(), Flags);
+  else if (const ObjCProtocolLoc *PL = N.get())
+Finder.add(PL->Protocol, Flags);
   return Finder.takeDecls();
 }
 
@@ -669,25 +662,7 @@
   {OMD}});
 }
 
-void visitProtocolList(
-llvm::iterator_range Protocols,
-llvm::iterator_range Locations) {
-  for (const auto &P : llvm::zip(Protocols, Locations)) {
-Refs.push_back(ReferenceLoc{NestedNameSpecifierLoc(),
-std::get<1>(P),
-/*IsDecl=*/false,
-{std::get<0>(P)}});
-  }
-}
-
-void VisitObjCInterfaceDecl(const ObjCInterfaceDecl *OID) {
-  if (OID->isThisDeclarationADefinition())
-visitProtocolList(OID->protocols(), OID->protocol_locs());
-  Base::VisitObjCInterfaceDecl(OID); // Visit the interface's name.
-}
-
 void VisitObjCCategoryDecl(const ObjCCategoryDecl *OCD) {
-  visitProtocolList(OCD->protocols(), OCD->protocol_locs());
   // getLocation is the extended class's location, not the category's.
   Refs.push_back(ReferenceLoc{NestedNameSpecifierLoc(),
   OCD->getLocation(),
@@ -709,12 +684,6 @@
   /*IsDecl=*/true,
   {OCID->getCategoryDecl()}});
 }
-
-void VisitObjCProtocolDecl(const ObjCProtocolDecl *OPD) {
-  if (OPD->isThisDeclarationADefinition())
-visitProtocolList(OPD->protocols(), OPD->protocol_locs());
-  Base::VisitObjCProtocolDecl(OPD); // Visit the protocol's

[PATCH] D119199: replace clang LLVM_ENABLE_PLUGINS -> CLANG_PLUGIN_SUPPORT in tests

2022-02-09 Thread Jameson Nash via Phabricator via cfe-commits
vtjnash added a comment.

@cristian.adam Is this good now? You are blocking merging this, but I think it 
is ready to land, and I would like to not hold it up for other people if it is 
fixing their issues (and the issues you discovered too)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119199

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


[PATCH] D119375: [Clang][Sema] Do not evaluate value-dependent immediate invocations

2022-02-09 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron added a comment.

The assert that I mentioned in the summary: 
https://github.com/llvm/llvm-project/blob/main/clang/lib/AST/ExprConstant.cpp#L14969
(Although `assert`s are deleted in release builds, one can check the violation 
by `llvm::errs() << isValueDependent() << "\n";` in the method)

I think I have found the right place to check the condition, right after 
creating the `ConstantExpr` object.

//P.S. If this review is eventually approved, kindly please merge the commit on 
my behalf =) As I don't have merge access. My name is `Evgeny Shulgin` and 
email is `izaronpl...@gmail.com`. Sorry for inconvenience!//


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119375

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


[PATCH] D119184: [clang] [concepts] Check constrained-auto return types for void-returning functions

2022-02-09 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone updated this revision to Diff 407284.
Quuxplusone added a comment.

Rebase; clang-format.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119184

Files:
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/test/SemaCXX/deduced-return-type-cxx14.cpp
  clang/test/SemaTemplate/concepts.cpp

Index: clang/test/SemaTemplate/concepts.cpp
===
--- clang/test/SemaTemplate/concepts.cpp
+++ clang/test/SemaTemplate/concepts.cpp
@@ -169,3 +169,23 @@
   template void f(T, U) = delete;
   void g() { f(0, 0); }
 }
+
+namespace PR49188 {
+  template concept C = false; // expected-note 6 {{because 'false' evaluated to false}}
+
+  C auto f1() { return void(); }   // expected-error {{deduced type 'void' does not satisfy 'C'}}
+  C auto f2() { return; }  // expected-error {{deduced type 'void' does not satisfy 'C'}}
+  C auto f3() {}   // expected-error {{deduced type 'void' does not satisfy 'C'}}
+  C decltype(auto) f4() { return void(); } // expected-error {{deduced type 'void' does not satisfy 'C'}}
+  C decltype(auto) f5() { return; }// expected-error {{deduced type 'void' does not satisfy 'C'}}
+  C decltype(auto) f6() {} // expected-error {{deduced type 'void' does not satisfy 'C'}}
+
+  void g() {
+f1();
+f2();
+f3();
+f4();
+f5();
+f6();
+  }
+}
Index: clang/test/SemaCXX/deduced-return-type-cxx14.cpp
===
--- clang/test/SemaCXX/deduced-return-type-cxx14.cpp
+++ clang/test/SemaCXX/deduced-return-type-cxx14.cpp
@@ -113,7 +113,7 @@
 using Void = void;
 using Void = decltype(void_ret());
 
-auto &void_ret_2() {} // expected-error {{cannot deduce return type 'auto &' for function with no return statements}}
+auto &void_ret_2() {} // expected-error {{cannot form a reference to 'void'}}
 const auto void_ret_3() {} // ok, return type 'const void' is adjusted to 'void'
 
 const auto void_ret_4() {
Index: clang/lib/Sema/SemaStmt.cpp
===
--- clang/lib/Sema/SemaStmt.cpp
+++ clang/lib/Sema/SemaStmt.cpp
@@ -3590,7 +3590,7 @@
 
 AutoType *AT = CurCap->ReturnType->getContainedAutoType();
 assert(AT && "lost auto type from lambda return type");
-if (DeduceFunctionTypeFromReturnExpr(FD, ReturnLoc, RetValExp, AT)) {
+if (DeduceFunctionTypeFromReturnExpr(FD, ReturnLoc, RetValExp, AT, true)) {
   FD->setInvalidDecl();
   // FIXME: preserve the ill-formed return expression.
   return StmtError();
@@ -3761,9 +3761,9 @@
 /// C++1y [dcl.spec.auto]p6.
 bool Sema::DeduceFunctionTypeFromReturnExpr(FunctionDecl *FD,
 SourceLocation ReturnLoc,
-Expr *&RetExpr,
-AutoType *AT) {
-  // If this is the conversion function for a lambda, we choose to deduce it
+Expr *&RetExpr, const AutoType *AT,
+bool HasReturnStmt) {
+  // If this is the conversion function for a lambda, we choose to deduce its
   // type from the corresponding call operator, not from the synthesized return
   // statement within it. See Sema::DeduceReturnType.
   if (isLambdaConversionOperator(FD))
@@ -3808,19 +3808,18 @@
 LocalTypedefNameReferencer Referencer(*this);
 Referencer.TraverseType(RetExpr->getType());
   } else {
-//  In the case of a return with no operand, the initializer is considered
-//  to be void().
-//
-// Deduction here can only succeed if the return type is exactly 'cv auto'
-// or 'decltype(auto)', so just check for that case directly.
-if (!OrigResultType.getType()->getAs()) {
-  Diag(ReturnLoc, diag::err_auto_fn_return_void_but_not_auto)
-<< OrigResultType.getType();
-  return true;
-}
-// We always deduce U = void in this case.
-Deduced = SubstAutoType(OrigResultType.getType(), Context.VoidTy);
-if (Deduced.isNull())
+// In the case of a return with no operand, the initializer is considered
+// to be 'void()'.
+ExprResult R = new (Context) CXXScalarValueInitExpr(
+Context.VoidTy,
+Context.getTrivialTypeSourceInfo(Context.VoidTy, ReturnLoc), ReturnLoc);
+Expr *Dummy = R.get();
+DeduceAutoResult DAR = DeduceAutoType(OrigResultType, Dummy, Deduced);
+if (DAR == DAR_Failed && !FD->isInvalidDecl())
+  Diag(ReturnLoc, HasReturnStmt ? diag::err_auto_fn_return_void_but_not_auto
+: diag::err_auto_fn_no_return_but_not_auto)
+  << OrigResultType.getType();
+if (DAR != DAR_Succeeded)
   return true;
   }
 
@@ -3988,8 +3987,8 @@
   // we s

[PATCH] D119370: [clang-tidy] add option performance-move-const-arg.CheckMoveToConstRef

2022-02-09 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
ymandel accepted this revision.
ymandel added inline comments.
This revision is now accepted and ready to land.



Comment at: 
clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp:197-198
 }
   } else if (ReceivingExpr) {
-if ((*InvocationParmType)->isRValueReferenceType())
+if ((*InvocationParmType)->isRValueReferenceType() || !CheckMoveToConstRef)
   return;

nit, up to you. I think this way is a little clearer b/c it reads "proceed on 
this branch if the check is configured to "check move to const ref"".


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119370

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


[PATCH] D118924: [clang-format] Fix formatting of macro definitions with a leading comment.

2022-02-09 Thread Marek Kurdej 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 rGa7b5e5b413bd: [clang-format] Fix formatting of macro 
definitions with a leading comment. (authored by curdeius).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118924

Files:
  clang/lib/Format/UnwrappedLineParser.cpp
  clang/unittests/Format/FormatTest.cpp


Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -1797,6 +1797,17 @@
 
 TEST_F(FormatTest, UnderstandsMacros) {
   verifyFormat("#define A (parentheses)");
+  verifyFormat("/* comment */ #define A (parentheses)");
+  verifyFormat("/* comment */ /* another comment */ #define A (parentheses)");
+  // Even the partial code should never be merged.
+  EXPECT_EQ("/* comment */ #define A (parentheses)\n"
+"#",
+format("/* comment */ #define A (parentheses)\n"
+   "#"));
+  verifyFormat("/* comment */ #define A (parentheses)\n"
+   "#\n");
+  verifyFormat("/* comment */ #define A (parentheses)\n"
+   "#define B (parentheses)");
   verifyFormat("#define true ((int)1)");
   verifyFormat("#define and(x)");
   verifyFormat("#define if(x) x");
Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -3551,6 +3551,8 @@
 
 void UnwrappedLineParser::readToken(int LevelDifference) {
   SmallVector Comments;
+  bool PreviousWasComment = false;
+  bool FirstNonCommentOnLine = false;
   do {
 FormatTok = Tokens->getNextToken();
 assert(FormatTok);
@@ -3567,8 +3569,26 @@
   FormatTok->MustBreakBefore = true;
 }
 
+auto IsFirstNonCommentOnLine = [](bool FirstNonCommentOnLine,
+  const FormatToken &Tok,
+  bool PreviousWasComment) {
+  auto IsFirstOnLine = [](const FormatToken &Tok) {
+return Tok.HasUnescapedNewline || Tok.IsFirst;
+  };
+
+  // Consider preprocessor directives preceded by block comments as first
+  // on line.
+  if (PreviousWasComment)
+return FirstNonCommentOnLine || IsFirstOnLine(Tok);
+  return IsFirstOnLine(Tok);
+};
+
+FirstNonCommentOnLine = IsFirstNonCommentOnLine(
+FirstNonCommentOnLine, *FormatTok, PreviousWasComment);
+PreviousWasComment = FormatTok->Tok.is(tok::comment);
+
 while (!Line->InPPDirective && FormatTok->Tok.is(tok::hash) &&
-   (FormatTok->HasUnescapedNewline || FormatTok->IsFirst)) {
+   FirstNonCommentOnLine) {
   distributeComments(Comments, FormatTok);
   Comments.clear();
   // If there is an unfinished unwrapped line, we flush the preprocessor
@@ -3587,6 +3607,9 @@
 Line->Level += PPBranchLevel;
   flushComments(isOnNewLine(*FormatTok));
   parsePPDirective();
+  PreviousWasComment = FormatTok->Tok.is(tok::comment);
+  FirstNonCommentOnLine = IsFirstNonCommentOnLine(
+  FirstNonCommentOnLine, *FormatTok, PreviousWasComment);
 }
 
 if (!PPStack.empty() && (PPStack.back().Kind == PP_Unreachable) &&


Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -1797,6 +1797,17 @@
 
 TEST_F(FormatTest, UnderstandsMacros) {
   verifyFormat("#define A (parentheses)");
+  verifyFormat("/* comment */ #define A (parentheses)");
+  verifyFormat("/* comment */ /* another comment */ #define A (parentheses)");
+  // Even the partial code should never be merged.
+  EXPECT_EQ("/* comment */ #define A (parentheses)\n"
+"#",
+format("/* comment */ #define A (parentheses)\n"
+   "#"));
+  verifyFormat("/* comment */ #define A (parentheses)\n"
+   "#\n");
+  verifyFormat("/* comment */ #define A (parentheses)\n"
+   "#define B (parentheses)");
   verifyFormat("#define true ((int)1)");
   verifyFormat("#define and(x)");
   verifyFormat("#define if(x) x");
Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -3551,6 +3551,8 @@
 
 void UnwrappedLineParser::readToken(int LevelDifference) {
   SmallVector Comments;
+  bool PreviousWasComment = false;
+  bool FirstNonCommentOnLine = false;
   do {
 FormatTok = Tokens->getNextToken();
 assert(FormatTok);
@@ -3567,8 +3569,26 @@
   FormatTok->MustBreakBefore = true;
 }
 
+auto IsFirstNonCommentOnLine = [](bool FirstNonCo

[clang] a7b5e5b - [clang-format] Fix formatting of macro definitions with a leading comment.

2022-02-09 Thread Marek Kurdej via cfe-commits

Author: Marek Kurdej
Date: 2022-02-09T22:39:59+01:00
New Revision: a7b5e5b413bd1654e8e96b9c7842c7c1ab0db58a

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

LOG: [clang-format] Fix formatting of macro definitions with a leading comment.

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

Reviewed By: HazardyKnusperkeks

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

Added: 


Modified: 
clang/lib/Format/UnwrappedLineParser.cpp
clang/unittests/Format/FormatTest.cpp

Removed: 




diff  --git a/clang/lib/Format/UnwrappedLineParser.cpp 
b/clang/lib/Format/UnwrappedLineParser.cpp
index 97a2cf367e80..0686aeb253ad 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -3551,6 +3551,8 @@ void UnwrappedLineParser::distributeComments(
 
 void UnwrappedLineParser::readToken(int LevelDifference) {
   SmallVector Comments;
+  bool PreviousWasComment = false;
+  bool FirstNonCommentOnLine = false;
   do {
 FormatTok = Tokens->getNextToken();
 assert(FormatTok);
@@ -3567,8 +3569,26 @@ void UnwrappedLineParser::readToken(int LevelDifference) 
{
   FormatTok->MustBreakBefore = true;
 }
 
+auto IsFirstNonCommentOnLine = [](bool FirstNonCommentOnLine,
+  const FormatToken &Tok,
+  bool PreviousWasComment) {
+  auto IsFirstOnLine = [](const FormatToken &Tok) {
+return Tok.HasUnescapedNewline || Tok.IsFirst;
+  };
+
+  // Consider preprocessor directives preceded by block comments as first
+  // on line.
+  if (PreviousWasComment)
+return FirstNonCommentOnLine || IsFirstOnLine(Tok);
+  return IsFirstOnLine(Tok);
+};
+
+FirstNonCommentOnLine = IsFirstNonCommentOnLine(
+FirstNonCommentOnLine, *FormatTok, PreviousWasComment);
+PreviousWasComment = FormatTok->Tok.is(tok::comment);
+
 while (!Line->InPPDirective && FormatTok->Tok.is(tok::hash) &&
-   (FormatTok->HasUnescapedNewline || FormatTok->IsFirst)) {
+   FirstNonCommentOnLine) {
   distributeComments(Comments, FormatTok);
   Comments.clear();
   // If there is an unfinished unwrapped line, we flush the preprocessor
@@ -3587,6 +3607,9 @@ void UnwrappedLineParser::readToken(int LevelDifference) {
 Line->Level += PPBranchLevel;
   flushComments(isOnNewLine(*FormatTok));
   parsePPDirective();
+  PreviousWasComment = FormatTok->Tok.is(tok::comment);
+  FirstNonCommentOnLine = IsFirstNonCommentOnLine(
+  FirstNonCommentOnLine, *FormatTok, PreviousWasComment);
 }
 
 if (!PPStack.empty() && (PPStack.back().Kind == PP_Unreachable) &&

diff  --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index 6f76a0c62edf..c7516427c2f4 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -1797,6 +1797,17 @@ TEST_F(FormatTest, FormatShortBracedStatements) {
 
 TEST_F(FormatTest, UnderstandsMacros) {
   verifyFormat("#define A (parentheses)");
+  verifyFormat("/* comment */ #define A (parentheses)");
+  verifyFormat("/* comment */ /* another comment */ #define A (parentheses)");
+  // Even the partial code should never be merged.
+  EXPECT_EQ("/* comment */ #define A (parentheses)\n"
+"#",
+format("/* comment */ #define A (parentheses)\n"
+   "#"));
+  verifyFormat("/* comment */ #define A (parentheses)\n"
+   "#\n");
+  verifyFormat("/* comment */ #define A (parentheses)\n"
+   "#define B (parentheses)");
   verifyFormat("#define true ((int)1)");
   verifyFormat("#define and(x)");
   verifyFormat("#define if(x) x");



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


[PATCH] D119375: [Clang][Sema] Do not evaluate value-dependent immediate invocations

2022-02-09 Thread Evgeny Shulgin via Phabricator via cfe-commits
Izaron created this revision.
Izaron added reviewers: aaron.ballman, cor3ntin.
Izaron requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Value-dependent ConstantExprs are not meant to be evaluated.
There is an assert in Expr::EvaluateAsConstantExpr that ensures this condition.
But before this patch the method was called without prior check.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119375

Files:
  clang/lib/Sema/SemaExpr.cpp
  clang/test/SemaCXX/cxx2a-consteval.cpp


Index: clang/test/SemaCXX/cxx2a-consteval.cpp
===
--- clang/test/SemaCXX/cxx2a-consteval.cpp
+++ clang/test/SemaCXX/cxx2a-consteval.cpp
@@ -613,6 +613,26 @@
 
 } // namespace unevaluated
 
+namespace value_dependent {
+
+consteval int foo(int x) {
+  return x;
+}
+
+template  constexpr int bar() {
+  return foo(X);
+}
+
+template  constexpr int baz() {
+  constexpr int t = sizeof(T);
+  return foo(t);
+}
+
+static_assert(bar<15>() == 15);
+static_assert(baz() == sizeof(int));
+
+} // namespace value_dependent
+
 namespace PR50779 {
 struct derp {
   int b = 0;
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -16728,7 +16728,10 @@
   ConstantExpr::getStorageKind(Decl->getReturnType().getTypePtr(),
getASTContext()),
   /*IsImmediateInvocation*/ true);
-  ExprEvalContexts.back().ImmediateInvocationCandidates.emplace_back(Res, 0);
+  /// Value-dependent constant expression are not meant to be calculated.
+  /// Each template instantiation will calculate its own value later.
+  if (!Res->isValueDependent())
+ExprEvalContexts.back().ImmediateInvocationCandidates.emplace_back(Res, 0);
   return Res;
 }
 


Index: clang/test/SemaCXX/cxx2a-consteval.cpp
===
--- clang/test/SemaCXX/cxx2a-consteval.cpp
+++ clang/test/SemaCXX/cxx2a-consteval.cpp
@@ -613,6 +613,26 @@
 
 } // namespace unevaluated
 
+namespace value_dependent {
+
+consteval int foo(int x) {
+  return x;
+}
+
+template  constexpr int bar() {
+  return foo(X);
+}
+
+template  constexpr int baz() {
+  constexpr int t = sizeof(T);
+  return foo(t);
+}
+
+static_assert(bar<15>() == 15);
+static_assert(baz() == sizeof(int));
+
+} // namespace value_dependent
+
 namespace PR50779 {
 struct derp {
   int b = 0;
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -16728,7 +16728,10 @@
   ConstantExpr::getStorageKind(Decl->getReturnType().getTypePtr(),
getASTContext()),
   /*IsImmediateInvocation*/ true);
-  ExprEvalContexts.back().ImmediateInvocationCandidates.emplace_back(Res, 0);
+  /// Value-dependent constant expression are not meant to be calculated.
+  /// Each template instantiation will calculate its own value later.
+  if (!Res->isValueDependent())
+ExprEvalContexts.back().ImmediateInvocationCandidates.emplace_back(Res, 0);
   return Res;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D119117: [clang-format] Fix formatting of the array form of delete.

2022-02-09 Thread Marek Kurdej via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
curdeius marked an inline comment as done.
Closed by commit rGa77c67f93917: [clang-format] Fix formatting of the array 
form of delete. (authored by curdeius).

Changed prior to commit:
  https://reviews.llvm.org/D119117?vs=406363&id=407280#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119117

Files:
  clang/lib/Format/TokenAnnotator.cpp
  clang/unittests/Format/FormatTest.cpp
  clang/unittests/Format/TokenAnnotatorTest.cpp


Index: clang/unittests/Format/TokenAnnotatorTest.cpp
===
--- clang/unittests/Format/TokenAnnotatorTest.cpp
+++ clang/unittests/Format/TokenAnnotatorTest.cpp
@@ -97,6 +97,28 @@
   EXPECT_TOKEN(Tokens[4], tok::l_brace, TT_Unknown);
 }
 
+TEST_F(TokenAnnotatorTest, UnderstandsDelete) {
+  auto Tokens = annotate("delete (void *)p;");
+  EXPECT_EQ(Tokens.size(), 8u) << Tokens;
+  EXPECT_TOKEN(Tokens[4], tok::r_paren, TT_CastRParen);
+
+  Tokens = annotate("delete[] (void *)p;");
+  EXPECT_EQ(Tokens.size(), 10u) << Tokens;
+  EXPECT_TOKEN(Tokens[6], tok::r_paren, TT_CastRParen);
+
+  Tokens = annotate("delete[] /*comment*/ (void *)p;");
+  EXPECT_EQ(Tokens.size(), 11u) << Tokens;
+  EXPECT_TOKEN(Tokens[7], tok::r_paren, TT_CastRParen);
+
+  Tokens = annotate("delete[/*comment*/] (void *)p;");
+  EXPECT_EQ(Tokens.size(), 11u) << Tokens;
+  EXPECT_TOKEN(Tokens[7], tok::r_paren, TT_CastRParen);
+
+  Tokens = annotate("delete/*comment*/[] (void *)p;");
+  EXPECT_EQ(Tokens.size(), 11u) << Tokens;
+  EXPECT_TOKEN(Tokens[7], tok::r_paren, TT_CastRParen);
+}
+
 } // namespace
 } // namespace format
 } // namespace clang
Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -9744,6 +9744,7 @@
"new 
(aa(aaa))\n"
"typename ();");
   verifyFormat("delete[] h->p;");
+  verifyFormat("delete[] (void *)p;");
 
   verifyFormat("void operator delete(void *foo) ATTRIB;");
   verifyFormat("void operator new(void *foo) ATTRIB;");
Index: clang/lib/Format/TokenAnnotator.cpp
===
--- clang/lib/Format/TokenAnnotator.cpp
+++ clang/lib/Format/TokenAnnotator.cpp
@@ -1883,6 +1883,25 @@
 LeftOfParens = LeftOfParens->MatchingParen->Previous;
   }
 
+  if (LeftOfParens->is(tok::r_square)) {
+//   delete[] (void *)ptr;
+auto MayBeArrayDelete = [](FormatToken *Tok) -> FormatToken * {
+  if (Tok->isNot(tok::r_square))
+return nullptr;
+
+  Tok = Tok->getPreviousNonComment();
+  if (!Tok || Tok->isNot(tok::l_square))
+return nullptr;
+
+  Tok = Tok->getPreviousNonComment();
+  if (!Tok || Tok->isNot(tok::kw_delete))
+return nullptr;
+  return Tok;
+};
+if (FormatToken *MaybeDelete = MayBeArrayDelete(LeftOfParens))
+  LeftOfParens = MaybeDelete;
+  }
+
   // The Condition directly below this one will see the operator arguments
   // as a (void *foo) cast.
   //   void operator delete(void *foo) ATTRIB;
@@ -3227,7 +3246,10 @@
   if (Left.isOneOf(tok::kw_try, Keywords.kw___except, tok::kw_catch))
 return Style.SpaceBeforeParensOptions.AfterControlStatements ||
spaceRequiredBeforeParens(Right);
-  if (Left.isOneOf(tok::kw_new, tok::kw_delete))
+  if (Left.isOneOf(tok::kw_new, tok::kw_delete) ||
+  (Left.is(tok::r_square) && Left.MatchingParen &&
+   Left.MatchingParen->Previous &&
+   Left.MatchingParen->Previous->is(tok::kw_delete)))
 return Style.SpaceBeforeParens != FormatStyle::SBPO_Never ||
spaceRequiredBeforeParens(Right);
 }


Index: clang/unittests/Format/TokenAnnotatorTest.cpp
===
--- clang/unittests/Format/TokenAnnotatorTest.cpp
+++ clang/unittests/Format/TokenAnnotatorTest.cpp
@@ -97,6 +97,28 @@
   EXPECT_TOKEN(Tokens[4], tok::l_brace, TT_Unknown);
 }
 
+TEST_F(TokenAnnotatorTest, UnderstandsDelete) {
+  auto Tokens = annotate("delete (void *)p;");
+  EXPECT_EQ(Tokens.size(), 8u) << Tokens;
+  EXPECT_TOKEN(Tokens[4], tok::r_paren, TT_CastRParen);
+
+  Tokens = annotate("delete[] (void *)p;");
+  EXPECT_EQ(Tokens.size(), 10u) << Tokens;
+  EXPECT_TOKEN(Tokens[6], tok::r_paren, TT_CastRParen);
+
+  Tokens = annotate("delete[] /*comment*/ (void *)p;");
+  EXPECT_EQ(Tokens.size(), 11u) << Tokens;
+  EXPECT_TOKEN(Tokens[7], tok::r_paren, TT_CastRParen);
+
+  Tokens = annotate("delete[/*comment*/] (void *)p;");
+  EXPECT_EQ(Toke

[clang] a77c67f - [clang-format] Fix formatting of the array form of delete.

2022-02-09 Thread Marek Kurdej via cfe-commits

Author: Marek Kurdej
Date: 2022-02-09T22:36:13+01:00
New Revision: a77c67f93917596f9eded9edaced4a9d355a4e1c

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

LOG: [clang-format] Fix formatting of the array form of delete.

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

There was an inconsistency in formatting of delete expressions.

Before:
```
delete (void*)a;
delete[](void*) a;
```

After this patch:
```
delete (void*)a;
delete[] (void*)a;
```

Reviewed By: HazardyKnusperkeks, owenpan

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

Added: 


Modified: 
clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/FormatTest.cpp
clang/unittests/Format/TokenAnnotatorTest.cpp

Removed: 




diff  --git a/clang/lib/Format/TokenAnnotator.cpp 
b/clang/lib/Format/TokenAnnotator.cpp
index 76f623147d3a4..28b244b9c59f1 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -1883,6 +1883,25 @@ class AnnotatingParser {
 LeftOfParens = LeftOfParens->MatchingParen->Previous;
   }
 
+  if (LeftOfParens->is(tok::r_square)) {
+//   delete[] (void *)ptr;
+auto MayBeArrayDelete = [](FormatToken *Tok) -> FormatToken * {
+  if (Tok->isNot(tok::r_square))
+return nullptr;
+
+  Tok = Tok->getPreviousNonComment();
+  if (!Tok || Tok->isNot(tok::l_square))
+return nullptr;
+
+  Tok = Tok->getPreviousNonComment();
+  if (!Tok || Tok->isNot(tok::kw_delete))
+return nullptr;
+  return Tok;
+};
+if (FormatToken *MaybeDelete = MayBeArrayDelete(LeftOfParens))
+  LeftOfParens = MaybeDelete;
+  }
+
   // The Condition directly below this one will see the operator arguments
   // as a (void *foo) cast.
   //   void operator delete(void *foo) ATTRIB;
@@ -3227,7 +3246,10 @@ bool TokenAnnotator::spaceRequiredBetween(const 
AnnotatedLine &Line,
   if (Left.isOneOf(tok::kw_try, Keywords.kw___except, tok::kw_catch))
 return Style.SpaceBeforeParensOptions.AfterControlStatements ||
spaceRequiredBeforeParens(Right);
-  if (Left.isOneOf(tok::kw_new, tok::kw_delete))
+  if (Left.isOneOf(tok::kw_new, tok::kw_delete) ||
+  (Left.is(tok::r_square) && Left.MatchingParen &&
+   Left.MatchingParen->Previous &&
+   Left.MatchingParen->Previous->is(tok::kw_delete)))
 return Style.SpaceBeforeParens != FormatStyle::SBPO_Never ||
spaceRequiredBeforeParens(Right);
 }

diff  --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index 14942d1ba420e..6f76a0c62edf9 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -9744,6 +9744,7 @@ TEST_F(FormatTest, UnderstandsNewAndDelete) {
"new 
(aa(aaa))\n"
"typename ();");
   verifyFormat("delete[] h->p;");
+  verifyFormat("delete[] (void *)p;");
 
   verifyFormat("void operator delete(void *foo) ATTRIB;");
   verifyFormat("void operator new(void *foo) ATTRIB;");

diff  --git a/clang/unittests/Format/TokenAnnotatorTest.cpp 
b/clang/unittests/Format/TokenAnnotatorTest.cpp
index 88deee974bbf5..acb7386a89df9 100644
--- a/clang/unittests/Format/TokenAnnotatorTest.cpp
+++ b/clang/unittests/Format/TokenAnnotatorTest.cpp
@@ -97,6 +97,28 @@ TEST_F(TokenAnnotatorTest, 
UnderstandsLBracesInMacroDefinition) {
   EXPECT_TOKEN(Tokens[4], tok::l_brace, TT_Unknown);
 }
 
+TEST_F(TokenAnnotatorTest, UnderstandsDelete) {
+  auto Tokens = annotate("delete (void *)p;");
+  EXPECT_EQ(Tokens.size(), 8u) << Tokens;
+  EXPECT_TOKEN(Tokens[4], tok::r_paren, TT_CastRParen);
+
+  Tokens = annotate("delete[] (void *)p;");
+  EXPECT_EQ(Tokens.size(), 10u) << Tokens;
+  EXPECT_TOKEN(Tokens[6], tok::r_paren, TT_CastRParen);
+
+  Tokens = annotate("delete[] /*comment*/ (void *)p;");
+  EXPECT_EQ(Tokens.size(), 11u) << Tokens;
+  EXPECT_TOKEN(Tokens[7], tok::r_paren, TT_CastRParen);
+
+  Tokens = annotate("delete[/*comment*/] (void *)p;");
+  EXPECT_EQ(Tokens.size(), 11u) << Tokens;
+  EXPECT_TOKEN(Tokens[7], tok::r_paren, TT_CastRParen);
+
+  Tokens = annotate("delete/*comment*/[] (void *)p;");
+  EXPECT_EQ(Tokens.size(), 11u) << Tokens;
+  EXPECT_TOKEN(Tokens[7], tok::r_paren, TT_CastRParen);
+}
+
 } // namespace
 } // namespace format
 } // namespace clang



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


[PATCH] D119370: feat: add option performance-move-const-arg.CheckMoveToConstRef

2022-02-09 Thread Greg Miller via Phabricator via cfe-commits
devjgm updated this revision to Diff 407267.
devjgm added a comment.

Here is also updated the documentation to include the new option.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119370

Files:
  clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
  clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.h
  clang-tools-extra/docs/clang-tidy/checks/performance-move-const-arg.rst
  
clang-tools-extra/test/clang-tidy/checkers/performance-move-const-arg-const-ref.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/performance-move-const-arg-const-ref.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/performance-move-const-arg-const-ref.cpp
@@ -0,0 +1,80 @@
+// RUN: %check_clang_tidy %s performance-move-const-arg %t \
+// RUN: -config='{CheckOptions: \
+// RUN:  [{key: performance-move-const-arg.CheckMoveToConstRef, value: false}]}'
+
+namespace std {
+template 
+struct remove_reference;
+
+template 
+struct remove_reference {
+  typedef _Tp type;
+};
+
+template 
+struct remove_reference<_Tp &> {
+  typedef _Tp type;
+};
+
+template 
+struct remove_reference<_Tp &&> {
+  typedef _Tp type;
+};
+
+template 
+constexpr typename std::remove_reference<_Tp>::type &&move(_Tp &&__t) {
+  return static_cast::type &&>(__t);
+}
+
+template 
+constexpr _Tp &&
+forward(typename remove_reference<_Tp>::type &__t) noexcept {
+  return static_cast<_Tp &&>(__t);
+}
+
+} // namespace std
+
+struct TriviallyCopyable {
+  int i;
+};
+
+void f(TriviallyCopyable) {}
+
+void g() {
+  TriviallyCopyable obj;
+  // Some basic test to ensure that other warnings from
+  // performance-move-const-arg are still working and enabled.
+  f(std::move(obj));
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: std::move of the variable 'obj' of the trivially-copyable type 'TriviallyCopyable' has no effect; remove std::move() [performance-move-const-arg]
+  // CHECK-FIXES: f(obj);
+}
+
+class NoMoveSemantics {
+public:
+  NoMoveSemantics();
+  NoMoveSemantics(const NoMoveSemantics &);
+  NoMoveSemantics &operator=(const NoMoveSemantics &);
+};
+
+class MoveSemantics {
+public:
+  MoveSemantics();
+  MoveSemantics(MoveSemantics &&);
+
+  MoveSemantics &operator=(MoveSemantics &&);
+};
+
+void callByConstRef1(const NoMoveSemantics &);
+void callByConstRef2(const MoveSemantics &);
+
+void moveToConstReferencePositives() {
+  NoMoveSemantics a;
+
+  // This call is now allowed since CheckMoveToConstRef is false.
+  callByConstRef1(std::move(a));
+
+  MoveSemantics b;
+
+  // This call is now allowed since CheckMoveToConstRef is false.
+  callByConstRef2(std::move(b));
+}
Index: clang-tools-extra/docs/clang-tidy/checks/performance-move-const-arg.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/performance-move-const-arg.rst
+++ clang-tools-extra/docs/clang-tidy/checks/performance-move-const-arg.rst
@@ -35,3 +35,8 @@
 
If `true`, enables detection of trivially copyable types that do not
have a move constructor. Default is `true`.
+
+.. option:: CheckMoveToConstRef
+
+   If `true`, enables detection of `std::move()` passed as a const
+   reference argument. Default is `true`.
Index: clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.h
===
--- clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.h
+++ clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.h
@@ -18,16 +18,18 @@
 
 /// Find casts of calculation results to bigger type. Typically from int to
 ///
-/// There is one option:
+/// The options are
 ///
 ///   - `CheckTriviallyCopyableMove`: Whether to check for trivially-copyable
 //  types as their objects are not moved but copied. Enabled by default.
+//- `CheckMoveToConstRef`: Whether to check if a `std::move()` is passed
+//  as a const reference argument.
 class MoveConstArgCheck : public ClangTidyCheck {
 public:
   MoveConstArgCheck(StringRef Name, ClangTidyContext *Context)
-  : ClangTidyCheck(Name, Context),
-CheckTriviallyCopyableMove(
-Options.get("CheckTriviallyCopyableMove", true)) {}
+  : ClangTidyCheck(Name, Context), CheckTriviallyCopyableMove(Options.get(
+   "CheckTriviallyCopyableMove", true)),
+CheckMoveToConstRef(Options.get("CheckMoveToConstRef", true)) {}
   bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
 return LangOpts.CPlusPlus;
   }
@@ -37,6 +39,7 @@
 
 private:
   const bool CheckTriviallyCopyableMove;
+  const bool CheckMoveToConstRef;
   llvm::DenseSet AlreadyCheckedMoves;
 };
 
Index: clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
===
--- clang-tools-extra/clang-tidy/performance/

[PATCH] D119218: [clang-format] Honour "// clang-format off" when using QualifierOrder.

2022-02-09 Thread Marek Kurdej via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe329b5866f17: [clang-format] Honour "// clang-format 
off" when using QualifierOrder. (authored by curdeius).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119218

Files:
  clang/lib/Format/QualifierAlignmentFixer.cpp
  clang/unittests/Format/QualifierFixerTest.cpp


Index: clang/unittests/Format/QualifierFixerTest.cpp
===
--- clang/unittests/Format/QualifierFixerTest.cpp
+++ clang/unittests/Format/QualifierFixerTest.cpp
@@ -858,5 +858,27 @@
Style);
 }
 
+TEST_F(QualifierFixerTest, DisableRegions) {
+  FormatStyle Style = getLLVMStyle();
+  Style.QualifierAlignment = FormatStyle::QAS_Custom;
+  Style.QualifierOrder = {"inline", "static", "const", "type"};
+
+  ReplacementCount = 0;
+  verifyFormat("// clang-format off\n"
+   "int const inline static a = 0;\n"
+   "// clang-format on\n",
+   Style);
+  EXPECT_EQ(ReplacementCount, 0);
+  verifyFormat("// clang-format off\n"
+   "int const inline static a = 0;\n"
+   "// clang-format on\n"
+   "inline static const int a = 0;\n",
+   "// clang-format off\n"
+   "int const inline static a = 0;\n"
+   "// clang-format on\n"
+   "int const inline static a = 0;\n",
+   Style);
+}
+
 } // namespace format
 } // namespace clang
Index: clang/lib/Format/QualifierAlignmentFixer.cpp
===
--- clang/lib/Format/QualifierAlignmentFixer.cpp
+++ clang/lib/Format/QualifierAlignmentFixer.cpp
@@ -390,6 +390,10 @@
 
   for (AnnotatedLine *Line : AnnotatedLines) {
 FormatToken *First = Line->First;
+assert(First);
+if (First->Finalized)
+  continue;
+
 const auto *Last = Line->Last;
 
 for (const auto *Tok = First; Tok && Tok != Last && Tok->Next;


Index: clang/unittests/Format/QualifierFixerTest.cpp
===
--- clang/unittests/Format/QualifierFixerTest.cpp
+++ clang/unittests/Format/QualifierFixerTest.cpp
@@ -858,5 +858,27 @@
Style);
 }
 
+TEST_F(QualifierFixerTest, DisableRegions) {
+  FormatStyle Style = getLLVMStyle();
+  Style.QualifierAlignment = FormatStyle::QAS_Custom;
+  Style.QualifierOrder = {"inline", "static", "const", "type"};
+
+  ReplacementCount = 0;
+  verifyFormat("// clang-format off\n"
+   "int const inline static a = 0;\n"
+   "// clang-format on\n",
+   Style);
+  EXPECT_EQ(ReplacementCount, 0);
+  verifyFormat("// clang-format off\n"
+   "int const inline static a = 0;\n"
+   "// clang-format on\n"
+   "inline static const int a = 0;\n",
+   "// clang-format off\n"
+   "int const inline static a = 0;\n"
+   "// clang-format on\n"
+   "int const inline static a = 0;\n",
+   Style);
+}
+
 } // namespace format
 } // namespace clang
Index: clang/lib/Format/QualifierAlignmentFixer.cpp
===
--- clang/lib/Format/QualifierAlignmentFixer.cpp
+++ clang/lib/Format/QualifierAlignmentFixer.cpp
@@ -390,6 +390,10 @@
 
   for (AnnotatedLine *Line : AnnotatedLines) {
 FormatToken *First = Line->First;
+assert(First);
+if (First->Finalized)
+  continue;
+
 const auto *Last = Line->Last;
 
 for (const auto *Tok = First; Tok && Tok != Last && Tok->Next;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] e329b58 - [clang-format] Honour "// clang-format off" when using QualifierOrder.

2022-02-09 Thread Marek Kurdej via cfe-commits

Author: Marek Kurdej
Date: 2022-02-09T22:15:20+01:00
New Revision: e329b5866f1732f5c24cf2ae96479971f7101914

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

LOG: [clang-format] Honour "// clang-format off" when using QualifierOrder.

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

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan

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

Added: 


Modified: 
clang/lib/Format/QualifierAlignmentFixer.cpp
clang/unittests/Format/QualifierFixerTest.cpp

Removed: 




diff  --git a/clang/lib/Format/QualifierAlignmentFixer.cpp 
b/clang/lib/Format/QualifierAlignmentFixer.cpp
index 13af32a9f4f47..233b081a95f6d 100644
--- a/clang/lib/Format/QualifierAlignmentFixer.cpp
+++ b/clang/lib/Format/QualifierAlignmentFixer.cpp
@@ -390,6 +390,10 @@ LeftRightQualifierAlignmentFixer::analyze(
 
   for (AnnotatedLine *Line : AnnotatedLines) {
 FormatToken *First = Line->First;
+assert(First);
+if (First->Finalized)
+  continue;
+
 const auto *Last = Line->Last;
 
 for (const auto *Tok = First; Tok && Tok != Last && Tok->Next;

diff  --git a/clang/unittests/Format/QualifierFixerTest.cpp 
b/clang/unittests/Format/QualifierFixerTest.cpp
index 0517de2820d9d..14f09d875e6be 100755
--- a/clang/unittests/Format/QualifierFixerTest.cpp
+++ b/clang/unittests/Format/QualifierFixerTest.cpp
@@ -858,5 +858,27 @@ TEST_F(QualifierFixerTest, QualifierTemplates) {
Style);
 }
 
+TEST_F(QualifierFixerTest, DisableRegions) {
+  FormatStyle Style = getLLVMStyle();
+  Style.QualifierAlignment = FormatStyle::QAS_Custom;
+  Style.QualifierOrder = {"inline", "static", "const", "type"};
+
+  ReplacementCount = 0;
+  verifyFormat("// clang-format off\n"
+   "int const inline static a = 0;\n"
+   "// clang-format on\n",
+   Style);
+  EXPECT_EQ(ReplacementCount, 0);
+  verifyFormat("// clang-format off\n"
+   "int const inline static a = 0;\n"
+   "// clang-format on\n"
+   "inline static const int a = 0;\n",
+   "// clang-format off\n"
+   "int const inline static a = 0;\n"
+   "// clang-format on\n"
+   "int const inline static a = 0;\n",
+   Style);
+}
+
 } // namespace format
 } // namespace clang



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


[PATCH] D119370: feat: add option performance-move-const-arg.CheckMoveToConstRef

2022-02-09 Thread Greg Miller via Phabricator via cfe-commits
devjgm created this revision.
Herald added a subscriber: carlosgalvezp.
devjgm requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

This option allows callers to disable the warning from
https://clang.llvm.org/extra/clang-tidy/checks/performance-move-const-arg.html
that would warn on the following

  cc
  void f(const string &s);
  string s;
  f(std::move(s));  // ALLOWED if
  performance-move-const-arg.CheckMoveToConstRef=false

The reason people might want to disable this check, is because it allows
callers to use `std::move()` or not based on local reasoning about the
argument, and without having to care about how the function `f` accepts
the argument. Indeed, `f` might accept the argument by const-ref today,
but change to by-value tomorrow, and if the caller had moved the
argument that they were finished with, the code would work as
efficiently as possible regardless of how `f` accepted the parameter.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119370

Files:
  clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
  clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.h
  
clang-tools-extra/test/clang-tidy/checkers/performance-move-const-arg-const-ref.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/performance-move-const-arg-const-ref.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/performance-move-const-arg-const-ref.cpp
@@ -0,0 +1,80 @@
+// RUN: %check_clang_tidy %s performance-move-const-arg %t \
+// RUN: -config='{CheckOptions: \
+// RUN:  [{key: performance-move-const-arg.CheckMoveToConstRef, value: false}]}'
+
+namespace std {
+template 
+struct remove_reference;
+
+template 
+struct remove_reference {
+  typedef _Tp type;
+};
+
+template 
+struct remove_reference<_Tp &> {
+  typedef _Tp type;
+};
+
+template 
+struct remove_reference<_Tp &&> {
+  typedef _Tp type;
+};
+
+template 
+constexpr typename std::remove_reference<_Tp>::type &&move(_Tp &&__t) {
+  return static_cast::type &&>(__t);
+}
+
+template 
+constexpr _Tp &&
+forward(typename remove_reference<_Tp>::type &__t) noexcept {
+  return static_cast<_Tp &&>(__t);
+}
+
+} // namespace std
+
+struct TriviallyCopyable {
+  int i;
+};
+
+void f(TriviallyCopyable) {}
+
+void g() {
+  TriviallyCopyable obj;
+  // Some basic test to ensure that other warnings from
+  // performance-move-const-arg are still working and enabled.
+  f(std::move(obj));
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: std::move of the variable 'obj' of the trivially-copyable type 'TriviallyCopyable' has no effect; remove std::move() [performance-move-const-arg]
+  // CHECK-FIXES: f(obj);
+}
+
+class NoMoveSemantics {
+public:
+  NoMoveSemantics();
+  NoMoveSemantics(const NoMoveSemantics &);
+  NoMoveSemantics &operator=(const NoMoveSemantics &);
+};
+
+class MoveSemantics {
+public:
+  MoveSemantics();
+  MoveSemantics(MoveSemantics &&);
+
+  MoveSemantics &operator=(MoveSemantics &&);
+};
+
+void callByConstRef1(const NoMoveSemantics &);
+void callByConstRef2(const MoveSemantics &);
+
+void moveToConstReferencePositives() {
+  NoMoveSemantics a;
+
+  // This call is now allowed since CheckMoveToConstRef is false.
+  callByConstRef1(std::move(a));
+
+  MoveSemantics b;
+
+  // This call is now allowed since CheckMoveToConstRef is false.
+  callByConstRef2(std::move(b));
+}
Index: clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.h
===
--- clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.h
+++ clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.h
@@ -25,9 +25,9 @@
 class MoveConstArgCheck : public ClangTidyCheck {
 public:
   MoveConstArgCheck(StringRef Name, ClangTidyContext *Context)
-  : ClangTidyCheck(Name, Context),
-CheckTriviallyCopyableMove(
-Options.get("CheckTriviallyCopyableMove", true)) {}
+  : ClangTidyCheck(Name, Context), CheckTriviallyCopyableMove(Options.get(
+   "CheckTriviallyCopyableMove", true)),
+CheckMoveToConstRef(Options.get("CheckMoveToConstRef", true)) {}
   bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
 return LangOpts.CPlusPlus;
   }
@@ -37,6 +37,7 @@
 
 private:
   const bool CheckTriviallyCopyableMove;
+  const bool CheckMoveToConstRef;
   llvm::DenseSet AlreadyCheckedMoves;
 };
 
Index: clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
===
--- clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
+++ clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
@@ -37,6 +37,7 @@
 
 void MoveConstArgCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
   Options.store(Opts, "CheckTriviallyCopyableMove", CheckTriviallyCopyableMove);
+  Options.store(Opts, "Che

[libunwind] dfa5ab7 - [libunwind] Avoid a warning in 32 bit builds. NFC.

2022-02-09 Thread Martin Storsjö via cfe-commits

Author: Martin Storsjö
Date: 2022-02-09T23:00:46+02:00
New Revision: dfa5ab7b2b510e68ca2b11b043898c192633c0f6

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

LOG: [libunwind] Avoid a warning in 32 bit builds. NFC.

The warning was introduced with the recently merged SPARCv9
support in 2b9554b8850192bdd86c02eb671de1d866df8d87.

The cast matches the existing surrounding cases.

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

Added: 


Modified: 
libunwind/src/DwarfInstructions.hpp

Removed: 




diff  --git a/libunwind/src/DwarfInstructions.hpp 
b/libunwind/src/DwarfInstructions.hpp
index c1a241c55ce66..ab83b0c87acdc 100644
--- a/libunwind/src/DwarfInstructions.hpp
+++ b/libunwind/src/DwarfInstructions.hpp
@@ -91,8 +91,8 @@ typename A::pint_t DwarfInstructions::getSavedRegister(
 return (pint_t)addressSpace.getRegister(cfa + (pint_t)savedReg.value);
 
   case CFI_Parser::kRegisterInCFADecrypt: // sparc64 specific
-return addressSpace.getP(cfa + (pint_t)savedReg.value) ^
-   getSparcWCookie(registers, 0);
+return (pint_t)(addressSpace.getP(cfa + (pint_t)savedReg.value) ^
+   getSparcWCookie(registers, 0));
 
   case CFI_Parser::kRegisterAtExpression:
 return (pint_t)addressSpace.getRegister(evaluateExpression(



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


[PATCH] D117569: Constexpr not supported with __declspec(dllimport).

2022-02-09 Thread Zahira Ammarguellat via Phabricator via cfe-commits
zahiraam added a comment.

@majnemer Review please :)


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

https://reviews.llvm.org/D117569

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


[PATCH] D110485: Support [[no_unique_address]] for all targets.

2022-02-09 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo added a comment.

In D110485#3308854 , @mstorsjo wrote:

> To pick up the thread here again, `[[no_unique_address]]` is done and settled 
> in MSVC, with the slightly surprising semantics: `[[no_unique_address]]` is 
> accepted, without any warning (in C++20 mode), but it has no effect. (This, 
> not related to LLVM, but because they had shipped it in earlier versions 
> without having an effect, and changing that later would break things.) 
> `[[msvc::no_unique_address]]` does have an effect though. See 
> https://github.com/microsoft/STL/issues/1364#issuecomment-1034167093 for a 
> more authoritative source on that.
>
> So, separately from implementing `[[msvc::no_unique_address]]`, I think we 
> also should also silence the current warning about unknown attribute for the 
> standard `[[no_unique_address]]`, to match MSVC.

Oh, also, according to 
https://devblogs.microsoft.com/cppblog/msvc-cpp20-and-the-std-cpp20-switch/, 
the plan is to change `[[no_unique_address]]` to actually have an effect the 
next time the compiler breaks its C++ ABI at an unknown point in the future. 
(This shouldn't be an issue for Clang, as we'd have to make a conscious effort 
to implement the new ABI whenever that happens anyway.)


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

https://reviews.llvm.org/D110485

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


[PATCH] D110485: Support [[no_unique_address]] for all targets.

2022-02-09 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo added a comment.

To pick up the thread here again, `[[no_unique_address]]` is done and settled 
in MSVC, with the slightly surprising semantics: `[[no_unique_address]]` is 
accepted, without any warning (in C++20 mode), but it has no effect. (This, not 
related to LLVM, but because they had shipped it in earlier versions without 
having an effect, and changing that later would break things.) 
`[[msvc::no_unique_address]]` does have an effect though. See 
https://github.com/microsoft/STL/issues/1364#issuecomment-1034167093 for a more 
authoritative source on that.

So, separately from implementing `[[msvc::no_unique_address]]`, I think we also 
should also silence the current warning about unknown attribute for the 
standard `[[no_unique_address]]`, to match MSVC.


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

https://reviews.llvm.org/D110485

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


[PATCH] D119296: KCFI sanitizer

2022-02-09 Thread Peter Collingbourne via Phabricator via cfe-commits
pcc added inline comments.



Comment at: clang/lib/CodeGen/CGExpr.cpp:3168
+  -1);
+  llvm::Value *Test = Builder.CreateICmpEQ(Builder.CreateLoad(HashPtr), Hash);
+  llvm::BasicBlock *ContBB = createBasicBlock("kcfi.cont");

pcc wrote:
> samitolvanen wrote:
> > pcc wrote:
> > > We considered a scheme like this before and one problem that we 
> > > discovered with comparing the hash in this way is that it can produce 
> > > gadgets, e.g.
> > > ```
> > > movabs $0x0123456789abcdef, %rax
> > > cmp %rax, ...
> > > ```
> > > the `cmp`instruction ends up being a valid target address because the 
> > > `movabs` instruction ends in the hash. The way we thought about solving 
> > > this was to introduce a new intrinsic that would materialize the constant 
> > > without these gadgets (e.g. invert the `movabs` operand and follow it by 
> > > a `not`).
> > Yes, that's a concern with this approach, at least on x86_64. As the hash 
> > is more or less random, I assume you'd have to actually check that the 
> > inverted form won't have useful gadgets either, and potentially split the 
> > single `movabs` into multiple instructions if needed etc. Did you ever 
> > start work on the intrinsic or was that just an idea?
> The likelihood of the inverted operand having gadgets seems equal to that of 
> any other piece of code having gadgets (here I'm just talking about KCFI 
> gadgets, not any other kind of gadget). And if you're using a fixed 2-byte 
> prefix it would be impossible for the `movabs` operand to itself be a gadget. 
> So I don't think it would be necessary to check the inverted operand 
> specifically for gadgets.
> 
> You might want to consider selecting the fixed prefix more carefully. It may 
> be worth looking for a prefix that is less likely to appear in generated code 
> (e.g. by taking a histogram of 2-byte sequences in a corpus of libraries) 
> rather than choosing one arbitrarily.
Also the intrinsic was just an idea, we never implemented it because we ended 
up going with the currently implemented strategy for the CFI sanitizers.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119296

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


[PATCH] D119367: [HWASan] Allow no_sanitize(..) and change metadata passing.

2022-02-09 Thread Mitch Phillips via Phabricator via cfe-commits
hctim created this revision.
hctim added a reviewer: eugenis.
Herald added subscribers: dexonsmith, hiraditya.
Herald added a reviewer: aaron.ballman.
hctim requested review of this revision.
Herald added projects: clang, Sanitizers, LLVM.
Herald added subscribers: llvm-commits, Sanitizers, cfe-commits.

Currently HWASan uses the no_sanitize shared with llvm.asan.globals to
disable hwasanification. The llvm.asan.globals list contains a whole
bunch of fluff (location, name, dynamically-initialized, excluded) in
order for dynamic initialization in ASan. We don't do that in HWASan,
globals have a static tag that's embedded in the file.

Right now, it's not possible for no_sanitize("hwaddress") to be slapped
on a global. Add this feature.

In addition, add the metadata to the global variable itself, as to
whether sanitization is disabled. Passes like GlobalOpt can replace the
existing global, and only copies the metadata for the GlobalVariable
itself, without replacing the GV pointers in llvm.asan.globals. This can
cause bugs, where no_sanitize("hwaddress") (and "address" as well, but
that's left for another time) ends up getting ignored if the global is
replaced.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119367

Files:
  clang/lib/CodeGen/CGDecl.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/SanitizerMetadata.cpp
  clang/lib/CodeGen/SanitizerMetadata.h
  clang/lib/Sema/SemaDeclAttr.cpp
  compiler-rt/test/hwasan/TestCases/global-with-reduction.c
  compiler-rt/test/hwasan/TestCases/global.c
  llvm/include/llvm/IR/GlobalValue.h
  llvm/lib/IR/Globals.cpp
  llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp

Index: llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
===
--- llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -1717,34 +1717,10 @@
   GV->eraseFromParent();
 }
 
-static DenseSet getExcludedGlobals(Module &M) {
-  NamedMDNode *Globals = M.getNamedMetadata("llvm.asan.globals");
-  if (!Globals)
-return DenseSet();
-  DenseSet Excluded(Globals->getNumOperands());
-  for (auto MDN : Globals->operands()) {
-// Metadata node contains the global and the fields of "Entry".
-assert(MDN->getNumOperands() == 5);
-auto *V = mdconst::extract_or_null(MDN->getOperand(0));
-// The optimizer may optimize away a global entirely.
-if (!V)
-  continue;
-auto *StrippedV = V->stripPointerCasts();
-auto *GV = dyn_cast(StrippedV);
-if (!GV)
-  continue;
-ConstantInt *IsExcluded = mdconst::extract(MDN->getOperand(4));
-if (IsExcluded->isOne())
-  Excluded.insert(GV);
-  }
-  return Excluded;
-}
-
 void HWAddressSanitizer::instrumentGlobals() {
   std::vector Globals;
-  auto ExcludedGlobals = getExcludedGlobals(M);
   for (GlobalVariable &GV : M.globals()) {
-if (ExcludedGlobals.count(&GV))
+if (GV.isNoSanitize())
   continue;
 
 if (GV.isDeclarationForLinker() || GV.getName().startswith("llvm.") ||
Index: llvm/lib/IR/Globals.cpp
===
--- llvm/lib/IR/Globals.cpp
+++ llvm/lib/IR/Globals.cpp
@@ -69,6 +69,7 @@
   setDLLStorageClass(Src->getDLLStorageClass());
   setDSOLocal(Src->isDSOLocal());
   setPartition(Src->getPartition());
+  setNoSanitize(Src->isNoSanitize());
 }
 
 void GlobalValue::removeFromParent() {
Index: llvm/include/llvm/IR/GlobalValue.h
===
--- llvm/include/llvm/IR/GlobalValue.h
+++ llvm/include/llvm/IR/GlobalValue.h
@@ -80,14 +80,14 @@
 UnnamedAddrVal(unsigned(UnnamedAddr::None)),
 DllStorageClass(DefaultStorageClass), ThreadLocal(NotThreadLocal),
 HasLLVMReservedName(false), IsDSOLocal(false), HasPartition(false),
-IntID((Intrinsic::ID)0U), Parent(nullptr) {
+NoSanitize(false), IntID((Intrinsic::ID)0U), Parent(nullptr) {
 setLinkage(Linkage);
 setName(Name);
   }
 
   Type *ValueType;
 
-  static const unsigned GlobalValueSubClassDataBits = 16;
+  static const unsigned GlobalValueSubClassDataBits = 15;
 
   // All bitfields use unsigned as the underlying type so that MSVC will pack
   // them.
@@ -112,9 +112,15 @@
   /// https://lld.llvm.org/Partitions.html).
   unsigned HasPartition : 1;
 
+  /// Should this variable be excluded from sanitization. Used for HWASan, so
+  /// that global variables can be marked as
+  /// __attribute__((no_sanitize("hwaddress"))), as well as ensuring that
+  /// markers for other sanitizers (e.g. ubsan) don't get sanitized.
+  unsigned NoSanitize : 1;
+
 private:
   // Give subclasses access to what otherwise would be wasted padding.
-  // (16 + 4 + 2 + 2 + 2 + 3 + 1 + 1 + 1) == 32.
+  // (15 + 4 + 2 + 2 + 2 + 3 + 1 + 1 + 1 + 1) == 32.
   unsigned SubClassData : GlobalValueSubClassDataBits;
 
   friend class Constant;
@@ -240,6 +246,9 @@
   s

[PATCH] D119296: KCFI sanitizer

2022-02-09 Thread Peter Collingbourne via Phabricator via cfe-commits
pcc added inline comments.



Comment at: clang/lib/CodeGen/CGExpr.cpp:3168
+  -1);
+  llvm::Value *Test = Builder.CreateICmpEQ(Builder.CreateLoad(HashPtr), Hash);
+  llvm::BasicBlock *ContBB = createBasicBlock("kcfi.cont");

samitolvanen wrote:
> pcc wrote:
> > We considered a scheme like this before and one problem that we discovered 
> > with comparing the hash in this way is that it can produce gadgets, e.g.
> > ```
> > movabs $0x0123456789abcdef, %rax
> > cmp %rax, ...
> > ```
> > the `cmp`instruction ends up being a valid target address because the 
> > `movabs` instruction ends in the hash. The way we thought about solving 
> > this was to introduce a new intrinsic that would materialize the constant 
> > without these gadgets (e.g. invert the `movabs` operand and follow it by a 
> > `not`).
> Yes, that's a concern with this approach, at least on x86_64. As the hash is 
> more or less random, I assume you'd have to actually check that the inverted 
> form won't have useful gadgets either, and potentially split the single 
> `movabs` into multiple instructions if needed etc. Did you ever start work on 
> the intrinsic or was that just an idea?
The likelihood of the inverted operand having gadgets seems equal to that of 
any other piece of code having gadgets (here I'm just talking about KCFI 
gadgets, not any other kind of gadget). And if you're using a fixed 2-byte 
prefix it would be impossible for the `movabs` operand to itself be a gadget. 
So I don't think it would be necessary to check the inverted operand 
specifically for gadgets.

You might want to consider selecting the fixed prefix more carefully. It may be 
worth looking for a prefix that is less likely to appear in generated code 
(e.g. by taking a histogram of 2-byte sequences in a corpus of libraries) 
rather than choosing one arbitrarily.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119296

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


[PATCH] D119366: [clangd] Use `ObjCProtocolLoc` for generalized ObjC protocol support

2022-02-09 Thread David Goldman via Phabricator via cfe-commits
dgoldman created this revision.
Herald added subscribers: usaxena95, kadircet, arphaman.
dgoldman requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.

This removes clangd's existing workaround in favor of proper support
via the newly added `ObjCProtocolLoc`. This improves support by
allowing clangd to properly identify which protocol is selected
now that `ObjCProtocolLoc` gets its own ASTNode.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119366

Files:
  clang-tools-extra/clangd/FindTarget.cpp
  clang-tools-extra/clangd/Selection.cpp
  clang-tools-extra/clangd/unittests/FindTargetTests.cpp

Index: clang-tools-extra/clangd/unittests/FindTargetTests.cpp
===
--- clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -946,11 +946,9 @@
   EXPECT_DECLS("ObjCCategoryImplDecl", "@interface Foo(Ext)");
 
   Code = R"cpp(
-@protocol Foo
-@end
-void test([[id]] p);
+void test(id p);
   )cpp";
-  EXPECT_DECLS("ObjCObjectTypeLoc", "@protocol Foo");
+  EXPECT_DECLS("ParmVarDecl", "id p");
 
   Code = R"cpp(
 @class C;
@@ -966,7 +964,7 @@
 @end
 void test(C<[[Foo]]> *p);
   )cpp";
-  EXPECT_DECLS("ObjCObjectTypeLoc", "@protocol Foo");
+  EXPECT_DECLS("ObjCProtocolLoc", "@protocol Foo");
 
   Code = R"cpp(
 @class C;
@@ -976,8 +974,18 @@
 @end
 void test(C<[[Foo]], Bar> *p);
   )cpp";
-  // FIXME: We currently can't disambiguate between multiple protocols.
-  EXPECT_DECLS("ObjCObjectTypeLoc", "@protocol Foo", "@protocol Bar");
+  EXPECT_DECLS("ObjCProtocolLoc", "@protocol Foo");
+
+  Code = R"cpp(
+@class C;
+@protocol Foo
+@end
+@protocol Bar
+@end
+void test(C *p);
+  )cpp";
+  EXPECT_DECLS("ObjCProtocolLoc", "@protocol Bar");
+
 
   Code = R"cpp(
 @interface Foo
Index: clang-tools-extra/clangd/Selection.cpp
===
--- clang-tools-extra/clangd/Selection.cpp
+++ clang-tools-extra/clangd/Selection.cpp
@@ -684,6 +684,10 @@
 return traverseNode(
 &QX, [&] { return TraverseTypeLoc(QX.getUnqualifiedLoc()); });
   }
+  bool TraverseObjCProtocolLoc(ObjCProtocolLoc PL) {
+return traverseNode(&PL,
+[&] { return Base::TraverseObjCProtocolLoc(PL); });
+  }
   // Uninteresting parts of the AST that don't have locations within them.
   bool TraverseNestedNameSpecifier(NestedNameSpecifier *) { return true; }
   bool TraverseType(QualType) { return true; }
Index: clang-tools-extra/clangd/FindTarget.cpp
===
--- clang-tools-extra/clangd/FindTarget.cpp
+++ clang-tools-extra/clangd/FindTarget.cpp
@@ -453,15 +453,6 @@
   void VisitObjCInterfaceType(const ObjCInterfaceType *OIT) {
 Outer.add(OIT->getDecl(), Flags);
   }
-  void VisitObjCObjectType(const ObjCObjectType *OOT) {
-// Make all of the protocols targets since there's no child nodes for
-// protocols. This isn't needed for the base type, which *does* have a
-// child `ObjCInterfaceTypeLoc`. This structure is a hack, but it works
-// well for go-to-definition.
-unsigned NumProtocols = OOT->getNumProtocols();
-for (unsigned I = 0; I < NumProtocols; I++)
-  Outer.add(OOT->getProtocol(I), Flags);
-  }
 };
 Visitor(*this, Flags).Visit(T.getTypePtr());
   }
@@ -547,6 +538,8 @@
 Finder.add(TAL->getArgument(), Flags);
   else if (const CXXBaseSpecifier *CBS = N.get())
 Finder.add(CBS->getTypeSourceInfo()->getType(), Flags);
+  else if (const ObjCProtocolLoc *PL = N.get())
+Finder.add(PL->Protocol, Flags);
   return Finder.takeDecls();
 }
 
@@ -669,25 +662,7 @@
   {OMD}});
 }
 
-void visitProtocolList(
-llvm::iterator_range Protocols,
-llvm::iterator_range Locations) {
-  for (const auto &P : llvm::zip(Protocols, Locations)) {
-Refs.push_back(ReferenceLoc{NestedNameSpecifierLoc(),
-std::get<1>(P),
-/*IsDecl=*/false,
-{std::get<0>(P)}});
-  }
-}
-
-void VisitObjCInterfaceDecl(const ObjCInterfaceDecl *OID) {
-  if (OID->isThisDeclarationADefinition())
-visitProtocolList(OID->protocols(), OID->protocol_locs());
-  Base::VisitObjCInterfaceDecl(OID); // Visit the interface's name.
-}
-
 void VisitObjCCategoryDecl(const ObjCCategoryDecl *OCD) {
-  visitProtocolList(OCD->protocols(), OCD->protocol_locs());
   // getLocation is the extended class's location, not the category's.
   Refs.push_back(ReferenceLoc{NestedNameSpecifierLoc(),
   OCD->getLocation(),
@@ -709,12 +684,6 @@

[PATCH] D119364: Refactor nested if else with ternary operator

2022-02-09 Thread Shivam Rajput via Phabricator via cfe-commits
phyBrackets created this revision.
phyBrackets requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119364

Files:
  clang/lib/CodeGen/CGExprScalar.cpp


Index: clang/lib/CodeGen/CGExprScalar.cpp
===
--- clang/lib/CodeGen/CGExprScalar.cpp
+++ clang/lib/CodeGen/CGExprScalar.cpp
@@ -65,20 +65,14 @@
   const auto &LHSAP = LHS->getValue();
   const auto &RHSAP = RHS->getValue();
   if (Opcode == BO_Add) {
-if (Signed)
-  Result = LHSAP.sadd_ov(RHSAP, Overflow);
-else
-  Result = LHSAP.uadd_ov(RHSAP, Overflow);
+Result = Signed ? LHSAP.sadd_ov(RHSAP, Overflow)
+: LHSAP.uadd_ov(RHSAP, Overflow);
   } else if (Opcode == BO_Sub) {
-if (Signed)
-  Result = LHSAP.ssub_ov(RHSAP, Overflow);
-else
-  Result = LHSAP.usub_ov(RHSAP, Overflow);
+Result = Signed ? LHSAP.ssub_ov(RHSAP, Overflow)
+: LHSAP.usub_ov(RHSAP, Overflow);
   } else if (Opcode == BO_Mul) {
-if (Signed)
-  Result = LHSAP.smul_ov(RHSAP, Overflow);
-else
-  Result = LHSAP.umul_ov(RHSAP, Overflow);
+Result = Signed ? LHSAP.smul_ov(RHSAP, Overflow)
+: LHSAP.umul_ov(RHSAP, Overflow);
   } else if (Opcode == BO_Div || Opcode == BO_Rem) {
 if (Signed && !RHS->isZero())
   Result = LHSAP.sdiv_ov(RHSAP, Overflow);


Index: clang/lib/CodeGen/CGExprScalar.cpp
===
--- clang/lib/CodeGen/CGExprScalar.cpp
+++ clang/lib/CodeGen/CGExprScalar.cpp
@@ -65,20 +65,14 @@
   const auto &LHSAP = LHS->getValue();
   const auto &RHSAP = RHS->getValue();
   if (Opcode == BO_Add) {
-if (Signed)
-  Result = LHSAP.sadd_ov(RHSAP, Overflow);
-else
-  Result = LHSAP.uadd_ov(RHSAP, Overflow);
+Result = Signed ? LHSAP.sadd_ov(RHSAP, Overflow)
+: LHSAP.uadd_ov(RHSAP, Overflow);
   } else if (Opcode == BO_Sub) {
-if (Signed)
-  Result = LHSAP.ssub_ov(RHSAP, Overflow);
-else
-  Result = LHSAP.usub_ov(RHSAP, Overflow);
+Result = Signed ? LHSAP.ssub_ov(RHSAP, Overflow)
+: LHSAP.usub_ov(RHSAP, Overflow);
   } else if (Opcode == BO_Mul) {
-if (Signed)
-  Result = LHSAP.smul_ov(RHSAP, Overflow);
-else
-  Result = LHSAP.umul_ov(RHSAP, Overflow);
+Result = Signed ? LHSAP.smul_ov(RHSAP, Overflow)
+: LHSAP.umul_ov(RHSAP, Overflow);
   } else if (Opcode == BO_Div || Opcode == BO_Rem) {
 if (Signed && !RHS->isZero())
   Result = LHSAP.sdiv_ov(RHSAP, Overflow);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D119351: Update all LLVM documentation mentioning runtimes in LLVM_ENABLE_PROJECTS

2022-02-09 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone added inline comments.



Comment at: bolt/docs/OptimizingClang.md:228-236
 $ CPATH=${TOPLEV}/stage1/install/bin/
-$ cmake -G Ninja ${TOPLEV}/llvm-project/llvm -DLLVM_TARGETS_TO_BUILD=X86 \
+$ cmake -G Ninja -S ${TOPLEV}/llvm-project/llvm -B ${TOPLEV}/stage2-prof-gen \
+-DLLVM_TARGETS_TO_BUILD=X86 \
 -DCMAKE_BUILD_TYPE=Release \
 -DCMAKE_C_COMPILER=$CPATH/clang -DCMAKE_CXX_COMPILER=$CPATH/clang++ \
 -DLLVM_ENABLE_PROJECTS="clang;lld" \
 -DLLVM_USE_LINKER=lld -DLLVM_BUILD_INSTRUMENTED=ON \

FWIW, I personally prefer to run cmake and ninja //from// the build directory, 
i.e.
```
$ mkdir ${TOPLEV}/llvm-project/llvm/stage2-prof-gen
$ cd ${TOPLEV}/llvm-project/llvm/stage2-prof-gen
$ CPATH=${TOPLEV}/stage1/install/bin
$ cmake -G Ninja \
-DLLVM_TARGETS_TO_BUILD=X86 \
~~~
-DCMAKE_INSTALL_PREFIX=${TOPLEV}/stage2-prof-gen/install \
../llvm-project/llvm
$ ninja install
```
This is the style that was used in `DataFlowSanitizer.rst` below, which you 
explicitly moved away from into `-B`/`-S`/`-C` land (where I find it harder to 
keep straight all the different extra options that are needed).

Orthogonally, I'm worried that the advice on lines 73–74 of README.md doesn't 
mention `CMAKE_INSTALL_PREFIX`. When I'm building libc++ locally as part of my 
development workflow, I //absolutely do not// want to blow away my computer's 
default standard library installation; but what //do// I want to do? Should I 
use something like `-DCMAKE_INSTALL_PREFIX=$(pwd)/install` as depicted here? 
Can I really not get away with "running it out of the buildroot" the way I'm 
used to?— I //must// install it somewhere on my system in order to test it at 
all?



Comment at: flang/README.md:37
+If you are interested in writing new documentation, follow
 [markdown style guide from 
LLVM](https://github.com/llvm/llvm-project/blob/main/llvm/docs/MarkdownQuickstartTemplate.md).
 




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119351

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


[PATCH] D119362: [NFC] Make file offsets a regex to handle CRLF

2022-02-09 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

I think this NFC change is reasonable. We do lose a bit of JSON dumping test 
coverage from it (I don't see any tests for the offset there now), but I am 
okay with that as I don't think offsets are something that can be relied upon 
to be stable values anyway (we pick new source locations for things as we 
improve fidelity in the compiler).

LGTM, thank you for this!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119362

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


[PATCH] D119363: [clang] Add `ObjCProtocolLoc` to represent protocol references

2022-02-09 Thread David Goldman via Phabricator via cfe-commits
dgoldman created this revision.
Herald added subscribers: usaxena95, kadircet.
dgoldman requested review of this revision.
Herald added subscribers: cfe-commits, ilya-biryukov.
Herald added a project: clang.

Add `ObjCProtocolLoc` which behaves like `TypeLoc` but for
`ObjCProtocolDecl` references.

RecursiveASTVisitor now synthesizes `ObjCProtocolLoc` during traversal
and the `ObjCProtocolLoc` can be stored in a `DynTypedNode`.

In a follow up patch, I'll update clangd to make use of this
to properly support protocol references for hover + goto definition.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119363

Files:
  clang/include/clang/AST/ASTFwd.h
  clang/include/clang/AST/ASTTypeTraits.h
  clang/include/clang/AST/RecursiveASTVisitor.h
  clang/include/clang/AST/TypeLoc.h
  clang/lib/AST/ASTTypeTraits.cpp
  clang/lib/AST/ParentMapContext.cpp

Index: clang/lib/AST/ParentMapContext.cpp
===
--- clang/lib/AST/ParentMapContext.cpp
+++ clang/lib/AST/ParentMapContext.cpp
@@ -330,6 +330,10 @@
 DynTypedNode createDynTypedNode(const NestedNameSpecifierLoc &Node) {
   return DynTypedNode::create(Node);
 }
+template <>
+DynTypedNode createDynTypedNode(const ObjCProtocolLoc &Node) {
+  return DynTypedNode::create(Node);
+}
 /// @}
 
 /// A \c RecursiveASTVisitor that builds a map from nodes to their
@@ -433,6 +437,12 @@
 AttrNode, AttrNode, [&] { return VisitorBase::TraverseAttr(AttrNode); },
 &Map.PointerParents);
   }
+  bool TraverseObjCProtocolLoc(ObjCProtocolLoc ProtocolLocNode) {
+return TraverseNode(
+ProtocolLocNode, DynTypedNode::create(ProtocolLocNode),
+[&] { return VisitorBase::TraverseObjCProtocolLoc(ProtocolLocNode); },
+&Map.OtherParents);
+  }
 
   // Using generic TraverseNode for Stmt would prevent data-recursion.
   bool dataTraverseStmtPre(Stmt *StmtNode) {
Index: clang/lib/AST/ASTTypeTraits.cpp
===
--- clang/lib/AST/ASTTypeTraits.cpp
+++ clang/lib/AST/ASTTypeTraits.cpp
@@ -16,6 +16,7 @@
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Attr.h"
 #include "clang/AST/DeclCXX.h"
+#include "clang/AST/DeclObjC.h"
 #include "clang/AST/NestedNameSpecifier.h"
 #include "clang/AST/OpenMPClause.h"
 #include "clang/AST/TypeLoc.h"
@@ -52,6 +53,7 @@
 {NKI_None, "Attr"},
 #define ATTR(A) {NKI_Attr, #A "Attr"},
 #include "clang/Basic/AttrList.inc"
+{NKI_None, "ObjCProtocolLoc"},
 };
 
 bool ASTNodeKind::isBaseOf(ASTNodeKind Other, unsigned *Distance) const {
@@ -193,6 +195,8 @@
 QualType(T, 0).print(OS, PP);
   else if (const Attr *A = get())
 A->printPretty(OS, PP);
+  else if (const ObjCProtocolLoc *P = get())
+P->Protocol->print(OS, PP);
   else
 OS << "Unable to print values of type " << NodeKind.asStringRef() << "\n";
 }
@@ -228,5 +232,7 @@
 return CBS->getSourceRange();
   if (const auto *A = get())
 return A->getRange();
+  if (const ObjCProtocolLoc *P = get())
+return P->getSourceRange();
   return SourceRange();
 }
Index: clang/include/clang/AST/TypeLoc.h
===
--- clang/include/clang/AST/TypeLoc.h
+++ clang/include/clang/AST/TypeLoc.h
@@ -2607,6 +2607,20 @@
 : public InheritingConcreteTypeLoc {};
 
+class ObjCProtocolLoc {
+public:
+  const ObjCProtocolDecl *Protocol = nullptr;
+  SourceLocation Loc = SourceLocation();
+
+  /// Get the full source range.
+  SourceRange getSourceRange() const LLVM_READONLY {
+return SourceRange(Loc, Loc);
+  }
+
+  /// Evaluates true when this protocol loc is valid/non-empty.
+  explicit operator bool() const { return Protocol; }
+};
+
 } // namespace clang
 
 #endif // LLVM_CLANG_AST_TYPELOC_H
Index: clang/include/clang/AST/RecursiveASTVisitor.h
===
--- clang/include/clang/AST/RecursiveASTVisitor.h
+++ clang/include/clang/AST/RecursiveASTVisitor.h
@@ -324,6 +324,12 @@
   /// \returns false if the visitation was terminated early, true otherwise.
   bool TraverseConceptReference(const ConceptReference &C);
 
+  /// Recursively visit an Objective-C protocol reference with location
+  /// information.
+  ///
+  /// \returns false if the visitation was terminated early, true otherwise.
+  bool TraverseObjCProtocolLoc(ObjCProtocolLoc ProtocolLoc);
+
   //  Methods on Attrs 
 
   // Visit an attribute.
@@ -1340,7 +1346,14 @@
 DEF_TRAVERSE_TYPELOC(PackExpansionType,
  { TRY_TO(TraverseTypeLoc(TL.getPatternLoc())); })
 
-DEF_TRAVERSE_TYPELOC(ObjCTypeParamType, {})
+DEF_TRAVERSE_TYPELOC(ObjCTypeParamType, {
+  for (unsigned i = 0, n = TL.getNumProtocols(); i != n; ++i) {
+ObjCProtocolLoc ProtocolLoc;
+ProtocolLoc.Protocol = TL.getProtocol(i);
+ProtocolLoc.Loc = TL.getProtocolLoc(i);
+TRY_TO(TraverseObjCProtocolLoc(ProtocolLoc));
+  }
+})
 
 DEF_TRAVERSE_TYPELOC(ObjCInterfac

[PATCH] D119351: Update all LLVM documentation mentioning runtimes in LLVM_ENABLE_PROJECTS

2022-02-09 Thread Rafael Auler via Phabricator via cfe-commits
rafauler added a comment.

BOLT modifications LGTM, thanks


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119351

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


[PATCH] D119296: KCFI sanitizer

2022-02-09 Thread Sami Tolvanen via Phabricator via cfe-commits
samitolvanen planned changes to this revision.
samitolvanen added a comment.

Thanks for the pointers, Aaron. I'll rework the attribute code and also address 
the issues Nick pointed out in the next revision.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119296

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


[PATCH] D119296: KCFI sanitizer

2022-02-09 Thread Sami Tolvanen via Phabricator via cfe-commits
samitolvanen marked an inline comment as not done.
samitolvanen added inline comments.



Comment at: clang/include/clang/Basic/Attr.td:696
+def KCFIUnchecked : Attr {
+  let Spellings = [Clang<"kcfi_unchecked">];
+  let Subjects = SubjectList<[Var, TypedefName]>;

joaomoreira wrote:
> Are you considering that perhaps one could use KCFI and X86 CET/IBT at the 
> same time? If not, is there a reason for not just reusing the existing 
> "nocf_check" attribute?
I don't see why they couldn't be used at the same time, but the reason I'm not 
reusing `nocf_check` is that it's specific to x86 / CET and I didn't want to 
change its semantics, especially since KCFI targets other architectures too. 
Happy to hear thoughts about this, of course.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119296

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


[PATCH] D119296: KCFI sanitizer

2022-02-09 Thread Sami Tolvanen via Phabricator via cfe-commits
samitolvanen added inline comments.



Comment at: clang/lib/CodeGen/CGExpr.cpp:3168
+  -1);
+  llvm::Value *Test = Builder.CreateICmpEQ(Builder.CreateLoad(HashPtr), Hash);
+  llvm::BasicBlock *ContBB = createBasicBlock("kcfi.cont");

pcc wrote:
> We considered a scheme like this before and one problem that we discovered 
> with comparing the hash in this way is that it can produce gadgets, e.g.
> ```
> movabs $0x0123456789abcdef, %rax
> cmp %rax, ...
> ```
> the `cmp`instruction ends up being a valid target address because the 
> `movabs` instruction ends in the hash. The way we thought about solving this 
> was to introduce a new intrinsic that would materialize the constant without 
> these gadgets (e.g. invert the `movabs` operand and follow it by a `not`).
Yes, that's a concern with this approach, at least on x86_64. As the hash is 
more or less random, I assume you'd have to actually check that the inverted 
form won't have useful gadgets either, and potentially split the single 
`movabs` into multiple instructions if needed etc. Did you ever start work on 
the intrinsic or was that just an idea?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119296

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


[PATCH] D119362: [NFC] Make file offsets a regex to handle CRLF

2022-02-09 Thread Chris Bieneman via Phabricator via cfe-commits
beanz added a comment.

I realize this is a _big_ silly NFC change, but I figured I'd blast it out 
there in case anyone objects to the premise.

My goal is to eventually get to the point where Windows developers can use 
autocrlf (see the note here: 
https://llvm.org/docs/GettingStarted.html#checkout-llvm-from-git).

My assertion is that the file offset isn't the important thing any of these 
tests are testing, so making that match fuzzy makes the tests less fragile and 
get them working with CRLF line endings.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119362

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


[PATCH] D117887: [NVPTX] Expose float tys min, max, abs, neg as builtins

2022-02-09 Thread Jakub Chlanda via Phabricator via cfe-commits
jchlanda marked 2 inline comments as done.
jchlanda added inline comments.



Comment at: llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp:162
 
 SimplifyAction(Instruction::BinaryOps BinaryOp, FtzRequirementTy FtzReq)
 : BinaryOp(BinaryOp), FtzRequirement(FtzReq) {}

tra wrote:
> jchlanda wrote:
> > tra wrote:
> > > The new 3-argument constructor above obviates the need for this one.
> > I'm not sure if it does, the 3-way takes `Intrinsic`, while this one 
> > `Instruction`.
> You're right. Sorry, my mistake.
np


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117887

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


[PATCH] D119362: [NFC] Make file offsets a regex to handle CRLF

2022-02-09 Thread Chris Bieneman via Phabricator via cfe-commits
beanz created this revision.
beanz added reviewers: aaron.ballman, jyknight, rnk, dblaikie.
beanz requested review of this revision.
Herald added a project: clang.

None of these tests are really intended to test the file offset as much
as to test the structure. Making the regex allows this test to work
even if the file is checked out with CRLF line endings.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119362

Files:
  clang/test/AST/ast-dump-comment-json.cpp
  clang/test/AST/ast-dump-decl-context-json.cpp
  clang/test/AST/ast-dump-decl-json.c
  clang/test/AST/ast-dump-decl-json.m
  clang/test/AST/ast-dump-enum-json.cpp
  clang/test/AST/ast-dump-expr-json.c
  clang/test/AST/ast-dump-expr-json.cpp
  clang/test/AST/ast-dump-expr-json.m
  clang/test/AST/ast-dump-file-line-json.c
  clang/test/AST/ast-dump-funcs-json.cpp
  clang/test/AST/ast-dump-if-json.cpp
  clang/test/AST/ast-dump-macro-json.c
  clang/test/AST/ast-dump-namespace-json.cpp
  clang/test/AST/ast-dump-objc-arc-json.m
  clang/test/AST/ast-dump-record-definition-data-json.cpp
  clang/test/AST/ast-dump-records-json.cpp
  clang/test/AST/ast-dump-stmt-json.c
  clang/test/AST/ast-dump-stmt-json.cpp
  clang/test/AST/ast-dump-stmt-json.m
  clang/test/AST/ast-dump-template-decls-json.cpp
  clang/test/AST/ast-dump-temporaries-json.cpp
  clang/test/AST/ast-dump-types-errors-json.cpp
  clang/test/AST/ast-dump-types-json.cpp
  clang/test/AST/multistep-explicit-cast-json.c
  clang/test/AST/multistep-explicit-cast-json.cpp
  clang/test/Analysis/exploded-graph-rewriter/store.dot
  clang/test/Analysis/exploded-graph-rewriter/store_diff.dot
  clang/test/Analysis/expr-inspection.c

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


[PATCH] D116774: AST: Move __va_list tag back to std conditionally on AArch64.

2022-02-09 Thread Peter Collingbourne via Phabricator via cfe-commits
pcc updated this revision to Diff 407227.
pcc retitled this revision from "AST: Move __va_list tag to the top level on 
ARM architectures." to "AST: Move __va_list tag back to std conditionally on 
AArch64.".
pcc edited the summary of this revision.
pcc added a comment.

Make it conditional


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116774

Files:
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ItaniumMangle.cpp
  clang/test/CodeGen/aarch64-varargs.c
  clang/test/CodeGen/arm64-be-hfa-vararg.c
  clang/test/Headers/stdarg.cpp

Index: clang/test/Headers/stdarg.cpp
===
--- clang/test/Headers/stdarg.cpp
+++ clang/test/Headers/stdarg.cpp
@@ -15,7 +15,7 @@
 
 #include 
 
-// AARCH64-C: define {{.*}} @f(i32 noundef %n, %"struct.std::__va_list"* noundef %list)
+// AARCH64-C: define {{.*}} @f(i32 noundef %n, %struct.__va_list* noundef %list)
 // AARCH64-CXX: define {{.*}} @_Z1fiSt9__va_list(i32 noundef %n, %"struct.std::__va_list"* noundef %list)
 // X86_64-C: define {{.*}} @f(i32 noundef %n, %struct.__va_list_tag* noundef %list)
 // X86_64-CXX: define {{.*}} @_Z1fiP13__va_list_tag(i32 noundef %n, %struct.__va_list_tag* noundef %list)
Index: clang/test/CodeGen/arm64-be-hfa-vararg.c
===
--- clang/test/CodeGen/arm64-be-hfa-vararg.c
+++ clang/test/CodeGen/arm64-be-hfa-vararg.c
@@ -4,12 +4,12 @@
 
 // A single member HFA must be aligned just like a non-HFA register argument.
 double callee(int a, ...) {
-// CHECK: [[REGPP:%.*]] = getelementptr inbounds %"struct.std::__va_list", %"struct.std::__va_list"* [[VA:%.*]], i32 0, i32 2
+// CHECK: [[REGPP:%.*]] = getelementptr inbounds %struct.__va_list, %struct.__va_list* [[VA:%.*]], i32 0, i32 2
 // CHECK: [[REGP:%.*]] = load i8*, i8** [[REGPP]], align 8
 // CHECK: [[OFFSET0:%.*]] = getelementptr inbounds i8, i8* [[REGP]], i32 {{.*}}
 // CHECK: [[OFFSET1:%.*]] = getelementptr inbounds i8, i8* [[OFFSET0]], i64 8
 
-// CHECK: [[MEMPP:%.*]] = getelementptr inbounds %"struct.std::__va_list", %"struct.std::__va_list"* [[VA:%.*]], i32 0, i32 0
+// CHECK: [[MEMPP:%.*]] = getelementptr inbounds %struct.__va_list, %struct.__va_list* [[VA:%.*]], i32 0, i32 0
 // CHECK: [[MEMP:%.*]] = load i8*, i8** [[MEMPP]], align 8
 // CHECK: [[NEXTP:%.*]] = getelementptr inbounds i8, i8* [[MEMP]], i64 8
 // CHECK: store i8* [[NEXTP]], i8** [[MEMPP]], align 8
Index: clang/test/CodeGen/aarch64-varargs.c
===
--- clang/test/CodeGen/aarch64-varargs.c
+++ clang/test/CodeGen/aarch64-varargs.c
@@ -11,18 +11,18 @@
 int simple_int(void) {
 // CHECK-LABEL: define{{.*}} i32 @simple_int
   return va_arg(the_list, int);
-// CHECK: [[GR_OFFS:%[a-z_0-9]+]] = load i32, i32* getelementptr inbounds (%"struct.std::__va_list", %"struct.std::__va_list"* @the_list, i32 0, i32 3)
+// CHECK: [[GR_OFFS:%[a-z_0-9]+]] = load i32, i32* getelementptr inbounds (%struct.__va_list, %struct.__va_list* @the_list, i32 0, i32 3)
 // CHECK: [[EARLY_ONSTACK:%[a-z_0-9]+]] = icmp sge i32 [[GR_OFFS]], 0
 // CHECK: br i1 [[EARLY_ONSTACK]], label %[[VAARG_ON_STACK:[a-z_.0-9]+]], label %[[VAARG_MAYBE_REG:[a-z_.0-9]+]]
 
 // CHECK: [[VAARG_MAYBE_REG]]
 // CHECK: [[NEW_REG_OFFS:%[a-z_0-9]+]] = add i32 [[GR_OFFS]], 8
-// CHECK: store i32 [[NEW_REG_OFFS]], i32* getelementptr inbounds (%"struct.std::__va_list", %"struct.std::__va_list"* @the_list, i32 0, i32 3)
+// CHECK: store i32 [[NEW_REG_OFFS]], i32* getelementptr inbounds (%struct.__va_list, %struct.__va_list* @the_list, i32 0, i32 3)
 // CHECK: [[INREG:%[a-z_0-9]+]] = icmp sle i32 [[NEW_REG_OFFS]], 0
 // CHECK: br i1 [[INREG]], label %[[VAARG_IN_REG:[a-z_.0-9]+]], label %[[VAARG_ON_STACK]]
 
 // CHECK: [[VAARG_IN_REG]]
-// CHECK: [[REG_TOP:%[a-z_0-9]+]] = load i8*, i8** getelementptr inbounds (%"struct.std::__va_list", %"struct.std::__va_list"* @the_list, i32 0, i32 1)
+// CHECK: [[REG_TOP:%[a-z_0-9]+]] = load i8*, i8** getelementptr inbounds (%struct.__va_list, %struct.__va_list* @the_list, i32 0, i32 1)
 // CHECK: [[REG_ADDR:%[a-z_0-9]+]] = getelementptr inbounds i8, i8* [[REG_TOP]], i32 [[GR_OFFS]]
 // CHECK-BE: [[REG_ADDR_ALIGNED:%[0-9]+]] = getelementptr inbounds i8, i8* [[REG_ADDR]], i64 4
 // CHECK-BE: [[FROMREG_ADDR:%[a-z_0-9]+]] = bitcast i8* [[REG_ADDR_ALIGNED]] to i32*
@@ -30,9 +30,9 @@
 // CHECK: br label %[[VAARG_END:[a-z._0-9]+]]
 
 // CHECK: [[VAARG_ON_STACK]]
-// CHECK: [[STACK:%[a-z_0-9]+]] = load i8*, i8** getelementptr inbounds (%"struct.std::__va_list", %"struct.std::__va_list"* @the_list, i32 0, i32 0)
+// CHECK: [[STACK:%[a-z_0-9]+]] = load i8*, i8** getelementptr inbounds (%struct.__va_list, %struct.__va_list* @the_list, i32 0, i32 0)
 // CHECK: [[NEW_STACK:%[a-z_0-9]+]] = getelementptr inbounds i8, i8* [[STACK]], i64 8
-// CHECK: store i8* [[NEW_STACK]], i8** getelementptr inbounds (%"struct.s

[PATCH] D117887: [NVPTX] Expose float tys min, max, abs, neg as builtins

2022-02-09 Thread Artem Belevich via Phabricator via cfe-commits
tra added inline comments.



Comment at: llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp:162
 
 SimplifyAction(Instruction::BinaryOps BinaryOp, FtzRequirementTy FtzReq)
 : BinaryOp(BinaryOp), FtzRequirement(FtzReq) {}

jchlanda wrote:
> tra wrote:
> > The new 3-argument constructor above obviates the need for this one.
> I'm not sure if it does, the 3-way takes `Intrinsic`, while this one 
> `Instruction`.
You're right. Sorry, my mistake.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117887

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


[PATCH] D72404: [ThinLTO/FullLTO] Support Os and Oz

2022-02-09 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini added a comment.

In D72404#3307623 , @aykevl wrote:

> So, should all passes just look at the `optsize` and `minsize` attributes 
> instead of the `SizeLevel`? In other words, should 
> `PassManagerBuilder.SizeLevel` be removed and should passes only look at 
> function attributes instead of `SizeLevel`? Because at the moment, it's a 
> weird mix of both. IMHO size level should either all go via function 
> attributes or via a flag, not something in between as it is now.

I agree, I don't know (other than history) why we couldn't move towards 
removing `PassManagerBuilder.SizeLevel`?

> Also, if size level is done via function attributes, why not optimization 
> level? There is already `optnone`. I'm not saying that's better, but right 
> now I don't see the logic in this whole system.

Despite what gcc and clang exposes to their users, at the LLVM level we don't 
have a single dimension on which to put `O1/O2/O3` compared to `Os/Oz`. These 
also may not make sense for every single compiler out-there: `O1/O2/O3` for 
clang may not be the right pass pipeline for my proprietary shader compiler.
Another reason why O1 /O2 
/O3 
 are not making much such to be in 
the IR is that the IR is intended to be stored and reloaded any time in the 
middle of pipeline. LTO is an example of this, so we don't really want to store 
the "list of pass to run" in the IR.
Finally, we don't want to (or we can't really...) teach passes about whether 
they should execute during O1 /O2 
/O3 
, while `optnone` is just a "fuse" 
to disable them all. It is also convenient to have `optnone` as a function 
attribute because it allows to selectively disable the optimizer on a per 
function basis. On the other hand because of the nature of the pass pipeline, 
it can't be tweaked on a per function basis (what about Module passes?).

On the other hand the optsize/minsize are driving heuristic and can be 
orthogonal to the pass pipeline / controlled on a per-function basis and made 
available to every pass: they convey an "optimization goal" that applies to 
every pass individually.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72404

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


[clang] 8073da0 - [NFC] Fix sign-compare warning in GrammarBNF thanks to int promotion

2022-02-09 Thread Erich Keane via cfe-commits

Author: Erich Keane
Date: 2022-02-09T11:25:58-08:00
New Revision: 8073da0beed804d0cef1697b72fdc4151457a327

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

LOG: [NFC] Fix sign-compare warning in GrammarBNF thanks to int promotion

Added: 


Modified: 
clang/lib/Tooling/Syntax/Pseudo/GrammarBNF.cpp

Removed: 




diff  --git a/clang/lib/Tooling/Syntax/Pseudo/GrammarBNF.cpp 
b/clang/lib/Tooling/Syntax/Pseudo/GrammarBNF.cpp
index cf3e3e10ec540..b19bed3449ba9 100644
--- a/clang/lib/Tooling/Syntax/Pseudo/GrammarBNF.cpp
+++ b/clang/lib/Tooling/Syntax/Pseudo/GrammarBNF.cpp
@@ -225,7 +225,7 @@ class GrammarBuilder {
 "Token-like name {0} is used as a nonterminal", 
G.symbolName(SID)));
   }
 }
-for (RuleID RID = 0; RID + 1 < T.Rules.size(); ++RID) {
+for (RuleID RID = 0; RID + 1u < T.Rules.size(); ++RID) {
   if (T.Rules[RID] == T.Rules[RID + 1])
 Diagnostics.push_back(
 llvm::formatv("Duplicate rule: `{0}`", G.dumpRule(RID)));



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


[PATCH] D117887: [NVPTX] Expose float tys min, max, abs, neg as builtins

2022-02-09 Thread Jakub Chlanda via Phabricator via cfe-commits
jchlanda added inline comments.



Comment at: llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp:162
 
 SimplifyAction(Instruction::BinaryOps BinaryOp, FtzRequirementTy FtzReq)
 : BinaryOp(BinaryOp), FtzRequirement(FtzReq) {}

tra wrote:
> The new 3-argument constructor above obviates the need for this one.
I'm not sure if it does, the 3-way takes `Intrinsic`, while this one 
`Instruction`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117887

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


[PATCH] D117887: [NVPTX] Expose float tys min, max, abs, neg as builtins

2022-02-09 Thread Artem Belevich via Phabricator via cfe-commits
tra added inline comments.



Comment at: llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp:162
 
 SimplifyAction(Instruction::BinaryOps BinaryOp, FtzRequirementTy FtzReq)
 : BinaryOp(BinaryOp), FtzRequirement(FtzReq) {}

The new 3-argument constructor above obviates the need for this one.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117887

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


[PATCH] D118847: Added early exit for defaulted FunctionDecls.

2022-02-09 Thread Fabian Keßler via Phabricator via cfe-commits
Febbe marked an inline comment as done.
Febbe added a comment.

Thank you for the review. I am done and you can commit the patch :) . I don't 
have the rights to commit.


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

https://reviews.llvm.org/D118847

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


[PATCH] D118847: Added early exit for defaulted FunctionDecls.

2022-02-09 Thread Fabian Keßler via Phabricator via cfe-commits
Febbe updated this revision to Diff 407200.
Febbe marked 4 inline comments as done.
Febbe added a comment.

Last batch of suggested changes


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

https://reviews.llvm.org/D118847

Files:
  clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp
  
clang-tools-extra/test/clang-tidy/checkers/modernize-use-trailing-return-type-cxx20.cpp


Index: 
clang-tools-extra/test/clang-tidy/checkers/modernize-use-trailing-return-type-cxx20.cpp
===
--- 
clang-tools-extra/test/clang-tidy/checkers/modernize-use-trailing-return-type-cxx20.cpp
+++ 
clang-tools-extra/test/clang-tidy/checkers/modernize-use-trailing-return-type-cxx20.cpp
@@ -52,3 +52,49 @@
 T req2(T t) requires requires { t + t; };
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use a trailing return type for 
this function [modernize-use-trailing-return-type]
   // CHECK-FIXES: {{^}}auto req2(T t) -> T requires requires { t + t; };{{$}}
+
+//
+// Operator c++20 defaulted comparison operators
+//
+// Requires 
+
+namespace std {
+struct strong_ordering {
+  using value_type = signed char;
+  static strong_ordering const less;
+  static strong_ordering const equal;
+  static strong_ordering const equivalent;
+  static strong_ordering const greater;
+
+  constexpr strong_ordering(value_type v) : val(v) {}
+  template 
+  requires(T{0}) friend constexpr auto
+  operator==(strong_ordering v, T u) noexcept -> bool {
+return v.val == u;
+  }
+  friend constexpr auto operator==(strong_ordering v, strong_ordering w) 
noexcept -> bool = default;
+
+  value_type val{};
+};
+inline constexpr strong_ordering strong_ordering::less{-1};
+inline constexpr strong_ordering strong_ordering::equal{0};
+inline constexpr strong_ordering strong_ordering::equivalent{0};
+inline constexpr strong_ordering strong_ordering::greater{1};
+
+} // namespace std
+
+struct TestDefaultOperatorA {
+  int a{};
+  int b{};
+
+  friend auto operator<=>(const TestDefaultOperatorA &, const 
TestDefaultOperatorA &) noexcept = default;
+};
+
+struct TestDefaultOperatorB {
+  int a{};
+  int b{};
+  friend auto operator==(const TestDefaultOperatorB &, const 
TestDefaultOperatorB &) noexcept -> bool = default;
+  friend bool operator<(const TestDefaultOperatorB &, const 
TestDefaultOperatorB &) noexcept = default;
+  // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: use a trailing return type for 
this function [modernize-use-trailing-return-type]
+  // CHECK-FIXES: {{^}}  friend auto operator<(const TestDefaultOperatorB &, 
const TestDefaultOperatorB &) noexcept -> bool = default;{{$}}
+};
Index: clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp
===
--- clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp
+++ clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp
@@ -404,14 +404,17 @@
   const auto *Fr = Result.Nodes.getNodeAs("Friend");
   assert(F && "Matcher is expected to find only FunctionDecls");

-  if (F->getLocation().isInvalid())
+  // Three-way comparison operator<=> is syntactic sugar and generates implicit
+  // nodes for all other operators.
+  if (F->getLocation().isInvalid() || F->isImplicit())
 return;

-  // Skip functions which return just 'auto'.
+  // Skip functions which return 'auto' and defaulted operators.
   const auto *AT = F->getDeclaredReturnType()->getAs();
-  if (AT != nullptr && !AT->isConstrained() &&
-  AT->getKeyword() == AutoTypeKeyword::Auto &&
-  !hasAnyNestedLocalQualifiers(F->getDeclaredReturnType()))
+  if (AT != nullptr &&
+  ((!AT->isConstrained() && AT->getKeyword() == AutoTypeKeyword::Auto &&
+!hasAnyNestedLocalQualifiers(F->getDeclaredReturnType())) ||
+   F->isDefaulted()))
 return;

   // TODO: implement those


Index: clang-tools-extra/test/clang-tidy/checkers/modernize-use-trailing-return-type-cxx20.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/modernize-use-trailing-return-type-cxx20.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/modernize-use-trailing-return-type-cxx20.cpp
@@ -52,3 +52,49 @@
 T req2(T t) requires requires { t + t; };
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
   // CHECK-FIXES: {{^}}auto req2(T t) -> T requires requires { t + t; };{{$}}
+
+//
+// Operator c++20 defaulted comparison operators
+//
+// Requires 
+
+namespace std {
+struct strong_ordering {
+  using value_type = signed char;
+  static strong_ordering const less;
+  static strong_ordering const equal;
+  static strong_ordering const equivalent;
+  static strong_ordering const greater;
+
+  constexpr strong_ordering(value_type v) : val(v) {}
+  template 
+  requires(T{0}) friend constexpr auto
+  operator==(strong_ordering v, T u) no

[PATCH] D71966: [Wdocumentation][RFC] Improve identifier's of \param

2022-02-09 Thread Mark de Wever via Phabricator via cfe-commits
Mordante added a comment.

Sorry I missed your message. At the moment I don't intend to continue with this 
review. Do you want to commandeer this one or do you prefer me to abandon it?


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

https://reviews.llvm.org/D71966

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


[PATCH] D118070: Make lld-link work in a non-MSVC shell

2022-02-09 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In D118070#3308304 , @pkasting wrote:

> MaskRay: Friendly ping.

I think I still feel that having this in LLVMSupport is strange, but am happy 
if the two other folks I added are happy...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118070

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


[PATCH] D118070: Make lld-link work in a non-MSVC shell

2022-02-09 Thread Peter Kasting via Phabricator via cfe-commits
pkasting added a comment.

MaskRay: Friendly ping.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118070

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


[PATCH] D119351: Update all LLVM documentation mentioning runtimes in LLVM_ENABLE_PROJECTS

2022-02-09 Thread Louis Dionne via Phabricator via cfe-commits
ldionne created this revision.
Herald added subscribers: libcxx-commits, ayermolo, arphaman, mgorny.
Herald added a reviewer: sscalpone.
Herald added a reviewer: rafauler.
Herald added a reviewer: Amir.
Herald added a reviewer: maksfb.
Herald added projects: libunwind, Flang.
Herald added a reviewer: libunwind.
ldionne requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: llvm-commits, Sanitizers, cfe-commits, yota9, 
sstefan1, jdoerfert.
Herald added projects: clang, Sanitizers, libc++, LLVM.
Herald added a reviewer: libc++.

We are moving away from building the runtimes with LLVM_ENABLE_PROJECTS,
however the documentation was largely outdated. This commit updates all
the documentation I could find to use LLVM_ENABLE_RUNTIMES instead of
LLVM_ENABLE_PROJECTS for building runtimes.

Note that in the near future, libcxx, libcxxabi and libunwind will stop
supporting being built with LLVM_ENABLE_PROJECTS altogether. I don't know
what the plans are for other runtimes like libc, openmp and compiler-rt,
so I didn't make any changes to the documentation that would imply
something for those projects.

Once this lands, I will also cherry-pick this on the release/14.x branch
to make sure that LLVM's documentation is up-to-date and reflects what
we intend to support in the future.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119351

Files:
  README.md
  bolt/docs/OptimizingClang.md
  clang/docs/DataFlowSanitizer.rst
  clang/docs/Toolchain.rst
  compiler-rt/www/index.html
  flang/README.md
  libcxx/docs/BuildingLibcxx.rst
  libunwind/docs/BuildingLibunwind.rst
  llvm/docs/BuildingADistribution.rst
  llvm/docs/CMake.rst
  llvm/docs/GettingStarted.rst

Index: llvm/docs/GettingStarted.rst
===
--- llvm/docs/GettingStarted.rst
+++ llvm/docs/GettingStarted.rst
@@ -623,10 +623,15 @@
 | | other LLVM subprojects to additionally build. (Only|
 | | effective when using a side-by-side project layout |
 | | e.g. via git). The default list is empty. Can  |
-| | include: clang, clang-tools-extra, compiler-rt,|
-| | cross-project-tests, flang, libc, libclc, libcxx,  |
-| | libcxxabi, libunwind, lld, lldb, mlir, openmp, |
-| | polly, or pstl.|
+| | include: clang, clang-tools-extra, |
+| | cross-project-tests, flang, libc, libclc, lld, |
+| | lldb, mlir, openmp, polly, or pstl.|
++-++
+| LLVM_ENABLE_RUNTIMES| A semicolon-delimited list selecting which of the  |
+| | runtimes to build. (Only effective when using the  |
+| | full monorepo layout). The default list is empty.  |
+| | Can include: libcxx, libcxxabi, libunwind, |
+| | compiler-rt, libc, or openmp.  |
 +-++
 | LLVM_ENABLE_SPHINX  | Build sphinx-based documentation from the source   |
 | | code. This is disabled by default because it is|
@@ -1217,6 +1222,11 @@
compiling more than one project, separate the items with a semicolon. Should
you run into issues with the semicolon, try surrounding it with single quotes.
 
+* -DLLVM_ENABLE_RUNTIMES
+   Set this equal to the runtimes you wish to compile (e.g. libcxx, libcxxabi, etc.)
+   If compiling more than one runtime, separate the items with a semicolon. Should
+   you run into issues with the semicolon, try surrounding it with single quotes.
+
  * -DCLANG_ENABLE_STATIC_ANALYZER
Set this option to OFF if you do not require the clang static analyzer. This
should improve your build time slightly.
Index: llvm/docs/CMake.rst
===
--- llvm/docs/CMake.rst
+++ llvm/docs/CMake.rst
@@ -221,6 +221,10 @@
   Control which projects are enabled. For example you may want to work on clang
   or lldb by specifying ``-DLLVM_ENABLE_PROJECTS="clang;lldb"``.
 
+**LLVM_ENABLE_RUNTIMES**:STRING
+  Control which runtimes are enabled. For example you may want to work on
+  libc++ or libc++abi by specifying ``-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi"``.
+
 **LLVM_LIBDIR_SUFFIX**:STRING
   Extra suffix to append to the directory where libraries are to be
   installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
@@ -505,17 +509,17 @@
 
 **LLVM_ENABLE_PROJECTS**:STRING
   Semicolon-separated list of projects to build, or *all* for building all
-  (clang, lldb, compiler-rt, lld, polly, etc) projects. This fla

[PATCH] D119216: [AMDGPU] replace hostcall module flag with function attribute

2022-02-09 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm added inline comments.



Comment at: llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp:566
+  return false;
+};
+

sameerds wrote:
> sameerds wrote:
> > jdoerfert wrote:
> > > sameerds wrote:
> > > > jdoerfert wrote:
> > > > > sameerds wrote:
> > > > > > jdoerfert wrote:
> > > > > > > jdoerfert wrote:
> > > > > > > > sameerds wrote:
> > > > > > > > > jdoerfert wrote:
> > > > > > > > > > You can use AAPointerInfo for the call site return 
> > > > > > > > > > IRPosition. It will (through the iterations) gather all 
> > > > > > > > > > accesses and put them into "bins" based on offset and size. 
> > > > > > > > > > It deals with uses in calls, etc. and if there is stuff 
> > > > > > > > > > missing it is better to add it in one place so we benefit 
> > > > > > > > > > throughout. 
> > > > > > > > > I am not following what you have in mind. "implicitarg_ptr" 
> > > > > > > > > is a pointer returned by an intrinsic that reads an 
> > > > > > > > > ABI-defined register. I need to check that for a given 
> > > > > > > > > call-graph, a particular range of bytes relative to that base 
> > > > > > > > > pointer are never accessed. The above DFS on the uses 
> > > > > > > > > conservatively assumes that such a load exists unless it can 
> > > > > > > > > conclusively trace every use of the base pointer. This may 
> > > > > > > > > include the pointer being passed to an extern function or 
> > > > > > > > > being stored into a different memory location (although we 
> > > > > > > > > don't expect ABI registers being capture this way). I am not 
> > > > > > > > > seeing how to construct this around AAPointerInfo. As far as 
> > > > > > > > > I can see, the public interface only talks about uses that 
> > > > > > > > > are recognized as loads and stores.
> > > > > > > > Not actually tested, replaces the function body. Depends on 
> > > > > > > > D119249.
> > > > > > > > ```
> > > > > > > > const auto PointerInfoAA = A.getAAFor(*this, 
> > > > > > > > IRPosition::callback_returned(cast(Ptr)), 
> > > > > > > > DepClassTy::Required);
> > > > > > > > if (!PointerInfoAA.getState().isValidState())
> > > > > > > >   return true; // Abort (which is weird as false is abort in 
> > > > > > > > the other CB).
> > > > > > > > AAPointerInfo::OffsetAndSize OAS(*Position, /* probably look 
> > > > > > > > pointer width up in DL */ 8);
> > > > > > > > return !forallInterferingAccesses(OAS, [](const 
> > > > > > > > AAPointerInfo::Access &Acc, bool IsExact) {
> > > > > > > >return Acc.getRemoteInst()->isDroppable(); });
> > > > > > > > ```
> > > > > > > You don't actually need the state check.
> > > > > > > And as I said, this will take care of following pointers passed 
> > > > > > > into callees or through memory to other places, all while 
> > > > > > > ignoring dead code, etc.
> > > > > > I see now. forallInterferingAccesses() does check for valid state 
> > > > > > on entry, which is sufficient to take care of all the opaque uses 
> > > > > > like a call to an extern function or a complicated phi or a 
> > > > > > capturing store. Thanks a ton ... this has been very educational!
> > > > > Yes, all "forAll" functions will return `false` if we cannot visit 
> > > > > "all". Though, these methods will utilize the smarts, e.g., ignore 
> > > > > what is dead, look at loads if the value is stored in a way we can 
> > > > > track it through memory, transfer accesses in a callee to the caller 
> > > > > "space" if a pointer is passed to the callee,... etc.
> > > > > Yes, all "forAll" functions will return `false` if we cannot visit 
> > > > > "all". Though, these methods will utilize the smarts, e.g., ignore 
> > > > > what is dead, look at loads if the value is stored in a way we can 
> > > > > track it through memory, transfer accesses in a callee to the caller 
> > > > > "space" if a pointer is passed to the callee,... etc.
> > > > 
> > > > @jdoerfert, do you see  D119249 landing soon? We are kinda on a short 
> > > > runway here (less than a handful of days) and hoping to land this 
> > > > review quickly because it solves an important issue. I would prefer to 
> > > > have the check that you outlined, but the alternative is to let my 
> > > > version through now, and then update it when the new interface becomes 
> > > > available.
> > > Did you test my proposed code? I'll land my patch tomorrow, if yours 
> > > works as you expect with the proposed AAPointerInfo use, great. If it 
> > > doesn't I don't necessarily mind you merging something else with a clear 
> > > intention to address issues and remove duplication as we go.
> > > 
> > > I can lift my commit block as we go and @arsenm can also give it a 
> > > good-to-go if need be.
> > Lifting your commit block would be useful in general. I certainly do not 
> > intend to submit something in a hurry.
> > 
> > I applied your change and tested the proposed code. It gives more 
> > pessimistic results than my original crude version, i.e.,

[PATCH] D116261: [Clang][OpenMP] Add support for compare capture in parser

2022-02-09 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: clang/lib/AST/OpenMPClause.cpp:1804
+void OMPClausePrinter::VisitOMPCompareCaptureClause(OMPCompareCaptureClause *) 
{
+  // Do nothing as it is dummy.
+}

tianshilei1992 wrote:
> ABataev wrote:
> > Output?
> I did it on purpose because `OMPCompareCaptureClause` is a dummy node. When 
> it is visited (I really doubt if it can be visited because we don't create it 
> explicitly), it should not output any thing. `compare` and `capture` are 
> printed when visiting the two clauses.
Why? I see ActOnOpenMPCompareCaptureClause, which creates such nodes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116261

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


[PATCH] D118199: [AArch64] ACLE feature macro for Armv8.8-A MOPS

2022-02-09 Thread Son Tuan Vu via Phabricator via cfe-commits
tyb0807 updated this revision to Diff 407159.
tyb0807 added a comment.

Turn off warnings for negative tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118199

Files:
  clang/lib/Basic/Targets/AArch64.cpp
  clang/test/CodeGen/aarch64-mops.c
  clang/test/Preprocessor/aarch64-target-features.c

Index: clang/test/Preprocessor/aarch64-target-features.c
===
--- clang/test/Preprocessor/aarch64-target-features.c
+++ clang/test/Preprocessor/aarch64-target-features.c
@@ -510,9 +510,21 @@
 // CHECK-NO-SVE-VECTOR-BITS-NOT: __ARM_FEATURE_SVE_BITS
 // CHECK-NO-SVE-VECTOR-BITS-NOT: __ARM_FEATURE_SVE_VECTOR_OPERATORS
 
-// == Check Largse System Extensions (LSE)
+// == Check Large System Extensions (LSE)
 // RUN: %clang -target aarch64-none-linux-gnu -march=armv8-a+lse -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-LSE %s
 // RUN: %clang -target arm64-none-linux-gnu -march=armv8-a+lse -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-LSE %s
 // RUN: %clang -target aarch64-none-linux-gnu -march=armv8.1-a -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-LSE %s
 // RUN: %clang -target arm64-none-linux-gnu -march=armv8.1-a -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-LSE %s
 // CHECK-LSE: __ARM_FEATURE_ATOMICS 1
+
+// == Check Armv8.8-A/Armv9.3-A memcpy and memset acceleration instructions (MOPS)
+// RUN: %clang -target aarch64-arm-none-eabi -march=armv8.7-a  -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-NOMOPS %s
+// RUN: %clang -target aarch64-arm-none-eabi -march=armv8.7-a+mops -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-MOPS   %s
+// RUN: %clang -target aarch64-arm-none-eabi -march=armv8.8-a  -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-MOPS   %s
+// RUN: %clang -target aarch64-arm-none-eabi -march=armv8.8-a+mops -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-MOPS   %s
+// RUN: %clang -target aarch64-arm-none-eabi -march=armv9.2-a  -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-NOMOPS %s
+// RUN: %clang -target aarch64-arm-none-eabi -march=armv9.2-a+mops -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-MOPS   %s
+// RUN: %clang -target aarch64-arm-none-eabi -march=armv9.3-a  -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-MOPS   %s
+// RUN: %clang -target aarch64-arm-none-eabi -march=armv9.3-a+mops -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-MOPS   %s
+// CHECK-MOPS: __ARM_FEATURE_MOPS 1
+// CHECK-NOMOPS-NOT: __ARM_FEATURE_MOPS 1
Index: clang/test/CodeGen/aarch64-mops.c
===
--- clang/test/CodeGen/aarch64-mops.c
+++ clang/test/CodeGen/aarch64-mops.c
@@ -1,153 +1,77 @@
-// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
+// RUN: %clang_cc1 -triple aarch64-arm-unknown-eabi -target-feature +mops -target-feature +mte -w -S -emit-llvm -o - %s  | FileCheck --check-prefix=CHECK-MOPS   %s
+// RUN: %clang_cc1 -triple aarch64-arm-unknown-eabi -target-feature +mops  -w -S -emit-llvm -o - %s  | FileCheck --check-prefix=CHECK-NOMOPS %s
+// RUN: %clang_cc1 -triple aarch64-arm-unknown-eabi   -target-feature +mte -w -S -emit-llvm -o - %s  | FileCheck --check-prefix=CHECK-NOMOPS %s
+// RUN: %clang_cc1 -triple aarch64-arm-unknown-eabi-w -S -emit-llvm -o - %s  | FileCheck --check-prefix=CHECK-NOMOPS %s
 
-// RUN: %clang_cc1 -triple aarch64-arm-unknown-eabi -target-feature +mops -target-feature +mte -S -emit-llvm -o - %s  | FileCheck %s
-
-#define __ARM_FEATURE_MOPS 1
 #include 
 #include 
 
-// CHECK-LABEL: @bzero_0(
-// CHECK-NEXT:  entry:
-// CHECK-NEXT:[[DST_ADDR:%.*]] = alloca i8*, align 8
-// CHECK-NEXT:store i8* [[DST:%.*]], i8** [[DST_ADDR]], align 8
-// CHECK-NEXT:[[TMP0:%.*]] = load i8*, i8** [[DST_ADDR]], align 8
-// CHECK-NEXT:[[TMP1:%.*]] = call i8* @llvm.aarch64.mops.memset.tag(i8* [[TMP0]], i8 0, i64 0)
-// CHECK-NEXT:ret i8* [[TMP1]]
-//
+// CHECK-LABEL:   @bzero_0(
+// CHECK-MOPS:@llvm.aarch64.mops.memset.tag
+// CHECK-NOMOPS-NOT:  @llvm.aarch64.mops.memset.tag
 void *bzero_0(void *dst) {
   return __arm_mops_memset_tag(dst, 0, 0);
 }
 
-// CHECK-LABEL: @bzero_1(
-// CHECK-NEXT:  entry:
-// CHECK-NEXT:[[DST_ADDR:%.*]] = alloca i8*, align 8
-// CHECK-NEXT:store i8* [[DST:%.*]], i8** [[DST_ADDR]], align 8
-// CHECK-NEXT:[[TMP0:%.*]] = load i8*, i8** [[DST_ADDR]], align 8
-// CHECK-NEXT:[[TMP1:%.*]] = call i8* @llvm.aarch64.mops.memset.tag(i8* [[TMP0]], i8 0, i64 1)
-// CHECK-NEXT:ret i8* [[TMP1]]
-//
+// CHECK-LABEL:   @bzero_1(
+// CHECK-MOPS:@llvm.aarch64.mops.memset.tag
+// CHECK-NOMOPS-NOT:  @llvm.aarch64.mops.memset.tag
 void *bzero_1(void *dst) {
   return __arm_mops_memset_tag(dst, 0, 1);
 }
 
-//

[clang] a464444 - [OpenCL][Docs] Update OpenCL 3.0 status info

2022-02-09 Thread Sven van Haastregt via cfe-commits

Author: Sven van Haastregt
Date: 2022-02-09T15:12:49Z
New Revision: a46b2888b9d0fcfb712897f0110cadb84d93

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

LOG: [OpenCL][Docs] Update OpenCL 3.0 status info

Update the table to reflect recently committed work.

Added: 


Modified: 
clang/docs/OpenCLSupport.rst

Removed: 




diff  --git a/clang/docs/OpenCLSupport.rst b/clang/docs/OpenCLSupport.rst
index c1202601d48d3..7303c2b4e645b 100644
--- a/clang/docs/OpenCLSupport.rst
+++ b/clang/docs/OpenCLSupport.rst
@@ -382,17 +382,17 @@ implementation status.
 
+--+-+-+--+--+
 | Feature optionality  | Generic address space 
| :good:`done` | https://reviews.llvm.org/D95778 
and https://reviews.llvm.org/D103401 |
 
+--+-+-+--+--+
-| Feature optionality  | Builtin function overloads with generic 
address space | :good:`done` | 
https://reviews.llvm.org/D105526
 |
+| Feature optionality  | Builtin function overloads with generic 
address space | :good:`done` | 
https://reviews.llvm.org/D105526 and https://reviews.llvm.org/D107769   
 |
 
+--+-+-+--+--+
 | Feature optionality  | Program scope variables in global memory  
| :good:`done` | https://reviews.llvm.org/D103191   
  |
 
+--+-+-+--+--+
 | Feature optionality  | 3D image writes including builtin functions   
| :part:`worked on`| https://reviews.llvm.org/D106260 
(frontend)  |
 
+--+-+-+--+--+
-| Feature optionality  | read_write images including builtin functions 
| :part:`worked on`| https://reviews.llvm.org/D104915 
(frontend) and https://reviews.llvm.org/D107539 (functions) |
+| Feature optionality  | read_write images including builtin functions 
| :good:`done` | https://reviews.llvm.org/D104915 
(frontend) and https://reviews.llvm.org/D107539 (functions) |
 
+--+-+-+--+--+
 | Feature optionality  | C11 atomics memory scopes, ordering and 
builtin function  | :good:`done` | 
https://reviews.llvm.org/D106111
 |
 
+--+-+-+--+--+
-| Feature optionality  | Blocks and Device-side kernel enqueue 
including builtin functions | :none:`unclaimed`|
  |
+| Feature optionality  | Blocks and Device-side kernel enqueue 
including builtin functions | :part:`worked on`| 
https://reviews.llvm.org/D118605
 |
 
+--+-+-+--+--+
 | Feature optionality  | Pipes including builtin functions 
| :good:`done` | https://reviews.llvm.org/D107154 
(frontend) and https://reviews.llvm.org/D105858 (funct

[PATCH] D118199: [AArch64] ACLE feature macro for Armv8.8-A MOPS

2022-02-09 Thread Son Tuan Vu via Phabricator via cfe-commits
tyb0807 updated this revision to Diff 407155.
tyb0807 added a comment.

Fix buildbots failures


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118199

Files:
  clang/lib/Basic/Targets/AArch64.cpp
  clang/test/CodeGen/aarch64-mops.c
  clang/test/Preprocessor/aarch64-target-features.c

Index: clang/test/Preprocessor/aarch64-target-features.c
===
--- clang/test/Preprocessor/aarch64-target-features.c
+++ clang/test/Preprocessor/aarch64-target-features.c
@@ -510,9 +510,21 @@
 // CHECK-NO-SVE-VECTOR-BITS-NOT: __ARM_FEATURE_SVE_BITS
 // CHECK-NO-SVE-VECTOR-BITS-NOT: __ARM_FEATURE_SVE_VECTOR_OPERATORS
 
-// == Check Largse System Extensions (LSE)
+// == Check Large System Extensions (LSE)
 // RUN: %clang -target aarch64-none-linux-gnu -march=armv8-a+lse -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-LSE %s
 // RUN: %clang -target arm64-none-linux-gnu -march=armv8-a+lse -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-LSE %s
 // RUN: %clang -target aarch64-none-linux-gnu -march=armv8.1-a -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-LSE %s
 // RUN: %clang -target arm64-none-linux-gnu -march=armv8.1-a -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-LSE %s
 // CHECK-LSE: __ARM_FEATURE_ATOMICS 1
+
+// == Check Armv8.8-A/Armv9.3-A memcpy and memset acceleration instructions (MOPS)
+// RUN: %clang -target aarch64-arm-none-eabi -march=armv8.7-a  -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-NOMOPS %s
+// RUN: %clang -target aarch64-arm-none-eabi -march=armv8.7-a+mops -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-MOPS   %s
+// RUN: %clang -target aarch64-arm-none-eabi -march=armv8.8-a  -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-MOPS   %s
+// RUN: %clang -target aarch64-arm-none-eabi -march=armv8.8-a+mops -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-MOPS   %s
+// RUN: %clang -target aarch64-arm-none-eabi -march=armv9.2-a  -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-NOMOPS %s
+// RUN: %clang -target aarch64-arm-none-eabi -march=armv9.2-a+mops -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-MOPS   %s
+// RUN: %clang -target aarch64-arm-none-eabi -march=armv9.3-a  -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-MOPS   %s
+// RUN: %clang -target aarch64-arm-none-eabi -march=armv9.3-a+mops -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-MOPS   %s
+// CHECK-MOPS: __ARM_FEATURE_MOPS 1
+// CHECK-NOMOPS-NOT: __ARM_FEATURE_MOPS 1
Index: clang/test/CodeGen/aarch64-mops.c
===
--- clang/test/CodeGen/aarch64-mops.c
+++ clang/test/CodeGen/aarch64-mops.c
@@ -1,153 +1,77 @@
-// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
+// RUN: %clang_cc1 -triple aarch64-arm-unknown-eabi -target-feature +mops -target-feature +mte -S -emit-llvm -o - %s  | FileCheck --check-prefix=CHECK-MOPS   %s
+// RUN: %clang_cc1 -triple aarch64-arm-unknown-eabi -target-feature +mops  -S -emit-llvm -o - %s  | FileCheck --check-prefix=CHECK-NOMOPS %s
+// RUN: %clang_cc1 -triple aarch64-arm-unknown-eabi   -target-feature +mte -S -emit-llvm -o - %s  | FileCheck --check-prefix=CHECK-NOMOPS %s
+// RUN: %clang_cc1 -triple aarch64-arm-unknown-eabi-S -emit-llvm -o - %s  | FileCheck --check-prefix=CHECK-NOMOPS %s
 
-// RUN: %clang_cc1 -triple aarch64-arm-unknown-eabi -target-feature +mops -target-feature +mte -S -emit-llvm -o - %s  | FileCheck %s
-
-#define __ARM_FEATURE_MOPS 1
 #include 
 #include 
 
-// CHECK-LABEL: @bzero_0(
-// CHECK-NEXT:  entry:
-// CHECK-NEXT:[[DST_ADDR:%.*]] = alloca i8*, align 8
-// CHECK-NEXT:store i8* [[DST:%.*]], i8** [[DST_ADDR]], align 8
-// CHECK-NEXT:[[TMP0:%.*]] = load i8*, i8** [[DST_ADDR]], align 8
-// CHECK-NEXT:[[TMP1:%.*]] = call i8* @llvm.aarch64.mops.memset.tag(i8* [[TMP0]], i8 0, i64 0)
-// CHECK-NEXT:ret i8* [[TMP1]]
-//
+// CHECK-LABEL:   @bzero_0(
+// CHECK-MOPS:@llvm.aarch64.mops.memset.tag
+// CHECK-NOMOPS-NOT:  @llvm.aarch64.mops.memset.tag
 void *bzero_0(void *dst) {
   return __arm_mops_memset_tag(dst, 0, 0);
 }
 
-// CHECK-LABEL: @bzero_1(
-// CHECK-NEXT:  entry:
-// CHECK-NEXT:[[DST_ADDR:%.*]] = alloca i8*, align 8
-// CHECK-NEXT:store i8* [[DST:%.*]], i8** [[DST_ADDR]], align 8
-// CHECK-NEXT:[[TMP0:%.*]] = load i8*, i8** [[DST_ADDR]], align 8
-// CHECK-NEXT:[[TMP1:%.*]] = call i8* @llvm.aarch64.mops.memset.tag(i8* [[TMP0]], i8 0, i64 1)
-// CHECK-NEXT:ret i8* [[TMP1]]
-//
+// CHECK-LABEL:   @bzero_1(
+// CHECK-MOPS:@llvm.aarch64.mops.memset.tag
+// CHECK-NOMOPS-NOT:  @llvm.aarch64.mops.memset.tag
 void *bzero_1(void *dst) {
   return __arm_mops_memset_tag(dst, 0, 1);
 }
 
-// CHECK-LABEL: @bzero_10(
-

[PATCH] D118437: [NFC] [Modules] Refactor ODR checking for default template argument in ASTReader

2022-02-09 Thread Nathan Sidwell via Phabricator via cfe-commits
urnathan accepted this revision.
urnathan added a comment.
This revision is now accepted and ready to land.

ok, thanks for considering the suggestion.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118437

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


[PATCH] D118605: [OpenCL] Add support of language builtins for OpenCL C 3.0

2022-02-09 Thread Sven van Haastregt via Phabricator via cfe-commits
svenvh added inline comments.



Comment at: clang/include/clang/Basic/Builtins.def:88
 //   '__builtin_' prefix. It will be implemented in compiler-rt or libgcc.
+//  G -> this function uses generic address space (OpenCL).
+//  P -> this function uses pipes (OpenCL).

azabaznov wrote:
> Anastasia wrote:
> > azabaznov wrote:
> > > Anastasia wrote:
> > > > Anastasia wrote:
> > > > > It might be better to avoid adding such limited language-specific 
> > > > > functionality into generic representation of Builtins. Do you think 
> > > > > could we could just introduce specific language modes, say:
> > > > > 
> > > > > `OCLC_PIPES`
> > > > > `OCLC_DSE`
> > > > > `OCLC_GAS`
> > > > > 
> > > > > and then check against those in `builtinIsSupported`?
> > > > Btw another approach could be to do something similar to 
> > > > `TARGET_BUILTIN` i.e. list features in the last parameter as strings. 
> > > > We could add a separate macro for such builtins and just reuse target 
> > > > Builtins flow. This might be a bit more scalable in case we would need 
> > > > to add more of such builtins later on?
> > > > 
> > > > It might be better to avoid adding such limited language-specific 
> > > > functionality into generic representation of Builtins.
> > > 
> > > Nice idea! Though I think LanguageID is not designed to be used this way, 
> > > it's used only to check against specific language version. So it seems 
> > > pretty invasive. Also, function attributes seem more natural to me to 
> > > specify the type of the function. I don't know for sure which way is 
> > > better...
> > > 
> > > > Btw another approach could be to do something similar to TARGET_BUILTIN 
> > > > i.e. list features in the last parameter as strings.
> > > 
> > > I'd prefer to not use TARGET_BUILTIN as it operates on target feature, 
> > > but OpenCL feature is some other concept in clang...
> > Buitlins handling is pretty vital for clang so if we extend common 
> > functionality for just a few built-in functions it might not justify the 
> > overhead in terms of complexity, parsing time or space... so we would need 
> > to dive in those aspects more before finalizing the design... if we can 
> > avoid it we should try... and I feel in this case there might be some good 
> > ways to avoid it.
> > 
> > > Nice idea! Though I think LanguageID is not designed to be used this way, 
> > > it's used only to check against specific language version. So it seems 
> > > pretty invasive. Also, function attributes seem more natural to me to 
> > > specify the type of the function. I don't know for sure which way is 
> > > better...
> > 
> > I think this `LanguageID` is only used for the purposes of Builtins, so 
> > there should be no issue in evolving it differently. With the documentation 
> > and  adequate naming we can resolve the confusions in any.
> > 
> > The whole idea of language options in clang is that it is not dependent on 
> > the target. But we have violated this design already. The whole concept of 
> > OpenCL 3.0 language features that are target-specific is misaligned with 
> > the original design in clang.
> > 
> > > 
> > > Btw another approach could be to do something similar to 
> > > TARGET_BUILTIN i.e. list features in the last parameter as strings.
> > > 
> > > I'd prefer to not use TARGET_BUILTIN as it operates on target feature, 
> > > but OpenCL feature is some other concept in clang...
> > 
> > But we also have target features mirroring these, right? So I see no reason 
> > not to reuse what we already have... instead of adding another way to do 
> > the same or very similar thing...
> > 
> > We could also consider extending the functionality slightly to use language 
> > features instead however I can't see the immediate benefit at this point... 
> > other than it might be useful in the future... but we can't know for sure.
> > Buitlins handling is pretty vital for clang so if we extend common 
> > functionality for just a few built-in functions it might not justify the 
> > overhead in terms of complexity, parsing time or space... so we would need 
> > to dive in those aspects more before finalizing the design... if we can 
> > avoid it we should try... and I feel in this case there might be some good 
> > ways to avoid it.
> > 
> >>Nice idea! Though I think LanguageID is not designed to be used this way, 
> >>it's used only to check against specific >?language version. So it seems 
> >>pretty invasive. Also, function attributes seem more natural to me to 
> >>specify the type of the function. I don't know for sure which way is 
> >>better...
> > 
> > I think this LanguageID is only used for the purposes of Builtins, so there 
> > should be no issue in evolving it differently. With the documentation and 
> > adequate naming we can resolve the confusions in any.
> 
> So yeah, I think reusing LanguageID is pretty doable and sounds like a good 
> idea.
> 
> 
> > The whole idea of language options in

[PATCH] D118520: [clang-tidy] Output currently processing check and nodes on crash

2022-02-09 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.

LGTM




Comment at: clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp:349-352
+  // This should be an assert, but asserts shouldn't be used in signal
+  // handlers
+  if (!CurContext)
+return;

This function does a whole lot of things that shouldn't be used in signal 
handlers: http://eel.is/c++draft/support.signal#3

Unless you know of a problem from the assert, I'd say go ahead and use it.



Comment at: clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp:165
 : DiagEngine(nullptr), OptionsProvider(std::move(OptionsProvider)),
-  Profile(false),
+  CurrentlyProcessing(nullptr), Profile(false),
   AllowEnablingAnalyzerAlphaCheckers(AllowEnablingAnalyzerAlphaCheckers) {

LegalizeAdulthood wrote:
> Does the LLVM style guide say anything about preferring member initializers 
> over initializing constant expressions?
I know we document that we prefer sticking with the local style used around the 
change. I don't know if we say anything about initializers, but for new code 
I've been suggesting folks use member initializers when possible.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118520

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


[PATCH] D119012: [flang][driver] Add support for the `-emit-llvm` option

2022-02-09 Thread Andrzej Warzynski via Phabricator via cfe-commits
awarzynski updated this revision to Diff 407139.
awarzynski added a comment.

Remove the change from `fir::CodeGenSpecifics::get` (this was uploaded as a
seperate patch: https://reviews.llvm.org/D119332)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119012

Files:
  clang/include/clang/Driver/Options.td
  flang/include/flang/Frontend/FrontendActions.h
  flang/include/flang/Frontend/FrontendOptions.h
  flang/lib/Frontend/CompilerInvocation.cpp
  flang/lib/Frontend/FrontendActions.cpp
  flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
  flang/test/Driver/driver-help.f90
  flang/test/Driver/emit-llvm.f90
  flang/unittests/Frontend/FrontendActionTest.cpp

Index: flang/unittests/Frontend/FrontendActionTest.cpp
===
--- flang/unittests/Frontend/FrontendActionTest.cpp
+++ flang/unittests/Frontend/FrontendActionTest.cpp
@@ -161,4 +161,31 @@
   .contains(
   ":1:14: error: IF statement is not allowed in IF statement\n"));
 }
+
+TEST_F(FrontendActionTest, EmitLLVM) {
+  // Populate the input file with the pre-defined input and flush it.
+  *(inputFileOs_) << "end program";
+  inputFileOs_.reset();
+
+  // Set-up the action kind.
+  compInst_.invocation().frontendOpts().programAction = EmitLLVM;
+  compInst_.invocation().preprocessorOpts().noReformat = true;
+
+  // Set-up the output stream. We are using output buffer wrapped as an output
+  // stream, as opposed to an actual file (or a file descriptor).
+  llvm::SmallVector outputFileBuffer;
+  std::unique_ptr outputFileStream(
+  new llvm::raw_svector_ostream(outputFileBuffer));
+  compInst_.set_outputStream(std::move(outputFileStream));
+
+  // Execute the action.
+  bool success = ExecuteCompilerInvocation(&compInst_);
+
+  // Validate the expected output.
+  EXPECT_TRUE(success);
+  EXPECT_TRUE(!outputFileBuffer.empty());
+
+  EXPECT_TRUE(llvm::StringRef(outputFileBuffer.data())
+  .contains("define void @_QQmain()"));
+}
 } // namespace
Index: flang/test/Driver/emit-llvm.f90
===
--- /dev/null
+++ flang/test/Driver/emit-llvm.f90
@@ -0,0 +1,22 @@
+! Test the `-emit-llvm` option
+
+! UNSUPPORTED: system-windows
+! Windows is currently not supported in flang/lib/Optimizer/CodeGen/Target.cpp
+
+!
+! RUN COMMAND
+!
+! RUN: %flang_fc1 -emit-llvm %s -o - | FileCheck %s
+
+!
+! EXPECTED OUTPUT
+!
+! CHECK: ; ModuleID = 'FIRModule'
+! CHECK: define void @_QQmain()
+! CHECK-NEXT:  ret void
+! CHECK-NEXT: }
+
+!--
+! INPUT
+!--
+end program
Index: flang/test/Driver/driver-help.f90
===
--- flang/test/Driver/driver-help.f90
+++ flang/test/Driver/driver-help.f90
@@ -65,6 +65,7 @@
 ! HELP-FC1-NEXT:OPTIONS:
 ! HELP-FC1-NEXT: -cpp   Enable predefined and command line preprocessor macros
 ! HELP-FC1-NEXT: -D = Define  to  (or 1 if  omitted)
+! HELP-FC1-NEXT: -emit-llvm Use the LLVM representation for assembler and object files
 ! HELP-FC1-NEXT: -emit-mlir Build the parse tree, then lower it to MLIR
 ! HELP-FC1-NEXT: -emit-obj Emit native object files
 ! HELP-FC1-NEXT: -E Only run the preprocessor
Index: flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
===
--- flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
+++ flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
@@ -35,6 +35,8 @@
 return std::make_unique();
   case EmitMLIR:
 return std::make_unique();
+  case EmitLLVM:
+return std::make_unique();
   case EmitObj:
 return std::make_unique();
   case DebugUnparse:
Index: flang/lib/Frontend/FrontendActions.cpp
===
--- flang/lib/Frontend/FrontendActions.cpp
+++ flang/lib/Frontend/FrontendActions.cpp
@@ -14,6 +14,7 @@
 #include "flang/Lower/Bridge.h"
 #include "flang/Lower/PFTBuilder.h"
 #include "flang/Lower/Support/Verifier.h"
+#include "flang/Optimizer/Support/FIRContext.h"
 #include "flang/Optimizer/Support/InitFIR.h"
 #include "flang/Optimizer/Support/KindMapping.h"
 #include "flang/Optimizer/Support/Utils.h"
@@ -28,6 +29,7 @@
 
 #include "mlir/IR/Dialect.h"
 #include "mlir/Pass/PassManager.h"
+#include "mlir/Target/LLVMIR/ModuleTranslation.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/ErrorHandling.h"
 #include 
@@ -407,6 +409,72 @@
   ci.semantics().DumpSymbolsSources(llvm::outs());
 }
 
+#include "flang/Tools/CLOptions.inc"
+
+// Lower the previously generated MLIR module into an LLVM IR module
+void CodeGenAction::GenerateLLVMIR() {
+  assert(mlirModule && "The MLIR module has not been generated yet.");
+
+  CompilerInstance &ci = this->instance();
+
+  fir::support::loadDialects(*mlirCtx);
+

[PATCH] D118850: [PS4] Make __BIGGEST_ALIGNMENT__ 32bytes

2022-02-09 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM as far as the changes go (I can't speak to how appropriate the changes are 
for the PS4 target).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118850

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


[PATCH] D72404: [ThinLTO/FullLTO] Support Os and Oz

2022-02-09 Thread Ayke via Phabricator via cfe-commits
aykevl added a comment.

After some more testing on a larger amount of code (many small programs, 
together over 1MB of code), LoopRotate indeed seems to be the culprit. I'm now 
looking into a patch to LoopRotate to respect the `optsize` function attribute.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72404

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


[PATCH] D116635: Add warning to detect when calls passing arguments are made to functions without prototypes.

2022-02-09 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:5529
+def warn_call_function_without_prototype : Warning<
+  "calling function %0 with arguments when function has no prototype">, 
InGroup<
+  DiagGroup<"strict-calls-without-prototype">>, DefaultIgnore;

delcypher wrote:
> aaron.ballman wrote:
> > delcypher wrote:
> > > aaron.ballman wrote:
> > > > delcypher wrote:
> > > > > aaron.ballman wrote:
> > > > > > This diagnostic doesn't tell me what's wrong with the code (and in 
> > > > > > fact, there's very possibly nothing wrong with the code 
> > > > > > whatsoever). Further, why does calling a function *with no 
> > > > > > arguments* matter when it has no prototype? I would imagine this 
> > > > > > should flag any call to a function without a prototype given that 
> > > > > > the function without a prototype may still expect arguments. e.g.,
> > > > > > ```
> > > > > > // Header.h
> > > > > > int f();
> > > > > > 
> > > > > > // Source.c
> > > > > > int f(a) int a; { ... }
> > > > > > 
> > > > > > // Caller.c
> > > > > > #include "Header.h"
> > > > > > 
> > > > > > int main() {
> > > > > >   return f();
> > > > > > }
> > > > > > ```
> > > > > > I think the diagnostic text should be updated to something more 
> > > > > > like `cannot verify %0 is being called with the correct number or 
> > > > > > %plural{1:type|:types}1 of arguments because it was declared 
> > > > > > without a prototype` (or something along those lines that explains 
> > > > > > what's wrong with the code).
> > > > > @aaron.ballman  Thanks for the helpful feedback.
> > > > > 
> > > > > > This diagnostic doesn't tell me what's wrong with the code (and in 
> > > > > > fact, there's very possibly nothing wrong with the code whatsoever).
> > > > > 
> > > > > That's a fair criticism.  I think the diagnostic message you suggest 
> > > > > is a lot more helpful so I'll go for something like that.
> > > > > 
> > > > > > Further, why does calling a function *with no arguments* matter 
> > > > > > when it has no prototype?
> > > > > 
> > > > > The reason was to avoid the warning being noisy. E.g. I didn't the 
> > > > > warning to fire in this situation.
> > > > > 
> > > > > ```
> > > > > // Header.h
> > > > > int f(); // The user forgot to put `void` between parentheses
> > > > > 
> > > > > // Source.c
> > > > > int f(void) { ... }
> > > > > 
> > > > > // Caller.c
> > > > > #include "Header.h"
> > > > > 
> > > > > int main() {
> > > > >   return f();
> > > > > }
> > > > > ```
> > > > > 
> > > > > Forgetting to put `void` in the declaration of `f()` is a pretty 
> > > > > common thing to do because a lot of people read `int f()` as 
> > > > > declaring a function that takes no arguments (it does in C++ but not 
> > > > > in C).
> > > > > 
> > > > > I don't want the warning to be noisy because I was planning on 
> > > > > switching it on by default in open source and in a downstream 
> > > > > use-case make it an error.
> > > > > 
> > > > > How about this as a compromise? Split the warning into two separate 
> > > > > warnings
> > > > > 
> > > > > * `strict-call-without-prototype` -  Warns on calls to functions 
> > > > > without a prototype when no arguments are passed. Not enabled by 
> > > > > default
> > > > > * `call-without-prototype` -Warns on calls to functions without a 
> > > > > prototype when arguments are passed.  Enable this by default.
> > > > > 
> > > > > Alternatively we could enable both by default. That would still allow 
> > > > > me to make `call-without-prototype` an error and 
> > > > > `strict-call-without-prototype` not be an error for my downstream 
> > > > > use-case.
> > > > > 
> > > > > Thoughts?
> > > > > Forgetting to put void in the declaration of f() is a pretty common 
> > > > > thing to do because a lot of people read int f() as declaring a 
> > > > > function that takes no arguments (it does in C++ but not in C).
> > > > 
> > > > Yup, and this is exactly why I think we *should* be warning. That is a 
> > > > function without a prototype, so the code is very brittle and dangerous 
> > > > at the call site. The fact that the call site *currently* is correct 
> > > > doesn't mean it's *intentionally* correct. e.g.,
> > > > ```
> > > > // Header.h
> > > > int f(); // No prototype
> > > > 
> > > > // Source.c
> > > > int f(int a, int b) { return 0; } // Has a prototype, no diagnostic
> > > > 
> > > > // OtherSource.c
> > > > #include "Header.h"
> > > > 
> > > > int main() {
> > > >   return f(); // No diagnostic with this patch, but still have the UB.
> > > > }
> > > > ```
> > > > 
> > > > > I don't want the warning to be noisy because I was planning on 
> > > > > switching it on by default in open source and in a downstream 
> > > > > use-case make it an error.
> > > > 
> > > > Hmmm. Thinking out loud here.
> > > > 
> > > > Functions without prototypes were standardized in C89 as a deprecated 
> > > > feature (C89 3.9.4, 3.9.5). I'

[libunwind] 6f17768 - [runtimes] Remove support for standalone builds

2022-02-09 Thread Louis Dionne via cfe-commits

Author: Louis Dionne
Date: 2022-02-09T08:55:31-05:00
New Revision: 6f17768e11480063f4c2bcbeea559505fee3ea19

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

LOG: [runtimes] Remove support for standalone builds

Standalone build have been deprecated for some time now, so this
commit removes support for those builds entirely from libc++, libc++abi
and libunwind.

This, along with the removal of other legacy ways to build, will allow
for major build system simplifications.

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

Added: 


Modified: 
libcxx/CMakeLists.txt
libcxx/docs/ReleaseNotes.rst
libcxx/utils/ci/buildkite-pipeline.yml
libcxx/utils/ci/run-buildbot
libcxxabi/CMakeLists.txt
libcxxabi/www/index.html
libunwind/CMakeLists.txt

Removed: 




diff  --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index 390c149674d51..aabecc529d202 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -27,6 +27,9 @@ set(LIBCXX_BINARY_DIR  ${CMAKE_CURRENT_BINARY_DIR})
 set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build")
 
 if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR 
LIBCXX_STANDALONE_BUILD)
+  message(FATAL_ERROR "The Standalone build has been deprecated since LLVM 14, 
and it is not supported anymore. "
+  "Please use one of the ways described at 
https://libcxx.llvm.org/BuildingLibcxx.html for "
+  "building libc++.")
   project(libcxx CXX C)
 
   set(PACKAGE_NAME libcxx)

diff  --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst
index 9bb06cf2aa6a7..0bf24b9821503 100644
--- a/libcxx/docs/ReleaseNotes.rst
+++ b/libcxx/docs/ReleaseNotes.rst
@@ -57,3 +57,7 @@ ABI Changes
 
 Build System Changes
 
+
+- Support for standalone builds have been entirely removed from libc++, 
libc++abi and
+  libunwind. Please use :ref:`these instructions ` for 
building
+  libc++, libc++abi and/or libunwind.

diff  --git a/libcxx/utils/ci/buildkite-pipeline.yml 
b/libcxx/utils/ci/buildkite-pipeline.yml
index 0d8f6c8a964a8..ae4c07aa27a04 100644
--- a/libcxx/utils/ci/buildkite-pipeline.yml
+++ b/libcxx/utils/ci/buildkite-pipeline.yml
@@ -297,19 +297,6 @@ steps:
 limit: 2
   timeout_in_minutes: 120
 
-- label: "Legacy standalone build"
-  command: "libcxx/utils/ci/run-buildbot legacy-standalone"
-  artifact_paths:
-- "**/test-results.xml"
-  agents:
-queue: "libcxx-builders"
-os: "linux"
-  retry:
-automatic:
-  - exit_status: -1  # Agent was lost
-limit: 2
-  timeout_in_minutes: 120
-
 - label: "Legacy LLVM_ENABLE_PROJECTS build"
   command: "libcxx/utils/ci/run-buildbot legacy-project-build"
   artifact_paths:

diff  --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index 080c9643d309a..b8bebe4daa163 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -516,48 +516,6 @@ legacy-project-build)
   -DLIBCXX_CXX_ABI=libcxxabi
 check-runtimes
 ;;
-legacy-standalone)
-clean
-
-echo "--- Generating CMake"
-${CMAKE} \
-  -S "${MONOREPO_ROOT}/libcxx" \
-  -B "${BUILD_DIR}/libcxx" \
-  -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
-  -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-  -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-  -DLLVM_PATH="${MONOREPO_ROOT}/llvm" \
-  -DLIBCXX_CXX_ABI=libcxxabi \
-  -DLIBCXX_INCLUDE_BENCHMARKS=OFF \
-  -DLIBCXX_CXX_ABI_INCLUDE_PATHS="${MONOREPO_ROOT}/libcxxabi/include" \
-  -DLIBCXX_CXX_ABI_LIBRARY_PATH="${BUILD_DIR}/libcxxabi/lib"
-
-${CMAKE} \
-  -S "${MONOREPO_ROOT}/libcxxabi" \
-  -B "${BUILD_DIR}/libcxxabi" \
-  -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
-  -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-  -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-  -DLLVM_PATH="${MONOREPO_ROOT}/llvm" \
-  -DLIBCXXABI_LIBCXX_PATH="${MONOREPO_ROOT}/libcxx" \
-  -DLIBCXXABI_LIBCXX_INCLUDES="${BUILD_DIR}/libcxx/include/c++/v1" \
-  -DLIBCXXABI_LIBCXX_LIBRARY_PATH="${BUILD_DIR}/libcxx/lib"
-
-echo "+++ Generating libc++ headers"
-${NINJA} -vC "${BUILD_DIR}/libcxx" generate-cxx-headers
-
-echo "+++ Building libc++abi"
-${NINJA} -vC "${BUILD_DIR}/libcxxabi" cxxabi
-
-echo "+++ Building libc++"
-${NINJA} -vC "${BUILD_DIR}/libcxx" cxx
-
-echo "+++ Running the libc++ tests"
-${NINJA} -vC "${BUILD_DIR}/libcxx" check-cxx
-
-echo "+++ Running the libc++abi tests"
-${NINJA} -vC "${BUILD_DIR}/libcxxabi" check-cxxabi
-;;
 aarch64)
 clean
 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AArch64.cmake" \

diff  --

[PATCH] D116774: AST: Move __va_list tag to the top level on ARM architectures.

2022-02-09 Thread Jessica Clarke via Phabricator via cfe-commits
jrtc27 added a comment.

Ping? I'd really like to get this fixed in 14.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116774

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


[PATCH] D118847: Added early exit for defaulted FunctionDecls.

2022-02-09 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev added a comment.

In D118847#3307497 , @Febbe wrote:

> Can I still add a diff, or does this cause a revoke (apply the rest of the 
> feedback)? 
> Also, is the commit added automatically to the repo, or do I / another one 
> have to rebase it.
>
> Sorry for those questions, this is my first contribution to llvm.

Yes, you can add changes after LGTM, it might add the warning "landed changes 
with unreviewed diff" but it's generally OK if the changes are the suggestions.

Someone needs to commit the patch to the monorepo. Do you have the commit 
access? If not, I can do that for you once you indicate you are done with the 
changes.


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

https://reviews.llvm.org/D118847

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


  1   2   >