[PATCH] D111037: [X86] Check if struct is blank before getting the inner types

2021-10-08 Thread LuoYuanke via Phabricator via cfe-commits
LuoYuanke accepted this revision.
LuoYuanke added a comment.
This revision is now accepted and ready to land.

LGTM, thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111037

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


[PATCH] D111387: [NFC] [Clang] Remove pre-computed complex float types

2021-10-08 Thread Qiu Chaofan via Phabricator via cfe-commits
qiucf created this revision.
qiucf added reviewers: rjmccall, teemperor.
qiucf requested review of this revision.
Herald added projects: clang, LLDB.
Herald added subscribers: lldb-commits, cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111387

Files:
  clang/include/clang/AST/ASTContext.h
  clang/lib/AST/ASTContext.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/unittests/Symbol/TestTypeSystemClang.cpp

Index: lldb/unittests/Symbol/TestTypeSystemClang.cpp
===
--- lldb/unittests/Symbol/TestTypeSystemClang.cpp
+++ lldb/unittests/Symbol/TestTypeSystemClang.cpp
@@ -60,11 +60,11 @@
   EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeDouble),
   context.DoubleTy));
   EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeDoubleComplex),
-  context.DoubleComplexTy));
+  context.getComplexType(context.DoubleTy)));
   EXPECT_TRUE(
   context.hasSameType(GetBasicQualType(eBasicTypeFloat), context.FloatTy));
   EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeFloatComplex),
-  context.FloatComplexTy));
+  context.getComplexType(context.FloatTy)));
   EXPECT_TRUE(
   context.hasSameType(GetBasicQualType(eBasicTypeHalf), context.HalfTy));
   EXPECT_TRUE(
@@ -75,8 +75,9 @@
   context.hasSameType(GetBasicQualType(eBasicTypeLong), context.LongTy));
   EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeLongDouble),
   context.LongDoubleTy));
-  EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeLongDoubleComplex),
-  context.LongDoubleComplexTy));
+  EXPECT_TRUE(
+  context.hasSameType(GetBasicQualType(eBasicTypeLongDoubleComplex),
+  context.getComplexType(context.LongDoubleTy)));
   EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeLongLong),
   context.LongLongTy));
   EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeNullPtr),
Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -981,21 +981,25 @@
 }
 break;
 
