[PATCH] D140270: MIPS: fix build from IR files, nan2008 and FpAbi

2023-01-30 Thread YunQiang Su via Phabricator via cfe-commits
wzssyqa added a comment.

ping


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140270

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


[PATCH] D142862: [Support] change StringMap hash function from djbHash to xxHash

2023-01-30 Thread serge via Phabricator via cfe-commits
serge-sans-paille added a comment.

Can  you take a shot against https://llvm-compile-time-tracker.com/ so that we 
get an hint of the practical speedup?

Looks like xxhash.h is missing from the patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142862

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


[PATCH] D142862: [Support] change StringMap hash function from djbHash to xxHash

2023-01-30 Thread serge via Phabricator via cfe-commits
serge-sans-paille added a comment.

Do you intend to (optionnaly) provide XXH3 as described in 
https://github.com/Cyan4973/xxHash ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142862

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


[PATCH] D142871: [clangd] Semantic highlighting for constrained-parameter

2023-01-30 Thread Nathan Ridge via Phabricator via cfe-commits
nridge created this revision.
nridge added a reviewer: kadircet.
Herald added a subscriber: arphaman.
Herald added a project: All.
nridge requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142871

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


Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
===
--- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
+++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
@@ -1023,7 +1023,7 @@
 class $Class_def[[Z]] {};
 template $Bracket[[<]]typename, typename$Bracket[[>]]
 concept $Concept_decl[[C2]] = true;
-template $Bracket[[<]]C2$Bracket[[<]]int$Bracket[[>]] 
$TemplateParameter_def[[A]]$Bracket[[>]]
+template $Bracket[[<]]$Concept[[C2]]$Bracket[[<]]int$Bracket[[>]] 
$TemplateParameter_def[[A]]$Bracket[[>]]
 class $Class_def[[B]] {};
   )cpp",
   // no crash
Index: clang-tools-extra/clangd/FindTarget.cpp
===
--- clang-tools-extra/clangd/FindTarget.cpp
+++ clang-tools-extra/clangd/FindTarget.cpp
@@ -607,6 +607,7 @@
 llvm::SmallVector refInDecl(const Decl *D,
   const HeuristicResolver *Resolver) {
   struct Visitor : ConstDeclVisitor {
+using Base = ConstDeclVisitor;
 Visitor(const HeuristicResolver *Resolver) : Resolver(Resolver) {}
 
 const HeuristicResolver *Resolver;
@@ -707,6 +708,17 @@
   /*IsDecl=*/true,
   {OCID->getCategoryDecl()}});
 }
+
+void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D) {
+  if (auto *TC = D->getTypeConstraint()) {
+Refs.push_back(ReferenceLoc{TC->getNestedNameSpecifierLoc(),
+TC->getConceptNameLoc(),
+/*IsDecl=*/false,
+{TC->getNamedConcept()}});
+  }
+  // Pick up the name via VisitNamedDecl
+  Base::VisitTemplateTypeParmDecl(D);
+}
   };
 
   Visitor V{Resolver};


Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
===
--- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
+++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
@@ -1023,7 +1023,7 @@
 class $Class_def[[Z]] {};
 template $Bracket[[<]]typename, typename$Bracket[[>]]
 concept $Concept_decl[[C2]] = true;
-template $Bracket[[<]]C2$Bracket[[<]]int$Bracket[[>]] $TemplateParameter_def[[A]]$Bracket[[>]]
+template $Bracket[[<]]$Concept[[C2]]$Bracket[[<]]int$Bracket[[>]] $TemplateParameter_def[[A]]$Bracket[[>]]
 class $Class_def[[B]] {};
   )cpp",
   // no crash
Index: clang-tools-extra/clangd/FindTarget.cpp
===
--- clang-tools-extra/clangd/FindTarget.cpp
+++ clang-tools-extra/clangd/FindTarget.cpp
@@ -607,6 +607,7 @@
 llvm::SmallVector refInDecl(const Decl *D,
   const HeuristicResolver *Resolver) {
   struct Visitor : ConstDeclVisitor {
+using Base = ConstDeclVisitor;
 Visitor(const HeuristicResolver *Resolver) : Resolver(Resolver) {}
 
 const HeuristicResolver *Resolver;
@@ -707,6 +708,17 @@
   /*IsDecl=*/true,
   {OCID->getCategoryDecl()}});
 }
+
+void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D) {
+  if (auto *TC = D->getTypeConstraint()) {
+Refs.push_back(ReferenceLoc{TC->getNestedNameSpecifierLoc(),
+TC->getConceptNameLoc(),
+/*IsDecl=*/false,
+{TC->getNamedConcept()}});
+  }
+  // Pick up the name via VisitNamedDecl
+  Base::VisitTemplateTypeParmDecl(D);
+}
   };
 
   Visitor V{Resolver};
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D142871: [clangd] Semantic highlighting for constrained-parameter

2023-01-30 Thread Nathan Ridge via Phabricator via cfe-commits
nridge added inline comments.



Comment at: clang-tools-extra/clangd/FindTarget.cpp:720
+  // Pick up the name via VisitNamedDecl
+  Base::VisitTemplateTypeParmDecl(D);
+}

Am I using the API correctly here? It's a bit weird that `ConstDeclVisitor` 
would work differently from `RecursiveASTVisitor` in that VisitXXX methods for 
super-classes are not automatically called


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142871

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


[PATCH] D139926: [clangd] Add semantic token for angle brackets

2023-01-30 Thread Nathan Ridge via Phabricator via cfe-commits
nridge added inline comments.



Comment at: 
clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp:1026
+concept $Concept_decl[[C2]] = true;
+template $Bracket[[<]]C2$Bracket[[<]]int$Bracket[[>]] 
$TemplateParameter_def[[A]]$Bracket[[>]]
+class $Class_def[[B]] {};

ckandeler wrote:
> Note that C2 does not get a token here. Maybe we can fix that along the way?
That token should come via `findExplicitReferences` rather than 
`CollectExtraHighlightings`, so I put the fix in a separate patch: D142871


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139926

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


[PATCH] D142872: Honor the fwrapv option when generating the inbounds GEP .

2023-01-30 Thread Umesh Kalappa via Phabricator via cfe-commits
umesh.kalappa0 created this revision.
umesh.kalappa0 added a reviewer: nikic.
umesh.kalappa0 added a project: LLVM.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
umesh.kalappa0 requested review of this revision.
Herald added a project: clang.
Herald added subscribers: llvm-commits, cfe-commits.

Fix for the issue :https://github.com/llvm/llvm-project/issues/59580

Where we don't emit the inbounds flag for the GEP when wrapv is enbled .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142872

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/inbounds.c
  llvm/include/llvm/IR/ConstantFold.h
  llvm/lib/IR/ConstantFold.cpp
  llvm/lib/IR/Constants.cpp

Index: llvm/lib/IR/Constants.cpp
===
--- llvm/lib/IR/Constants.cpp
+++ llvm/lib/IR/Constants.cpp
@@ -2510,7 +2510,9 @@
 ArgVec.push_back(Idx);
   }
 
-  unsigned SubClassOptionalData = InBounds ? GEPOperator::IsInBounds : 0;
+  unsigned SubClassOptionalData = ( InBounds && !llvm::getSignedWrap() ) ?
+	   GEPOperator::IsInBounds : 0;
+
   if (InRangeIndex && *InRangeIndex < 63)
 SubClassOptionalData |= (*InRangeIndex + 1) << 1;
   const ConstantExprKeyType Key(Instruction::GetElementPtr, ArgVec, 0,
Index: llvm/lib/IR/ConstantFold.cpp
===
--- llvm/lib/IR/ConstantFold.cpp
+++ llvm/lib/IR/ConstantFold.cpp
@@ -347,6 +347,14 @@
   }
 }
 
