[PATCH] D130831: [CodeGen] Track DeferredDecls that have been emitted

2022-07-30 Thread Jun Zhang via Phabricator via cfe-commits
junaire created this revision.
junaire added a reviewer: v.g.vassilev.
Herald added a project: All.
junaire requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

If we run into a first usage or definition of a mangled name, and
there's a DeferredDecl that associated with it, we should remember it we
need to emit it later on.

Without this patch, clang-repl hits a JIT symbol not found error:
clang-repl> extern "C" int printf(const char *, ...);
clang-repl> auto l1 = []() { printf("ONE\n"); return 42; };
clang-repl> auto l2 = []() { printf("TWO\n"); return 17; };
clang-repl> auto r1 = l1();
ONE
clang-repl> auto r2 = l2();
TWO
clang-repl> auto r3 = l2();
JIT session error: Symbols not found: [ l2 ]
error: Failed to materialize symbols: { (main,
{ r3, __orc_init_func.incr_module_5, $.incr_module_5.__inits.0 }) }


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130831

Files:
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/test/Interpreter/lambda.cpp


Index: clang/test/Interpreter/lambda.cpp
===
--- /dev/null
+++ clang/test/Interpreter/lambda.cpp
@@ -0,0 +1,21 @@
+// RUN: clang-repl "int x = 10;" "int y=7; err;" "int y = 10;"
+// RUN: clang-repl "int i = 10;" 'extern "C" int printf(const char*,...);' \
+// RUN:'auto r1 = printf("i = %d\n", i);' | FileCheck 
--check-prefix=CHECK-DRIVER %s
+// REQUIRES: host-supports-jit
+// UNSUPPORTED: system-aix
+// CHECK-DRIVER: i = 10
+// RUN: cat %s | clang-repl | FileCheck %s
+// RUN: cat %s | clang-repl -Xcc -O2 | FileCheck %s
+extern "C" int printf(const char *, ...);
+
+auto l1 = []() { printf("ONE\n"); return 42; };
+auto l2 = []() { printf("TWO\n"); return 17; };
+
+auto r1 = l1();
+// CHECK: ONE
+auto r2 = l2();
+// CHECK: TWO
+auto r3 = l2();
+// CHECK: TWO
+
+%quit
Index: clang/lib/CodeGen/CodeGenModule.cpp
===
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -3271,6 +3271,7 @@
 // The value must be emitted, but cannot be emitted eagerly.
 assert(!MayBeEmittedEagerly(Global));
 addDeferredDeclToEmit(GD);
+EmittedDeferredDecls[MangledName] = GD;
   } else {
 // Otherwise, remember that we saw a deferred decl with this name.  The
 // first use of the mangled name will cause it to move into
@@ -3988,6 +3989,7 @@
   // DeferredDeclsToEmit list, and remove it from DeferredDecls (since we
   // don't need it anymore).
   addDeferredDeclToEmit(DDI->second);
+  EmittedDeferredDecls[DDI->first] = DDI->second;
   DeferredDecls.erase(DDI);
 
   // Otherwise, there are cases we have to worry about where we're
@@ -4269,6 +4271,7 @@
 // Move the potentially referenced deferred decl to the DeferredDeclsToEmit
 // list, and remove it from DeferredDecls (since we don't need it anymore).
 addDeferredDeclToEmit(DDI->second);
+EmittedDeferredDecls[DDI->first] = DDI->second;
 DeferredDecls.erase(DDI);
   }
 


Index: clang/test/Interpreter/lambda.cpp
===
--- /dev/null
+++ clang/test/Interpreter/lambda.cpp
@@ -0,0 +1,21 @@
+// RUN: clang-repl "int x = 10;" "int y=7; err;" "int y = 10;"
+// RUN: clang-repl "int i = 10;" 'extern "C" int printf(const char*,...);' \
+// RUN:'auto r1 = printf("i = %d\n", i);' | FileCheck --check-prefix=CHECK-DRIVER %s
+// REQUIRES: host-supports-jit
+// UNSUPPORTED: system-aix
+// CHECK-DRIVER: i = 10
+// RUN: cat %s | clang-repl | FileCheck %s
+// RUN: cat %s | clang-repl -Xcc -O2 | FileCheck %s
+extern "C" int printf(const char *, ...);
+
+auto l1 = []() { printf("ONE\n"); return 42; };
+auto l2 = []() { printf("TWO\n"); return 17; };
+
+auto r1 = l1();
+// CHECK: ONE
+auto r2 = l2();
+// CHECK: TWO
+auto r3 = l2();
+// CHECK: TWO
+
+%quit
Index: clang/lib/CodeGen/CodeGenModule.cpp
===
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -3271,6 +3271,7 @@
 // The value must be emitted, but cannot be emitted eagerly.
 assert(!MayBeEmittedEagerly(Global));
 addDeferredDeclToEmit(GD);