-  case DW_ATE_complex_float:
-if (QualTypeMatchesBitSize(bit_size, ast, ast.FloatComplexTy))
-  return GetType(ast.FloatComplexTy);
-else if (QualTypeMatchesBitSize(bit_size, ast, ast.DoubleComplexTy))
-  return GetType(ast.DoubleComplexTy);
-else if (QualTypeMatchesBitSize(bit_size, ast, ast.LongDoubleComplexTy))
-  return GetType(ast.LongDoubleComplexTy);
-else {
-  CompilerType complex_float_clang_type =
-  GetBuiltinTypeForDWARFEncodingAndBitSize("float", DW_ATE_float,
-   bit_size / 2);
-  return GetType(
-  ast.getComplexType(ClangUtil::GetQualType(complex_float_clang_type)));
-}
-break;
+  case DW_ATE_complex_float: {
+CanQualType FloatComplexTy = ast.getComplexType(ast.FloatTy);
+if (QualTypeMatchesBitSize(bit_size, ast, FloatComplexTy))
+  return GetType(FloatComplexTy);
+
+CanQualType DoubleComplexTy = ast.getComplexType(ast.DoubleTy);
+if (QualTypeMatchesBitSize(bit_size, ast, DoubleComplexTy))
+  return GetType(DoubleComplexTy);
+
+CanQualType LongDoubleComplexTy = ast.getComplexType(ast.LongDoubleTy);
+if (QualTypeMatchesBitSize(bit_size, ast, LongDoubleComplexTy))
+  return GetType(LongDoubleComplexTy);
+
+CompilerType complex_float_clang_type =
+GetBuiltinTypeForDWARFEncodingAndBitSize("float", DW_ATE_float,
+ bit_size / 2);
+return GetType(
+ast.getComplexType(ClangUtil::GetQualType(complex_float_clang_type)));
+  }
 
   case DW_ATE_float:
 if (type_name == "float" &&
@@ -2051,11 +2055,11 @@
   case eBasicTypeLongDouble:
 return ast->LongDoubleTy.getAsOpaquePtr();
   case eBasicTypeFloatComplex:
-return ast->FloatComplexTy.getAsOpaquePtr();
+return ast->getComplexType(ast->FloatTy).getAsOpaquePtr();
   case eBasicTypeDoubleComplex:
-return ast->DoubleComplexTy.getAsOpaquePtr();
+return ast->getComplexType(ast->DoubleTy).getAsOpaquePtr();
   case eBasicTypeLongDoubleComplex:
-return ast->LongDoubleComplexTy.getAsOpaquePtr();
+return ast->getComplexType(ast->LongDoubleTy).getAsOpaquePtr();
   case eBasicTypeObjCID:
 return ast->getObjCIdType().getAsOpaquePtr();
   case eBasicTypeObjCClass:
Index: clang/lib/AST/ASTContext.cpp
===
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -1411,12 +1411,6 @@

[PATCH] D109948: [Clang] Enable _Complex __ibm128 type

2021-10-08 Thread Qiu Chaofan via Phabricator via cfe-commits
qiucf updated this revision to Diff 378112.
qiucf marked 2 inline comments as done.
qiucf added a comment.

Based on another patch to remove pre-computed complex CanQualType.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109948

Files:
  clang/lib/AST/ASTContext.cpp
  clang/lib/Sema/DeclSpec.cpp
  clang/test/CodeGen/ppc64-complex-parms.c
  clang/test/CodeGen/ppc64-complex-return.c

Index: clang/test/CodeGen/ppc64-complex-return.c
===
--- clang/test/CodeGen/ppc64-complex-return.c
+++ clang/test/CodeGen/ppc64-complex-return.c
@@ -34,6 +34,12 @@
 
 // CHECK: define{{.*}} { ppc_fp128, ppc_fp128 } @foo_long_double(ppc_fp128 {{[%A-Za-z0-9.]+}}, ppc_fp128 {{[%A-Za-z0-9.]+}}) [[NUW]] {
 
+_Complex __ibm128 foo_ibm128(_Complex __ibm128 x) {
+  return x;
+}
+
+// CHECK: define{{.*}} { ppc_fp128, ppc_fp128 } @foo_ibm128(ppc_fp128 {{[%A-Za-z0-9.]+}}, ppc_fp128 {{[%A-Za-z0-9.]+}}) [[NUW]] {
+
 _Complex int foo_int(_Complex int x) {
   return x;
 }
@@ -91,6 +97,15 @@
 // CHECK: extractvalue { ppc_fp128, ppc_fp128 } [[VAR3]], 0
 // CHECK: extractvalue { ppc_fp128, ppc_fp128 } [[VAR3]], 1
 
+__ibm128 bar_ibm128(void) {
+  return creall(foo_ibm128(2.0L - 2.5Li));
+}
+
+// CHECK: define{{.*}} ppc_fp128 @bar_ibm128() [[NUW]] {
+// CHECK: [[VAR3:[%A-Za-z0-9.]+]] = call { ppc_fp128, ppc_fp128 } @foo_ibm128
+// CHECK: extractvalue { ppc_fp128, ppc_fp128 } [[VAR3]], 0
+// CHECK: extractvalue { ppc_fp128, ppc_fp128 } [[VAR3]], 1
+
 #ifdef TEST_F128
 __float128 bar_f128(void) {
   return crealf128(foo_f128(2.0Q - 2.5Qi));
Index: clang/test/CodeGen/ppc64-complex-parms.c
===
--- clang/test/CodeGen/ppc64-complex-parms.c
+++ clang/test/CodeGen/ppc64-complex-parms.c
@@ -33,6 +33,13 @@
 
 // CHECK: define{{.*}} ppc_fp128 @foo_long_double(ppc_fp128 {{[%A-Za-z0-9.]+}}, ppc_fp128 {{[%A-Za-z0-9.]+}}) [[NUW]] {
 
+__ibm128 foo_ibm128(_Complex __ibm128 x) {
+  // We don't have a suffix for explicit __ibm128 type yet. Use *l instead.
+  return creall(x);
+}
+
+// CHECK: define{{.*}} ppc_fp128 @foo_ibm128(ppc_fp128 {{[%A-Za-z0-9.]+}}, ppc_fp128 {{[%A-Za-z0-9.]+}}) [[NUW]] {
+
 int foo_int(_Complex int x) {
   return __real__ x;
 }
@@ -111,6 +118,22 @@
 // CHECK: %[[VAR27:[A-Za-z0-9.]+]] = load ppc_fp128, ppc_fp128* %[[VAR26]], align 16
 // CHECK: %{{[A-Za-z0-9.]+}} = call ppc_fp128 @foo_long_double(ppc_fp128 %[[VAR25]], ppc_fp128 %[[VAR27]])
 
+void bar_ibm128(void) {
+  foo_ibm128(2.0L - 2.5Li);
+}
+
+// CHECK: define{{.*}} void @bar_ibm128() [[NUW]] {
+// CHECK: %[[VAR21:[A-Za-z0-9.]+]] = alloca { ppc_fp128, ppc_fp128 }, align 16
+// CHECK: %[[VAR22:[A-Za-z0-9.]+]] = getelementptr inbounds { ppc_fp128, ppc_fp128 }, { ppc_fp128, ppc_fp128 }* %[[VAR21]], i32 0, i32 0
+// CHECK: %[[VAR23:[A-Za-z0-9.]+]] = getelementptr inbounds { ppc_fp128, ppc_fp128 }, { ppc_fp128, ppc_fp128 }* %[[VAR21]], i32 0, i32 1
+// CHECK: store ppc_fp128 0xM4000, ppc_fp128* %[[VAR22]]
+// CHECK: store ppc_fp128 0xMC0048000, ppc_fp128* %[[VAR23]]
+// CHECK: %[[VAR24:[A-Za-z0-9.]+]] = getelementptr inbounds { ppc_fp128, ppc_fp128 }, { ppc_fp128, ppc_fp128 }* %[[VAR21]], i32 0, i32 0
+// CHECK: %[[VAR25:[A-Za-z0-9.]+]] = load ppc_fp128, ppc_fp128* %[[VAR24]], align 16
+// CHECK: %[[VAR26:[A-Za-z0-9.]+]] = getelementptr inbounds { ppc_fp128, ppc_fp128 }, { ppc_fp128, ppc_fp128 }* %[[VAR21]], i32 0, i32 1
+// CHECK: %[[VAR27:[A-Za-z0-9.]+]] = load ppc_fp128, ppc_fp128* %[[VAR26]], align 16
+// CHECK: %{{[A-Za-z0-9.]+}} = call ppc_fp128 @foo_ibm128(ppc_fp128 %[[VAR25]], ppc_fp128 %[[VAR27]])
+
 void bar_int(void) {
   foo_int(2 - 3i);
 }
Index: clang/lib/Sema/DeclSpec.cpp
===
--- clang/lib/Sema/DeclSpec.cpp
+++ clang/lib/Sema/DeclSpec.cpp
@@ -1307,7 +1307,8 @@
   if (!S.getLangOpts().CPlusPlus)
 S.Diag(TSTLoc, diag::ext_integer_complex);
 } else if (TypeSpecType != TST_float && TypeSpecType != TST_double &&
-   TypeSpecType != TST_float128 && TypeSpecType != TST_float16) {
+   TypeSpecType != TST_float128 && TypeSpecType != TST_float16 &&
+   TypeSpecType != TST_ibm128) {
   // FIXME: __fp16?
   S.Diag(TSCLoc, diag::err_invalid_complex_spec)
 << getSpecifierName((TST)TypeSpecType, Policy);
Index: clang/lib/AST/ASTContext.cpp
===
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -6334,7 +6334,7 @@
 case BFloat16Rank: llvm_unreachable("Complex bfloat16 is not supported");
 case Float16Rank:
 case HalfRank: llvm_unreachable("Complex half is not supported");
-case Ibm128Rank: llvm_unreachable("Complex __ibm128 is not supported");
+case Ibm128Rank: return getComplexType(Ibm128Ty);
  

[PATCH] D111387: [NFC] [Clang] Remove pre-computed complex float types

2021-10-08 Thread Raphael Isemann via Phabricator via cfe-commits
teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.
Herald added a subscriber: JDevlieghere.

Would be nice to have the motivation for this in the commit message (IIUC this 
is based on the suggestion from D109948  ). 
Patch itself LGTM, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111387

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


[PATCH] D111228: [clang-tidy] Add options to bugprone-unused-return-value.

2021-10-08 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 378113.
balazske added a comment.

Using `StringRef`, added documentation (untested).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111228

Files:
  clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp
  clang-tools-extra/clang-tidy/bugprone/UnusedReturnValueCheck.h
  clang-tools-extra/docs/clang-tidy/checks/bugprone-unused-return-value.rst
  
clang-tools-extra/test/clang-tidy/checkers/bugprone-unused-return-value-custom.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/bugprone-unused-return-value-custom.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/bugprone-unused-return-value-custom.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/bugprone-unused-return-value-custom.cpp
@@ -1,7 +1,11 @@
 // RUN: %check_clang_tidy %s bugprone-unused-return-value %t \
 // RUN: -config='{CheckOptions: \
 // RUN:  [{key: bugprone-unused-return-value.CheckedFunctions, \
-// RUN:value: "::fun;::ns::Outer::Inner::memFun;::ns::Type::staticFun;::ns::ClassTemplate::memFun;::ns::ClassTemplate::staticFun"}]}' \
+// RUN:value: "::fun;::ns::Outer::Inner::memFun;::ns::Type::staticFun;::ns::ClassTemplate::memFun;::ns::ClassTemplate::staticFun;::excludedFun"}, \
+// RUN:  {key: bugprone-unused-return-value.IncludedFunctions, \
+// RUN:value: "::includedFun;::excludedFun"}, \
+// RUN:  {key: bugprone-unused-return-value.ExcludedFunctions, \
+// RUN:value: "::excludedFun"}]}' \
 // RUN: --
 
 namespace std {
@@ -44,6 +48,8 @@
 
 int fun();
 void fun(int);
+int includedFun();
+int excludedFun();
 
 void warning() {
   fun();
@@ -81,6 +87,10 @@
   ns::ClassTemplate::staticFun();
   // CHECK-NOTES: [[@LINE-1]]:3: warning: the value {{.*}} should be used
   // CHECK-NOTES: [[@LINE-2]]:3: note: cast {{.*}} this warning
+
+  includedFun();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value {{.*}} should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast {{.*}} this warning
 }
 
 void noWarning() {
@@ -105,4 +115,7 @@
 
   ns::Type ObjB3;
   ObjB3.memFun();
+
+  // no warning on function that is specified as excluded and as to be checked
+  excludedFun();
 }
Index: clang-tools-extra/docs/clang-tidy/checks/bugprone-unused-return-value.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/bugprone-unused-return-value.rst
+++ clang-tools-extra/docs/clang-tidy/checks/bugprone-unused-return-value.rst
@@ -10,9 +10,25 @@
 
 .. option:: CheckedFunctions
 
-   Semicolon-separated list of functions to check. Defaults to
-   ``::std::async;::std::launder;::std::remove;::std::remove_if;::std::unique;::std::unique_ptr::release;::std::basic_string::empty;::std::vector::empty``.
-   This means that the calls to following functions are checked by default:
+   Semicolon-separated list of functions to check. The function is checked if
+   the name and scope matches, with any arguments.
+   By default the following functions are checked:
+   ``std::async, std::launder, std::remove, std::remove_if, std::unique,
+   std::unique_ptr::release, std::basic_string::empty, std::vector::empty,
+   std::back_inserter, std::distance, std::find, std::find_if, std::inserter,
+   std::lower_bound, std::make_pair, std::map::count, std::map::find,
+   std::map::lower_bound, std::multimap::equal_range,
+   std::multimap::upper_bound, std::set::count, std::set::find, std::setfill,
+   std::setprecision, std::setw, std::upper_bound, std::vector::at,
+   bsearch, ferror, feof, isalnum, isalpha, isblank, iscntrl, isdigit, isgraph,
+   islower, isprint, ispunct, isspace, isupper, iswalnum, iswprint, iswspace,
+   isxdigit, memchr, memcmp, strcmp, strcoll, strncmp, strpbrk, strrchr,
+   strspn, strstr, wcscmp, access, bind, connect, difftime, dlsym, fnmatch,
+   getaddrinfo, getopt, htonl, htons, iconv_open, inet_addr, isascii, isatty,
+   mmap, newlocale, openat, pathconf, pthread_equal, pthread_getspecific,
+   pthread_mutex_trylock, readdir, readlink, recvmsg, regexec, scandir,
+   semget, setjmp, shm_open, shmget, sigismember, strcasecmp, strsignal,
+   ttyname``
 
- ``std::async()``. Not using the return value makes the call synchronous.
- ``std::launder()``. Not using the return value usually means that the
@@ -29,3 +45,14 @@
- ``std::basic_string::empty()`` and ``std::vector::empty()``. Not using the
  return value often indicates that the programmer confused the function with
  ``clear()``.
+
+.. option:: IncludedFunctions
+
+   Semicolon-separated list of additional functions to check. The list specified
+   with `CheckedFunctions` is extended by these functions.
+
+.. option:: ExcludedFunctions
+
+   Semicolon-separated list of functions to exclude from the check. These
+   functions are not checked even if included in the `CheckedFunctions` or
+   `IncludedFun

[clang] 00c0ce0 - [NFC] [Clang] Remove pre-computed complex float types

2021-10-08 Thread Qiu Chaofan via cfe-commits

Author: Qiu Chaofan
Date: 2021-10-08T15:52:16+08:00
New Revision: 00c0ce0655da804c2ffb1a2a807052298032acc6

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

LOG: [NFC] [Clang] Remove pre-computed complex float types

As discussed in D109948, pre-computing all complex float types is not
necessary and brings extra overhead. This patch removes these defined
types, and construct them in-place when needed.

Reviewed By: teemperor

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

Added: 


Modified: 
clang/include/clang/AST/ASTContext.h
clang/lib/AST/ASTContext.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/unittests/Symbol/TestTypeSystemClang.cpp

Removed: 




diff  --git a/clang/include/clang/AST/ASTContext.h 
b/clang/include/clang/AST/ASTContext.h
index 582134e586e0d..d4e813c5ed9d7 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -1091,8 +1091,6 @@ class ASTContext : public RefCountedBase {
   CanQualType HalfTy; // [OpenCL 6.1.1.1], ARM NEON
   CanQualType BFloat16Ty;
   CanQualType Float16Ty; // C11 extension ISO/IEC TS 18661-3
-  CanQualType FloatComplexTy, DoubleComplexTy, LongDoubleComplexTy;
-  CanQualType Float128ComplexTy;
   CanQualType VoidPtrTy, NullPtrTy;
   CanQualType DependentTy, OverloadTy, BoundMemberTy, UnknownAnyTy;
   CanQualType BuiltinFnTy;

diff  --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index d1fd3ce061415..4085477bc45ad 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -1411,12 +1411,6 @@ void ASTContext::InitBuiltinTypes(const TargetInfo 
&Target,
   if (LangOpts.MatrixTypes)
 InitBuiltinType(IncompleteMatrixIdxTy, BuiltinType::IncompleteMatrixIdx);
 
-  // C99 6.2.5p11.
-  FloatComplexTy  = getComplexType(FloatTy);
-  DoubleComplexTy = getComplexType(DoubleTy);
-  LongDoubleComplexTy = getComplexType(LongDoubleTy);
-  Float128ComplexTy   = getComplexType(Float128Ty);
-
   // Builtin types for 'id', 'Class', and 'SEL'.
   InitBuiltinType(ObjCBuiltinIdTy, BuiltinType::ObjCId);
   InitBuiltinType(ObjCBuiltinClassTy, BuiltinType::ObjCClass);
@@ -6341,10 +6335,10 @@ QualType 
ASTContext::getFloatingTypeOfSizeWithinDomain(QualType Size,
 case Float16Rank:
 case HalfRank: llvm_unreachable("Complex half is not supported");
 case Ibm128Rank: llvm_unreachable("Complex __ibm128 is not supported");
-case FloatRank:  return FloatComplexTy;
-case DoubleRank: return DoubleComplexTy;
-case LongDoubleRank: return LongDoubleComplexTy;
-case Float128Rank:   return Float128ComplexTy;
+case FloatRank:  return getComplexType(FloatTy);
+case DoubleRank: return getComplexType(DoubleTy);
+case LongDoubleRank: return getComplexType(LongDoubleTy);
+case Float128Rank:   return getComplexType(Float128Ty);
 }
   }
 

diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 99ed2a906635c..152b570a6f913 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -981,21 +981,25 @@ CompilerType 
TypeSystemClang::GetBuiltinTypeForDWARFEncodingAndBitSize(
 }
 break;
 
-  case DW_ATE_complex_float:
-if (QualTypeMatchesBitSize(bit_size, ast, ast.FloatComplexTy))
-  return GetType(ast.FloatComplexTy);
-else if (QualTypeMatchesBitSize(bit_size, ast, ast.DoubleComplexTy))
-  return GetType(ast.DoubleComplexTy);
-else if (QualTypeMatchesBitSize(bit_size, ast, ast.LongDoubleComplexTy))
-  return GetType(ast.LongDoubleComplexTy);
-else {
-  CompilerType complex_float_clang_type =
-  GetBuiltinTypeForDWARFEncodingAndBitSize("float", DW_ATE_float,
-   bit_size / 2);
-  return GetType(
-  
ast.getComplexType(ClangUtil::GetQualType(complex_float_clang_type)));
-}
-break;
+  case DW_ATE_complex_float: {
+CanQualType FloatComplexTy = ast.getComplexType(ast.FloatTy);
+if (QualTypeMatchesBitSize(bit_size, ast, FloatComplexTy))
+  return GetType(FloatComplexTy);
+
+CanQualType DoubleComplexTy = ast.getComplexType(ast.DoubleTy);
+if (QualTypeMatchesBitSize(bit_size, ast, DoubleComplexTy))
+  return GetType(DoubleComplexTy);
+
+CanQualType LongDoubleComplexTy = ast.getComplexType(ast.LongDoubleTy);
+if (QualTypeMatchesBitSize(bit_size, ast, LongDoubleComplexTy))
+  return GetType(LongDoubleComplexTy);
+
+CompilerType complex_float_clang_type =
+GetBuiltinTypeForDWARFEncodingAndBitSize("float", DW_ATE_float,
+ bit_size / 2);
+re

[PATCH] D111387: [NFC] [Clang] Remove pre-computed complex float types

2021-10-08 Thread Qiu Chaofan 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 rG00c0ce0655da: [NFC] [Clang] Remove pre-computed complex 
float types (authored by qiucf).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111387

Files:
  clang/include/clang/AST/ASTContext.h
  clang/lib/AST/ASTContext.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/unittests/Symbol/TestTypeSystemClang.cpp

Index: lldb/unittests/Symbol/TestTypeSystemClang.cpp
===
--- lldb/unittests/Symbol/TestTypeSystemClang.cpp
+++ lldb/unittests/Symbol/TestTypeSystemClang.cpp
@@ -60,11 +60,11 @@
   EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeDouble),
   context.DoubleTy));
   EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeDoubleComplex),
-  context.DoubleComplexTy));
+  context.getComplexType(context.DoubleTy)));
   EXPECT_TRUE(
   context.hasSameType(GetBasicQualType(eBasicTypeFloat), context.FloatTy));
   EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeFloatComplex),
-  context.FloatComplexTy));
+  context.getComplexType(context.FloatTy)));
   EXPECT_TRUE(
   context.hasSameType(GetBasicQualType(eBasicTypeHalf), context.HalfTy));
   EXPECT_TRUE(
@@ -75,8 +75,9 @@
   context.hasSameType(GetBasicQualType(eBasicTypeLong), context.LongTy));
   EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeLongDouble),
   context.LongDoubleTy));
-  EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeLongDoubleComplex),
-  context.LongDoubleComplexTy));
+  EXPECT_TRUE(
+  context.hasSameType(GetBasicQualType(eBasicTypeLongDoubleComplex),
+  context.getComplexType(context.LongDoubleTy)));
   EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeLongLong),
   context.LongLongTy));
   EXPECT_TRUE(context.hasSameType(GetBasicQualType(eBasicTypeNullPtr),
Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -981,21 +981,25 @@
 }
 break;
 
-  case DW_ATE_complex_float:
-if (QualTypeMatchesBitSize(bit_size, ast, ast.FloatComplexTy))
-  return GetType(ast.FloatComplexTy);
-else if (QualTypeMatchesBitSize(bit_size, ast, ast.DoubleComplexTy))
-  return GetType(ast.DoubleComplexTy);
-else if (QualTypeMatchesBitSize(bit_size, ast, ast.LongDoubleComplexTy))
-  return GetType(ast.LongDoubleComplexTy);
-else {
-  CompilerType complex_float_clang_type =
-  GetBuiltinTypeForDWARFEncodingAndBitSize("float", DW_ATE_float,
-   bit_size / 2);
-  return GetType(
-  ast.getComplexType(ClangUtil::GetQualType(complex_float_clang_type)));
-}
-break;
+  case DW_ATE_complex_float: {
+CanQualType FloatComplexTy = ast.getComplexType(ast.FloatTy);
+if (QualTypeMatchesBitSize(bit_size, ast, FloatComplexTy))
+  return GetType(FloatComplexTy);
+
+CanQualType DoubleComplexTy = ast.getComplexType(ast.DoubleTy);
+if (QualTypeMatchesBitSize(bit_size, ast, DoubleComplexTy))
+  return GetType(DoubleComplexTy);
+
+CanQualType LongDoubleComplexTy = ast.getComplexType(ast.LongDoubleTy);
+if (QualTypeMatchesBitSize(bit_size, ast, LongDoubleComplexTy))
+  return GetType(LongDoubleComplexTy);
+
+CompilerType complex_float_clang_type =
+GetBuiltinTypeForDWARFEncodingAndBitSize("float", DW_ATE_float,
+ bit_size / 2);
+return GetType(
+ast.getComplexType(ClangUtil::GetQualType(complex_float_clang_type)));
+  }
 
   case DW_ATE_float:
 if (type_name == "float" &&
@@ -2051,11 +2055,11 @@
   case eBasicTypeLongDouble:
 return ast->LongDoubleTy.getAsOpaquePtr();
   case eBasicTypeFloatComplex:
-return ast->FloatComplexTy.getAsOpaquePtr();
+return ast->getComplexType(ast->FloatTy).getAsOpaquePtr();
   case eBasicTypeDoubleComplex:
-return ast->DoubleComplexTy.getAsOpaquePtr();
+return ast->getComplexType(ast->DoubleTy).getAsOpaquePtr();
   case eBasicTypeLongDoubleComplex:
-return ast->LongDoubleComplexTy.getAsOpaquePtr();
+return ast->getComplexType(ast->LongDoubleTy).getAsOpaquePtr();
   case eBasicTypeObjCID:
 return ast->getObjCIdType().getAsOpaquePtr();
   case eBasicTypeObjCClass:
Index: clang/lib/AST/ASTContext.cpp
=

[PATCH] D111340: [Driver][NetBSD] Use ToolChain reference instead of getToolChain().

2021-10-08 Thread Frederic Cambus via Phabricator via cfe-commits
fcambus updated this revision to Diff 378124.
fcambus added a comment.
Herald added a subscriber: fedor.sergeev.

Also define and use ToolChain reference in netbsd::Assembler::ConstructJob().


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

https://reviews.llvm.org/D111340

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

Index: clang/lib/Driver/ToolChains/NetBSD.cpp
===
--- clang/lib/Driver/ToolChains/NetBSD.cpp
+++ clang/lib/Driver/ToolChains/NetBSD.cpp
@@ -29,14 +29,16 @@
  const InputInfoList &Inputs,
  const ArgList &Args,
  const char *LinkingOutput) const {
-  const Driver &D = getToolChain().getDriver();
+  const toolchains::NetBSD &ToolChain =
+static_cast(getToolChain());
+  const Driver &D = ToolChain.getDriver();
 
   claimNoWarnArgs(Args);
   ArgStringList CmdArgs;
 
   // GNU as needs different flags for creating the correct output format
   // on architectures with different ABIs or optional feature sets.
-  switch (getToolChain().getArch()) {
+  switch (ToolChain.getArch()) {
   case llvm::Triple::x86:
 CmdArgs.push_back("--32");
 break;
@@ -47,7 +49,7 @@
 StringRef MArch, MCPU;
 arm::getARMArchCPUFromArgs(Args, MArch, MCPU, /*FromAs*/ true);
 std::string Arch =
-arm::getARMTargetCPU(MCPU, MArch, getToolChain().getTriple());
+arm::getARMTargetCPU(MCPU, MArch, ToolChain.getTriple());
 CmdArgs.push_back(Args.MakeArgString("-mcpu=" + Arch));
 break;
   }
@@ -58,7 +60,7 @@
   case llvm::Triple::mips64el: {
 StringRef CPUName;
 StringRef ABIName;
-mips::getMipsCPUAndABI(Args, getToolChain().getTriple(), CPUName, ABIName);
+mips::getMipsCPUAndABI(Args, ToolChain.getTriple(), CPUName, ABIName);
 
 CmdArgs.push_back("-march");
 CmdArgs.push_back(CPUName.data());
@@ -66,31 +68,31 @@
 CmdArgs.push_back("-mabi");
 CmdArgs.push_back(mips::getGnuCompatibleMipsABIName(ABIName).data());
 
-if (getToolChain().getTriple().isLittleEndian())
+if (ToolChain.getTriple().isLittleEndian())
   CmdArgs.push_back("-EL");
 else
   CmdArgs.push_back("-EB");
 
-AddAssemblerKPIC(getToolChain(), Args, CmdArgs);
+AddAssemblerKPIC(ToolChain, Args, CmdArgs);
 break;
   }
 
   case llvm::Triple::sparc:
   case llvm::Triple::sparcel: {
 CmdArgs.push_back("-32");
-std::string CPU = getCPUName(D, Args, getToolChain().getTriple());
+std::string CPU = getCPUName(D, Args, ToolChain.getTriple());
 CmdArgs.push_back(
-sparc::getSparcAsmModeForCPU(CPU, getToolChain().getTriple()));
-AddAssemblerKPIC(getToolChain(), Args, CmdArgs);
+sparc::getSparcAsmModeForCPU(CPU, ToolChain.getTriple()));
+AddAssemblerKPIC(ToolChain, Args, CmdArgs);
 break;
   }
 
   case llvm::Triple::sparcv9: {
 CmdArgs.push_back("-64");
-std::string CPU = getCPUName(D, Args, getToolChain().getTriple());
+std::string CPU = getCPUName(D, Args, ToolChain.getTriple());
 CmdArgs.push_back(
-sparc::getSparcAsmModeForCPU(CPU, getToolChain().getTriple()));
-AddAssemblerKPIC(getToolChain(), Args, CmdArgs);
+sparc::getSparcAsmModeForCPU(CPU, ToolChain.getTriple()));
+AddAssemblerKPIC(ToolChain, Args, CmdArgs);
 break;
   }
 
@@ -106,7 +108,7 @@
   for (const auto &II : Inputs)
 CmdArgs.push_back(II.getFilename());
 
-  const char *Exec = Args.MakeArgString((getToolChain().GetProgramPath("as")));
+  const char *Exec = Args.MakeArgString((ToolChain.GetProgramPath("as")));
   C.addCommand(std::make_unique(JA, *this,
  ResponseFileSupport::AtFileCurCP(),
  Exec, CmdArgs, Inputs, Output));
@@ -258,9 +260,9 @@
   Args.AddAllArgs(CmdArgs, options::OPT_Z_Flag);
   Args.AddAllArgs(CmdArgs, options::OPT_r);
 
-  bool NeedsSanitizerDeps = addSanitizerRuntimes(getToolChain(), Args, CmdArgs);
+  bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs);
   bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs);
-  AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA);
+  AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 
   const SanitizerArgs &SanArgs = ToolChain.getSanitizerArgs();
   if (SanArgs.needsSharedRt()) {
@@ -297,7 +299,7 @@
 // Use the static OpenMP runtime with -static-openmp
 bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) &&
 !Args.hasArg(options::OPT_static);
-addOpenMPRuntime(CmdArgs, getToolChain(), Args, StaticOpenMP);
+addOpenMPRuntime(CmdArgs, ToolChain, Args, StaticOpenMP);
 
 if (D.CCCIsCXX()) {
   if (ToolChain.ShouldLinkCXXStdlib(Args))
@@ -305,7 +307,7 @@
   CmdArgs.push_back("-lm");
 }
 if (NeedsSanitizerDeps)
-  linkSanitizerRuntimeDeps(getToolChain(), CmdArgs);
+  linkSanitizerR

[PATCH] D111340: [Driver][NetBSD] Use ToolChain reference instead of getToolChain().

2021-10-08 Thread Frederic Cambus via Phabricator via cfe-commits
fcambus marked an inline comment as done.
fcambus added inline comments.



Comment at: clang/lib/Driver/ToolChains/NetBSD.cpp:32
  const char *LinkingOutput) const {
   const Driver &D = getToolChain().getDriver();
 

mgorny wrote:
> Since you're doing it for the other method, maybe it'd make sense to define 
> `ToolChain` here as well.
Makes sense, updated the diff.


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

https://reviews.llvm.org/D111340

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


[clang-tools-extra] b1309a1 - [clangd] Revert unwanted change from D108194

2021-10-08 Thread Kirill Bobyrev via cfe-commits

Author: Kirill Bobyrev
Date: 2021-10-08T10:42:30+02:00
New Revision: b1309a1ed99deb3508da9d53fee2ae1f766d8432

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

LOG: [clangd] Revert unwanted change from D108194

Left-overs from the review process were not deleted.

Added: 


Modified: 
clang-tools-extra/clangd/Headers.h

Removed: 




diff  --git a/clang-tools-extra/clangd/Headers.h 
b/clang-tools-extra/clangd/Headers.h
index 815131572eac1..7b42598b819cb 100644
--- a/clang-tools-extra/clangd/Headers.h
+++ b/clang-tools-extra/clangd/Headers.h
@@ -125,11 +125,6 @@ class IncludeStructure {
   // populates the structure.
   std::unique_ptr collect(const SourceManager &SM);
 
-  void setMainFileEntry(const FileEntry *Entry) {
-assert(Entry && Entry->isValid());
-this->MainFileEntry = Entry;
-  }
-
   // HeaderID identifies file in the include graph. It corresponds to a
   // FileEntry rather than a FileID, but stays stable across preamble & main
   // file builds.



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


[PATCH] D111391: [NFC] [Clang] Use global enum for explicit float mode

2021-10-08 Thread Qiu Chaofan via Phabricator via cfe-commits
qiucf created this revision.
qiucf added reviewers: rjmccall, nemanjai, aaron.ballman, erichkeane.
qiucf requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Currently, there're multiple float types that can be represented by 
`__attribute__((mode(xx)))`. It's parsed, and then a corresponding type is 
created  if available.

This refactor moves the enum for mode into a global enum class visible to 
`ASTContext`, as discussed in D109950 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111391

Files:
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/Basic/TargetInfo.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/Basic/TargetInfo.cpp
  clang/lib/Basic/Targets/X86.h
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/Sema/SemaDeclAttr.cpp

Index: clang/lib/Sema/SemaDeclAttr.cpp
===
--- clang/lib/Sema/SemaDeclAttr.cpp
+++ clang/lib/Sema/SemaDeclAttr.cpp
@@ -4203,9 +4203,10 @@
 /// attribute.
 static void parseModeAttrArg(Sema &S, StringRef Str, unsigned &DestWidth,
  bool &IntegerMode, bool &ComplexMode,
- bool &ExplicitIEEE) {
+ FloatModeKind &ExplicitType) {
   IntegerMode = true;
   ComplexMode = false;
+  ExplicitType = FloatModeKind::NoFloat;
   switch (Str.size()) {
   case 2:
 switch (Str[0]) {
@@ -4225,11 +4226,11 @@
   DestWidth = 96;
   break;
 case 'K': // KFmode - IEEE quad precision (__float128)
-  ExplicitIEEE = true;
+  ExplicitType = FloatModeKind::Float128;
   DestWidth = Str[1] == 'I' ? 0 : 128;
   break;
 case 'T':
-  ExplicitIEEE = false;
+  ExplicitType = FloatModeKind::LongDouble;
   DestWidth = 128;
   break;
 }
@@ -4290,7 +4291,7 @@
   unsigned DestWidth = 0;
   bool IntegerMode = true;
   bool ComplexMode = false;
-  bool ExplicitIEEE = false;
+  FloatModeKind ExplicitType = FloatModeKind::NoFloat;
   llvm::APInt VectorSize(64, 0);
   if (Str.size() >= 4 && Str[0] == 'V') {
 // Minimal length of vector mode is 4: 'V' + NUMBER(>=1) + TYPE(>=2).
@@ -4303,7 +4304,7 @@
 !Str.substr(1, VectorStringLength).getAsInteger(10, VectorSize) &&
 VectorSize.isPowerOf2()) {
   parseModeAttrArg(*this, Str.substr(VectorStringLength + 1), DestWidth,
-   IntegerMode, ComplexMode, ExplicitIEEE);
+   IntegerMode, ComplexMode, ExplicitType);
   // Avoid duplicate warning from template instantiation.
   if (!InInstantiation)
 Diag(AttrLoc, diag::warn_vector_mode_deprecated);
@@ -4314,7 +4315,7 @@
 
   if (!VectorSize)
 parseModeAttrArg(*this, Str, DestWidth, IntegerMode, ComplexMode,
- ExplicitIEEE);
+ ExplicitType);
 
   // FIXME: Sync this with InitializePredefinedMacros; we need to match int8_t
   // and friends, at least with glibc.
@@ -4380,7 +4381,7 @@
 NewElemTy = Context.getIntTypeForBitwidth(DestWidth,
   OldElemTy->isSignedIntegerType());
   else
-NewElemTy = Context.getRealTypeForBitwidth(DestWidth, ExplicitIEEE);
+NewElemTy = Context.getRealTypeForBitwidth(DestWidth, ExplicitType);
 
   if (NewElemTy.isNull()) {
 Diag(AttrLoc, diag::err_machine_mode) << 1 /*Unsupported*/ << Name;
Index: clang/lib/CodeGen/CGCall.cpp
===
--- clang/lib/CodeGen/CGCall.cpp
+++ clang/lib/CodeGen/CGCall.cpp
@@ -1564,11 +1564,11 @@
 default:
   return false;
 case BuiltinType::Float:
-  return getTarget().useObjCFPRetForRealType(TargetInfo::Float);
+  return getTarget().useObjCFPRetForRealType(FloatModeKind::Float);
 case BuiltinType::Double:
-  return getTarget().useObjCFPRetForRealType(TargetInfo::Double);
+  return getTarget().useObjCFPRetForRealType(FloatModeKind::Double);
 case BuiltinType::LongDouble:
-  return getTarget().useObjCFPRetForRealType(TargetInfo::LongDouble);
+  return getTarget().useObjCFPRetForRealType(FloatModeKind::LongDouble);
 }
   }
 
Index: clang/lib/Basic/Targets/X86.h
===
--- clang/lib/Basic/Targets/X86.h
+++ clang/lib/Basic/Targets/X86.h
@@ -412,8 +412,8 @@
 
 // Use fpret for all types.
 RealTypeUsesObjCFPRet =
-((1 << TargetInfo::Float) | (1 << TargetInfo::Double) |
- (1 << TargetInfo::LongDouble));
+((1 << (int)FloatModeKind::Float) | (1 << (int)FloatModeKind::Double) |
+ (1 << (int)FloatModeKind::LongDouble));
 
 // x86-32 has atomics up to 8 bytes
 MaxAtomicPromoteWidth = 64;
@@ -692,7 +692,7 @@
 "64-i64:64-f80:128-n8:16:32:64-S128");
 
 // Use fpret only for long double.
-RealTypeUsesObjCFPRet = (1 << TargetInfo::LongDouble);
+Rea

[PATCH] D110798: [NFC] Use CHECK-NEXT instead of CHECK-SAME in target-invalid-cpu-note.c

2021-10-08 Thread David Spickett via Phabricator via cfe-commits
DavidSpickett added a comment.

This LGTM with the comment reworded. Thanks!




Comment at: clang/test/Misc/target-invalid-cpu-note.c:1
+// Use CHECK-NEXT instead of CHECK-SAME: ensure outputs between different 
lines of CHECK-SAME not missing checked.
 // RUN: not %clang_cc1 -triple armv5--- -target-cpu not-a-cpu -fsyntax-only %s 
2>&1 | FileCheck %s --check-prefix ARM

This wording is a bit confusing, how about:
// Use CHECK-NEXT instead of multiple CHECK-SAME to ensure we will fail if 
there is anything extra in the output


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110798

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


[PATCH] D109950: [Clang] Enable IC/IF mode for __ibm128

2021-10-08 Thread Qiu Chaofan via Phabricator via cfe-commits
qiucf updated this revision to Diff 378131.
qiucf marked 2 inline comments as done.
qiucf added a comment.

Split and rebase upon D111391 .


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109950

Files:
  clang/lib/Basic/TargetInfo.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/Sema/attr-mode.c


Index: clang/test/Sema/attr-mode.c
===
--- clang/test/Sema/attr-mode.c
+++ clang/test/Sema/attr-mode.c
@@ -92,6 +92,12 @@
 void f_ft128_complex_arg(_Complex long double *x);
 void test_TFtype(f128ibm *a) { f_ft128_arg (a); }
 void test_TCtype(c128ibm *a) { f_ft128_complex_arg (a); }
+typedef float w128ibm __attribute__((mode(IF)));
+typedef _Complex float cw128ibm __attribute__((mode(IC)));
+void f_ibm128_arg(__ibm128 *x);
+void f_ibm128_complex_arg(_Complex __ibm128 *x);
+void test_IFtype(w128ibm *a) { f_ibm128_arg(a); }
+void test_ICtype(cw128ibm *a) { f_ibm128_complex_arg(a); }
 #elif TEST_F128_PPC64
 typedef int invalid_7 __attribute((mode(KF))); // expected-error{{type of 
machine mode does not match type of base type}}
 typedef int invalid_8 __attribute((mode(KI))); // expected-error{{unknown 
machine mode}}
Index: clang/lib/Sema/SemaDeclAttr.cpp
===
--- clang/lib/Sema/SemaDeclAttr.cpp
+++ clang/lib/Sema/SemaDeclAttr.cpp
@@ -4233,6 +4233,10 @@
   ExplicitType = FloatModeKind::LongDouble;
   DestWidth = 128;
   break;
+case 'I':
+  ExplicitType = FloatModeKind::Ibm128;
+  DestWidth = Str[1] == 'I' ? 0 : 128;
+  break;
 }
 if (Str[1] == 'F') {
   IntegerMode = false;
Index: clang/lib/Basic/TargetInfo.cpp
===
--- clang/lib/Basic/TargetInfo.cpp
+++ clang/lib/Basic/TargetInfo.cpp
@@ -297,11 +297,11 @@
 if (ExplicitType == FloatModeKind::Float128)
   return hasFloat128Type() ? FloatModeKind::Float128
: FloatModeKind::NoFloat;
-if (&getLongDoubleFormat() == &llvm::APFloat::PPCDoubleDouble() ||
-&getLongDoubleFormat() == &llvm::APFloat::IEEEquad())
-  return FloatModeKind::LongDouble;
-if (hasFloat128Type())
-  return FloatModeKind::Float128;
+if (ExplicitType == FloatModeKind::Ibm128)
+  return hasIbm128Type() ? FloatModeKind::Ibm128
+ : FloatModeKind::NoFloat;
+if (ExplicitType == FloatModeKind::LongDouble)
+  return ExplicitType;
 break;
   }
 


Index: clang/test/Sema/attr-mode.c
===
--- clang/test/Sema/attr-mode.c
+++ clang/test/Sema/attr-mode.c
@@ -92,6 +92,12 @@
 void f_ft128_complex_arg(_Complex long double *x);
 void test_TFtype(f128ibm *a) { f_ft128_arg (a); }
 void test_TCtype(c128ibm *a) { f_ft128_complex_arg (a); }
+typedef float w128ibm __attribute__((mode(IF)));
+typedef _Complex float cw128ibm __attribute__((mode(IC)));
+void f_ibm128_arg(__ibm128 *x);
+void f_ibm128_complex_arg(_Complex __ibm128 *x);
+void test_IFtype(w128ibm *a) { f_ibm128_arg(a); }
+void test_ICtype(cw128ibm *a) { f_ibm128_complex_arg(a); }
 #elif TEST_F128_PPC64
 typedef int invalid_7 __attribute((mode(KF))); // expected-error{{type of machine mode does not match type of base type}}
 typedef int invalid_8 __attribute((mode(KI))); // expected-error{{unknown machine mode}}
Index: clang/lib/Sema/SemaDeclAttr.cpp
===
--- clang/lib/Sema/SemaDeclAttr.cpp
+++ clang/lib/Sema/SemaDeclAttr.cpp
@@ -4233,6 +4233,10 @@
   ExplicitType = FloatModeKind::LongDouble;
   DestWidth = 128;
   break;
+case 'I':
+  ExplicitType = FloatModeKind::Ibm128;
+  DestWidth = Str[1] == 'I' ? 0 : 128;
+  break;
 }
 if (Str[1] == 'F') {
   IntegerMode = false;
Index: clang/lib/Basic/TargetInfo.cpp
===
--- clang/lib/Basic/TargetInfo.cpp
+++ clang/lib/Basic/TargetInfo.cpp
@@ -297,11 +297,11 @@
 if (ExplicitType == FloatModeKind::Float128)
   return hasFloat128Type() ? FloatModeKind::Float128
: FloatModeKind::NoFloat;
-if (&getLongDoubleFormat() == &llvm::APFloat::PPCDoubleDouble() ||
-&getLongDoubleFormat() == &llvm::APFloat::IEEEquad())
-  return FloatModeKind::LongDouble;
-if (hasFloat128Type())
-  return FloatModeKind::Float128;
+if (ExplicitType == FloatModeKind::Ibm128)
+  return hasIbm128Type() ? FloatModeKind::Ibm128
+ : FloatModeKind::NoFloat;
+if (ExplicitType == FloatModeKind::LongDouble)
+  return ExplicitType;
 break;
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/ma

[clang] c0f9c7c - [X86] Check if struct is blank before getting the inner types

2021-10-08 Thread via cfe-commits

Author: Wang, Pengfei
Date: 2021-10-08T17:09:34+08:00
New Revision: c0f9c7c01561a70974485e0e4a358d6bbdaf3b8e

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

LOG: [X86] Check if struct is blank before getting the inner types

This fixes pr52011.

Reviewed By: LuoYuanke

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

Added: 


Modified: 
clang/lib/CodeGen/TargetInfo.cpp
clang/test/CodeGen/X86/avx512fp16-abi.c

Removed: 




diff  --git a/clang/lib/CodeGen/TargetInfo.cpp 
b/clang/lib/CodeGen/TargetInfo.cpp
index bebadc44725cc..10951a01150a8 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -3415,6 +3415,9 @@ static llvm::Type *getFPTypeAtOffset(llvm::Type *IRType, 
unsigned IROffset,
 
   // If this is a struct, recurse into the field at the specified offset.
   if (llvm::StructType *STy = dyn_cast(IRType)) {
+if (!STy->getNumContainedTypes())
+  return nullptr;
+
 const llvm::StructLayout *SL = TD.getStructLayout(STy);
 unsigned Elt = SL->getElementContainingOffset(IROffset);
 IROffset -= SL->getElementOffset(Elt);

diff  --git a/clang/test/CodeGen/X86/avx512fp16-abi.c 
b/clang/test/CodeGen/X86/avx512fp16-abi.c
index 5018567d5bb4d..1144274280557 100644
--- a/clang/test/CodeGen/X86/avx512fp16-abi.c
+++ b/clang/test/CodeGen/X86/avx512fp16-abi.c
@@ -197,3 +197,44 @@ _Float16 fs2(struct shalf2 s) {
   // CHECK-CPP: define{{.*}} @_Z3fs26shalf2(double {{.*}}
   return s.a;
 };
+
+struct fsd {
+  float a;
+  struct {};
+  double b;
+};
+
+struct fsd pr52011() {
+  // CHECK: define{{.*}} { float, double } @
+}
+
+struct hsd {
+  _Float16 a;
+  struct {};
+  double b;
+};
+
+struct hsd pr52011_2() {
+  // CHECK: define{{.*}} { half, double } @
+}
+
+struct hsf {
+  _Float16 a;
+  struct {};
+  float b;
+};
+
+struct hsf pr52011_3() {
+  // CHECK: define{{.*}} <4 x half> @
+}
+
+struct fds {
+  float a;
+  double b;
+  struct {};
+};
+
+struct fds pr52011_4() {
+  // CHECK-C: define{{.*}} { float, double } @pr52011_4
+  // CHECK-CPP: define{{.*}} void @_Z9pr52011_4v({{.*}} sret
+}



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


[PATCH] D111037: [X86] Check if struct is blank before getting the inner types

2021-10-08 Thread Pengfei Wang via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc0f9c7c01561: [X86] Check if struct is blank before getting 
the inner types (authored by pengfei).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111037

Files:
  clang/lib/CodeGen/TargetInfo.cpp
  clang/test/CodeGen/X86/avx512fp16-abi.c


Index: clang/test/CodeGen/X86/avx512fp16-abi.c
===
--- clang/test/CodeGen/X86/avx512fp16-abi.c
+++ clang/test/CodeGen/X86/avx512fp16-abi.c
@@ -197,3 +197,44 @@
   // CHECK-CPP: define{{.*}} @_Z3fs26shalf2(double {{.*}}
   return s.a;
 };
+
+struct fsd {
+  float a;
+  struct {};
+  double b;
+};
+
+struct fsd pr52011() {
+  // CHECK: define{{.*}} { float, double } @
+}
+
+struct hsd {
+  _Float16 a;
+  struct {};
+  double b;
+};
+
+struct hsd pr52011_2() {
+  // CHECK: define{{.*}} { half, double } @
+}
+
+struct hsf {
+  _Float16 a;
+  struct {};
+  float b;
+};
+
+struct hsf pr52011_3() {
+  // CHECK: define{{.*}} <4 x half> @
+}
+
+struct fds {
+  float a;
+  double b;
+  struct {};
+};
+
+struct fds pr52011_4() {
+  // CHECK-C: define{{.*}} { float, double } @pr52011_4
+  // CHECK-CPP: define{{.*}} void @_Z9pr52011_4v({{.*}} sret
+}
Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -3415,6 +3415,9 @@
 
   // If this is a struct, recurse into the field at the specified offset.
   if (llvm::StructType *STy = dyn_cast(IRType)) {
+if (!STy->getNumContainedTypes())
+  return nullptr;
+
 const llvm::StructLayout *SL = TD.getStructLayout(STy);
 unsigned Elt = SL->getElementContainingOffset(IROffset);
 IROffset -= SL->getElementOffset(Elt);


Index: clang/test/CodeGen/X86/avx512fp16-abi.c
===
--- clang/test/CodeGen/X86/avx512fp16-abi.c
+++ clang/test/CodeGen/X86/avx512fp16-abi.c
@@ -197,3 +197,44 @@
   // CHECK-CPP: define{{.*}} @_Z3fs26shalf2(double {{.*}}
   return s.a;
 };
+
+struct fsd {
+  float a;
+  struct {};
+  double b;
+};
+
+struct fsd pr52011() {
+  // CHECK: define{{.*}} { float, double } @
+}
+
+struct hsd {
+  _Float16 a;
+  struct {};
+  double b;
+};
+
+struct hsd pr52011_2() {
+  // CHECK: define{{.*}} { half, double } @
+}
+
+struct hsf {
+  _Float16 a;
+  struct {};
+  float b;
+};
+
+struct hsf pr52011_3() {
+  // CHECK: define{{.*}} <4 x half> @
+}
+
+struct fds {
+  float a;
+  double b;
+  struct {};
+};
+
+struct fds pr52011_4() {
+  // CHECK-C: define{{.*}} { float, double } @pr52011_4
+  // CHECK-CPP: define{{.*}} void @_Z9pr52011_4v({{.*}} sret
+}
Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -3415,6 +3415,9 @@
 
   // If this is a struct, recurse into the field at the specified offset.
   if (llvm::StructType *STy = dyn_cast(IRType)) {
+if (!STy->getNumContainedTypes())
+  return nullptr;
+
 const llvm::StructLayout *SL = TD.getStructLayout(STy);
 unsigned Elt = SL->getElementContainingOffset(IROffset);
 IROffset -= SL->getElementOffset(Elt);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 1f90b36 - [Driver][NetBSD] Use ToolChain reference instead of getToolChain().

2021-10-08 Thread Frederic Cambus via cfe-commits

Author: Frederic Cambus
Date: 2021-10-08T11:13:22+02:00
New Revision: 1f90b365bd626e5d7d963106692143699c69f616

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

LOG: [Driver][NetBSD] Use ToolChain reference instead of getToolChain().

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

Added: 


Modified: 
clang/lib/Driver/ToolChains/NetBSD.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/NetBSD.cpp 
b/clang/lib/Driver/ToolChains/NetBSD.cpp
index 0cadd2b7666c9..0a8c254306c6c 100644
--- a/clang/lib/Driver/ToolChains/NetBSD.cpp
+++ b/clang/lib/Driver/ToolChains/NetBSD.cpp
@@ -29,14 +29,16 @@ void netbsd::Assembler::ConstructJob(Compilation &C, const 
JobAction &JA,
  const InputInfoList &Inputs,
  const ArgList &Args,
  const char *LinkingOutput) const {
-  const Driver &D = getToolChain().getDriver();
+  const toolchains::NetBSD &ToolChain =
+static_cast(getToolChain());
+  const Driver &D = ToolChain.getDriver();
 
   claimNoWarnArgs(Args);
   ArgStringList CmdArgs;
 
   // GNU as needs 
diff erent flags for creating the correct output format
   // on architectures with 
diff erent ABIs or optional feature sets.
-  switch (getToolChain().getArch()) {
+  switch (ToolChain.getArch()) {
   case llvm::Triple::x86:
 CmdArgs.push_back("--32");
 break;
@@ -47,7 +49,7 @@ void netbsd::Assembler::ConstructJob(Compilation &C, const 
JobAction &JA,
 StringRef MArch, MCPU;
 arm::getARMArchCPUFromArgs(Args, MArch, MCPU, /*FromAs*/ true);
 std::string Arch =
-arm::getARMTargetCPU(MCPU, MArch, getToolChain().getTriple());
+arm::getARMTargetCPU(MCPU, MArch, ToolChain.getTriple());
 CmdArgs.push_back(Args.MakeArgString("-mcpu=" + Arch));
 break;
   }
@@ -58,7 +60,7 @@ void netbsd::Assembler::ConstructJob(Compilation &C, const 
JobAction &JA,
   case llvm::Triple::mips64el: {
 StringRef CPUName;
 StringRef ABIName;
-mips::getMipsCPUAndABI(Args, getToolChain().getTriple(), CPUName, ABIName);
+mips::getMipsCPUAndABI(Args, ToolChain.getTriple(), CPUName, ABIName);
 
 CmdArgs.push_back("-march");
 CmdArgs.push_back(CPUName.data());
@@ -66,31 +68,31 @@ void netbsd::Assembler::ConstructJob(Compilation &C, const 
JobAction &JA,
 CmdArgs.push_back("-mabi");
 CmdArgs.push_back(mips::getGnuCompatibleMipsABIName(ABIName).data());
 
-if (getToolChain().getTriple().isLittleEndian())
+if (ToolChain.getTriple().isLittleEndian())
   CmdArgs.push_back("-EL");
 else
   CmdArgs.push_back("-EB");
 
-AddAssemblerKPIC(getToolChain(), Args, CmdArgs);
+AddAssemblerKPIC(ToolChain, Args, CmdArgs);
 break;
   }
 
   case llvm::Triple::sparc:
   case llvm::Triple::sparcel: {
 CmdArgs.push_back("-32");
-std::string CPU = getCPUName(D, Args, getToolChain().getTriple());
+std::string CPU = getCPUName(D, Args, ToolChain.getTriple());
 CmdArgs.push_back(
-sparc::getSparcAsmModeForCPU(CPU, getToolChain().getTriple()));
-AddAssemblerKPIC(getToolChain(), Args, CmdArgs);
+sparc::getSparcAsmModeForCPU(CPU, ToolChain.getTriple()));
+AddAssemblerKPIC(ToolChain, Args, CmdArgs);
 break;
   }
 
   case llvm::Triple::sparcv9: {
 CmdArgs.push_back("-64");
-std::string CPU = getCPUName(D, Args, getToolChain().getTriple());
+std::string CPU = getCPUName(D, Args, ToolChain.getTriple());
 CmdArgs.push_back(
-sparc::getSparcAsmModeForCPU(CPU, getToolChain().getTriple()));
-AddAssemblerKPIC(getToolChain(), Args, CmdArgs);
+sparc::getSparcAsmModeForCPU(CPU, ToolChain.getTriple()));
+AddAssemblerKPIC(ToolChain, Args, CmdArgs);
 break;
   }
 
@@ -106,7 +108,7 @@ void netbsd::Assembler::ConstructJob(Compilation &C, const 
JobAction &JA,
   for (const auto &II : Inputs)
 CmdArgs.push_back(II.getFilename());
 
-  const char *Exec = Args.MakeArgString((getToolChain().GetProgramPath("as")));
+  const char *Exec = Args.MakeArgString((ToolChain.GetProgramPath("as")));
   C.addCommand(std::make_unique(JA, *this,
  ResponseFileSupport::AtFileCurCP(),
  Exec, CmdArgs, Inputs, Output));
@@ -258,9 +260,9 @@ void netbsd::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
   Args.AddAllArgs(CmdArgs, options::OPT_Z_Flag);
   Args.AddAllArgs(CmdArgs, options::OPT_r);
 
-  bool NeedsSanitizerDeps = addSanitizerRuntimes(getToolChain(), Args, 
CmdArgs);
+  bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs);
   bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs);
-  AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA);
+  

[PATCH] D111340: [Driver][NetBSD] Use ToolChain reference instead of getToolChain().

2021-10-08 Thread Frederic Cambus via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
fcambus marked an inline comment as done.
Closed by commit rG1f90b365bd62: [Driver][NetBSD] Use ToolChain reference 
instead of getToolChain(). (authored by fcambus).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111340

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

Index: clang/lib/Driver/ToolChains/NetBSD.cpp
===
--- clang/lib/Driver/ToolChains/NetBSD.cpp
+++ clang/lib/Driver/ToolChains/NetBSD.cpp
@@ -29,14 +29,16 @@
  const InputInfoList &Inputs,
  const ArgList &Args,
  const char *LinkingOutput) const {
-  const Driver &D = getToolChain().getDriver();
+  const toolchains::NetBSD &ToolChain =
+static_cast(getToolChain());
+  const Driver &D = ToolChain.getDriver();
 
   claimNoWarnArgs(Args);
   ArgStringList CmdArgs;
 
   // GNU as needs different flags for creating the correct output format
   // on architectures with different ABIs or optional feature sets.
-  switch (getToolChain().getArch()) {
+  switch (ToolChain.getArch()) {
   case llvm::Triple::x86:
 CmdArgs.push_back("--32");
 break;
@@ -47,7 +49,7 @@
 StringRef MArch, MCPU;
 arm::getARMArchCPUFromArgs(Args, MArch, MCPU, /*FromAs*/ true);
 std::string Arch =
-arm::getARMTargetCPU(MCPU, MArch, getToolChain().getTriple());
+arm::getARMTargetCPU(MCPU, MArch, ToolChain.getTriple());
 CmdArgs.push_back(Args.MakeArgString("-mcpu=" + Arch));
 break;
   }
@@ -58,7 +60,7 @@
   case llvm::Triple::mips64el: {
 StringRef CPUName;
 StringRef ABIName;
-mips::getMipsCPUAndABI(Args, getToolChain().getTriple(), CPUName, ABIName);
+mips::getMipsCPUAndABI(Args, ToolChain.getTriple(), CPUName, ABIName);
 
 CmdArgs.push_back("-march");
 CmdArgs.push_back(CPUName.data());
@@ -66,31 +68,31 @@
 CmdArgs.push_back("-mabi");
 CmdArgs.push_back(mips::getGnuCompatibleMipsABIName(ABIName).data());
 
-if (getToolChain().getTriple().isLittleEndian())
+if (ToolChain.getTriple().isLittleEndian())
   CmdArgs.push_back("-EL");
 else
   CmdArgs.push_back("-EB");
 
-AddAssemblerKPIC(getToolChain(), Args, CmdArgs);
+AddAssemblerKPIC(ToolChain, Args, CmdArgs);
 break;
   }
 
   case llvm::Triple::sparc:
   case llvm::Triple::sparcel: {
 CmdArgs.push_back("-32");
-std::string CPU = getCPUName(D, Args, getToolChain().getTriple());
+std::string CPU = getCPUName(D, Args, ToolChain.getTriple());
 CmdArgs.push_back(
-sparc::getSparcAsmModeForCPU(CPU, getToolChain().getTriple()));
-AddAssemblerKPIC(getToolChain(), Args, CmdArgs);
+sparc::getSparcAsmModeForCPU(CPU, ToolChain.getTriple()));
+AddAssemblerKPIC(ToolChain, Args, CmdArgs);
 break;
   }
 
   case llvm::Triple::sparcv9: {
 CmdArgs.push_back("-64");
-std::string CPU = getCPUName(D, Args, getToolChain().getTriple());
+std::string CPU = getCPUName(D, Args, ToolChain.getTriple());
 CmdArgs.push_back(
-sparc::getSparcAsmModeForCPU(CPU, getToolChain().getTriple()));
-AddAssemblerKPIC(getToolChain(), Args, CmdArgs);
+sparc::getSparcAsmModeForCPU(CPU, ToolChain.getTriple()));
+AddAssemblerKPIC(ToolChain, Args, CmdArgs);
 break;
   }
 
@@ -106,7 +108,7 @@
   for (const auto &II : Inputs)
 CmdArgs.push_back(II.getFilename());
 
-  const char *Exec = Args.MakeArgString((getToolChain().GetProgramPath("as")));
+  const char *Exec = Args.MakeArgString((ToolChain.GetProgramPath("as")));
   C.addCommand(std::make_unique(JA, *this,
  ResponseFileSupport::AtFileCurCP(),
  Exec, CmdArgs, Inputs, Output));
@@ -258,9 +260,9 @@
   Args.AddAllArgs(CmdArgs, options::OPT_Z_Flag);
   Args.AddAllArgs(CmdArgs, options::OPT_r);
 
-  bool NeedsSanitizerDeps = addSanitizerRuntimes(getToolChain(), Args, CmdArgs);
+  bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs);
   bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs);
-  AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA);
+  AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 
   const SanitizerArgs &SanArgs = ToolChain.getSanitizerArgs();
   if (SanArgs.needsSharedRt()) {
@@ -297,7 +299,7 @@
 // Use the static OpenMP runtime with -static-openmp
 bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) &&
 !Args.hasArg(options::OPT_static);
-addOpenMPRuntime(CmdArgs, getToolChain(), Args, StaticOpenMP);
+addOpenMPRuntime(CmdArgs, ToolChain, Args, StaticOpenMP);
 
 if (D.CCCIsCXX()) {
   if (ToolChain.ShouldLinkCXXStdlib(Args))
@@ -305,7 +307,7 @@
 

[PATCH] D111208: [clang-tidy] Support globbing in NOLINT* expressions

2021-10-08 Thread Salman Javed via Phabricator via cfe-commits
salman-javed-nz added a comment.

What should happen with the following code:

  // NOLINTBEGIN(google*)
  
  // NOLINTEND(google-explicit-constructor)
  // NOLINTEND(google-runtime-operator)

and this code:

  // NOLINTBEGIN(google-explicit-constructor)
  // NOLINTBEGIN(google-runtime-operator)
  
  // NOLINTEND(google*)

At the moment, Clang-Tidy does not allow mixing "check-specific" 
`NOLINTBEGIN/END`s with "global" ones. See discussion in D108560#3020444 
. So the following is not a supported 
construct:

  // NOLINTBEGIN(google-explicit-constructor)
  // NOLINTEND(*)

How should Clang-Tidy behave when mixing check-specific `NOLINTBEGIN/END`s with 
globbed ones?




Comment at: clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp:349
+  // Allow specifying a few checks with a glob expression.
+  GlobList Globs(ChecksStr);
+  if (!Globs.contains(CheckName))

What happens when `CheckStr` is empty?
How has Clang-Tidy treated `// NOLINT()` in the past? Does this patch change 
the behaviour? What //should // be the "right" behaviour?



Comment at: clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp:353
+  if (SuppressionIsSpecific)
+*SuppressionIsSpecific = true;
 }

So when this function is called with args `Line = "NOLINTBEGIN(google*)"` and 
`CheckName = "google-explicit-constructor"`, it will return true with 
`*SuppressionIsSpecific = true`.
Should `*SuppressionIsSpecific = false` instead here?



Comment at: clang-tools-extra/docs/clang-tidy/index.rst:341
+// Silence all warnings from the "google" module
+Foo(bool param);  // NOLINT(google*)
+

To match the spacing in the above lines.



Comment at: clang-tools-extra/docs/clang-tidy/index.rst:344
+// Silence all warnings, *except* the ones from the "google" module
+Foo(bool param);  // NOLINT(*,-google*)
+





Comment at: clang-tools-extra/docs/clang-tidy/index.rst:347
+// No warnings are suppressed, due to double negation
+Foo(bool param);  // NOLINT(-google*)
   };

carlosgalvezp wrote:
> salman-javed-nz wrote:
> > Would anyone do this on purpose, or is this a user error?
> I don't see any use case here, no. I just thought to document it to clarify 
> the double negation that's happening, in case a user gets confused and 
> doesn't see the warning being suppressed.
> 
> Do you think it brings value or does more harm than good?




Comment at: clang-tools-extra/test/clang-tidy/infrastructure/nolint.cpp:63
+
+class D6 { D6(int x); }; // NOLINT(*,-google*)
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: single-argument constructors must 
be marked explicit

How about changing `class D6` so that it violates 2 checks: a google one and a 
non-google one.
Then you can confirm whether the `*` in `NOLINT(*,-google*)` is working.


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

https://reviews.llvm.org/D111208

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


[clang] 35ebe4c - [Clang][OpenMP] Add partial support for Static Device Libraries

2021-10-08 Thread Saiyedul Islam via cfe-commits

Author: Saiyedul Islam
Date: 2021-10-08T09:37:51Z
New Revision: 35ebe4cc24f87397762e35831953c4bfe5f52def

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

LOG: [Clang][OpenMP] Add partial support for Static Device Libraries

An archive containing device code object files can be passed to
clang command line for linking. For each given offload target
it creates a device specific archives which is either passed to llvm-link
if the target is amdgpu, or to clang-nvlink-wrapper if the target is
nvptx. -L/-l flags are used to specify these fat archives on the command
line. E.g.
  clang++ -fopenmp -fopenmp-targets=nvptx64 main.cpp -L. -lmylib

It currently doesn't support linking an archive directly, like:
  clang++ -fopenmp -fopenmp-targets=nvptx64 main.cpp libmylib.a

Linking with x86 offload also does not work.

Reviewed By: ye-luo

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

Added: 
clang/test/Driver/Inputs/openmp_static_device_link/libFatArchive.a
clang/test/Driver/fat_archive_amdgpu.cpp
clang/test/Driver/fat_archive_nvptx.cpp

Modified: 
clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/lib/Driver/ToolChains/CommonArgs.h
clang/lib/Driver/ToolChains/Cuda.cpp
clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp 
b/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
index 135e3694434db..5400e26177291 100644
--- a/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
+++ b/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
@@ -114,6 +114,10 @@ const char *AMDGCN::OpenMPLinker::constructLLVMLinkCommand(
 }
   }
 
+  AddStaticDeviceLibsLinking(C, *this, JA, Inputs, Args, CmdArgs, "amdgcn",
+  SubArchName,
+  /* bitcode SDL?*/ true,
+  /* PostClang Link? */ false);
   // Add an intermediate output file.
   CmdArgs.push_back("-o");
   const char *OutputFileName =

diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 3f98914bd1904..c636c25a1dc81 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -7745,12 +7745,28 @@ void OffloadBundler::ConstructJob(Compilation &C, const 
JobAction &JA,
 Triples += Action::GetOffloadKindName(CurKind);
 Triples += '-';
 Triples += CurTC->getTriple().normalize();
-if ((CurKind == Action::OFK_HIP || CurKind == Action::OFK_OpenMP ||
- CurKind == Action::OFK_Cuda) &&
+if ((CurKind == Action::OFK_HIP || CurKind == Action::OFK_Cuda) &&
 CurDep->getOffloadingArch()) {
   Triples += '-';
   Triples += CurDep->getOffloadingArch();
 }
+
+// TODO: Replace parsing of -march flag. Can be done by storing GPUArch
+//   with each toolchain.
+StringRef GPUArchName;
+if (CurKind == Action::OFK_OpenMP) {
+  // Extract GPUArch from -march argument in TC argument list.
+  for (unsigned ArgIndex = 0; ArgIndex < TCArgs.size(); ArgIndex++) {
+auto ArchStr = StringRef(TCArgs.getArgString(ArgIndex));
+auto Arch = ArchStr.startswith_insensitive("-march=");
+if (Arch) {
+  GPUArchName = ArchStr.substr(7);
+  Triples += "-";
+  break;
+}
+  }
+  Triples += GPUArchName.str();
+}
   }
   CmdArgs.push_back(TCArgs.MakeArgString(Triples));
 
@@ -7824,12 +7840,27 @@ void OffloadBundler::ConstructJobMultipleOutputs(
 Triples += '-';
 Triples += Dep.DependentToolChain->getTriple().normalize();
 if ((Dep.DependentOffloadKind == Action::OFK_HIP ||
- Dep.DependentOffloadKind == Action::OFK_OpenMP ||
  Dep.DependentOffloadKind == Action::OFK_Cuda) &&
 !Dep.DependentBoundArch.empty()) {
   Triples += '-';
   Triples += Dep.DependentBoundArch;
 }
+// TODO: Replace parsing of -march flag. Can be done by storing GPUArch
+//   with each toolchain.
+StringRef GPUArchName;
+if (Dep.DependentOffloadKind == Action::OFK_OpenMP) {
+  // Extract GPUArch from -march argument in TC argument list.
+  for (unsigned ArgIndex = 0; ArgIndex < TCArgs.size(); ArgIndex++) {
+StringRef ArchStr = StringRef(TCArgs.getArgString(ArgIndex));
+auto Arch = ArchStr.startswith_insensitive("-march=");
+if (Arch) {
+  GPUArchName = ArchStr.substr(7);
+  Triples += "-";
+  break;
+}
+  }
+  Triples += GPUArchName.str();
+}
   }
 
   CmdArgs.push_back(TCArgs.MakeArgString(Triples));

diff  --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 9f1895466c98d..c3abdf446cfaf

[clang] 5ab6ee7 - Fix a variety of bugs with nil-receiver checks when targeting

2021-10-08 Thread John McCall via cfe-commits

Author: John McCall
Date: 2021-10-08T05:44:06-04:00
New Revision: 5ab6ee75994d645725264e757d67bbb1c96fb2b6

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

LOG: Fix a variety of bugs with nil-receiver checks when targeting
non-Darwin ObjC runtimes:

- Use the same logic the Darwin runtime does for inferring that a
  receiver is non-null and therefore doesn't require null checks.
  Previously we weren't skipping these for non-super dispatch.

- Emit a null check when there's a consumed parameter so that we can
  destroy the argument if the call doesn't happen.  This mostly
  involves extracting some common logic from the Darwin-runtime code.

- Generate a zero aggregate by zeroing the same memory that was used
  in the method call instead of zeroing separate memory and then
  merging them with a phi.  This uses less memory and avoids unnecessary
  copies.

- Emit zero initialization, and generate zero values in phis, using
  the proper zero-value routines instead of assuming that the zero
  value of the result type has a bitwise-zero representation.

Added: 
clang/test/CodeGenObjC/gnu-nil-receiver.m

Modified: 
clang/include/clang/AST/DeclObjC.h
clang/lib/AST/Decl.cpp
clang/lib/AST/DeclObjC.cpp
clang/lib/CodeGen/CGObjCGNU.cpp
clang/lib/CodeGen/CGObjCMac.cpp
clang/lib/CodeGen/CGObjCRuntime.cpp
clang/lib/CodeGen/CGObjCRuntime.h

Removed: 




diff  --git a/clang/include/clang/AST/DeclObjC.h 
b/clang/include/clang/AST/DeclObjC.h
index f484dfedbf544..79ec1d6e5c3c2 100644
--- a/clang/include/clang/AST/DeclObjC.h
+++ b/clang/include/clang/AST/DeclObjC.h
@@ -487,6 +487,9 @@ class ObjCMethodDecl : public NamedDecl, public DeclContext 
{
   /// True if the method is tagged as objc_direct
   bool isDirectMethod() const;
 
+  /// True if the method has a parameter that's destroyed in the callee.
+  bool hasParamDestroyedInCallee() const;
+
   /// Returns the property associated with this method's selector.
   ///
   /// Note that even if this particular method is not marked as a property

diff  --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index acc0839dba753..6a837430924f3 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -2789,11 +2789,15 @@ SourceRange ParmVarDecl::getSourceRange() const {
 }
 
 bool ParmVarDecl::isDestroyedInCallee() const {
+  // ns_consumed only affects code generation in ARC
   if (hasAttr())
-return true;
+return getASTContext().getLangOpts().ObjCAutoRefCount;
 
+  // FIXME: isParamDestroyedInCallee() should probably imply
+  // isDestructedType()
   auto *RT = getType()->getAs();
-  if (RT && RT->getDecl()->isParamDestroyedInCallee())
+  if (RT && RT->getDecl()->isParamDestroyedInCallee() &&
+  getType().isDestructedType())
 return true;
 
   return false;

diff  --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp
index 6e790f03b0270..64eefc245f04a 100644
--- a/clang/lib/AST/DeclObjC.cpp
+++ b/clang/lib/AST/DeclObjC.cpp
@@ -855,6 +855,14 @@ bool 
ObjCMethodDecl::isDesignatedInitializerForTheInterface(
   return false;
 }
 
+bool ObjCMethodDecl::hasParamDestroyedInCallee() const {
+  for (auto param : parameters()) {
+if (param->isDestroyedInCallee())
+  return true;
+  }
+  return false;
+}
+
 Stmt *ObjCMethodDecl::getBody() const {
   return Body.get(getASTContext().getExternalSource());
 }

diff  --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp
index 3f361f4e79317..e016644150b4f 100644
--- a/clang/lib/CodeGen/CGObjCGNU.cpp
+++ b/clang/lib/CodeGen/CGObjCGNU.cpp
@@ -2651,35 +2651,6 @@ CGObjCGNU::GenerateMessageSend(CodeGenFunction &CGF,
 }
   }
 
-  // If the return type is something that goes in an integer register, the
-  // runtime will handle 0 returns.  For other cases, we fill in the 0 value
-  // ourselves.
-  //
-  // The language spec says the result of this kind of message send is
-  // undefined, but lots of people seem to have forgotten to read that
-  // paragraph and insist on sending messages to nil that have structure
-  // returns.  With GCC, this generates a random return value (whatever happens
-  // to be on the stack / in those registers at the time) on most platforms,
-  // and generates an illegal instruction trap on SPARC.  With LLVM it corrupts
-  // the stack.
-  bool isPointerSizedReturn = (ResultType->isAnyPointerType() ||
-  ResultType->isIntegralOrEnumerationType() || ResultType->isVoidType());
-
-  llvm::BasicBlock *startBB = nullptr;
-  llvm::BasicBlock *messageBB = nullptr;
-  llvm::BasicBlock *continueBB = nullptr;
-
-  if (!isPointerSizedReturn) {
-startBB = Builder.GetInsertBlock();
-messageBB = CGF.createBasicBlock("msgSend");
-continueBB = CGF.createBasicBlock("continue");
-
-llvm::Value *is

[PATCH] D111293: [CFE][Codegen][In-progress] Remove CodeGenFunction::InitTempAlloca()

2021-10-08 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

Hmm.  I decided the ObjC case needed a more complex change and went ahead and 
committed that fix here: 
https://github.com/llvm/llvm-project/commit/5ab6ee75994d.  That obviates the 
need for the new test; sorry for the runaround.  Please rebase and I'll review.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111293

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


[PATCH] D111273: [clang-format-diff] Fix missing formatting for zero length git diff lines

2021-10-08 Thread Hans Wennborg via Phabricator via cfe-commits
hans accepted this revision.
hans added a comment.
This revision is now accepted and ready to land.

lgtm

If you want to look into it, I think having some kind of test for this script 
would be useful.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111273

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


[PATCH] D111208: [clang-tidy] Support globbing in NOLINT* expressions

2021-10-08 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp added a comment.

> How should Clang-Tidy behave when mixing check-specific NOLINTBEGIN/ENDs with 
> globbed ones?

I would say keep current behavior - complain that the user wrote something 
different in the BEGIN and in the END. I like keeping things simple and easy to 
read and reason about. I think adding smarter logic here would make 
clang-tidy's code more complicated, but also it would allow users to write more 
complicated NOLINT expressions that would be very hard to read and track.

Honestly as a user I'm more than fine with one level of NOLINTBEGIN/END. Any 
more nesting than that causes me much more cognitive effort than it's worth.

What do you think?


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

https://reviews.llvm.org/D111208

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


[PATCH] D111273: [clang-format-diff] Fix missing formatting for zero length git diff lines

2021-10-08 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay accepted this revision.
MyDeveloperDay added a comment.

So this isn't just clang-format-diff.py but also all of `git clang-format`

  
  git add Analysis.cpp
  $ git clang-format
  clang-format did not modify any files

This is bad because this is a way in which those using "git clang-format" can 
miss formatting a line

So ultimately looking at the diff (normal diff)

  $ git diff --cached Analysis.cpp
  diff --git a/llvm/lib/CodeGen/Analysis.cpp b/llvm/lib/CodeGen/Analysis.cpp
  index e5d576d879b5..3107fc0b9936 100644
  --- a/llvm/lib/CodeGen/Analysis.cpp
  +++ b/llvm/lib/CodeGen/Analysis.cpp
  @@ -115,7 +115,6 @@ void llvm::ComputeValueVTs(const TargetLowering &TLI, 
const DataLayout &DL,
   return;
 // Base case: we can get an EVT for this LLVM IR type.
 ValueVTs.push_back(TLI.getValueType(DL, Ty));
  -  if (MemVTs)
   MemVTs->push_back(TLI.getMemValueType(DL, Ty));
 if (Offsets)
   Offsets->push_back(StartingOffset);

This is going to give us a start_line of 115 and a line_count of 6 and hence an 
end_line of 115+5 = 120

F19483241: image.png 

if clang-format is given those lines I WOULD expect it to continue and correct 
it.

  $ clang-format -n --lines 115:120 Analysis.cpp
  Analysis.cpp:117:48: warning: code should be clang-formatted 
[-Wclang-format-violations]
ValueVTs.push_back(TLI.getValueType(DL, Ty));

But like clang-format-diff here, git-clang-format is doing a -U0 diff hence the 
line count is 0

  $ git diff -U0 --cached Analysis.cpp
  diff --git a/llvm/lib/CodeGen/Analysis.cpp b/llvm/lib/CodeGen/Analysis.cpp
  index e5d576d879b5..3107fc0b9936 100644
  --- a/llvm/lib/CodeGen/Analysis.cpp
  +++ b/llvm/lib/CodeGen/Analysis.cpp
  @@ -118 +117,0 @@ void llvm::ComputeValueVTs(const TargetLowering &TLI, const 
DataLayout &DL,
  -  if (MemVTs)

git-clang-format would also not process that change (as line_count == 0)

The code for handling this in git-clang-format is subtly different but equally 
ootentially wrong

  def extract_lines(patch_file):
"""Extract the changed lines in `patch_file`.
  
The return value is a dictionary mapping filename to a list of (start_line,
line_count) pairs.
  
The input must have been produced with ``-U0``, meaning unidiff format with
zero lines of context.  The return value is a dict mapping filename to a
list of line `Range`s."""
matches = {}
for line in patch_file:
  line = convert_string(line)
  match = re.search(r'^\+\+\+\ [^/]+/(.*)', line)
  if match:
filename = match.group(1).rstrip('\r\n')
  match = re.search(r'^@@ -[0-9,]+ \+(\d+)(,(\d+))?', line)
  if match:
start_line = int(match.group(1))
line_count = 1
if match.group(3):
  line_count = int(match.group(3))
if line_count > 0:
  matches.setdefault(filename, []).append(Range(start_line, line_count))
return matches

However if we take the same approach as suggested here, clang-format will run 
over that line

  $ clang-format -n --lines 117:117 Analysis.cpp
  Analysis.cpp:117:48: warning: code should be clang-formatted 
[-Wclang-format-violations]
ValueVTs.push_back(TLI.getValueType(DL, Ty));

To answer @hans question, I think it will do the correct thing, clang-format 
still works on the whole file, it just filters the replacements based on the 
"line range" given by --lines so I would expect it to work

I think this is the correct change being proposed here, but I also think 
git-clang-format is wrong.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111273

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


[PATCH] D111293: [CFE][Codegen][In-progress] Remove CodeGenFunction::InitTempAlloca()

2021-10-08 Thread Mahesha S via Phabricator via cfe-commits
hsmhsm updated this revision to Diff 378157.
hsmhsm added a comment.

Rebase to latest trunk.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111293

Files:
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/test/CodeGenObjC/static-alloc-init.m


Index: clang/test/CodeGenObjC/static-alloc-init.m
===
--- /dev/null
+++ clang/test/CodeGenObjC/static-alloc-init.m
@@ -0,0 +1,45 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-freebsd -S -emit-llvm 
-fobjc-runtime=gnustep-2.0 -o - %s | FileCheck %s
+
+typedef struct {
+  int x[12];
+} Big;
+
+@protocol P
+- (Big) foo;
+@end
+
+// CHECK-LABEL: define{{.*}} void @test(
+// CHECK:   %p.addr = alloca i8*, align 8
+// CHECK-NEXT:   %big = alloca %struct.Big, align 4
+// CHECK-NEXT:   %tmp = alloca i8*, align 8
+// CHECK-NEXT:   store i8* %p, i8** %p.addr, align 8
+// CHECK-NEXT:   br label %for.cond
+//
+// CHECK-LABEL: for.cond:
+// CHECK:%0 = load i8*, i8** %p.addr, align 8
+// CHECK-NEXT:   %1 = icmp eq i8* %0, null
+// CHECK-NEXT:   br i1 %1, label %nilReceiverCleanup, label %msgSend
+//
+// CHECK-LABEL: msgSend:
+// CHECK:store i8* %0, i8** %tmp, align 8
+// CHECK-NEXT:   %2 = call { i8*, i8*, i8*, i32, i8* (i8*, i8*, ...)* }* 
@objc_msg_lookup_sender(i8** %tmp, i8* bitcast ({ i8*, i8* }* 
@".objc_selector_foo_{?=[12i]}16\010:8" to i8*), i8* null)
+// CHECK-NEXT:   %3 = getelementptr inbounds { i8*, i8*, i8*, i32, i8* (i8*, 
i8*, ...)* }, { i8*, i8*, i8*, i32, i8* (i8*, i8*, ...)* }* %2, i32 0, i32 4
+// CHECK-NEXT:   %4 = load i8* (i8*, i8*, ...)*, i8* (i8*, i8*, ...)** %3, 
align 8
+// CHECK-NEXT:   %5 = load volatile i8*, i8** %tmp, align 8
+// CHECK-NEXT:   %6 = bitcast i8* (i8*, i8*, ...)* %4 to void (%struct.Big*, 
i8*, i8*)*
+// CHECK-NEXT:   call void %6(%struct.Big* sret(%struct.Big) align 4 %big, i8* 
%5, i8* bitcast ({ i8*, i8* }* @".objc_selector_foo_{?=[12i]}16\010:8" to i8*))
+// CHECK-NEXT:   br label %continue
+//
+// CHECK-LABEL: nilReceiverCleanup:
+// CHECK:%7 = bitcast %struct.Big* %big to i8*
+// CHECK-NEXT:   call void @llvm.memset.p0i8.i64(i8* align 4 %7, i8 0, i64 48, 
i1 false)
+// CHECK-NEXT:   br label %continue
+//
+// CHECK-LABEL: continue:
+// CHECK:br label %for.cond
+
+void test(id p) {
+ for (;;) {
+   Big big = [p foo];
+ }
+}
Index: clang/lib/CodeGen/CodeGenFunction.cpp
===
--- clang/lib/CodeGen/CodeGenFunction.cpp
+++ clang/lib/CodeGen/CodeGenFunction.cpp
@@ -981,7 +981,8 @@
   // precise source location of the checked return statement.
   if (requiresReturnValueCheck()) {
 ReturnLocation = CreateDefaultAlignTempAlloca(Int8PtrTy, 
"return.sloc.ptr");
-InitTempAlloca(ReturnLocation, llvm::ConstantPointerNull::get(Int8PtrTy));
+Builder.CreateStore(llvm::ConstantPointerNull::get(Int8PtrTy),
+ReturnLocation);
   }
 
   // Emit subprogram debug descriptor.


Index: clang/test/CodeGenObjC/static-alloc-init.m
===
--- /dev/null
+++ clang/test/CodeGenObjC/static-alloc-init.m
@@ -0,0 +1,45 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-freebsd -S -emit-llvm -fobjc-runtime=gnustep-2.0 -o - %s | FileCheck %s
+
+typedef struct {
+  int x[12];
+} Big;
+
+@protocol P
+- (Big) foo;
+@end
+
+// CHECK-LABEL: define{{.*}} void @test(
+// CHECK:   %p.addr = alloca i8*, align 8
+// CHECK-NEXT:   %big = alloca %struct.Big, align 4
+// CHECK-NEXT:   %tmp = alloca i8*, align 8
+// CHECK-NEXT:   store i8* %p, i8** %p.addr, align 8
+// CHECK-NEXT:   br label %for.cond
+//
+// CHECK-LABEL: for.cond:
+// CHECK:%0 = load i8*, i8** %p.addr, align 8
+// CHECK-NEXT:   %1 = icmp eq i8* %0, null
+// CHECK-NEXT:   br i1 %1, label %nilReceiverCleanup, label %msgSend
+//
+// CHECK-LABEL: msgSend:
+// CHECK:store i8* %0, i8** %tmp, align 8
+// CHECK-NEXT:   %2 = call { i8*, i8*, i8*, i32, i8* (i8*, i8*, ...)* }* @objc_msg_lookup_sender(i8** %tmp, i8* bitcast ({ i8*, i8* }* @".objc_selector_foo_{?=[12i]}16\010:8" to i8*), i8* null)
+// CHECK-NEXT:   %3 = getelementptr inbounds { i8*, i8*, i8*, i32, i8* (i8*, i8*, ...)* }, { i8*, i8*, i8*, i32, i8* (i8*, i8*, ...)* }* %2, i32 0, i32 4
+// CHECK-NEXT:   %4 = load i8* (i8*, i8*, ...)*, i8* (i8*, i8*, ...)** %3, align 8
+// CHECK-NEXT:   %5 = load volatile i8*, i8** %tmp, align 8
+// CHECK-NEXT:   %6 = bitcast i8* (i8*, i8*, ...)* %4 to void (%struct.Big*, i8*, i8*)*
+// CHECK-NEXT:   call void %6(%struct.Big* sret(%struct.Big) align 4 %big, i8* %5, i8* bitcast ({ i8*, i8* }* @".objc_selector_foo_{?=[12i]}16\010:8" to i8*))
+// CHECK-NEXT:   br label %continue
+//
+// CHECK-LABEL: nilReceiverCleanup:
+// CHECK:%7 = bitcast %struct.Big* %big to i8*
+// CHECK-NEXT:   call void @llvm.memset.p0i8.i64(i8* align 4 %7, i8 0, i64 48, i1 false)
+// CHECK-NEXT:   b

[PATCH] D110742: [OpenCL] Add pure and const attributes to vload builtins

2021-10-08 Thread Stuart Brady via Phabricator via cfe-commits
stuart added a comment.

In D110742#3048301 , @svenvh wrote:

>> For the constant address space, the const attribute (or readnone) can be 
>> used. As memory in the constant address space is immutable, the statement in 
>> the langref that: "if a readnone function reads or writes memory visible to 
>> the program, or has other side-effects, the behavior is undefined" does not 
>> apply. The reading of immutable memory does not have side-effects, nor can 
>> it be affected by side-effects.
>
> I think `readnone` might be too strong, because the pointer argument will 
> still be dereferenced (while `readnone` implies that "the function computes 
> its result [...] based strictly on its arguments, without dereferencing any 
> pointer arguments").

That may be so, but the function does not have its own side-effects, nor can it 
depend upon any side-effects, as the memory in question is truly immutable 
(i.e. it cannot even be changed by another process, thread, or shared memory 
interface in such a way that would be observable).

All functions, with or without `__attribute__((const))` can be said to require 
memory reads in the form of the instruction fetches needed to execute the 
instructions that comprise the compiled function. It is also quite normal for 
constant pools to be generated for a function, from which memory reads will be 
performed despite no pointer being dereferenced in the original C source.

Both `__attribute__((const))` and `readnone` are intended to permit arbitrary 
code motion, and so in my opinion the langref misstates the true nature of the 
`readnone` attribute. (The Clang manual does not even document 
`__attribute__((const))`.) From a cursory examination of the LLVM source, I did 
not find any use of `readnone` that conflicts with this interpretation of the 
`readnone` attribute.

Does the langref need to be amended, first, or is it okay to interpret the 
`readnone` attribute as it was clearly intended, without going through the 
process of updating the langref first?

I can update this review to use `__attribute__((pure))` for all address spaces, 
for the time being, but it seems a shame that the poor wording in the langref 
might (necessarily) prevent us from making the optimal change.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110742

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


[PATCH] D111208: [clang-tidy] Support globbing in NOLINT* expressions

2021-10-08 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp added inline comments.



Comment at: clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp:353
+  if (SuppressionIsSpecific)
+*SuppressionIsSpecific = true;
 }

salman-javed-nz wrote:
> So when this function is called with args `Line = "NOLINTBEGIN(google*)"` and 
> `CheckName = "google-explicit-constructor"`, it will return true with 
> `*SuppressionIsSpecific = true`.
> Should `*SuppressionIsSpecific = false` instead here?
Good point. I honestly don't understand what SuppressionIsSpecific means and 
how it's used downstream, could you clarify?


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

https://reviews.llvm.org/D111208

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


[clang] ff013b6 - Extend init-statement to allow alias-declaration

2021-10-08 Thread Aaron Ballman via cfe-commits

Author: Corentin Jabot
Date: 2021-10-08T07:13:45-04:00
New Revision: ff013b61004b01043bdbebb6416c30ecb3d3d48c

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

LOG: Extend init-statement to allow alias-declaration

Implement P2360R0 in C++23 mode and as an extension in older
languages mode.

Added: 
clang/test/Parser/cxx2b-init-statement.cpp
clang/test/SemaCXX/cxx2b-init-statement.cpp

Modified: 
clang/docs/ReleaseNotes.rst
clang/include/clang/Basic/DiagnosticParseKinds.td
clang/include/clang/Parse/Parser.h
clang/lib/Parse/ParseDeclCXX.cpp
clang/lib/Parse/ParseExprCXX.cpp
clang/lib/Parse/ParseStmt.cpp
clang/lib/Parse/ParseTentative.cpp
clang/www/cxx_status.html

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 9181f01be440..dc8f8a306824 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -134,6 +134,8 @@ C++20 Feature Support
 C++2b Feature Support
 ^
 - Implemented `P1938R3: if consteval `_.
+- Implemented `P2360R0: Extend init-statement to allow alias-declaration 
`_.
+
 
 CUDA Language Changes in Clang
 --

diff  --git a/clang/include/clang/Basic/DiagnosticParseKinds.td 
b/clang/include/clang/Basic/DiagnosticParseKinds.td
index cf649670f051..8ae264caddcb 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -549,6 +549,12 @@ def err_expected_init_in_condition_lparen : Error<
   "variable declaration in condition cannot have a parenthesized initializer">;
 def err_extraneous_rparen_in_condition : Error<
   "extraneous ')' after condition, expected a statement">;
+def ext_alias_in_init_statement : ExtWarn<
+  "alias declaration in this context is a C++2b extension">,
+  InGroup;
+def warn_cxx20_alias_in_init_statement  : Warning<
+  "alias declaration in this context is incompatible with C++ standards before 
C++2b">,
+  DefaultIgnore, InGroup;
 def warn_dangling_else : Warning<
   "add explicit braces to avoid dangling else">,
   InGroup;

diff  --git a/clang/include/clang/Parse/Parser.h 
b/clang/include/clang/Parse/Parser.h
index f42e59ab6ddf..de25760017b5 100644
--- a/clang/include/clang/Parse/Parser.h
+++ b/clang/include/clang/Parse/Parser.h
@@ -1977,6 +1977,9 @@ class Parser : public CodeCompletionHandler {
   Sema::ConditionKind CK,
   ForRangeInfo *FRI = nullptr,
   bool EnterForConditionScope = false);
+  DeclGroupPtrTy
+  ParseAliasDeclarationInInitStatement(DeclaratorContext Context,
+   ParsedAttributesWithRange &Attrs);
 
   
//======//
   // C++ Coroutines
@@ -2396,7 +2399,8 @@ class Parser : public CodeCompletionHandler {
 if (getLangOpts().OpenMP)
   Actions.startOpenMPLoop();
 if (getLangOpts().CPlusPlus)
-  return isCXXSimpleDeclaration(/*AllowForRangeDecl=*/true);
+  return Tok.is(tok::kw_using) ||
+ isCXXSimpleDeclaration(/*AllowForRangeDecl=*/true);
 return isDeclarationSpecifier(true);
   }
 