+bool llvm::getSignedWrap() {
+  return llvm::SignedWrap;
+}
+
+void llvm::setSignedWrap(bool SignedWrap) {
+  llvm::SignedWrap=SignedWrap;
+}
+
 Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V,
 Type *DestTy) {
   if (isa(V))
Index: llvm/include/llvm/IR/ConstantFold.h
===
--- llvm/include/llvm/IR/ConstantFold.h
+++ llvm/include/llvm/IR/ConstantFold.h
@@ -26,10 +26,15 @@
 
 namespace llvm {
   template  class ArrayRef;
+  inline bool SignedWrap = false;
+
   class Value;
   class Constant;
   class Type;
 
+  bool getSignedWrap(void);
+  void setSignedWrap(bool Wrap);
+
   // Constant fold various types of instruction...
   Constant *ConstantFoldCastInstruction(
 unsigned opcode, ///< The opcode of the cast
Index: clang/test/CodeGen/inbounds.c
===
--- /dev/null
+++ clang/test/CodeGen/inbounds.c
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fwrapv -emit-llvm -o - %s | FileCheck %s 
+
+extern char base[];
+
+char *test() {
+return base + 1;
+}
+
+// CHECK: ret ptr getelementptr   (i8, ptr @base, i64 1)
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1689,6 +1689,9 @@
   llvm::is_contained(DebugEntryValueArchs, T.getArch()))
 Opts.EmitCallSiteInfo = true;
 
+  if (Args.hasArg(OPT_fwrapv))
+Opts.SignedWrap = true;
+
   if (!Opts.EnableDIPreservationVerify && Opts.DIBugsReportFilePath.size()) {
 Diags.Report(diag::warn_ignoring_verify_debuginfo_preserve_export)
 << Opts.DIBugsReportFilePath;
Index: clang/lib/CodeGen/CGExpr.cpp
===
--- clang/lib/CodeGen/CGExpr.cpp
+++ clang/lib/CodeGen/CGExpr.cpp
@@ -3613,7 +3613,12 @@
   if (!E->getType()->isVariableArrayType()) {
 assert(isa(Addr.getElementType()) &&
"Expected pointer to array");
+
+if (CGM.getCodeGenOpts().SignedWrap)
+  llvm::setSignedWrap(true);
+
 Addr = Builder.CreateConstArrayGEP(Addr, 0, "arraydecay");
+
   }
 
   // The result of this decay conversion points to an array element within the
Index: clang/include/clang/Basic/CodeGenOptions.def
===
--- clang/include/clang/Basic/CodeGenOptions.def
+++ clang/include/clang/Basic/CodeGenOptions.def
@@ -27,6 +27,7 @@
 CODEGENOPT(Name, Bits, Default)
 #endif
 
+CODEGENOPT(SignedWrap	 , 1, 0) ///< -fwarpv
 CODEGENOPT(DisableIntegratedAS, 1, 0) ///< -no-integrated-as
 ENUM_CODEGENOPT(CompressDebugSections, llvm::DebugCompressionType, 2,
 llvm::DebugCompressionType::None)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D139926: [clangd] Add semantic token for angle brackets

2023-01-30 Thread Nathan Ridge via Phabricator via cfe-commits
nridge added a comment.

In D139926#4084846 , @nridge wrote:

>   template 
>   class A {
>  template  void foo(U a) { }
>  template<> void foo(int a) { }  // <--
>   };
>
> This one is `ClassScopeFunctionSpecializationDecl::getTemplateArgsAsWritten()`

I got this testcase slightly wrong, the `template<>` is handled via 
`VisitDeclaratorDecl`, but it can have arguments as well:

  template 
  class A {
 template  void foo(U a) { }
 template<> void foo(int a) { }  // note the 
  };

which is what requires handling 
`ClassScopeFunctionSpecializationDecl::getTemplateArgsAsWritten()`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139926

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


[PATCH] D139926: [clangd] Add semantic token for angle brackets

2023-01-30 Thread Nathan Ridge via Phabricator via cfe-commits
nridge added a comment.

I did find one other edge case (last one, I promise!)

  template  void foo(T);
  template  class A {
friend void foo<>(T);  // <--
  };

This one is `FunctionDecl::getDependentSpecializationInfo()->getLAngleLoc()`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139926

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


[clang] 5375b63 - [UTC] Add --version argument

2023-01-30 Thread Nikita Popov via cfe-commits

Author: Nikita Popov
Date: 2023-01-30T09:57:26+01:00
New Revision: 5375b638be874b5438e98bd8a435e198af3ef2d0

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

LOG: [UTC] Add --version argument

We have a number of pending changes to update_test_checks.py
(and friends) that are essentially blocked on test churn:
If the output of UTC for an existing flag combination changes,
then the next time a test is regenerated, it will contain many
spurious changes. This makes changes to UTC default
behavior essentially impossible.

Examples of such changes are:

* D133943/D142373 want --function-signature to also check the
  return type/attributes.
* D139006/D140212 want to make --function-signature the default
  behavior.
* D142452 wants to add wildcards for block labels.

This patch tries to resolve this issue by adding a --version
argument, which works as follows:

* When regenerating an old test, the default version is 1.
* When generating a new test, the default version is the newest.
 When an explicit version is specified, that of course wins.

This means that any currently existing tests will keep using
--version 1 format, while any new tests will automatically embed
--version N where N is the latest version, and then keep using
that test format from then on.

This patch only implements the --version flag without bumping
the default version, so it does not have any visible behavior
change by itself.

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

Added: 


Modified: 
clang/test/utils/update_cc_test_checks/lit.local.cfg
llvm/test/tools/UpdateTestChecks/lit.local.cfg
llvm/utils/UpdateTestChecks/common.py

Removed: 




diff  --git a/clang/test/utils/update_cc_test_checks/lit.local.cfg 
b/clang/test/utils/update_cc_test_checks/lit.local.cfg
index b78c4ffdab585..b461878880e47 100644
--- a/clang/test/utils/update_cc_test_checks/lit.local.cfg
+++ b/clang/test/utils/update_cc_test_checks/lit.local.cfg
@@ -26,6 +26,10 @@ else:
 extra_args = '--clang ' + shell_quote(clang_path)
 opt_path = os.path.join(config.llvm_tools_dir, 'opt')
 extra_args += ' --opt ' + shell_quote(opt_path)
+# Specify an explicit default version in UTC tests, so that the --version
+# embedded in UTC_ARGS does not change in all test expectations every time
+# the default is bumped.
+extra_args += ' --version=1'
 script_path = os.path.join(config.llvm_src_root, 'utils',
'update_cc_test_checks.py')
 assert os.path.isfile(script_path)

diff  --git a/llvm/test/tools/UpdateTestChecks/lit.local.cfg 
b/llvm/test/tools/UpdateTestChecks/lit.local.cfg
index d9d11b5a06c07..cdaf1b3464d22 100644
--- a/llvm/test/tools/UpdateTestChecks/lit.local.cfg
+++ b/llvm/test/tools/UpdateTestChecks/lit.local.cfg
@@ -15,6 +15,10 @@ def add_update_script_substition(name, 
python_exe=config.python_executable,
 assert name.startswith('%')
 script_path = os.path.join(config.llvm_src_root, 'utils', name[1:] + '.py')
 assert os.path.isfile(script_path)
+# Specify an explicit default version in UTC tests, so that the --version
+# embedded in UTC_ARGS does not change in all test expectations every time
+# the default is bumped.
+extra_args += ' --version=1'
 config.substitutions.append(
 (name, "'%s' %s %s" % (python_exe, script_path, extra_args)))
 

diff  --git a/llvm/utils/UpdateTestChecks/common.py 
b/llvm/utils/UpdateTestChecks/common.py
index cf382c0ff23fa..7e538d775efa7 100644
--- a/llvm/utils/UpdateTestChecks/common.py
+++ b/llvm/utils/UpdateTestChecks/common.py
@@ -18,6 +18,13 @@
 _verbose = False
 _prefix_filecheck_ir_name = ''
 
+"""
+Version changelog:
+
+1: Initial version, used by tests that don't specify --version explicitly.
+"""
+DEFAULT_VERSION = 1
+
 class Regex(object):
   """Wrap a compiled regular expression object to allow deep copy of a regexp.
   This is required for the deep copy done in do_scrub.
@@ -138,6 +145,10 @@ def __call__(self, parser, namespace, values, 
option_string=None):
   dest='gen_unused_prefix_body',
   default=True,
   help='Generate a function body that always matches for 
unused prefixes. This is useful when unused prefixes are desired, and it avoids 
needing to annotate each FileCheck as allowing them.')
+  # This is the default when regenerating existing tests. The default when
+  # generating new tests is determined by DEFAULT_VERSION.
+  parser.add_argument('--version', type=int, default=1,
+  help='The version of output format')
   args = parser.parse_args()
   global _verbose, _global_value_regex, _global_hex_value_regex
   _verbose = args.verbose
@@ -226,12 +237,18 @@ def itertests(test_patterns, pars

[PATCH] D142473: [UTC] Add --version argument

2023-01-30 Thread Nikita Popov 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 rG5375b638be87: [UTC] Add --version argument (authored by 
nikic).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142473

Files:
  clang/test/utils/update_cc_test_checks/lit.local.cfg
  llvm/test/tools/UpdateTestChecks/lit.local.cfg
  llvm/utils/UpdateTestChecks/common.py


Index: llvm/utils/UpdateTestChecks/common.py
===
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -18,6 +18,13 @@
 _verbose = False
 _prefix_filecheck_ir_name = ''
 
+"""
+Version changelog:
+
+1: Initial version, used by tests that don't specify --version explicitly.
+"""
+DEFAULT_VERSION = 1
+
 class Regex(object):
   """Wrap a compiled regular expression object to allow deep copy of a regexp.
   This is required for the deep copy done in do_scrub.
@@ -138,6 +145,10 @@
   dest='gen_unused_prefix_body',
   default=True,
   help='Generate a function body that always matches for 
unused prefixes. This is useful when unused prefixes are desired, and it avoids 
needing to annotate each FileCheck as allowing them.')
+  # This is the default when regenerating existing tests. The default when
+  # generating new tests is determined by DEFAULT_VERSION.
+  parser.add_argument('--version', type=int, default=1,
+  help='The version of output format')
   args = parser.parse_args()
   global _verbose, _global_value_regex, _global_hex_value_regex
   _verbose = args.verbose
@@ -226,12 +237,18 @@
 for test in tests_list:
   with open(test) as f:
 input_lines = [l.rstrip() for l in f]
-  args = parser.parse_args()
+  first_line = input_lines[0] if input_lines else ""
+  is_regenerate = UTC_ADVERT in first_line
+
+  # If we're generating a new test, set the default version to the latest.
+  argv = sys.argv[:]
+  if not is_regenerate:
+argv.insert(1, '--version=' + str(DEFAULT_VERSION))
+
+  args = parser.parse_args(argv[1:])
   if argparse_callback is not None:
 argparse_callback(args)
-  argv = sys.argv[:]
-  first_line = input_lines[0] if input_lines else ""
-  if UTC_ADVERT in first_line:
+  if is_regenerate:
 if script_name not in first_line and not args.force_update:
   warn("Skipping test which wasn't autogenerated by " + script_name, 
test)
   continue
Index: llvm/test/tools/UpdateTestChecks/lit.local.cfg
===
--- llvm/test/tools/UpdateTestChecks/lit.local.cfg
+++ llvm/test/tools/UpdateTestChecks/lit.local.cfg
@@ -15,6 +15,10 @@
 assert name.startswith('%')
 script_path = os.path.join(config.llvm_src_root, 'utils', name[1:] + '.py')
 assert os.path.isfile(script_path)
+# Specify an explicit default version in UTC tests, so that the --version
+# embedded in UTC_ARGS does not change in all test expectations every time
+# the default is bumped.
+extra_args += ' --version=1'
 config.substitutions.append(
 (name, "'%s' %s %s" % (python_exe, script_path, extra_args)))
 
Index: clang/test/utils/update_cc_test_checks/lit.local.cfg
===
--- clang/test/utils/update_cc_test_checks/lit.local.cfg
+++ clang/test/utils/update_cc_test_checks/lit.local.cfg
@@ -26,6 +26,10 @@
 extra_args = '--clang ' + shell_quote(clang_path)
 opt_path = os.path.join(config.llvm_tools_dir, 'opt')
 extra_args += ' --opt ' + shell_quote(opt_path)
+# Specify an explicit default version in UTC tests, so that the --version
+# embedded in UTC_ARGS does not change in all test expectations every time
+# the default is bumped.
+extra_args += ' --version=1'
 script_path = os.path.join(config.llvm_src_root, 'utils',
'update_cc_test_checks.py')
 assert os.path.isfile(script_path)


Index: llvm/utils/UpdateTestChecks/common.py
===
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -18,6 +18,13 @@
 _verbose = False
 _prefix_filecheck_ir_name = ''
 
+"""
+Version changelog:
+
+1: Initial version, used by tests that don't specify --version explicitly.
+"""
+DEFAULT_VERSION = 1
+
 class Regex(object):
   """Wrap a compiled regular expression object to allow deep copy of a regexp.
   This is required for the deep copy done in do_scrub.
@@ -138,6 +145,10 @@
   dest='gen_unused_prefix_body',
   default=True,
   help='Generate a functio

[PATCH] D122215: [WebAssembly] Initial support for reference type externref in clang

2023-01-30 Thread Paulo Matos via Phabricator via cfe-commits
pmatos updated this revision to Diff 493226.
pmatos added a comment.

Rebase on main.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122215

Files:
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/Type.h
  clang/include/clang/AST/TypeProperties.td
  clang/include/clang/Basic/BuiltinsWebAssembly.def
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/WebAssemblyReferenceTypes.def
  clang/include/clang/Sema/Sema.h
  clang/include/clang/Serialization/ASTBitCodes.h
  clang/include/clang/module.modulemap
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/ExprConstant.cpp
  clang/lib/AST/ItaniumMangle.cpp
  clang/lib/AST/MicrosoftMangle.cpp
  clang/lib/AST/NSAPI.cpp
  clang/lib/AST/PrintfFormatString.cpp
  clang/lib/AST/Type.cpp
  clang/lib/AST/TypeLoc.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/CodeGen/CGDebugInfo.h
  clang/lib/CodeGen/CodeGenTypes.cpp
  clang/lib/CodeGen/ItaniumCXXABI.cpp
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/CodeGen/TargetInfo.h
  clang/lib/Index/USRGeneration.cpp
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaType.cpp
  clang/lib/Serialization/ASTCommon.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/test/CodeGen/WebAssembly/wasm-externref.c
  clang/test/CodeGen/builtins-wasm.c
  clang/test/CodeGenCXX/wasm-reftypes-mangle.cpp
  clang/test/CodeGenCXX/wasm-reftypes-typeinfo.cpp
  clang/test/Sema/wasm-refs.c
  clang/test/SemaCXX/wasm-refs.cpp
  clang/test/SemaTemplate/address_space-dependent.cpp
  clang/tools/libclang/CIndex.cpp
  llvm/include/llvm/IR/Type.h
  llvm/include/llvm/Transforms/Utils.h
  llvm/lib/CodeGen/ValueTypes.cpp
  llvm/lib/IR/Type.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
  llvm/lib/Transforms/Utils/Mem2Reg.cpp

Index: llvm/lib/Transforms/Utils/Mem2Reg.cpp
===
--- llvm/lib/Transforms/Utils/Mem2Reg.cpp
+++ llvm/lib/Transforms/Utils/Mem2Reg.cpp
@@ -74,15 +74,19 @@
 struct PromoteLegacyPass : public FunctionPass {
   // Pass identification, replacement for typeid
   static char ID;
+  bool ForcePass; /// If true, forces pass to execute, instead of skipping.
 
-  PromoteLegacyPass() : FunctionPass(ID) {
+  PromoteLegacyPass() : FunctionPass(ID), ForcePass(false) {
+initializePromoteLegacyPassPass(*PassRegistry::getPassRegistry());
+  }
+  PromoteLegacyPass(bool IsForced) : FunctionPass(ID), ForcePass(IsForced) {
 initializePromoteLegacyPassPass(*PassRegistry::getPassRegistry());
   }
 
   // runOnFunction - To run this pass, first we calculate the alloca
   // instructions that are safe for promotion, then we promote each one.
   bool runOnFunction(Function &F) override {
-if (skipFunction(F))
+if (!ForcePass && skipFunction(F))
   return false;
 
 DominatorTree &DT = getAnalysis().getDomTree();
@@ -96,6 +100,7 @@
 AU.addRequired();
 AU.setPreservesCFG();
   }
+
 };
 
 } // end anonymous namespace
@@ -111,6 +116,6 @@
 false, false)
 
 // createPromoteMemoryToRegister - Provide an entry point to create this pass.
-FunctionPass *llvm::createPromoteMemoryToRegisterPass() {
-  return new PromoteLegacyPass();
+FunctionPass *llvm::createPromoteMemoryToRegisterPass(bool IsForced) {
+  return new PromoteLegacyPass(IsForced);
 }
Index: llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
===
--- llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
+++ llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
@@ -16,6 +16,7 @@
 #include "TargetInfo/WebAssemblyTargetInfo.h"
 #include "Utils/WebAssemblyUtilities.h"
 #include "WebAssembly.h"
+#include "WebAssemblyISelLowering.h"
 #include "WebAssemblyMachineFunctionInfo.h"
 #include "WebAssemblyTargetObjectFile.h"
 #include "WebAssemblyTargetTransformInfo.h"
@@ -464,6 +465,14 @@
 }
 
 void WebAssemblyPassConfig::addISelPrepare() {
+  WebAssemblyTargetMachine *WasmTM = static_cast(TM);
+  const WebAssemblySubtarget *Subtarget = WasmTM
+->getSubtargetImpl(std::string(WasmTM->getTargetCPU()),
+   std::string(WasmTM->getTargetFeatureString()));
+  if(Subtarget->hasReferenceTypes()) {
+// We need to remove allocas for reference types
+addPass(createPromoteMemoryToRegisterPass(true));
+  }
   // Lower atomics and TLS if necessary
   addPass(new CoalesceFeaturesAndStripAtomics(&getWebAssemblyTargetMachine()));
 
Index: llvm/lib/IR/Type.cpp
===
--- llvm/lib/IR/Type.cpp
+++ llvm/lib/IR/Type.cpp
@@ -306,6 +306,18 @@
   return getInt64Ty(C)->getPointerTo(AS);
 }
 
+Type *Type::getWasm_ExternrefTy(LLVMContext &C) {
+  // opaque pointer in a

[clang] e31ee64 - [clang][ASTImporter] Handle UsingType in friend declarations.

2023-01-30 Thread Balázs Kéri via cfe-commits

Author: Balázs Kéri
Date: 2023-01-30T10:06:11+01:00
New Revision: e31ee6417c33a6e2f0e8440b1a86d5365279ad68

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

LOG: [clang][ASTImporter] Handle UsingType in friend declarations.

ASTImporterLookupTable did not handle correctly friend declarations
where the friend type is an UsingType (type of a declaration that
comes from an using-declaration). The problem is fixed by handling
it in the same way as a friend with TypedefType.

Reviewed By: steakhal

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

Added: 


Modified: 
clang/lib/AST/ASTImporterLookupTable.cpp
clang/unittests/AST/ASTImporterTest.cpp

Removed: 




diff  --git a/clang/lib/AST/ASTImporterLookupTable.cpp 
b/clang/lib/AST/ASTImporterLookupTable.cpp
index b7d17a5e92d00..a193e97bbf5a0 100644
--- a/clang/lib/AST/ASTImporterLookupTable.cpp
+++ b/clang/lib/AST/ASTImporterLookupTable.cpp
@@ -67,6 +67,8 @@ struct Builder : RecursiveASTVisitor {
 } else if (isa(Ty)) {
   // We do not put friend typedefs to the lookup table because
   // ASTImporter does not organize typedefs into redecl chains.
+} else if (isa(Ty)) {
+  // Similar to TypedefType, not putting into lookup table.
 } else {
   llvm_unreachable("Unhandled type of friend class");
 }

diff  --git a/clang/unittests/AST/ASTImporterTest.cpp 
b/clang/unittests/AST/ASTImporterTest.cpp
index 1080b5acd4b30..78de31e478ebc 100644
--- a/clang/unittests/AST/ASTImporterTest.cpp
+++ b/clang/unittests/AST/ASTImporterTest.cpp
@@ -5180,6 +5180,39 @@ TEST_P(ASTImporterLookupTableTest,
   EXPECT_EQ(Res.count(Alias), 1u);
 }
 
+TEST_P(ASTImporterLookupTableTest,
+   LookupFindsFriendClassDeclWithUsingTypeDoesNotAssert) {
+  TranslationUnitDecl *ToTU = getToTuDecl(
+  R"(
+  namespace a {
+namespace b { class InnerClass; }
+using b::InnerClass;
+  }
+  class B {
+friend a::InnerClass;
+  };
+  )",
+  Lang_CXX11);
+
+  // ASTImporterLookupTable constructor handles friend with using-type without
+  // asserts.
+  ASTImporterLookupTable LT(*ToTU);
+
+  auto *Using = FirstDeclMatcher().match(
+  ToTU, usingDecl(hasName("InnerClass")));
+  DeclarationName Name = Using->getDeclName();
+  auto Res = LT.lookup(ToTU, Name);
+  EXPECT_EQ(Res.size(), 0u);
+  auto *NsA = FirstDeclMatcher().match(
+  ToTU, namespaceDecl(hasName("a")));
+  auto *RecordB = FirstDeclMatcher().match(
+  ToTU, cxxRecordDecl(hasName("B")));
+  auto Res1 = LT.lookup(NsA, Name);
+  EXPECT_EQ(Res1.count(Using), 1u);
+  auto Res2 = LT.lookup(RecordB, Name);
+  EXPECT_EQ(Res2.size(), 0u);
+}
+
 TEST_P(ASTImporterLookupTableTest, LookupFindsFwdFriendClassTemplateDecl) {
   TranslationUnitDecl *ToTU = getToTuDecl(
   R"(



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


[PATCH] D142607: [clang][ASTImporter] Handle UsingType in friend declarations.

2023-01-30 Thread Balázs Kéri 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 rGe31ee6417c33: [clang][ASTImporter] Handle UsingType in 
friend declarations. (authored by balazske).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142607

Files:
  clang/lib/AST/ASTImporterLookupTable.cpp
  clang/unittests/AST/ASTImporterTest.cpp


Index: clang/unittests/AST/ASTImporterTest.cpp
===
--- clang/unittests/AST/ASTImporterTest.cpp
+++ clang/unittests/AST/ASTImporterTest.cpp
@@ -5180,6 +5180,39 @@
   EXPECT_EQ(Res.count(Alias), 1u);
 }
 
+TEST_P(ASTImporterLookupTableTest,
+   LookupFindsFriendClassDeclWithUsingTypeDoesNotAssert) {
+  TranslationUnitDecl *ToTU = getToTuDecl(
+  R"(
+  namespace a {
+namespace b { class InnerClass; }
+using b::InnerClass;
+  }
+  class B {
+friend a::InnerClass;
+  };
+  )",
+  Lang_CXX11);
+
+  // ASTImporterLookupTable constructor handles friend with using-type without
+  // asserts.
+  ASTImporterLookupTable LT(*ToTU);
+
+  auto *Using = FirstDeclMatcher().match(
+  ToTU, usingDecl(hasName("InnerClass")));
+  DeclarationName Name = Using->getDeclName();
+  auto Res = LT.lookup(ToTU, Name);
+  EXPECT_EQ(Res.size(), 0u);
+  auto *NsA = FirstDeclMatcher().match(
+  ToTU, namespaceDecl(hasName("a")));
+  auto *RecordB = FirstDeclMatcher().match(
+  ToTU, cxxRecordDecl(hasName("B")));
+  auto Res1 = LT.lookup(NsA, Name);
+  EXPECT_EQ(Res1.count(Using), 1u);
+  auto Res2 = LT.lookup(RecordB, Name);
+  EXPECT_EQ(Res2.size(), 0u);
+}
+
 TEST_P(ASTImporterLookupTableTest, LookupFindsFwdFriendClassTemplateDecl) {
   TranslationUnitDecl *ToTU = getToTuDecl(
   R"(
Index: clang/lib/AST/ASTImporterLookupTable.cpp
===
--- clang/lib/AST/ASTImporterLookupTable.cpp
+++ clang/lib/AST/ASTImporterLookupTable.cpp
@@ -67,6 +67,8 @@
 } else if (isa(Ty)) {
   // We do not put friend typedefs to the lookup table because
   // ASTImporter does not organize typedefs into redecl chains.
+} else if (isa(Ty)) {
+  // Similar to TypedefType, not putting into lookup table.
 } else {
   llvm_unreachable("Unhandled type of friend class");
 }


Index: clang/unittests/AST/ASTImporterTest.cpp
===
--- clang/unittests/AST/ASTImporterTest.cpp
+++ clang/unittests/AST/ASTImporterTest.cpp
@@ -5180,6 +5180,39 @@
   EXPECT_EQ(Res.count(Alias), 1u);
 }
 
+TEST_P(ASTImporterLookupTableTest,
+   LookupFindsFriendClassDeclWithUsingTypeDoesNotAssert) {
+  TranslationUnitDecl *ToTU = getToTuDecl(
+  R"(
+  namespace a {
+namespace b { class InnerClass; }
+using b::InnerClass;
+  }
+  class B {
+friend a::InnerClass;
+  };
+  )",
+  Lang_CXX11);
+
+  // ASTImporterLookupTable constructor handles friend with using-type without
+  // asserts.
+  ASTImporterLookupTable LT(*ToTU);
+
+  auto *Using = FirstDeclMatcher().match(
+  ToTU, usingDecl(hasName("InnerClass")));
+  DeclarationName Name = Using->getDeclName();
+  auto Res = LT.lookup(ToTU, Name);
+  EXPECT_EQ(Res.size(), 0u);
+  auto *NsA = FirstDeclMatcher().match(
+  ToTU, namespaceDecl(hasName("a")));
+  auto *RecordB = FirstDeclMatcher().match(
+  ToTU, cxxRecordDecl(hasName("B")));
+  auto Res1 = LT.lookup(NsA, Name);
+  EXPECT_EQ(Res1.count(Using), 1u);
+  auto Res2 = LT.lookup(RecordB, Name);
+  EXPECT_EQ(Res2.size(), 0u);
+}
+
 TEST_P(ASTImporterLookupTableTest, LookupFindsFwdFriendClassTemplateDecl) {
   TranslationUnitDecl *ToTU = getToTuDecl(
   R"(
Index: clang/lib/AST/ASTImporterLookupTable.cpp
===
--- clang/lib/AST/ASTImporterLookupTable.cpp
+++ clang/lib/AST/ASTImporterLookupTable.cpp
@@ -67,6 +67,8 @@
 } else if (isa(Ty)) {
   // We do not put friend typedefs to the lookup table because
   // ASTImporter does not organize typedefs into redecl chains.
+} else if (isa(Ty)) {
+  // Similar to TypedefType, not putting into lookup table.
 } else {
   llvm_unreachable("Unhandled type of friend class");
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D142006: [mlir][bufferization] Fix getAliasingOpOperand/OpResult for non-bufferizable ops

2023-01-30 Thread Matthias Springer via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf3483c23ce2c: [mlir][bufferization] Fix 
getAliasingOpOperand/OpResult for non-bufferizable ops (authored by springerm).

Changed prior to commit:
  https://reviews.llvm.org/D142006?vs=492765&id=493228#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142006

Files:
  mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h
  mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
  mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp
  mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
  mlir/test/Dialect/Bufferization/Transforms/one-shot-bufferize-analysis.mlir
  mlir/test/Dialect/Bufferization/Transforms/one-shot-bufferize-partial.mlir
  
mlir/test/Dialect/Bufferization/Transforms/one-shot-bufferize-pass-statistics.mlir
  mlir/test/Dialect/Bufferization/Transforms/one-shot-bufferize.mlir

Index: mlir/test/Dialect/Bufferization/Transforms/one-shot-bufferize.mlir
===
--- mlir/test/Dialect/Bufferization/Transforms/one-shot-bufferize.mlir
+++ mlir/test/Dialect/Bufferization/Transforms/one-shot-bufferize.mlir
@@ -136,7 +136,7 @@
 
 // CHECK-LABEL: func @select_different_tensors(
 //  CHECK-SAME: %[[t:.*]]: tensor
-func.func @select_different_tensors(%t: tensor, %sz: index, %c: i1) -> tensor {
+func.func @select_different_tensors(%t: tensor, %sz: index, %pos: index, %c: i1) -> f32 {
   // CHECK-DAG: %[[m:.*]] = bufferization.to_memref %[[t]] : memref
   // CHECK-DAG: %[[alloc:.*]] = memref.alloc(%{{.*}}) {{.*}} : memref
   %0 = bufferization.alloc_tensor(%sz) : tensor
@@ -145,7 +145,8 @@
   // CHECK: %[[casted:.*]] = memref.cast %[[alloc]] : memref to memref
   // CHECK: arith.select %{{.*}}, %[[casted]], %[[m]]
   %1 = arith.select %c, %0, %t : tensor
-  return %1 : tensor
+  %2 = tensor.extract %1[%pos] : tensor
+  return %2 : f32
 }
 
 // -
Index: mlir/test/Dialect/Bufferization/Transforms/one-shot-bufferize-pass-statistics.mlir
===
--- mlir/test/Dialect/Bufferization/Transforms/one-shot-bufferize-pass-statistics.mlir
+++ mlir/test/Dialect/Bufferization/Transforms/one-shot-bufferize-pass-statistics.mlir
@@ -5,7 +5,7 @@
 // CHECK:  (S) 1 num-buffer-alloc
 // CHECK:  (S) 1 num-buffer-dealloc
 // CHECK:  (S) 1 num-tensor-in-place
-// CHECK:  (S) 1 num-tensor-out-of-place
+// CHECK:  (S) 2 num-tensor-out-of-place
 func.func @read_after_write_conflict(%cst : f32, %idx : index, %idx2 : index)
 -> (f32, f32) {
   %t = "test.dummy_op"() : () -> (tensor<10xf32>)
Index: mlir/test/Dialect/Bufferization/Transforms/one-shot-bufferize-partial.mlir
===
--- mlir/test/Dialect/Bufferization/Transforms/one-shot-bufferize-partial.mlir
+++ mlir/test/Dialect/Bufferization/Transforms/one-shot-bufferize-partial.mlir
@@ -100,11 +100,14 @@
 %t1: tensor, %o: index, %s: index) -> (tensor, tensor) {
   // CHECK: %[[m1:.*]] = bufferization.to_memref %[[t1]]
   // CHECK: %[[subview:.*]] = memref.subview %[[m1]]
+  // The op must alloc because "test.dummy" may bufferize to a memory write.
+  // CHECK: %[[alloc:.*]] = memref.alloc
+  // CHECK: memref.copy %[[subview]], %[[alloc]]
   %0 = tensor.extract_slice %t1[%o][%s][1] : tensor to tensor
-  // CHECK: %[[subview_tensor:.*]] = bufferization.to_tensor %[[subview]]
-  // CHECK: %[[dummy:.*]] = "test.dummy_op"(%[[subview_tensor]])
+  // CHECK: %[[alloc_tensor:.*]] = bufferization.to_tensor %[[alloc]]
+  // CHECK: %[[dummy:.*]] = "test.dummy_op"(%[[alloc_tensor]])
   %1 = "test.dummy_op"(%0) : (tensor) -> tensor
-  // CHECK: return %[[subview_tensor]], %[[dummy]]
+  // CHECK: return %[[alloc_tensor]], %[[dummy]]
   return %0, %1 : tensor, tensor
 }
 
Index: mlir/test/Dialect/Bufferization/Transforms/one-shot-bufferize-analysis.mlir
===
--- /dev/null
+++ mlir/test/Dialect/Bufferization/Transforms/one-shot-bufferize-analysis.mlir
@@ -0,0 +1,34 @@
+// RUN: mlir-opt %s -one-shot-bufferize="test-analysis-only" -allow-unregistered-dialect -split-input-file | FileCheck %s
+
+// CHECK-LABEL: func @unknown_op_aliasing(
+func.func @unknown_op_aliasing(%f: f32, %f2: f32, %pos: index) -> f32 {
+  %0 = tensor.empty() : tensor<10xf32>
+  // CHECK: linalg.fill {__inplace_operands_attr__ = ["none", "true"]}
+  %1 = linalg.fill ins(%f : f32) outs(%0 : tensor<10xf32>) -> tensor<10xf32>
+
+  // Something must bufferize out-of-place because the op may return an alias
+  // of %1.
+  // CHECK: "dummy.dummy_op"(%{{.*}}) {__inplace_operands_attr__ = ["false"]}
+  %alias = "dummy.dummy_op"(%1) : (tensor<10xf32>) -> (tensor<10xf32>)
+
+  // CHECK: linalg.fill {__inplace_operands_attr__ = ["none", "true"]}
+  %2 = linal

[PATCH] D142878: Add testing for Fuchsia multilib

2023-01-30 Thread Michael Platings via Phabricator via cfe-commits
michaelplatings created this revision.
michaelplatings added a reviewer: phosek.
Herald added a subscriber: abrachet.
Herald added a project: All.
michaelplatings requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.

The plan is to change how multilib works under the hood and this test gives 
confidence that the changes won't break user-visible behaviour.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142878

Files:
  clang/lib/Driver/ToolChains/Fuchsia.cpp
  clang/lib/Driver/ToolChains/Fuchsia.h
  clang/unittests/Driver/CMakeLists.txt
  clang/unittests/Driver/FuchsiaTest.cpp

Index: clang/unittests/Driver/FuchsiaTest.cpp
===
--- /dev/null
+++ clang/unittests/Driver/FuchsiaTest.cpp
@@ -0,0 +1,80 @@
+//===- unittests/Driver/FuchsiaTest.cpp --- Fuchsia 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
+//
+//===--===//
+//
+// Unit tests for Fuchsia
+//
+//===--===//
+
+#include "../../lib/Driver/ToolChains/Fuchsia.h"
+#include "gtest/gtest.h"
+
+using namespace clang::driver;
+
+/*
+This test was added prior to changing the behaviour of Multilib.
+The way that Fuchsia used Multilib made it very likely that the change
+would cause it to break so by adding this exhaustive test we avoid that
+possibility.
+*/
+TEST(FuchsiaTest, MultilibVariant) {
+  MultilibSet Multilibs;
+  toolchains::Fuchsia::configureMultilibs(Multilibs);
+
+  std::string Actual;
+
+  for (bool Itanium : {false, true}) {
+for (bool RelativeVtables : {false, true}) {
+  for (bool Hwasan : {false, true}) {
+for (bool Asan : {false, true}) {
+  for (bool Exceptions : {false, true}) {
+Multilib::flags_list Flags;
+toolchains::Fuchsia::configureMultilibFlags(
+Flags, Exceptions, Asan, Hwasan, RelativeVtables, Itanium);
+Multilib Selected;
+EXPECT_TRUE(Multilibs.select(Flags, Selected));
+Actual += Selected.gccSuffix() + "\n";
+  }
+}
+  }
+}
+  }
+  std::string Expected = R"(/noexcept
+
+/asan+noexcept
+/asan
+/hwasan+noexcept
+/hwasan
+/hwasan+noexcept
+/hwasan
+/relative-vtables+noexcept
+/relative-vtables
+/relative-vtables+asan+noexcept
+/relative-vtables+asan
+/relative-vtables+hwasan+noexcept
+/relative-vtables+hwasan
+/relative-vtables+hwasan+noexcept
+/relative-vtables+hwasan
+/compat
+/compat
+/compat
+/compat
+/compat
+/compat
+/compat
+/compat
+/compat
+/compat
+/compat
+/compat
+/compat
+/compat
+/compat
+/compat
+)";
+  EXPECT_EQ(Expected, Actual);
+}
Index: clang/unittests/Driver/CMakeLists.txt
===
--- clang/unittests/Driver/CMakeLists.txt
+++ clang/unittests/Driver/CMakeLists.txt
@@ -9,6 +9,7 @@
 add_clang_unittest(ClangDriverTests
   DistroTest.cpp
   DXCModeTest.cpp
+  FuchsiaTest.cpp
   ToolChainTest.cpp
   ModuleCacheTest.cpp
   MultilibTest.cpp
Index: clang/lib/Driver/ToolChains/Fuchsia.h
===
--- clang/lib/Driver/ToolChains/Fuchsia.h
+++ clang/lib/Driver/ToolChains/Fuchsia.h
@@ -98,6 +98,11 @@
 
   const char *getDefaultLinker() const override { return "ld.lld"; }
 
+  static void configureMultilibs(MultilibSet &);
+  static void configureMultilibFlags(Multilib::flags_list &, bool Exceptions,
+ bool Asan, bool Hwasan,
+ bool RelativeVtables, bool Itanium);
+
 protected:
   Tool *buildLinker() const override;
 };
Index: clang/lib/Driver/ToolChains/Fuchsia.cpp
===
--- clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -215,6 +215,35 @@
 return FP;
   };
 
+  configureMultilibs(Multilibs);
+
+  Multilibs.FilterOut([&](const Multilib &M) {
+std::vector RD = FilePaths(M);
+return llvm::all_of(RD, [&](std::string P) { return !getVFS().exists(P); });
+  });
+
+  Multilib::flags_list Flags;
+  configureMultilibFlags(
+  Flags,
+  Args.hasFlag(options::OPT_fexceptions, options::OPT_fno_exceptions, true),
+  getSanitizerArgs(Args).needsAsanRt(),
+  getSanitizerArgs(Args).needsHwasanRt(),
+  Args.hasFlag(options::OPT_fexperimental_relative_cxx_abi_vtables,
+   options::OPT_fno_experimental_relative_cxx_abi_vtables,
+   false),
+  Args.getLastArgValue(options::OPT_fcxx_abi_EQ) == "itanium");
+
+  Multilibs.setFilePathsCallback(FilePaths);
+
+  if (Multilibs.select(Flags, SelectedMultilib))
+if

[PATCH] D142804: [clang-format] Support clang-format on/off line comments as prefixes

2023-01-30 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay accepted this revision.
MyDeveloperDay added a comment.
This revision is now accepted and ready to land.

LGTM


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

https://reviews.llvm.org/D142804

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


[PATCH] D142878: Add testing for Fuchsia multilib

2023-01-30 Thread Michael Platings via Phabricator via cfe-commits
michaelplatings updated this revision to Diff 493244.
michaelplatings added a comment.

Update commit message and run arc with clang-format on the PATH


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142878

Files:
  clang/lib/Driver/ToolChains/Fuchsia.cpp
  clang/lib/Driver/ToolChains/Fuchsia.h
  clang/unittests/Driver/CMakeLists.txt
  clang/unittests/Driver/FuchsiaTest.cpp

Index: clang/unittests/Driver/FuchsiaTest.cpp
===
--- /dev/null
+++ clang/unittests/Driver/FuchsiaTest.cpp
@@ -0,0 +1,80 @@
+//===- unittests/Driver/FuchsiaTest.cpp --- Fuchsia 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
+//
+//===--===//
+//
+// Unit tests for Fuchsia
+//
+//===--===//
+
+#include "../../lib/Driver/ToolChains/Fuchsia.h"
+#include "gtest/gtest.h"
+
+using namespace clang::driver;
+
+/*
+This test was added prior to changing the behaviour of Multilib.
+The way that Fuchsia used Multilib made it very likely that the change
+would cause it to break so by adding this exhaustive test we avoid that
+possibility.
+*/
+TEST(FuchsiaTest, MultilibVariant) {
+  MultilibSet Multilibs;
+  toolchains::Fuchsia::configureMultilibs(Multilibs);
+
+  std::string Actual;
+
+  for (bool Itanium : {false, true}) {
+for (bool RelativeVtables : {false, true}) {
+  for (bool Hwasan : {false, true}) {
+for (bool Asan : {false, true}) {
+  for (bool Exceptions : {false, true}) {
+Multilib::flags_list Flags;
+toolchains::Fuchsia::configureMultilibFlags(
+Flags, Exceptions, Asan, Hwasan, RelativeVtables, Itanium);
+Multilib Selected;
+EXPECT_TRUE(Multilibs.select(Flags, Selected));
+Actual += Selected.gccSuffix() + "\n";
+  }
+}
+  }
+}
+  }
+  std::string Expected = R"(/noexcept
+
+/asan+noexcept
+/asan
+/hwasan+noexcept
+/hwasan
+/hwasan+noexcept
+/hwasan
+/relative-vtables+noexcept
+/relative-vtables
+/relative-vtables+asan+noexcept
+/relative-vtables+asan
+/relative-vtables+hwasan+noexcept
+/relative-vtables+hwasan
+/relative-vtables+hwasan+noexcept
+/relative-vtables+hwasan
+/compat
+/compat
+/compat
+/compat
+/compat
+/compat
+/compat
+/compat
+/compat
+/compat
+/compat
+/compat
+/compat
+/compat
+/compat
+/compat
+)";
+  EXPECT_EQ(Expected, Actual);
+}
Index: clang/unittests/Driver/CMakeLists.txt
===
--- clang/unittests/Driver/CMakeLists.txt
+++ clang/unittests/Driver/CMakeLists.txt
@@ -9,6 +9,7 @@
 add_clang_unittest(ClangDriverTests
   DistroTest.cpp
   DXCModeTest.cpp
+  FuchsiaTest.cpp
   ToolChainTest.cpp
   ModuleCacheTest.cpp
   MultilibTest.cpp
Index: clang/lib/Driver/ToolChains/Fuchsia.h
===
--- clang/lib/Driver/ToolChains/Fuchsia.h
+++ clang/lib/Driver/ToolChains/Fuchsia.h
@@ -98,6 +98,11 @@
 
   const char *getDefaultLinker() const override { return "ld.lld"; }
 
+  static void configureMultilibs(MultilibSet &);
+  static void configureMultilibFlags(Multilib::flags_list &, bool Exceptions,
+ bool Asan, bool Hwasan,
+ bool RelativeVtables, bool Itanium);
+
 protected:
   Tool *buildLinker() const override;
 };
Index: clang/lib/Driver/ToolChains/Fuchsia.cpp
===
--- clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -215,6 +215,35 @@
 return FP;
   };
 
+  configureMultilibs(Multilibs);
+
+  Multilibs.FilterOut([&](const Multilib &M) {
+std::vector RD = FilePaths(M);
+return llvm::all_of(RD, [&](std::string P) { return !getVFS().exists(P); });
+  });
+
+  Multilib::flags_list Flags;
+  configureMultilibFlags(
+  Flags,
+  Args.hasFlag(options::OPT_fexceptions, options::OPT_fno_exceptions, true),
+  getSanitizerArgs(Args).needsAsanRt(),
+  getSanitizerArgs(Args).needsHwasanRt(),
+  Args.hasFlag(options::OPT_fexperimental_relative_cxx_abi_vtables,
+   options::OPT_fno_experimental_relative_cxx_abi_vtables,
+   false),
+  Args.getLastArgValue(options::OPT_fcxx_abi_EQ) == "itanium");
+
+  Multilibs.setFilePathsCallback(FilePaths);
+
+  if (Multilibs.select(Flags, SelectedMultilib))
+if (!SelectedMultilib.isDefault())
+  if (const auto &PathsCallback = Multilibs.filePathsCallback())
+for (const auto &Path : PathsCallback(SelectedMultilib))
+  // Prepend the multi

[PATCH] D139926: [clangd] Add semantic token for angle brackets

2023-01-30 Thread Christian Kandeler via Phabricator via cfe-commits
ckandeler updated this revision to Diff 493247.
ckandeler added a comment.

Support more cases as per review comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139926

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

Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
===
--- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
+++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
@@ -130,17 +130,17 @@
 )cpp",
   R"cpp(
   namespace $Namespace_decl[[abc]] {
-template
+template$Bracket[[<]]typename $TemplateParameter_def[[T]]$Bracket[[>]]
 struct $Class_def[[A]] {
   $TemplateParameter[[T]] $Field_decl[[t]];
 };
   }
-  template
-  struct $Class_def[[C]] : $Namespace[[abc]]::$Class[[A]]<$TemplateParameter[[T]]> {
+  template$Bracket[[<]]typename $TemplateParameter_def[[T]]$Bracket[[>]]
+  struct $Class_def[[C]] : $Namespace[[abc]]::$Class[[A]]$Bracket[[<]]$TemplateParameter[[T]]$Bracket[[>]] {
 typename $TemplateParameter[[T]]::$Type_dependentName[[A]]* $Field_decl[[D]];
   };
-  $Namespace[[abc]]::$Class[[A]] $Variable_def[[AA]];
-  typedef $Namespace[[abc]]::$Class[[A]] $Class_decl[[AAA]];
+  $Namespace[[abc]]::$Class[[A]]$Bracket[[<]]int$Bracket[[>]] $Variable_def[[AA]];
+  typedef $Namespace[[abc]]::$Class[[A]]$Bracket[[<]]int$Bracket[[>]] $Class_decl[[AAA]];
   struct $Class_def[[B]] {
 $Class_decl_constrDestr[[B]]();
 ~$Class_decl_constrDestr[[B]]();
@@ -243,36 +243,36 @@
   typedef float $Primitive_decl[[F]];
 )cpp",
   R"cpp(
-  template
+  template$Bracket[[<]]typename $TemplateParameter_def[[T]], typename = void$Bracket[[>]]
   class $Class_def[[A]] {
 $TemplateParameter[[T]] $Field_decl[[AA]];
 $TemplateParameter[[T]] $Method_decl[[foo]]();
   };
-  template
+  template$Bracket[[<]]class $TemplateParameter_def[[TT]]$Bracket[[>]]
   class $Class_def[[B]] {
-$Class[[A]]<$TemplateParameter[[TT]]> $Field_decl[[AA]];
+$Class[[A]]$Bracket[[<]]$TemplateParameter[[TT]]$Bracket[[>]] $Field_decl[[AA]];
   };
-  template
+  template$Bracket[[<]]class $TemplateParameter_def[[TT]], class $TemplateParameter_def[[GG]]$Bracket[[>]]
   class $Class_def[[BB]] {};
-  template
-  class $Class_def[[BB]]<$TemplateParameter[[T]], int> {};
-  template
-  class $Class_def[[BB]]<$TemplateParameter[[T]], $TemplateParameter[[T]]*> {};
+  template$Bracket[[<]]class $TemplateParameter_def[[T]]$Bracket[[>]]
+  class $Class_def[[BB]]$Bracket[[<]]$TemplateParameter[[T]], int$Bracket[[>]] {};
+  template$Bracket[[<]]class $TemplateParameter_def[[T]]$Bracket[[>]]
+  class $Class_def[[BB]]$Bracket[[<]]$TemplateParameter[[T]], $TemplateParameter[[T]]*$Bracket[[>]] {};
 
-  template class $TemplateParameter_def[[T]], class $TemplateParameter_def[[C]]>
-  $TemplateParameter[[T]]<$TemplateParameter[[C]]> $Function_decl[[f]]();
+  template$Bracket[[<]]template$Bracket[[<]]class$Bracket[[>]] class $TemplateParameter_def[[T]], class $TemplateParameter_def[[C]]$Bracket[[>]]
+  $TemplateParameter[[T]]$Bracket[[<]]$TemplateParameter[[C]]$Bracket[[>]] $Function_decl[[f]]();
 
-  template
+  template$Bracket[[<]]typename$Bracket[[>]]
   class $Class_def[[Foo]] {};
 
-  template
+  template$Bracket[[<]]typename $TemplateParameter_def[[T]]$Bracket[[>]]
   void $Function_decl[[foo]]($TemplateParameter[[T]] ...);
 )cpp",
   R"cpp(
-  template 
+  template $Bracket[[<]]class $TemplateParameter_def[[T]]$Bracket[[>]]
   struct $Class_def[[Tmpl]] {$TemplateParameter[[T]] $Field_decl[[x]] = 0;};
-  extern template struct $Class_def[[Tmpl]];
-  template struct $Class_def[[Tmpl]];
+  extern template struct $Class_def[[Tmpl]]$Bracket[[<]]float$Bracket[[>]];
+  template struct $Class_def[[Tmpl]]$Bracket[[<]]double$Bracket[[>]];
 )cpp",
   // This test is to guard against highlightings disappearing when using
   // conversion operators as their behaviour in the clang AST differ from
@@ -335,17 +335,17 @@
 )cpp",
   R"cpp(
   class $Class_def[[G]] {};
-  template<$Class[[G]] *$TemplateParameter_def_readonly[[U]]>
+  template$Bracket[[<]]$Class[[G]] *$TemplateParameter_def_readonly[[U]]$Bracket[[>]]
   class $Class_def[[GP]] {};
-  template<$Class[[G]] &$TemplateParameter_def_readonly[[U]]>
+  template$Bracket[[<]]$Class[[G]] &$TemplateParameter_def_readonly[[U]]$Bracket[[>]]
   class $Class_def[[GR]] {};
-  template
+  template$Bracket[[<]]int *$TemplateParameter_def_

[PATCH] D142816: [clang-tidy] Add --list-unique-checks command

2023-01-30 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp added a comment.

This is not as trivial as one might think. Check aliases aren't necessarily 
identical, as they can differ based on configuration settings, becoming 
essentially different checks. I have a WIP patch 
 to allow users to avoid running exact 
aliases (identical config). I think if we are going to add this kind of 
functionality it would be good to support that instead of only "listing" the 
checks - this still puts work on the user to remove the redundant checks. Might 
be worth starting an RFC discussion in Discourse to align before putting up 
patches (many similar patches have been put up already and failed due to lack 
of previous study/alignment).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142816

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


[PATCH] D128440: [WebAssembly] Initial support for reference type funcref in clang

2023-01-30 Thread Paulo Matos via Phabricator via cfe-commits
pmatos updated this revision to Diff 493251.
pmatos added a comment.

Rebase on main.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128440

Files:
  clang/include/clang/AST/DeclBase.h
  clang/include/clang/AST/Type.h
  clang/include/clang/Basic/AddressSpaces.h
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/BuiltinsWebAssembly.def
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/TokenKinds.def
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/DeclBase.cpp
  clang/lib/AST/Type.cpp
  clang/lib/AST/TypePrinter.cpp
  clang/lib/Basic/TargetInfo.cpp
  clang/lib/Basic/Targets/DirectX.h
  clang/lib/Basic/Targets/NVPTX.h
  clang/lib/Basic/Targets/SPIR.h
  clang/lib/Basic/Targets/TCE.h
  clang/lib/Basic/Targets/WebAssembly.h
  clang/lib/Basic/Targets/X86.h
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/CodeGen/TargetInfo.h
  clang/lib/Format/FormatToken.h
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Parse/ParseTentative.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaType.cpp
  clang/test/CodeGen/WebAssembly/wasm-funcref.c
  clang/test/Parser/wasm-funcref.c
  clang/test/SemaTemplate/address_space-dependent.cpp

Index: clang/test/SemaTemplate/address_space-dependent.cpp
===
--- clang/test/SemaTemplate/address_space-dependent.cpp
+++ clang/test/SemaTemplate/address_space-dependent.cpp
@@ -43,7 +43,7 @@
 
 template 
 void tooBig() {
-  __attribute__((address_space(I))) int *bounds; // expected-error {{address space is larger than the maximum supported (8388587)}}
+  __attribute__((address_space(I))) int *bounds; // expected-error {{address space is larger than the maximum supported (8388586)}}
 }
 
 template 
@@ -101,7 +101,7 @@
   car<1, 2, 3>(); // expected-note {{in instantiation of function template specialization 'car<1, 2, 3>' requested here}}
   HasASTemplateFields<1> HASTF;
   neg<-1>(); // expected-note {{in instantiation of function template specialization 'neg<-1>' requested here}}
-  correct<0x7FFFEA>();
+  correct<0x7FFFE9>();
   tooBig<8388650>(); // expected-note {{in instantiation of function template specialization 'tooBig<8388650L>' requested here}}
 
   __attribute__((address_space(1))) char *x;
Index: clang/test/Parser/wasm-funcref.c
===
--- /dev/null
+++ clang/test/Parser/wasm-funcref.c
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -triple powerpc-linux-gnu -fsyntax-only -verify %s
+
+// Test that we trigger an error at parse time if using keyword funcref
+// while not using a wasm triple.
+typedef void (*__funcref funcref_t)(); // expected-error {{invalid use of __funcref keyword outside the WebAssembly triple}}
+typedef int (*__funcref fn_funcref_t)(int);// expected-error {{invalid use of __funcref keyword outside the WebAssembly triple}}
+typedef int (*fn_t)(int);
+
+static fn_funcref_t nullFuncref = 0;
Index: clang/test/CodeGen/WebAssembly/wasm-funcref.c
===
--- /dev/null
+++ clang/test/CodeGen/WebAssembly/wasm-funcref.c
@@ -0,0 +1,84 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
+// RUN: %clang_cc1 -triple wasm32 -target-feature +reference-types -o - -emit-llvm %s | FileCheck %s
+
+typedef void (*__funcref funcref_t)();
+typedef int (*__funcref fn_funcref_t)(int);
+typedef int (*fn_t)(int);
+
+// Null funcref builtin call
+// CHECK-LABEL: @get_null(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = call ptr addrspace(20) @llvm.wasm.ref.null.func()
+// CHECK-NEXT:ret ptr addrspace(20) [[TMP0]]
+//
+funcref_t get_null() {
+  return __builtin_wasm_ref_null_func();
+}
+
+// Call to null funcref builtin but requires cast since
+// default return value for builtin is a funcref with function type () -> ().
+// CHECK-LABEL: @get_null_ii(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = call ptr addrspace(20) @llvm.wasm.ref.null.func()
+// CHECK-NEXT:ret ptr addrspace(20) [[TMP0]]
+//
+fn_funcref_t get_null_ii() {
+  return (fn_funcref_t) __builtin_wasm_ref_null_func();
+}
+
+// Identity function for funcref.
+// CHECK-LABEL: @identity(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[FN_ADDR:%.*]] = alloca ptr addrspace(20), align 4
+// CHECK-NEXT:store ptr addrspace(20) [[FN:%.*]], ptr [[FN_ADDR]], align 4
+// CHECK-NEXT:[[TMP0:%.*]] = load ptr addrspace(20), ptr [[FN_ADDR]], align 4
+// CHECK-NEXT:ret ptr addrspace(20) [[TMP0]]
+//
+funcref_t identity(funcref_t fn) {
+  return fn;
+}
+
+void helper(funcref_t);
+
+// Pass funcref ref as an argument to a helper function.
+// CHECK-LABEL: @handle(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[

[PATCH] D141133: [clang-tidy] Implement CppCoreGuideline F.54

2023-01-30 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp added inline comments.



Comment at: 
clang-tools-extra/clang-tidy/cppcoreguidelines/AvoidCaptureDefaultWhenCapturingThisCheck.cpp:81
+  Lambda->getCaptureDefaultLoc(),
+  "lambdas that capture 'this' should not specify a capture default");
+

njames93 wrote:
> Would be nice to show if `this` is implicitly captured.
Was this comment addressed? I see it marked as "Not Done".


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141133

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


[PATCH] D142757: [clang][driver] Do not warn about position of `/clang:-xc` in cl mode

2023-01-30 Thread Mariya Podchishchaeva via Phabricator via cfe-commits
Fznamznon updated this revision to Diff 493256.
Fznamznon added a comment.

Emit an error if `/clang:-x` passed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142757

Files:
  clang/lib/Driver/Driver.cpp
  clang/test/ClangScanDeps/Inputs/modules_cdb_clangcl_by_mod_name.json
  clang/test/Driver/x-args.c


Index: clang/test/Driver/x-args.c
===
--- clang/test/Driver/x-args.c
+++ clang/test/Driver/x-args.c
@@ -5,3 +5,8 @@
 // RUN: %clang -fsyntax-only -xc %s -xc++ -fsyntax-only 2>&1 | FileCheck %s
 // RUN: %clang -fsyntax-only %s -xc %s -xc++ -fsyntax-only 2>&1 | FileCheck %s
 // CHECK: '-x c++' after last input file has no effect
+
+// RUN: not %clang_cl /WX /clang:-xc /clang:-E /clang:-dM %s 2>&1 | FileCheck 
-check-prefix=CL %s
+// RUN: not %clang_cl /WX /clang:-E /clang:-dM %s /clang:-xc 2>&1 | FileCheck 
-check-prefix=CL %s
+// CL-NOT: '-x c' after last input file has no effect
+// CL: error: unsupported option '-x c'; did you mean '/TC' or '/TP'?
Index: clang/test/ClangScanDeps/Inputs/modules_cdb_clangcl_by_mod_name.json
===
--- clang/test/ClangScanDeps/Inputs/modules_cdb_clangcl_by_mod_name.json
+++ clang/test/ClangScanDeps/Inputs/modules_cdb_clangcl_by_mod_name.json
@@ -1,12 +1,12 @@
 [
 {
   "directory": "DIR",
-  "command": "clang-cl /E /IInputs /D INCLUDE_HEADER2 /clang:-MD /clang:-MF 
/clang:DIR/modules_cdb2_clangcl.d /clang:-fmodules /clang:-fcxx-modules 
/clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules 
/clang:-fimplicit-module-maps /clang:-x /clang:c++ --",
+  "command": "clang-cl /E /IInputs /D INCLUDE_HEADER2 /clang:-MD /clang:-MF 
/clang:DIR/modules_cdb2_clangcl.d /clang:-fmodules /clang:-fcxx-modules 
/clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules 
/clang:-fimplicit-module-maps /TP --",
   "file": ""
 },
 {
   "directory": "DIR",
-  "command": "clang-cl /E /IInputs /clang:-fmodules /clang:-fcxx-modules 
/clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules 
/clang:-fimplicit-module-maps /clang:-x /clang:c++ --",
+  "command": "clang-cl /E /IInputs /clang:-fmodules /clang:-fcxx-modules 
/clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules 
/clang:-fimplicit-module-maps /TP --",
   "file": ""
 },
 ]
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -2572,11 +2572,18 @@
   }
 
   // Warn -x after last input file has no effect
-  {
+  if (!IsCLMode()) {
 Arg *LastXArg = Args.getLastArgNoClaim(options::OPT_x);
 Arg *LastInputArg = Args.getLastArgNoClaim(options::OPT_INPUT);
-if (LastXArg && LastInputArg && LastInputArg->getIndex() < 
LastXArg->getIndex())
+if (LastXArg && LastInputArg &&
+LastInputArg->getIndex() < LastXArg->getIndex())
   Diag(clang::diag::warn_drv_unused_x) << LastXArg->getValue();
+  } else {
+// In CL mode suggest /TC or /TP since -x doesn't make sense if passed via
+// /clang:.
+if (auto *A = Args.getLastArg(options::OPT_x))
+  Diag(diag::err_drv_unsupported_opt_with_suggestion)
+  << A->getAsString(Args) << "/TC' or '/TP";
   }
 
   for (Arg *A : Args) {


Index: clang/test/Driver/x-args.c
===
--- clang/test/Driver/x-args.c
+++ clang/test/Driver/x-args.c
@@ -5,3 +5,8 @@
 // RUN: %clang -fsyntax-only -xc %s -xc++ -fsyntax-only 2>&1 | FileCheck %s
 // RUN: %clang -fsyntax-only %s -xc %s -xc++ -fsyntax-only 2>&1 | FileCheck %s
 // CHECK: '-x c++' after last input file has no effect
+
+// RUN: not %clang_cl /WX /clang:-xc /clang:-E /clang:-dM %s 2>&1 | FileCheck -check-prefix=CL %s
+// RUN: not %clang_cl /WX /clang:-E /clang:-dM %s /clang:-xc 2>&1 | FileCheck -check-prefix=CL %s
+// CL-NOT: '-x c' after last input file has no effect
+// CL: error: unsupported option '-x c'; did you mean '/TC' or '/TP'?
Index: clang/test/ClangScanDeps/Inputs/modules_cdb_clangcl_by_mod_name.json
===
--- clang/test/ClangScanDeps/Inputs/modules_cdb_clangcl_by_mod_name.json
+++ clang/test/ClangScanDeps/Inputs/modules_cdb_clangcl_by_mod_name.json
@@ -1,12 +1,12 @@
 [
 {
   "directory": "DIR",
-  "command": "clang-cl /E /IInputs /D INCLUDE_HEADER2 /clang:-MD /clang:-MF /clang:DIR/modules_cdb2_clangcl.d /clang:-fmodules /clang:-fcxx-modules /clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules /clang:-fimplicit-module-maps /clang:-x /clang:c++ --",
+  "command": "clang-cl /E /IInputs /D INCLUDE_HEADER2 /clang:-MD /clang:-MF /clang:DIR/modules_cdb2_clangcl.d /clang:-fmodules /clang:-fcxx-modules /clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimpli

[PATCH] D142228: [clangd] Disable tests that are incompatible with Windows

2023-01-30 Thread Andrew Ng via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2493a7016416: [clangd] Disable tests that are incompatible 
with Windows (authored by andrewng).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142228

Files:
  clang-tools-extra/clangd/test/dependency-output.test
  clang-tools-extra/clangd/test/did-change-configuration-params.test
  clang-tools-extra/clangd/test/test-uri-posix.test


Index: clang-tools-extra/clangd/test/test-uri-posix.test
===
--- clang-tools-extra/clangd/test/test-uri-posix.test
+++ clang-tools-extra/clangd/test/test-uri-posix.test
@@ -1,5 +1,5 @@
 # RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
-# UNSUPPORTED: target={{.*-windows-(gnu|msvc)}}
+# UNSUPPORTED: system-windows, target={{.*-windows-(gnu|msvc)}}
 # Test authority-less URI
 
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
 ---
Index: clang-tools-extra/clangd/test/did-change-configuration-params.test
===
--- clang-tools-extra/clangd/test/did-change-configuration-params.test
+++ clang-tools-extra/clangd/test/did-change-configuration-params.test
@@ -1,6 +1,6 @@
 # RUN: clangd -compile_args_from=lsp -lit-test < %s 2> %t | FileCheck 
-strict-whitespace %s
 # RUN: FileCheck --check-prefix=ERR --input-file=%t %s
-# UNSUPPORTED: target={{.*-windows-(gnu|msvc)}}
+# UNSUPPORTED: system-windows, target={{.*-windows-(gnu|msvc)}}
 
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
 ---
 
{"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"compilationDatabaseChanges":{"/clangd-test/foo.c":
 {"workingDirectory":"/clangd-test", "compilationCommand": ["clang", "-c", 
"foo.c"]}
Index: clang-tools-extra/clangd/test/dependency-output.test
===
--- clang-tools-extra/clangd/test/dependency-output.test
+++ clang-tools-extra/clangd/test/dependency-output.test
@@ -1,4 +1,4 @@
-# UNSUPPORTED: target={{.*-windows-(gnu|msvc)}}
+# UNSUPPORTED: system-windows, target={{.*-windows-(gnu|msvc)}}
 # RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
 
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
 ---


Index: clang-tools-extra/clangd/test/test-uri-posix.test
===
--- clang-tools-extra/clangd/test/test-uri-posix.test
+++ clang-tools-extra/clangd/test/test-uri-posix.test
@@ -1,5 +1,5 @@
 # RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
-# UNSUPPORTED: target={{.*-windows-(gnu|msvc)}}
+# UNSUPPORTED: system-windows, target={{.*-windows-(gnu|msvc)}}
 # Test authority-less URI
 {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
 ---
Index: clang-tools-extra/clangd/test/did-change-configuration-params.test
===
--- clang-tools-extra/clangd/test/did-change-configuration-params.test
+++ clang-tools-extra/clangd/test/did-change-configuration-params.test
@@ -1,6 +1,6 @@
 # RUN: clangd -compile_args_from=lsp -lit-test < %s 2> %t | FileCheck -strict-whitespace %s
 # RUN: FileCheck --check-prefix=ERR --input-file=%t %s
-# UNSUPPORTED: target={{.*-windows-(gnu|msvc)}}
+# UNSUPPORTED: system-windows, target={{.*-windows-(gnu|msvc)}}
 {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
 ---
 {"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"compilationDatabaseChanges":{"/clangd-test/foo.c": {"workingDirectory":"/clangd-test", "compilationCommand": ["clang", "-c", "foo.c"]}
Index: clang-tools-extra/clangd/test/dependency-output.test
===
--- clang-tools-extra/clangd/test/dependency-output.test
+++ clang-tools-extra/clangd/test/dependency-output.test
@@ -1,4 +1,4 @@
-# UNSUPPORTED: target={{.*-windows-(gnu|msvc)}}
+# UNSUPPORTED: system-windows, target={{.*-windows-(gnu|msvc)}}
 # RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
 {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
 ---
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] 2493a70 - [clangd] Disable tests that are incompatible with Windows

2023-01-30 Thread Andrew Ng via cfe-commits

Author: Andrew Ng
Date: 2023-01-30T10:44:32Z
New Revision: 2493a7016416c90038be5c816e12a7ad07cee054

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

LOG: [clangd] Disable tests that are incompatible with Windows

These tests explicitly make use of POSIX absolute paths.

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

Added: 


Modified: 
clang-tools-extra/clangd/test/dependency-output.test
clang-tools-extra/clangd/test/did-change-configuration-params.test
clang-tools-extra/clangd/test/test-uri-posix.test

Removed: 




diff  --git a/clang-tools-extra/clangd/test/dependency-output.test 
b/clang-tools-extra/clangd/test/dependency-output.test
index 32b439e520e5e..a53315809a5c4 100644
--- a/clang-tools-extra/clangd/test/dependency-output.test
+++ b/clang-tools-extra/clangd/test/dependency-output.test
@@ -1,4 +1,4 @@
-# UNSUPPORTED: target={{.*-windows-(gnu|msvc)}}
+# UNSUPPORTED: system-windows, target={{.*-windows-(gnu|msvc)}}
 # RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
 
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
 ---

diff  --git 
a/clang-tools-extra/clangd/test/did-change-configuration-params.test 
b/clang-tools-extra/clangd/test/did-change-configuration-params.test
index fd33f63818a28..ae0d37a347a25 100644
--- a/clang-tools-extra/clangd/test/did-change-configuration-params.test
+++ b/clang-tools-extra/clangd/test/did-change-configuration-params.test
@@ -1,6 +1,6 @@
 # RUN: clangd -compile_args_from=lsp -lit-test < %s 2> %t | FileCheck 
-strict-whitespace %s
 # RUN: FileCheck --check-prefix=ERR --input-file=%t %s
-# UNSUPPORTED: target={{.*-windows-(gnu|msvc)}}
+# UNSUPPORTED: system-windows, target={{.*-windows-(gnu|msvc)}}
 
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
 ---
 
{"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"compilationDatabaseChanges":{"/clangd-test/foo.c":
 {"workingDirectory":"/clangd-test", "compilationCommand": ["clang", "-c", 
"foo.c"]}

diff  --git a/clang-tools-extra/clangd/test/test-uri-posix.test 
b/clang-tools-extra/clangd/test/test-uri-posix.test
index 37d8a3d8e7a63..d321b96c3ca6c 100644
--- a/clang-tools-extra/clangd/test/test-uri-posix.test
+++ b/clang-tools-extra/clangd/test/test-uri-posix.test
@@ -1,5 +1,5 @@
 # RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
-# UNSUPPORTED: target={{.*-windows-(gnu|msvc)}}
+# UNSUPPORTED: system-windows, target={{.*-windows-(gnu|msvc)}}
 # Test authority-less URI
 
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
 ---



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


[PATCH] D142757: [clang][driver] Emit an error for `/clang:-x`

2023-01-30 Thread Mariya Podchishchaeva via Phabricator via cfe-commits
Fznamznon marked an inline comment as done.
Fznamznon added inline comments.



Comment at: clang/lib/Driver/Driver.cpp:2571
 // No driver mode exposes -x and /TC or /TP; we don't support mixing them.
 assert(!Args.hasArg(options::OPT_x) && "-x and /TC or /TP is not allowed");
   }

MaskRay wrote:
> ```
> -assert(!Args.hasArg(options::OPT_x) && "-x and /TC or /TP is not 
> allowed");
> +if (auto *A = Args.getLastArg(options::OPT_x))
> +  Diag(diag::err_drv_unsupported_opt_with_suggestion)
> +  << A->getAsString(Args) << "/TC' or '/TP";
> ```
Thank you, the suggestion seems reasonable to me. Although, the concrete place 
doesn't.
The suggested line to change is under if (we have /TC or /TP argument), so if I 
put error emission there it won't be emitted if no /TC or /TP was passed and 
the original problem reported in 
https://github.com/llvm/llvm-project/issues/59307 won't be resolved. People 
will still be confused by the warning saying `-x c` passed after last input 
when in fact they passed `/clang:-x` before the input.

Also, the whole function doesn't return even if diagnostic is emitted, so I put 
error emission in a way to not emit a warning saying that -x is passed after 
last input together with it, because both errors emitted like this:

error: '-x c' after last input file has no effect
error: unsupported option '-x c'; did you mean '/TC' or '/TP'?

look confusing.



Comment at: clang/test/Driver/x-args.c:8
 // CHECK: '-x c++' after last input file has no effect
+//
+// RUN: %clang_cl /WX /clang:-xc /clang:-E /clang:-dM %s 2>&1 | FileCheck 
-check-prefix=CL %s

MaskRay wrote:
> Delete `//`
> 
Done, thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142757

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


[PATCH] D141449: clang/OpenCL: Fix not setting convergent on block invoke kernels

2023-01-30 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm added a comment.

ping


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

https://reviews.llvm.org/D141449

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


[PATCH] D141620: clang/OpenCL: Apply default attributes to enqueued blocks

2023-01-30 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm added a comment.

ping


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

https://reviews.llvm.org/D141620

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


[PATCH] D141447: clang/OpenCL: Don't use a Function for the block type

2023-01-30 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm added a comment.

ping


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

https://reviews.llvm.org/D141447

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


[PATCH] D142872: Honor the fwrapv option when generating the inbounds GEP .

2023-01-30 Thread Nikita Popov via Phabricator via cfe-commits
nikic requested changes to this revision.
nikic added a comment.
This revision now requires changes to proceed.

CreateConstArrayGEP currently always creates an inbounds GEP. You need to 
modify it make inbounds option / use a different method, not supress it in the 
constant folding infrastructure.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142872

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


[PATCH] D139010: [clang][WebAssembly] Implement support for table types and builtins

2023-01-30 Thread Paulo Matos via Phabricator via cfe-commits
pmatos updated this revision to Diff 493264.
pmatos added a comment.

Rebase on main and fix a test diagnostic expectation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139010

Files:
  clang/include/clang/AST/Expr.h
  clang/include/clang/AST/Stmt.h
  clang/include/clang/AST/Type.h
  clang/include/clang/Basic/BuiltinsWebAssembly.def
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/Specifiers.h
  clang/include/clang/Sema/Sema.h
  clang/include/clang/Serialization/ASTBitCodes.h
  clang/include/clang/Serialization/TypeBitCodes.def
  clang/lib/AST/TextNodeDumper.cpp
  clang/lib/AST/Type.cpp
  clang/lib/Basic/Targets/WebAssembly.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGValue.h
  clang/lib/Sema/SemaCast.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaExceptionSpec.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/SemaType.cpp
  clang/test/CodeGen/WebAssembly/builtins-table.c
  clang/test/CodeGen/WebAssembly/table.c
  clang/test/Sema/builtins-wasm.c
  clang/test/Sema/wasm-refs.c
  clang/test/SemaCXX/wasm-refs-and-tables.cpp
  clang/test/SemaCXX/wasm-refs.cpp
  llvm/include/llvm/CodeGen/WasmAddressSpaces.h
  llvm/include/llvm/IR/Type.h
  llvm/lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.cpp
  llvm/lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.h
  llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyLowerRefTypesIntPtrConv.cpp

Index: llvm/lib/Target/WebAssembly/WebAssemblyLowerRefTypesIntPtrConv.cpp
===
--- llvm/lib/Target/WebAssembly/WebAssemblyLowerRefTypesIntPtrConv.cpp
+++ llvm/lib/Target/WebAssembly/WebAssemblyLowerRefTypesIntPtrConv.cpp
@@ -62,8 +62,9 @@
   for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) {
 PtrToIntInst *PTI = dyn_cast(&*I);
 IntToPtrInst *ITP = dyn_cast(&*I);
-if (!(PTI && WebAssembly::isRefType(PTI->getPointerOperand()->getType())) &&
-!(ITP && WebAssembly::isRefType(ITP->getDestTy(
+if (!(PTI &&
+  PTI->getPointerOperand()->getType()->isWebAssemblyReferenceType()) &&
+!(ITP && ITP->getDestTy()->isWebAssemblyReferenceType()))
   continue;
 
 UndefValue *U = UndefValue::get(I->getType());
Index: llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
===
--- llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
+++ llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
@@ -1202,7 +1202,7 @@
   // Lastly, if this is a call to a funcref we need to add an instruction
   // table.set to the chain and transform the call.
   if (CLI.CB &&
-  WebAssembly::isFuncrefType(CLI.CB->getCalledOperand()->getType())) {
+  CLI.CB->getCalledOperand()->getType()->isWebAssemblyFuncrefType()) {
 // In the absence of function references proposal where a funcref call is
 // lowered to call_ref, using reference types we generate a table.set to set
 // the funcref to a special table used solely for this purpose, followed by
Index: llvm/lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.h
===
--- llvm/lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.h
+++ llvm/lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.h
@@ -45,43 +45,6 @@
   Multivalue = 0x,
 };
 
-enum WasmAddressSpace : unsigned {
-  // Default address space, for pointers to linear memory (stack, heap, data).
-  WASM_ADDRESS_SPACE_DEFAULT = 0,
-  // A non-integral address space for pointers to named objects outside of
-  // linear memory: WebAssembly globals or WebAssembly locals.  Loads and stores
-  // to these pointers are lowered to global.get / global.set or local.get /
-  // local.set, as appropriate.
-  WASM_ADDRESS_SPACE_VAR = 1,
-  // A non-integral address space for externref values
-  WASM_ADDRESS_SPACE_EXTERNREF = 10,
-  // A non-integral address space for funcref values
-  WASM_ADDRESS_SPACE_FUNCREF = 20,
-};
-
-inline bool isDefaultAddressSpace(unsigned AS) {
-  return AS == WASM_ADDRESS_SPACE_DEFAULT;
-}
-inline bool isWasmVarAddressSpace(unsigned AS) {
-  return AS == WASM_ADDRESS_SPACE_VAR;
-}
-inline bool isValidAddressSpace(unsigned AS) {
-  return isDefaultAddressSpace(AS) || isWasmVarAddressSpace(AS);
-}
-inline bool isFuncrefType(const Type *Ty) {
-  return isa(Ty) &&
- Ty->getPointerAddressSpace() ==
- WasmAddressSpace::WASM_ADDRESS_SPACE_FUNCREF;
-}
-inline bool isExternrefType(const Type *Ty) {
-  return isa(Ty) &&
- Ty->getPointerAddressSpace() ==
- WasmAddressSpace::WASM_ADDRESS_SPACE_EXTERNREF;
-}

[PATCH] D142804: [clang-format] Support clang-format on/off line comments as prefixes

2023-01-30 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments.



Comment at: clang/lib/Format/Format.cpp:3893
 
+bool isClangFormatOn(StringRef Comment) {
+  if (Comment == "/* clang-format on */")

alexolog wrote:
> owenpan wrote:
> > alexolog wrote:
> > > alexolog wrote:
> > > > Here's my attempt at something flexible:
> > > > Disclaimer: this is my first time looking at the LLVM codebase, so 
> > > > don't expect production quality.
> > > > 
> > > > ```
> > > > 
> > > > 
> > > > // Implementation detail, hide in a namespace and/or take out of the 
> > > > header
> > > > bool isClangFormatMarked(StringRef Comment, StringRef Mark) {
> > > >   // Quick heuristics: minimum length and starts with a slash (comment)
> > > >   // Shortest tag: "//clang-format on", 17 characters
> > > >   static constexpr StringLiteral clangFormatStr("clang-format ");
> > > >   if (Comment.size() < clangFormatStr.size() + 4 || Comment[0] != '/')
> > > > return false;
> > > > 
> > > >   // check if it's a comment starting with "//" or "/*"
> > > >   bool CloseNeeded = false;
> > > >   if (Comment[1] == '*')
> > > > CloseNeeded = true;
> > > >   else if (Comment[1] != '/')
> > > > return false;
> > > > 
> > > >   // Remove the comment start and all following whitespace
> > > >   Comment = Comment.substr(2).ltrim();
> > > > 
> > > >   // Check for the actual command, a piece at a time
> > > >   if (!Comment.consume_front(clangFormatStr) || 
> > > > !Comment.consume_front(Mark))
> > > > return false;
> > > > 
> > > >   // Are we there yet?
> > > >   if (!CloseNeeded && Comment.empty() ||
> > > >   CloseNeeded && Comment.starts_with("*/"))
> > > > return true;
> > > > 
> > > >   // For a trailer, restrict the next character
> > > >   // (currently spaces and tabs, but can include a colon, etc.)
> > > >   static constexpr StringLiteral Separator(" \t");
> > > >   if (!Separator.contains(Comment[0]))
> > > > return false;
> > > >   
> > > >   // Verify comment is properly terminated
> > > >   if (!CloseNeeded || Comment.contains("*/"))
> > > > return true;
> > > > 
> > > >   return false; // Everything else
> > > > }
> > > > 
> > > > 
> > > > 
> > > > bool isClangFormatOn(StringRef Comment) {
> > > >   return isClangFormatMarked(Comment, "on");
> > > > }
> > > > 
> > > > bool isClangFormatOff(StringRef Comment) {
> > > >   return isClangFormatMarked(Comment, "off");
> > > > }
> > > > 
> > > > 
> > > > 
> > > >   EXPECT_TRUE(isClangFormatOn("//clang-format on"));
> > > >   EXPECT_TRUE(isClangFormatOn("// clang-format on"));
> > > >   EXPECT_TRUE(isClangFormatOn("//clang-format on "));
> > > >   EXPECT_TRUE(isClangFormatOn("//clang-format on and off"));
> > > >   EXPECT_TRUE(isClangFormatOn("/*clang-format on*/"));
> > > >   EXPECT_TRUE(isClangFormatOn("/* clang-format on*/"));
> > > >   EXPECT_TRUE(isClangFormatOn("/*clang-format on */"));
> > > >   EXPECT_TRUE(isClangFormatOn("/*clang-format on*/int i{0};"));
> > > > 
> > > >   EXPECT_FALSE(isClangFormatOn("//clang-format  on"));
> > > >   EXPECT_FALSE(isClangFormatOn("//clang-format o"));
> > > >   EXPECT_FALSE(isClangFormatOn("// clang-format o"));
> > > >   EXPECT_FALSE(isClangFormatOn("//clang-format ontario"));
> > > >   EXPECT_FALSE(isClangFormatOn("//clang-format off"));
> > > >   EXPECT_FALSE(isClangFormatOn("/*clang-format onwards*/"));
> > > > 
> > > > 
> > > > ```
> > > Sorry about the "done".  My misunderstanding
> > > Here's my attempt at something flexible:
> > > Disclaimer: this is my first time looking at the LLVM codebase, so don't 
> > > expect production quality.
> > 
> > Thanks! If we didn't have to worry about regressions, we might want to do 
> > something like what you suggested above.
> Isn't it what extensive test coverage is for?
I meant the regression of behavior.


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

https://reviews.llvm.org/D142804

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


[PATCH] D142872: Honor the fwrapv option when generating the inbounds GEP .

2023-01-30 Thread Nikita Popov via Phabricator via cfe-commits
nikic added a comment.

You also shouldn't need to introduce any new handling for the fwrapv option. 
I'm not sure how exactly it is currently threaded through, but there must be 
existing handling for it already. For example, there is 
isSignedOverflowDefined() on LangOptions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142872

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


[PATCH] D135405: fix handling of braced-init temporaries for modernize-use-emplace

2023-01-30 Thread Peter Wolf via Phabricator via cfe-commits
BigPeet added a comment.

Ping?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135405

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


[PATCH] D142826: [Clang] Add -Wtype-limits to -Wextra for GCC compatibility

2023-01-30 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a reviewer: clang-vendors.
aaron.ballman added a comment.

Heh, I literally started working on this on Friday afternoon. :-D

There's a failing CI case that needs to be addressed: 
Sema/tautological-constant-compare.c  -- IIRC, fixing that should suffice for 
test coverage. This should also have a release note.

Also, I'm adding `clang-vendors` not because I think this is a potentially 
*breaking* change, but because it could be potentially disruptive due to adding 
to `-Wextra` when we've not really changed that much in recent history.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142826

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


[PATCH] D142872: Honor the fwrapv option when generating the inbounds GEP .

2023-01-30 Thread Umesh Kalappa via Phabricator via cfe-commits
umesh.kalappa0 updated this revision to Diff 493282.
umesh.kalappa0 edited the summary of this revision.

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

https://reviews.llvm.org/D142872

Files:
  clang/lib/CodeGen/CGExpr.cpp
  clang/test/CodeGen/inbounds.c
  llvm/include/llvm/IR/ConstantFold.h
  llvm/lib/IR/ConstantFold.cpp
  llvm/lib/IR/Constants.cpp


Index: llvm/lib/IR/Constants.cpp
===
--- llvm/lib/IR/Constants.cpp
+++ llvm/lib/IR/Constants.cpp
@@ -2510,7 +2510,9 @@
 ArgVec.push_back(Idx);
   }
 
-  unsigned SubClassOptionalData = InBounds ? GEPOperator::IsInBounds : 0;
+  unsigned SubClassOptionalData = ( InBounds && !llvm::getSignedWrap() ) ?
+  GEPOperator::IsInBounds : 0;
+
   if (InRangeIndex && *InRangeIndex < 63)
 SubClassOptionalData |= (*InRangeIndex + 1) << 1;
   const ConstantExprKeyType Key(Instruction::GetElementPtr, ArgVec, 0,
Index: llvm/lib/IR/ConstantFold.cpp
===
--- llvm/lib/IR/ConstantFold.cpp
+++ llvm/lib/IR/ConstantFold.cpp
@@ -347,6 +347,14 @@
   }
 }
 
+bool llvm::getSignedWrap() {
+  return llvm::SignedWrap;
+}
+
+void llvm::setSignedWrap(bool SignedWrap) {
+  llvm::SignedWrap=SignedWrap;
+}
+
 Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V,
 Type *DestTy) {
   if (isa(V))
Index: llvm/include/llvm/IR/ConstantFold.h
===
--- llvm/include/llvm/IR/ConstantFold.h
+++ llvm/include/llvm/IR/ConstantFold.h
@@ -26,10 +26,15 @@
 
 namespace llvm {
   template  class ArrayRef;
+  inline bool SignedWrap = false;
+
   class Value;
   class Constant;
   class Type;
 
+  bool getSignedWrap(void);
+  void setSignedWrap(bool Wrap);
+
   // Constant fold various types of instruction...
   Constant *ConstantFoldCastInstruction(
 unsigned opcode, ///< The opcode of the cast
Index: clang/test/CodeGen/inbounds.c
===
--- /dev/null
+++ clang/test/CodeGen/inbounds.c
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fwrapv -emit-llvm -o - %s 
| FileCheck %s 
+
+extern char base[];
+
+char *test() {
+return base + 1;
+}
+
+// CHECK: ret ptr getelementptr   (i8, ptr @base, i64 1)
Index: clang/lib/CodeGen/CGExpr.cpp
===
--- clang/lib/CodeGen/CGExpr.cpp
+++ clang/lib/CodeGen/CGExpr.cpp
@@ -3613,7 +3613,12 @@
   if (!E->getType()->isVariableArrayType()) {
 assert(isa(Addr.getElementType()) &&
"Expected pointer to array");
+
+if (getLangOpts().isSignedOverflowDefined())
+  llvm::setSignedWrap(true);
+
 Addr = Builder.CreateConstArrayGEP(Addr, 0, "arraydecay");
+
   }
 
   // The result of this decay conversion points to an array element within the


Index: llvm/lib/IR/Constants.cpp
===
--- llvm/lib/IR/Constants.cpp
+++ llvm/lib/IR/Constants.cpp
@@ -2510,7 +2510,9 @@
 ArgVec.push_back(Idx);
   }
 
-  unsigned SubClassOptionalData = InBounds ? GEPOperator::IsInBounds : 0;
+  unsigned SubClassOptionalData = ( InBounds && !llvm::getSignedWrap() ) ?
+	   GEPOperator::IsInBounds : 0;
+
   if (InRangeIndex && *InRangeIndex < 63)
 SubClassOptionalData |= (*InRangeIndex + 1) << 1;
   const ConstantExprKeyType Key(Instruction::GetElementPtr, ArgVec, 0,
Index: llvm/lib/IR/ConstantFold.cpp
===
--- llvm/lib/IR/ConstantFold.cpp
+++ llvm/lib/IR/ConstantFold.cpp
@@ -347,6 +347,14 @@
   }
 }
 
+bool llvm::getSignedWrap() {
+  return llvm::SignedWrap;
+}
+
+void llvm::setSignedWrap(bool SignedWrap) {
+  llvm::SignedWrap=SignedWrap;
+}
+
 Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V,
 Type *DestTy) {
   if (isa(V))
Index: llvm/include/llvm/IR/ConstantFold.h
===
--- llvm/include/llvm/IR/ConstantFold.h
+++ llvm/include/llvm/IR/ConstantFold.h
@@ -26,10 +26,15 @@
 
 namespace llvm {
   template  class ArrayRef;
+  inline bool SignedWrap = false;
+
   class Value;
   class Constant;
   class Type;
 
+  bool getSignedWrap(void);
+  void setSignedWrap(bool Wrap);
+
   // Constant fold various types of instruction...
   Constant *ConstantFoldCastInstruction(
 unsigned opcode, ///< The opcode of the cast
Index: clang/test/CodeGen/inbounds.c
===
--- /dev/null
+++ clang/test/CodeGen/inbounds.c
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fwrapv -emit-llvm -o - %s | FileCheck %s 
+
+extern char base[];
+
+char *test() {
+return base + 1;
+}
+
+// CHECK: ret 

[PATCH] D142872: Honor the fwrapv option when generating the inbounds GEP .

2023-01-30 Thread Umesh Kalappa via Phabricator via cfe-commits
umesh.kalappa0 added a comment.

In D142872#4090317 , @nikic wrote:

> You also shouldn't need to introduce any new handling for the fwrapv option. 
> I'm not sure how exactly it is currently threaded through, but there must be 
> existing handling for it already. For example, there is 
> isSignedOverflowDefined() on LangOptions.

Make sense here .


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

https://reviews.llvm.org/D142872

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


[PATCH] D142872: Honor the fwrapv option when generating the inbounds GEP .

2023-01-30 Thread Umesh Kalappa via Phabricator via cfe-commits
umesh.kalappa0 added a comment.

In D142872#4090304 , @nikic wrote:

> CreateConstArrayGEP currently always creates an inbounds GEP. You need to 
> modify it make inbounds optional or use a different method, not suppress it 
> in the constant folding infrastructure.

Thank you very much for the feedback and

We tried calling other overload like "CreateConstGEP" ,but that didn't help due 
to  below call from "ConstantFoldGetElementPtr" ,that was recursive call from   
"ConstantExpr::getGetElementPtr" .

>> return ConstantExpr::getGetElementPtr(PointeeTy, C, Idxs, /*InBounds=*/true, 
>> InRangeIndex);

So we thought of disabling the call like "ConstantExpr::getGetElementPtr"  with 
InBounds=true  for wrapv and changes  has its consensus so we end up changes 
that is shared  for review.


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

https://reviews.llvm.org/D142872

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


[PATCH] D141447: clang/OpenCL: Don't use a Function for the block type

2023-01-30 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added inline comments.



Comment at: clang/lib/CodeGen/TargetInfo.cpp:12477-12480
+  F->setCallingConv(llvm::CallingConv::AMDGPU_KERNEL);
+
+  // FIXME: Apply default attributes
+  F->addFnAttr(llvm::Attribute::NoUnwind);

need a test


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

https://reviews.llvm.org/D141447

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


[PATCH] D141447: clang/OpenCL: Don't use a Function for the block type

2023-01-30 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm added inline comments.



Comment at: clang/lib/CodeGen/TargetInfo.cpp:12477-12480
+  F->setCallingConv(llvm::CallingConv::AMDGPU_KERNEL);
+
+  // FIXME: Apply default attributes
+  F->addFnAttr(llvm::Attribute::NoUnwind);

yaxunl wrote:
> need a test
It's already tested, I recommitted the regression test in 
7f2f6eec3ead9c5715c86159919d6df182d1cc4d. This is supposed to be NFC


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

https://reviews.llvm.org/D141447

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


[PATCH] D141620: clang/OpenCL: Apply default attributes to enqueued blocks

2023-01-30 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added inline comments.



Comment at: clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl:381
+// GFX900-LABEL: define {{[^@]+}}@callee
+// GFX900-SAME: (i64 noundef [[ID:%.*]], ptr addrspace(1) noundef [[OUT:%.*]]) 
#[[ATTR1:[0-9]+]] {
+// GFX900-NEXT:  entry:

these attributes are not really checked since ATTR1 etc are not used to check 
the attributes definitions. Is this a bug of update_cc_test_checks.py ? Or it 
is expected to be manually edited to enforce the checking?


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

https://reviews.llvm.org/D141620

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


[PATCH] D141447: clang/OpenCL: Don't use a Function for the block type

2023-01-30 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl accepted this revision.
yaxunl added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks.


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

https://reviews.llvm.org/D141447

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


[PATCH] D141133: [clang-tidy] Implement CppCoreGuideline F.54

2023-01-30 Thread Chris Cotter via Phabricator via cfe-commits
ccotter marked 2 inline comments as done.
ccotter added inline comments.



Comment at: 
clang-tools-extra/clang-tidy/cppcoreguidelines/AvoidCaptureDefaultWhenCapturingThisCheck.cpp:81
+  Lambda->getCaptureDefaultLoc(),
+  "lambdas that capture 'this' should not specify a capture default");
+

carlosgalvezp wrote:
> njames93 wrote:
> > Would be nice to show if `this` is implicitly captured.
> Was this comment addressed? I see it marked as "Not Done".
oh yes, I forgot to mark addressed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141133

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


[PATCH] D142799: [Clang] Fix unconditional access to Attr pointer when checking if _Nullable is applicable to a type

2023-01-30 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr2 accepted this revision.
gribozavr2 added a comment.
This revision is now accepted and ready to land.

Thank you for the fix!


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

https://reviews.llvm.org/D142799

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


[PATCH] D141449: clang/OpenCL: Fix not setting convergent on block invoke kernels

2023-01-30 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl accepted this revision.
yaxunl added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks


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

https://reviews.llvm.org/D141449

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


[PATCH] D142799: [Clang] Fix unconditional access to Attr pointer when checking if _Nullable is applicable to a type

2023-01-30 Thread Erich Keane via Phabricator via cfe-commits
erichkeane accepted this revision.
erichkeane added a comment.

Needs a release note, otherwise LGTM.


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

https://reviews.llvm.org/D142799

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


[PATCH] D136886: [clang] ASTImporter: Fix importing of va_list types and declarations

2023-01-30 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

In D136886#4087953 , @vabridgers 
wrote:

> @mizvekov, will you be picking this change up and finishing this, or do you 
> mind if I have a go at finishing this patch? Thanks

@mizvekov has been away from the community for a while, and I'm not sure when 
he's coming back.  I'd suspect that if you have interest in fixing it, that 
you're welcome to take it over!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136886

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


[PATCH] D142890: [clangd] Add config option for fast diagnostics mode

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

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142890

Files:
  clang-tools-extra/clangd/Config.h
  clang-tools-extra/clangd/ConfigCompile.cpp
  clang-tools-extra/clangd/ConfigFragment.h
  clang-tools-extra/clangd/ConfigYAML.cpp
  clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
  clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp
  clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp

Index: clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp
===
--- clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp
+++ clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp
@@ -538,7 +538,7 @@
 void foo() {}
   )cpp");
   Config Cfg;
-  Cfg.Diagnostics.UnusedIncludes = Config::Experiment;
+  Cfg.Diagnostics.UnusedIncludes = Config::UnusedIncludesPolicy::Experiment;
   WithContextValue Ctx(Config::Key, std::move(Cfg));
   ParsedAST AST = TU.build();
 
@@ -627,7 +627,7 @@
   TU.ExtraArgs.emplace_back("-xobjective-c");
 
   Config Cfg;
-  Cfg.Diagnostics.UnusedIncludes = Config::Strict;
+  Cfg.Diagnostics.UnusedIncludes = Config::UnusedIncludesPolicy::Strict;
   WithContextValue Ctx(Config::Key, std::move(Cfg));
   ParsedAST AST = TU.build();
   EXPECT_THAT(AST.getDiagnostics(), llvm::ValueIs(IsEmpty()));
Index: clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp
===
--- clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp
+++ clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp
@@ -273,6 +273,31 @@
   EXPECT_THAT(Results[0].Style.FullyQualifiedNamespaces,
   ElementsAre(val("foo"), val("bar")));
 }
+
+TEST(ParseYAML, DiagnosticsMode) {
+  CapturedDiags Diags;
+  {
+Annotations YAML(R"yaml(
+Diagnostics:
+  Mode: Fast)yaml");
+auto Results =
+Fragment::parseYAML(YAML.code(), "config.yaml", Diags.callback());
+ASSERT_THAT(Diags.Diagnostics, IsEmpty());
+ASSERT_EQ(Results.size(), 1u);
+EXPECT_THAT(Results[0].Diagnostics.Mode, llvm::ValueIs(val("Fast")));
+  }
+
+  {
+Annotations YAML(R"yaml(
+Diagnostics:
+  Mode: Strict)yaml");
+auto Results =
+Fragment::parseYAML(YAML.code(), "config.yaml", Diags.callback());
+ASSERT_THAT(Diags.Diagnostics, IsEmpty());
+ASSERT_EQ(Results.size(), 1u);
+EXPECT_THAT(Results[0].Diagnostics.Mode, llvm::ValueIs(val("Strict")));
+  }
+}
 } // namespace
 } // namespace config
 } // namespace clangd
Index: clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
===
--- clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
+++ clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
@@ -543,6 +543,23 @@
   EXPECT_TRUE(compileAndApply());
   EXPECT_THAT(Conf.Style.FullyQualifiedNamespaces, ElementsAre("foo", "bar"));
 }
+
+TEST_F(ConfigCompileTests, DiagnosticsMode) {
+  Frag = {};
+  EXPECT_TRUE(compileAndApply());
+  // Defaults to Strict.
+  EXPECT_EQ(Conf.Diagnostics.Mode, Config::DiagnosticsMode::Strict);
+
+  Frag.Diagnostics.Mode.emplace("Fast");
+  EXPECT_TRUE(compileAndApply());
+  // Defaults to Strict.
+  EXPECT_EQ(Conf.Diagnostics.Mode, Config::DiagnosticsMode::Fast);
+
+  Frag.Diagnostics.Mode.emplace("Strict");
+  EXPECT_TRUE(compileAndApply());
+  // Defaults to Strict.
+  EXPECT_EQ(Conf.Diagnostics.Mode, Config::DiagnosticsMode::Strict);
+}
 } // namespace
 } // namespace config
 } // namespace clangd
Index: clang-tools-extra/clangd/ConfigYAML.cpp
===
--- clang-tools-extra/clangd/ConfigYAML.cpp
+++ clang-tools-extra/clangd/ConfigYAML.cpp
@@ -130,6 +130,7 @@
 });
 Dict.handle("Includes", [&](Node &N) { parse(F.Includes, N); });
 Dict.handle("ClangTidy", [&](Node &N) { parse(F.ClangTidy, N); });
+Dict.handle("Mode", [&](Node &N) { F.Mode = scalarValue(N, "Mode"); });
 Dict.parse(N);
   }
 
@@ -268,7 +269,7 @@
 // If Key is seen twice, Parse runs only once and an error is reported.
 void handle(llvm::StringLiteral Key, std::function Parse) {
   for (const auto &Entry : Keys) {
-(void) Entry;
+(void)Entry;
 assert(Entry.first != Key && "duplicate key handler");
   }
   Keys.emplace_back(Key, std::move(Parse));
Index: clang-tools-extra/clangd/ConfigFragment.h
===
--- clang-tools-extra/clangd/ConfigFragment.h
+++ clang-tools-extra/clangd/ConfigFragment.h
@@ -232,9 +232,16 @@
 ///
 /// Valid values are:
 /// - Strict
+/// - Experiment
 /// - None
 std::optional> Un

[PATCH] D142891: [clang-format] Recognize Verilog non-blocking assignment

2023-01-30 Thread sstwcw via Phabricator via cfe-commits
sstwcw created this revision.
sstwcw added reviewers: HazardyKnusperkeks, MyDeveloperDay, curdeius, owenpan.
Herald added a project: All.
sstwcw requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142891

Files:
  clang/lib/Format/TokenAnnotator.cpp
  clang/lib/Format/WhitespaceManager.cpp
  clang/unittests/Format/FormatTestVerilog.cpp
  clang/unittests/Format/TokenAnnotatorTest.cpp

Index: clang/unittests/Format/TokenAnnotatorTest.cpp
===
--- clang/unittests/Format/TokenAnnotatorTest.cpp
+++ clang/unittests/Format/TokenAnnotatorTest.cpp
@@ -1247,6 +1247,21 @@
   EXPECT_TOKEN(Tokens[5], tok::question, TT_ConditionalExpr);
   EXPECT_TOKEN(Tokens[7], tok::colon, TT_ConditionalExpr);
   EXPECT_TOKEN(Tokens[9], tok::colon, TT_GotoLabelColon);
+  // Non-blocking assignments.
+  Tokens = Annotate("a <= b;");
+  ASSERT_EQ(Tokens.size(), 5u);
+  EXPECT_TOKEN(Tokens[1], tok::lessequal, TT_BinaryOperator);
+  EXPECT_TOKEN_PRECEDENCE(Tokens[1], prec::Assignment);
+  Tokens = Annotate("if (a <= b) break;");
+  ASSERT_EQ(Tokens.size(), 9u);
+  EXPECT_TOKEN(Tokens[3], tok::lessequal, TT_BinaryOperator);
+  EXPECT_TOKEN_PRECEDENCE(Tokens[3], prec::Relational);
+  Tokens = Annotate("a <= b <= a;");
+  ASSERT_EQ(Tokens.size(), 7u);
+  EXPECT_TOKEN(Tokens[1], tok::lessequal, TT_BinaryOperator);
+  EXPECT_TOKEN_PRECEDENCE(Tokens[1], prec::Assignment);
+  EXPECT_TOKEN(Tokens[3], tok::lessequal, TT_BinaryOperator);
+  EXPECT_TOKEN_PRECEDENCE(Tokens[3], prec::Relational);
 }
 
 TEST_F(TokenAnnotatorTest, UnderstandConstructors) {
Index: clang/unittests/Format/FormatTestVerilog.cpp
===
--- clang/unittests/Format/FormatTestVerilog.cpp
+++ clang/unittests/Format/FormatTestVerilog.cpp
@@ -45,6 +45,58 @@
   }
 };
 
+TEST_F(FormatTestVerilog, Align) {
+  FormatStyle Style = getLLVMStyle(FormatStyle::LK_Verilog);
+  Style.AlignConsecutiveAssignments.Enabled = true;
+  verifyFormat("x<= x;\n"
+   "sfdbddfbdfbb <= x;\n"
+   "x = x;",
+   Style);
+  verifyFormat("x= x;\n"
+   "sfdbddfbdfbb = x;\n"
+   "x= x;",
+   Style);
+  // Compound assignments are not aligned by default. '<=' is not a compound
+  // assignment.
+  verifyFormat("x<= x;\n"
+   "sfdbddfbdfbb <= x;",
+   Style);
+  verifyFormat("x += x;\n"
+   "sfdbddfbdfbb <= x;",
+   Style);
+  verifyFormat("x <<= x;\n"
+   "sfdbddfbdfbb <= x;",
+   Style);
+  verifyFormat("x <<<= x;\n"
+   "sfdbddfbdfbb <= x;",
+   Style);
+  verifyFormat("x >>= x;\n"
+   "sfdbddfbdfbb <= x;",
+   Style);
+  verifyFormat("x >>>= x;\n"
+   "sfdbddfbdfbb <= x;",
+   Style);
+  Style.AlignConsecutiveAssignments.AlignCompound = true;
+  verifyFormat("x<= x;\n"
+   "sfdbddfbdfbb <= x;",
+   Style);
+  verifyFormat("x+= x;\n"
+   "sfdbddfbdfbb <= x;",
+   Style);
+  verifyFormat("x<<= x;\n"
+   "sfdbddfbdfbb  <= x;",
+   Style);
+  verifyFormat("x<<<= x;\n"
+   "sfdbddfbdfbb   <= x;",
+   Style);
+  verifyFormat("x>>= x;\n"
+   "sfdbddfbdfbb  <= x;",
+   Style);
+  verifyFormat("x>>>= x;\n"
+   "sfdbddfbdfbb   <= x;",
+   Style);
+}
+
 TEST_F(FormatTestVerilog, BasedLiteral) {
   verifyFormat("x = '0;");
   verifyFormat("x = '1;");
Index: clang/lib/Format/WhitespaceManager.cpp
===
--- clang/lib/Format/WhitespaceManager.cpp
+++ clang/lib/Format/WhitespaceManager.cpp
@@ -838,7 +838,12 @@
 
 return Style.AlignConsecutiveAssignments.AlignCompound
? C.Tok->getPrecedence() == prec::Assignment
-   : C.Tok->is(tok::equal);
+   : C.Tok->is(tok::equal) ||
+ // In Verilog the '<=' is not a compound assignment,
+ // thus it is aligned even when the AlignCompound
+ // option is not set.
+ (Style.isVerilog() && C.Tok->is(tok::lessequal) &&
+  C.Tok->getPrecedence() == prec::Assignment);
   },
   Changes, /*StartAt=*/0, Style.AlignConsecutiveAssignments,
   /*RightJustify=*/true);
Index: clang/lib/Format/TokenAnnotator.cpp
===
--- clang/lib/Format/TokenAnnotator.cpp
+++ clang/lib/Format/TokenAnnotator.cpp
@@ -1625,6 +1625,7 @@
 bool CaretFound = false;
 bool InCpp11Attribut

[PATCH] D142892: [clangd] Publish diagnostics from stale preambles

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

Diagnostics emitted while parsing main-file is easy, as they already
see new source locations. We just need to make sure the ones that can be
attributed to preamble section of the file is patched. That's achieved in two
ways:

- New include is actually patched with a #line-directive, so most clang 
features already point at the right line.
- Patching of main-file-includes inside the ParsedAST, which is used by replay 
preamble and include-cleaner analysis. This patch fixes/improve patching in 
this case.

The second problem is patching includes that were published when building the
preamble. Unfortunately because we don't have the full edit history in place,
it's hard to perform an exact translation. This patch tries to just preserve
diagnostics that are contained to lines containing #include or #define
directives and moves them around with the new file contents. It's granularity is
per-line, it doesn't handle column-wide changes.

Depends on D142890 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142892

Files:
  clang-tools-extra/clangd/ParsedAST.cpp
  clang-tools-extra/clangd/Preamble.cpp
  clang-tools-extra/clangd/Preamble.h
  clang-tools-extra/clangd/unittests/PreambleTests.cpp

Index: clang-tools-extra/clangd/unittests/PreambleTests.cpp
===
--- clang-tools-extra/clangd/unittests/PreambleTests.cpp
+++ clang-tools-extra/clangd/unittests/PreambleTests.cpp
@@ -8,6 +8,7 @@
 
 #include "Annotations.h"
 #include "Compiler.h"
+#include "Config.h"
 #include "Headers.h"
 #include "Hover.h"
 #include "Preamble.h"
@@ -18,10 +19,12 @@
 #include "clang/Format/Format.h"
 #include "clang/Frontend/FrontendActions.h"
 #include "clang/Frontend/PrecompiledPreamble.h"
+#include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/VirtualFileSystem.h"
+#include "llvm/Testing/Support/SupportHelpers.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 #include 
@@ -30,9 +33,14 @@
 #include 
 
 using testing::Contains;
+using testing::ElementsAre;
 using testing::Field;
+using testing::IsEmpty;
 using testing::Matcher;
 using testing::MatchesRegex;
+using testing::Not;
+using testing::UnorderedElementsAre;
+using testing::UnorderedElementsAreArray;
 
 namespace clang {
 namespace clangd {
@@ -190,9 +198,12 @@
 Field(&Inclusion::Resolved, testPath("a.h");
 }
 
-std::optional createPatchedAST(llvm::StringRef Baseline,
-  llvm::StringRef Modified) {
-  auto BaselinePreamble = TestTU::withCode(Baseline).preamble();
+std::optional
+createPatchedAST(llvm::StringRef Baseline, llvm::StringRef Modified,
+ llvm::StringMap AdditionalFiles = {}) {
+  auto PreambleTU = TestTU::withCode(Baseline);
+  PreambleTU.AdditionalFiles = AdditionalFiles;
+  auto BaselinePreamble = PreambleTU.preamble();
   if (!BaselinePreamble) {
 ADD_FAILURE() << "Failed to build baseline preamble";
 return std::nullopt;
@@ -201,6 +212,7 @@
   IgnoreDiagnostics Diags;
   MockFS FS;
   auto TU = TestTU::withCode(Modified);
+  TU.AdditionalFiles = std::move(AdditionalFiles);
   auto CI = buildCompilerInvocation(TU.inputs(FS), Diags);
   if (!CI) {
 ADD_FAILURE() << "Failed to build compiler invocation";
@@ -565,6 +577,135 @@
 TU.inputs(FS), *BaselinePreamble);
   EXPECT_TRUE(PP.text().empty());
 }
+
+MATCHER_P(DiagWithRange, Range, "") { return arg.Range == Range; }
+
+TEST(PreamblePatch, DiagnosticsFromMainASTAreInRightPlace) {
+  Config Cfg;
+  Cfg.Diagnostics.Mode = Config::DiagnosticsMode::Fast;
+  WithContextValue WithCfg(Config::Key, std::move(Cfg));
+
+  llvm::StringLiteral BaselinePreamble = "#define FOO\n";
+  {
+// Check with removals from preamble.
+Annotations Code("[[x]];/* error-ok */");
+auto PatchedDiags =
+*createPatchedAST(BaselinePreamble, Code.code())->getDiagnostics();
+EXPECT_THAT(PatchedDiags,
+testing::ElementsAre(DiagWithRange(Code.range(;
+  }
+  {
+// Check with additions to preamble.
+Annotations Code(
+(BaselinePreamble + "#define BAR\n[[x]];/* error-ok */").str());
+auto PatchedDiags =
+*createPatchedAST(BaselinePreamble, Code.code())->getDiagnostics();
+EXPECT_THAT(PatchedDiags,
+testing::ElementsAre(DiagWithRange(Code.range(;
+  }
+}
+
+TEST(PreamblePatch, DiagnosticsToPreamble) {
+  Config Cfg;
+  Cfg.Diagnostics.Mode = Config::DiagnosticsMode::Fast;
+  Cfg.Diagnostics.UnusedIncludes = 

[PATCH] D91000: [clang-tidy] Add bugprone-unsafe-functions checker.

2023-01-30 Thread Whisperity via Phabricator via cfe-commits
whisperity added a comment.

In D91000#4020891 , @futogergely wrote:

> What we could do is:
>
> 1. add a new checker option to decide if we suggest replacements from AnnexK. 
> We could avoid registering matchers this way, but I don't really like this, 
> having an option for something we could decide from the defined macros.
> 2. As a TODO, we could make possible to register checkers AFTER the 
> preprocessor is executed. I have not looked into this, so I don't really know 
> if it is possible at all in the current architecture.

I think it's fine if we do not go a great length for changing the entire 
infrastructure around this. At least we looked, it's not possible.

@aaron.ballman said that we've likely did as much as we could. At least the 
matchers themselves aren't that expensive, it's a small string lookup 
(hopefully hashed or at least memoised) in a trivial search for a very specific 
node type only.

I'll try running at least one final grand CI test of this check just to make 
sure it's not crashing and such, but due to the C11 **and** //Annex K// 
requirement, I do not expect a lot of results...


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

https://reviews.llvm.org/D91000

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


[PATCH] D142893: Class for building MultilibSet

2023-01-30 Thread Michael Platings via Phabricator via cfe-commits
michaelplatings created this revision.
michaelplatings added a reviewer: phosek.
Herald added a subscriber: abrachet.
Herald added a project: All.
michaelplatings requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.

The functionality in MultilibSet for creating it is tied to its current
implementation. Putting that code in a separate class is an enabler for
changing the MultilibSet implementation.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142893

Files:
  clang/include/clang/Driver/Multilib.h
  clang/include/clang/Driver/MultilibBuilder.h
  clang/lib/Driver/CMakeLists.txt
  clang/lib/Driver/Multilib.cpp
  clang/lib/Driver/MultilibBuilder.cpp
  clang/lib/Driver/ToolChains/BareMetal.cpp
  clang/lib/Driver/ToolChains/Fuchsia.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/unittests/Driver/CMakeLists.txt
  clang/unittests/Driver/MultilibBuilderTest.cpp
  clang/unittests/Driver/MultilibTest.cpp

Index: clang/unittests/Driver/MultilibTest.cpp
===
--- clang/unittests/Driver/MultilibTest.cpp
+++ clang/unittests/Driver/MultilibTest.cpp
@@ -11,34 +11,17 @@
 //===--===//
 
 #include "clang/Driver/Multilib.h"
+#include "../../lib/Driver/ToolChains/CommonArgs.h"
 #include "clang/Basic/LLVM.h"
+#include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSwitch.h"
+#include "llvm/Support/SourceMgr.h"
 #include "gtest/gtest.h"
 
 using namespace clang::driver;
 using namespace clang;
 
-TEST(MultilibTest, MultilibValidity) {
-
-  ASSERT_TRUE(Multilib().isValid()) << "Empty multilib is not valid";
-
-  ASSERT_TRUE(Multilib().flag("+foo").isValid())
-  << "Single indicative flag is not valid";
-
-  ASSERT_TRUE(Multilib().flag("-foo").isValid())
-  << "Single contraindicative flag is not valid";
-
-  ASSERT_FALSE(Multilib().flag("+foo").flag("-foo").isValid())
-  << "Conflicting flags should invalidate the Multilib";
-
-  ASSERT_TRUE(Multilib().flag("+foo").flag("+foo").isValid())
-  << "Multilib should be valid even if it has the same flag twice";
-
-  ASSERT_TRUE(Multilib().flag("+foo").flag("-foobar").isValid())
-  << "Seemingly conflicting prefixes shouldn't actually conflict";
-}
-
 TEST(MultilibTest, OpEqReflexivity1) {
   Multilib M;
   ASSERT_TRUE(M == M) << "Multilib::operator==() is not reflexive";
@@ -50,40 +33,28 @@
 }
 
 TEST(MultilibTest, OpEqReflexivity3) {
-  Multilib M1, M2;
-  M1.flag("+foo");
-  M2.flag("+foo");
+  Multilib M1({}, {}, {}, 0, {"+foo"});
+  Multilib M2({}, {}, {}, 0, {"+foo"});
   ASSERT_TRUE(M1 == M2) << "Multilibs with the same flag should be the same";
 }
 
 TEST(MultilibTest, OpEqInequivalence1) {
-  Multilib M1, M2;
-  M1.flag("+foo");
-  M2.flag("-foo");
+  Multilib M1({}, {}, {}, 0, {"+foo"});
+  Multilib M2({}, {}, {}, 0, {"-foo"});
   ASSERT_FALSE(M1 == M2) << "Multilibs with conflicting flags are not the same";
   ASSERT_FALSE(M2 == M1)
   << "Multilibs with conflicting flags are not the same (commuted)";
 }
 
 TEST(MultilibTest, OpEqInequivalence2) {
-  Multilib M1, M2;
-  M2.flag("+foo");
+  Multilib M1;
+  Multilib M2({}, {}, {}, 0, {"+foo"});
   ASSERT_FALSE(M1 == M2) << "Flags make Multilibs different";
 }
 
-TEST(MultilibTest, OpEqEquivalence1) {
-  Multilib M1, M2;
-  M1.flag("+foo");
-  M2.flag("+foo").flag("+foo");
-  ASSERT_TRUE(M1 == M2) << "Flag duplication shouldn't affect equivalence";
-  ASSERT_TRUE(M2 == M1)
-  << "Flag duplication shouldn't affect equivalence (commuted)";
-}
-
 TEST(MultilibTest, OpEqEquivalence2) {
-  Multilib M1("64");
-  Multilib M2;
-  M2.gccSuffix("/64");
+  Multilib M1("/64");
+  Multilib M2("/64");
   ASSERT_TRUE(M1 == M2)
   << "Constructor argument must match Multilib::gccSuffix()";
   ASSERT_TRUE(M2 == M1)
@@ -91,9 +62,8 @@
 }
 
 TEST(MultilibTest, OpEqEquivalence3) {
-  Multilib M1("", "32");
-  Multilib M2;
-  M2.osSuffix("/32");
+  Multilib M1("", "/32");
+  Multilib M2("", "/32");
   ASSERT_TRUE(M1 == M2)
   << "Constructor argument must match Multilib::osSuffix()";
   ASSERT_TRUE(M2 == M1)
@@ -101,9 +71,8 @@
 }
 
 TEST(MultilibTest, OpEqEquivalence4) {
-  Multilib M1("", "", "16");
-  Multilib M2;
-  M2.includeSuffix("/16");
+  Multilib M1("", "", "/16");
+  Multilib M2("", "", "/16");
   ASSERT_TRUE(M1 == M2)
   << "Constructor argument must match Multilib::includeSuffix()";
   ASSERT_TRUE(M2 == M1)
@@ -111,31 +80,31 @@
 }
 
 TEST(MultilibTest, OpEqInequivalence3) {
-  Multilib M1("foo");
-  Multilib M2("bar");
+  Multilib M1("/foo");
+  Multilib M2("/bar");
   ASSERT_FALSE(M1 == M2) << "Differing gccSuffixes should be different";
   ASSERT_FALSE(M2 == M1)
   << "Differing gccSuffixes should be different (commuted)";
 }
 
 TEST(MultilibTest, OpEqInequivalence4) {
-  Multilib M1("", "foo");
-  Multilib M2("", "bar");
+  Multilib M1("", "/foo");

[PATCH] D142872: Honor the fwrapv option when generating the inbounds GEP .

2023-01-30 Thread Nikita Popov via Phabricator via cfe-commits
nikic added a comment.

@umesh.kalappa0 I see. That part is actually a bug in LLVM. I'm working on a 
fix.


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

https://reviews.llvm.org/D142872

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


[PATCH] D91000: [clang-tidy] Add bugprone-unsafe-functions checker.

2023-01-30 Thread Whisperity via Phabricator via cfe-commits
whisperity added a comment.

Tentative **LGTM**, will still need to run the "usual test projects" in the CI 
for confirmation. What's missing from this patch are the `.rst` files for the 
CERT-specific aliases of the check, but those are trivial and we can "add them 
in post" anyway.


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

https://reviews.llvm.org/D91000

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


[PATCH] D139182: AArch64: add CodeGen support for FEAT_XS DSB instructions

2023-01-30 Thread Tim Northover via Phabricator via cfe-commits
t.p.northover updated this revision to Diff 493305.
t.p.northover added a comment.

Thanks for the warning. Now that's settled down a bit I've updated the patch to 
the new regime.


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

https://reviews.llvm.org/D139182

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Basic/Targets/AArch64.cpp
  clang/lib/Basic/Targets/AArch64.h
  clang/lib/Sema/SemaChecking.cpp
  clang/test/Sema/builtins-arm64.c
  llvm/include/llvm/TargetParser/AArch64TargetParser.h
  llvm/lib/Target/AArch64/AArch64InstrFormats.td
  llvm/lib/Target/AArch64/AArch64InstrInfo.td
  llvm/test/CodeGen/AArch64/dsb-xs.ll
  llvm/unittests/TargetParser/TargetParserTest.cpp

Index: llvm/unittests/TargetParser/TargetParserTest.cpp
===
--- llvm/unittests/TargetParser/TargetParserTest.cpp
+++ llvm/unittests/TargetParser/TargetParserTest.cpp
@@ -1572,7 +1572,7 @@
   AArch64::AEK_B16B16,  AArch64::AEK_SMEF16F16, AArch64::AEK_CSSC,
   AArch64::AEK_RCPC3,   AArch64::AEK_THE,   AArch64::AEK_D128,
   AArch64::AEK_LSE128,  AArch64::AEK_SPECRES2,  AArch64::AEK_RASv2,
-  AArch64::AEK_ITE,
+  AArch64::AEK_ITE, AArch64::AEK_XS,
   };
 
   std::vector Features;
Index: llvm/test/CodeGen/AArch64/dsb-xs.ll
===
--- /dev/null
+++ llvm/test/CodeGen/AArch64/dsb-xs.ll
@@ -0,0 +1,17 @@
+; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+xs %s -o - | FileCheck %s
+
+define void @test_barriers() {
+; CHECK-LABEL: test_barriers:
+
+; CHECK: dsb oshnxs
+; CHECK: dsb nshnxs
+; CHECK: dsb ishnxs
+; CHECK: dsb synxs
+
+  call void @llvm.aarch64.dsb(i32 16)
+  call void @llvm.aarch64.dsb(i32 20)
+  call void @llvm.aarch64.dsb(i32 24)
+  call void @llvm.aarch64.dsb(i32 28)
+  ret void
+}
+declare void @llvm.aarch64.dsb(i32)
Index: llvm/lib/Target/AArch64/AArch64InstrInfo.td
===
--- llvm/lib/Target/AArch64/AArch64InstrInfo.td
+++ llvm/lib/Target/AArch64/AArch64InstrInfo.td
@@ -1023,7 +1023,8 @@
   let Predicates = [HasTRACEV8_4];
 }
 
-def DSBnXS  : CRmSystemI {
+def DSBnXS  : CRmSystemI {
   let CRm{1-0}   = 0b11;
   let Inst{9-8}  = 0b10;
   let Predicates = [HasXS];
Index: llvm/lib/Target/AArch64/AArch64InstrFormats.td
===
--- llvm/lib/Target/AArch64/AArch64InstrFormats.td
+++ llvm/lib/Target/AArch64/AArch64InstrFormats.td
@@ -1034,6 +1034,14 @@
   let ParserMatchClass = Imm0_255Operand;
 }
 
+def DSBnXSXForm : SDNodeXFormgetTargetConstant((N->getZExtValue() & 0xc) | 3, SDLoc(N), MVT::i32);
+}]>;
+
+def imm32_nXS : ImmLeaf;
+
 // An arithmetic shifter operand:
 //  {7-6} - shift type: 00 = lsl, 01 = lsr, 10 = asr
 //  {5-0} - imm6
Index: llvm/include/llvm/TargetParser/AArch64TargetParser.h
===
--- llvm/include/llvm/TargetParser/AArch64TargetParser.h
+++ llvm/include/llvm/TargetParser/AArch64TargetParser.h
@@ -147,6 +147,7 @@
   AEK_SPECRES2 =1ULL << 53, // FEAT_SPECRES2
   AEK_RASv2 =   1ULL << 54, // FEAT_RASv2
   AEK_ITE = 1ULL << 55, // FEAT_ITE
+  AEK_XS =  1ULL << 56, // FEAT_XS
 };
 // clang-format on
 
@@ -249,6 +250,7 @@
 {"the", AArch64::AEK_THE, "+the", "-the", FEAT_MAX, "", 0},
 {"tme", AArch64::AEK_TME, "+tme", "-tme", FEAT_MAX, "", 0},
 {"wfxt", AArch64::AEK_NONE, {}, {}, FEAT_WFXT, "+wfxt", 550},
+{"xs", AArch64::AEK_XS, "+xs", "-xs", FEAT_MAX, "", 0},
 // Special cases
 {"none", AArch64::AEK_NONE, {}, {}, FEAT_MAX, "", ExtensionInfo::MaxFMVPriority},
 };
@@ -309,12 +311,12 @@
 inline constexpr ArchInfo ARMV8_4A  = { VersionTuple{8, 4}, AProfile, "armv8.4-a", "+v8.4a", (ARMV8_3A.DefaultExts | AArch64::AEK_DOTPROD)};
 inline constexpr ArchInfo ARMV8_5A  = { VersionTuple{8, 5}, AProfile, "armv8.5-a", "+v8.5a", (ARMV8_4A.DefaultExts)};
 inline constexpr ArchInfo ARMV8_6A  = { VersionTuple{8, 6}, AProfile, "armv8.6-a", "+v8.6a", (ARMV8_5A.DefaultExts | AArch64::AEK_BF16 | AArch64::AEK_I8MM)};
-inline constexpr ArchInfo ARMV8_7A  = { VersionTuple{8, 7}, AProfile, "armv8.7-a", "+v8.7a", (ARMV8_6A.DefaultExts)};
+inline constexpr ArchInfo ARMV8_7A  = { VersionTuple{8, 7}, AProfile, "armv8.7-a", "+v8.7a", (ARMV8_6A.DefaultExts | AArch64::AEK_XS)};
 inline constexpr ArchInfo ARMV8_8A  = { VersionTuple{8, 8}, AProfile, "armv8.8-a", "+v8.8a", (ARMV8_7A.DefaultExts | AArch64::AEK_MOPS | AArch64::AEK_HBC)};
 inline constexpr ArchInfo ARMV8_9A  = { VersionTuple{8, 9}, AProfile, "armv8.9-a", "+v8.9a", (ARMV8_8A.DefaultExts | AArch64::AEK_SPECRES2 | AArch64::AEK_CSSC | AArch64::AEK_RASv2)};
 inline constexpr ArchInfo ARMV9A= { VersionTuple{9, 0}, AProfile, "armv9-a", "+v9a", (ARMV8_5A.DefaultExts | AArch64::AEK_FP16 | AArch64::AEK_SVE | AArch64::AEK_SVE2)};
 inline constexpr ArchInfo ARMV9_1A  = { VersionTuple{

[PATCH] D142800: [Clang][Diagnostic] Add `-Wcomparison-op-parentheses` to warn on chained comparisons

2023-01-30 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a subscriber: tahonermann.
erichkeane added inline comments.



Comment at: clang/lib/Sema/SemaExpr.cpp:15539
+/// Emit a diagnostic together with a fixit hint that wraps the inner 
comparison
+/// expression in parentheses.
+static void EmitDiagnosticForCompOpInCompOp(Sema &Self, SourceLocation OpLoc,

I'd repalce the comment with something more like:

```Emit a diagnostic for a case where a comparison operation is a direct 
sub-expression of another comparison operation.  Additionally, emit a fixit 
hint to suggest the inner comparison expression be wrapped in parentheses.```



Comment at: clang/lib/Sema/SemaExpr.cpp:15548
+
+  SuggestParentheses(Self, Bop->getOperatorLoc(),
+ Self.PDiag(diag::note_precedence_silence)

I find myself wondering if we could provide a better 'suggested fix' here.  
Aaron is better with the diagnostics than I am, but I would think that someone 
doing:

`a < b < c` PROBABLY doesn't mean that, they probably mean: `a < b && b < c`.

Also, is the mistake the 'same' when they do something like `a > b != c` ?  It 
would seem to me that mixing operators might make it something either more 
intentional/meaningful.  ADDITIONALLY, in the case where they are booleans, 
these end up being overly noisy.  The pattern of the  == c (where 'c' is bool, 
or convertible to bool) is probably intentional.

I think the logic here needs to be more complicated than just "Comparison 
within Comparison", however I don't have a fully formed idea of when to 
diagnose.

@tahonermann : Do you perhaps have a good idea?


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

https://reviews.llvm.org/D142800

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


[PATCH] D142800: [Clang][Diagnostic] Add `-Wcomparison-op-parentheses` to warn on chained comparisons

2023-01-30 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments.



Comment at: clang/test/Sema/comparison-op-parentheses.c:1
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DSILENCE
+// RUN: %clang_cc1 -fsyntax-only -verify %s -Wcomparison-op-parentheses

don't use macros to control conditional diagnostics like that.  You use 
`-verify=something`.


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

https://reviews.llvm.org/D142800

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


[PATCH] D142862: [Support] change StringMap hash function from djbHash to xxHash

2023-01-30 Thread Erik Desjardins via Phabricator via cfe-commits
erikdesjardins added a subscriber: nikic.
erikdesjardins added a comment.

In D142862#4089860 , 
@serge-sans-paille wrote:

> Can  you take a shot against https://llvm-compile-time-tracker.com/ so that 
> we get an hint of the practical speedup?

I don't think I have permission to use that. @nikic?

> Looks like xxhash.h is missing from the patch.

It already exists: 
https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/Support/xxhash.h


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142862

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


[PATCH] D124351: [Clang] Implement Change scope of lambda trailing-return-type

2023-01-30 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang/lib/Parse/ParseExprCXX.cpp:1293
   Actions.PushLambdaScope();
+  Actions.ActOnLambdaIntroducer(Intro, getCurScope());
 

cor3ntin wrote:
> aaron.ballman wrote:
> > Typically, we call an `ActOn` method after having parsed the construct; in 
> > this case, we're calling `ActOnLambdaIntroducer()` when it was parsed 
> > elsewhere (this is the parsing code for after the introducer). So perhaps 
> > this should be moved elsewhere or renamed?
> ActOnLambdaExpressionAfterIntroducer?
> We are actually acting on the lambda introducer, but it needs to be done in 
> these scopes so it's why its there.
Yeah, that's about the best name I can come up with as well. It's a bit messy 
because there's not really a clear separation of the steps of building up a 
lambda, but I think it's defensible.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124351

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


[PATCH] D124351: [Clang] Implement Change scope of lambda trailing-return-type

2023-01-30 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.

Aside from these minor nits and the naming concerns, I think this LGTM.




Comment at: clang/docs/ReleaseNotes.rst:747-748
 - Implemented "Permitting static constexpr variables in constexpr functions" 
(`P2647R1 _`).
 - Implemented `CWG2640 Allow more characters in an n-char sequence 
_`.
+  This Change was applied to C++20 as a Defect Report.
+- Implemented `P2036R3: Change scope of lambda trailing-return-type 
`_

This change looks like it needs to be made on the Clang 16 branch as it was a 
drive-by change here.



Comment at: clang/docs/ReleaseNotes.rst:749-752
+- Implemented `P2036R3: Change scope of lambda trailing-return-type 
`_
+  and `P2579R0 Mitigation strategies for P2036 `_.
+  This proposals modify how variables captured in lambdas can appear in 
trailing return type
+  expressions and how their types are deduced therein, in all C++ language 
versions.

This will probably need rebasing.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124351

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


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

2023-01-30 Thread David Sherwood via Phabricator via cfe-commits
david-arm added a comment.

Hi @bryanpkc, this is looking a lot better now and thanks for addressing the 
comments! I've not reviewed all of the patch yet, but I do have a few more 
comments. The most important ones are about performing immediate range checks 
for the builtins and not declaring the __ARM_FEATURE_SME yet.




Comment at: clang/include/clang/Basic/TargetBuiltins.h:312
+  /// Flags to identify the types for overloaded SME builtins.
+  class SMETypeFlags {
+uint64_t Flags;

I actually don't think you need to add this class - we should be able to just 
reuse the existing SVETypeFlags structure. I think this is fine because you've 
commonised the flags between SME and SVE.



Comment at: clang/include/clang/Basic/arm_sme.td:21
+
+def SVLD1_HOR_ZA8 : MInst<"svld1_hor_za8", "vimiPQ", "c", [IsLoad, 
IsOverloadNone, IsStreaming, IsSharedZA], MemEltTyDefault, 
"aarch64_sme_ld1b_horiz">;
+def SVLD1_HOR_ZA16 : MInst<"svld1_hor_za16", "vimiPQ", "s", [IsLoad, 
IsOverloadNone, IsStreaming, IsSharedZA], MemEltTyDefault, 
"aarch64_sme_ld1h_horiz">;

I think all the load and store instructions need immediate checks for the tile 
and slice_offset here such as:

[ImmCheck<0, ImmCheck0>, ImmCheck<2, ImmCheck0_15>]

for SVLD1_HOR_ZA8 and the others. It's mentioned in the ACLE - 
https://arm-software.github.io/acle/main/acle.html#sme-language-extensions-and-intrinsics:

  15.4.3.1 Common Rules

  ...
  Every argument named tile, slice_offset or tile_mask must be an integer 
constant expression in the range of the underlying instruction.




Comment at: clang/include/clang/Basic/arm_sve_sme_incl.td:126
+// Z: const pointer to uint64_t
+
+class MergeType {

Please can you add a comment here for the new Prototype modifier you added - 
'%'?



Comment at: clang/lib/Basic/Targets/AArch64.cpp:438
 
+  if (HasSME)
+Builder.defineMacro("__ARM_FEATURE_SME", "1");

Can you remove this please? We can't really set this macro until the SME ABI 
and ACLE is feature complete.



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:9315
+  unsigned IntID) {
+  switch (IntID) {
+  case Intrinsic::aarch64_sme_ld1h_horiz:

I think that instead of this switch statement you should just be able to write 
something like:

  Ops[3] = EmitSVEPredicateCast(Ops[3],  
getSVEVectorForElementType(SVEBuiltinMemEltTy(TypeFlags)))




Comment at: clang/lib/CodeGen/CGBuiltin.cpp:9357
+Function *StreamingVectorLength =
+CGM.getIntrinsic(Intrinsic::aarch64_sme_cntsb, {});
+llvm::Value *StreamingVectorLengthCall =

I think you can just call

  CGM.getIntrinsic(Intrinsic::aarch64_sme_cntsb)



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:9359
+llvm::Value *StreamingVectorLengthCall =
+Builder.CreateCall(StreamingVectorLength, {});
+llvm::Value *Mulvl =

Again, I think you can just do

  Builder.CreateCall(StreamingVectorLength)



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:9368
+  NewOps.push_back(EmitTileslice(Ops[2], Ops[1]));
+  Function *F = CGM.getIntrinsic(IntID, {});
+  return Builder.CreateCall(F, NewOps);

nit: `Function *F = CGM.getIntrinsic(IntID);`



Comment at: 
clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_int_const_expr_error.c:5
+
+__attribute__((arm_streaming)) void test_svld1_hor_za8(uint64_t tile, uint32_t 
slice_base, uint64_t slice_offset, svbool_t pg, void *ptr) {
+  svld1_hor_za8(tile, slice_base, 0, pg, ptr);  // expected-error 
{{argument to 'svld1_hor_za8' must be a constant integer}}

Once you've added the immediate range checks for the loads and stores it would 
be good add checks here for immediates outside the range for each instruction.



Comment at: clang/utils/TableGen/SveEmitter.cpp:1634
+void SVEEmitter::createSMETypeFlags(raw_ostream &OS) {
+  OS << "#ifdef LLVM_GET_SME_TYPEFLAGS\n";
+  for (auto &KV : FlagTypes)

If you reuse the existing SVETypeFlags rather than create a new SMETypeFlags 
then you only need the LLVM_GET_SME_IMMCHECKTYPES bit.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127910

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


[PATCH] D139182: AArch64: add CodeGen support for FEAT_XS DSB instructions

2023-01-30 Thread Sam Elliott via Phabricator via cfe-commits
lenary added a comment.

I'm not sure I agree with "map naturally", when `CRm` is a 4-bit field, and 
both bit 7 and bit 5 are different in the `dsb ` vs `dsb nXS` 
instructions.

Are you willing to put this through review for the ACLE 
? 
`__builtin_arm_dsb` is the implementation of `__dsb`, so I worry that this 
would make this intrinsic non-portable for clang vs gcc.


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

https://reviews.llvm.org/D139182

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


[PATCH] D141620: clang/OpenCL: Apply default attributes to enqueued blocks

2023-01-30 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm added inline comments.



Comment at: clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl:381
+// GFX900-LABEL: define {{[^@]+}}@callee
+// GFX900-SAME: (i64 noundef [[ID:%.*]], ptr addrspace(1) noundef [[OUT:%.*]]) 
#[[ATTR1:[0-9]+]] {
+// GFX900-NEXT:  entry:

yaxunl wrote:
> these attributes are not really checked since ATTR1 etc are not used to check 
> the attributes definitions. Is this a bug of update_cc_test_checks.py ? Or it 
> is expected to be manually edited to enforce the checking?
Seems to be an update_cc_test_checks bug I mentioned in the description 


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

https://reviews.llvm.org/D141620

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


[PATCH] D141133: [clang-tidy] Implement CppCoreGuideline F.54

2023-01-30 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp accepted this revision.
carlosgalvezp added a comment.

Thanks for updating the comment! Since I marked it as approved last time, I 
will land this in the next couple of days if no more comments come up.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141133

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


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

2023-01-30 Thread Dave Green via Phabricator via cfe-commits
dmgreen added inline comments.



Comment at: clang/utils/TableGen/SveEmitter.cpp:1477
+
+  OS << "#if !defined(__ARM_FEATURE_SME)\n";
+  OS << "#error \"SME support not enabled\"\n";

We have been changing how the existing SVE and NEON instrinsics work a little. 
There are some details in https://reviews.llvm.org/D131064. The short version 
is it is best to not rely upon preprocessor macros, and instead define the 
intrinsics so that they can be used if the right target features are available. 
This allows us to do things like this below, even without a -march that 
supports sme, and have them callable at runtime under the right situations. We 
should be doing the same for SME.
```
__attribute__((target("+sme")))
void sme_func() {
  somesmeintrinsics();
}
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127910

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


[PATCH] D142757: [clang][driver] Emit an error for `/clang:-x`

2023-01-30 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

This seems reasonable to me. I was a bit worried about the behavior being 
rather strange, but given that these are "escape hatch" command line options to 
skip the clang-cl driver, and there are existing clang-cl options that cover 
this functionality, it makes more sense to me now. LGTM, but please add a 
release note about the fix (to clang/docs/ReleaseNotes.rst). I'll leave the 
final sign-off to @MaskRay.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142757

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


[clang] 8f6c623 - [AArch64] Replace AEK_CRYPTO with relevant features in cpu definitions

2023-01-30 Thread David Green via cfe-commits

Author: David Green
Date: 2023-01-30T16:05:25Z
New Revision: 8f6c623e874624c1f247f93bf457d5196a84cec6

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

LOG: [AArch64] Replace AEK_CRYPTO with relevant features in cpu definitions

This replaces AEK_CRYPTO in the AArch64TargetParser definitions,
replacing the composite Crypto features with the constituent parts.
AEK_CRYPTO is replaced with either AEK_AES | AEK_SHA2 or AEK_AES |
AEK_SHA2 | AEK_SHA3 | AEK_SHA4 depending on if the cpu is Arm-v8.4+.
This helps get the features correct in some more places like
target(cpu=..) attributes.

Otherwise this is hopefully an NFC for -mcpu options but seems like a
cleaner design.

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

Added: 


Modified: 
clang/lib/Driver/ToolChains/Arch/AArch64.cpp
clang/test/CodeGen/aarch64-targetattr.c
clang/test/Preprocessor/aarch64-target-features.c
llvm/include/llvm/TargetParser/AArch64TargetParser.h
llvm/unittests/TargetParser/TargetParserTest.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp 
b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
index 4476b9f37bd9d..de306daaa7478 100644
--- a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -410,6 +410,7 @@ void aarch64::getAArch64TargetFeatures(const Driver &D,
 } else if (*I == "-crypto") {
   HasCrypto = false;
   HasNoCrypto = true;
+  HasSM4 = HasSHA2 = HasSHA3 = HasAES = false;
 }
 // Register the iterator position if this is an architecture feature
 if (ArchFeatPos == -1 && (V8Version != -1 || V9Version != -1))

diff  --git a/clang/test/CodeGen/aarch64-targetattr.c 
b/clang/test/CodeGen/aarch64-targetattr.c
index cc697b8894acf..9cdbf42c82e45 100644
--- a/clang/test/CodeGen/aarch64-targetattr.c
+++ b/clang/test/CodeGen/aarch64-targetattr.c
@@ -97,13 +97,13 @@ void nosimd() {}
 // CHECK: attributes #5 = { {{.*}} "tune-cpu"="cortex-a710" }
 // CHECK: attributes #6 = { {{.*}} "target-cpu"="generic" }
 // CHECK: attributes #7 = { {{.*}} "tune-cpu"="generic" }
-// CHECK: attributes #8 = { {{.*}} "target-cpu"="neoverse-n1" 
"target-features"="+crc,+crypto,+dotprod,+fp-armv8,+fullfp16,+lse,+neon,+ras,+rcpc,+rdm,+spe,+ssbs"
 "tune-cpu"="cortex-a710" }
+// CHECK: attributes #8 = { {{.*}} "target-cpu"="neoverse-n1" 
"target-features"="+aes,+crc,+dotprod,+fp-armv8,+fullfp16,+lse,+neon,+ras,+rcpc,+rdm,+sha2,+spe,+ssbs"
 "tune-cpu"="cortex-a710" }
 // CHECK: attributes #9 = { {{.*}} 
"target-features"="+fp-armv8,+fullfp16,+neon,+sve" "tune-cpu"="cortex-a710" }
-// CHECK: attributes #10 = { {{.*}} "target-cpu"="neoverse-v1" 
"target-features"="+bf16,+crc,+crypto,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+lse,+neon,+rand,+ras,+rcpc,+rdm,+spe,+ssbs,+sve,+sve2"
 }
-// CHECK: attributes #11 = { {{.*}} "target-cpu"="neoverse-v1" 
"target-features"="+bf16,+crc,+crypto,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+lse,+neon,+rand,+ras,+rcpc,+rdm,+spe,+ssbs,-sve"
 }
+// CHECK: attributes #10 = { {{.*}} "target-cpu"="neoverse-v1" 
"target-features"="+aes,+bf16,+crc,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+lse,+neon,+rand,+ras,+rcpc,+rdm,+sha2,+sha3,+sm4,+spe,+ssbs,+sve,+sve2"
 }
+// CHECK: attributes #11 = { {{.*}} "target-cpu"="neoverse-v1" 
"target-features"="+aes,+bf16,+crc,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+lse,+neon,+rand,+ras,+rcpc,+rdm,+sha2,+sha3,+sm4,+spe,+ssbs,-sve"
 }
 // CHECK: attributes #12 = { {{.*}} 
"target-features"="+fp-armv8,+fullfp16,+neon,+sve" }
 // CHECK: attributes #13 = { {{.*}} 
"target-features"="+fp-armv8,+fullfp16,+neon,+sve,-sve2" }
 // CHECK: attributes #14 = { {{.*}} "target-features"="+fullfp16" }
-// CHECK: attributes #15 = { {{.*}} "target-cpu"="neoverse-n1" 
"target-features"="+bf16,+crc,+crypto,+dotprod,+fp-armv8,+fullfp16,+i8mm,+lse,+neon,+ras,+rcpc,+rdm,+spe,+ssbs,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8.6a,+v8a"
 "tune-cpu"="cortex-a710" }
-// CHECK: attributes #16 = { {{.*}} "branch-target-enforcement"="true" {{.*}} 
"target-features"="+bf16,+crc,+crypto,+dotprod,+fp-armv8,+fullfp16,+i8mm,+lse,+neon,+ras,+rcpc,+rdm,+spe,+ssbs,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8.6a,+v8a"
 "tune-cpu"="cortex-a710" }
+// CHECK: attributes #15 = { {{.*}} "target-cpu"="neoverse-n1" 
"target-features"="+aes,+bf16,+crc,+dotprod,+fp-armv8,+fullfp16,+i8mm,+lse,+neon,+ras,+rcpc,+rdm,+sha2,+spe,+ssbs,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8.6a,+v8a"
 "tune-cpu"="cortex-a710" }
+// CHECK: attributes #16 = { {{.*}} "branch-target-enforcement"="true" {{.*}} 
"target-features"="+aes,+bf16,+crc,+dotprod,+fp-armv8,+fullfp16,+i8mm,+lse,+neon,+ras,+rcpc,+rdm,+sha2,+spe,+ssbs,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8.6a,+v8a"
 "tune-cpu"="cortex

[PATCH] D142548: [AArch64] Replace AEK_CRYPTO with relevant features in cpu definitions

2023-01-30 Thread Dave Green 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 rG8f6c623e8746: [AArch64] Replace AEK_CRYPTO with relevant 
features in cpu definitions (authored by dmgreen).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Changed prior to commit:
  https://reviews.llvm.org/D142548?vs=492110&id=493317#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142548

Files:
  clang/lib/Driver/ToolChains/Arch/AArch64.cpp
  clang/test/CodeGen/aarch64-targetattr.c
  clang/test/Preprocessor/aarch64-target-features.c
  llvm/include/llvm/TargetParser/AArch64TargetParser.h
  llvm/unittests/TargetParser/TargetParserTest.cpp

Index: llvm/unittests/TargetParser/TargetParserTest.cpp
===
--- llvm/unittests/TargetParser/TargetParserTest.cpp
+++ llvm/unittests/TargetParser/TargetParserTest.cpp
@@ -975,23 +975,27 @@
 AArch64CPUTests, AArch64CPUTestFixture,
 ::testing::Values(
 ARMCPUTestParams("cortex-a34", "armv8-a", "crypto-neon-fp-armv8",
- AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
- AArch64::AEK_FP | AArch64::AEK_SIMD,
+ AArch64::AEK_CRC | AArch64::AEK_AES |
+ AArch64::AEK_SHA2 | AArch64::AEK_FP |
+ AArch64::AEK_SIMD,
  "8-A"),
 ARMCPUTestParams("cortex-a35", "armv8-a", "crypto-neon-fp-armv8",
- AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
- AArch64::AEK_FP | AArch64::AEK_SIMD,
+ AArch64::AEK_CRC | AArch64::AEK_AES |
+ AArch64::AEK_SHA2 | AArch64::AEK_FP |
+ AArch64::AEK_SIMD,
  "8-A"),
 ARMCPUTestParams("cortex-a53", "armv8-a", "crypto-neon-fp-armv8",
- AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
- AArch64::AEK_FP | AArch64::AEK_SIMD,
+ AArch64::AEK_CRC | AArch64::AEK_AES |
+ AArch64::AEK_SHA2 | AArch64::AEK_FP |
+ AArch64::AEK_SIMD,
  "8-A"),
 ARMCPUTestParams("cortex-a55", "armv8.2-a", "crypto-neon-fp-armv8",
- AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
- AArch64::AEK_FP | AArch64::AEK_SIMD |
- AArch64::AEK_RAS | AArch64::AEK_LSE |
- AArch64::AEK_RDM | AArch64::AEK_FP16 |
- AArch64::AEK_DOTPROD | AArch64::AEK_RCPC,
+ AArch64::AEK_CRC | AArch64::AEK_AES |
+ AArch64::AEK_SHA2 | AArch64::AEK_FP |
+ AArch64::AEK_SIMD | AArch64::AEK_RAS |
+ AArch64::AEK_LSE | AArch64::AEK_RDM |
+ AArch64::AEK_FP16 | AArch64::AEK_DOTPROD |
+ AArch64::AEK_RCPC,
  "8.2-A"),
 ARMCPUTestParams(
 "cortex-a510", "armv9-a", "neon-fp-armv8",
@@ -1004,82 +1008,86 @@
 AArch64::AEK_FP16FML | AArch64::AEK_SB,
 "9-A"),
 ARMCPUTestParams("cortex-a57", "armv8-a", "crypto-neon-fp-armv8",
- AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
- AArch64::AEK_FP | AArch64::AEK_SIMD,
+ AArch64::AEK_CRC | AArch64::AEK_AES |
+ AArch64::AEK_SHA2 | AArch64::AEK_FP |
+ AArch64::AEK_SIMD,
  "8-A"),
 ARMCPUTestParams("cortex-a65", "armv8.2-a", "crypto-neon-fp-armv8",
- AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
- AArch64::AEK_DOTPROD | AArch64::AEK_FP |
- AArch64::AEK_FP16 | AArch64::AEK_LSE |
- AArch64::AEK_RAS | AArch64::AEK_RCPC |
- AArch64::AEK_RDM | AArch64::AEK_SIMD |
- AArch64::AEK_SSBS,
+ AArch64::AEK_CRC | AArch64::AEK_AES |
+ AArch64::AEK_SHA2 | AArch64::AEK_DOTPROD |
+ AArch64::AEK_FP | AArch64::AEK_FP16 |
+ AArch64::AEK_LSE | AArch64::AEK_RAS |
+ AArch64::AEK_RCPC | AArch64::AEK_RDM |
+ AArch64::AEK_SIMD | AArch64::AEK_SSBS,
  "8.2-A"),
 ARMCPUTestParams("cortex-a65ae", "armv8.2-a", "crypto-neon-fp-armv8",
- AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
- AArch64::AEK_DOTPROD | AArch64::AEK_FP |
-   

[PATCH] D142692: [clang] Store the template param list of an explicit variable template specialization

2023-01-30 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik added subscribers: clang-language-wg, shafik.
shafik added a comment.

Adding `clang-language-wg` for more visibility.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142692

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


[PATCH] D142692: [clang] Store the template param list of an explicit variable template specialization

2023-01-30 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

We have a good amount of AST-dump tests around that are likely the right place 
to put them perhaps?  What is the reproducer that caused you to discover this 
issue?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142692

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


[PATCH] D141192: [Clang] Fix warnings on bad shifts.

2023-01-30 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

Sorry for the delay in reviewing, I was out for standards meetings last week 
and couldn't get to this one. For future patches, can you be sure to upload 
them with more diff context (`-U` is what I usually use).

You should also add a release note for the fix.




Comment at: clang/lib/AST/ExprConstant.cpp:2837-2843
+if (SA != RHS) {
+  if (Info.getLangOpts().CPlusPlus11) {
+Info.CCEDiag(E, diag::note_constexpr_large_shift)
+<< RHS << E->getType() << LHS.getBitWidth();
+return false;
+  }
+}

These can be combined into one `if` with `&&`.



Comment at: clang/lib/Sema/SemaExpr.cpp:11762-11763
 << LHS.get()->getSourceRange() << RHS.get()->getSourceRange();
-return;
+
+// We return BSV_Ok because we already done diag.
+return BSV_Ok;

because we already done diag -> because we already emitted the diagnostic



Comment at: clang/lib/Sema/SemaExpr.cpp:12023-12025
+  ExpressionEvaluationContext Context = ExprEvalContexts.back().Context;
+  if (Context == ExpressionEvaluationContext::ConstantEvaluated ||
+  Context == ExpressionEvaluationContext::ImmediateFunctionContext) {

You can use `ExprEvalContexts.back().isConstantEvaluated()` instead.



Comment at: clang/test/C/drs/dr0xx.c:429
*/
- _Static_assert(-1 << 1 == -2, "fail"); /* Didn't shift a zero into the "sign 
bit". */
+ _Static_assert(-1 << 1 == -2, "fail");  /* expected-warning {{shifting a 
negative signed value is undefined}} */
  _Static_assert(1 << 3 == 1u << 3u, "fail"); /* Shift of a positive signed 
value does sensible things. */

The new comment doesn't match the comment above. I'm not certain when WG14 
changed the behavior from implementation-defined to undefined, but we should 
capture that information in the test because the DR has been superseded. I 
suspect it was from the twos complement changes in C2x though, so that'd be a 
good place to start looking.



Comment at: clang/test/Sema/shift-count-negative.c:7
+enum shiftof {
+X = (1<<-29) //expected-warning {{shift count is negative}}
+};

When the shift is a negative *constant* value (as opposed to a signed variable 
type), should we diagnose this as an error rather than a warning? (Perhaps 
worth thinking about as a follow-up patch?)



Comment at: clang/test/Sema/shift-count-overflow.c:1-2
+// RUN: %clang_cc1 -x c -fsyntax-only -verify -Wshift-count-overflow %s
+// RUN: %clang_cc1 -x c -fsyntax-only -verify -Wall %s
+

No need for the `-x c` in these.



Comment at: clang/test/Sema/shift-count-overflow.c:5
+enum shiftof {
+X = (1<<32) // expected-warning {{shift count >= width of type}}   
+};

This depends on the target architecture, doesn't it? You might want to add some 
target triples to the RUN line to ensure you've picked targets where this 
property holds.



Comment at: clang/test/Sema/shift-count-overflow.c:7-8
+};
+
+
+

Spurious newlines?



Comment at: clang/test/Sema/shift-negative-value.c:7
+enum shiftof {
+X = (-1<<29) //expected-warning {{shifting a negative signed value is 
undefined}}
+};

This is another case we might want to consider if we can turn into an error (in 
a follow-up patch).


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

https://reviews.llvm.org/D141192

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


[PATCH] D142316: [clang] Add test for CWG2396

2023-01-30 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik added inline comments.



Comment at: clang/test/CXX/drs/dr23xx.cpp:202
+  // void g2(A a) { a.operator B decltype(B())::*(); }
+  // void h(A a) { a.operator identity::type B::*(); }  
+  // void h2(A a) { a.operator B identity::type::*(); } 

Endill wrote:
> shafik wrote:
> > While gcc accepts the first three it does not like the last two: 
> > https://godbolt.org/z/js8Pz14Eo
> > 
> > I believe they should also be covered but not confident.
> I agree they should. I can't find any special considerations in the standard 
> regarding unqualified name lookup of template arguments.
> 
> Are there any action items for me here?
Yeah, can you file a gcc bug report for the last two? If they agree it is a gcc 
but then we are all good, if not then we need to see what they say.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142316

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


[PATCH] D142757: [clang][driver] Emit an error for `/clang:-x`

2023-01-30 Thread Mariya Podchishchaeva via Phabricator via cfe-commits
Fznamznon updated this revision to Diff 493326.
Fznamznon added a comment.

Add a release note.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142757

Files:
  clang/docs/ReleaseNotes.rst
  clang/lib/Driver/Driver.cpp
  clang/test/ClangScanDeps/Inputs/modules_cdb_clangcl_by_mod_name.json
  clang/test/Driver/x-args.c


Index: clang/test/Driver/x-args.c
===
--- clang/test/Driver/x-args.c
+++ clang/test/Driver/x-args.c
@@ -5,3 +5,8 @@
 // RUN: %clang -fsyntax-only -xc %s -xc++ -fsyntax-only 2>&1 | FileCheck %s
 // RUN: %clang -fsyntax-only %s -xc %s -xc++ -fsyntax-only 2>&1 | FileCheck %s
 // CHECK: '-x c++' after last input file has no effect
+
+// RUN: not %clang_cl /WX /clang:-xc /clang:-E /clang:-dM %s 2>&1 | FileCheck 
-check-prefix=CL %s
+// RUN: not %clang_cl /WX /clang:-E /clang:-dM %s /clang:-xc 2>&1 | FileCheck 
-check-prefix=CL %s
+// CL-NOT: '-x c' after last input file has no effect
+// CL: error: unsupported option '-x c'; did you mean '/TC' or '/TP'?
Index: clang/test/ClangScanDeps/Inputs/modules_cdb_clangcl_by_mod_name.json
===
--- clang/test/ClangScanDeps/Inputs/modules_cdb_clangcl_by_mod_name.json
+++ clang/test/ClangScanDeps/Inputs/modules_cdb_clangcl_by_mod_name.json
@@ -1,12 +1,12 @@
 [
 {
   "directory": "DIR",
-  "command": "clang-cl /E /IInputs /D INCLUDE_HEADER2 /clang:-MD /clang:-MF 
/clang:DIR/modules_cdb2_clangcl.d /clang:-fmodules /clang:-fcxx-modules 
/clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules 
/clang:-fimplicit-module-maps /clang:-x /clang:c++ --",
+  "command": "clang-cl /E /IInputs /D INCLUDE_HEADER2 /clang:-MD /clang:-MF 
/clang:DIR/modules_cdb2_clangcl.d /clang:-fmodules /clang:-fcxx-modules 
/clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules 
/clang:-fimplicit-module-maps /TP --",
   "file": ""
 },
 {
   "directory": "DIR",
-  "command": "clang-cl /E /IInputs /clang:-fmodules /clang:-fcxx-modules 
/clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules 
/clang:-fimplicit-module-maps /clang:-x /clang:c++ --",
+  "command": "clang-cl /E /IInputs /clang:-fmodules /clang:-fcxx-modules 
/clang:-fmodules-cache-path=DIR/module-cache_clangcl /clang:-fimplicit-modules 
/clang:-fimplicit-module-maps /TP --",
   "file": ""
 },
 ]
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -2572,11 +2572,18 @@
   }
 
   // Warn -x after last input file has no effect
-  {
+  if (!IsCLMode()) {
 Arg *LastXArg = Args.getLastArgNoClaim(options::OPT_x);
 Arg *LastInputArg = Args.getLastArgNoClaim(options::OPT_INPUT);
-if (LastXArg && LastInputArg && LastInputArg->getIndex() < 
LastXArg->getIndex())
+if (LastXArg && LastInputArg &&
+LastInputArg->getIndex() < LastXArg->getIndex())
   Diag(clang::diag::warn_drv_unused_x) << LastXArg->getValue();
+  } else {
+// In CL mode suggest /TC or /TP since -x doesn't make sense if passed via
+// /clang:.
+if (auto *A = Args.getLastArg(options::OPT_x))
+  Diag(diag::err_drv_unsupported_opt_with_suggestion)
+  << A->getAsString(Args) << "/TC' or '/TP";
   }
 
   for (Arg *A : Args) {
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -57,6 +57,10 @@
 - Fix crash on invalid code when looking up a destructor in a templated class
   inside a namespace. This fixes
   `Issue 59446 `_.
+- Fix confusing warning message when `/clang:-x` is passed in clang-cl driver
+  mode and emit an error which suggests using `/TC` or `/TP` clang-cl options
+  instead. This fixes
+  `Issue 59307 `_.
 
 Improvements to Clang's diagnostics
 ^^^


Index: clang/test/Driver/x-args.c
===
--- clang/test/Driver/x-args.c
+++ clang/test/Driver/x-args.c
@@ -5,3 +5,8 @@
 // RUN: %clang -fsyntax-only -xc %s -xc++ -fsyntax-only 2>&1 | FileCheck %s
 // RUN: %clang -fsyntax-only %s -xc %s -xc++ -fsyntax-only 2>&1 | FileCheck %s
 // CHECK: '-x c++' after last input file has no effect
+
+// RUN: not %clang_cl /WX /clang:-xc /clang:-E /clang:-dM %s 2>&1 | FileCheck -check-prefix=CL %s
+// RUN: not %clang_cl /WX /clang:-E /clang:-dM %s /clang:-xc 2>&1 | FileCheck -check-prefix=CL %s
+// CL-NOT: '-x c' after last input file has no effect
+// CL: error: unsupported option '-x c'; did you mean '/TC' or '/TP'?
Index: clang/test/ClangScanDeps/Inputs/modules_cdb_clangcl_by_mod_name.json
==

[PATCH] D124351: [Clang] Implement Change scope of lambda trailing-return-type

2023-01-30 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 493328.
cor3ntin added a comment.

- rebase
- rename ActOnLambdaIntroducer
- Fix a crash in `transformedLocalDecl`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124351

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/AST/DeclCXX.h
  clang/include/clang/Sema/Scope.h
  clang/include/clang/Sema/ScopeInfo.h
  clang/include/clang/Sema/Sema.h
  clang/lib/Parse/ParseExprCXX.cpp
  clang/lib/Sema/Scope.cpp
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaCXXScopeSpec.cpp
  clang/lib/Sema/SemaConcept.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaLambda.cpp
  clang/lib/Sema/SemaTemplateInstantiate.cpp
  clang/lib/Sema/TreeTransform.h
  clang/test/CXX/expr/expr.prim/expr.prim.lambda/p11-1y.cpp
  clang/test/CXX/expr/expr.prim/expr.prim.lambda/p4.cpp
  clang/test/SemaCXX/lambda-capture-type-deduction.cpp
  clang/test/SemaCXX/warn-shadow-in-lambdas.cpp
  clang/www/cxx_status.html

Index: clang/www/cxx_status.html
===
--- clang/www/cxx_status.html
+++ clang/www/cxx_status.html
@@ -1358,7 +1358,7 @@
 
   Change scope of lambda trailing-return-type
   https://wg21.link/P2036R3";>P2036R3
-  No
+  Clang 17
 
 
   https://wg21.link/P2579R0";>P2579R0
Index: clang/test/SemaCXX/warn-shadow-in-lambdas.cpp
===
--- clang/test/SemaCXX/warn-shadow-in-lambdas.cpp
+++ clang/test/SemaCXX/warn-shadow-in-lambdas.cpp
@@ -95,7 +95,7 @@
 #ifdef AVOID
   auto l4 = [var = param] (int param) { ; }; // no warning
 #else
-  auto l4 = [var = param] (int param) { ; }; // expected-warning {{declaration shadows a local variable}}
+  auto l4 = [var = param](int param) { ; }; // expected-warning 2{{declaration shadows a local variable}}
 #endif
 
   // Make sure that inner lambdas work as well.
Index: clang/test/SemaCXX/lambda-capture-type-deduction.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/lambda-capture-type-deduction.cpp
@@ -0,0 +1,243 @@
+// RUN: %clang_cc1 -std=c++2b -verify -fsyntax-only %s
+
+template 
+constexpr bool is_same = false;
+
+template 
+constexpr bool is_same = true;
+
+void f() {
+
+  int y;
+
+  static_assert(is_same decltype((x)) { return x; }())>);
+
+  static_assert(is_same decltype((x)) { return x; }())>);
+
+  static_assert(is_same decltype((y)) { return y; }())>);
+
+  static_assert(is_same decltype((y)) { return y; }())>);
+
+  static_assert(is_same decltype((y)) { return y; }())>);
+
+  static_assert(is_same decltype((y)) { return y; }())>);
+
+  auto ref = [&x = y](
+ decltype([&](decltype(x)) { return 0; }) y) {
+return x;
+  };
+}
+
+void test_noexcept() {
+
+  int y;
+
+  static_assert(noexcept([x = 1] noexcept(is_same) {}()));
+  static_assert(noexcept([x = 1] mutable noexcept(is_same) {}()));
+  static_assert(noexcept([y] noexcept(is_same) {}()));
+  static_assert(noexcept([y] mutable noexcept(is_same) {}()));
+  static_assert(noexcept([=] noexcept(is_same) {}()));
+  static_assert(noexcept([=] mutable noexcept(is_same) {}()));
+  static_assert(noexcept([&] noexcept(is_same) {}()));
+  static_assert(noexcept([&] mutable noexcept(is_same) {}()));
+}
+
+void test_requires() {
+
+  int x;
+
+  [x = 1]() requires is_same {}
+  ();
+  [x = 1]() mutable requires is_same {}
+  ();
+  [x]() requires is_same {}
+  ();
+  [x]() mutable requires is_same {}
+  ();
+  [=]() requires is_same {}
+  ();
+  [=]() mutable requires is_same {}
+  ();
+  [&]() requires is_same {}
+  ();
+  [&]() mutable requires is_same {}
+  ();
+  [&x]() requires is_same {}
+  ();
+  [&x]() mutable requires is_same {}
+  ();
+
+  [x = 1]() requires is_same {} ();
+  [x = 1]() mutable requires is_same {} ();
+}
+
+void err() {
+  int y, z;
+  (void)[x = 1]
+  requires(is_same) {};
+
+  (void)[x = 1]{};
+
+  (void)[=]{};
+
+  (void)[z]{};
+}
+
+void gnu_attributes() {
+  int y;
+  (void)[=]() __attribute__((diagnose_if(!is_same, "wrong type", "warning"))){}();
+  // expected-warning@-1 {{wrong type}} expected-note@-1{{'diagnose_if' attribute on 'operator()'}}
+  (void)[=]() __attribute__((diagnose_if(!is_same, "wrong type", "warning"))){}();
+
+  (void)[=]() __attribute__((diagnose_if(!is_same, "wrong type", "warning"))) mutable {}();
+  (void)[=]() __attribute__((diagnose_if(!is_same, "wrong type", "warning"))) mutable {}();
+  // expected-warning@-1 {{wrong type}} expected-note@-1{{'diagnose_if' attribute on 'operator()'}}
+
+
+  (void)[x=1]() __attribute__((diagnose_if(!is_same, "wrong type", "warning"))){}();
+  // expected-warning@-1 {{wrong type}} expected-note@-1{{'diagnose_if' attribute on 'operator()'}}
+  (void)[x=1]() __attribute__((diagnose_if(!is_same, "wrong type", "warning"))){}();
+
+  (void)[x=1]() __attribute__((diagnose_

[PATCH] D141620: clang/OpenCL: Apply default attributes to enqueued blocks

2023-01-30 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl accepted this revision.
yaxunl added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks


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

https://reviews.llvm.org/D141620

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


[PATCH] D142905: Change multilib selection algorithm

2023-01-30 Thread Michael Platings via Phabricator via cfe-commits
michaelplatings created this revision.
michaelplatings added a reviewer: phosek.
Herald added subscribers: abrachet, mgrang.
Herald added a project: All.
michaelplatings requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.

The new algorithm is:

1. Find all multilibs with flags that are a subset of the requested flags.
2. If more than one multilib matches, choose the last.

In addition a new selection mechanism is permitted, for which multiple
multilibs are returned. This allows layering multilibs on top of each
other.

Since multilibs are now ordered within a list, they no longer need a
Priority field.

The new algorithm is different to the old algorithm, but in practise
the old algorithm was always used in such a way that the effect is the
same.
The old algorithm was to find the set intersection of the requested
flags (with the first character of each removed) with each multilib's
flags (ditto), and for that intersection check whether the first
character matched. However, ignoring the first characters, the
requested flags were always a superset of all the multilibs flags.
Therefore the new algorithm can be used as a drop-in replacement.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142905

Files:
  clang/include/clang/Driver/Multilib.h
  clang/include/clang/Driver/MultilibBuilder.h
  clang/lib/Driver/Multilib.cpp
  clang/lib/Driver/MultilibBuilder.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/Fuchsia.cpp
  clang/unittests/Driver/MultilibBuilderTest.cpp
  clang/unittests/Driver/MultilibTest.cpp

Index: clang/unittests/Driver/MultilibTest.cpp
===
--- clang/unittests/Driver/MultilibTest.cpp
+++ clang/unittests/Driver/MultilibTest.cpp
@@ -33,14 +33,14 @@
 }
 
 TEST(MultilibTest, OpEqReflexivity3) {
-  Multilib M1({}, {}, {}, 0, {"+foo"});
-  Multilib M2({}, {}, {}, 0, {"+foo"});
+  Multilib M1({}, {}, {}, {"+foo"});
+  Multilib M2({}, {}, {}, {"+foo"});
   ASSERT_TRUE(M1 == M2) << "Multilibs with the same flag should be the same";
 }
 
 TEST(MultilibTest, OpEqInequivalence1) {
-  Multilib M1({}, {}, {}, 0, {"+foo"});
-  Multilib M2({}, {}, {}, 0, {"-foo"});
+  Multilib M1({}, {}, {}, {"+foo"});
+  Multilib M2({}, {}, {}, {"-foo"});
   ASSERT_FALSE(M1 == M2) << "Multilibs with conflicting flags are not the same";
   ASSERT_FALSE(M2 == M1)
   << "Multilibs with conflicting flags are not the same (commuted)";
@@ -48,7 +48,7 @@
 
 TEST(MultilibTest, OpEqInequivalence2) {
   Multilib M1;
-  Multilib M2({}, {}, {}, 0, {"+foo"});
+  Multilib M2({}, {}, {}, {"+foo"});
   ASSERT_FALSE(M1 == M2) << "Flags make Multilibs different";
 }
 
@@ -124,7 +124,7 @@
 }
 
 TEST(MultilibTest, Construction3) {
-  Multilib M({}, {}, {}, 0, {"+f1", "+f2", "-f3"});
+  Multilib M({}, {}, {}, {"+f1", "+f2", "-f3"});
   for (Multilib::flags_list::const_iterator I = M.flags().begin(),
 E = M.flags().end();
I != E; ++I) {
@@ -149,8 +149,8 @@
 
 TEST(MultilibTest, SetPriority) {
   MultilibSet MS({
-  Multilib("/foo", {}, {}, 1, {"+foo"}),
-  Multilib("/bar", {}, {}, 2, {"+bar"}),
+  Multilib("/foo", {}, {}, {"+foo"}),
+  Multilib("/bar", {}, {}, {"+bar"}),
   });
   Multilib::flags_list Flags1 = {"+foo", "-bar"};
   Multilib Selection1;
@@ -166,3 +166,24 @@
   ASSERT_TRUE(Selection2.gccSuffix() == "/bar")
   << "Selection picked " << Selection2 << " which was not expected";
 }
+
+TEST(MultilibTest, SelectMultiple) {
+  MultilibSet MS({
+  Multilib("/a", {}, {}, {"x"}),
+  Multilib("/b", {}, {}, {"y"}),
+  });
+  std::vector Selection;
+
+  Selection = MS.select({"x"});
+  ASSERT_EQ(1u, Selection.size());
+  EXPECT_EQ("/a", Selection[0].gccSuffix());
+
+  Selection = MS.select({"y"});
+  ASSERT_EQ(1u, Selection.size());
+  EXPECT_EQ("/b", Selection[0].gccSuffix());
+
+  Selection = MS.select({"y", "x"});
+  ASSERT_EQ(2u, Selection.size());
+  EXPECT_EQ("/a", Selection[0].gccSuffix());
+  EXPECT_EQ("/b", Selection[1].gccSuffix());
+}
Index: clang/unittests/Driver/MultilibBuilderTest.cpp
===
--- clang/unittests/Driver/MultilibBuilderTest.cpp
+++ clang/unittests/Driver/MultilibBuilderTest.cpp
@@ -7,7 +7,7 @@
 //
 //===--===//
 //
-// Unit tests for Multilib and MultilibBuilder
+// Unit tests for MultilibBuilderVariant and MultilibBuilder
 //
 //===--===//
 
@@ -185,14 +185,14 @@
 bool IsSF = I & 0x2;
 Multilib::flags_list Flags;
 if (IsEL)
-  Flags.push_back("+EL");
+  Flags.insert("+EL");
 else
-  Flags.push_back("-EL");
+  Flags.insert("-EL");
 
 if (IsSF)
-  Flags.push_back("+SF");
+  Flags.insert("+SF");
 else
-  Flags.push_back("-S

[PATCH] D142816: [clang-tidy] Add --list-unique-checks command

2023-01-30 Thread Piotr Zegar via Phabricator via cfe-commits
ClockMan abandoned this revision.
ClockMan added a comment.

Ok, I agree that solution taken in D114317  
with explicit marking of checks via misc::PrimaryCheck or conversion of type to 
string on preprocesor level is better.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142816

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


[PATCH] D142861: [Clang] avoid relying on StringMap iteration order when roundtripping -analyzer-config

2023-01-30 Thread Jan Svoboda via Phabricator via cfe-commits
jansvoboda11 added a comment.

Thanks for the patch. Left a couple of small suggestions.




Comment at: clang/lib/Frontend/CompilerInvocation.cpp:881
+  // Sort options by key to avoid relying on StringMap iteration order.
+  SmallVector, 4> SortedConfigOpts;
   for (const auto &C : Opts.Config) {

I think you should be able to drop `llvm::`.



Comment at: clang/lib/Frontend/CompilerInvocation.cpp:881
+  // Sort options by key to avoid relying on StringMap iteration order.
+  SmallVector, 4> SortedConfigOpts;
   for (const auto &C : Opts.Config) {

jansvoboda11 wrote:
> I think you should be able to drop `llvm::`.
No reason to allocate for this temporary storage IMO, you could replace 
`std::string` with `StringRef`.



Comment at: clang/lib/Frontend/CompilerInvocation.cpp:882-884
   for (const auto &C : Opts.Config) {
+SortedConfigOpts.emplace_back(C.getKey(), C.getValue());
+  }

Per our coding style, we don't put braces around bodies with just a single 
statement.



Comment at: clang/lib/Frontend/CompilerInvocation.cpp:889
+
+  for (const auto &C : SortedConfigOpts) {
+const llvm::StringRef &Key = std::get<0>(C);

You could use C++17 structured bindings: `for (const auto &[Key, Value] : 
SortedConfigOpts) { ... }`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142861

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


[PATCH] D142578: [Clang][Doc] Edit the Clang release notes

2023-01-30 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

Thank you for working on this, it is really shaping up nicely!

In D142578#4088769 , @royjacobson 
wrote:

> In D142578#4088011 , @tschuett 
> wrote:
>
>> IDK. Clang 16 is fully is a fully conformant C++20 except for some DRs. Or 
>> beginning with Clang 16, we start a long-term project to overhaul the 
>> diagnostics.
>>
>> I agree that breaking changes are important.
>
> I contemplated on this for a bit, and I don't have anything that I feel is 
> representative enough and fits into one paragraph. I'm still not against the 
> general idea though.

I think "major announcements" should be limited to things almost everyone will 
want to know about, like "we're changing our license" or "we've finished 
support for ". So not every release will have major 
announcements, and that's fine -- we can remove any empty sections from the 
release notes.




Comment at: clang/docs/ReleaseNotes.rst:16
  Release notes for previous releases can be found on
- `the Download Page `_.
+ `the Releases Page `_.
 

Are you planning to merge the changes in generic text over to the trunk once 
this lands?



Comment at: clang/docs/ReleaseNotes.rst:43
+  conforming GNU extensions. Projects incompatible with C++17 can add
+  ``-std=gnu++14`` to their build settings to restore the previous behaviour.
 

Do we want to mention that this may also impact build-time performance of 
projects relying on the default language standard mode, because C++17 pulls in 
a lot more compile-time-intensive APIs like constexpr and more template 
metaprogramming?



Comment at: clang/docs/ReleaseNotes.rst:46
+- The ``-fexperimental-new-pass-manager`` and ``-fno-legacy-pass-manager``
+  flags have been removed. These flags have been silently ignored since 15.
 

I don't know if we want to standardize on `Clang-15` or `Clang 15`, etc. Feel 
free to edit as you see fit.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142578

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


[PATCH] D142907: LangRef: Add "dynamic" option to "denormal-fp-math"

2023-01-30 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm created this revision.
arsenm added reviewers: scanon, spatel, cameron.mcinally, andrew.w.kaylor, tra, 
jlebar, Anastasia, yaxunl, efriedma, jcranmer-intel, kpn, sepavloff.
Herald added subscribers: kosarev, foad, StephenFan, wenlei, jdoerfert, 
kerbowa, pengfei, hiraditya, jvesely.
Herald added a project: All.
arsenm requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

This is stricter than the default "ieee", and should probably be the
default. This patch leaves the default alone. I can change this in a
future patch.

  

There are non-reversible transforms I would like to perform which are
legal under IEEE denormal handling, but illegal with flushing zero
behavior. Namely, conversions between llvm.is.fpclass and fcmp with
zeroes.

  

Under "ieee" handling, it is legal to translate between
llvm.is.fpclass(x, fcZero) and fcmp x, 0.

  

Under "preserve-sign" handling, it is legal to translate between
llvm.is.fpclass(x, fcSubnormal|fcZero) and fcmp x, 0.

  

I would like to compile and distribute some math library functions in
a mode where it's callable from code with and without denormals
enabled, which requires not changing the compares with denormals or
zeroes.

  

If an IEEE function transforms an llvm.is.fpclass call into an fcmp 0,
it is no longer possible to call the function from code with denormals
enabled, or write an optimization to move the function into a denormal
flushing mode. For the original function, if x was a denormal, the
class would evaluate to false. If the function compiled with denormal
handling was converted to or called from a preserve-sign function, the
fcmp now evaluates to true.

  

This could also be of use for strictfp handling, where code may be
changing the denormal mode.

  

Alternative name could be "unknown".


https://reviews.llvm.org/D142907

Files:
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/CodeGen/CodeGenAction.cpp
  clang/lib/CodeGen/CodeGenModule.h
  clang/test/CodeGen/denormalfpmode-f32.c
  clang/test/CodeGen/denormalfpmode.c
  clang/test/CodeGenCUDA/Inputs/ocml-sample.cl
  clang/test/CodeGenCUDA/link-builtin-bitcode-denormal-fp-mode.cu
  clang/test/Driver/denormal-fp-math.c
  llvm/docs/LangRef.rst
  llvm/include/llvm/ADT/FloatingPointMode.h
  llvm/include/llvm/IR/Attributes.td
  llvm/include/llvm/IR/Function.h
  llvm/lib/Analysis/ConstantFolding.cpp
  llvm/lib/CodeGen/CommandFlags.cpp
  llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
  llvm/lib/IR/Attributes.cpp
  llvm/lib/IR/Function.cpp
  llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h
  llvm/test/CodeGen/Generic/denormal-fp-math-cl-opt.ll
  llvm/test/CodeGen/X86/sqrt-fastmath.ll
  llvm/test/Transforms/Inline/AMDGPU/inline-denormal-fp-math.ll
  llvm/test/Transforms/InstSimplify/canonicalize.ll
  llvm/test/Transforms/InstSimplify/constant-fold-fp-denormal.ll
  llvm/unittests/ADT/FloatingPointMode.cpp
  llvm/utils/TableGen/Attributes.cpp

Index: llvm/utils/TableGen/Attributes.cpp
===
--- llvm/utils/TableGen/Attributes.cpp
+++ llvm/utils/TableGen/Attributes.cpp
@@ -54,6 +54,7 @@
   // Emit attribute enums in the same order llvm::Attribute::operator< expects.
   Emit({"EnumAttr", "TypeAttr", "IntAttr"}, "ATTRIBUTE_ENUM");
   Emit({"StrBoolAttr"}, "ATTRIBUTE_STRBOOL");
+  Emit({"ComplexStrAttr"}, "ATTRIBUTE_COMPLEXSTR");
 
   OS << "#undef ATTRIBUTE_ALL\n";
   OS << "#endif\n\n";
Index: llvm/unittests/ADT/FloatingPointMode.cpp
===
--- llvm/unittests/ADT/FloatingPointMode.cpp
+++ llvm/unittests/ADT/FloatingPointMode.cpp
@@ -20,6 +20,8 @@
 parseDenormalFPAttributeComponent("preserve-sign"));
   EXPECT_EQ(DenormalMode::PositiveZero,
 parseDenormalFPAttributeComponent("positive-zero"));
+  EXPECT_EQ(DenormalMode::Dynamic,
+parseDenormalFPAttributeComponent("dynamic"));
   EXPECT_EQ(DenormalMode::Invalid, parseDenormalFPAttributeComponent("foo"));
 }
 
@@ -27,6 +29,7 @@
   EXPECT_EQ("ieee", denormalModeKindName(DenormalMode::IEEE));
   EXPECT_EQ("preserve-sign", denormalModeKindName(DenormalMode::PreserveSign));
   EXPECT_EQ("positive-zero", denormalModeKindName(DenormalMode::PositiveZero));
+  EXPECT_EQ("dynamic", denormalModeKindName(DenormalMode::Dynamic));
   EXPECT_EQ("", denormalModeKindName(DenormalMode::Invalid));
 }
 
@@ -54,6 +57,10 @@
   EXPECT_EQ(DenormalMode(DenormalMode::PositiveZero, DenormalMode::PositiveZero),
 parseDenormalFPAttribute("positive-zero,positive-zero"));
 
+  EXPECT_EQ(DenormalMode(DenormalMode::Dynamic, DenormalMode::Dynamic),
+parseDenormalFPAttribute("dynamic"));
+  EXPECT_EQ(DenormalMode(DenormalMode::Dynamic, DenormalMode::Dynamic),
+parseDenormalFPAttribute("dynamic,dynamic"));
 
   EXPECT_EQ(DenormalMode(DenormalMode::IEEE, DenormalMode::PositiveZero),
 parseDenormalFPAttribute("ieee,positiv

[PATCH] D142861: [Clang] avoid relying on StringMap iteration order when roundtripping -analyzer-config

2023-01-30 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay accepted this revision.
MaskRay added inline comments.



Comment at: clang/lib/Frontend/CompilerInvocation.cpp:886
+  llvm::sort(SortedConfigOpts, [](const auto &A, const auto &B) {
+return std::get<0>(A) < std::get<0>(B);
+  });

If you use `pair` instead of `tuple`, you can use `llvm::less_first()`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142861

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


[PATCH] D142862: [Support] change StringMap hash function from djbHash to xxHash

2023-01-30 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

To enable smooth hash function migration in the future, we can explore the idea 
of adding `#ifdef EXPENSIVE_CHECKS\nshuffle` (see 
https://github.com/llvm/llvm-project/issues/34483).
That means we should fix these tests properly to be non-dependent on the 
iteration order.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142862

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


[PATCH] D142595: [Driver][AVR] Don't emit default '-Tdata' when '-T' is specified

2023-01-30 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay requested changes to this revision.
MaskRay added a comment.
This revision now requires changes to proceed.

In D142595#4089391 , @benshi001 wrote:

> In D142595#4089124 , @MaskRay wrote:
>
>> OK. If this doesn't add `-Tdata=` driver options, I'm fine with it.
>> But why is default `-Tdata` added in the first place?
>>
>> Most linker scripts are added as `-Wl,-T,a.lds` (`-Wl,` values are opaque to 
>> the driver), so the driver cannot really know whether a linker script is 
>> used.
>
> So how about change to
>
> 1. move the default `-Tdata` to a later position.
> 2. clang driver just checks `-T` but omits `-Wl`, this can not 100% fix the 
> issue, but at least improve it. Current most users are from avr-gcc, who have 
> get used to `-T`.
>
> A good solution is using default linker script provided by the avr-libc, 
> which will be overwritten by user's explicit specification.
>
> I will do that solution in a different patch, it needs more extra work. 
> Currently we just guarantee avr-gcc users's `-T` option will not be broken.

I think checking whether there is a linker script in any way is not a right 
solution.
GNU ld supports `-dT` which lld doesn't support. A linker script can be used 
without a -T/-dT option as well (it gets appended).
Any chance to remove `-Tdata=` and require the user to specify a `-Tdata=`?


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

https://reviews.llvm.org/D142595

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


[PATCH] D142799: [Clang] Fix unconditional access to Attr pointer when checking if _Nullable is applicable to a type

2023-01-30 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik updated this revision to Diff 493351.
shafik added a comment.

- Add release note


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

https://reviews.llvm.org/D142799

Files:
  clang/docs/ReleaseNotes.rst
  clang/lib/Sema/TreeTransform.h
  clang/test/SemaCXX/nullability.cpp


Index: clang/test/SemaCXX/nullability.cpp
===
--- clang/test/SemaCXX/nullability.cpp
+++ clang/test/SemaCXX/nullability.cpp
@@ -136,3 +136,9 @@
 void testNullabilityCompletenessWithTemplate() {
   Template tip;
 }
+
+namespace GH60344 {
+class a;
+template  using c = b _Nullable; // expected-error {{'_Nullable' 
cannot be applied to non-pointer type 'GH60344::a'}}
+c;  // expected-note {{in instantiation of template type alias 'c' 
requested here}}
+}
Index: clang/lib/Sema/TreeTransform.h
===
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -6992,7 +6992,8 @@
 // type sugar, and therefore cannot be diagnosed in any other way.
 if (auto nullability = oldType->getImmediateNullability()) {
   if (!modifiedType->canHaveNullability()) {
-SemaRef.Diag(TL.getAttr()->getLocation(),
+SemaRef.Diag((TL.getAttr() ? TL.getAttr()->getLocation()
+   : TL.getModifiedLoc().getBeginLoc()),
  diag::err_nullability_nonpointer)
 << DiagNullabilityKind(*nullability, false) << modifiedType;
 return QualType();
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -57,6 +57,9 @@
 - Fix crash on invalid code when looking up a destructor in a templated class
   inside a namespace. This fixes
   `Issue 59446 `_.
+- Fix crash when diagnosing incorrect usage of _Nullable involing alias
+  templates. This fixes
+  `Issue 60344 `_.
 
 Improvements to Clang's diagnostics
 ^^^


Index: clang/test/SemaCXX/nullability.cpp
===
--- clang/test/SemaCXX/nullability.cpp
+++ clang/test/SemaCXX/nullability.cpp
@@ -136,3 +136,9 @@
 void testNullabilityCompletenessWithTemplate() {
   Template tip;
 }
+
+namespace GH60344 {
+class a;
+template  using c = b _Nullable; // expected-error {{'_Nullable' cannot be applied to non-pointer type 'GH60344::a'}}
+c;  // expected-note {{in instantiation of template type alias 'c' requested here}}
+}
Index: clang/lib/Sema/TreeTransform.h
===
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -6992,7 +6992,8 @@
 // type sugar, and therefore cannot be diagnosed in any other way.
 if (auto nullability = oldType->getImmediateNullability()) {
   if (!modifiedType->canHaveNullability()) {
-SemaRef.Diag(TL.getAttr()->getLocation(),
+SemaRef.Diag((TL.getAttr() ? TL.getAttr()->getLocation()
+   : TL.getModifiedLoc().getBeginLoc()),
  diag::err_nullability_nonpointer)
 << DiagNullabilityKind(*nullability, false) << modifiedType;
 return QualType();
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -57,6 +57,9 @@
 - Fix crash on invalid code when looking up a destructor in a templated class
   inside a namespace. This fixes
   `Issue 59446 `_.
+- Fix crash when diagnosing incorrect usage of _Nullable involing alias
+  templates. This fixes
+  `Issue 60344 `_.
 
 Improvements to Clang's diagnostics
 ^^^
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D142862: [Support] change StringMap hash function from djbHash to xxHash

2023-01-30 Thread Noah Goldstein via Phabricator via cfe-commits
goldstein.w.n added a comment.

FWIW, if the only use if hashtables `xxhash` has a slight perf bug in 
`XXH3_len_129to240_128b` and `XXH3_len_129to240_64b` where it will repeat the 
last the block if length is a factor of `32`/`16` respectively.
`XXH3_len_129to240_128b`:

- https://github.com/Cyan4973/xxHash/blob/dev/xxhash.h#L3981

`XXH3_len_129to240_64b`:

- https://github.com/Cyan4973/xxHash/blob/dev/xxhash.h#L5877

It's not fixed b.c `xxhash` needs to have a stable result for compression, but 
for hashtable it might be worth fixing in the internal llvm version?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142862

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


[PATCH] D142384: [C++20] Fix a crash with modules.

2023-01-30 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments.



Comment at: clang/lib/AST/ExprConstant.cpp:6233
+  assert(RD->hasDefinition());
+  RD->getDefinition();
   if (RD->getNumVBases()) {

I think it would make sense to use the definition of the class as `RD` here, 
since we're going to be iterating through `RD`'s fields.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142384

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


[PATCH] D142914: [MLIR][OpenMP] Added OMPIRBuilder support for Target Data directives.

2023-01-30 Thread Akash Banerjee via Phabricator via cfe-commits
TIFitis created this revision.
TIFitis added reviewers: kiranchandramohan, clementval, jdoerfert.
Herald added subscribers: Moerafaat, zero9178, bzcheeseman, awarzynski, 
sdasgup3, wenzhicui, wrengr, cota, teijeong, rdzhabarov, tatianashp, msifontes, 
jurahul, Kayjukh, grosul1, Joonsoo, liufengdb, aartbik, mgester, arpith-jacob, 
antiagainst, shauheen, rriddle, mehdi_amini, thopre, guansong, hiraditya, 
yaxunl.
Herald added a reviewer: ftynse.
Herald added a project: All.
TIFitis requested review of this revision.
Herald added a reviewer: nicolasvasilache.
Herald added subscribers: llvm-commits, cfe-commits, sstefan1, 
stephenneuendorffer, nicolasvasilache.
Herald added a reviewer: dcaballe.
Herald added projects: clang, MLIR, LLVM.

This patch adds OpenMP IRBuilder support for the Target Data directives to 
allow lowering to LLVM IR.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142914

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
  llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
  llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
  llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
  mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp

Index: mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
===
--- mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
+++ mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
@@ -19,6 +19,7 @@
 
 #include "llvm/ADT/SetVector.h"
 #include "llvm/ADT/TypeSwitch.h"
+#include "llvm/Frontend/OpenMP/OMPConstants.h"
 #include "llvm/Frontend/OpenMP/OMPIRBuilder.h"
 #include "llvm/IR/DebugInfoMetadata.h"
 #include "llvm/IR/IRBuilder.h"
@@ -1338,6 +1339,230 @@
   return success();
 }
 
+/// Create a constant string location from the MLIR Location information.
+static llvm::Constant *
+createSourceLocStrFromLocation(Location loc, llvm::OpenMPIRBuilder &builder,
+   StringRef name, uint32_t &strLen) {
+  if (auto fileLoc = loc.dyn_cast()) {
+StringRef fileName = fileLoc.getFilename();
+unsigned lineNo = fileLoc.getLine();
+unsigned colNo = fileLoc.getColumn();
+return builder.getOrCreateSrcLocStr(name, fileName, lineNo, colNo, strLen);
+  }
+  std::string locStr;
+  llvm::raw_string_ostream locOS(locStr);
+  locOS << loc;
+  return builder.getOrCreateSrcLocStr(locOS.str(), strLen);
+}
+
+/// Create a constant string representing the mapping information extracted from
+/// the MLIR location information.
+static llvm::Constant *
+createMappingInformation(Location loc, llvm::OpenMPIRBuilder &builder) {
+  uint32_t strLen;
+  if (auto nameLoc = loc.dyn_cast()) {
+StringRef name = nameLoc.getName();
+return createSourceLocStrFromLocation(nameLoc.getChildLoc(), builder, name,
+  strLen);
+  }
+  return createSourceLocStrFromLocation(loc, builder, "unknown", strLen);
+}
+
+/// Computes the size of type in bytes.
+static llvm::Value *getSizeInBytes(llvm::IRBuilderBase &builder,
+   llvm::Value *basePtr) {
+  llvm::LLVMContext &ctx = builder.getContext();
+  llvm::Value *null =
+  llvm::Constant::getNullValue(basePtr->getType()->getPointerTo());
+  llvm::Value *sizeGep =
+  builder.CreateGEP(basePtr->getType(), null, builder.getInt32(1));
+  llvm::Value *sizePtrToInt =
+  builder.CreatePtrToInt(sizeGep, llvm::Type::getInt64Ty(ctx));
+  return sizePtrToInt;
+}
+
+/// Process MapOperands for Target Data directives.
+static LogicalResult processMapOperand(
+llvm::IRBuilderBase &builder, LLVM::ModuleTranslation &moduleTranslation,
+const SmallVector &mapOperands, const ArrayAttr &mapTypes,
+SmallVector &mapTypeFlags,
+SmallVectorImpl &mapNames,
+struct llvm::OpenMPIRBuilder::MapperAllocas &mapperAllocas) {
+
+  auto numMapOperands = mapOperands.size();
+  llvm::OpenMPIRBuilder *ompBuilder = moduleTranslation.getOpenMPBuilder();
+  llvm::PointerType *i8PtrTy = builder.getInt8PtrTy();
+  llvm::ArrayType *arrI8PtrTy = llvm::ArrayType::get(i8PtrTy, numMapOperands);
+  llvm::IntegerType *i64Ty = builder.getInt64Ty();
+  llvm::ArrayType *arrI64Ty = llvm::ArrayType::get(i64Ty, numMapOperands);
+
+  unsigned index = 0;
+  for (const auto &mapOp : mapOperands) {
+const auto &mapTypeOp = mapTypes[index];
+
+llvm::Value *mapOpValue = moduleTranslation.lookupValue(mapOp);
+llvm::Value *mapOpPtrBase;
+llvm::Value *mapOpPtr;
+llvm::Value *mapOpSize;
+
+if (mapOp.getType().isa()) {
+  mapOpPtrBase = mapOpValue;
+  mapOpPtr = mapOpValue;
+  mapOpSize = getSizeInBytes(builder, mapOpValue);
+} else {
+  return failure();
+}
+
+// Store base pointer extracted from operand into the i-th position of
+// argBase.
+llvm::Value *ptrBaseGEP = builder.CreateInBoundsGEP(
+arrI8PtrTy, mapperAllocas.ArgsBase,
+

[PATCH] D140270: MIPS: fix build from IR files, nan2008 and FpAbi

2023-01-30 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In D140270#4089857 , @wzssyqa wrote:

> ping

I don't know how to test this, so this will be up to @nathanchance ...
(Thanks for improving the mips port, though)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140270

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


[PATCH] D142861: [Clang] avoid relying on StringMap iteration order when roundtripping -analyzer-config

2023-01-30 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added inline comments.



Comment at: clang/lib/Frontend/CompilerInvocation.cpp:881
+  // Sort options by key to avoid relying on StringMap iteration order.
+  SmallVector, 4> SortedConfigOpts;
   for (const auto &C : Opts.Config) {

jansvoboda11 wrote:
> jansvoboda11 wrote:
> > I think you should be able to drop `llvm::`.
> No reason to allocate for this temporary storage IMO, you could replace 
> `std::string` with `StringRef`.
Perhaps std::pair would be slightly easier to read than std::tuple?



Comment at: clang/lib/Frontend/CompilerInvocation.cpp:882-884
   for (const auto &C : Opts.Config) {
+SortedConfigOpts.emplace_back(C.getKey(), C.getValue());
+  }

jansvoboda11 wrote:
> Per our coding style, we don't put braces around bodies with just a single 
> statement.
We usually skip braces on single line blocks



Comment at: clang/lib/Frontend/CompilerInvocation.cpp:889-891
+  for (const auto &C : SortedConfigOpts) {
+const llvm::StringRef &Key = std::get<0>(C);
+const std::string &Value = std::get<1>(C);

jansvoboda11 wrote:
> You could use C++17 structured bindings: `for (const auto &[Key, Value] : 
> SortedConfigOpts) { ... }`.
maybe a structured binding here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142861

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


[PATCH] D142861: [Clang] avoid relying on StringMap iteration order when roundtripping -analyzer-config

2023-01-30 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

(heh, don't mind my feedback being duplicate - didn't refresh before submitting 
- glad other folks got to it before me! :) )


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142861

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


[PATCH] D142917: [Fuchsia] Re-enable HWASan for globals in runtimes

2023-01-30 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added a reviewer: leonardchan.
Herald added a subscriber: abrachet.
Herald added a project: All.
phosek requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This is now supported.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142917

Files:
  clang/cmake/caches/Fuchsia-stage2.cmake


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -224,7 +224,6 @@
   set(RUNTIMES_aarch64-unknown-fuchsia+hwasan_LLVM_USE_SANITIZER "HWAddress" 
CACHE STRING "")
   
set(RUNTIMES_aarch64-unknown-fuchsia+hwasan_LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS
 OFF CACHE BOOL "")
   
set(RUNTIMES_aarch64-unknown-fuchsia+hwasan_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS
 OFF CACHE BOOL "")
-  set(RUNTIMES_aarch64-unknown-fuchsia+hwasan_CMAKE_CXX_FLAGS 
"${FUCHSIA_aarch64-unknown-fuchsia_COMPILER_FLAGS} -mllvm --hwasan-globals=0" 
CACHE STRING "")
 
   # HWASan+noexcept
   set(RUNTIMES_aarch64-unknown-fuchsia+hwasan+noexcept_LLVM_BUILD_COMPILER_RT 
OFF CACHE BOOL "")
@@ -233,7 +232,6 @@
   
set(RUNTIMES_aarch64-unknown-fuchsia+hwasan+noexcept_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS
 OFF CACHE BOOL "")
   
set(RUNTIMES_aarch64-unknown-fuchsia+hwasan+noexcept_LIBCXXABI_ENABLE_EXCEPTIONS
 OFF CACHE BOOL "")
   
set(RUNTIMES_aarch64-unknown-fuchsia+hwasan+noexcept_LIBCXX_ENABLE_EXCEPTIONS 
OFF CACHE BOOL "")
-  set(RUNTIMES_aarch64-unknown-fuchsia+hwasan+noexcept_CMAKE_CXX_FLAGS 
"${FUCHSIA_aarch64-unknown-fuchsia_COMPILER_FLAGS} -mllvm --hwasan-globals=0" 
CACHE STRING "")
 
   set(LLVM_RUNTIME_MULTILIBS 
"asan;noexcept;compat;asan+noexcept;hwasan;hwasan+noexcept" CACHE STRING "")
 


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -224,7 +224,6 @@
   set(RUNTIMES_aarch64-unknown-fuchsia+hwasan_LLVM_USE_SANITIZER "HWAddress" CACHE STRING "")
   set(RUNTIMES_aarch64-unknown-fuchsia+hwasan_LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
   set(RUNTIMES_aarch64-unknown-fuchsia+hwasan_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
-  set(RUNTIMES_aarch64-unknown-fuchsia+hwasan_CMAKE_CXX_FLAGS "${FUCHSIA_aarch64-unknown-fuchsia_COMPILER_FLAGS} -mllvm --hwasan-globals=0" CACHE STRING "")
 
   # HWASan+noexcept
   set(RUNTIMES_aarch64-unknown-fuchsia+hwasan+noexcept_LLVM_BUILD_COMPILER_RT OFF CACHE BOOL "")
@@ -233,7 +232,6 @@
   set(RUNTIMES_aarch64-unknown-fuchsia+hwasan+noexcept_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
   set(RUNTIMES_aarch64-unknown-fuchsia+hwasan+noexcept_LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
   set(RUNTIMES_aarch64-unknown-fuchsia+hwasan+noexcept_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
-  set(RUNTIMES_aarch64-unknown-fuchsia+hwasan+noexcept_CMAKE_CXX_FLAGS "${FUCHSIA_aarch64-unknown-fuchsia_COMPILER_FLAGS} -mllvm --hwasan-globals=0" CACHE STRING "")
 
   set(LLVM_RUNTIME_MULTILIBS "asan;noexcept;compat;asan+noexcept;hwasan;hwasan+noexcept" CACHE STRING "")
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D141861: [nvptx-arch] Dynamically load the CUDA runtime if not found during the build

2023-01-30 Thread Steven Johnson via Phabricator via cfe-commits
srj added a comment.

In D141861#4060100 , @jhuber6 wrote:

> In D141861#4060028 , @srj wrote:
>
>> This change appears to have broken the build when crosscompiling to x86-32 
>> on a Linux x86-64 system; on the Halide buildbots, we now fail at link time 
>> with
>>
>>   FAILED: bin/nvptx-arch 
>>   : && /usr/bin/g++-7  -m32 -Wno-psabi -fPIC -fno-semantic-interposition 
>> -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra 
>> -Wno-unused-parameter -Wwrite-strings -Wcast-qual 
>> -Wno-missing-field-initializers -pedantic -Wno-long-long 
>> -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-noexcept-type 
>> -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation 
>> -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common 
>> -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG 
>> -Wl,-rpath-link,/home/halidenightly/build_bot/worker/llvm-16-x86-32-linux/llvm-build/./lib
>>   -Wl,--gc-sections 
>> tools/clang/tools/nvptx-arch/CMakeFiles/nvptx-arch.dir/NVPTXArch.cpp.o -o 
>> bin/nvptx-arch  -Wl,-rpath,"\$ORIGIN/../lib"  lib/libLLVMSupport.a  
>> -lpthread  -lrt  -ldl  -lpthread  -lm  lib/libLLVMDemangle.a && :
>>   /usr/bin/ld: 
>> tools/clang/tools/nvptx-arch/CMakeFiles/nvptx-arch.dir/NVPTXArch.cpp.o: in 
>> function `handleError(cudaError_enum)':
>>   NVPTXArch.cpp:(.text._ZL11handleError14cudaError_enum+0x2b): undefined 
>> reference to `cuGetErrorString'
>>   /usr/bin/ld: 
>> tools/clang/tools/nvptx-arch/CMakeFiles/nvptx-arch.dir/NVPTXArch.cpp.o: in 
>> function `main':
>>   NVPTXArch.cpp:(.text.startup.main+0xcf): undefined reference to `cuInit'
>>   /usr/bin/ld: NVPTXArch.cpp:(.text.startup.main+0xf9): undefined reference 
>> to `cuDeviceGetCount'
>>   /usr/bin/ld: NVPTXArch.cpp:(.text.startup.main+0x11e): undefined reference 
>> to `cuDeviceGet'
>>   /usr/bin/ld: NVPTXArch.cpp:(.text.startup.main+0x131): undefined reference 
>> to `cuDeviceGetAttribute'
>>   /usr/bin/ld: NVPTXArch.cpp:(.text.startup.main+0x146): undefined reference 
>> to `cuDeviceGetAttribute'
>>   collect2: error: ld returned 1 exit status
>>
>> I'm guessing that the problem here is that the build machine has Cuda 
>> installed (so the headers are found), but no 32-bit version of Cuda (so 
>> linking fails).
>>
>> Probably easy to fix, but as of right now, our 32-bit testing is dead in the 
>> water; could someone please revert this pending a proper fix?
>
> Can you let me know if rG4ce454c654bd 
>  solves 
> it? I'm guessing the problem is arising when we find the libraries at build 
> configure time but not at build time so we might need another check as well.

It looks like this change (but not the rG4ce454c654bd 
) is in 
the 17 branch, as the latter is now failing in the same way for crosscompiles.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141861

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


[clang] 52c28d7 - clang/OpenCL: Don't use a Function for the block type

2023-01-30 Thread Matt Arsenault via cfe-commits

Author: Matt Arsenault
Date: 2023-01-30T15:03:14-04:00
New Revision: 52c28d7cf9018f3558268217f6cf91271eb4ac39

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

LOG: clang/OpenCL: Don't use a Function for the block type

The AMDGPU value for this is not really a function. Currently we're
emitting IR that isn't true to what will eventually be emitted.

Added: 


Modified: 
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/CodeGen/CGOpenCLRuntime.cpp
clang/lib/CodeGen/CGOpenCLRuntime.h
clang/lib/CodeGen/TargetInfo.cpp
clang/lib/CodeGen/TargetInfo.h

Removed: 




diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index bf23774c3fe12..76c4b7ed88d13 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -4923,7 +4923,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
   auto Info =
   CGM.getOpenCLRuntime().emitOpenCLEnqueuedBlock(*this, E->getArg(3));
   llvm::Value *Kernel =
-  Builder.CreatePointerCast(Info.Kernel, GenericVoidPtrTy);
+  Builder.CreatePointerCast(Info.KernelHandle, GenericVoidPtrTy);
   llvm::Value *Block =
   Builder.CreatePointerCast(Info.BlockArg, GenericVoidPtrTy);
 
@@ -4977,7 +4977,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
   auto Info =
   CGM.getOpenCLRuntime().emitOpenCLEnqueuedBlock(*this, E->getArg(3));
   llvm::Value *Kernel =
-  Builder.CreatePointerCast(Info.Kernel, GenericVoidPtrTy);
+  Builder.CreatePointerCast(Info.KernelHandle, GenericVoidPtrTy);
   auto *Block = Builder.CreatePointerCast(Info.BlockArg, GenericVoidPtrTy);
   llvm::Value *ElemPtr, *TmpSize, *TmpPtr;
   std::tie(ElemPtr, TmpSize, TmpPtr) = CreateArrayForSizeVar(4);
@@ -5034,7 +5034,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
   auto Info =
   CGM.getOpenCLRuntime().emitOpenCLEnqueuedBlock(*this, E->getArg(6));
   llvm::Value *Kernel =
-  Builder.CreatePointerCast(Info.Kernel, GenericVoidPtrTy);
+  Builder.CreatePointerCast(Info.KernelHandle, GenericVoidPtrTy);
   llvm::Value *Block =
   Builder.CreatePointerCast(Info.BlockArg, GenericVoidPtrTy);
 
@@ -5084,7 +5084,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
 getContext().getTargetAddressSpace(LangAS::opencl_generic));
 auto Info =
 CGM.getOpenCLRuntime().emitOpenCLEnqueuedBlock(*this, E->getArg(0));
-Value *Kernel = Builder.CreatePointerCast(Info.Kernel, GenericVoidPtrTy);
+Value *Kernel =
+Builder.CreatePointerCast(Info.KernelHandle, GenericVoidPtrTy);
 Value *Arg = Builder.CreatePointerCast(Info.BlockArg, GenericVoidPtrTy);
 return RValue::get(EmitRuntimeCall(
 CGM.CreateRuntimeFunction(
@@ -5098,7 +5099,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
 getContext().getTargetAddressSpace(LangAS::opencl_generic));
 auto Info =
 CGM.getOpenCLRuntime().emitOpenCLEnqueuedBlock(*this, E->getArg(0));
-Value *Kernel = Builder.CreatePointerCast(Info.Kernel, GenericVoidPtrTy);
+Value *Kernel =
+Builder.CreatePointerCast(Info.KernelHandle, GenericVoidPtrTy);
 Value *Arg = Builder.CreatePointerCast(Info.BlockArg, GenericVoidPtrTy);
 return RValue::get(EmitRuntimeCall(
 CGM.CreateRuntimeFunction(
@@ -5115,7 +5117,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
 llvm::Value *NDRange = NDRangeL.getAddress(*this).getPointer();
 auto Info =
 CGM.getOpenCLRuntime().emitOpenCLEnqueuedBlock(*this, E->getArg(1));
-Value *Kernel = Builder.CreatePointerCast(Info.Kernel, GenericVoidPtrTy);
+Value *Kernel =
+Builder.CreatePointerCast(Info.KernelHandle, GenericVoidPtrTy);
 Value *Block = Builder.CreatePointerCast(Info.BlockArg, GenericVoidPtrTy);
 const char *Name =
 BuiltinID == Builtin::BIget_kernel_max_sub_group_size_for_ndrange

diff  --git a/clang/lib/CodeGen/CGOpenCLRuntime.cpp 
b/clang/lib/CodeGen/CGOpenCLRuntime.cpp
index ab8de7ecf50c4..5a5d7a4d18c57 100644
--- a/clang/lib/CodeGen/CGOpenCLRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenCLRuntime.cpp
@@ -156,7 +156,7 @@ void CGOpenCLRuntime::recordBlockInfo(const BlockExpr *E,
   EnqueuedBlockMap[E].InvokeFunc = InvokeF;
   EnqueuedBlockMap[E].BlockArg = Block;
   EnqueuedBlockMap[E].BlockTy = BlockTy;
-  EnqueuedBlockMap[E].Kernel = nullptr;
+  EnqueuedBlockMap[E].KernelHandle = nullptr;
 }
 
 llvm::Function *CGOpenCLRuntime::getInvokeFunction(const Expr *E) {
@@ -175,7 +175,7 @@ CGOpenCLRuntime::emitOpenCLEnqueuedBlo

[clang] 00f6a7f - clang/OpenCL: Fix not setting convergent on block invoke kernels

2023-01-30 Thread Matt Arsenault via cfe-commits

Author: Matt Arsenault
Date: 2023-01-30T15:03:14-04:00
New Revision: 00f6a7f02f9c8d542ce8ff1c9c037d9fdb421b88

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

LOG: clang/OpenCL: Fix not setting convergent on block invoke kernels

Yet another example how convergent not being the default is dangerous
and backwards.

Added: 


Modified: 
clang/lib/CodeGen/TargetInfo.cpp
clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl
clang/test/CodeGenOpenCL/cl20-device-side-enqueue.cl

Removed: 




diff  --git a/clang/lib/CodeGen/TargetInfo.cpp 
b/clang/lib/CodeGen/TargetInfo.cpp
index 1b80529e36a72..7e08d42e866ff 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -12451,6 +12451,7 @@ llvm::Value 
*TargetCodeGenInfo::createEnqueuedBlockKernel(
 
   // FIXME: Apply default attributes
   F->addFnAttr(llvm::Attribute::NoUnwind);
+  F->addFnAttr(llvm::Attribute::Convergent);
 
   Builder.CreateRetVoid();
   Builder.restoreIP(IP);
@@ -12504,6 +12505,7 @@ llvm::Value 
*AMDGPUTargetCodeGenInfo::createEnqueuedBlockKernel(
 
   // FIXME: Apply default attributes
   F->addFnAttr(llvm::Attribute::NoUnwind);
+  F->addFnAttr(llvm::Attribute::Convergent);
   F->addFnAttr("enqueued-block");
 
   auto IP = CGF.Builder.saveIP();

diff  --git a/clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl 
b/clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl
index 4277dbbc20530..17c5fc6132856 100644
--- a/clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl
+++ b/clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl
@@ -182,7 +182,7 @@ kernel void test(global char *a, char b, global long *c, 
long d) {
 // CHECK-NEXT:ret void
 //
 //
-// CHECK: Function Attrs: nounwind
+// CHECK: Function Attrs: convergent nounwind
 // CHECK-LABEL: define {{[^@]+}}@__test_block_invoke_kernel
 // CHECK-SAME: (<{ i32, i32, ptr, ptr addrspace(1), i8 }> [[TMP0:%.*]]) 
#[[ATTR4:[0-9]+]] !kernel_arg_addr_space !7 !kernel_arg_access_qual !8 
!kernel_arg_type !9 !kernel_arg_base_type !9 !kernel_arg_type_qual !10 {
 // CHECK-NEXT:  entry:
@@ -216,7 +216,7 @@ kernel void test(global char *a, char b, global long *c, 
long d) {
 // CHECK-NEXT:ret void
 //
 //
-// CHECK: Function Attrs: nounwind
+// CHECK: Function Attrs: convergent nounwind
 // CHECK-LABEL: define {{[^@]+}}@__test_block_invoke_2_kernel
 // CHECK-SAME: (<{ i32, i32, ptr, ptr addrspace(1), ptr addrspace(1), i64, i8 
}> [[TMP0:%.*]]) #[[ATTR4]] !kernel_arg_addr_space !7 !kernel_arg_access_qual 
!8 !kernel_arg_type !9 !kernel_arg_base_type !9 !kernel_arg_type_qual !10 {
 // CHECK-NEXT:  entry:
@@ -255,7 +255,7 @@ kernel void test(global char *a, char b, global long *c, 
long d) {
 // CHECK-NEXT:ret void
 //
 //
-// CHECK: Function Attrs: nounwind
+// CHECK: Function Attrs: convergent nounwind
 // CHECK-LABEL: define {{[^@]+}}@__test_block_invoke_3_kernel
 // CHECK-SAME: (<{ i32, i32, ptr, ptr addrspace(1), ptr addrspace(1), i64, i8 
}> [[TMP0:%.*]], ptr addrspace(3) [[TMP1:%.*]]) #[[ATTR4]] 
!kernel_arg_addr_space !11 !kernel_arg_access_qual !12 !kernel_arg_type !13 
!kernel_arg_base_type !13 !kernel_arg_type_qual !14 {
 // CHECK-NEXT:  entry:
@@ -282,7 +282,7 @@ kernel void test(global char *a, char b, global long *c, 
long d) {
 // CHECK-NEXT:ret void
 //
 //
-// CHECK: Function Attrs: nounwind
+// CHECK: Function Attrs: convergent nounwind
 // CHECK-LABEL: define {{[^@]+}}@__test_block_invoke_4_kernel
 // CHECK-SAME: (<{ i32, i32, ptr, i64, ptr addrspace(1) }> [[TMP0:%.*]]) 
#[[ATTR4]] !kernel_arg_addr_space !7 !kernel_arg_access_qual !8 
!kernel_arg_type !9 !kernel_arg_base_type !9 !kernel_arg_type_qual !10 {
 // CHECK-NEXT:  entry:
@@ -297,7 +297,7 @@ kernel void test(global char *a, char b, global long *c, 
long d) {
 // CHECK: attributes #1 = { convergent noinline norecurse nounwind optnone 
"amdgpu-flat-work-group-size"="1,256" "no-trapping-math"="true" 
"stack-protector-buffer-size"="8" "target-cpu"="gfx900" 
"target-features"="+16-bit-insts,+ci-insts,+dpp,+gfx8-insts,+gfx9-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64"
 "uniform-work-group-size"="false" }
 // CHECK: attributes #2 = { nocallback nofree nounwind willreturn 
memory(argmem: readwrite) }
 // CHECK: attributes #3 = { convergent noinline nounwind optnone 
"no-trapping-math"="true" "stack-protector-buffer-size"="8" 
"target-cpu"="gfx900" 
"target-features"="+16-bit-insts,+ci-insts,+dpp,+gfx8-insts,+gfx9-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64"
 }
-// CHECK: attributes #4 = { nounwind "enqueued-block" }
+// CHECK: attributes #4 = { convergent nounwind "enqueued-block" }
 // CHECK: attributes #5 = { convergent nounwind }
 //.
 // CHECK: !0 = !{i32 1, !"amdgpu_code_object_version", i32 400}

diff  --git a/clang/test/CodeGenOpenCL/cl20-device-side-e

[clang] d12ee4b - clang/OpenCL: Extend tests for enqueued block attributes

2023-01-30 Thread Matt Arsenault via cfe-commits

Author: Matt Arsenault
Date: 2023-01-30T15:03:15-04:00
New Revision: d12ee4bf7c14a00b14890fc3042edd659dde7fb2

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

LOG: clang/OpenCL: Extend tests for enqueued block attributes

Baseline tests showing that enqueued blocks are not getting the
correct attributes applied.

Added: 


Modified: 
clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl

Removed: 




diff  --git a/clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl 
b/clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl
index 17c5fc613285..c56aee03441d 100644
--- a/clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl
+++ b/clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl
@@ -1,5 +1,5 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --function-signature --check-attributes --check-globals 
--include-generated-funcs --prefix-filecheck-ir-name VAR
-// RUN: %clang_cc1 -cl-std=CL2.0 -O0 -disable-llvm-passes -fno-ident 
-emit-llvm -o - -triple amdgcn-amd-amdhsa -target-cpu gfx900 %s | FileCheck %s 
--check-prefix=CHECK
+// RUN: %clang_cc1 -cl-std=CL2.0 -O0 -disable-llvm-passes -fno-ident 
-emit-llvm -o - -triple amdgcn-amd-amdhsa %s 
-fdenormal-fp-math-f32=preserve-sign | FileCheck %s --check-prefix=CHECK
 
 typedef struct {int a;} ndrange_t;
 
@@ -35,9 +35,40 @@ kernel void test(global char *a, char b, global long *c, 
long d) {
 
   enqueue_kernel(default_queue, flags, ndrange, block);
 }
+
+// Test that target attributes are applied to the functions inserted for the
+// block.
+__attribute__((target("s-memtime-inst")))
+kernel void test_target_features_kernel(global int *i) {
+  queue_t default_queue;
+  unsigned flags = 0;
+  ndrange_t ndrange;
+
+  enqueue_kernel(default_queue, flags, ndrange,
+ ^(void) {
+   __builtin_amdgcn_s_memtime();
+ });
+}
+
+__attribute__((target("s-memtime-inst")))
+void test_target_features_func(global int *i) {
+  queue_t default_queue;
+  unsigned flags = 0;
+  ndrange_t ndrange;
+
+  enqueue_kernel(default_queue, flags, ndrange,
+ ^(void) {
+   __builtin_amdgcn_s_memtime();
+ });
+}
+
+//.
+// CHECK: @__block_literal_global = internal addrspace(1) constant { i32, i32, 
ptr } { i32 16, i32 8, ptr @__test_target_features_kernel_block_invoke }, align 
8 #0
+// CHECK: @__block_literal_global.1 = internal addrspace(1) constant { i32, 
i32, ptr } { i32 16, i32 8, ptr @__test_target_features_func_block_invoke }, 
align 8 #0
+//.
 // CHECK: Function Attrs: convergent noinline norecurse nounwind optnone
 // CHECK-LABEL: define {{[^@]+}}@callee
-// CHECK-SAME: (i64 noundef [[ID:%.*]], ptr addrspace(1) noundef [[OUT:%.*]]) 
#[[ATTR0:[0-9]+]] {
+// CHECK-SAME: (i64 noundef [[ID:%.*]], ptr addrspace(1) noundef [[OUT:%.*]]) 
#[[ATTR1:[0-9]+]] {
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:[[ID_ADDR:%.*]] = alloca i64, align 8, addrspace(5)
 // CHECK-NEXT:[[OUT_ADDR:%.*]] = alloca ptr addrspace(1), align 8, 
addrspace(5)
@@ -53,7 +84,7 @@ kernel void test(global char *a, char b, global long *c, long 
d) {
 //
 // CHECK: Function Attrs: convergent noinline norecurse nounwind optnone
 // CHECK-LABEL: define {{[^@]+}}@test
-// CHECK-SAME: (ptr addrspace(1) noundef align 1 [[A:%.*]], i8 noundef 
[[B:%.*]], ptr addrspace(1) noundef align 8 [[C:%.*]], i64 noundef [[D:%.*]]) 
#[[ATTR1:[0-9]+]] !kernel_arg_addr_space !3 !kernel_arg_access_qual !4 
!kernel_arg_type !5 !kernel_arg_base_type !5 !kernel_arg_type_qual !6 {
+// CHECK-SAME: (ptr addrspace(1) noundef align 1 [[A:%.*]], i8 noundef 
[[B:%.*]], ptr addrspace(1) noundef align 8 [[C:%.*]], i64 noundef [[D:%.*]]) 
#[[ATTR2:[0-9]+]] !kernel_arg_addr_space !3 !kernel_arg_access_qual !4 
!kernel_arg_type !5 !kernel_arg_base_type !5 !kernel_arg_type_qual !6 {
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:[[A_ADDR:%.*]] = alloca ptr addrspace(1), align 8, 
addrspace(5)
 // CHECK-NEXT:[[B_ADDR:%.*]] = alloca i8, align 1, addrspace(5)
@@ -167,7 +198,7 @@ kernel void test(global char *a, char b, global long *c, 
long d) {
 //
 // CHECK: Function Attrs: convergent noinline nounwind optnone
 // CHECK-LABEL: define {{[^@]+}}@__test_block_invoke
-// CHECK-SAME: (ptr noundef [[DOTBLOCK_DESCRIPTOR:%.*]]) #[[ATTR3:[0-9]+]] {
+// CHECK-SAME: (ptr noundef [[DOTBLOCK_DESCRIPTOR:%.*]]) #[[ATTR4:[0-9]+]] {
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:[[DOTBLOCK_DESCRIPTOR_ADDR:%.*]] = alloca ptr, align 8, 
addrspace(5)
 // CHECK-NEXT:[[BLOCK_ADDR:%.*]] = alloca ptr, align 8, addrspace(5)
@@ -184,7 +215,7 @@ kernel void test(global char *a, char b, global long *c, 
long d) {
 //
 // CHECK: Function Attrs: convergent nounwind
 // CHECK-LABEL: define {{[^@]+}}@__test_block_invoke_kernel
-// CHECK-SAME: (<{ i

[PATCH] D141447: clang/OpenCL: Don't use a Function for the block type

2023-01-30 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm closed this revision.
arsenm added a comment.

52c28d7cf9018f3558268217f6cf91271eb4ac39 



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

https://reviews.llvm.org/D141447

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


[PATCH] D141449: clang/OpenCL: Fix not setting convergent on block invoke kernels

2023-01-30 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm closed this revision.
arsenm added a comment.

00f6a7f02f9c8d542ce8ff1c9c037d9fdb421b88 



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

https://reviews.llvm.org/D141449

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


[PATCH] D140270: MIPS: fix build from IR files, nan2008 and FpAbi

2023-01-30 Thread Nathan Chancellor via Phabricator via cfe-commits
nathanchance added a comment.

I tested this against the kernel and left my feedback above (no issues) so this 
can be merged.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140270

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


[PATCH] D142799: [Clang] Fix unconditional access to Attr pointer when checking if _Nullable is applicable to a type

2023-01-30 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr2 accepted this revision.
gribozavr2 added inline comments.



Comment at: clang/docs/ReleaseNotes.rst:60
   `Issue 59446 `_.
+- Fix crash when diagnosing incorrect usage of _Nullable involing alias
+  templates. This fixes




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

https://reviews.llvm.org/D142799

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


[PATCH] D141620: clang/OpenCL: Apply default attributes to enqueued blocks

2023-01-30 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm closed this revision.
arsenm added a comment.

647925648a0fde06b5b44086843f0d8f164a71df 



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

https://reviews.llvm.org/D141620

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


  1   2   >