+EmittedDeferredDecls[MangledName] = GD;
   } else {
 // Otherwise, remember that we saw a deferred decl with this name.  The
 // first use of the mangled name will cause it to move into
@@ -3988,6 +3989,7 @@
   // DeferredDeclsToEmit list, and remove it from DeferredDecls (since we
   // don't need it anymore).
   addDeferredDeclToEmit(DDI->second);
+  EmittedDeferredDecls[DDI->first] = DDI->second;
   DeferredDecls.erase(DDI);
 
   // Otherwise, there are cases we have to worry about where we're
@@ -4269,6 +4271,7 @@
 // Move the potentially referenced deferred decl to the DeferredDeclsToEmit
 // list, and remove it from DeferredDecls (since we 

[clang] 3da1395 - [CodeGen][NFC] Use isa_and_nonnull instead of explicit check

2022-07-30 Thread Jun Zhang via cfe-commits

Author: Jun Zhang
Date: 2022-07-31T13:03:24+08:00
New Revision: 3da13953834eb31b41949e92886f6fb7f3fd63fc

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

LOG: [CodeGen][NFC] Use isa_and_nonnull instead of explicit check

Signed-off-by: Jun Zhang 

Added: 


Modified: 
clang/lib/CodeGen/CodeGenModule.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CodeGenModule.cpp 
b/clang/lib/CodeGen/CodeGenModule.cpp
index 8940cee37d3e6..579ebba7736da 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -3974,7 +3974,7 @@ llvm::Constant *CodeGenModule::GetOrCreateLLVMFunction(
 // All MSVC dtors other than the base dtor are linkonce_odr and delegate to
 // each other bottoming out with the base dtor.  Therefore we emit non-base
 // dtors on usage, even if there is no dtor definition in the TU.
-if (D && isa(D) &&
+if (isa_and_nonnull(D) &&
 getCXXABI().useThunkForDtorVariant(cast(D),
GD.getDtorType()))
   addDeferredDeclToEmit(GD);



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


[PATCH] D124750: [MLIR] Add a utility to sort the operands of commutative ops

2022-07-30 Thread Jeff Niu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb508c5649f5e: [MLIR] Add a utility to sort the operands of 
commutative ops (authored by srishti-pm, committed by Mogball).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124750

Files:
  mlir/include/mlir/Transforms/CommutativityUtils.h
  mlir/lib/Transforms/Utils/CMakeLists.txt
  mlir/lib/Transforms/Utils/CommutativityUtils.cpp
  mlir/test/Transforms/test-commutativity-utils.mlir
  mlir/test/lib/Dialect/Test/TestOps.td
  mlir/test/lib/Transforms/CMakeLists.txt
  mlir/test/lib/Transforms/TestCommutativityUtils.cpp
  mlir/tools/mlir-opt/mlir-opt.cpp

Index: mlir/tools/mlir-opt/mlir-opt.cpp
===
--- mlir/tools/mlir-opt/mlir-opt.cpp
+++ mlir/tools/mlir-opt/mlir-opt.cpp
@@ -57,6 +57,7 @@
 void registerVectorizerTestPass();
 
 namespace test {
+void registerCommutativityUtils();
 void registerConvertCallOpPass();
 void registerInliner();
 void registerMemRefBoundCheck();
@@ -149,6 +150,7 @@
   registerVectorizerTestPass();
   registerTosaTestQuantUtilAPIPass();
 
+  mlir::test::registerCommutativityUtils();
   mlir::test::registerConvertCallOpPass();
   mlir::test::registerInliner();
   mlir::test::registerMemRefBoundCheck();
Index: mlir/test/lib/Transforms/TestCommutativityUtils.cpp
===
--- /dev/null
+++ mlir/test/lib/Transforms/TestCommutativityUtils.cpp
@@ -0,0 +1,48 @@
+//===- TestCommutativityUtils.cpp - Pass to test the commutativity utility-===//
+//
+// 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
+//
+//===--===//
+//
+// This pass tests the functionality of the commutativity utility pattern.
+//
+//===--===//
+
+#include "mlir/Transforms/CommutativityUtils.h"
+
+#include "TestDialect.h"
+#include "mlir/Pass/Pass.h"
+#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
+
+using namespace mlir;
+
+namespace {
+
+struct CommutativityUtils
+: public PassWrapper> {
+  MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CommutativityUtils)
+
+  StringRef getArgument() const final { return "test-commutativity-utils"; }
+  StringRef getDescription() const final {
+return "Test the functionality of the commutativity utility";
+  }
+
+  void runOnOperation() override {
+auto func = getOperation();
+auto *context = ();
+
+RewritePatternSet patterns(context);
+populateCommutativityUtilsPatterns(patterns);
+
+(void)applyPatternsAndFoldGreedily(func, std::move(patterns));
+  }
+};
+} // namespace
+
+namespace mlir {
+namespace test {
+void registerCommutativityUtils() { PassRegistration(); }
+} // namespace test
+} // namespace mlir
Index: mlir/test/lib/Transforms/CMakeLists.txt
===
--- mlir/test/lib/Transforms/CMakeLists.txt
+++ mlir/test/lib/Transforms/CMakeLists.txt
@@ -1,5 +1,6 @@
 # Exclude tests from libMLIR.so
 add_mlir_library(MLIRTestTransforms
+  TestCommutativityUtils.cpp
   TestConstantFold.cpp
   TestControlFlowSink.cpp
   TestInlining.cpp
Index: mlir/test/lib/Dialect/Test/TestOps.td
===
--- mlir/test/lib/Dialect/Test/TestOps.td
+++ mlir/test/lib/Dialect/Test/TestOps.td
@@ -1186,11 +1186,21 @@
   let hasFolder = 1;
 }
 
+def TestAddIOp : TEST_Op<"addi"> {
+  let arguments = (ins I32:$op1, I32:$op2);
+  let results = (outs I32);
+}
+
 def TestCommutativeOp : TEST_Op<"op_commutative", [Commutative]> {
   let arguments = (ins I32:$op1, I32:$op2, I32:$op3, I32:$op4);
   let results = (outs I32);
 }
 
+def TestLargeCommutativeOp : TEST_Op<"op_large_commutative", [Commutative]> {
+  let arguments = (ins I32:$op1, I32:$op2, I32:$op3, I32:$op4, I32:$op5, I32:$op6, I32:$op7);
+  let results = (outs I32);
+}
+
 def TestCommutative2Op : TEST_Op<"op_commutative2", [Commutative]> {
   let arguments = (ins I32:$op1, I32:$op2);
   let results = (outs I32);
Index: mlir/test/Transforms/test-commutativity-utils.mlir
===
--- /dev/null
+++ mlir/test/Transforms/test-commutativity-utils.mlir
@@ -0,0 +1,116 @@
+// RUN: mlir-opt %s -test-commutativity-utils | FileCheck %s
+
+// CHECK-LABEL: @test_small_pattern_1
+func.func @test_small_pattern_1(%arg0 : i32) -> i32 {
+  // CHECK-NEXT: %[[ARITH_CONST:.*]] = arith.constant
+  %0 = arith.constant 45 : i32
+
+  // CHECK-NEXT: %[[TEST_ADD:.*]] = "test.addi"
+  %1 = "test.addi"(%arg0, %arg0): (i32, i32) -> i32
+
+  // CHECK-NEXT: %[[ARITH_ADD:.*]] = arith.addi
+  %2 = arith.addi 

[PATCH] D112374: [clang] Implement ElaboratedType sugaring for types written bare

2022-07-30 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov marked an inline comment as done.
mizvekov added inline comments.



Comment at: clang/lib/AST/QualTypeNames.cpp:455
+  if (const auto *UT = QT->getAs()) {
+return getFullyQualifiedType(UT->getUnderlyingType(), Ctx,
+ WithGlobalNsPrefix);

rtrieu wrote:
> Moving this down here means when the ElaboratedType is stripped off, its 
> Qualifers aren't preserved in the underlying type.  rGfb7fa27f92ca has a fix 
> to reattach the discarded Qualifiers.
Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112374

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


[PATCH] D130827: [clang] Fixed a number of typos

2022-07-30 Thread Gabriel Ravier via Phabricator via cfe-commits
GabrielRavier created this revision.
Herald added subscribers: steakhal, martong, arphaman, whisperity, mgorny.
Herald added a reviewer: aaron.ballman.
Herald added a reviewer: dang.
Herald added a reviewer: NoQ.
Herald added a reviewer: ributzka.
Herald added a project: All.
GabrielRavier requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.

I went over the output of the following mess of a command:

`(ulimit -m 200; ulimit -v 200; git ls-files -z | parallel --xargs -0 
cat | aspell list --mode=none --ignore-case | grep -E '^[A-Za-z][a-z]*$' | sort 
| uniq -c | sort -n | grep -vE '.{25}' | aspell pipe -W3 | grep : | cut -d' ' 
-f2 | less)`

and proceeded to spend a few days looking at it to find probable typos
and fixed a few hundred of them in all of the llvm project (note, the
ones I found are not anywhere near all of them, but it seems like a
good start).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130827

Files:
  clang/CMakeLists.txt
  clang/bindings/python/clang/cindex.py
  clang/cmake/caches/MultiDistributionExample.cmake
  clang/docs/ClangFormat.rst
  clang/docs/JSONCompilationDatabase.rst
  clang/docs/LanguageExtensions.rst
  clang/docs/analyzer/user-docs/CrossTranslationUnit.rst
  clang/include/clang/AST/DeclCXX.h
  clang/include/clang/AST/OpenMPClause.h
  clang/include/clang/Analysis/ConstructionContext.h
  clang/include/clang/Analysis/FlowSensitive/DataflowValues.h
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/BuiltinsVE.def
  clang/include/clang/Basic/JsonSupport.h
  clang/include/clang/Basic/SourceManager.h
  clang/include/clang/ExtractAPI/Serialization/SymbolGraphSerializer.h
  clang/include/clang/Lex/DependencyDirectivesScanner.h
  clang/include/clang/Sema/DeclSpec.h
  clang/include/clang/Sema/Sema.h
  clang/include/clang/Serialization/ASTReader.h
  clang/include/clang/Serialization/SourceLocationEncoding.h
  clang/include/clang/StaticAnalyzer/Core/CheckerManager.h
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
  clang/include/clang/Tooling/Core/Replacement.h
  clang/include/clang/Tooling/Syntax/Tree.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/Analysis/CFG.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CrossTU/CrossTranslationUnit.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
  clang/lib/Format/Format.cpp
  clang/lib/Format/UnwrappedLineParser.h
  clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
  clang/lib/Headers/arm_acle.h
  clang/lib/Headers/opencl-c.h
  clang/lib/Lex/Lexer.cpp
  clang/lib/Parse/ParseStmt.cpp
  clang/lib/Sema/SemaCodeComplete.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/lib/Sema/SemaDeclObjC.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
  clang/lib/Tooling/AllTUsExecution.cpp
  clang/lib/Tooling/Core/Replacement.cpp
  clang/lib/Tooling/Syntax/Tokens.cpp
  clang/test/CMakeLists.txt
  clang/test/CodeGen/vectorcall.c
  clang/test/CodeGenCXX/target-features-error.cpp
  clang/test/Interpreter/code-undo.cpp
  clang/test/Interpreter/execute-weak.cpp
  clang/test/Interpreter/execute.cpp
  clang/test/Interpreter/global-dtor-win.cpp
  clang/test/Interpreter/global-dtor.cpp
  clang/test/Interpreter/lit.local.cfg
  clang/test/Interpreter/plugins.cpp
  clang/test/Interpreter/simple-exception.cpp
  clang/test/SemaCXX/builtin-align-cxx.cpp
  clang/test/SemaOpenCL/usm-address-spaces-conversions.cl
  clang/test/lit.cfg.py
  clang/tools/CMakeLists.txt
  clang/tools/clang-repl/ClangRepl.cpp
  clang/tools/clang-shlib/CMakeLists.txt
  clang/tools/include-mapping/gen_std.py
  clang/tools/scan-build-py/lib/libear/ear.c
  clang/unittests/AST/StructuralEquivalenceTest.cpp
  clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
  clang/unittests/CMakeLists.txt
  clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp
  clang/unittests/Tooling/SourceCodeTest.cpp
  clang/utils/TableGen/NeonEmitter.cpp
  clang/utils/analyzer/SATest.py
  clang/utils/analyzer/exploded-graph-rewriter.py
  clang/www/analyzer/installation.html

Index: clang/www/analyzer/installation.html
===
--- clang/www/analyzer/installation.html
+++ clang/www/analyzer/installation.html
@@ -58,7 +58,7 @@
 
 
 scan-build: scan-build is the high-level command line utility for running the analyzer
-scan-view: scan-view a companion comannd line
+scan-view: scan-view a companion command line
 utility to scan-build, scan-view is used to view
 analysis results generated by scan-build.  There is an option
 that one can pass to scan-build to cause scan-view to
Index: clang/utils/analyzer/exploded-graph-rewriter.py
===
--- 

[PATCH] D130826: [clang-tools-extra] Fixed a number of typos

2022-07-30 Thread Gabriel Ravier via Phabricator via cfe-commits
GabrielRavier created this revision.
Herald added subscribers: carlosgalvezp, usaxena95, kadircet, arphaman, 
javed.absar, kbarton, nemanjai.
Herald added a project: All.
GabrielRavier requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

I went over the output of the following mess of a command:

`(ulimit -m 200; ulimit -v 200; git ls-files -z | parallel --xargs -0 
cat | aspell list --mode=none --ignore-case | grep -E '^[A-Za-z][a-z]*$' | sort 
| uniq -c | sort -n | grep -vE '.{25}' | aspell pipe -W3 | grep : | cut -d' ' 
-f2 | less)`

and proceeded to spend a few days looking at it to find probable typos
and fixed a few hundred of them in all of the llvm project (note, the
ones I found are not anywhere near all of them, but it seems like a
good start).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130826

Files:
  clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp
  clang-tools-extra/clang-tidy/performance/TypePromotionInMathFnCheck.h
  clang-tools-extra/clangd/CodeComplete.h
  clang-tools-extra/clangd/ConfigFragment.h
  clang-tools-extra/clangd/DumpAST.cpp
  clang-tools-extra/clangd/HeuristicResolver.cpp
  clang-tools-extra/clangd/IncludeCleaner.cpp
  clang-tools-extra/clangd/InlayHints.cpp
  clang-tools-extra/clangd/Quality.cpp
  clang-tools-extra/clangd/SemanticHighlighting.cpp
  
clang-tools-extra/clangd/benchmarks/CompletionModel/DecisionForestBenchmark.cpp
  clang-tools-extra/clangd/index/CanonicalIncludes.h
  clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
  clang-tools-extra/clangd/unittests/XRefsTests.cpp
  clang-tools-extra/pseudo/gen/Main.cpp
  clang-tools-extra/pseudo/lib/cxx/cxx.bnf
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/virtual-class-destructor.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/virtual-class-destructor.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/virtual-class-destructor.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/virtual-class-destructor.cpp
@@ -143,7 +143,7 @@
   // CHECK-FIXES: virtual ~PublicNonVirtualBaseClass() {}
 };
 
-class PublicNonVirtualNonBaseClass { // OK accoring to C.35, since this class does not have any virtual methods.
+class PublicNonVirtualNonBaseClass { // OK according to C.35, since this class does not have any virtual methods.
   void f();
 
 public:
Index: clang-tools-extra/pseudo/lib/cxx/cxx.bnf
===
--- clang-tools-extra/pseudo/lib/cxx/cxx.bnf
+++ clang-tools-extra/pseudo/lib/cxx/cxx.bnf
@@ -1,7 +1,7 @@
 # This is a C++ grammar from the C++ standard [1].
 #
 # The grammar is a superset of the true grammar requring semantic constraints to
-# resolve ambiguties. The grammar is context-free and ambiguous (beyond the
+# resolve ambiguities. The grammar is context-free and ambiguous (beyond the
 # limit of LR(k)). We use general parsing algorithm (e.g GLR) to handle the
 # grammar and generate a transition table which is used to drive the parsing.
 #
Index: clang-tools-extra/pseudo/gen/Main.cpp
===
--- clang-tools-extra/pseudo/gen/Main.cpp
+++ clang-tools-extra/pseudo/gen/Main.cpp
@@ -65,7 +65,7 @@
 // Mangles a symbol name into a valid identifier.
 //
 // These follow names in the grammar fairly closely:
-//   nonterminal: `ptr-declartor` becomes `ptr_declarator`;
+//   nonterminal: `ptr-declarator` becomes `ptr_declarator`;
 //   punctuator: `,` becomes `COMMA`;
 //   keyword: `INT` becomes `INT`;
 //   terminal: `IDENTIFIER` becomes `IDENTIFIER`;
Index: clang-tools-extra/clangd/unittests/XRefsTests.cpp
===
--- clang-tools-extra/clangd/unittests/XRefsTests.cpp
+++ clang-tools-extra/clangd/unittests/XRefsTests.cpp
@@ -1801,7 +1801,7 @@
   }
 }
 
-TEST(FindImplementations, CaptureDefintion) {
+TEST(FindImplementations, CaptureDefinition) {
   llvm::StringRef Test = R"cpp(
 struct Base {
   virtual void F^oo();
Index: clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
===
--- clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
+++ clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
@@ -1035,7 +1035,7 @@
   // Starts handling the update action and blocks until the
   // first preamble is built.
   ASTAction::RunningAction,
-  // Afterwqards it builds an AST for that preamble to publish
+  // Afterwards it builds an AST for that preamble to publish
   // diagnostics.
   ASTAction::Building,
   // Then goes idle.
Index: clang-tools-extra/clangd/index/CanonicalIncludes.h

[PATCH] D130788: [clang-repl] Disable building when LLVM_STATIC_LINK_CXX_STDLIB is ON.

2022-07-30 Thread Sunho Kim via Phabricator via cfe-commits
sunho added a comment.

https://lab.llvm.org/buildbot/#/builders/98/builds/22588 fuschia build bot is 
happy with this change and I don't see new build breakages so far!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130788

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


[PATCH] D130689: [LLVM] Update C++ standard to 17

2022-07-30 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

In D130689#3686716 , @thieta wrote:

> You can already test this with `-DCMAKE_CXX_STANDARD=17` afaik. I wonder how 
> many bot owners would actually test this if we made another flag available.

Thanks, that works.

Our linux and win bots are happy, but our mac bot fails with:

  
/opt/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/Support/RWMutex.h:98:8:
 error: 'shared_mutex' is unavailable: introduced in macOS 10.12
std::shared_mutex impl;
 ^
  
/opt/s/w/ir/cache/osx_sdk/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/shared_mutex:179:58:
 note: 'shared_mutex' has been explicitly marked unavailable here
  class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_SHARED_MUTEX shared_mutex
   ^

Is it expected and intentional that this increases the mac deployment target to 
10.12?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130689

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


[PATCH] D130788: [clang-repl] Disable building when LLVM_STATIC_LINK_CXX_STDLIB is ON.

2022-07-30 Thread Sunho Kim via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa8f2e24e48fd: [clang-repl] Disable building when 
LLVM_STATIC_LINK_CXX_STDLIB is ON. (authored by sunho).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130788

Files:
  clang/CMakeLists.txt
  clang/test/CMakeLists.txt
  clang/test/Interpreter/code-undo.cpp
  clang/test/Interpreter/execute-weak.cpp
  clang/test/Interpreter/execute.cpp
  clang/test/Interpreter/global-dtor-win.cpp
  clang/test/Interpreter/global-dtor.cpp
  clang/test/Interpreter/lit.local.cfg
  clang/test/Interpreter/plugins.cpp
  clang/test/Interpreter/simple-exception.cpp
  clang/test/lit.cfg.py
  clang/tools/CMakeLists.txt
  clang/tools/clang-repl/ClangRepl.cpp
  clang/unittests/CMakeLists.txt
  clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp

Index: clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp
===
--- clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp
+++ clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp
@@ -113,17 +113,6 @@
   Triple.getArch() == llvm::Triple::aarch64_32))
 return;
 
-  // Check if platform does not support exceptions.
-  {
-// Force the creation of an incremental executor to call getSymbolAddress.
-llvm::cantFail(Interp->ParseAndExecute(""));
-auto Sym = Interp->getSymbolAddress("__cxa_throw");
-if (!Sym) {
-  LLVMConsumeError(llvm::wrap(Sym.takeError()));
-  return;
-}
-  }
-
   llvm::cantFail(Interp->ParseAndExecute(ExceptionCode));
   testing::internal::CaptureStdout();
   auto ThrowException =
Index: clang/unittests/CMakeLists.txt
===
--- clang/unittests/CMakeLists.txt
+++ clang/unittests/CMakeLists.txt
@@ -35,7 +35,9 @@
 add_subdirectory(Rewrite)
 add_subdirectory(Sema)
 add_subdirectory(CodeGen)
-add_subdirectory(Interpreter)
+if(HAVE_CLANG_REPL_SUPPORT)
+  add_subdirectory(Interpreter)
+endif()
 # FIXME: libclang unit tests are disabled on Windows due
 # to failures, mostly in libclang.VirtualFileOverlay_*.
 if(NOT WIN32 AND CLANG_TOOL_LIBCLANG_BUILD) 
Index: clang/tools/clang-repl/ClangRepl.cpp
===
--- clang/tools/clang-repl/ClangRepl.cpp
+++ clang/tools/clang-repl/ClangRepl.cpp
@@ -28,8 +28,6 @@
   llvm::cl::CommaSeparated);
 static llvm::cl::opt OptHostSupportsJit("host-supports-jit",
   llvm::cl::Hidden);
-static llvm::cl::opt OptHostSupportsException("host-supports-exception",
-llvm::cl::Hidden);
 static llvm::cl::list OptInputs(llvm::cl::Positional,
  llvm::cl::desc("[code to run]"));
 
@@ -67,42 +65,6 @@
   return Errs ? EXIT_FAILURE : EXIT_SUCCESS;
 }
 
-// Check if the host environment supports c++ exception handling
-// by querying the existence of symbol __cxa_throw.
-static bool checkExceptionSupport() {
-  auto J = llvm::orc::LLJITBuilder().create();
-  if (!J) {
-llvm::consumeError(J.takeError());
-return false;
-  }
-
-  std::vector Dummy;
-  auto CI = clang::IncrementalCompilerBuilder::create(Dummy);
-  if (!CI) {
-llvm::consumeError(CI.takeError());
-return false;
-  }
-
-  auto Interp = clang::Interpreter::create(std::move(*CI));
-  if (!Interp) {
-llvm::consumeError(Interp.takeError());
-return false;
-  }
-
-  if (auto Err = (*Interp)->ParseAndExecute("")) {
-llvm::consumeError(std::move(Err));
-return false;
-  }
-
-  auto Sym = (*Interp)->getSymbolAddress("__cxa_throw");
-  if (!Sym) {
-llvm::consumeError(Sym.takeError());
-return false;
-  }
-
-  return true;
-}
-
 llvm::ExitOnError ExitOnErr;
 int main(int argc, const char **argv) {
   ExitOnErr.setBanner("clang-repl: ");
@@ -127,14 +89,6 @@
 return 0;
   }
 
-  if (OptHostSupportsException) {
-if (checkExceptionSupport())
-  llvm::outs() << "true\n";
-else
-  llvm::outs() << "false\n";
-return 0;
-  }
-
   // FIXME: Investigate if we could use runToolOnCodeWithArgs from tooling. It
   // can replace the boilerplate code for creation of the compiler instance.
   auto CI = ExitOnErr(clang::IncrementalCompilerBuilder::create(ClangArgv));
Index: clang/tools/CMakeLists.txt
===
--- clang/tools/CMakeLists.txt
+++ clang/tools/CMakeLists.txt
@@ -14,7 +14,9 @@
 add_clang_subdirectory(clang-offload-bundler)
 add_clang_subdirectory(clang-offload-wrapper)
 add_clang_subdirectory(clang-scan-deps)
-add_clang_subdirectory(clang-repl)
+if(HAVE_CLANG_REPL_SUPPORT)
+  

[clang] a8f2e24 - [clang-repl] Disable building when LLVM_STATIC_LINK_CXX_STDLIB is ON.

2022-07-30 Thread Sunho Kim via cfe-commits

Author: Sunho Kim
Date: 2022-07-31T05:42:57+09:00
New Revision: a8f2e24e48fddb3707301c9d24cc50ab778d4fda

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

LOG: [clang-repl] Disable building when LLVM_STATIC_LINK_CXX_STDLIB is ON.

We have seen random symbol not found "__cxa_throw" error in fuschia build bots 
and out-of-tree users. The understanding have been that they are built without 
exception support, but it turned out that these platforms have 
LLVM_STATIC_LINK_CXX_STDLIB ON so that they link libstdc++ to llvm statically. 
The reason why this is problematic for clang-repl is that by default clang-repl 
tries to find symbols from symbol table of executable and dynamic libraries 
loaded by current process. It needs to load another libstdc++, but the platform 
that had LLVM_STATIC_LINK_CXX_STDLIB turned on is usally those with missing or 
obsolate shared libstdc++ in the first place -- trying to load it again would 
be destined to fail eventually with a risk to introuduce mixed libstdc++ 
versions.

A proper solution that doesn't take a workaround is statically link the same 
libstdc++ by clang-repl side, but this is not possible with old JIT linker 
runtimedyld. New just-in-time linker JITLink handles this relatively well, but 
it's not availalbe in majority of platforms. For now, this patch just disables 
the building of clang-repl when LLVM_STATIC_LINK_CXX_STDLIB is ON and removes 
the "__cxa_throw" check in exception unittest as well as reverting previous 
exception check flag patch.

Reviewed By: v.g.vassilev

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

Added: 
clang/test/Interpreter/lit.local.cfg

Modified: 
clang/CMakeLists.txt
clang/test/CMakeLists.txt
clang/test/Interpreter/code-undo.cpp
clang/test/Interpreter/execute-weak.cpp
clang/test/Interpreter/execute.cpp
clang/test/Interpreter/global-dtor.cpp
clang/test/Interpreter/plugins.cpp
clang/test/Interpreter/simple-exception.cpp
clang/test/lit.cfg.py
clang/tools/CMakeLists.txt
clang/tools/clang-repl/ClangRepl.cpp
clang/unittests/CMakeLists.txt
clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp

Removed: 
clang/test/Interpreter/global-dtor-win.cpp



diff  --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 480f13e73c9f5..82207fae0c015 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -504,6 +504,13 @@ CMAKE_DEPENDENT_OPTION(CLANG_PLUGIN_SUPPORT
   "Build clang with plugin support" ON
   "HAVE_CLANG_PLUGIN_SUPPORT" OFF)
 
+# If libstdc++ is statically linked, clang-repl needs to statically link 
libstdc++
+# itself, which is not possible in many platforms because of current 
limitations in 
+# JIT stack. (more platforms need to be supported by JITLink)
+if(NOT LLVM_STATIC_LINK_CXX_STDLIB)
+  set(HAVE_CLANG_REPL_SUPPORT ON)
+endif()
+
 option(CLANG_ENABLE_ARCMT "Build ARCMT." ON)
 option(CLANG_ENABLE_STATIC_ANALYZER
   "Include static analyzer in clang binary." ON)

diff  --git a/clang/test/CMakeLists.txt b/clang/test/CMakeLists.txt
index 5b604b2a3eeba..a05c372fbd346 100644
--- a/clang/test/CMakeLists.txt
+++ b/clang/test/CMakeLists.txt
@@ -66,7 +66,6 @@ list(APPEND CLANG_TEST_DEPS
   clang-import-test
   clang-rename
   clang-refactor
-  clang-repl
   clang-
diff 
   clang-scan-deps
   diagtool
@@ -147,6 +146,12 @@ if(CLANG_ENABLE_STATIC_ANALYZER)
   endif()
 endif()
 
+if (HAVE_CLANG_REPL_SUPPORT)
+  list(APPEND CLANG_TEST_DEPS
+clang-repl
+)
+endif()
+
 # Copy gen_ast_dump_json_test.py to the clang build dir. This allows invoking
 # it without having to pass the --clang= argument
 configure_file(AST/gen_ast_dump_json_test.py

diff  --git a/clang/test/Interpreter/code-undo.cpp 
b/clang/test/Interpreter/code-undo.cpp
index 9a908d6b7e455..c963e45b9f224 100644
--- a/clang/test/Interpreter/code-undo.cpp
+++ b/clang/test/Interpreter/code-undo.cpp
@@ -1,6 +1,5 @@
 // RUN: clang-repl "int i = 10;" 'extern "C" int printf(const char*,...);' \
 // RUN:'auto r1 = printf("i = %d\n", i);' | FileCheck 
--check-prefix=CHECK-DRIVER %s
-// REQUIRES: host-supports-jit
 // UNSUPPORTED: system-aix
 // CHECK-DRIVER: i = 10
 // RUN: cat %s | clang-repl | FileCheck %s

diff  --git a/clang/test/Interpreter/execute-weak.cpp 
b/clang/test/Interpreter/execute-weak.cpp
index 7d0b7061e5019..5b343512c5456 100644
--- a/clang/test/Interpreter/execute-weak.cpp
+++ b/clang/test/Interpreter/execute-weak.cpp
@@ -1,7 +1,6 @@
 // RUN: clang-repl "int x = 10;" "int y=7; err;" "int y = 10;"
 // RUN: clang-repl "int i = 10;" 'extern "C" int printf(const char*,...);' \
 // RUN:'auto r1 = printf("i = %d\n", i);' | FileCheck 
--check-prefix=CHECK-DRIVER %s
-// REQUIRES: host-supports-jit
 // CHECK-DRIVER: i = 10
 // UNSUPPORTED: 

[PATCH] D129799: [clang-tidy] Add CLANG_TIDY_CONFUSABLE_CHARS_GEN cmake setting to avoid building when cross compiling

2022-07-30 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo added a comment.

In D129799#3689044 , @trcrsired wrote:

> Hi i have a question. Does llvm provide a general toggle to set all those 
> things with a directory? It becomes unmanagable since the end of llvm 15 for 
> Canadian compilation.
>
> like LLVM_NATIVE_TOOL_DIR some thing like that?

Not that I know of, but that would indeed be quite convenient - sounds like a 
good idea to me.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129799

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


[PATCH] D116203: [clang] adds unary type transformations as compiler built-ins

2022-07-30 Thread Christopher Di Bella via Phabricator via cfe-commits
cjdb marked 13 inline comments as done.
cjdb added inline comments.



Comment at: clang/lib/Parse/ParseExpr.cpp:1755-1756
+  Tok.setKind(tok::identifier);
+  Diag(Tok, diag::ext_keyword_as_ident)
+  << Tok.getIdentifierInfo()->getName() << 0;
+  goto ParseIdentifier;

rsmith wrote:
> Is it feasible to also produce this warning for the corresponding case in 
> `MaybeParseTypeTransformTypeSpecifier` / the callers of that function?
Will this risk sending out the warning twice, and if so, can the diagnostic 
engine handle that?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116203

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


[PATCH] D116280: [clang] adds unary type trait checks as compiler built-ins

2022-07-30 Thread Christopher Di Bella via Phabricator via cfe-commits
cjdb updated this revision to Diff 448806.
cjdb added a subscriber: rsmith.
cjdb added a comment.

I think this covers all the feedback @rsmith has provided, though my treatment 
of `BuildPointerType` and `BuildReferenceType` might be wrong.

Hopefully `__make_signed` and `__make_unsigned` are correct now!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116280

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/TokenKinds.def
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/Parse/ParseDeclCXX.cpp
  clang/lib/Parse/ParseExpr.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaType.cpp
  clang/test/SemaCXX/type-traits.cpp

Index: clang/test/SemaCXX/type-traits.cpp
===
--- clang/test/SemaCXX/type-traits.cpp
+++ clang/test/SemaCXX/type-traits.cpp
@@ -345,11 +345,19 @@
 }
 
 typedef Enum EnumType;
+typedef EnumClass EnumClassType;
 
 void is_enum()
 {
   { int arr[T(__is_enum(Enum))]; }
   { int arr[T(__is_enum(EnumType))]; }
+  { int arr[T(__is_enum(SignedEnum))]; }
+  { int arr[T(__is_enum(UnsignedEnum))]; }
+
+  { int arr[T(__is_enum(EnumClass))]; }
+  { int arr[T(__is_enum(EnumClassType))]; }
+  { int arr[T(__is_enum(SignedEnumClass))]; }
+  { int arr[T(__is_enum(UnsignedEnumClass))]; }
 
   { int arr[F(__is_enum(int))]; }
   { int arr[F(__is_enum(Union))]; }
@@ -363,6 +371,29 @@
   { int arr[F(__is_enum(HasAnonymousUnion))]; }
 }
 
+void is_scoped_enum() {
+  { int arr[F(__is_scoped_enum(Enum))]; }
+  { int arr[F(__is_scoped_enum(EnumType))]; }
+  { int arr[F(__is_scoped_enum(SignedEnum))]; }
+  { int arr[F(__is_scoped_enum(UnsignedEnum))]; }
+
+  { int arr[T(__is_scoped_enum(EnumClass))]; }
+  { int arr[T(__is_scoped_enum(EnumClassType))]; }
+  { int arr[T(__is_scoped_enum(SignedEnumClass))]; }
+  { int arr[T(__is_scoped_enum(UnsignedEnumClass))]; }
+
+  { int arr[F(__is_scoped_enum(int))]; }
+  { int arr[F(__is_scoped_enum(Union))]; }
+  { int arr[F(__is_scoped_enum(Int))]; }
+  { int arr[F(__is_scoped_enum(IntAr))]; }
+  { int arr[F(__is_scoped_enum(UnionAr))]; }
+  { int arr[F(__is_scoped_enum(Derives))]; }
+  { int arr[F(__is_scoped_enum(ClassType))]; }
+  { int arr[F(__is_scoped_enum(cvoid))]; }
+  { int arr[F(__is_scoped_enum(IntArNB))]; }
+  { int arr[F(__is_scoped_enum(HasAnonymousUnion))]; }
+}
+
 struct FinalClass final {
 };
 
@@ -702,6 +733,106 @@
   int t31[F(__is_array(cvoid*))];
 }
 
+void is_bounded_array(int n) {
+  int t01[T(__is_bounded_array(IntAr))];
+  int t02[F(__is_bounded_array(IntArNB))];
+  int t03[T(__is_bounded_array(UnionAr))];
+
+  int t10[F(__is_bounded_array(void))];
+  int t11[F(__is_bounded_array(cvoid))];
+  int t12[F(__is_bounded_array(float))];
+  int t13[F(__is_bounded_array(double))];
+  int t14[F(__is_bounded_array(long double))];
+  int t15[F(__is_bounded_array(bool))];
+  int t16[F(__is_bounded_array(char))];
+  int t17[F(__is_bounded_array(signed char))];
+  int t18[F(__is_bounded_array(unsigned char))];
+  int t19[F(__is_bounded_array(wchar_t))];
+  int t20[F(__is_bounded_array(short))];
+  int t21[F(__is_bounded_array(unsigned short))];
+  int t22[F(__is_bounded_array(int))];
+  int t23[F(__is_bounded_array(unsigned int))];
+  int t24[F(__is_bounded_array(long))];
+  int t25[F(__is_bounded_array(unsigned long))];
+  int t26[F(__is_bounded_array(Union))];
+  int t27[F(__is_bounded_array(Derives))];
+  int t28[F(__is_bounded_array(ClassType))];
+  int t29[F(__is_bounded_array(Enum))];
+  int t30[F(__is_bounded_array(void *))];
+  int t31[F(__is_bounded_array(cvoid *))];
+
+  int t32[n];
+  (void)__is_bounded_array(decltype(t32)); // expected-error{{variable length arrays are not supported for '__is_bounded_array'}}
+}
+
+void is_unbounded_array(int n) {
+  int t01[F(__is_unbounded_array(IntAr))];
+  int t02[T(__is_unbounded_array(IntArNB))];
+  int t03[F(__is_unbounded_array(UnionAr))];
+
+  int t10[F(__is_unbounded_array(void))];
+  int t11[F(__is_unbounded_array(cvoid))];
+  int t12[F(__is_unbounded_array(float))];
+  int t13[F(__is_unbounded_array(double))];
+  int t14[F(__is_unbounded_array(long double))];
+  int t15[F(__is_unbounded_array(bool))];
+  int t16[F(__is_unbounded_array(char))];
+  int t17[F(__is_unbounded_array(signed char))];
+  int t18[F(__is_unbounded_array(unsigned char))];
+  int t19[F(__is_unbounded_array(wchar_t))];
+  int t20[F(__is_unbounded_array(short))];
+  int t21[F(__is_unbounded_array(unsigned short))];
+  int t22[F(__is_unbounded_array(int))];
+  int t23[F(__is_unbounded_array(unsigned int))];
+  int t24[F(__is_unbounded_array(long))];
+  int t25[F(__is_unbounded_array(unsigned long))];
+  int t26[F(__is_unbounded_array(Union))];
+  int t27[F(__is_unbounded_array(Derives))];
+  int t28[F(__is_unbounded_array(ClassType))];
+  int t29[F(__is_unbounded_array(Enum))];
+  int t30[F(__is_unbounded_array(void *))];
+  

[PATCH] D130822: Fixed loads of typos

2022-07-30 Thread Gabriel Ravier via Phabricator via cfe-commits
GabrielRavier added a comment.

Well, I assumed if I split it up per project I would have been told to merge 
all the patches into a big one to avoid having a bunch of small ones 
essentially all doing the same thing, but then again this also makes sense, 
I'll split it up.




Comment at: flang/docs/Extensions.md:157
   with each other.
-* Values for whole anonymous parent components in structure constructors
   (e.g., `EXTENDEDTYPE(PARENTTYPE(1,2,3))` rather than `EXTENDEDTYPE(1,2,3)`

clementval wrote:
> This is just wrong
I'll correct it in my per-project patch


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130822

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


[PATCH] D130822: Fixed loads of typos

2022-07-30 Thread Nikolas Klauser via Phabricator via cfe-commits
philnik added a comment.

Could you split this up per project? Large patches like this are really hard to 
review, since there is no single person/small group that can approve everything.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130822

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


[PATCH] D130822: Fixed loads of typos

2022-07-30 Thread Valentin Clement via Phabricator via cfe-commits
clementval requested changes to this revision.
clementval added inline comments.
This revision now requires changes to proceed.



Comment at: flang/docs/Extensions.md:157
   with each other.
-* Values for whole anonymous parent components in structure constructors
   (e.g., `EXTENDEDTYPE(PARENTTYPE(1,2,3))` rather than `EXTENDEDTYPE(1,2,3)`

This is just wrong


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130822

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


[PATCH] D130058: [Clang] Diagnose ill-formed constant expression when setting a non fixed enum to a value outside the range of the enumeration values

2022-07-30 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

In D130058#3687868 , @aaron.ballman 
wrote:

> In D130058#3687680 , @thakis wrote:
>
>> Hello, this breaks a bunch of existing code over here (and I imagine 
>> elsewhere).
>
> Do you have an idea on how much a bunch is and whether the fixes are 
> particularly involved or not? Did it break a system header?

Sorry for the slow reply, this was fairly involved to count.

With D130811 , the most annoying instance is 
resolved. I'd say it's now few enough instances in few enough repositories that 
this isn't necessary for Chromium, but based on the numbers below I'd expect 
that this change will be fairly annoying for people with larger codebases.

For Chromium, this affects:

- 6 different places in v8, all due to due using enums with a spiffy BitField 
class (reduced example here 
https://bugs.chromium.org/p/chromium/issues/detail?id=1348574#c7). This 
BitField class takes a "size" template arg, and clang now happens to complain 
if that size arg is too large to hold all enum fields: If you have an enum with 
8 values but try to store it in a BitField<.., 4> you now happen to get an 
error, because a BitField<..., 3>. (This is kind of cool!) 
(https://chromium-review.googlesource.com/c/v8/v8/+/3794708)

- 11 different places in chromium that are related to a macro that takes an 
enum (summary here: 
https://bugs.chromium.org/p/chromium/issues/detail?id=1348574#c11) where the 
workaround is to give those enums a fixed underlying type
- 4 places in unit tests that do something like `constexpr auto 
kImpossibleEnumValue = static_cast(-1);` (replaced "constexpr" with 
"const" as workaround)
- 1 place that checked that static_assert()ed that two enumerators from two 
distinct enum types have the same value, this just needed rewriting the 
expression slightly

After D130811 , we're lucky that no code in 
difficult-to-change third-party repositories are affected.

It does affect 22 distinct places though, so it seems likely that other 
projects might be less lucky.

(But since it's no longer a problem for us, I also won't push for a warning 
more than I did in this comment.)


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

https://reviews.llvm.org/D130058

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


[PATCH] D129799: [clang-tidy] Add CLANG_TIDY_CONFUSABLE_CHARS_GEN cmake setting to avoid building when cross compiling

2022-07-30 Thread cqwrteur via Phabricator via cfe-commits
trcrsired added a comment.

Hi i have a question. Does llvm provide a general toggle to set all those 
things with a directory? It becomes unmanagable since the end of llvm 15.

like LLVM_NATIVE_TOOL_DIR some thing like that?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129799

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


[PATCH] D125944: Template instantiation error recovery

2022-07-30 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev added a comment.

@Purva-Chaudhari can you rebase this patch?


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

https://reviews.llvm.org/D125944

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


[PATCH] D128158: [AMDGPU] Add amdgcn_sched_group_barrier builtin

2022-07-30 Thread Austin Kerbow via Phabricator via cfe-commits
kerbowa marked an inline comment as done.
kerbowa added inline comments.



Comment at: llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp:314
+
+bool SchedGroup::isFull() const {
+  return MaxSize && Collection.size() >= *MaxSize;

uabelho wrote:
> Compiling with gcc, I get a warning that this function is unused.
> I'm wondering, there seems to be both a const and a non-const version of the 
> isFull method now, but they are identical? Perhaps the non-const version 
> could be removed?
Removed in 7898426a72, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128158

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


[clang] 91d9b7b - DependencyScanningTool.h - fix Wdocumentation warning. NFC.

2022-07-30 Thread Simon Pilgrim via cfe-commits

Author: Simon Pilgrim
Date: 2022-07-30T11:00:35+01:00
New Revision: 91d9b7b407947a958ea31746e20424ba7c446f15

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

LOG: DependencyScanningTool.h - fix Wdocumentation warning. NFC.

Added: 


Modified: 
clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h

Removed: 




diff  --git 
a/clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h 
b/clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h
index 209cc81e38dd8..0a092a433a22c 100644
--- a/clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h
+++ b/clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h
@@ -52,7 +52,7 @@ struct FullDependencies {
   ///   arguments for dependencies.
   std::vector getCommandLine(
   llvm::function_ref
-  LookupOutput) const;
+  LookupModuleOutput) const;
 
   /// Get the full command line, excluding -fmodule-file=" arguments.
   std::vector getCommandLineWithoutModulePaths() const;



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


[clang] b3fd44d - Sema.h - fix Wdocumentation warnings. NFC.

2022-07-30 Thread Simon Pilgrim via cfe-commits

Author: Simon Pilgrim
Date: 2022-07-30T11:00:16+01:00
New Revision: b3fd44dd6adbd53b43893e5379be8eefde36c701

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

LOG: Sema.h - fix Wdocumentation warnings. NFC.

Added: 


Modified: 
clang/include/clang/Sema/Sema.h

Removed: 




diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index b84ad1283173d..04858ba122efe 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -6820,9 +6820,6 @@ class Sema final {
   /// output parameter (containing the full nested-name-specifier,
   /// including this new type).
   ///
-  /// \param ErrorRecoveryLookup If true, then this method is called to improve
-  /// error recovery. In this case do not emit error message.
-  ///
   /// \param IsCorrectedToColon If not null, suggestions to replace '::' -> ':'
   /// are allowed.  The bool value pointed by this parameter is set to 'true'
   /// if the identifier is treated as if it was followed by ':', not '::'.
@@ -7142,8 +7139,8 @@ class Sema final {
   /// check (either a concept or a constrained entity).
   /// \param ConstraintExprs a list of constraint expressions, treated as if
   /// they were 'AND'ed together.
-  /// \param TemplateArgs the list of template arguments to substitute into the
-  /// constraint expression.
+  /// \param TemplateArgLists the list of template arguments to substitute into
+  /// the constraint expression.
   /// \param TemplateIDRange The source range of the template id that
   /// caused the constraints check.
   /// \param Satisfaction if true is returned, will contain details of the



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


[PATCH] D130793: [clang-tidy] adjust treating of array-of-pointers when 'AnalyzePointers' is deactivated

2022-07-30 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added inline comments.



Comment at: 
clang-tools-extra/test/clang-tidy/checkers/misc/const-correctness-pointer-as-values.cpp:16
+void range_for() {
+  int np_local0[2] = {1, 2};
+  int *p_local0[2] = {_local0[0], _local0[1]};

the tests must be exanded to check that typedefs in arrays are handled properly.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130793

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


[PATCH] D128379: [clangd] Change the url for clang-tidy check documentation

2022-07-30 Thread Nathan James via Phabricator via cfe-commits
njames93 added a comment.

What's the plan with this, a fix wouod likely need to be backportsd for this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128379

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


[PATCH] D129242: [clang-repl] Add host exception support check utility flag.

2022-07-30 Thread Mikael Holmén via Phabricator via cfe-commits
uabelho added a comment.

In D129242#3687968 , @sunho wrote:

> https://reviews.llvm.org/D130788 this is the patch fyi.

Great, the patch works for us. Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129242

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


[PATCH] D128569: Start support for HLSL `RWBuffer`

2022-07-30 Thread Mikael Holmén via Phabricator via cfe-commits
uabelho added a comment.

Hello,

Compiling with gcc I get the following warning with this patch:

  [1832/2330] Building CXX object 
tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/HLSLExternalSemaSource.cpp.o
  In file included from ../../clang/include/clang/Sema/ExternalSemaSource.h:15,
   from 
../../clang/include/clang/Sema/HLSLExternalSemaSource.h:17,
   from ../../clang/lib/Sema/HLSLExternalSemaSource.cpp:12:
  ../../clang/include/clang/AST/ExternalASTSource.h:211:16: warning: 'virtual 
void clang::ExternalASTSource::CompleteType(clang::ObjCInterfaceDecl*)' was 
hidden [-Woverloaded-virtual]
211 |   virtual void CompleteType(ObjCInterfaceDecl *Class);
|^~~~
  In file included from ../../clang/lib/Sema/HLSLExternalSemaSource.cpp:12:
  ../../clang/include/clang/Sema/HLSLExternalSemaSource.h:49:8: warning:   by 
'virtual void clang::HLSLExternalSemaSource::CompleteType(clang::TagDecl*)' 
[-Woverloaded-virtual]
 49 |   void CompleteType(TagDecl *Tag) override;
|^~~~




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128569

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