diff  --git a/clang/lib/Parse/ParseDeclCXX.cpp 
b/clang/lib/Parse/ParseDeclCXX.cpp
index 73b458e09a9c..f5a6ffcff9e9 100644
--- a/clang/lib/Parse/ParseDeclCXX.cpp
+++ b/clang/lib/Parse/ParseDeclCXX.cpp
@@ -678,7 +678,10 @@ Parser::ParseUsingDeclaration(
 SourceLocation UsingLoc, SourceLocation &DeclEnd,
 ParsedAttributesWithRange &PrefixAttrs, AccessSpecifier AS) {
   SourceLocation UELoc;
-  if (TryConsumeToken(tok::kw_enum, UELoc)) {
+  bool InInitStatement = Context == DeclaratorContext::SelectionInit ||
+ Context == DeclaratorContext::ForInit;
+
+  if (TryConsumeToken(tok::kw_enum, UELoc) && !InInitStatement) {
 // C++20 using-enum
 Diag(UELoc, getLangOpts().CPlusPlus20
 ? diag::warn_cxx17_compat_using_enum_declaration
@@ -714,6 +717,9 @@ Parser::ParseUsingDeclaration(
   ParsedAttributesWithRange MisplacedAttrs(AttrFactory);
   MaybeParseCXX11Attributes(MisplacedAttrs);
 
+  if (InInitStatement && Tok.isNot(tok::identifier))
+return nullptr;
+
   UsingDeclarator D;
   bool InvalidDeclarator = ParseUsingDeclarator(Context, D);
 
@@ -732,7 +738,7 @@ Parser::ParseUsingDeclaration(
   }
 
   // Maybe this is an alias-declaration.
-  if (Tok.is(tok::equal)) {
+  if (Tok.is(tok::equal) || InInitStatement) {
 if (InvalidDeclarator) {
   SkipUntil(tok::semi);
   return nullptr;

diff  --git a/clang/lib/Parse/ParseExprCXX.cpp 
b/clang/lib/Parse/ParseExprCXX.cpp
index 5b7e15e19

[PATCH] D111175: [Clang] Extend init-statement to allow alias-declaration

2021-10-08 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman closed this revision.
aaron.ballman added a comment.

I've commit on your behalf in ff013b61004b01043bdbebb6416c30ecb3d3d48c 
, thank 
you for the new functionality!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75

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


[PATCH] D107049: [clang-repl] Re-implement clang-interpreter as a test case.

2021-10-08 Thread Nico Weber via Phabricator via cfe-commits
thakis added inline comments.



Comment at: clang/unittests/Interpreter/CMakeLists.txt:5
+  OrcJIT
+  Support
   )

Why are these additions needed here again? This change doesn't add any code to 
ClangReplInterpreterTests as far as I can tell. Are these remnants from before 
the exception tests were in a different binary?


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

https://reviews.llvm.org/D107049

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


[PATCH] D111228: [clang-tidy] Add options to bugprone-unused-return-value.

2021-10-08 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a reviewer: alexfh.
aaron.ballman added a comment.

Thank you for the new documentation, that helps! The one thing I'm still 
struggling with is the design approach and how well this will scale. Basically, 
the issue here is that `CheckedFunctions` already has a very long list of 
options, and you want to be able to manage that list (add entries to it or 
remove entries from it) without having to re-specify the entire list, correct? 
My concerns are: 0) It's a confusing design because the complete list is now 
spread over three different options that you have to think about, instead of 
just "here's the list of entries", 1) this problem can appear in *any* config 
list that gets large (for example, when you have a config file in a parent 
directory and a child directory and the parent adds a bunch of items to a list 
that the child wants to manage).

I wonder if we should be considering a more general approach like adding some 
set manipulation functionality to the config list itself. Thinking out loud 
(haven't put a ton of thought into this), we could devise some sort of syntax 
like:

`{key: bugprone-unused-return-value.IncludedFunctions, value: 
"$add$($remove$(bugprone-unused-return-value.IncludedFunctions, 
"::excludedFun"), "::includedFun,::otherFun"},`

That would remove `::excludedFun` from the default list and add `::includedFun` 
and `::otherFun` to the list. Then this functionality could be used in any 
config setting that involves lists of elements rather than adding additional 
config options to each check. WDYT?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111228

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


[PATCH] D111391: [NFC] [Clang] Use global enum for explicit float mode

2021-10-08 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, thanks for the cleanup!




Comment at: clang/lib/Sema/SemaDeclAttr.cpp:4209
   ComplexMode = false;
+  ExplicitType = FloatModeKind::NoFloat;
   switch (Str.size()) {

This bit looks like it's not an NFC change -- we never used to set this value 
before. However, it is an NFC change because the caller always sets 
`ExplicitType` to `NoFloat`, so this is more for safety when adding new 
callers, which is fine by me.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111391

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


[PATCH] D109950: [Clang] Enable IC/IF mode for __ibm128

2021-10-08 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

I'd appreciate some codegen tests for the new functionality as well (so we're 
testing not just "do we accept it" but also "does it work" as well), but this 
looks correct to me.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109950

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


[PATCH] D111400: [Clang] Implement P2242R3

2021-10-08 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin created this revision.
cor3ntin requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Allow goto, label statements as well as
static, thread_local and non-literal variables in constexpr
functions.

The proposal is implemented as a language extension in older
language modes.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111400

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Frontend/InitPreprocessor.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/CXX/basic/basic.types/p10.cpp
  clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/dtor.cpp
  clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3-2b.cpp
  clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp
  clang/test/Lexer/cxx-features.cpp
  clang/test/SemaCXX/constant-expression-cxx14.cpp
  clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
  clang/www/cxx_status.html

Index: clang/www/cxx_status.html
===
--- clang/www/cxx_status.html
+++ clang/www/cxx_status.html
@@ -1356,7 +1356,7 @@
 
   Non-literal variables (and labels and gotos) in constexpr functions
   https://wg21.link/P2242R3";>P2242R3
-  No
+  Clang 14
 
 
   Character encoding of diagnostic text
Index: clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
===
--- clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
+++ clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
@@ -115,11 +115,6 @@
 constexpr const char *Str = "abc";
 static_assert(fp4(Str) == Str);
 
-auto NCL = [](int i) { static int j; return j; }; //expected-note{{declared here}}
-constexpr int (*fp5)(int) = NCL;
-constexpr int I =  //expected-error{{must be initialized by a constant expression}}
-  fp5(5); //expected-note{{non-constexpr function}} 
-
 namespace test_dont_always_instantiate_constexpr_templates {
 
 auto explicit_return_type = [](auto x) -> int { return x.get(); };
Index: clang/test/SemaCXX/constant-expression-cxx14.cpp
===
--- clang/test/SemaCXX/constant-expression-cxx14.cpp
+++ clang/test/SemaCXX/constant-expression-cxx14.cpp
@@ -44,14 +44,6 @@
   return 3 * k3 + 5 * k2 + n * k - 20;
 }
 static_assert(g(2) == 42, "");
-constexpr int h(int n) {
-  static const int m = n; // expected-error {{static variable not permitted in a constexpr function}}
-  return m;
-}
-constexpr int i(int n) {
-  thread_local const int m = n; // expected-error {{thread_local variable not permitted in a constexpr function}}
-  return m;
-}
 
 // if-statements can be used in constexpr functions.
 constexpr int j(int k) {
@@ -65,7 +57,9 @@
   return 2;
 }
   }
-} // expected-note 2{{control reached end of constexpr function}}
+} // expected-warning {{non-void}} \
+  //expected-note 2{{control reached end of constexpr function}}
+
 static_assert(j(0) == -3, "");
 static_assert(j(1) == 5, "");
 static_assert(j(2), ""); // expected-error {{constant expression}} expected-note {{in call to 'j(2)'}}
Index: clang/test/Lexer/cxx-features.cpp
===
--- clang/test/Lexer/cxx-features.cpp
+++ clang/test/Lexer/cxx-features.cpp
@@ -273,7 +273,7 @@
 #error "wrong value for __cpp_lambdas"
 #endif
 
-#if check(constexpr, 0, 200704, 201304, 201603, 201907, 201907)
+#if check(constexpr, 0, 200704, 201304, 201603, 201907, 202110)
 #error "wrong value for __cpp_constexpr"
 #endif
 
Index: clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp
===
--- clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp
+++ clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 -verify -fcxx-exceptions -triple=x86_64-linux-gnu -std=c++11 -Werror=c++14-extensions -Werror=c++20-extensions %s
-// RUN: %clang_cc1 -verify -fcxx-exceptions -triple=x86_64-linux-gnu -std=c++14 -DCXX14 -Werror=c++20-extensions %s
-// RUN: %clang_cc1 -verify -fcxx-exceptions -triple=x86_64-linux-gnu -std=c++20 -DCXX14 -DCXX20 %s
+// RUN: %clang_cc1 -verify -fcxx-exceptions -triple=x86_64-linux-gnu -std=c++11 -Werror=c++14-extensions -Werror=c++20-extensions -Werror=c++2b-extensions %s
+// RUN: %clang_cc1 -verify -fcxx-exceptions -triple=x86_64-linux-gnu -std=c++14 -DCXX14 -Werror=c++20-extensions -Werror=c++2b-extensions %s
+// RUN: %clang_cc1 -verify -fcxx-exceptions -triple=x86_64-linux-gnu -std=c++20 -DCXX14 -DCXX20 -Werror=c++2b-extensions %s
+// RUN: %clang_cc1 -verify -fcxx-exceptions -triple=x86_64-linux-gnu -std=c++2b -DCXX14 -DCXX20 -DCXX2b %s
+
 
 namespace N {
   typedef char C;
@@ -10,7 +12,7 @@
   typedef double D;
 }
 
-struct NonLiteral { // expected-note 3{{no constexpr constructors}}
+struct NonLiteral { // expected-note 2{{no constexpr constructors}}
   NonLiteral() {}
   NonLiteral(int) 

[PATCH] D107450: [clang-tidy] Fix wrong FixIt in performance-move-const-arg

2021-10-08 Thread gehry via Phabricator via cfe-commits
Sockke updated this revision to Diff 378168.
Sockke retitled this revision from "[clang-tidy] Fix wrong FIxIt in 
performance-move-const-arg" to "[clang-tidy] Fix wrong FixIt in 
performance-move-const-arg".
Sockke added a comment.

Sorry for the delayed reply because of National Day.  I have updated. 
@whisperity


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

https://reviews.llvm.org/D107450

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.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/performance-move-const-arg.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/performance-move-const-arg.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/performance-move-const-arg.cpp
@@ -246,3 +246,40 @@
   };
   f(MoveSemantics());
 }
+
+void showInt(int &&v) {}
+void showInt(int v1, int &&v2) {}
+void testInt() {
+  int a = 10;
+  showInt(std::move(a));
+  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: std::move of the variable 'a' of the trivially-copyable type 'int' has no effect [performance-move-const-arg]
+  // CHECK-MESSAGES: :[[@LINE-6]]:20: note: consider changing the 1st parameter of showInt from 'int &&' to 'const int &'
+  showInt(int());
+  showInt(a, std::move(a));
+  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: std::move of the variable 'a' of the trivially-copyable type 'int' has no effect [performance-move-const-arg]
+  // CHECK-MESSAGES: :[[@LINE-9]]:28: note: consider changing the 2st parameter of showInt from 'int &&' to 'const int &'
+}
+template 
+void forwardToShowInt(T && t) {
+  showInt(static_cast(t));
+}
+void testTemplate() {
+  int a = 10;
+  forwardToShowInt(std::move(a));
+  // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: std::move of the variable 'a' of the trivially-copyable type 'int' has no effect [performance-move-const-arg]
+}
+
+struct Tmp {};
+void showTmp(Tmp &&v) {}
+void testTmp() {
+  Tmp t;
+  showTmp(std::move(t));
+  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: std::move of the variable 't' of the trivially-copyable type 'Tmp' has no effect [performance-move-const-arg]
+  // CHECK-MESSAGES: :[[@LINE-5]]:20: note: consider changing the 1st parameter of showTmp from 'Tmp &&' to 'const Tmp &'
+}
+
+void showA(A && v) {}
+void testA() {
+  A a;
+  showA(std::move(a));
+}
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
@@ -10,6 +10,7 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_MOVECONSTANTARGUMENTCHECK_H
 
 #include "../ClangTidyCheck.h"
+#include "llvm/ADT/DenseSet.h"
 
 namespace clang {
 namespace tidy {
@@ -36,6 +37,7 @@
 
 private:
   const bool CheckTriviallyCopyableMove;
+  llvm::DenseSet HasCheckedMoveSet;
 };
 
 } // namespace performance
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
@@ -50,7 +50,9 @@
   Finder->addMatcher(
   invocation(forEachArgumentWithParam(
  MoveCallMatcher,
- parmVarDecl(hasType(references(isConstQualified())
+ parmVarDecl(anyOf(hasType(references(isConstQualified())),
+   hasType(rValueReferenceType(
+ .bind("invocation-parm")))
   .bind("receiving-expr"),
   this);
 }
@@ -58,6 +60,15 @@
 void MoveConstArgCheck::check(const MatchFinder::MatchResult &Result) {
   const auto *CallMove = Result.Nodes.getNodeAs("call-move");
   const auto *ReceivingExpr = Result.Nodes.getNodeAs("receiving-expr");
+  const auto *InvocationParm =
+  Result.Nodes.getNodeAs("invocation-parm");
+
+  if (!ReceivingExpr && HasCheckedMoveSet.contains(CallMove))
+return;
+
+  if (ReceivingExpr)
+HasCheckedMoveSet.insert(CallMove);
+
   const Expr *Arg = CallMove->getArg(0);
   SourceManager &SM = Result.Context->getSourceManager();
 
@@ -90,20 +101,52 @@
   return;
 
 bool IsVariable = isa(Arg);
+bool IsRValueReferenceArg = false;
 const auto *Var =
 IsVariable ? dyn_cast(Arg)->getDecl() : nullptr;
-auto Diag = diag(FileMoveRange.getBegin(),
- "std::move of the %select{|const }0"
- "%select{expression|variable %4}1 "
- "%select{|of the trivially-copyable type %5 }2"
- "has no effect; remove std::move()"
- "%select{| or make the variable non-const}3")
-<< IsConstArg << IsVariable << IsTrivia

[PATCH] D111400: [Clang] Implement P2242R3

2021-10-08 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 378172.
cor3ntin added a comment.

Fix diagnostics formatting


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111400

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Frontend/InitPreprocessor.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/CXX/basic/basic.types/p10.cpp
  clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/dtor.cpp
  clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3-2b.cpp
  clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp
  clang/test/Lexer/cxx-features.cpp
  clang/test/SemaCXX/constant-expression-cxx14.cpp
  clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
  clang/www/cxx_status.html

Index: clang/www/cxx_status.html
===
--- clang/www/cxx_status.html
+++ clang/www/cxx_status.html
@@ -1356,7 +1356,7 @@
 
   Non-literal variables (and labels and gotos) in constexpr functions
   https://wg21.link/P2242R3";>P2242R3
-  No
+  Clang 14
 
 
   Character encoding of diagnostic text
Index: clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
===
--- clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
+++ clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
@@ -115,11 +115,6 @@
 constexpr const char *Str = "abc";
 static_assert(fp4(Str) == Str);
 
-auto NCL = [](int i) { static int j; return j; }; //expected-note{{declared here}}
-constexpr int (*fp5)(int) = NCL;
-constexpr int I =  //expected-error{{must be initialized by a constant expression}}
-  fp5(5); //expected-note{{non-constexpr function}} 
-
 namespace test_dont_always_instantiate_constexpr_templates {
 
 auto explicit_return_type = [](auto x) -> int { return x.get(); };
Index: clang/test/SemaCXX/constant-expression-cxx14.cpp
===
--- clang/test/SemaCXX/constant-expression-cxx14.cpp
+++ clang/test/SemaCXX/constant-expression-cxx14.cpp
@@ -44,14 +44,6 @@
   return 3 * k3 + 5 * k2 + n * k - 20;
 }
 static_assert(g(2) == 42, "");
-constexpr int h(int n) {
-  static const int m = n; // expected-error {{static variable not permitted in a constexpr function}}
-  return m;
-}
-constexpr int i(int n) {
-  thread_local const int m = n; // expected-error {{thread_local variable not permitted in a constexpr function}}
-  return m;
-}
 
 // if-statements can be used in constexpr functions.
 constexpr int j(int k) {
@@ -65,7 +57,9 @@
   return 2;
 }
   }
-} // expected-note 2{{control reached end of constexpr function}}
+} // expected-warning {{non-void}} \
+  //expected-note 2{{control reached end of constexpr function}}
+
 static_assert(j(0) == -3, "");
 static_assert(j(1) == 5, "");
 static_assert(j(2), ""); // expected-error {{constant expression}} expected-note {{in call to 'j(2)'}}
Index: clang/test/Lexer/cxx-features.cpp
===
--- clang/test/Lexer/cxx-features.cpp
+++ clang/test/Lexer/cxx-features.cpp
@@ -273,7 +273,7 @@
 #error "wrong value for __cpp_lambdas"
 #endif
 
-#if check(constexpr, 0, 200704, 201304, 201603, 201907, 201907)
+#if check(constexpr, 0, 200704, 201304, 201603, 201907, 202110)
 #error "wrong value for __cpp_constexpr"
 #endif
 
Index: clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp
===
--- clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp
+++ clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 -verify -fcxx-exceptions -triple=x86_64-linux-gnu -std=c++11 -Werror=c++14-extensions -Werror=c++20-extensions %s
-// RUN: %clang_cc1 -verify -fcxx-exceptions -triple=x86_64-linux-gnu -std=c++14 -DCXX14 -Werror=c++20-extensions %s
-// RUN: %clang_cc1 -verify -fcxx-exceptions -triple=x86_64-linux-gnu -std=c++20 -DCXX14 -DCXX20 %s
+// RUN: %clang_cc1 -verify -fcxx-exceptions -triple=x86_64-linux-gnu -std=c++11 -Werror=c++14-extensions -Werror=c++20-extensions -Werror=c++2b-extensions %s
+// RUN: %clang_cc1 -verify -fcxx-exceptions -triple=x86_64-linux-gnu -std=c++14 -DCXX14 -Werror=c++20-extensions -Werror=c++2b-extensions %s
+// RUN: %clang_cc1 -verify -fcxx-exceptions -triple=x86_64-linux-gnu -std=c++20 -DCXX14 -DCXX20 -Werror=c++2b-extensions %s
+// RUN: %clang_cc1 -verify -fcxx-exceptions -triple=x86_64-linux-gnu -std=c++2b -DCXX14 -DCXX20 -DCXX2b %s
+
 
 namespace N {
   typedef char C;
@@ -10,7 +12,7 @@
   typedef double D;
 }
 
-struct NonLiteral { // expected-note 3{{no constexpr constructors}}
+struct NonLiteral { // expected-note 2{{no constexpr constructors}}
   NonLiteral() {}
   NonLiteral(int) {}
 };
@@ -150,16 +152,25 @@
 }
 constexpr int DisallowedStmtsCXX14_2() {
   //  - a goto statement
-  goto x; // expected-error {{statement not allowed in constexpr fun

[PATCH] D111400: [Clang] Implement P2242R3

2021-10-08 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 378173.
cor3ntin added a comment.

Add missing test file


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111400

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Frontend/InitPreprocessor.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/CXX/basic/basic.types/p10.cpp
  clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/dtor.cpp
  clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3-2b.cpp
  clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp
  clang/test/Lexer/cxx-features.cpp
  clang/test/SemaCXX/constant-expression-cxx14.cpp
  clang/test/SemaCXX/constant-expression-cxx2b.cpp
  clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
  clang/www/cxx_status.html

Index: clang/www/cxx_status.html
===
--- clang/www/cxx_status.html
+++ clang/www/cxx_status.html
@@ -1356,7 +1356,7 @@
 
   Non-literal variables (and labels and gotos) in constexpr functions
   https://wg21.link/P2242R3";>P2242R3
-  No
+  Clang 14
 
 
   Character encoding of diagnostic text
Index: clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
===
--- clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
+++ clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
@@ -115,11 +115,6 @@
 constexpr const char *Str = "abc";
 static_assert(fp4(Str) == Str);
 
-auto NCL = [](int i) { static int j; return j; }; //expected-note{{declared here}}
-constexpr int (*fp5)(int) = NCL;
-constexpr int I =  //expected-error{{must be initialized by a constant expression}}
-  fp5(5); //expected-note{{non-constexpr function}} 
-
 namespace test_dont_always_instantiate_constexpr_templates {
 
 auto explicit_return_type = [](auto x) -> int { return x.get(); };
Index: clang/test/SemaCXX/constant-expression-cxx2b.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/constant-expression-cxx2b.cpp
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify %s -fcxx-exceptions -triple=x86_64-linux-gnu
+
+constexpr int f(int n) {  // expected-error {{constexpr function never produces a constant expression}}
+  static const int m = n; //  expected-note {{declared here}}
+  return m;   //  expected-note {{initializer of 'm' is not a constant expression}}
+}
+constexpr int g(int n) {// expected-error {{constexpr function never produces a constant expression}}
+  thread_local const int m = n; //  expected-note {{declared here}}
+  return m; //  expected-note {{initializer of 'm' is not a constant expression}}
+}
+
+constexpr int h(int n) {
+  if (!n)
+return 0;
+  static const int m = n;
+  return m;
+}
+constexpr int i(int n) {
+  if (!n)
+return 0;
+  thread_local const int m = n;
+  return m;
+}
Index: clang/test/SemaCXX/constant-expression-cxx14.cpp
===
--- clang/test/SemaCXX/constant-expression-cxx14.cpp
+++ clang/test/SemaCXX/constant-expression-cxx14.cpp
@@ -44,14 +44,6 @@
   return 3 * k3 + 5 * k2 + n * k - 20;
 }
 static_assert(g(2) == 42, "");
-constexpr int h(int n) {
-  static const int m = n; // expected-error {{static variable not permitted in a constexpr function}}
-  return m;
-}
-constexpr int i(int n) {
-  thread_local const int m = n; // expected-error {{thread_local variable not permitted in a constexpr function}}
-  return m;
-}
 
 // if-statements can be used in constexpr functions.
 constexpr int j(int k) {
@@ -65,7 +57,9 @@
   return 2;
 }
   }
-} // expected-note 2{{control reached end of constexpr function}}
+} // expected-warning {{non-void}} \
+  //expected-note 2{{control reached end of constexpr function}}
+
 static_assert(j(0) == -3, "");
 static_assert(j(1) == 5, "");
 static_assert(j(2), ""); // expected-error {{constant expression}} expected-note {{in call to 'j(2)'}}
Index: clang/test/Lexer/cxx-features.cpp
===
--- clang/test/Lexer/cxx-features.cpp
+++ clang/test/Lexer/cxx-features.cpp
@@ -273,7 +273,7 @@
 #error "wrong value for __cpp_lambdas"
 #endif
 
-#if check(constexpr, 0, 200704, 201304, 201603, 201907, 201907)
+#if check(constexpr, 0, 200704, 201304, 201603, 201907, 202110)
 #error "wrong value for __cpp_constexpr"
 #endif
 
Index: clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp
===
--- clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp
+++ clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 -verify -fcxx-exceptions -triple=x86_64-linux-gnu -std=c++11 -Werror=c++14-extensions -Werror=c++20-extensions %s
-// RUN: %clang_cc1 -verify -fcxx-exceptions -triple=x86_64-linux-gnu -s

[PATCH] D110215: [C++2a] [Module] Support extern C/C++ semantics

2021-10-08 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added subscribers: cfe-commits, aaron.ballman.
aaron.ballman added reviewers: aaron.ballman, erichkeane.
aaron.ballman added a comment.

Adding some more reviewers and subscribing the mailing lists.




Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:10842
 def note_prev_module_definition_from_ast_file : Note<"module loaded from 
'%0'">;
+def err_module_langugae_linkage_no_global : Error <
+  "The declaration %0 appears within a linkage-specification should be "

aaron.ballman wrote:
> mizvekov wrote:
> > ```
> > def **err_module_language_linkage_no_global** : Error <
> >   "The declaration %0**, which** appears within a linkage-specification**, 
> > is not "
> >   "attached to **the** global module.">;
> > ```
> > 
> > My two cents since I think the last sentence did not seem to explain the 
> > problem very well.
> Diagnostics in Clang are intentionally ungrammatical, so they should not have 
> leading capitalization or most terminating punctuation. I agree that the 
> diagnostic wording here doesn't really explain what's going wrong.
typo, should be: err_module_language_linkage_no_global 



Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:10842-10845
+def err_module_langugae_linkage_no_global : Error <
+  "The declaration %0 appears within a linkage-specification should be "
+  "attached to global module. But the compiler failed to search the global "
+  "module.">;

mizvekov wrote:
> ```
> def **err_module_language_linkage_no_global** : Error <
>   "The declaration %0**, which** appears within a linkage-specification**, is 
> not "
>   "attached to **the** global module.">;
> ```
> 
> My two cents since I think the last sentence did not seem to explain the 
> problem very well.
Diagnostics in Clang are intentionally ungrammatical, so they should not have 
leading capitalization or most terminating punctuation. I agree that the 
diagnostic wording here doesn't really explain what's going wrong.



Comment at: clang/lib/Sema/SemaDecl.cpp:9351
+  (NewFD->isExternCContext() || NewFD->isExternCXXContext())) {
+if (!getGlobalModule())
+  Diag(NewFD->getLocation(),

I'm a bit confused here. [module.unit]p7 is describing what module a 
declaration attached to under which circumstances. I don't see a constraint 
there which should result in a diagnostic. My reading of 
https://eel.is/c++draft/module.unit#6 is that the global module always exists, 
so we should be able to attach declarations to it at any point. Am I 
misunderstanding?



Comment at: clang/test/CXX/module/module.linkage_specification/Inputs/h1.h:7
+}
\ No newline at end of file


mizvekov wrote:
> Please if possible make your editor set new lines at EOF.
+1 -- please add a newline to the end of each of these files that.


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

https://reviews.llvm.org/D110215

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


[PATCH] D111208: [clang-tidy] Support globbing in NOLINT* expressions

2021-10-08 Thread Salman Javed via Phabricator via cfe-commits
salman-javed-nz added a comment.

In D111208#3050680 , @carlosgalvezp 
wrote:

>> How should Clang-Tidy behave when mixing check-specific NOLINTBEGIN/ENDs 
>> with globbed ones?
>
> I would say keep current behavior - complain that the user wrote something 
> different in the BEGIN and in the END. I like keeping things simple and easy 
> to read and reason about. I think adding smarter logic here would make 
> clang-tidy's code more complicated, but also it would allow users to write 
> more complicated NOLINT expressions that would be very hard to read and track.
>
> Honestly as a user I'm more than fine with one level of NOLINTBEGIN/END. Any 
> more nesting than that causes me much more cognitive effort than it's worth.
>
> What do you think?

I think the current simple approach is the way to go. If and when someone comes 
back to us with a compelling case for why more complicated NOLINT syntax is 
needed, we can think about it then.




Comment at: clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp:353
+  if (SuppressionIsSpecific)
+*SuppressionIsSpecific = true;
 }

carlosgalvezp wrote:
> salman-javed-nz wrote:
> > So when this function is called with args `Line = "NOLINTBEGIN(google*)"` 
> > and `CheckName = "google-explicit-constructor"`, it will return true with 
> > `*SuppressionIsSpecific = true`.
> > Should `*SuppressionIsSpecific = false` instead here?
> Good point. I honestly don't understand what SuppressionIsSpecific means and 
> how it's used downstream, could you clarify?
`SuppressionIsSpecific = true` means when a check is suppressed by name, i.e. 
`NOLINTBEGIN(check-name)`.

`SuppressionIsSpecific = false` means when `NOLINTBEGIN`  or 
`NOLINTBEGIN(*)` is used. My gut feeling is that It should probably be false 
when a glob is used too.

The point of this variable is so that a check-specific `BEGIN` can only be 
`END`ed with a check-specific END.



Comment at: clang-tools-extra/docs/clang-tidy/index.rst:347
+// No warnings are suppressed, due to double negation
+Foo(bool param);  // NOLINT(-google*)
   };

salman-javed-nz wrote:
> carlosgalvezp wrote:
> > salman-javed-nz wrote:
> > > Would anyone do this on purpose, or is this a user error?
> > I don't see any use case here, no. I just thought to document it to clarify 
> > the double negation that's happening, in case a user gets confused and 
> > doesn't see the warning being suppressed.
> > 
> > Do you think it brings value or does more harm than good?
> 
> I don't see any use case here, no. I just thought to document it to clarify 
> the double negation that's happening, in case a user gets confused and 
> doesn't see the warning being suppressed.
> 
> Do you think it brings value or does more harm than good?

I'd be happy with just the basic `+` glob functionality. The first thing I'd 
use it on is to suppress checks that are an alias of another check, e.g. 
`NOLINT(*no-malloc)` to cover both `hicpp-no-malloc` and 
`cppcoreguidelines-no-malloc`.

As for glob expressions that begin with a `-`... you get the functionality for 
free thanks to the `GlobList` class but it's not a feature I think I will need. 
I speak only for myself though. Maybe someone else here has a strong need for 
this?

Is `NOLINTBEGIN(-check)` equivalent to `NOLINTEND(check)`? It hursts my head 
even thinking about it.

Your unit test where you test `NOLINT(google*,-google*,google*)`, Clang-Tidy 
does the right thing in that situation, but I have to wonder why any user would 
want to add, remove, then add the same check group in the one expression in the 
first place? Should we even be entertaining this kind of use?


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

https://reviews.llvm.org/D111208

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


[PATCH] D111332: [AST Matchers] Update dump_ast_matchers.py to query only class index page.

2021-10-08 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added reviewers: sammccall, klimek.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM, though I'll note I'm by no means a Python expert. I'm adding a few more 
AST matching folks in case they spot something I've missed, so please give this 
at least 24 hours before landing.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111332

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


[PATCH] D110258: [AArch64] Always add -tune-cpu argument to -cc1 driver

2021-10-08 Thread David Sherwood via Phabricator via cfe-commits
david-arm updated this revision to Diff 378180.
david-arm marked an inline comment as done.
david-arm added a comment.

- Fixed formatting issues.


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

https://reviews.llvm.org/D110258

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/aarch64-mtune.c
  llvm/lib/Target/AArch64/AArch64Subtarget.cpp
  llvm/lib/Target/AArch64/AArch64Subtarget.h
  llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
  llvm/unittests/Target/AArch64/InstSizes.cpp
  llvm/unittests/Target/AArch64/MatrixRegisterAliasing.cpp

Index: llvm/unittests/Target/AArch64/MatrixRegisterAliasing.cpp
===
--- llvm/unittests/Target/AArch64/MatrixRegisterAliasing.cpp
+++ llvm/unittests/Target/AArch64/MatrixRegisterAliasing.cpp
@@ -26,6 +26,7 @@
 
 std::unique_ptr createInstrInfo(TargetMachine *TM) {
   AArch64Subtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
+  std::string(TM->getTargetCPU()),
   std::string(TM->getTargetFeatureString()), *TM,
   /* isLittle */ false);
   return std::make_unique(ST);
Index: llvm/unittests/Target/AArch64/InstSizes.cpp
===
--- llvm/unittests/Target/AArch64/InstSizes.cpp
+++ llvm/unittests/Target/AArch64/InstSizes.cpp
@@ -29,6 +29,7 @@
 
 std::unique_ptr createInstrInfo(TargetMachine *TM) {
   AArch64Subtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
+  std::string(TM->getTargetCPU()),
   std::string(TM->getTargetFeatureString()), *TM,
   /* isLittle */ false);
   return std::make_unique(ST);
Index: llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
===
--- llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
+++ llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
@@ -355,10 +355,13 @@
 const AArch64Subtarget *
 AArch64TargetMachine::getSubtargetImpl(const Function &F) const {
   Attribute CPUAttr = F.getFnAttribute("target-cpu");
+  Attribute TuneAttr = F.getFnAttribute("tune-cpu");
   Attribute FSAttr = F.getFnAttribute("target-features");
 
   std::string CPU =
   CPUAttr.isValid() ? CPUAttr.getValueAsString().str() : TargetCPU;
+  std::string TuneCPU =
+  TuneAttr.isValid() ? TuneAttr.getValueAsString().str() : CPU;
   std::string FS =
   FSAttr.isValid() ? FSAttr.getValueAsString().str() : TargetFS;
 
@@ -399,6 +402,7 @@
   Key += "SVEMax";
   Key += std::to_string(MaxSVEVectorSize);
   Key += CPU;
+  Key += TuneCPU;
   Key += FS;
 
   auto &I = SubtargetMap[Key];
@@ -407,8 +411,8 @@
 // creation will depend on the TM and the code generation flags on the
 // function that reside in TargetOptions.
 resetTargetOptions(F);
-I = std::make_unique(TargetTriple, CPU, FS, *this,
-   isLittle, MinSVEVectorSize,
+I = std::make_unique(TargetTriple, CPU, TuneCPU, FS,
+   *this, isLittle, MinSVEVectorSize,
MaxSVEVectorSize);
   }
   return I.get();
Index: llvm/lib/Target/AArch64/AArch64Subtarget.h
===
--- llvm/lib/Target/AArch64/AArch64Subtarget.h
+++ llvm/lib/Target/AArch64/AArch64Subtarget.h
@@ -293,7 +293,8 @@
   /// passed in feature string so that we can use initializer lists for
   /// subtarget initialization.
   AArch64Subtarget &initializeSubtargetDependencies(StringRef FS,
-StringRef CPUString);
+StringRef CPUString,
+StringRef TuneCPUString);
 
   /// Initialize properties based on the selected processor family.
   void initializeProperties();
@@ -302,8 +303,8 @@
   /// This constructor initializes the data members to match that
   /// of the specified triple.
   AArch64Subtarget(const Triple &TT, const std::string &CPU,
-   const std::string &FS, const TargetMachine &TM,
-   bool LittleEndian,
+   const std::string &TuneCPU, const std::string &FS,
+   const TargetMachine &TM, bool LittleEndian,
unsigned MinSVEVectorSizeInBitsOverride = 0,
unsigned MaxSVEVectorSizeInBitsOverride = 0);
 
Index: llvm/lib/Target/AArch64/AArch64Subtarget.cpp
===
--- llvm/lib/Target/AArch64/AArch64Subtarget.cpp
+++ llvm/lib/Target/AArch64/AArch64Subtarget.cpp
@@ -50,15 +50,17 @@
 static cl::opt UseAA("aarch64-use-aa", cl::init(true),
cl::desc("Enable the use of AA during codegen."));
 
-AArch64Subtarget &
-AArch64Subtarget::initializeSubtargetDependencies(StringRef 

[PATCH] D110913: [analyzer][solver] Handle simplification to ConcreteInt

2021-10-08 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments.



Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:2104
+  const llvm::APSInt &SV = CI->getValue();
+  const RangeSet *ClassConstraint = getConstraint(State, Class);
+  // We have found a contradiction.

We usually use `R` or `RS`. It gets readability better IMO.



Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:2107-2109
+return nullptr;
+} else {
+  SimplifiedMemberSym = SimplifiedMemberVal.getAsSymbol();

What prevents you to not put this stuff inside `ento::simplify`. I think it 
should perfectly fit in there.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110913

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


[PATCH] D111318: [clang][clangd] Improve signature help for variadic functions.

2021-10-08 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment.

Thanks, this looks great, just want to check if there are more callsites we can 
hit while here.




Comment at: clang/lib/Sema/SemaOverload.cpp:6460
   // list (8.3.5).
   if (TooManyArguments(NumParams, Args.size(), PartialOverloading) &&
   !Proto->isVariadic()) {

Hmm, there are something like 6 callers of TooManyArguments.
They all check isVariadic, and probably should all be adjusted in this way 
(except in once case where PartialOverloading is constant `false`).
This includes one almost-identical caller in this file, for 
AddMethodCandidate...

It's tempting to say that we should just pass some more args into 
TooManyArguments and have it do this logic internally. Maybe pass the 
FunctionType and the FunctionDecl* in, with the latter nullable?
At least this would keep this nice comment in one place.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111318

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


[PATCH] D110913: [analyzer][solver] Handle simplification to ConcreteInt

2021-10-08 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments.



Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:2099-2111
+
+SymbolRef SimplifiedMemberSym = nullptr;
+SVal SimplifiedMemberVal = simplifyToSVal(State, MemberSym);
+if (const auto CI = SimplifiedMemberVal.getAs()) {
+  const llvm::APSInt &SV = CI->getValue();
+  const RangeSet *ClassConstraint = getConstraint(State, Class);
+  // We have found a contradiction.

UPD. I mean all this new snippet.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110913

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


[PATCH] D111332: [AST Matchers] Update dump_ast_matchers.py to query only class index page.

2021-10-08 Thread Sam McCall via Phabricator via cfe-commits
sammccall accepted this revision.
sammccall added a comment.

Nice!




Comment at: clang/docs/tools/dump_ast_matchers.py:48
   text = re.sub(r'>', '>', text)
   def link_if_exists(m):
 name = m.group(1)

While here I'd add a comment:
```
"""
Wrap a likely AST node name in a link to its clang docs.

We want to do this only if the page exists, in which case it will be referenced 
from the class index page.
"""
```

(You're only adding a bit of conceptual complexity here, but it looks like it's 
been built up over time...)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111332

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


[PATCH] D111260: [clang] Visit enum base specifiers in libIndex

2021-10-08 Thread Sam McCall via Phabricator via cfe-commits
sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

LG. As you pointed out offline it's slightly out-of-order compared to he body 
but I don't think this matters, and it'd cost a fair bit of complexity to fix.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111260

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


[clang-tools-extra] 6393c21 - [clangd] IncludeCleaner: Stop crashing when included file is not found

2021-10-08 Thread Kirill Bobyrev via cfe-commits

Author: Kirill Bobyrev
Date: 2021-10-08T14:51:11+02:00
New Revision: 6393c21d476de2584b3ac010aace6a9b26d5bbec

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

LOG: [clangd] IncludeCleaner: Stop crashing when included file is not found

Added: 


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

Removed: 




diff  --git a/clang-tools-extra/clangd/IncludeCleaner.cpp 
b/clang-tools-extra/clangd/IncludeCleaner.cpp
index d9bf600a04b86..91db8bfb8bc3c 100644
--- a/clang-tools-extra/clangd/IncludeCleaner.cpp
+++ b/clang-tools-extra/clangd/IncludeCleaner.cpp
@@ -161,7 +161,10 @@ getUnused(const IncludeStructure &Structure,
   std::vector Unused;
   for (const Inclusion &MFI : Structure.MainFileIncludes) {
 // FIXME: Skip includes that are not self-contained.
-assert(MFI.HeaderID);
+if (!MFI.HeaderID) {
+  elog("File {0} not found.", MFI.Written);
+  continue;
+}
 auto IncludeID = static_cast(*MFI.HeaderID);
 if (!ReferencedFiles.contains(IncludeID)) {
   Unused.push_back(&MFI);



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


[PATCH] D111259: [clang] Fix range for forward-declared enums

2021-10-08 Thread Sam McCall via Phabricator via cfe-commits
sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/lib/AST/Decl.cpp:4509
+  auto Res = TagDecl::getSourceRange();
+  // Has a definition, we can use the usual source range.
+  if (TagDecl::getBraceRange().getEnd().isValid())

Both these comments echo the code a bit.

Maybe the only thing I'd mention is "TagDecl doesn't know about the enum base"



Comment at: clang/lib/AST/Decl.cpp:4510
+  // Has a definition, we can use the usual source range.
+  if (TagDecl::getBraceRange().getEnd().isValid())
+return Res;

Nit: you don't need the TagDecl:: qualifier

Maybe move this condition inside the getITSI if, to make it clearer this is an 
exception/condition/interaction with that case.




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111259

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


[PATCH] D109144: [SPIR-V] Add SPIR-V triple architecture and clang target info

2021-10-08 Thread Henry Linjamäki via Phabricator via cfe-commits
linjamaki added a comment.

> What I have in mind is to continue using SPIR target for now (until SPIR-V 
> back-end is added).

> For instance, SYCL compiler emits code for SPIR target and code format is 
> configured via flag.
>
> `-emit-llvm` changes output file format for regular C++ compilation flow:
>
>   clang++ a.cpp -c -o a.o  # object format by default 
>   clang++ a.cpp -c -emit-llvm -o a.bc  # LLVM IR format with 
> `-emit-llvm`
>
> Similar approach for HIP device compilation flow:
>
>   clang++ -target spir -x hip a.cpp -cuda-device-only -o a.spv
>  # SPIR-V format by default
>   clang++ -target spir -x hip a.cpp -cuda-device-only -emit-llvm -o a.bc  
>  # LLVM IR (aka SPIR) format with `-emit-llvm` if needed
>
> I think this was proposed in RFC. @linjamaki, am I right?

In the RFC we proposed a HIP compilation flow for producing and **embedding** 
SPIR-V binary into the host executable. What was not stated in the RFC clearly 
is that the process is supposed to be carried out without the need for clients 
to issue explicit commands for producing SPIR-V binaries and then to link them 
into the final executable separately. D110622 
 has test cases as examples for this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109144

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


[PATCH] D111242: Add `TypeLoc`-related matchers.

2021-10-08 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.

LGTM!




Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:6406-6414
+/// Matches reference `TypeLoc`s.
+///
+/// Given
+/// \code
+///   int x = 3;
+///   int& xx = x;
+/// \endcode

jcking1034 wrote:
> jcking1034 wrote:
> > aaron.ballman wrote:
> > > I'd appreciate more documentation on whether this is expected to match 
> > > both lvalue and rvalue references. I suppose there's a secondary question 
> > > of whether this matches member functions too:
> > > ```
> > > struct S {
> > >   void func() &; // Can this match this as a reference type loc?
> > > };
> > > ```
> > I've added an example to clarify that this matches both lvalue and rvalue 
> > references. Having some trouble addressing your second point, but will keep 
> > playing around with it.
> After looking into it, it seems that this matcher will not match 
> ref-qualified member functions. Essentially, this node isn't represented in a 
> way that allows for it to be matched by `referenceTypeLoc`.
> 
> For a more detailed explaination: In this example, we are able to use 
> `cxxMethodDecl` to match `void func() &`. If we wished to match the `Type` of 
> the member function, we could use 
> `cxxMethodDecl(hasType(functionProtoType().bind("t")))`, and from the 
> `FunctionProtoType` node you could determine if the function is ref-qualified 
> through a call to `getRefQualifier` 
> (https://clang.llvm.org/doxygen/classclang_1_1FunctionProtoType.html). It's 
> not possible to match using 
> `cxxMethodDecl(hasType(referenceType().bind("t")))`. So it seems that the 
> type of the member function is not a reference type, but instead a 
> `FunctionProtoType` from which you'd programmatically have to determine if 
> it's a reference type. In the realm of `TypeLoc`s, there is no `TypeLoc` that 
> corresponds to the `FunctionProtoType` node, and so the best you could do may 
> be something like 
> `cxxMethodDecl(hasTypeLoc(loc(functionProtoType().bind("t"` and 
> programmatically analyzing the bound node. For reference, please see 
> https://godbolt.org/z/qxsEb6a5Y.
Thank you for the detailed explanation! I think the current behavior is fine.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111242

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


[PATCH] D110798: [NFC] Use CHECK-NEXT instead of CHECK-SAME in target-invalid-cpu-note.c

2021-10-08 Thread Freddy, Ye via Phabricator via cfe-commits
FreddyYe updated this revision to Diff 378199.
FreddyYe marked an inline comment as done.
FreddyYe added a comment.

Address comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110798

Files:
  clang/test/Misc/target-invalid-cpu-note.c

Index: clang/test/Misc/target-invalid-cpu-note.c
===
--- clang/test/Misc/target-invalid-cpu-note.c
+++ clang/test/Misc/target-invalid-cpu-note.c
@@ -1,211 +1,96 @@
+// Use CHECK-NEXT instead of multiple CHECK-SAME to ensure we will fail if there is anything extra in the output.
 // RUN: not %clang_cc1 -triple armv5--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix ARM
 // ARM: error: unknown target CPU 'not-a-cpu'
-// ARM: note: valid target CPU values are:
-// ARM-SAME: arm8
+// ARM-NEXT: note: valid target CPU values are: arm8, arm810, strongarm, strongarm110, strongarm1100, strongarm1110, arm7tdmi, arm7tdmi-s, arm710t, arm720t, arm9, arm9tdmi, arm920, arm920t, arm922t, arm940t, ep9312, arm10tdmi, arm1020t, arm9e, arm946e-s, arm966e-s, arm968e-s, arm10e, arm1020e, arm1022e, arm926ej-s, arm1136j-s, arm1136jf-s, mpcore, mpcorenovfp, arm1176jz-s, arm1176jzf-s, arm1156t2-s, arm1156t2f-s, cortex-m0, cortex-m0plus, cortex-m1, sc000, cortex-a5, cortex-a7, cortex-a8, cortex-a9, cortex-a12, cortex-a15, cortex-a17, krait, cortex-r4, cortex-r4f, cortex-r5, cortex-r7, cortex-r8, cortex-r52, sc300, cortex-m3, cortex-m4, cortex-m7, cortex-m23, cortex-m33, cortex-m35p, cortex-m55, cortex-a32, cortex-a35, cortex-a53, cortex-a55, cortex-a57, cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae, cortex-a77, cortex-a78, cortex-a78c, cortex-x1, neoverse-n1, neoverse-n2, neoverse-v1, cyclone, exynos-m3, exynos-m4, exynos-m5, kryo, iwmmxt, xscale, swift{{$}}
 
 // RUN: not %clang_cc1 -triple arm64--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix AARCH64
 // AARCH64: error: unknown target CPU 'not-a-cpu'
-// AARCH64: note: valid target CPU values are:
-// AARCH64-SAME: cortex-a35,
+// AARCH64-NEXT: note: valid target CPU values are: cortex-a34, cortex-a35, cortex-a53, cortex-a55, cortex-a57, cortex-a65, cortex-a65ae, cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae, cortex-a77, cortex-a78, cortex-a78c, cortex-r82, cortex-x1, neoverse-e1, neoverse-n1, neoverse-n2, neoverse-v1, cyclone, apple-a7, apple-a8, apple-a9, apple-a10, apple-a11, apple-a12, apple-a13, apple-a14, apple-m1, apple-s4, apple-s5, exynos-m3, exynos-m4, exynos-m5, falkor, saphira, kryo, thunderx2t99, thunderx3t110, thunderx, thunderxt88, thunderxt81, thunderxt83, tsv110, a64fx, carmel{{$}}
 
 // RUN: not %clang_cc1 -triple arm64--- -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE_AARCH64
 // TUNE_AARCH64: error: unknown target CPU 'not-a-cpu'
-// TUNE_AARCH64: note: valid target CPU values are:
-// TUNE_AARCH64-SAME: cortex-a35,
+// TUNE_AARCH64-NEXT: note: valid target CPU values are: cortex-a34, cortex-a35, cortex-a53, cortex-a55, cortex-a57, cortex-a65, cortex-a65ae, cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae, cortex-a77, cortex-a78, cortex-a78c, cortex-r82, cortex-x1, neoverse-e1, neoverse-n1, neoverse-n2, neoverse-v1, cyclone, apple-a7, apple-a8, apple-a9, apple-a10, apple-a11, apple-a12, apple-a13, apple-a14, apple-m1, apple-s4, apple-s5, exynos-m3, exynos-m4, exynos-m5, falkor, saphira, kryo, thunderx2t99, thunderx3t110, thunderx, thunderxt88, thunderxt81, thunderxt83, tsv110, a64fx, carmel{{$}}
 
 // RUN: not %clang_cc1 -triple i386--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix X86
 // X86: error: unknown target CPU 'not-a-cpu'
-// X86: note: valid target CPU values are: i386, i486, winchip-c6, winchip2, c3,
-// X86-SAME: i586, pentium, pentium-mmx, pentiumpro, i686, pentium2, pentium3,
-// X86-SAME: pentium3m, pentium-m, c3-2, yonah, pentium4, pentium4m, prescott,
-// X86-SAME: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont,
-// X86-SAME: nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge,
-// X86-SAME: core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512,
-// X86-SAME: skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, knl, knm, lakemont, k6, k6-2, k6-3,
-// X86-SAME: athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64,
-// X86-SAME: athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10,
-// X86-SAME: barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3,
-// X86-SAME: x86-64, x86-64-v2, x86-64-v3, x86-64-v4, geode{{$}}
+// X86-NEXT: note: valid target CPU values are: i386, i486, winchip-c6, winchip2, c3, i586, pentium, pentium-mmx, pentiumpro, i686, pentium2, pentium3, pentium3m, pentium-m, c3-2, yonah, pentium4, pentium4m, 

[PATCH] D110798: [NFC] Use CHECK-NEXT instead of CHECK-SAME in target-invalid-cpu-note.c

2021-10-08 Thread Freddy, Ye via Phabricator via cfe-commits
FreddyYe added inline comments.



Comment at: clang/test/Misc/target-invalid-cpu-note.c:1
+// Use CHECK-NEXT instead of CHECK-SAME: ensure outputs between different 
lines of CHECK-SAME not missing checked.
 // RUN: not %clang_cc1 -triple armv5--- -target-cpu not-a-cpu -fsyntax-only %s 
2>&1 | FileCheck %s --check-prefix ARM

DavidSpickett wrote:
> This wording is a bit confusing, how about:
> // Use CHECK-NEXT instead of multiple CHECK-SAME to ensure we will fail if 
> there is anything extra in the output
Looks better. Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110798

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


[PATCH] D111406: [AIX][ZOS] Excluding merge-objc-interface.m from Tests

2021-10-08 Thread Qiongsi Wu via Phabricator via cfe-commits
qiongsiwu1 created this revision.
qiongsiwu1 added reviewers: jsji, Jake-Egan.
qiongsiwu1 added a project: LLVM.
qiongsiwu1 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Objective C is not supported on AIX or ZOS. This patch excludes the newly added 
`clang/test/Modules/merge-objc-interface.m` (added by 
https://reviews.llvm.org/D110280) from AIX and ZOS testing.

Many existing tests are already disabled by https://reviews.llvm.org/D109060.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111406

Files:
  clang/test/Modules/merge-objc-interface.m


Index: clang/test/Modules/merge-objc-interface.m
===
--- clang/test/Modules/merge-objc-interface.m
+++ clang/test/Modules/merge-objc-interface.m
@@ -1,3 +1,4 @@
+// UNSUPPORTED: -zos, -aix
 // RUN: rm -rf %t
 // RUN: split-file %s %t
 // RUN: %clang_cc1 -emit-llvm -o %t/test.bc -F%t/Frameworks %t/test.m \


Index: clang/test/Modules/merge-objc-interface.m
===
--- clang/test/Modules/merge-objc-interface.m
+++ clang/test/Modules/merge-objc-interface.m
@@ -1,3 +1,4 @@
+// UNSUPPORTED: -zos, -aix
 // RUN: rm -rf %t
 // RUN: split-file %s %t
 // RUN: %clang_cc1 -emit-llvm -o %t/test.bc -F%t/Frameworks %t/test.m \
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D110798: [NFC] Use CHECK-NEXT instead of CHECK-SAME in target-invalid-cpu-note.c

2021-10-08 Thread David Spickett via Phabricator via cfe-commits
DavidSpickett accepted this revision.
DavidSpickett added a comment.
This revision is now accepted and ready to land.

Forgot to accept, looks good.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110798

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


[clang] 75127bc - [AIX][ZOS] Excluding merge-objc-interface.m from Tests

2021-10-08 Thread Jinsong Ji via cfe-commits

Author: Qiongsi Wu
Date: 2021-10-08T14:00:06Z
New Revision: 75127bce6de78b83b70b898a04473f213451f13e

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

LOG: [AIX][ZOS] Excluding merge-objc-interface.m from Tests

Objective C is not supported on AIX or ZOS. This patch excludes the newly added 
`clang/test/Modules/merge-objc-interface.m` (added by 
https://reviews.llvm.org/D110280) from AIX and ZOS testing.

Many existing tests are already disabled by https://reviews.llvm.org/D109060.

Reviewed By: jsji

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

Added: 


Modified: 
clang/test/Modules/merge-objc-interface.m

Removed: 




diff  --git a/clang/test/Modules/merge-objc-interface.m 
b/clang/test/Modules/merge-objc-interface.m
index fba06294a26af..f62f541c1a297 100644
--- a/clang/test/Modules/merge-objc-interface.m
+++ b/clang/test/Modules/merge-objc-interface.m
@@ -1,3 +1,4 @@
+// UNSUPPORTED: -zos, -aix
 // RUN: rm -rf %t
 // RUN: split-file %s %t
 // RUN: %clang_cc1 -emit-llvm -o %t/test.bc -F%t/Frameworks %t/test.m \



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


[PATCH] D111406: [AIX][ZOS] Excluding merge-objc-interface.m from Tests

2021-10-08 Thread Jinsong Ji 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 rG75127bce6de7: [AIX][ZOS] Excluding merge-objc-interface.m 
from Tests (authored by qiongsiwu1, committed by jsji).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111406

Files:
  clang/test/Modules/merge-objc-interface.m


Index: clang/test/Modules/merge-objc-interface.m
===
--- clang/test/Modules/merge-objc-interface.m
+++ clang/test/Modules/merge-objc-interface.m
@@ -1,3 +1,4 @@
+// UNSUPPORTED: -zos, -aix
 // RUN: rm -rf %t
 // RUN: split-file %s %t
 // RUN: %clang_cc1 -emit-llvm -o %t/test.bc -F%t/Frameworks %t/test.m \


Index: clang/test/Modules/merge-objc-interface.m
===
--- clang/test/Modules/merge-objc-interface.m
+++ clang/test/Modules/merge-objc-interface.m
@@ -1,3 +1,4 @@
+// UNSUPPORTED: -zos, -aix
 // RUN: rm -rf %t
 // RUN: split-file %s %t
 // RUN: %clang_cc1 -emit-llvm -o %t/test.bc -F%t/Frameworks %t/test.m \
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 6d27659 - [NFC] Use CHECK-NEXT instead of CHECK-SAME in target-invalid-cpu-note.c

2021-10-08 Thread Freddy Ye via cfe-commits

Author: Freddy Ye
Date: 2021-10-08T22:07:40+08:00
New Revision: 6d276595d1ce734a2269f6d3828dc457d7da99c4

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

LOG: [NFC] Use CHECK-NEXT instead of CHECK-SAME in target-invalid-cpu-note.c

Reviewed By: DavidSpickett

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

Added: 


Modified: 
clang/test/Misc/target-invalid-cpu-note.c

Removed: 




diff  --git a/clang/test/Misc/target-invalid-cpu-note.c 
b/clang/test/Misc/target-invalid-cpu-note.c
index aedad031e8382..9d0a3df0a38df 100644
--- a/clang/test/Misc/target-invalid-cpu-note.c
+++ b/clang/test/Misc/target-invalid-cpu-note.c
@@ -1,211 +1,96 @@
+// Use CHECK-NEXT instead of multiple CHECK-SAME to ensure we will fail if 
there is anything extra in the output.
 // RUN: not %clang_cc1 -triple armv5--- -target-cpu not-a-cpu -fsyntax-only %s 
2>&1 | FileCheck %s --check-prefix ARM
 // ARM: error: unknown target CPU 'not-a-cpu'
-// ARM: note: valid target CPU values are:
-// ARM-SAME: arm8
+// ARM-NEXT: note: valid target CPU values are: arm8, arm810, strongarm, 
strongarm110, strongarm1100, strongarm1110, arm7tdmi, arm7tdmi-s, arm710t, 
arm720t, arm9, arm9tdmi, arm920, arm920t, arm922t, arm940t, ep9312, arm10tdmi, 
arm1020t, arm9e, arm946e-s, arm966e-s, arm968e-s, arm10e, arm1020e, arm1022e, 
arm926ej-s, arm1136j-s, arm1136jf-s, mpcore, mpcorenovfp, arm1176jz-s, 
arm1176jzf-s, arm1156t2-s, arm1156t2f-s, cortex-m0, cortex-m0plus, cortex-m1, 
sc000, cortex-a5, cortex-a7, cortex-a8, cortex-a9, cortex-a12, cortex-a15, 
cortex-a17, krait, cortex-r4, cortex-r4f, cortex-r5, cortex-r7, cortex-r8, 
cortex-r52, sc300, cortex-m3, cortex-m4, cortex-m7, cortex-m23, cortex-m33, 
cortex-m35p, cortex-m55, cortex-a32, cortex-a35, cortex-a53, cortex-a55, 
cortex-a57, cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae, 
cortex-a77, cortex-a78, cortex-a78c, cortex-x1, neoverse-n1, neoverse-n2, 
neoverse-v1, cyclone, exynos-m3, exynos-m4, exynos-m5, kryo, iwmmxt, xscale, 
swift{{$}}
 
 // RUN: not %clang_cc1 -triple arm64--- -target-cpu not-a-cpu -fsyntax-only %s 
2>&1 | FileCheck %s --check-prefix AARCH64
 // AARCH64: error: unknown target CPU 'not-a-cpu'
-// AARCH64: note: valid target CPU values are:
-// AARCH64-SAME: cortex-a35,
+// AARCH64-NEXT: note: valid target CPU values are: cortex-a34, cortex-a35, 
cortex-a53, cortex-a55, cortex-a57, cortex-a65, cortex-a65ae, cortex-a72, 
cortex-a73, cortex-a75, cortex-a76, cortex-a76ae, cortex-a77, cortex-a78, 
cortex-a78c, cortex-r82, cortex-x1, neoverse-e1, neoverse-n1, neoverse-n2, 
neoverse-v1, cyclone, apple-a7, apple-a8, apple-a9, apple-a10, apple-a11, 
apple-a12, apple-a13, apple-a14, apple-m1, apple-s4, apple-s5, exynos-m3, 
exynos-m4, exynos-m5, falkor, saphira, kryo, thunderx2t99, thunderx3t110, 
thunderx, thunderxt88, thunderxt81, thunderxt83, tsv110, a64fx, carmel{{$}}
 
 // RUN: not %clang_cc1 -triple arm64--- -tune-cpu not-a-cpu -fsyntax-only %s 
2>&1 | FileCheck %s --check-prefix TUNE_AARCH64
 // TUNE_AARCH64: error: unknown target CPU 'not-a-cpu'
-// TUNE_AARCH64: note: valid target CPU values are:
-// TUNE_AARCH64-SAME: cortex-a35,
+// TUNE_AARCH64-NEXT: note: valid target CPU values are: cortex-a34, 
cortex-a35, cortex-a53, cortex-a55, cortex-a57, cortex-a65, cortex-a65ae, 
cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae, cortex-a77, 
cortex-a78, cortex-a78c, cortex-r82, cortex-x1, neoverse-e1, neoverse-n1, 
neoverse-n2, neoverse-v1, cyclone, apple-a7, apple-a8, apple-a9, apple-a10, 
apple-a11, apple-a12, apple-a13, apple-a14, apple-m1, apple-s4, apple-s5, 
exynos-m3, exynos-m4, exynos-m5, falkor, saphira, kryo, thunderx2t99, 
thunderx3t110, thunderx, thunderxt88, thunderxt81, thunderxt83, tsv110, a64fx, 
carmel{{$}}
 
 // RUN: not %clang_cc1 -triple i386--- -target-cpu not-a-cpu -fsyntax-only %s 
2>&1 | FileCheck %s --check-prefix X86
 // X86: error: unknown target CPU 'not-a-cpu'
-// X86: note: valid target CPU values are: i386, i486, winchip-c6, winchip2, 
c3,
-// X86-SAME: i586, pentium, pentium-mmx, pentiumpro, i686, pentium2, pentium3,
-// X86-SAME: pentium3m, pentium-m, c3-2, yonah, pentium4, pentium4m, prescott,
-// X86-SAME: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, 
goldmont-plus, tremont,
-// X86-SAME: nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge,
-// X86-SAME: core-avx-i, haswell, core-avx2, broadwell, skylake, 
skylake-avx512,
-// X86-SAME: skx, cascadelake, cooperlake, cannonlake, icelake-client, 
rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, knl, knm, 
lakemont, k6, k6-2, k6-3,
-// X86-SAME: athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, 
athlon64,
-// X86-SAME: athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, 
amdfam10,
-/

[PATCH] D110798: [NFC] Use CHECK-NEXT instead of CHECK-SAME in target-invalid-cpu-note.c

2021-10-08 Thread Freddy, Ye 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 rG6d276595d1ce: [NFC] Use CHECK-NEXT instead of CHECK-SAME in 
target-invalid-cpu-note.c (authored by FreddyYe).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110798

Files:
  clang/test/Misc/target-invalid-cpu-note.c

Index: clang/test/Misc/target-invalid-cpu-note.c
===
--- clang/test/Misc/target-invalid-cpu-note.c
+++ clang/test/Misc/target-invalid-cpu-note.c
@@ -1,211 +1,96 @@
+// Use CHECK-NEXT instead of multiple CHECK-SAME to ensure we will fail if there is anything extra in the output.
 // RUN: not %clang_cc1 -triple armv5--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix ARM
 // ARM: error: unknown target CPU 'not-a-cpu'
-// ARM: note: valid target CPU values are:
-// ARM-SAME: arm8
+// ARM-NEXT: note: valid target CPU values are: arm8, arm810, strongarm, strongarm110, strongarm1100, strongarm1110, arm7tdmi, arm7tdmi-s, arm710t, arm720t, arm9, arm9tdmi, arm920, arm920t, arm922t, arm940t, ep9312, arm10tdmi, arm1020t, arm9e, arm946e-s, arm966e-s, arm968e-s, arm10e, arm1020e, arm1022e, arm926ej-s, arm1136j-s, arm1136jf-s, mpcore, mpcorenovfp, arm1176jz-s, arm1176jzf-s, arm1156t2-s, arm1156t2f-s, cortex-m0, cortex-m0plus, cortex-m1, sc000, cortex-a5, cortex-a7, cortex-a8, cortex-a9, cortex-a12, cortex-a15, cortex-a17, krait, cortex-r4, cortex-r4f, cortex-r5, cortex-r7, cortex-r8, cortex-r52, sc300, cortex-m3, cortex-m4, cortex-m7, cortex-m23, cortex-m33, cortex-m35p, cortex-m55, cortex-a32, cortex-a35, cortex-a53, cortex-a55, cortex-a57, cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae, cortex-a77, cortex-a78, cortex-a78c, cortex-x1, neoverse-n1, neoverse-n2, neoverse-v1, cyclone, exynos-m3, exynos-m4, exynos-m5, kryo, iwmmxt, xscale, swift{{$}}
 
 // RUN: not %clang_cc1 -triple arm64--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix AARCH64
 // AARCH64: error: unknown target CPU 'not-a-cpu'
-// AARCH64: note: valid target CPU values are:
-// AARCH64-SAME: cortex-a35,
+// AARCH64-NEXT: note: valid target CPU values are: cortex-a34, cortex-a35, cortex-a53, cortex-a55, cortex-a57, cortex-a65, cortex-a65ae, cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae, cortex-a77, cortex-a78, cortex-a78c, cortex-r82, cortex-x1, neoverse-e1, neoverse-n1, neoverse-n2, neoverse-v1, cyclone, apple-a7, apple-a8, apple-a9, apple-a10, apple-a11, apple-a12, apple-a13, apple-a14, apple-m1, apple-s4, apple-s5, exynos-m3, exynos-m4, exynos-m5, falkor, saphira, kryo, thunderx2t99, thunderx3t110, thunderx, thunderxt88, thunderxt81, thunderxt83, tsv110, a64fx, carmel{{$}}
 
 // RUN: not %clang_cc1 -triple arm64--- -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE_AARCH64
 // TUNE_AARCH64: error: unknown target CPU 'not-a-cpu'
-// TUNE_AARCH64: note: valid target CPU values are:
-// TUNE_AARCH64-SAME: cortex-a35,
+// TUNE_AARCH64-NEXT: note: valid target CPU values are: cortex-a34, cortex-a35, cortex-a53, cortex-a55, cortex-a57, cortex-a65, cortex-a65ae, cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae, cortex-a77, cortex-a78, cortex-a78c, cortex-r82, cortex-x1, neoverse-e1, neoverse-n1, neoverse-n2, neoverse-v1, cyclone, apple-a7, apple-a8, apple-a9, apple-a10, apple-a11, apple-a12, apple-a13, apple-a14, apple-m1, apple-s4, apple-s5, exynos-m3, exynos-m4, exynos-m5, falkor, saphira, kryo, thunderx2t99, thunderx3t110, thunderx, thunderxt88, thunderxt81, thunderxt83, tsv110, a64fx, carmel{{$}}
 
 // RUN: not %clang_cc1 -triple i386--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix X86
 // X86: error: unknown target CPU 'not-a-cpu'
-// X86: note: valid target CPU values are: i386, i486, winchip-c6, winchip2, c3,
-// X86-SAME: i586, pentium, pentium-mmx, pentiumpro, i686, pentium2, pentium3,
-// X86-SAME: pentium3m, pentium-m, c3-2, yonah, pentium4, pentium4m, prescott,
-// X86-SAME: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont,
-// X86-SAME: nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge,
-// X86-SAME: core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512,
-// X86-SAME: skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, knl, knm, lakemont, k6, k6-2, k6-3,
-// X86-SAME: athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64,
-// X86-SAME: athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10,
-// X86-SAME: barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3,
-// X86-SAME: x86-64, x86-64-v2, x86-64-v3, x86-64-v4, geode{{$}}
+// X86-NEXT: note: valid target CPU values are: i386, i486, winchip-c6, winchip2, c3

[PATCH] D111352: [clang] Fix absolute file paths with -fdebug-prefix-map

2021-10-08 Thread Paul Robinson via Phabricator via cfe-commits
probinson accepted this revision.
probinson added a comment.
This revision is now accepted and ready to land.

I suspect this is not the only way for directories and filenames to become 
confused, but it certainly helps.  LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111352

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


[PATCH] D110258: [AArch64] Always add -tune-cpu argument to -cc1 driver

2021-10-08 Thread David Sherwood via Phabricator via cfe-commits
david-arm added a comment.

Gentle ping!


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

https://reviews.llvm.org/D110258

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


[PATCH] D109652: [PowerPC] Restrict various P10 options to P10 only.

2021-10-08 Thread Amy Kwan via Phabricator via cfe-commits
amyk added a comment.

Ping @lei.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109652

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


[PATCH] D109825: [AArch64]Enabling Cortex-A510 Support

2021-10-08 Thread Mubashar Ahmad via Phabricator via cfe-commits
mubashar_ updated this revision to Diff 378216.
mubashar_ marked 3 inline comments as done.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109825

Files:
  llvm/include/llvm/Support/AArch64TargetParser.def
  llvm/lib/Target/AArch64/AArch64.td
  llvm/unittests/Support/TargetParserTest.cpp


Index: llvm/unittests/Support/TargetParserTest.cpp
===
--- llvm/unittests/Support/TargetParserTest.cpp
+++ llvm/unittests/Support/TargetParserTest.cpp
@@ -898,14 +898,16 @@
  AArch64::AEK_RDM | AArch64::AEK_FP16 |
  AArch64::AEK_DOTPROD | AArch64::AEK_RCPC,
  "8.2-A"),
-ARMCPUTestParams("cortex-a510", "armv9-a", "crypto-neon-fp-armv8",
+ARMCPUTestParams("cortex-a510", "armv9-a", "neon-fp-armv8",
  AArch64::AEK_CRC | AArch64::AEK_FP |
  AArch64::AEK_SIMD | AArch64::AEK_RAS |
- AArch64::AEK_I8MM | AArch64::AEK_BF16 |
- AArch64::AEK_SVE2 | AArch64::AEK_SVE |
- AArch64::AEK_SVE2BITPERM | AArch64::AEK_SSBS |
- AArch64::AEK_BT | AArch64::AEK_MTE |
- AArch64::AEK_DOTPROD,
+ AArch64::AEK_LSE | AArch64::AEK_RDM |
+ AArch64::AEK_RCPC | AArch64::AEK_DOTPROD |
+ AArch64::AEK_SVE2 | AArch64::AEK_BF16 |
+ AArch64::AEK_I8MM | AArch64::AEK_SVE2BITPERM |
+ AArch64::AEK_PAUTH | AArch64::AEK_MTE |
+ AArch64::AEK_SSBS | AArch64::AEK_FP16FML |
+ AArch64::AEK_SB,
  "9-A"),
 ARMCPUTestParams("cortex-a57", "armv8-a", "crypto-neon-fp-armv8",
  AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
Index: llvm/lib/Target/AArch64/AArch64.td
===
--- llvm/lib/Target/AArch64/AArch64.td
+++ llvm/lib/Target/AArch64/AArch64.td
@@ -632,23 +632,18 @@
 
 def ProcA510: SubtargetFeature<"a510", "ARMProcFamily", "CortexA510",
"Cortex-A510 ARM processors", [
- HasV9aOps,
- FeatureCrypto,
- FeatureFPARMv8,
- FeatureFuseAES,
- FeatureNEON,
- FeaturePerfMon,
- FeaturePostRAScheduler,
- FeatureSPE,
- FeatureAM,
- FeatureMPAM,
- FeatureETE,
- FeatureMTE,
- FeatureSVE2,
- FeatureSVE2BitPerm,
- FeatureFullFP16,
- FeatureFP16FML,
- FeatureDotProd
+   HasV9_0aOps,
+   FeatureNEON,
+   FeaturePerfMon,
+   FeatureMatMulInt8,
+   FeatureBF16,
+   FeatureAM,
+   FeatureMTE,
+   FeatureETE,
+   FeatureSVE2BitPerm,
+   FeatureFP16FML,
+   FeatureFuseAES,
+   FeaturePostRAScheduler
]>;
 
 def ProcA57 : SubtargetFeature<"a57", "ARMProcFamily", "CortexA57",
Index: llvm/include/llvm/Support/AArch64TargetParser.def
===
--- llvm/include/llvm/Support/AArch64TargetParser.def
+++ llvm/include/llvm/Support/AArch64TargetParser.def
@@ -144,11 +144,10 @@
  (AArch64::AEK_CRC))
 AARCH64_CPU_NAME("cortex-a55", ARMV8_2A, FK_CRYPTO_NEON_FP_ARMV8, false,
  (AArch64::AEK_FP16 | AArch64::AEK_DOTPROD | 
AArch64::AEK_RCPC))
-AARCH64_CPU_NAME("cortex=a510", ARMV9A,FK_CRYPTO_NEON_FP_ARMV8, false,
- (AArch64::AEK_CRC | AArch64::AEK_FP | AArch64::AEK_SIMD |
-  AArch64::AEK_RAS | AArch64::AEK_I8MM | AArch64::AEK_BF16 |
-  AArch64::AEK_SVE2 | AArch64::AEK_SVE | 
AArch64::AEK_SVE2BITPERM |
-  AArch64::AEK_SSBS | AArch64::AEK_BT | AArch64::AEK_MTE))
+AARCH64_CPU_NAME("cortex-a510", ARMV9A, FK_NEON_FP_ARMV8, false,
+ (AArch64::AEK_BF16 | AArch64::AEK_I8

[PATCH] D102923: [clang][lex] Remark for used header search paths

2021-10-08 Thread Jan Svoboda via Phabricator via cfe-commits
jansvoboda11 updated this revision to Diff 378222.
jansvoboda11 added a comment.

Rebase, handle module maps, add more tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102923

Files:
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticLexKinds.td
  clang/include/clang/Lex/HeaderSearch.h
  clang/lib/Frontend/InitHeaderSearch.cpp
  clang/lib/Lex/HeaderSearch.cpp
  
clang/test/Preprocessor/Inputs/search-path-usage/FwA/FrameworkA.framework/Headers/FrameworkA.h
  
clang/test/Preprocessor/Inputs/search-path-usage/FwA/FrameworkA.framework/Modules/module.modulemap
  
clang/test/Preprocessor/Inputs/search-path-usage/FwB/FrameworkB.framework/Headers/FrameworkB.h
  
clang/test/Preprocessor/Inputs/search-path-usage/FwB/FrameworkB.framework/Modules/module.modulemap
  clang/test/Preprocessor/Inputs/search-path-usage/a/a.h
  clang/test/Preprocessor/Inputs/search-path-usage/a_next/a.h
  clang/test/Preprocessor/Inputs/search-path-usage/b.hmap.json.template
  clang/test/Preprocessor/Inputs/search-path-usage/b/b.h
  clang/test/Preprocessor/Inputs/search-path-usage/d/d.h
  
clang/test/Preprocessor/Inputs/search-path-usage/modulemap_abs/module.modulemap.template
  clang/test/Preprocessor/search-path-usage-headers.m

Index: clang/test/Preprocessor/search-path-usage-headers.m
===
--- /dev/null
+++ clang/test/Preprocessor/search-path-usage-headers.m
@@ -0,0 +1,119 @@
+// RUN: rm -rf %t && mkdir %t
+
+// Check that search paths used by `#include` and `#include_next` are reported.
+//
+// RUN: %clang_cc1 -Eonly %s -Rsearch-path-usage   \
+// RUN:   -I%S/Inputs/search-path-usage/a  \
+// RUN:   -I%S/Inputs/search-path-usage/a_next \
+// RUN:   -I%S/Inputs/search-path-usage/b  \
+// RUN:   -I%S/Inputs/search-path-usage/c  \
+// RUN:   -I%S/Inputs/search-path-usage/d  \
+// RUN:   -DINCLUDE 2>&1 | FileCheck %s --check-prefix=CHECK-INCLUDE
+#ifdef INCLUDE
+#include "a.h"
+#include "d.h"
+// CHECK-INCLUDE-NOT:  remark:
+// CHECK-INCLUDE:  remark: search path used: '{{.*}}/search-path-usage/a'
+// CHECK-INCLUDE-NEXT: remark: search path used: '{{.*}}/search-path-usage/a_next'
+// CHECK-INCLUDE-NEXT: remark: search path used: '{{.*}}/search-path-usage/d'
+// CHECK-INCLUDE-NOT:  remark:
+#endif
+
+// Check that framework search paths are reported.
+//
+// RUN: %clang_cc1 -Eonly %s -Rsearch-path-usage \
+// RUN:   -F%S/Inputs/search-path-usage/FwA  \
+// RUN:   -F%S/Inputs/search-path-usage/FwB  \
+// RUN:   -DFRAMEWORK 2>&1 | FileCheck %s --check-prefix=CHECK-FRAMEWORK
+#ifdef FRAMEWORK
+#include "FrameworkA/FrameworkA.h"
+// CHECK-FRAMEWORK-NOT: remark:
+// CHECK-FRAMEWORK: remark: search path used: '{{.*}}/search-path-usage/FwA'
+// CHECK-FRAMEWORK-NOT: remark:
+#endif
+
+// Check that system search paths are reported.
+//
+// RUN: %clang_cc1 -Eonly %s -Rsearch-path-usage \
+// RUN:   -isystem %S/Inputs/search-path-usage/b \
+// RUN:   -isystem %S/Inputs/search-path-usage/d \
+// RUN:   -DSYSTEM 2>&1 | FileCheck %s --check-prefix=CHECK-SYSTEM
+#ifdef SYSTEM
+#include "b.h"
+// CHECK-SYSTEM-NOT: remark:
+// CHECK-SYSTEM: remark: search path used: '{{.*}}/search-path-usage/b'
+// CHECK-SYSTEM-NOT: remark:
+#endif
+
+// Check that sysroot-based search paths are reported.
+//
+// RUN: %clang_cc1 -Eonly %s -Rsearch-path-usage \
+// RUN:   -isysroot %S/Inputs/search-path-usage  \
+// RUN:   -iwithsysroot /b   \
+// RUN:   -iwithsysroot /d   \
+// RUN:   -DSYSROOT 2>&1 | FileCheck %s --check-prefix=CHECK-SYSROOT
+#ifdef SYSROOT
+#include "d.h"
+// CHECK-SYSROOT-NOT: remark:
+// CHECK-SYSROOT: remark: search path used: '/d'
+// CHECK-SYSROOT-NOT: remark:
+#endif
+
+// Check that search paths used by `__has_include()` are reported.
+//
+// RUN: %clang_cc1 -Eonly %s -Rsearch-path-usage \
+// RUN:   -I%S/Inputs/search-path-usage/b\
+// RUN:   -I%S/Inputs/search-path-usage/d\
+// RUN:   -DHAS_INCLUDE 2>&1 | FileCheck %s --check-prefix CHECK-HAS-INCLUDE
+#ifdef HAS_INCLUDE
+#if __has_include("b.h")
+#endif
+#if __has_include("x.h")
+#endif
+// CHECK-HAS-INCLUDE-NOT: remark
+// CHECK-HAS-INCLUDE: remark: search path used: '{{.*}}/search-path-usage/b'
+// CHECK-HAS-INCLUDE-NOT: remark
+#endif
+
+// Check that search paths used by `#import` are reported.
+//
+// RUN: %clang_cc1 -Eonly %s -Rsearch-path-usage \
+// RUN:   -I%S/Inputs/search-path-usage/b\
+// RUN:   -I%S/Inputs/search-path-usage/d\
+// RUN:   -DIMPORT 2>&1 | FileCheck %s --check-prefix CHECK-IMPORT
+#ifdef IMPORT
+#import "d.h"
+// CHECK-IMPORT-NOT: remark
+// CHECK-IMPORT: remark: search path used: '{{.*}}/search-path-usage/d'
+// CHECK-IMPORT-NOT: remark
+#endif
+
+// Check that header maps are reported.
+//
+// RUN: sed "s|DIR|%/S/Inputs/search-path-usage|g" %S/In

[PATCH] D109825: [AArch64]Enabling Cortex-A510 Support

2021-10-08 Thread Shivam Gupta via Phabricator via cfe-commits
xgupta added a comment.

Where are the other patches? Or diff is not uploaded correctly.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109825

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


[PATCH] D106191: [clang] Option control afn flag

2021-10-08 Thread Masoud Ataei via Phabricator via cfe-commits
masoud.ataei marked an inline comment as not done.
masoud.ataei added inline comments.



Comment at: clang/docs/UsersManual.rst:1393
+
+   Allow substitution of approximate calculations for functions.
+   Defaults to ``-fno-approx-func``.

erichkeane wrote:
> masoud.ataei wrote:
> > erichkeane wrote:
> > > This seems pretty incomplete to me, I have no idea what it does from this 
> > > description.  Can you elaborate?
> > If I didn't miss to say it is about math function calls, then I guess it 
> > would be more clear. 
> > ```
> > Allow substitution of approximate calculations for math function calls.
> > ```
> > This option just adds `afn` fast-math flag to the function calls and in 
> > backend the math function call can be replaced by an approximate 
> > calculation (either another math function call or not). 
> > https://llvm.org/docs/LangRef.html#fast-math-flags
> allow substitution of approximate calculations for math function with what?  
> I'm not clear as to what this does still.  I'm not sure that I get what the 
> 'afn' documentation means there either.  Typically we'd want the clang 
> frontend flags to be more accurate/descriptive than the LLVM-IR documentation.
This option adds `afn` fast-math flag to function calls in IR. And in the case 
of math function calls (like `log`, `sqrt`, `pow`, ...), `afn` flag allows LLVM 
to substitute the math calls with an "approximate calculation". What an 
approximate calculation is may differ based on which math call it is, what 
other fast-math flags are set, what is the target machine, and other factors.

An approximate calculation can be
 1. sequence of instructions (inlining): for example, inlining sqrt call needs 
`afn` flag to be present in the call.
 2. a substituted math function call (which may be less accurate but faster): 
 this substitution can be 
 (a) for general targets: for example: `pow(x,0.25)` to `sqrt(sqrt(x))`. or
 (b) for a specific target: for example, in the case of PowerPC, we are 
proposing to substitute math calls to MASS library calls 
https://reviews.llvm.org/D101759

Note that, `afn` flag is necessary for these approximate calculation but may 
not be sufficient. Most of them need at lease one or two other fast-math flags 
to be set too. 

I agree the term "approximate calculation" is a very general term. But I guess 
it is needed to describe this general situation. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106191

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


[PATCH] D111332: [AST Matchers] Update dump_ast_matchers.py to query only class index page.

2021-10-08 Thread James King via Phabricator via cfe-commits
jcking1034 updated this revision to Diff 378236.
jcking1034 added a comment.

Add docstring to `link_if_exists`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111332

Files:
  clang/docs/LibASTMatchersReference.html
  clang/docs/tools/dump_ast_matchers.py

Index: clang/docs/tools/dump_ast_matchers.py
===
--- clang/docs/tools/dump_ast_matchers.py
+++ clang/docs/tools/dump_ast_matchers.py
@@ -10,6 +10,12 @@
 except ImportError:
 from urllib2 import urlopen
 
+CLASS_INDEX_PAGE_URL = 'https://clang.llvm.org/doxygen/classes.html'
+try:
+  CLASS_INDEX_PAGE = urlopen(CLASS_INDEX_PAGE_URL).read()
+except Exception as e:
+  raise Exception('Unable to get %s: %s' % (CLASS_INDEX_PAGE_URL, e))
+
 MATCHERS_FILE = '../../include/clang/ASTMatchers/ASTMatchers.h'
 
 # Each matcher is documented in one row of the form:
@@ -40,15 +46,18 @@
   text = re.sub(r'<', '<', text)
   text = re.sub(r'>', '>', text)
   def link_if_exists(m):
+"""Wrap a likely AST node name in a link to its clang docs.
+
+   We want to do this only if the page exists, in which case it will be
+   referenced from the class index page.
+"""
 name = m.group(1)
 url = 'https://clang.llvm.org/doxygen/classclang_1_1%s.html' % name
 if url not in doxygen_probes:
-  try:
-print('Probing %s...' % url)
-urlopen(url)
-doxygen_probes[url] = True
-  except:
-doxygen_probes[url] = False
+  search_str = 'href="classclang_1_1%s.html"' % name
+  doxygen_probes[url] = search_str in CLASS_INDEX_PAGE
+  if not doxygen_probes[url]:
+print('Did not find %s in class index page' % name)
 if doxygen_probes[url]:
   return r'Matcher<%s>' % (url, name)
 else:
Index: clang/docs/LibASTMatchersReference.html
===
--- clang/docs/LibASTMatchersReference.html
+++ clang/docs/LibASTMatchersReference.html
@@ -573,15 +573,6 @@
 Return typeNameParameters
 
 
-MatcherCXXBaseSpecifier>cxxBaseSpecifierMatcherCXXBaseSpecifier>...
-Matches class bases.
-
-Examples matches public virtual B.
-  class B {};
-  class C : public virtual B {};
-
-
-
 MatcherAttr>attrMatcherAttr>...
 Matches attributes.
 Attributes may be attached with a variety of different syntaxes (including
@@ -600,6 +591,15 @@
 
 
 
+MatcherCXXBaseSpecifier>cxxBaseSpecifierMatcherCXXBaseSpecifier>...
+Matches class bases.
+
+Examples matches public virtual B.
+  class B {};
+  class C : public virtual B {};
+
+
+
 MatcherCXXCtorInitializer>cxxCtorInitializerMatcherCXXCtorInitializer>...
 Matches constructor initializers.
 
@@ -1160,6 +1160,16 @@
   matches using namespace X 
 
 
+MatcherDecl>usingEnumDeclMatcherUsingEnumDecl>...
+Matches using-enum declarations.
+
+Given
+  namespace X { enum x {...}; }
+  using enum X::x;
+usingEnumDecl()
+  matches using enum X::x 
+
+
 MatcherDecl>valueDeclMatcherValueDecl>...
 Matches any value declaration.
 
@@ -3031,6 +3041,10 @@
 
 
 
+MatcherCXXConstructorDecl>isInheritingConstructor
+
+
+
 MatcherCXXConstructorDecl>isMoveConstructor
 Matches constructor declarations that are move constructors.
 
@@ -3779,7 +3793,7 @@
 MatcherDecl>isExpandedFromMacrostd::string MacroName
 Matches statements that are (transitively) expanded from the named macro.
 Does not match if only part of the statement is expanded from that macro or
-if different parts of the the statement are expanded from different
+if different parts of the statement are expanded from different
 appearances of the macro.
 
 
@@ -5232,7 +5246,7 @@
 MatcherTypeLoc>isExpandedFromMacrostd::string MacroName
 Matches statements that are (transitively) expanded from the named macro.
 Does not match if only part of the statement is expanded from that macro or
-if different parts of the the stateme

[PATCH] D109825: [AArch64]Enabling Cortex-A510 Support

2021-10-08 Thread Mubashar Ahmad via Phabricator via cfe-commits
mubashar_ added a comment.

@xgupta those would be under the history tab.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109825

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


[PATCH] D106191: [clang] Option control afn flag

2021-10-08 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments.



Comment at: clang/docs/UsersManual.rst:1393
+
+   Allow substitution of approximate calculations for functions.
+   Defaults to ``-fno-approx-func``.

masoud.ataei wrote:
> erichkeane wrote:
> > masoud.ataei wrote:
> > > erichkeane wrote:
> > > > This seems pretty incomplete to me, I have no idea what it does from 
> > > > this description.  Can you elaborate?
> > > If I didn't miss to say it is about math function calls, then I guess it 
> > > would be more clear. 
> > > ```
> > > Allow substitution of approximate calculations for math function calls.
> > > ```
> > > This option just adds `afn` fast-math flag to the function calls and in 
> > > backend the math function call can be replaced by an approximate 
> > > calculation (either another math function call or not). 
> > > https://llvm.org/docs/LangRef.html#fast-math-flags
> > allow substitution of approximate calculations for math function with what? 
> >  I'm not clear as to what this does still.  I'm not sure that I get what 
> > the 'afn' documentation means there either.  Typically we'd want the clang 
> > frontend flags to be more accurate/descriptive than the LLVM-IR 
> > documentation.
> This option adds `afn` fast-math flag to function calls in IR. And in the 
> case of math function calls (like `log`, `sqrt`, `pow`, ...), `afn` flag 
> allows LLVM to substitute the math calls with an "approximate calculation". 
> What an approximate calculation is may differ based on which math call it is, 
> what other fast-math flags are set, what is the target machine, and other 
> factors.
> 
> An approximate calculation can be
>  1. sequence of instructions (inlining): for example, inlining sqrt call 
> needs `afn` flag to be present in the call.
>  2. a substituted math function call (which may be less accurate but faster): 
>  this substitution can be 
>  (a) for general targets: for example: `pow(x,0.25)` to `sqrt(sqrt(x))`. 
> or
>  (b) for a specific target: for example, in the case of PowerPC, we are 
> proposing to substitute math calls to MASS library calls 
> https://reviews.llvm.org/D101759
> 
> Note that, `afn` flag is necessary for these approximate calculation but may 
> not be sufficient. Most of them need at lease one or two other fast-math 
> flags to be set too. 
> 
> I agree the term "approximate calculation" is a very general term. But I 
> guess it is needed to describe this general situation. 
Perhaps then something like:
`Allow certain math function calls (such as log, sqrt, pow, etc) to be replaced 
with an approximately equivalent set of instructions or alternative math 
function calls.  For example, a pow(x, 0.25) may be replaced with sqrt(sqrt(x), 
despite being an inexact result in cases where .`


For Options.td we can be a little more terse, so perhaps something a little 
more like:

`Allow certain math function calls to be replaced with an approximately 
equivalent calculation.`

@aaron.ballman  WDYT?



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106191

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


[PATCH] D102923: [clang][lex] Remark for used header search paths

2021-10-08 Thread Jan Svoboda via Phabricator via cfe-commits
jansvoboda11 added a comment.

I believe I've addressed all suggestions provided so far. @dexonsmith & 
@Bigcheese, can you check again?




Comment at: clang/test/Preprocessor/header-search-user-entries.c:9-11
+// CHECK: remark: user-provided search path used: 
'{{.*}}/header-search-user-entries/a'
+// CHECK: remark: user-provided search path used: 
'{{.*}}/header-search-user-entries/a_next'
+// CHECK: remark: user-provided search path used: 
'{{.*}}/header-search-user-entries/d'

jansvoboda11 wrote:
> dexonsmith wrote:
> > If `-verify` doesn't work (hopefully it does), I think you'll need to add 
> > some `CHECK-NOT` / `CHECK-NEXT` / etc. or else you're not testing for the 
> > absence of other diagnostics.
> > 
> > Please also test:
> > - Framework search path (used vs. not used)
> > - System search path (used vs. not used)
> > - One search path described relative to `-isysroot` (used vs. not used)
> > - Header map (matched and used vs. matched but not used vs. not matched -- 
> > for the middle case, I'm not sure what result we actually want)
> > - A path only used via `#if __has_include()` (when it's not followed by an 
> > `#include` or `#import`)
> > - A path only used via ObjC's `#import`
> > 
> > If one of them doesn't work and it's complex enough to separate into a 
> > follow up, I think that'd be fine, but please find somewhere to leave a 
> > FIXME.
> Good point, I'll work on improving the coverage.
I tried using `-verify` together with `expected-remark-re` (to match 
**relative** paths) and `@*` (to match any/no line number), but those don't 
seem to work together.

This expectation:
```
// expected-remark-re @* {{search path used: '{{.*}}/search-path-usage/FwA'}}
```
produces:
```
error: 'error' diagnostics seen but not expected: 
  File 
/Users/Jan/Code/upstream-llvm/clang/test/Preprocessor/search-path-usage-headers.m
 Line 30: cannot find start ('{{') of expected regex
error: 'remark' diagnostics seen but not expected: 
  (frontend): search path used: 
'/Users/Jan/Code/upstream-llvm/clang/test/Preprocessor/Inputs/search-path-usage/FwA'
2 errors generated.
```

If I drop `@*`, stuff doesn't work (presumably because of line numbers):
```
error: 'remark' diagnostics expected but not seen: 
  File 
/Users/Jan/Code/upstream-llvm/clang/test/Preprocessor/search-path-usage-headers.m
 Line 30: search path used: '{{.*}}/search-path-usage/FwA'
error: 'remark' diagnostics seen but not expected: 
  (frontend): search path used: 
'/Users/Jan/Code/upstream-llvm/clang/test/Preprocessor/Inputs/search-path-usage/FwA'
2 errors generated.
```

Let me know if I'm doing something wrong. In the meantime, I made the FileCheck 
checks more thorough as you suggested.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102923

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


[PATCH] D102923: [clang][lex] Remark on search path usage

2021-10-08 Thread Jan Svoboda via Phabricator via cfe-commits
jansvoboda11 added inline comments.



Comment at: clang/test/Preprocessor/header-search-user-entries.c:9-11
+// CHECK: remark: user-provided search path used: 
'{{.*}}/header-search-user-entries/a'
+// CHECK: remark: user-provided search path used: 
'{{.*}}/header-search-user-entries/a_next'
+// CHECK: remark: user-provided search path used: 
'{{.*}}/header-search-user-entries/d'

jansvoboda11 wrote:
> jansvoboda11 wrote:
> > dexonsmith wrote:
> > > If `-verify` doesn't work (hopefully it does), I think you'll need to add 
> > > some `CHECK-NOT` / `CHECK-NEXT` / etc. or else you're not testing for the 
> > > absence of other diagnostics.
> > > 
> > > Please also test:
> > > - Framework search path (used vs. not used)
> > > - System search path (used vs. not used)
> > > - One search path described relative to `-isysroot` (used vs. not used)
> > > - Header map (matched and used vs. matched but not used vs. not matched 
> > > -- for the middle case, I'm not sure what result we actually want)
> > > - A path only used via `#if __has_include()` (when it's not followed by 
> > > an `#include` or `#import`)
> > > - A path only used via ObjC's `#import`
> > > 
> > > If one of them doesn't work and it's complex enough to separate into a 
> > > follow up, I think that'd be fine, but please find somewhere to leave a 
> > > FIXME.
> > Good point, I'll work on improving the coverage.
> I tried using `-verify` together with `expected-remark-re` (to match 
> **relative** paths) and `@*` (to match any/no line number), but those don't 
> seem to work together.
> 
> This expectation:
> ```
> // expected-remark-re @* {{search path used: '{{.*}}/search-path-usage/FwA'}}
> ```
> produces:
> ```
> error: 'error' diagnostics seen but not expected: 
>   File 
> /Users/Jan/Code/upstream-llvm/clang/test/Preprocessor/search-path-usage-headers.m
>  Line 30: cannot find start ('{{') of expected regex
> error: 'remark' diagnostics seen but not expected: 
>   (frontend): search path used: 
> '/Users/Jan/Code/upstream-llvm/clang/test/Preprocessor/Inputs/search-path-usage/FwA'
> 2 errors generated.
> ```
> 
> If I drop `@*`, stuff doesn't work (presumably because of line numbers):
> ```
> error: 'remark' diagnostics expected but not seen: 
>   File 
> /Users/Jan/Code/upstream-llvm/clang/test/Preprocessor/search-path-usage-headers.m
>  Line 30: search path used: '{{.*}}/search-path-usage/FwA'
> error: 'remark' diagnostics seen but not expected: 
>   (frontend): search path used: 
> '/Users/Jan/Code/upstream-llvm/clang/test/Preprocessor/Inputs/search-path-usage/FwA'
> 2 errors generated.
> ```
> 
> Let me know if I'm doing something wrong. In the meantime, I made the 
> FileCheck checks more thorough as you suggested.
> - Header map (matched and used vs. matched but not used vs. not matched -- 
> for the middle case, I'm not sure what result we actually want)

Can you clarify what you mean by "matched" and "used" exactly?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102923

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


[PATCH] D111258: [PowerPC] Emit dcbt and dcbtst in place of their extended mnemonics on AIX

2021-10-08 Thread Nemanja Ivanovic via Phabricator via cfe-commits
nemanjai accepted this revision.
nemanjai added a comment.

LGTM. This is already approved, but just wanted to indicate that I think the 
comments were addressed adequately.


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

https://reviews.llvm.org/D111258

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


[PATCH] D109825: [AArch64]Enabling Cortex-A510 Support

2021-10-08 Thread Shivam Gupta via Phabricator via cfe-commits
xgupta added a comment.

Yeah, those changes are in history, But we need them in the present to commit :)

The patch is incorrectly updated, did you followed 
https://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-command-line?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109825

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


[PATCH] D106191: [clang] Option control afn flag

2021-10-08 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang/docs/UsersManual.rst:1393
+
+   Allow substitution of approximate calculations for functions.
+   Defaults to ``-fno-approx-func``.

erichkeane wrote:
> masoud.ataei wrote:
> > erichkeane wrote:
> > > masoud.ataei wrote:
> > > > erichkeane wrote:
> > > > > This seems pretty incomplete to me, I have no idea what it does from 
> > > > > this description.  Can you elaborate?
> > > > If I didn't miss to say it is about math function calls, then I guess 
> > > > it would be more clear. 
> > > > ```
> > > > Allow substitution of approximate calculations for math function calls.
> > > > ```
> > > > This option just adds `afn` fast-math flag to the function calls and in 
> > > > backend the math function call can be replaced by an approximate 
> > > > calculation (either another math function call or not). 
> > > > https://llvm.org/docs/LangRef.html#fast-math-flags
> > > allow substitution of approximate calculations for math function with 
> > > what?  I'm not clear as to what this does still.  I'm not sure that I get 
> > > what the 'afn' documentation means there either.  Typically we'd want the 
> > > clang frontend flags to be more accurate/descriptive than the LLVM-IR 
> > > documentation.
> > This option adds `afn` fast-math flag to function calls in IR. And in the 
> > case of math function calls (like `log`, `sqrt`, `pow`, ...), `afn` flag 
> > allows LLVM to substitute the math calls with an "approximate calculation". 
> > What an approximate calculation is may differ based on which math call it 
> > is, what other fast-math flags are set, what is the target machine, and 
> > other factors.
> > 
> > An approximate calculation can be
> >  1. sequence of instructions (inlining): for example, inlining sqrt call 
> > needs `afn` flag to be present in the call.
> >  2. a substituted math function call (which may be less accurate but 
> > faster): 
> >  this substitution can be 
> >  (a) for general targets: for example: `pow(x,0.25)` to 
> > `sqrt(sqrt(x))`. or
> >  (b) for a specific target: for example, in the case of PowerPC, we are 
> > proposing to substitute math calls to MASS library calls 
> > https://reviews.llvm.org/D101759
> > 
> > Note that, `afn` flag is necessary for these approximate calculation but 
> > may not be sufficient. Most of them need at lease one or two other 
> > fast-math flags to be set too. 
> > 
> > I agree the term "approximate calculation" is a very general term. But I 
> > guess it is needed to describe this general situation. 
> Perhaps then something like:
> `Allow certain math function calls (such as log, sqrt, pow, etc) to be 
> replaced with an approximately equivalent set of instructions or alternative 
> math function calls.  For example, a pow(x, 0.25) may be replaced with 
> sqrt(sqrt(x), despite being an inexact result in cases where  little>.`
> 
> 
> For Options.td we can be a little more terse, so perhaps something a little 
> more like:
> 
> `Allow certain math function calls to be replaced with an approximately 
> equivalent calculation.`
> 
> @aaron.ballman  WDYT?
> 
I think the docs suggestion makes sense (though please be sure to add backticks 
to all the syntax components, correct the missing paren on `sqrt(sqrt(x))`, and 
finish the  bit.

I think the suggested wording for Options.td looks good. Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106191

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


[PATCH] D109825: [AArch64]Enabling Cortex-A510 Support

2021-10-08 Thread Mubashar Ahmad via Phabricator via cfe-commits
mubashar_ added a comment.

@xgupta I followed the request review via web interface section of that page. 
Let me look into it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109825

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


[PATCH] D109506: [clangd] Print current request context along with the stack trace

2021-10-08 Thread Emma Blink via Phabricator via cfe-commits
0x1eaf updated this revision to Diff 378257.
0x1eaf added a comment.

Addressed feedback from the last round of comments. Sorry for the delay!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109506

Files:
  clang-tools-extra/clangd/JSONTransport.cpp
  clang-tools-extra/clangd/TUScheduler.cpp
  clang-tools-extra/clangd/support/CMakeLists.txt
  clang-tools-extra/clangd/support/ThreadCrashReporter.cpp
  clang-tools-extra/clangd/support/ThreadCrashReporter.h
  clang-tools-extra/clangd/test/crash.test
  clang-tools-extra/clangd/tool/ClangdMain.cpp
  clang-tools-extra/clangd/unittests/CMakeLists.txt
  clang-tools-extra/clangd/unittests/ThreadCrashReporterTests.cpp

Index: clang-tools-extra/clangd/unittests/ThreadCrashReporterTests.cpp
===
--- /dev/null
+++ clang-tools-extra/clangd/unittests/ThreadCrashReporterTests.cpp
@@ -0,0 +1,78 @@
+///===- ThreadCrashReporterTests.cpp - Thread local signal handling tests -===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "support/ThreadCrashReporter.h"
+#include "support/Threading.h"
+#include "llvm/Support/Signals.h"
+#include "gtest/gtest.h"
+#include 
+#include 
+
+namespace clang {
+namespace clangd {
+
+namespace {
+
+static void infoSignalHandler() { ThreadCrashReporter::runCrashHandlers(); }
+
+TEST(ThreadCrashReporterTest, All) {
+#if defined(_WIN32)
+  // Simulate signals on Windows for unit testing purposes.
+  // The `crash.test` lit test checks the end-to-end integration.
+  auto SignalCurrentThread = []() { infoSignalHandler(); };
+#else
+  llvm::sys::SetInfoSignalFunction(&infoSignalHandler);
+  auto SignalCurrentThread = []() { raise(SIGUSR1); };
+#endif
+
+  AsyncTaskRunner Runner;
+  auto SignalAnotherThread = [&]() {
+Runner.runAsync("signal another thread", SignalCurrentThread);
+Runner.wait();
+  };
+
+  bool Called;
+  {
+ThreadCrashReporter ScopedReporter([&Called]() { Called = true; });
+// Check handler gets called when a signal gets delivered to the current
+// thread.
+Called = false;
+SignalCurrentThread();
+EXPECT_TRUE(Called);
+
+// Check handler does not get called when another thread gets signalled.
+Called = false;
+SignalAnotherThread();
+EXPECT_FALSE(Called);
+  }
+  // Check handler does not get called when the reporter object goes out of
+  // scope.
+  Called = false;
+  SignalCurrentThread();
+  EXPECT_FALSE(Called);
+
+  std::string Order = "";
+  {
+ThreadCrashReporter ScopedReporter([&Order] { Order.push_back('a'); });
+{
+  ThreadCrashReporter ScopedReporter([&Order] { Order.push_back('b'); });
+  SignalCurrentThread();
+}
+// Check that handlers are called in LIFO order.
+EXPECT_EQ(Order, "ba");
+
+// Check that current handler is the only one after the nested scope is
+// over.
+SignalCurrentThread();
+EXPECT_EQ(Order, "baa");
+  }
+}
+
+} // namespace
+} // namespace clangd
+} // namespace clang
Index: clang-tools-extra/clangd/unittests/CMakeLists.txt
===
--- clang-tools-extra/clangd/unittests/CMakeLists.txt
+++ clang-tools-extra/clangd/unittests/CMakeLists.txt
@@ -88,6 +88,7 @@
   TestIndex.cpp
   TestTU.cpp
   TestWorkspace.cpp
+  ThreadCrashReporterTests.cpp
   TidyProviderTests.cpp
   TypeHierarchyTests.cpp
   URITests.cpp
Index: clang-tools-extra/clangd/tool/ClangdMain.cpp
===
--- clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -24,6 +24,7 @@
 #include "refactor/Rename.h"
 #include "support/Path.h"
 #include "support/Shutdown.h"
+#include "support/ThreadCrashReporter.h"
 #include "support/ThreadsafeFS.h"
 #include "support/Trace.h"
 #include "clang/Format/Format.h"
@@ -679,6 +680,8 @@
 
   llvm::InitializeAllTargetInfos();
   llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
+  llvm::sys::AddSignalHandler(
+  [](void *) { ThreadCrashReporter::runCrashHandlers(); }, nullptr);
   llvm::sys::SetInterruptFunction(&requestShutdown);
   llvm::cl::SetVersionPrinter([](llvm::raw_ostream &OS) {
 OS << versionString() << "\n"
Index: clang-tools-extra/clangd/test/crash.test
===
--- /dev/null
+++ clang-tools-extra/clangd/test/crash.test
@@ -0,0 +1,5 @@
+# Overflow the recursive json parser, prevent `yes` error due to broken pipe and `clangd` SIGSEGV from being treated as a failure.
+# RUN: (yes '[' || :) | head -n 5 | (clangd --input-style=delimited 2>&1 || :) | FileCheck %s
+#  CHECK: Sig

[PATCH] D108138: [WIP] Remove switch statements before vectorization

2021-10-08 Thread Kerry McLaughlin via Phabricator via cfe-commits
kmclaughlin abandoned this revision.
kmclaughlin added a comment.

I just wanted to give an update on this patch, which I'm abandoning for the 
time being:

@lebedev.ri raised some good questions about the approach taken and whether the 
additional compile time spent would be worth the additional opportunities for 
vectorisation. After posting the last update, I collected some benchmark 
results using Spec2017 to get a better understanding of the impact of these 
changes and found that several benchmarks showed performance regressions for 
fixed-width.

The biggest outliers (in terms of percentage runtime change) were:
520.omnetpp_r: -3.00%
500.perlbench_r: -2.00%
502.gcc_r: -1.52%

I also collected the results after adding in a threshold number of cases to be 
unswitched (set to 4), as was included in the first draft of this patch. This 
also showed some regressions in the benchmarks run and no significant 
improvements. Both sets of results showed increased compile times for many 
benchmarks.

The same benchmarks as above, with the threshold of 4 set:
520.omnetpp_r: -3.46%
500.perlbench_r: -1.20%
502.gcc_r: -1.22%

Results were collected on a Neoverse-N1 machine. Given that these results 
indicate this isn't the best approach to take, I'm abandoning the patch for 
now. When this is picked up in future, it will likely be better to follow 
either the suggestion to prevent canonicalisation of branches & compares into 
switch statements (under a given number of cases) in the first place, or to 
teach the loop vectoriser to recognise switches.


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

https://reviews.llvm.org/D108138

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


[PATCH] D109506: [clangd] Print current request context along with the stack trace

2021-10-08 Thread Emma Blink via Phabricator via cfe-commits
0x1eaf marked 9 inline comments as done.
0x1eaf added a comment.

I've opted for simulating signals in the unit test on Windows by manually 
calling the signal handler, and added a list test to test the crash handling 
integration end-to-end.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109506

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


[PATCH] D108138: [WIP] Remove switch statements before vectorization

2021-10-08 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

:(
I'm sorry for derailing this.
I still think proper switch handling for loops would be nice.


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

https://reviews.llvm.org/D108138

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


[PATCH] D111371: [Support][ThinLTO] Move ThinLTO caching to LLVM Support library.

2021-10-08 Thread Teresa Johnson via Phabricator via cfe-commits
tejohnson added a comment.

This lgtm but I agree with @phosek 's suggestion to configure the file prefix 
and keep it as "Thin" for ThinLTO.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111371

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


[PATCH] D110641: Implement P0857R0 -Part B: requires clause for template-template params

2021-10-08 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added inline comments.



Comment at: clang/test/CXX/temp/temp.arg/temp.arg.template/p3-2a.cpp:60-62
+  // A naive individual might expect the following to all fail concept 
checking,
+  // but there does not seem to be any requirement to check these in the
+  // standard, and none of the other implementations do so either.

erichkeane wrote:
> aaron.ballman wrote:
> > I agree that none of the other implementations seems to be checking 
> > constraints here, but I would have guessed that 
> > https://eel.is/c++draft/temp.arg.template#3 was what would trigger checking 
> > the constraints here (the `and for template template-parameters, each of 
> > their corresponding template-parameters matches, recursively.` bit, 
> > specifically).
> > 
> > Usually the answer to "Am I misreading the standard or are these three 
> > implementations all wrong in the same way?" is "I misread the standard.", 
> > but I'd appreciate some confirmation here. :-)
> >>Usually the answer to "Am I misreading the standard or are these three 
> >>implementations all wrong in the same way?" is "I misread the standard."
> 
> This is typically _MY_ response to this as well, so I was hoping @rsmith or 
> @hubert.reinterpretcast could tell me the answer here (and perhaps help write 
> a Core issue if the implementations are all 'right').
I've spent the last hour trying to come up with scenarios where GCC does 
something interesting here, or where there would be a use for this here, but I 
have nothing.


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

https://reviews.llvm.org/D110641

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


[PATCH] D111434: [PowerPC] PPC backend optimization on conditional trap intrustions

2021-10-08 Thread Victor Huang via Phabricator via cfe-commits
NeHuang created this revision.
NeHuang added reviewers: nemanjai, stefanp, PowerPC.
NeHuang added projects: LLVM, PowerPC.
Herald added subscribers: shchenz, JDevlieghere, kbarton, hiraditya.
NeHuang requested review of this revision.

This patch adds PPC back end optimization to analyze the arguments of a 
conditional trap instruction to execute one of the following

- Delete it if the condition is never true
- Replace it with an unconditional trap if the condition is always true
- Otherwise keep it


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111434

Files:
  llvm/lib/Target/PowerPC/PPCMIPeephole.cpp
  llvm/test/CodeGen/PowerPC/mi-peepholes-trap-opt.mir

Index: llvm/test/CodeGen/PowerPC/mi-peepholes-trap-opt.mir
===
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/mi-peepholes-trap-opt.mir
@@ -0,0 +1,448 @@
+# RUN: llc -mtriple powerpc64le-unknown-linux-gnu -mcpu=pwr8 -x mir < %s \
+# RUN:   -verify-machineinstrs -start-before=ppc-mi-peepholes | FileCheck %s
+
+---
+name:conditional_trap_opt_reg_implicit_def
+alignment:   16
+tracksRegLiveness: true
+body: |
+  bb.0.entry:
+%0:gprc = IMPLICIT_DEF
+%1:gprc = IMPLICIT_DEF
+%2:g8rc = IMPLICIT_DEF
+%3:g8rc = IMPLICIT_DEF
+TW 8, %0, %1
+TD 8, %2, %3
+TWI 24, %0, 0
+TDI 24, %2, 0
+BLR8 implicit $lr8, implicit $rm
+...
+  # CHECK-LABEL: conditional_trap_opt_reg_implicit_def
+  # CHECK: # %bb.0: # %entry
+  # CHECK-NEXT:  twgt3, 3
+  # CHECK-NEXT:  tdgt3, 3
+  # CHECK-NEXT:  twnei   3, 0
+  # CHECK-NEXT:  tdnei   3, 0
+  # CHECK-NEXT:  blr
+---
+name:conditional_trap_opt_TW_31
+alignment:   16
+tracksRegLiveness: true
+body: |
+  bb.0.entry:
+%0:gprc = LI 3
+%1:gprc = LI 0
+TW 31, %1, %0
+BLR8 implicit $lr8, implicit $rm
+...
+  # CHECK-LABEL: conditional_trap_opt_TW_31
+  # CHECK: # %bb.0: # %entry
+  # CHECK-NEXT:  trap
+  # CHECK-NEXT:  blr
+
+---
+name:conditional_trap_opt_TW_16
+alignment:   16
+tracksRegLiveness: true
+body: |
+  bb.0.entry:
+%0:gprc = LI 5
+%1:gprc = LI 1
+TW 16, %1, %0
+TW 16, %0, %1
+BLR8 implicit $lr8, implicit $rm
+...
+  # CHECK-LABEL: conditional_trap_opt_TW_16
+  # CHECK: # %bb.0: # %entry
+  # CHECK-NEXT:  trap
+  # CHECK-NEXT:  blr
+
+---
+name:conditional_trap_opt_TW_8
+alignment:   16
+tracksRegLiveness: true
+body: |
+  bb.0.entry:
+%0:gprc = LI -1
+%1:gprc = LI 10
+TW 8, %1, %0
+TW 8, %0, %1
+BLR8 implicit $lr8, implicit $rm
+...
+  # CHECK-LABEL: conditional_trap_opt_TW_8
+  # CHECK: # %bb.0: # %entry
+  # CHECK-NEXT:  trap
+  # CHECK-NEXT:  blr
+
+---
+name:conditional_trap_opt_TW_2
+alignment:   16
+tracksRegLiveness: true
+body: |
+  bb.0.entry:
+%0:gprc = LI -1
+%1:gprc = LI 2
+TW 2, %1, %0
+TW 2, %0, %1
+BLR8 implicit $lr8, implicit $rm
+...
+  # CHECK-LABEL: conditional_trap_opt_TW_2
+  # CHECK: # %bb.0: # %entry
+  # CHECK-NEXT:  trap
+  # CHECK-NEXT:  blr
+
+---
+name:conditional_trap_opt_TW_1
+alignment:   16
+tracksRegLiveness: true
+body: |
+  bb.0.entry:
+%0:gprc = LI -3
+%1:gprc = LI 4
+TW 1, %1, %0
+TW 1, %0, %1
+BLR8 implicit $lr8, implicit $rm
+...
+  # CHECK-LABEL: conditional_trap_opt_TW_1
+  # CHECK: # %bb.0: # %entry
+  # CHECK-NEXT:  trap
+  # CHECK-NEXT:  blr
+
+---
+name:conditional_trap_opt_TW_4
+alignment:   16
+tracksRegLiveness: true
+body: |
+  bb.0.entry:
+%0:gprc = LI 5
+%1:gprc = LI 1
+TW 4, %1, %0
+TW 4, %1, %1
+BLR8 implicit $lr8, implicit $rm
+...
+  # CHECK-LABEL: conditional_trap_opt_TW_4
+  # CHECK: # %bb.0: # %entry
+  # CHECK-NEXT:  trap
+  # CHECK-NEXT:  blr
+
+---
+name:conditional_trap_opt_TWI_31
+alignment:   16
+tracksRegLiveness: true
+body: |
+  bb.0.entry:
+%0:gprc = LI 3
+TWI 31, %0, 0
+BLR8 implicit $lr8, implicit $rm
+...
+  # CHECK-LABEL: conditional_trap_opt_TWI_31
+  # CHECK: # %bb.0: # %entry
+  # CHECK-NEXT:  trap
+  # CHECK-NEXT:  blr
+
+---
+name:conditional_trap_opt_TWI_16
+alignment:   16
+tracksRegLiveness: true
+body: |
+  bb.0.entry:
+%0:gprc = LI 5
+%1:gprc = LI 1
+TWI 16, %1, 5
+TWI 16, %0, 1
+BLR8 implicit $lr8, implicit $rm
+...
+  # CHECK-LABEL: conditional_trap_opt_TWI_16
+  # CHECK: # %bb.0: # %entry
+  # CHECK-NEXT:  trap
+  # CHECK-NEXT:  blr
+
+---
+name:conditional_trap_opt_TWI_8
+alignment:   16
+tracksRegLiveness: true
+body: |
+  bb.0.entry:
+%0:gprc = LI -1
+%1:gprc = LI 10
+TWI 8, %1, -1
+TWI 8, %0, 10
+BLR8 implicit $lr8, implicit $rm
+...
+  # CHECK-LABEL: conditional_trap_opt_TWI_8
+  # CHECK: # %bb.0: # %entry
+  # CHECK-NEXT:  trap
+  # CHECK-NEXT:  blr
+
+---
+name:con

[PATCH] D111336: [AIX] Disable tests failing due to missing DWARF sections

2021-10-08 Thread Jake Egan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8037481cb2d7: [AIX] Disable tests failing due to missing 
DWARF sections (authored by Jake-Egan).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111336

Files:
  clang/test/Modules/DebugInfoSubmoduleImport.c
  llvm/test/DebugInfo/Generic/2010-04-19-FramePtr.ll
  llvm/test/DebugInfo/Generic/accel-table-hash-collisions.ll
  llvm/test/DebugInfo/Generic/address_space_rvalue.ll
  llvm/test/DebugInfo/Generic/debug-names-empty-name.ll
  llvm/test/DebugInfo/Generic/debug-names-hash-collisions.ll
  llvm/test/DebugInfo/Generic/debug-names-index-type.ll
  llvm/test/DebugInfo/Generic/debug-names-linkage-name.ll
  llvm/test/DebugInfo/Generic/debug-names-many-cu.ll
  llvm/test/DebugInfo/Generic/debug-names-name-collisions.ll
  llvm/test/DebugInfo/Generic/debug-names-one-cu.ll
  llvm/test/DebugInfo/Generic/debug-names-two-cu.ll
  llvm/test/DebugInfo/Generic/export-symbol-anonymous-class.ll
  llvm/test/DebugInfo/Generic/string-offsets-form.ll
  llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp

Index: llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
@@ -437,7 +437,11 @@
   TestAllForms<4, AddrType, RefAddrType>();
 }
 
+#ifdef _AIX
+TEST(DWARFDebigInfo, DISABLED_TestDWARF32Version5Addr4AllForms) {
+#else
 TEST(DWARFDebugInfo, TestDWARF32Version5Addr4AllForms) {
+#endif
   // Test that we can decode all forms for DWARF32, version 5, with 4 byte
   // addresses.
   typedef uint32_t AddrType;
@@ -446,7 +450,11 @@
   TestAllForms<5, AddrType, RefAddrType>();
 }
 
+#ifdef _AIX
+TEST(DWARFDebigInfo, DISABLED_TestDWARF32Version5Addr8AllForms) {
+#else
 TEST(DWARFDebugInfo, TestDWARF32Version5Addr8AllForms) {
+#endif
   // Test that we can decode all forms for DWARF32, version 5, with 8 byte
   // addresses.
   typedef uint64_t AddrType;
@@ -1007,7 +1015,11 @@
   TestAddresses<4, AddrType>();
 }
 
+#ifdef _AIX
+TEST(DWARFDebugInfo, DISABLED_TestStringOffsets) {
+#else
 TEST(DWARFDebugInfo, TestStringOffsets) {
+#endif
   Triple Triple = getNormalizedDefaultTargetTriple();
   if (!isObjectEmissionSupported(Triple))
 return;
Index: llvm/test/DebugInfo/Generic/string-offsets-form.ll
===
--- llvm/test/DebugInfo/Generic/string-offsets-form.ll
+++ llvm/test/DebugInfo/Generic/string-offsets-form.ll
@@ -1,3 +1,4 @@
+; XFAIL: -aix
 ; RUN: %llc_dwarf -filetype=obj < %s | llvm-dwarfdump -all -show-form -v - \
 ; RUN:   | FileCheck %s
 ;
Index: llvm/test/DebugInfo/Generic/export-symbol-anonymous-class.ll
===
--- llvm/test/DebugInfo/Generic/export-symbol-anonymous-class.ll
+++ llvm/test/DebugInfo/Generic/export-symbol-anonymous-class.ll
@@ -1,3 +1,4 @@
+; XFAIL: -aix
 ; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump -debug-info - | FileCheck %s
 ;
 ; struct A {
Index: llvm/test/DebugInfo/Generic/debug-names-two-cu.ll
===
--- llvm/test/DebugInfo/Generic/debug-names-two-cu.ll
+++ llvm/test/DebugInfo/Generic/debug-names-two-cu.ll
@@ -1,3 +1,4 @@
+; XFAIL: -aix
 ; RUN: %llc_dwarf -accel-tables=Dwarf -filetype=obj -o %t < %s
 ; RUN: llvm-dwarfdump -debug-names %t | FileCheck %s
 ; RUN: llvm-dwarfdump -debug-names -verify %t | FileCheck --check-prefix=VERIFY %s
Index: llvm/test/DebugInfo/Generic/debug-names-one-cu.ll
===
--- llvm/test/DebugInfo/Generic/debug-names-one-cu.ll
+++ llvm/test/DebugInfo/Generic/debug-names-one-cu.ll
@@ -1,3 +1,4 @@
+; XFAIL: -aix
 ; RUN: %llc_dwarf -accel-tables=Dwarf -filetype=obj -o %t < %s
 ; RUN: llvm-dwarfdump -debug-names %t | FileCheck %s
 ; RUN: llvm-dwarfdump -debug-names -verify %t | FileCheck --check-prefix=VERIFY %s
Index: llvm/test/DebugInfo/Generic/debug-names-name-collisions.ll
===
--- llvm/test/DebugInfo/Generic/debug-names-name-collisions.ll
+++ llvm/test/DebugInfo/Generic/debug-names-name-collisions.ll
@@ -1,3 +1,4 @@
+; XFAIL: -aix
 ; RUN: %llc_dwarf -accel-tables=Dwarf -dwarf-linkage-names=All -filetype=obj -o %t < %s
 ; RUN: llvm-dwarfdump -debug-names %t | FileCheck %s
 ; RUN: llvm-dwarfdump -debug-names -verify %t | FileCheck --check-prefix=VERIFY %s
Index: llvm/test/DebugInfo/Generic/debug-names-many-cu.ll
===
--- llvm/test/DebugInfo/Generic/debug-names-many-cu.ll
+++ llvm/test/DebugInfo/Generic/debug-names-many-cu.ll
@@ -1,3 +1,4 @@
+; XFAIL: -aix
 ; RUN: %llc_dwarf -accel-tables=Dwarf -filetype=obj -o %t < %s
 ; RUN: llvm-dwarfdump -debug-na

[clang] 8037481 - [AIX] Disable tests failing due to missing DWARF sections

2021-10-08 Thread Jake Egan via cfe-commits

Author: Jake Egan
Date: 2021-10-08T12:06:38-04:00
New Revision: 8037481cb2d729ae3d782c3fed930f69d740fa23

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

LOG: [AIX] Disable tests failing due to missing DWARF sections

The following tests are failing due to missing DWARF sections. This patch sets 
these tests as XFAIL/DISABLED on AIX until a more permanent solution is 
implemented.

Reviewed By: shchenz

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

Added: 


Modified: 
clang/test/Modules/DebugInfoSubmoduleImport.c
llvm/test/DebugInfo/Generic/2010-04-19-FramePtr.ll
llvm/test/DebugInfo/Generic/accel-table-hash-collisions.ll
llvm/test/DebugInfo/Generic/address_space_rvalue.ll
llvm/test/DebugInfo/Generic/debug-names-empty-name.ll
llvm/test/DebugInfo/Generic/debug-names-hash-collisions.ll
llvm/test/DebugInfo/Generic/debug-names-index-type.ll
llvm/test/DebugInfo/Generic/debug-names-linkage-name.ll
llvm/test/DebugInfo/Generic/debug-names-many-cu.ll
llvm/test/DebugInfo/Generic/debug-names-name-collisions.ll
llvm/test/DebugInfo/Generic/debug-names-one-cu.ll
llvm/test/DebugInfo/Generic/debug-names-two-cu.ll
llvm/test/DebugInfo/Generic/export-symbol-anonymous-class.ll
llvm/test/DebugInfo/Generic/string-offsets-form.ll
llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp

Removed: 




diff  --git a/clang/test/Modules/DebugInfoSubmoduleImport.c 
b/clang/test/Modules/DebugInfoSubmoduleImport.c
index b608d300d5feb..d8fbd4eb0775c 100644
--- a/clang/test/Modules/DebugInfoSubmoduleImport.c
+++ b/clang/test/Modules/DebugInfoSubmoduleImport.c
@@ -1,3 +1,4 @@
+// XFAIL: -aix
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -fmodules -fmodule-format=obj -debug-info-kind=limited 
-dwarf-ext-refs \
 // RUN: -fimplicit-module-maps -x c -fmodules-cache-path=%t -I %S/Inputs \

diff  --git a/llvm/test/DebugInfo/Generic/2010-04-19-FramePtr.ll 
b/llvm/test/DebugInfo/Generic/2010-04-19-FramePtr.ll
index 77e4fa003865e..44fabb5e09509 100644
--- a/llvm/test/DebugInfo/Generic/2010-04-19-FramePtr.ll
+++ b/llvm/test/DebugInfo/Generic/2010-04-19-FramePtr.ll
@@ -1,3 +1,4 @@
+; XFAIL: -aix
 ; RUN: %llc_dwarf -debugger-tune=lldb -asm-verbose -O1 -o - < %s | FileCheck %s
 ; RUN: %llc_dwarf -debugger-tune=gdb -asm-verbose -O1 -o - < %s | FileCheck %s 
--check-prefix=DISABLE
 ; RUN: %llc_dwarf -frame-pointer=all -debugger-tune=lldb -asm-verbose -O1 -o - 
< %s | FileCheck %s --check-prefix=DISABLE

diff  --git a/llvm/test/DebugInfo/Generic/accel-table-hash-collisions.ll 
b/llvm/test/DebugInfo/Generic/accel-table-hash-collisions.ll
index 2e321c90b142b..f9c7da04c31e7 100644
--- a/llvm/test/DebugInfo/Generic/accel-table-hash-collisions.ll
+++ b/llvm/test/DebugInfo/Generic/accel-table-hash-collisions.ll
@@ -1,3 +1,4 @@
+; XFAIL: -aix
 ; RUN: %llc_dwarf -accel-tables=Apple -filetype=obj -o - < %s \
 ; RUN:   | llvm-dwarfdump -apple-names - | FileCheck %s
 

diff  --git a/llvm/test/DebugInfo/Generic/address_space_rvalue.ll 
b/llvm/test/DebugInfo/Generic/address_space_rvalue.ll
index 60e77a707b4eb..e9e91c267f733 100644
--- a/llvm/test/DebugInfo/Generic/address_space_rvalue.ll
+++ b/llvm/test/DebugInfo/Generic/address_space_rvalue.ll
@@ -1,3 +1,4 @@
+; XFAIL: -aix
 ; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump -debug-info - | 
FileCheck %s
 
 ; This nonsensical example tests that address spaces for rvalue

diff  --git a/llvm/test/DebugInfo/Generic/debug-names-empty-name.ll 
b/llvm/test/DebugInfo/Generic/debug-names-empty-name.ll
index 0a7b34c16281d..f578f91392174 100644
--- a/llvm/test/DebugInfo/Generic/debug-names-empty-name.ll
+++ b/llvm/test/DebugInfo/Generic/debug-names-empty-name.ll
@@ -1,3 +1,4 @@
+; XFAIL: -aix
 ; RUN: %llc_dwarf -debugger-tune=lldb -accel-tables=Dwarf -filetype=obj -o %t 
< %s
 ; RUN: llvm-dwarfdump -find=_GLOBAL__sub_I__ %t | FileCheck 
--check-prefix=INFO %s
 ; RUN: llvm-dwarfdump -debug-names %t | FileCheck --check-prefix=NAMES %s

diff  --git a/llvm/test/DebugInfo/Generic/debug-names-hash-collisions.ll 
b/llvm/test/DebugInfo/Generic/debug-names-hash-collisions.ll
index c105701d95bd1..42c361ab8f15c 100644
--- a/llvm/test/DebugInfo/Generic/debug-names-hash-collisions.ll
+++ b/llvm/test/DebugInfo/Generic/debug-names-hash-collisions.ll
@@ -1,3 +1,4 @@
+; XFAIL: -aix
 ; RUN: %llc_dwarf -accel-tables=Dwarf -filetype=obj -o %t < %s
 ; RUN: llvm-dwarfdump -debug-names %t | FileCheck %s
 ; RUN: llvm-dwarfdump -debug-names -verify %t | FileCheck 
--check-prefix=VERIFY %s

diff  --git a/llvm/test/DebugInfo/Generic/debug-names-index-type.ll 
b/llvm/test/DebugInfo/Generic/debug-names-index-type.ll
index c72b013f4d780..03af245c1d79e 100644
--- a/llvm/test/DebugInfo/Generic/debug-names-index-type.ll
+++ b/llvm/test/DebugInfo/Generic/debug-na

[PATCH] D110641: Implement P0857R0 -Part B: requires clause for template-template params

2021-10-08 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added inline comments.



Comment at: clang/test/CXX/temp/temp.arg/temp.arg.template/p3-2a.cpp:60-62
+  // A naive individual might expect the following to all fail concept 
checking,
+  // but there does not seem to be any requirement to check these in the
+  // standard, and none of the other implementations do so either.

cor3ntin wrote:
> erichkeane wrote:
> > aaron.ballman wrote:
> > > I agree that none of the other implementations seems to be checking 
> > > constraints here, but I would have guessed that 
> > > https://eel.is/c++draft/temp.arg.template#3 was what would trigger 
> > > checking the constraints here (the `and for template template-parameters, 
> > > each of their corresponding template-parameters matches, recursively.` 
> > > bit, specifically).
> > > 
> > > Usually the answer to "Am I misreading the standard or are these three 
> > > implementations all wrong in the same way?" is "I misread the standard.", 
> > > but I'd appreciate some confirmation here. :-)
> > >>Usually the answer to "Am I misreading the standard or are these three 
> > >>implementations all wrong in the same way?" is "I misread the standard."
> > 
> > This is typically _MY_ response to this as well, so I was hoping @rsmith or 
> > @hubert.reinterpretcast could tell me the answer here (and perhaps help 
> > write a Core issue if the implementations are all 'right').
> I've spent the last hour trying to come up with scenarios where GCC does 
> something interesting here, or where there would be a use for this here, but 
> I have nothing.
I am a bit confused by GCC https://godbolt.org/z/TTrP81jjx 


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

https://reviews.llvm.org/D110641

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


[PATCH] D110641: Implement P0857R0 -Part B: requires clause for template-template params

2021-10-08 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments.



Comment at: clang/test/CXX/temp/temp.arg/temp.arg.template/p3-2a.cpp:60-62
+  // A naive individual might expect the following to all fail concept 
checking,
+  // but there does not seem to be any requirement to check these in the
+  // standard, and none of the other implementations do so either.

cor3ntin wrote:
> cor3ntin wrote:
> > erichkeane wrote:
> > > aaron.ballman wrote:
> > > > I agree that none of the other implementations seems to be checking 
> > > > constraints here, but I would have guessed that 
> > > > https://eel.is/c++draft/temp.arg.template#3 was what would trigger 
> > > > checking the constraints here (the `and for template 
> > > > template-parameters, each of their corresponding template-parameters 
> > > > matches, recursively.` bit, specifically).
> > > > 
> > > > Usually the answer to "Am I misreading the standard or are these three 
> > > > implementations all wrong in the same way?" is "I misread the 
> > > > standard.", but I'd appreciate some confirmation here. :-)
> > > >>Usually the answer to "Am I misreading the standard or are these three 
> > > >>implementations all wrong in the same way?" is "I misread the standard."
> > > 
> > > This is typically _MY_ response to this as well, so I was hoping @rsmith 
> > > or @hubert.reinterpretcast could tell me the answer here (and perhaps 
> > > help write a Core issue if the implementations are all 'right').
> > I've spent the last hour trying to come up with scenarios where GCC does 
> > something interesting here, or where there would be a use for this here, 
> > but I have nothing.
> I am a bit confused by GCC https://godbolt.org/z/TTrP81jjx 
Huh is this some level of the subsumes check that needs to happen?  Though 
you show that the 'same constraint name + more info' thing doesn't work?  I'm 
very confused...


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

https://reviews.llvm.org/D110641

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


[PATCH] D110641: Implement P0857R0 -Part B: requires clause for template-template params

2021-10-08 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added inline comments.



Comment at: clang/test/CXX/temp/temp.arg/temp.arg.template/p3-2a.cpp:60-62
+  // A naive individual might expect the following to all fail concept 
checking,
+  // but there does not seem to be any requirement to check these in the
+  // standard, and none of the other implementations do so either.

erichkeane wrote:
> cor3ntin wrote:
> > cor3ntin wrote:
> > > erichkeane wrote:
> > > > aaron.ballman wrote:
> > > > > I agree that none of the other implementations seems to be checking 
> > > > > constraints here, but I would have guessed that 
> > > > > https://eel.is/c++draft/temp.arg.template#3 was what would trigger 
> > > > > checking the constraints here (the `and for template 
> > > > > template-parameters, each of their corresponding template-parameters 
> > > > > matches, recursively.` bit, specifically).
> > > > > 
> > > > > Usually the answer to "Am I misreading the standard or are these 
> > > > > three implementations all wrong in the same way?" is "I misread the 
> > > > > standard.", but I'd appreciate some confirmation here. :-)
> > > > >>Usually the answer to "Am I misreading the standard or are these 
> > > > >>three implementations all wrong in the same way?" is "I misread the 
> > > > >>standard."
> > > > 
> > > > This is typically _MY_ response to this as well, so I was hoping 
> > > > @rsmith or @hubert.reinterpretcast could tell me the answer here (and 
> > > > perhaps help write a Core issue if the implementations are all 'right').
> > > I've spent the last hour trying to come up with scenarios where GCC does 
> > > something interesting here, or where there would be a use for this here, 
> > > but I have nothing.
> > I am a bit confused by GCC https://godbolt.org/z/TTrP81jjx 
> Huh is this some level of the subsumes check that needs to happen?  
> Though you show that the 'same constraint name + more info' thing doesn't 
> work?  I'm very confused...
My current reading of the tea leaves (with no confidence whatsoever) is that 
the require clauses should match - aka be exactly the same.
And in the last case, maybe GCC has a bug where it fails to do the check if the 
template argument has no require clause whatsoever.
Maybe?


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

https://reviews.llvm.org/D110641

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


[PATCH] D111228: [clang-tidy] Add options to bugprone-unused-return-value.

2021-10-08 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment.

Probably it can work to only have a "add" or "remove" possibility in the config 
string, and not using an option name like in the provided example. Otherwise it 
can be possible to mix string lists from different checks, that seems to be a 
difficult problem. Other solution is to have a special list (or set) 
configuration format.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111228

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


[PATCH] D110641: Implement P0857R0 -Part B: requires clause for template-template params

2021-10-08 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments.



Comment at: clang/test/CXX/temp/temp.arg/temp.arg.template/p3-2a.cpp:60-62
+  // A naive individual might expect the following to all fail concept 
checking,
+  // but there does not seem to be any requirement to check these in the
+  // standard, and none of the other implementations do so either.

cor3ntin wrote:
> erichkeane wrote:
> > cor3ntin wrote:
> > > cor3ntin wrote:
> > > > erichkeane wrote:
> > > > > aaron.ballman wrote:
> > > > > > I agree that none of the other implementations seems to be checking 
> > > > > > constraints here, but I would have guessed that 
> > > > > > https://eel.is/c++draft/temp.arg.template#3 was what would trigger 
> > > > > > checking the constraints here (the `and for template 
> > > > > > template-parameters, each of their corresponding 
> > > > > > template-parameters matches, recursively.` bit, specifically).
> > > > > > 
> > > > > > Usually the answer to "Am I misreading the standard or are these 
> > > > > > three implementations all wrong in the same way?" is "I misread the 
> > > > > > standard.", but I'd appreciate some confirmation here. :-)
> > > > > >>Usually the answer to "Am I misreading the standard or are these 
> > > > > >>three implementations all wrong in the same way?" is "I misread the 
> > > > > >>standard."
> > > > > 
> > > > > This is typically _MY_ response to this as well, so I was hoping 
> > > > > @rsmith or @hubert.reinterpretcast could tell me the answer here (and 
> > > > > perhaps help write a Core issue if the implementations are all 
> > > > > 'right').
> > > > I've spent the last hour trying to come up with scenarios where GCC 
> > > > does something interesting here, or where there would be a use for this 
> > > > here, but I have nothing.
> > > I am a bit confused by GCC https://godbolt.org/z/TTrP81jjx 
> > Huh is this some level of the subsumes check that needs to happen?  
> > Though you show that the 'same constraint name + more info' thing doesn't 
> > work?  I'm very confused...
> My current reading of the tea leaves (with no confidence whatsoever) is that 
> the require clauses should match - aka be exactly the same.
> And in the last case, maybe GCC has a bug where it fails to do the check if 
> the template argument has no require clause whatsoever.
> Maybe?
Maybe?  But MSVC's implementation doesn't seem to be checking at all either: 
https://godbolt.org/z/nbY8EEG1M


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

https://reviews.llvm.org/D110641

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


[PATCH] D109707: [HIP] [AlwaysInliner] Disable AlwaysInliner to eliminate undefined symbols

2021-10-08 Thread Anshil Gandhi via Phabricator via cfe-commits
gandhi21299 updated this revision to Diff 377922.
gandhi21299 added a comment.

refreshing patch


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109707

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/CodeGenCUDA/amdgpu-alias-undef-symbols.cu
  llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp
  llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
  llvm/test/CodeGen/AMDGPU/inline-calls.ll


Index: llvm/test/CodeGen/AMDGPU/inline-calls.ll
===
--- llvm/test/CodeGen/AMDGPU/inline-calls.ll
+++ llvm/test/CodeGen/AMDGPU/inline-calls.ll
@@ -1,6 +1,5 @@
 ; RUN: llc -march=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck  
%s
 ; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck  %s
-; RUN: llc -march=r600 -mcpu=redwood -verify-machineinstrs < %s | FileCheck %s
 
 ; ALL-NOT: {{^}}func:
 define internal i32 @func(i32 %a) {
@@ -18,8 +17,8 @@
   ret void
 }
 
-; CHECK-NOT: func_alias
-; ALL-NOT: func_alias
+; CHECK: func_alias
+; ALL: func_alias
 @func_alias = alias i32 (i32), i32 (i32)* @func
 
 ; ALL: {{^}}kernel3:
Index: llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
===
--- llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
@@ -29,6 +29,8 @@
 #include "SIMachineFunctionInfo.h"
 #include "llvm/Analysis/CallGraph.h"
 #include "llvm/CodeGen/TargetPassConfig.h"
+#include "llvm/IR/GlobalAlias.h"
+#include "llvm/IR/GlobalValue.h"
 #include "llvm/Target/TargetMachine.h"
 
 using namespace llvm;
@@ -61,7 +63,8 @@
 assert(Op.getImm() == 0);
 return nullptr;
   }
-
+  if (auto *GA = dyn_cast(Op.getGlobal()))
+return cast(GA->getOperand(0));
   return cast(Op.getGlobal());
 }
 
Index: llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp
===
--- llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp
@@ -93,6 +93,8 @@
 
   for (GlobalAlias &A : M.aliases()) {
 if (Function* F = dyn_cast(A.getAliasee())) {
+  if (A.getLinkage() != GlobalValue::InternalLinkage)
+continue;
   A.replaceAllUsesWith(F);
   AliasesToRemove.push_back(&A);
 }
Index: clang/test/CodeGenCUDA/amdgpu-alias-undef-symbols.cu
===
--- /dev/null
+++ clang/test/CodeGenCUDA/amdgpu-alias-undef-symbols.cu
@@ -0,0 +1,17 @@
+// REQUIRES: amdgpu-registered-target, clang-driver
+
+// RUN: %clang --offload-arch=gfx906 --cuda-device-only -x hip -emit-llvm -S 
-o - %s \
+// RUN:   -fgpu-rdc -O3 -mllvm -amdgpu-early-inline-all=true -mllvm 
-amdgpu-function-calls=false | \
+// RUN:   FileCheck %s
+
+#include "Inputs/cuda.h"
+
+// CHECK: %struct.B = type { i8 }
+struct B {
+
+  // CHECK: @_ZN1BC1Ei = hidden unnamed_addr alias void (%struct.B*, i32), 
void (%struct.B*, i32)* @_ZN1BC2Ei
+  __device__ B(int x);
+};
+
+__device__ B::B(int x) {
+}
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -5102,9 +5102,9 @@
   }
 
   // Enable -mconstructor-aliases except on darwin, where we have to work 
around
-  // a linker bug (see ), and CUDA/AMDGPU device code,
-  // where aliases aren't supported.
-  if (!RawTriple.isOSDarwin() && !RawTriple.isNVPTX() && !RawTriple.isAMDGPU())
+  // a linker bug (see ), and CUDA device code, where
+  // aliases aren't supported.
+  if (!RawTriple.isOSDarwin() && !RawTriple.isNVPTX())
 CmdArgs.push_back("-mconstructor-aliases");
 
   // Darwin's kernel doesn't support guard variables; just die if we


Index: llvm/test/CodeGen/AMDGPU/inline-calls.ll
===
--- llvm/test/CodeGen/AMDGPU/inline-calls.ll
+++ llvm/test/CodeGen/AMDGPU/inline-calls.ll
@@ -1,6 +1,5 @@
 ; RUN: llc -march=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck  %s
 ; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck  %s
-; RUN: llc -march=r600 -mcpu=redwood -verify-machineinstrs < %s | FileCheck %s
 
 ; ALL-NOT: {{^}}func:
 define internal i32 @func(i32 %a) {
@@ -18,8 +17,8 @@
   ret void
 }
 
-; CHECK-NOT: func_alias
-; ALL-NOT: func_alias
+; CHECK: func_alias
+; ALL: func_alias
 @func_alias = alias i32 (i32), i32 (i32)* @func
 
 ; ALL: {{^}}kernel3:
Index: llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
===
--- llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
@@ -29,6 +29,8 @@
 #include "SIMachineFunctionInfo.h"
 #include "llvm/Analysis/CallGraph.h"
 #include "llvm/Cod

[PATCH] D109707: [HIP] [AlwaysInliner] Disable AlwaysInliner to eliminate undefined symbols

2021-10-08 Thread Anshil Gandhi via Phabricator via cfe-commits
gandhi21299 updated this revision to Diff 378218.
gandhi21299 added a comment.

added -nogpulib and -nogpuinc flags to amdgpu-alias-undef-symbols.cu


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109707

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/CodeGenCUDA/amdgpu-alias-undef-symbols.cu
  llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp
  llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
  llvm/test/CodeGen/AMDGPU/inline-calls.ll


Index: llvm/test/CodeGen/AMDGPU/inline-calls.ll
===
--- llvm/test/CodeGen/AMDGPU/inline-calls.ll
+++ llvm/test/CodeGen/AMDGPU/inline-calls.ll
@@ -1,6 +1,5 @@
 ; RUN: llc -march=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck  
%s
 ; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck  %s
-; RUN: llc -march=r600 -mcpu=redwood -verify-machineinstrs < %s | FileCheck %s
 
 ; ALL-NOT: {{^}}func:
 define internal i32 @func(i32 %a) {
@@ -18,8 +17,8 @@
   ret void
 }
 
-; CHECK-NOT: func_alias
-; ALL-NOT: func_alias
+; CHECK: func_alias
+; ALL: func_alias
 @func_alias = alias i32 (i32), i32 (i32)* @func
 
 ; ALL: {{^}}kernel3:
Index: llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
===
--- llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
@@ -29,6 +29,8 @@
 #include "SIMachineFunctionInfo.h"
 #include "llvm/Analysis/CallGraph.h"
 #include "llvm/CodeGen/TargetPassConfig.h"
+#include "llvm/IR/GlobalAlias.h"
+#include "llvm/IR/GlobalValue.h"
 #include "llvm/Target/TargetMachine.h"
 
 using namespace llvm;
@@ -61,7 +63,8 @@
 assert(Op.getImm() == 0);
 return nullptr;
   }
-
+  if (auto *GA = dyn_cast(Op.getGlobal()))
+return cast(GA->getOperand(0));
   return cast(Op.getGlobal());
 }
 
Index: llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp
===
--- llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp
@@ -93,6 +93,8 @@
 
   for (GlobalAlias &A : M.aliases()) {
 if (Function* F = dyn_cast(A.getAliasee())) {
+  if (A.getLinkage() != GlobalValue::InternalLinkage)
+continue;
   A.replaceAllUsesWith(F);
   AliasesToRemove.push_back(&A);
 }
Index: clang/test/CodeGenCUDA/amdgpu-alias-undef-symbols.cu
===
--- /dev/null
+++ clang/test/CodeGenCUDA/amdgpu-alias-undef-symbols.cu
@@ -0,0 +1,17 @@
+// REQUIRES: amdgpu-registered-target, clang-driver
+
+// RUN: %clang --offload-arch=gfx906 --cuda-device-only -nogpulib -nogpuinc -x 
hip -emit-llvm -S -o - %s \
+// RUN:   -fgpu-rdc -O3 -mllvm -amdgpu-early-inline-all=true -mllvm 
-amdgpu-function-calls=false | \
+// RUN:   FileCheck %s
+
+#include "Inputs/cuda.h"
+
+// CHECK: %struct.B = type { i8 }
+struct B {
+
+  // CHECK: @_ZN1BC1Ei = hidden unnamed_addr alias void (%struct.B*, i32), 
void (%struct.B*, i32)* @_ZN1BC2Ei
+  __device__ B(int x);
+};
+
+__device__ B::B(int x) {
+}
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -5103,9 +5103,9 @@
   }
 
   // Enable -mconstructor-aliases except on darwin, where we have to work 
around
-  // a linker bug (see ), and CUDA/AMDGPU device code,
-  // where aliases aren't supported.
-  if (!RawTriple.isOSDarwin() && !RawTriple.isNVPTX() && !RawTriple.isAMDGPU())
+  // a linker bug (see ), and CUDA device code, where
+  // aliases aren't supported.
+  if (!RawTriple.isOSDarwin() && !RawTriple.isNVPTX())
 CmdArgs.push_back("-mconstructor-aliases");
 
   // Darwin's kernel doesn't support guard variables; just die if we


Index: llvm/test/CodeGen/AMDGPU/inline-calls.ll
===
--- llvm/test/CodeGen/AMDGPU/inline-calls.ll
+++ llvm/test/CodeGen/AMDGPU/inline-calls.ll
@@ -1,6 +1,5 @@
 ; RUN: llc -march=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck  %s
 ; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck  %s
-; RUN: llc -march=r600 -mcpu=redwood -verify-machineinstrs < %s | FileCheck %s
 
 ; ALL-NOT: {{^}}func:
 define internal i32 @func(i32 %a) {
@@ -18,8 +17,8 @@
   ret void
 }
 
-; CHECK-NOT: func_alias
-; ALL-NOT: func_alias
+; CHECK: func_alias
+; ALL: func_alias
 @func_alias = alias i32 (i32), i32 (i32)* @func
 
 ; ALL: {{^}}kernel3:
Index: llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
===
--- llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
@@ -29,6 +29,8 @@
 #include "SIMachineF

[PATCH] D109707: [HIP] [AlwaysInliner] Disable AlwaysInliner to eliminate undefined symbols

2021-10-08 Thread Anshil Gandhi via Phabricator via cfe-commits
gandhi21299 added a comment.

ping


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109707

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


[PATCH] D106191: [clang] Option control afn flag

2021-10-08 Thread Masoud Ataei via Phabricator via cfe-commits
masoud.ataei updated this revision to Diff 378277.
masoud.ataei added a comment.

Update the documentation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106191

Files:
  clang/docs/UsersManual.rst
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/CodeGen/afn-flag-test.c
  clang/test/Driver/fast-math.c
  llvm/include/llvm/Target/TargetOptions.h

Index: llvm/include/llvm/Target/TargetOptions.h
===
--- llvm/include/llvm/Target/TargetOptions.h
+++ llvm/include/llvm/Target/TargetOptions.h
@@ -126,7 +126,7 @@
 TargetOptions()
 : UnsafeFPMath(false), NoInfsFPMath(false), NoNaNsFPMath(false),
   NoTrappingFPMath(true), NoSignedZerosFPMath(false),
-  EnableAIXExtendedAltivecABI(false),
+  ApproxFuncFPMath(false), EnableAIXExtendedAltivecABI(false),
   HonorSignDependentRoundingFPMathOption(false), NoZerosInBSS(false),
   GuaranteedTailCallOpt(false), StackSymbolOrdering(true),
   EnableFastISel(false), EnableGlobalISel(false), UseInitArray(false),
@@ -183,6 +183,12 @@
 /// argument or result as insignificant.
 unsigned NoSignedZerosFPMath : 1;
 
+/// ApproxFuncFPMath - This flag is enabled when the
+/// -enable-approx-func-fp-math is specified on the command line. This
+/// specifies that optimizations are allowed to substitute math functions
+/// with approximate calculations
+unsigned ApproxFuncFPMath : 1;
+
 /// EnableAIXExtendedAltivecABI - This flag returns true when -vec-extabi is
 /// specified. The code generator is then able to use both volatile and
 /// nonvolitle vector registers. When false, the code generator only uses
Index: clang/test/Driver/fast-math.c
===
--- clang/test/Driver/fast-math.c
+++ clang/test/Driver/fast-math.c
@@ -70,6 +70,11 @@
 // CHECK-NO-NANS-NO-FAST-MATH: "-cc1"
 // CHECK-NO-NANS-NO-FAST-MATH-NOT: "-menable-no-nans"
 //
+// RUN: %clang -### -fapprox-func -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-APPROX-FUNC %s
+// CHECK-APPROX-FUNC: "-cc1"
+// CHECK-APPROX-FUNC: "-fapprox-func"
+//
 // RUN: %clang -### -fmath-errno -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-MATH-ERRNO %s
 // CHECK-MATH-ERRNO: "-cc1"
Index: clang/test/CodeGen/afn-flag-test.c
===
--- /dev/null
+++ clang/test/CodeGen/afn-flag-test.c
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fapprox-func  %s -emit-llvm -o - | FileCheck --check-prefix=CHECK-AFN %s
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck --check-prefix=CHECK-NO-AFN %s
+
+extern double exp(double);
+double afn_option_test(double x) {
+  return exp(x);
+  // CHECK-LABEL:  define{{.*}} double @afn_option_test(double %x) #0 {
+
+  // CHECK-AFN:  %{{.*}} = call afn double @{{.*}}exp{{.*}}(double %{{.*}})
+  // CHECK-AFN:  attributes #0 ={{.*}} "approx-func-fp-math"="true" {{.*}}
+
+  // CHECK-NO-AFN:   %{{.*}} = call double @{{.*}}exp{{.*}}(double %{{.*}})
+  // CHECK-NO-AFN-NOT:  attributes #0 ={{.*}} "approx-func-fp-math"="true" {{.*}}
+}
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -2618,6 +2618,7 @@
   // LLVM flags based on the final state.
   bool HonorINFs = true;
   bool HonorNaNs = true;
+  bool ApproxFunc = false;
   // -fmath-errno is the default on some platforms, e.g. BSD-derived OSes.
   bool MathErrno = TC.IsMathErrnoDefault();
   bool AssociativeMath = false;
@@ -2722,6 +2723,8 @@
 case options::OPT_fno_honor_infinities: HonorINFs = false;break;
 case options::OPT_fhonor_nans:  HonorNaNs = true; break;
 case options::OPT_fno_honor_nans:   HonorNaNs = false;break;
+case options::OPT_fapprox_func: ApproxFunc = true;break;
+case options::OPT_fno_approx_func:  ApproxFunc = false;   break;
 case options::OPT_fmath_errno:  MathErrno = true; break;
 case options::OPT_fno_math_errno:   MathErrno = false;break;
 case options::OPT_fassociative_math:AssociativeMath = true;   break;
@@ -2917,6 +2920,9 @@
   if (!HonorNaNs)
 CmdArgs.push_back("-menable-no-nans");
 
+  if (ApproxFunc)
+CmdArgs.push_back("-fapprox-func");
+
   if (MathErrno)
 CmdArgs.push_back("-fmath-errno");
 
Index: clang/lib/CodeGen/CGCall.cpp
===
--- clang/lib/CodeGen/CGCall.cpp
+++ clang/lib/CodeGen/CGCall.cpp
@@ -1828,6 +1828,8 @@
   FuncAttrs.addAttribute("no-infs-fp-math", "true");
 if (LangOpts.NoHonorNaNs)
   Fun

[PATCH] D111332: [AST Matchers] Update dump_ast_matchers.py to query only class index page.

2021-10-08 Thread James King via Phabricator via cfe-commits
jcking1034 updated this revision to Diff 378279.
jcking1034 added a comment.

Rebase onto master


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111332

Files:
  clang/docs/LibASTMatchersReference.html
  clang/docs/tools/dump_ast_matchers.py

Index: clang/docs/tools/dump_ast_matchers.py
===
--- clang/docs/tools/dump_ast_matchers.py
+++ clang/docs/tools/dump_ast_matchers.py
@@ -10,6 +10,12 @@
 except ImportError:
 from urllib2 import urlopen
 
+CLASS_INDEX_PAGE_URL = 'https://clang.llvm.org/doxygen/classes.html'
+try:
+  CLASS_INDEX_PAGE = urlopen(CLASS_INDEX_PAGE_URL).read()
+except Exception as e:
+  raise Exception('Unable to get %s: %s' % (CLASS_INDEX_PAGE_URL, e))
+
 MATCHERS_FILE = '../../include/clang/ASTMatchers/ASTMatchers.h'
 
 # Each matcher is documented in one row of the form:
@@ -40,15 +46,18 @@
   text = re.sub(r'<', '<', text)
   text = re.sub(r'>', '>', text)
   def link_if_exists(m):
+"""Wrap a likely AST node name in a link to its clang docs.
+
+   We want to do this only if the page exists, in which case it will be
+   referenced from the class index page.
+"""
 name = m.group(1)
 url = 'https://clang.llvm.org/doxygen/classclang_1_1%s.html' % name
 if url not in doxygen_probes:
-  try:
-print('Probing %s...' % url)
-urlopen(url)
-doxygen_probes[url] = True
-  except:
-doxygen_probes[url] = False
+  search_str = 'href="classclang_1_1%s.html"' % name
+  doxygen_probes[url] = search_str in CLASS_INDEX_PAGE
+  if not doxygen_probes[url]:
+print('Did not find %s in class index page' % name)
 if doxygen_probes[url]:
   return r'Matcher<%s>' % (url, name)
 else:
Index: clang/docs/LibASTMatchersReference.html
===
--- clang/docs/LibASTMatchersReference.html
+++ clang/docs/LibASTMatchersReference.html
@@ -573,15 +573,6 @@
 Return typeNameParameters
 
 
-MatcherCXXBaseSpecifier>cxxBaseSpecifierMatcherCXXBaseSpecifier>...
-Matches class bases.
-
-Examples matches public virtual B.
-  class B {};
-  class C : public virtual B {};
-
-
-
 MatcherAttr>attrMatcherAttr>...
 Matches attributes.
 Attributes may be attached with a variety of different syntaxes (including
@@ -600,6 +591,15 @@
 
 
 
+MatcherCXXBaseSpecifier>cxxBaseSpecifierMatcherCXXBaseSpecifier>...
+Matches class bases.
+
+Examples matches public virtual B.
+  class B {};
+  class C : public virtual B {};
+
+
+
 MatcherCXXCtorInitializer>cxxCtorInitializerMatcherCXXCtorInitializer>...
 Matches constructor initializers.
 
@@ -1160,6 +1160,16 @@
   matches using namespace X 
 
 
+MatcherDecl>usingEnumDeclMatcherUsingEnumDecl>...
+Matches using-enum declarations.
+
+Given
+  namespace X { enum x {...}; }
+  using enum X::x;
+usingEnumDecl()
+  matches using enum X::x 
+
+
 MatcherDecl>valueDeclMatcherValueDecl>...
 Matches any value declaration.
 
@@ -3031,6 +3041,10 @@
 
 
 
+MatcherCXXConstructorDecl>isInheritingConstructor
+
+
+
 MatcherCXXConstructorDecl>isMoveConstructor
 Matches constructor declarations that are move constructors.
 
@@ -3779,7 +3793,7 @@
 MatcherDecl>isExpandedFromMacrostd::string MacroName
 Matches statements that are (transitively) expanded from the named macro.
 Does not match if only part of the statement is expanded from that macro or
-if different parts of the the statement are expanded from different
+if different parts of the statement are expanded from different
 appearances of the macro.
 
 
@@ -5232,7 +5246,7 @@
 MatcherTypeLoc>isExpandedFromMacrostd::string MacroName
 Matches statements that are (transitively) expanded from the named macro.
 Does not match if only part of the statement is expanded from that macro or
-if different parts of the the statement are expanded 

[PATCH] D110823: [clangd] Add code completion of param name on /* inside function calls.

2021-10-08 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added a comment.

thanks, mostly LG, a couple of nits :)




Comment at: clang-tools-extra/clangd/CodeComplete.cpp:1120
+  OverloadCandidate Candidate = Candidates[I];
+  if (auto *Func = Candidate.getFunction()) {
+if (Func->getNumParams() <= CurrentArg)

nit: early exit

```
auto *Func = ...;
if(!Func)
  continue;
...
```



Comment at: clang-tools-extra/clangd/CodeComplete.cpp:1124
+auto *PVD = Func->getParamDecl(CurrentArg);
+if (PVD == nullptr)
+  continue;

nit: `!PVD` same for `Ident`



Comment at: clang-tools-extra/clangd/CodeComplete.cpp:1145
+  CodeCompletionTUInfo CCTUInfo;
+  std::vector &ParamNames;
+  // For de-duplication only. StringRefs based on strings in ParamNames.

nit: Why not directly have an `llvm::DenseSet` here? I am not sure if the order 
we're preserving currently is a good one anyway (depends a lot on the order of 
includes, i think?). If we really want to preserve some ordering, it would 
probably make sense to have the lexicographical one instead.



Comment at: clang-tools-extra/clangd/CodeComplete.cpp:1965
+// run) and Prefix is the already existing prefix inside this comment.
+bool shouldCodeCompleteComment(llvm::StringRef Content, unsigned &Offset,
+   llvm::StringRef &Prefix) {

let's name it more explicitly that this only checks if user is likely to be 
completing for function argument comment.

`maybeFunctionArgumentComment` ?

documentation just needs to reflect that fact now rather than explaining the 
being only type of comment completion supported and such.



Comment at: clang-tools-extra/clangd/CodeComplete.cpp:1966
+bool shouldCodeCompleteComment(llvm::StringRef Content, unsigned &Offset,
+   llvm::StringRef &Prefix) {
+  if (Content.empty())

this might read easier as:

```
while (!Contents.empty() && isAciiIdentifierContinue(Contents.back())
  Contents = Contents.drop_back();
Contents.rtrim(); // by default this drops the chars you have in `Whitespace` 
already.
Offset = Contents.size();
return Contents.endswith("/*");
```

this has the different behaviour for `/* qwer ^` but I don't think we want to 
complete after a word anyway (that's not what we do in the rest of the 
completion, space terminates the previous identifier).

As for propagating prefix, I think it's enough to check that the file content 
endswith whatever name we're going to suggest in the signature help collector.

nit: As for `Offset`, I might actually prefer returning an `Optional` 
while renaming the function to `getFunctionArgumentCommentStart`, but i am fine 
with this too, up to you.



Comment at: clang-tools-extra/clangd/CodeComplete.cpp:1956
+  auto Content = llvm::StringRef(ParseInput.Contents).take_front(*Offset);
+  if (Content.endswith("/*")) {
+// We are doing code completion of a comment, where we currently only

adamcz wrote:
> kadircet wrote:
> > what if the user triggers at `foo(/*  b^`? I think we'd still want to 
> > provide `bar`.
> > 
> > I think we should detect whether we're in a comment first, we can run the 
> > Lexer for that but it'd probably be an overkill. For now I think we can 
> > just check for the string after last `*/`, if it has a `/*` we're in a 
> > comment, otherwise we check for the current line only. if it has a `//` 
> > we're again in a comment.
> > 
> > Then we can switch to the `codeCompleteComment` mode, inside there one 
> > branch can collect completion results for possible parameter names (while 
> > filtering using the currently typed text) and we can expand with more logic 
> > later on (e.g. suggest identifiers from index?).
> > 
> > WDYT?
> Good point about /* b^, thanks! I did not consider manually triggered code 
> completion at all.
> 
> Detecting last */ the way you suggest seems fragile. There's macros that can 
> expand to /* or */, there's strings, lines that are already comments (i.e. 
> "// blah /* blah), "#if 0" sections, etc.
> Running Lexer is an option, but I don't think it's necessary. Currently 
> there's very few options when we can offer code completion:
> /*^
> /*   ^
> /*foo^
> /*   foo^
> This can be quickly detected by scanning back through whitespace, then valid 
> identifier characters, then whitespace again.
> 
> Since it's unclear if and when we'll be adding more code completion in 
> comments I want to keep this simple rather than build for the future when we 
> may indeed need a lexer.
> 
> WDYT?
> 
> (also added some tests to cover this).
As discussed offline, I was mostly worried about extending this in the future, 
but we can think about that later. So this is good as-is.



Comment at: clang-tools-extra/clangd/CodeComplete.cpp:1963
+auto OffsetBeforeComment = *Offset - 2;
+return codeCompl

[PATCH] D111228: [clang-tidy] Add options to bugprone-unused-return-value.

2021-10-08 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D111228#3051686 , @balazske wrote:

> Probably it can work to only have a "add" or "remove" possibility in the 
> config string, and not using an option name like in the provided example. 
> Otherwise it can be possible to mix string lists from different checks, that 
> seems to be a difficult problem. Other solution is to have a special list (or 
> set) configuration format.

Hmm, I was thinking that was more of a feature than a problem. We have some 
checks that already have parallel lists of somewhat related strings, so being 
able to say "define this list in terms of that list plus/minus these elements" 
seems useful. Or are you saying there's an implementation difficulty with 
supporting that which might make it less of a good approach?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111228

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


[PATCH] D111440: [MS compat] Handle #pragma fenv_access like #pragma STDC FENV_ACCESS (PR50694)

2021-10-08 Thread Hans Wennborg via Phabricator via cfe-commits
hans created this revision.
hans added reviewers: thakis, rsmith.
Herald added a subscriber: dexonsmith.
hans requested review of this revision.
Herald added a project: clang.

This adds support for the MSVC spelling of the pragma in -fms-extensions mode.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111440

Files:
  clang/include/clang/Basic/DiagnosticParseKinds.td
  clang/include/clang/Basic/TokenKinds.def
  clang/include/clang/Parse/Parser.h
  clang/lib/Parse/ParsePragma.cpp
  clang/lib/Parse/ParseStmt.cpp
  clang/lib/Parse/Parser.cpp
  clang/test/CodeGen/pragma-fenv_access.c
  clang/test/Parser/pragma-fenv_access-ms.c

Index: clang/test/Parser/pragma-fenv_access-ms.c
===
--- /dev/null
+++ clang/test/Parser/pragma-fenv_access-ms.c
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -triple i686-pc-win32 -fms-extensions -fsyntax-only -verify %s
+
+#pragma fenv_access (on)
+#pragma fenv_access (off)
+
+#pragma fenv_access // expected-warning{{incorrect use of '#pragma fenv_access}}
+#pragma fenv_access foo // expected-warning{{incorrect use of '#pragma fenv_access}}
+#pragma fenv_access on // expected-warning{{incorrect use of '#pragma fenv_access}}
+#pragma fenv_access ( // expected-warning{{incorrect use of '#pragma fenv_access}}
+#pragma fenv_access (on // expected-warning{{incorrect use of '#pragma fenv_access}}
+#pragma fenv_access (on) foo // expected-warning{{extra tokens at end of '#pragma fenv_access'}}
+
+void f() {
+  (void)0;
+  #pragma fenv_access (on) // expected-error{{'#pragma fenv_access' can only appear at file scope or at the start of a compound statement}}
+}
Index: clang/test/CodeGen/pragma-fenv_access.c
===
--- clang/test/CodeGen/pragma-fenv_access.c
+++ clang/test/CodeGen/pragma-fenv_access.c
@@ -1,6 +1,11 @@
 // RUN: %clang_cc1 -fexperimental-strict-floating-point -ffp-exception-behavior=strict -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -fexperimental-strict-floating-point -ffp-exception-behavior=strict -triple %itanium_abi_triple -emit-llvm %s -o - -fms-extensions -DMS | FileCheck %s
 
+#ifdef MS
+#pragma fenv_access (on)
+#else
 #pragma STDC FENV_ACCESS ON
+#endif
 
 float func_01(float x, float y) {
   return x + y;
@@ -25,7 +30,11 @@
 // CHECK: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
 
 
+#ifdef MS
+#pragma fenv_access (off)
+#else
 #pragma STDC FENV_ACCESS OFF
+#endif
 
 float func_04(float x, float y) {
   #pragma float_control(except, off)
Index: clang/lib/Parse/Parser.cpp
===
--- clang/lib/Parse/Parser.cpp
+++ clang/lib/Parse/Parser.cpp
@@ -785,6 +785,7 @@
 HandlePragmaFPContract();
 return nullptr;
   case tok::annot_pragma_fenv_access:
+  case tok::annot_pragma_fenv_access_ms:
 HandlePragmaFEnvAccess();
 return nullptr;
   case tok::annot_pragma_fenv_round:
Index: clang/lib/Parse/ParseStmt.cpp
===
--- clang/lib/Parse/ParseStmt.cpp
+++ clang/lib/Parse/ParseStmt.cpp
@@ -374,8 +374,11 @@
 return StmtError();
 
   case tok::annot_pragma_fenv_access:
+  case tok::annot_pragma_fenv_access_ms:
 ProhibitAttributes(Attrs);
-Diag(Tok, diag::err_pragma_stdc_fenv_access_scope);
+Diag(Tok, diag::err_pragma_file_or_compound_scope) <<
+(Kind == tok::annot_pragma_fenv_access ? "STDC FENV_ACCESS"
+   : "fenv_access");
 ConsumeAnnotationToken();
 return StmtEmpty();
 
@@ -955,6 +958,7 @@
   HandlePragmaFP();
   break;
 case tok::annot_pragma_fenv_access:
+case tok::annot_pragma_fenv_access_ms:
   HandlePragmaFEnvAccess();
   break;
 case tok::annot_pragma_fenv_round:
Index: clang/lib/Parse/ParsePragma.cpp
===
--- clang/lib/Parse/ParsePragma.cpp
+++ clang/lib/Parse/ParsePragma.cpp
@@ -261,6 +261,66 @@
 Token &FirstToken) override;
 };
 
+// "\#pragma fenv_access (on)".
+struct PragmaMSFenvAccessHandler : public PragmaHandler {
+  PragmaMSFenvAccessHandler() : PragmaHandler("fenv_access") {}
+  void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
+Token &FirstToken) override {
+Token PragmaName = FirstToken;
+if (!PP.getTargetInfo().hasStrictFP() && !PP.getLangOpts().ExpStrictFP) {
+  PP.Diag(FirstToken.getLocation(), diag::warn_pragma_fp_ignored)
+  << PragmaName.getIdentifierInfo()->getName();
+  return;
+}
+
+tok::OnOffSwitch OOS;
+Token Tok;
+PP.Lex(Tok);
+if (Tok.isNot(tok::l_paren)) {
+  PP.Diag(Tok.getLocation(), diag::warn_pragma_ms_fenv_access);
+  return;
+}
+PP.Lex(Tok); // Eat the l_paren
+if (Tok

[PATCH] D106191: [clang] Option control afn flag

2021-10-08 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

1 small 'english' question, hopefully Aaron can answer, otherwise LGTM.




Comment at: clang/docs/UsersManual.rst:1395
+   to be replaced with an approximately equivalent set of instructions
+   or alternative math function calls. For example, a ``pow(x, 0.25)``
+   may be replaced with ``sqrt(sqrt(x))``, despite being an inexact result

Should this be 'alternate math function calls'?  I'm second guessing myself now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106191

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


[PATCH] D111434: [PowerPC] PPC backend optimization on conditional trap intrustions

2021-10-08 Thread Victor Huang via Phabricator via cfe-commits
NeHuang updated this revision to Diff 378284.
NeHuang added a comment.

clang-format


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111434

Files:
  llvm/lib/Target/PowerPC/PPCMIPeephole.cpp
  llvm/test/CodeGen/PowerPC/mi-peepholes-trap-opt.mir

Index: llvm/test/CodeGen/PowerPC/mi-peepholes-trap-opt.mir
===
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/mi-peepholes-trap-opt.mir
@@ -0,0 +1,448 @@
+# RUN: llc -mtriple powerpc64le-unknown-linux-gnu -mcpu=pwr8 -x mir < %s \
+# RUN:   -verify-machineinstrs -start-before=ppc-mi-peepholes | FileCheck %s
+
+---
+name:conditional_trap_opt_reg_implicit_def
+alignment:   16
+tracksRegLiveness: true
+body: |
+  bb.0.entry:
+%0:gprc = IMPLICIT_DEF
+%1:gprc = IMPLICIT_DEF
+%2:g8rc = IMPLICIT_DEF
+%3:g8rc = IMPLICIT_DEF
+TW 8, %0, %1
+TD 8, %2, %3
+TWI 24, %0, 0
+TDI 24, %2, 0
+BLR8 implicit $lr8, implicit $rm
+...
+  # CHECK-LABEL: conditional_trap_opt_reg_implicit_def
+  # CHECK: # %bb.0: # %entry
+  # CHECK-NEXT:  twgt3, 3
+  # CHECK-NEXT:  tdgt3, 3
+  # CHECK-NEXT:  twnei   3, 0
+  # CHECK-NEXT:  tdnei   3, 0
+  # CHECK-NEXT:  blr
+---
+name:conditional_trap_opt_TW_31
+alignment:   16
+tracksRegLiveness: true
+body: |
+  bb.0.entry:
+%0:gprc = LI 3
+%1:gprc = LI 0
+TW 31, %1, %0
+BLR8 implicit $lr8, implicit $rm
+...
+  # CHECK-LABEL: conditional_trap_opt_TW_31
+  # CHECK: # %bb.0: # %entry
+  # CHECK-NEXT:  trap
+  # CHECK-NEXT:  blr
+
+---
+name:conditional_trap_opt_TW_16
+alignment:   16
+tracksRegLiveness: true
+body: |
+  bb.0.entry:
+%0:gprc = LI 5
+%1:gprc = LI 1
+TW 16, %1, %0
+TW 16, %0, %1
+BLR8 implicit $lr8, implicit $rm
+...
+  # CHECK-LABEL: conditional_trap_opt_TW_16
+  # CHECK: # %bb.0: # %entry
+  # CHECK-NEXT:  trap
+  # CHECK-NEXT:  blr
+
+---
+name:conditional_trap_opt_TW_8
+alignment:   16
+tracksRegLiveness: true
+body: |
+  bb.0.entry:
+%0:gprc = LI -1
+%1:gprc = LI 10
+TW 8, %1, %0
+TW 8, %0, %1
+BLR8 implicit $lr8, implicit $rm
+...
+  # CHECK-LABEL: conditional_trap_opt_TW_8
+  # CHECK: # %bb.0: # %entry
+  # CHECK-NEXT:  trap
+  # CHECK-NEXT:  blr
+
+---
+name:conditional_trap_opt_TW_2
+alignment:   16
+tracksRegLiveness: true
+body: |
+  bb.0.entry:
+%0:gprc = LI -1
+%1:gprc = LI 2
+TW 2, %1, %0
+TW 2, %0, %1
+BLR8 implicit $lr8, implicit $rm
+...
+  # CHECK-LABEL: conditional_trap_opt_TW_2
+  # CHECK: # %bb.0: # %entry
+  # CHECK-NEXT:  trap
+  # CHECK-NEXT:  blr
+
+---
+name:conditional_trap_opt_TW_1
+alignment:   16
+tracksRegLiveness: true
+body: |
+  bb.0.entry:
+%0:gprc = LI -3
+%1:gprc = LI 4
+TW 1, %1, %0
+TW 1, %0, %1
+BLR8 implicit $lr8, implicit $rm
+...
+  # CHECK-LABEL: conditional_trap_opt_TW_1
+  # CHECK: # %bb.0: # %entry
+  # CHECK-NEXT:  trap
+  # CHECK-NEXT:  blr
+
+---
+name:conditional_trap_opt_TW_4
+alignment:   16
+tracksRegLiveness: true
+body: |
+  bb.0.entry:
+%0:gprc = LI 5
+%1:gprc = LI 1
+TW 4, %1, %0
+TW 4, %1, %1
+BLR8 implicit $lr8, implicit $rm
+...
+  # CHECK-LABEL: conditional_trap_opt_TW_4
+  # CHECK: # %bb.0: # %entry
+  # CHECK-NEXT:  trap
+  # CHECK-NEXT:  blr
+
+---
+name:conditional_trap_opt_TWI_31
+alignment:   16
+tracksRegLiveness: true
+body: |
+  bb.0.entry:
+%0:gprc = LI 3
+TWI 31, %0, 0
+BLR8 implicit $lr8, implicit $rm
+...
+  # CHECK-LABEL: conditional_trap_opt_TWI_31
+  # CHECK: # %bb.0: # %entry
+  # CHECK-NEXT:  trap
+  # CHECK-NEXT:  blr
+
+---
+name:conditional_trap_opt_TWI_16
+alignment:   16
+tracksRegLiveness: true
+body: |
+  bb.0.entry:
+%0:gprc = LI 5
+%1:gprc = LI 1
+TWI 16, %1, 5
+TWI 16, %0, 1
+BLR8 implicit $lr8, implicit $rm
+...
+  # CHECK-LABEL: conditional_trap_opt_TWI_16
+  # CHECK: # %bb.0: # %entry
+  # CHECK-NEXT:  trap
+  # CHECK-NEXT:  blr
+
+---
+name:conditional_trap_opt_TWI_8
+alignment:   16
+tracksRegLiveness: true
+body: |
+  bb.0.entry:
+%0:gprc = LI -1
+%1:gprc = LI 10
+TWI 8, %1, -1
+TWI 8, %0, 10
+BLR8 implicit $lr8, implicit $rm
+...
+  # CHECK-LABEL: conditional_trap_opt_TWI_8
+  # CHECK: # %bb.0: # %entry
+  # CHECK-NEXT:  trap
+  # CHECK-NEXT:  blr
+
+---
+name:conditional_trap_opt_TWI_2
+alignment:   16
+tracksRegLiveness: true
+body: |
+  bb.0.entry:
+%0:gprc = LI -1
+%1:gprc = LI 2
+TWI 2, %1, -1
+TWI 2, %0, 2
+BLR8 implicit $lr8, implicit $rm
+...
+  # CHECK-LABEL: conditional_trap_opt_TWI_2
+  # CHECK: # %bb.0: # %entry
+  # CHECK-NEXT:  trap
+  # CHECK-NEXT:  blr
+
+---

[PATCH] D106191: [clang] Option control afn flag

2021-10-08 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




Comment at: clang/docs/UsersManual.rst:1395
+   to be replaced with an approximately equivalent set of instructions
+   or alternative math function calls. For example, a ``pow(x, 0.25)``
+   may be replaced with ``sqrt(sqrt(x))``, despite being an inexact result

erichkeane wrote:
> Should this be 'alternate math function calls'?  I'm second guessing myself 
> now.
`alternative` is correct. `alternate` as an adjective means "every other, every 
second".


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106191

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


[PATCH] D102488: [clang][deps] Prune unused header search paths

2021-10-08 Thread Jan Svoboda via Phabricator via cfe-commits
jansvoboda11 updated this revision to Diff 378285.
jansvoboda11 added a comment.

Rebase, switch from `std::vector` to `llvm::BitVector`, load the bit 
vector eagerly.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102488

Files:
  clang/include/clang/Serialization/ASTBitCodes.h
  clang/include/clang/Serialization/ModuleFile.h
  clang/include/clang/Tooling/DependencyScanning/DependencyScanningService.h
  clang/include/clang/Tooling/DependencyScanning/DependencyScanningWorker.h
  clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/lib/Tooling/DependencyScanning/DependencyScanningService.cpp
  clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
  clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
  clang/test/ClangScanDeps/Inputs/header-search-pruning/a/a.h
  clang/test/ClangScanDeps/Inputs/header-search-pruning/b/b.h
  clang/test/ClangScanDeps/Inputs/header-search-pruning/begin/begin.h
  clang/test/ClangScanDeps/Inputs/header-search-pruning/cdb.json
  clang/test/ClangScanDeps/Inputs/header-search-pruning/end/end.h
  clang/test/ClangScanDeps/Inputs/header-search-pruning/mod.h
  clang/test/ClangScanDeps/Inputs/header-search-pruning/module.modulemap
  clang/test/ClangScanDeps/header-search-pruning.cpp
  clang/tools/clang-scan-deps/ClangScanDeps.cpp

Index: clang/tools/clang-scan-deps/ClangScanDeps.cpp
===
--- clang/tools/clang-scan-deps/ClangScanDeps.cpp
+++ clang/tools/clang-scan-deps/ClangScanDeps.cpp
@@ -170,6 +170,11 @@
"specified directory instead the module cache directory."),
 llvm::cl::cat(DependencyScannerCategory));
 
+static llvm::cl::opt OptimizeArgs(
+"optimize-args",
+llvm::cl::desc("Whether to optimize command-line arguments of modules."),
+llvm::cl::init(false), llvm::cl::cat(DependencyScannerCategory));
+
 llvm::cl::opt
 NumThreads("j", llvm::cl::Optional,
llvm::cl::desc("Number of worker threads to use (default: use "
@@ -507,7 +512,7 @@
   SharedStream DependencyOS(llvm::outs());
 
   DependencyScanningService Service(ScanMode, Format, ReuseFileManager,
-SkipExcludedPPRanges);
+SkipExcludedPPRanges, OptimizeArgs);
   llvm::ThreadPool Pool(llvm::hardware_concurrency(NumThreads));
   std::vector> WorkerTools;
   for (unsigned I = 0; I < Pool.getThreadCount(); ++I)
Index: clang/test/ClangScanDeps/header-search-pruning.cpp
===
--- /dev/null
+++ clang/test/ClangScanDeps/header-search-pruning.cpp
@@ -0,0 +1,85 @@
+// RUN: rm -rf %t && mkdir -p %t
+// RUN: cp -r %S/Inputs/header-search-pruning/* %t
+// RUN: cp %S/header-search-pruning.cpp %t/header-search-pruning.cpp
+// RUN: sed -e "s|DIR|%/t|g" -e "s|DEFINES|-DINCLUDE_A|g" %S/Inputs/header-search-pruning/cdb.json > %t/cdb_a.json
+// RUN: sed -e "s|DIR|%/t|g" -e "s|DEFINES|-DINCLUDE_B|g" %S/Inputs/header-search-pruning/cdb.json > %t/cdb_b.json
+// RUN: sed -e "s|DIR|%/t|g" -e "s|DEFINES|-DINCLUDE_A -DINCLUDE_B|g" %S/Inputs/header-search-pruning/cdb.json > %t/cdb_ab.json
+//
+// RUN: clang-scan-deps -compilation-database %t/cdb_a.json -format experimental-full -optimize-args >> %t/result_a.json
+// RUN: cat %t/result_a.json | sed 's/\\/\//g' | FileCheck --check-prefixes=CHECK_A %s
+//
+// RUN: clang-scan-deps -compilation-database %t/cdb_b.json -format experimental-full -optimize-args >> %t/result_b.json
+// RUN: cat %t/result_b.json | sed 's/\\/\//g' | FileCheck --check-prefixes=CHECK_B %s
+//
+// RUN: clang-scan-deps -compilation-database %t/cdb_ab.json -format experimental-full -optimize-args >> %t/result_ab.json
+// RUN: cat %t/result_ab.json | sed 's/\\/\//g' | FileCheck --check-prefixes=CHECK_AB %s
+
+#include "mod.h"
+
+// CHECK_A:{
+// CHECK_A-NEXT: "modules": [
+// CHECK_A-NEXT:   {
+// CHECK_A-NEXT: "clang-module-deps": [],
+// CHECK_A-NEXT: "clang-modulemap-file": "{{.*}}",
+// CHECK_A-NEXT: "command-line": [
+// CHECK_A-NEXT:   "-cc1"
+// CHECK_A:"-I",
+// CHECK_A-NEXT:   "begin",
+// CHECK_A-NEXT:   "-I",
+// CHECK_A-NEXT:   "a",
+// CHECK_A-NEXT:   "-I",
+// CHECK_A-NEXT:   "end"
+// CHECK_A:  ],
+// CHECK_A-NEXT: "context-hash": "{{.*}}",
+// CHECK_A-NEXT: "file-deps": [
+// CHECK_A:  ],
+// CHECK_A-NEXT: "name": "mod"
+// CHECK_A-NEXT:   }
+// CHECK_A-NEXT: ]
+// CHECK_A:}
+
+// CHECK_B:{
+// CHECK_B-NEXT: "modules": [
+// CHECK_B-NEXT:   {
+// CHECK_B-NEXT: "clang-module-deps": [],
+// CHECK_B-NEXT: "clang-modulemap-file": "{{.*}}",
+// CHECK_B-NEXT: 

  1   2   3   >