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

2022-07-31 Thread Jun Zhang via Phabricator via cfe-commits
junaire added a comment.

Hi, I think the main issue is that your patch contains another patch 
unintentionally, please fix that :)




Comment at: clang/CMakeLists.txt:513
-endif()
-
 option(CLANG_ENABLE_ARCMT "Build ARCMT." ON)

Why delete these lines?



Comment at: clang/include/clang/Basic/JsonSupport.h:109
+ std::end(ForbiddenChars),
+ Char) != std::end(ForbiddenChars);
   });

This is not a typo, right? And I think using `llvm::is_contained` is more 
impressive?



Comment at: clang/include/clang/Sema/Sema.h:4022
+  ExprResult &SrcExpr, bool DoFunctionPointerConversion = false,
+  bool Complain = false, SourceRange OpRangeForComplaining = SourceRange(),
+  QualType DestTypeForComplaining = QualType(),

Normally we don't clang-format legacy code like this, as it's bad for git 
blame. 



Comment at: clang/lib/Format/Format.cpp:1724
+Style->QualifierOrder.end(), "type");
+  if (type == Style->QualifierOrder.end())
 return ParseError::MissingQualifierType;

ditto



Comment at: clang/lib/Headers/opencl-c.h:17856
+intel_sub_group_avc_sic_payload_t __ovld intel_sub_group_avc_sic_configure_ipe(
+uchar luma_intra_partition_mask, uchar intra_neighbour_availability,
 uchar left_edge_luma_pixels, uchar upper_left_corner_luma_pixel,

Not sure if we want to format this...



Comment at: clang/lib/Sema/SemaDeclAttr.cpp:1880
+  if (I->getOwnKind() != K && I->args_end() !=
+  std::find(I->args_begin(), I->args_end(), Idx)) {
 S.Diag(AL.getLoc(), diag::err_attributes_are_not_compatible) << AL << 
I;

ditto



Comment at: clang/test/CMakeLists.txt:154
-endif()
-
 # Copy gen_ast_dump_json_test.py to the clang build dir. This allows invoking

Why drop this? I thought it was intentional?



Comment at: clang/test/Interpreter/code-undo.cpp:3
 // RUN:'auto r1 = printf("i = %d\n", i);' | FileCheck 
--check-prefix=CHECK-DRIVER %s
+// REQUIRES: host-supports-jit
 // UNSUPPORTED: system-aix

why add this in a typo-fix patch?



Comment at: clang/test/Interpreter/execute-weak.cpp:4
 // RUN:'auto r1 = printf("i = %d\n", i);' | FileCheck 
--check-prefix=CHECK-DRIVER %s
+// REQUIRES: host-supports-jit
 // CHECK-DRIVER: i = 10

why add this in a typo-fix patch?



Comment at: clang/test/Interpreter/execute.cpp:5
 // RUN:'auto r1 = printf("i = %d\n", i);' | FileCheck 
--check-prefix=CHECK-DRIVER %s
+// REQUIRES: host-supports-jit
 // UNSUPPORTED: system-aix

why add this in a typo-fix patch?



Comment at: clang/test/Interpreter/global-dtor-win.cpp:1
+// clang-format off
+// FIXME: Merge into global-dtor.cpp when exception support arrives on 
windows-msvc

Is this in main?



Comment at: clang/tools/CMakeLists.txt:17
 add_clang_subdirectory(clang-scan-deps)
-if(HAVE_CLANG_REPL_SUPPORT)
-  add_clang_subdirectory(clang-repl)

Why drop this?



Comment at: clang/tools/clang-repl/ClangRepl.cpp:31
   llvm::cl::Hidden);
+static llvm::cl::opt OptHostSupportsException("host-supports-exception",
+llvm::cl::Hidden);

I think this patch contains another patch...



Comment at: clang/tools/clang-repl/ClangRepl.cpp:70
 
+// Check if the host environment supports c++ exception handling
+// by querying the existence of symbol __cxa_throw.

I think this patch contains another patch...



Comment at: clang/tools/clang-repl/ClangRepl.cpp:130
 
+  if (OptHostSupportsException) {
+if (checkExceptionSupport())

I think this patch contains another patch...



Comment at: clang/unittests/CMakeLists.txt:38
 add_subdirectory(CodeGen)
-if(HAVE_CLANG_REPL_SUPPORT)
-  add_subdirectory(Interpreter)

Why drop this?



Comment at: 
clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp:116
 
+  // Check if platform does not support exceptions.
+  {

I think this patch contains another patch...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130827

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


[PATCH] D130422: [clang-repl] Fix incorrect return code

2022-07-31 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev accepted this revision.
v.g.vassilev added a comment.
This revision is now accepted and ready to land.

Thanks for working on this. This is one of the problems where is hard to find 
the right behavior. For example, if a repl running in interactive issues an 
error and then successfully recovers what's the right process return code 
success or a failure? If we decide it is a success then if we ran in 
non-interactive mode eg `clang-repl "err"` then the exit code should be a 
failure.

Either way, this patch improves our current state in which we cannot detect 
failing tests in `-verify` mode. Let's accept it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130422

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


[PATCH] D130422: [clang-repl] Fix incorrect return code

2022-07-31 Thread Jun Zhang via Phabricator via cfe-commits
junaire added a comment.

In D130422#3689392 , @v.g.vassilev 
wrote:

> Thanks for working on this. This is one of the problems where is hard to find 
> the right behavior. For example, if a repl running in interactive issues an 
> error and then successfully recovers what's the right process return code 
> success or a failure? If we decide it is a success then if we ran in 
> non-interactive mode eg `clang-repl "err"` then the exit code should be a 
> failure.
>
> Either way, this patch improves our current state in which we cannot detect 
> failing tests in `-verify` mode. Let's accept it.

Maybe add a FIXME in the tests?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130422

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


[PATCH] D130422: [clang-repl] Fix incorrect return code

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

In D130422#3689397 , @junaire wrote:

> In D130422#3689392 , @v.g.vassilev 
> wrote:
>
>> Thanks for working on this. This is one of the problems where is hard to 
>> find the right behavior. For example, if a repl running in interactive 
>> issues an error and then successfully recovers what's the right process 
>> return code success or a failure? If we decide it is a success then if we 
>> ran in non-interactive mode eg `clang-repl "err"` then the exit code should 
>> be a failure.
>>
>> Either way, this patch improves our current state in which we cannot detect 
>> failing tests in `-verify` mode. Let's accept it.
>
> Maybe add a FIXME in the tests?

That's probably a good idea.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130422

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


[PATCH] D130422: [clang-repl] Fix incorrect return code

2022-07-31 Thread Jun Zhang via Phabricator via cfe-commits
junaire updated this revision to Diff 448844.
junaire added a comment.

Rebase and add a FIXME


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130422

Files:
  clang/test/Interpreter/fail.cpp
  clang/tools/clang-repl/ClangRepl.cpp


Index: clang/tools/clang-repl/ClangRepl.cpp
===
--- clang/tools/clang-repl/ClangRepl.cpp
+++ clang/tools/clang-repl/ClangRepl.cpp
@@ -50,7 +50,7 @@
 
 // If we are running with -verify a reported has to be returned as unsuccess.
 // This is relevant especially for the test suite.
-static int checkDiagErrors(const clang::CompilerInstance *CI) {
+static int checkDiagErrors(const clang::CompilerInstance *CI, bool HasError) {
   unsigned Errs = CI->getDiagnostics().getClient()->getNumErrors();
   if (CI->getDiagnosticOpts().VerifyDiagnostics) {
 // If there was an error that came from the verifier we must return 1 as
@@ -62,7 +62,7 @@
 // The interpreter expects BeginSourceFile/EndSourceFiles to be balanced.
 Client->BeginSourceFile(CI->getLangOpts(), &CI->getPreprocessor());
   }
-  return Errs ? EXIT_FAILURE : EXIT_SUCCESS;
+  return (Errs || HasError) ? EXIT_FAILURE : EXIT_SUCCESS;
 }
 
 llvm::ExitOnError ExitOnErr;
@@ -107,6 +107,8 @@
   llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), "error: ");
   }
 
+  bool HasError = false;
+
   if (OptInputs.empty()) {
 llvm::LineEditor LE("clang-repl");
 // FIXME: Add LE.setListCompleter
@@ -114,13 +116,17 @@
   if (*Line == R"(%quit)")
 break;
   if (*Line == R"(%undo)") {
-if (auto Err = Interp->Undo())
+if (auto Err = Interp->Undo()) {
   llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), "error: ");
+  HasError = true;
+}
 continue;
   }
 
-  if (auto Err = Interp->ParseAndExecute(*Line))
+  if (auto Err = Interp->ParseAndExecute(*Line)) {
 llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), "error: ");
+HasError = true;
+  }
 }
   }
 
@@ -129,5 +135,7 @@
   // later errors use the default handling behavior instead.
   llvm::remove_fatal_error_handler();
 
-  return checkDiagErrors(Interp->getCompilerInstance());
+  llvm::llvm_shutdown();
+
+  return checkDiagErrors(Interp->getCompilerInstance(), HasError);
 }
Index: clang/test/Interpreter/fail.cpp
===
--- /dev/null
+++ clang/test/Interpreter/fail.cpp
@@ -0,0 +1,17 @@
+// FIXME: There're some inconsistence between interactive and non-interactive
+// mode. For exmaple when clang-repl runs in the interactive mode, issues an
+// error and then successfully recovers, if we decide it's a success then for
+// the non-interactive mode the exit code should be a failure.
+// 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 | not clang-repl | FileCheck %s
+BOOM!
+extern "C" int printf(const char *, ...);
+int i = 42;
+auto r1 = printf("i = %d\n", i);
+// CHECK: i = 42
+%quit


Index: clang/tools/clang-repl/ClangRepl.cpp
===
--- clang/tools/clang-repl/ClangRepl.cpp
+++ clang/tools/clang-repl/ClangRepl.cpp
@@ -50,7 +50,7 @@
 
 // If we are running with -verify a reported has to be returned as unsuccess.
 // This is relevant especially for the test suite.
-static int checkDiagErrors(const clang::CompilerInstance *CI) {
+static int checkDiagErrors(const clang::CompilerInstance *CI, bool HasError) {
   unsigned Errs = CI->getDiagnostics().getClient()->getNumErrors();
   if (CI->getDiagnosticOpts().VerifyDiagnostics) {
 // If there was an error that came from the verifier we must return 1 as
@@ -62,7 +62,7 @@
 // The interpreter expects BeginSourceFile/EndSourceFiles to be balanced.
 Client->BeginSourceFile(CI->getLangOpts(), &CI->getPreprocessor());
   }
-  return Errs ? EXIT_FAILURE : EXIT_SUCCESS;
+  return (Errs || HasError) ? EXIT_FAILURE : EXIT_SUCCESS;
 }
 
 llvm::ExitOnError ExitOnErr;
@@ -107,6 +107,8 @@
   llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), "error: ");
   }
 
+  bool HasError = false;
+
   if (OptInputs.empty()) {
 llvm::LineEditor LE("clang-repl");
 // FIXME: Add LE.setListCompleter
@@ -114,13 +116,17 @@
   if (*Line == R"(%quit)")
 break;
   if (*Line == R"(%undo)") {
-if (auto Err = Interp->Undo())
+if (auto Err = Interp->Undo()) {
   llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), "error: ");
+  HasError = true;
+}
 continue;
   }
 
-  if (auto Err = Interp->

[PATCH] D130422: [clang-repl] Fix incorrect return code

2022-07-31 Thread Jun Zhang via Phabricator via cfe-commits
junaire updated this revision to Diff 448846.
junaire added a comment.

Fix some typos


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130422

Files:
  clang/test/Interpreter/fail.cpp
  clang/tools/clang-repl/ClangRepl.cpp


Index: clang/tools/clang-repl/ClangRepl.cpp
===
--- clang/tools/clang-repl/ClangRepl.cpp
+++ clang/tools/clang-repl/ClangRepl.cpp
@@ -50,7 +50,7 @@
 
 // If we are running with -verify a reported has to be returned as unsuccess.
 // This is relevant especially for the test suite.
-static int checkDiagErrors(const clang::CompilerInstance *CI) {
+static int checkDiagErrors(const clang::CompilerInstance *CI, bool HasError) {
   unsigned Errs = CI->getDiagnostics().getClient()->getNumErrors();
   if (CI->getDiagnosticOpts().VerifyDiagnostics) {
 // If there was an error that came from the verifier we must return 1 as
@@ -62,7 +62,7 @@
 // The interpreter expects BeginSourceFile/EndSourceFiles to be balanced.
 Client->BeginSourceFile(CI->getLangOpts(), &CI->getPreprocessor());
   }
-  return Errs ? EXIT_FAILURE : EXIT_SUCCESS;
+  return (Errs || HasError) ? EXIT_FAILURE : EXIT_SUCCESS;
 }
 
 llvm::ExitOnError ExitOnErr;
@@ -107,6 +107,8 @@
   llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), "error: ");
   }
 
+  bool HasError = false;
+
   if (OptInputs.empty()) {
 llvm::LineEditor LE("clang-repl");
 // FIXME: Add LE.setListCompleter
@@ -114,13 +116,17 @@
   if (*Line == R"(%quit)")
 break;
   if (*Line == R"(%undo)") {
-if (auto Err = Interp->Undo())
+if (auto Err = Interp->Undo()) {
   llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), "error: ");
+  HasError = true;
+}
 continue;
   }
 
-  if (auto Err = Interp->ParseAndExecute(*Line))
+  if (auto Err = Interp->ParseAndExecute(*Line)) {
 llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), "error: ");
+HasError = true;
+  }
 }
   }
 
@@ -129,5 +135,7 @@
   // later errors use the default handling behavior instead.
   llvm::remove_fatal_error_handler();
 
-  return checkDiagErrors(Interp->getCompilerInstance());
+  llvm::llvm_shutdown();
+
+  return checkDiagErrors(Interp->getCompilerInstance(), HasError);
 }
Index: clang/test/Interpreter/fail.cpp
===
--- /dev/null
+++ clang/test/Interpreter/fail.cpp
@@ -0,0 +1,17 @@
+// FIXME: There're some inconsistencies between interactive and non-interactive
+// modes. For example, when clang-repl runs in the interactive mode, issues an
+// error, and then successfully recovers if we decide it's a success then for
+// the non-interactive mode the exit code should be a failure.
+// 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 | not clang-repl | FileCheck %s
+BOOM!
+extern "C" int printf(const char *, ...);
+int i = 42;
+auto r1 = printf("i = %d\n", i);
+// CHECK: i = 42
+%quit


Index: clang/tools/clang-repl/ClangRepl.cpp
===
--- clang/tools/clang-repl/ClangRepl.cpp
+++ clang/tools/clang-repl/ClangRepl.cpp
@@ -50,7 +50,7 @@
 
 // If we are running with -verify a reported has to be returned as unsuccess.
 // This is relevant especially for the test suite.
-static int checkDiagErrors(const clang::CompilerInstance *CI) {
+static int checkDiagErrors(const clang::CompilerInstance *CI, bool HasError) {
   unsigned Errs = CI->getDiagnostics().getClient()->getNumErrors();
   if (CI->getDiagnosticOpts().VerifyDiagnostics) {
 // If there was an error that came from the verifier we must return 1 as
@@ -62,7 +62,7 @@
 // The interpreter expects BeginSourceFile/EndSourceFiles to be balanced.
 Client->BeginSourceFile(CI->getLangOpts(), &CI->getPreprocessor());
   }
-  return Errs ? EXIT_FAILURE : EXIT_SUCCESS;
+  return (Errs || HasError) ? EXIT_FAILURE : EXIT_SUCCESS;
 }
 
 llvm::ExitOnError ExitOnErr;
@@ -107,6 +107,8 @@
   llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), "error: ");
   }
 
+  bool HasError = false;
+
   if (OptInputs.empty()) {
 llvm::LineEditor LE("clang-repl");
 // FIXME: Add LE.setListCompleter
@@ -114,13 +116,17 @@
   if (*Line == R"(%quit)")
 break;
   if (*Line == R"(%undo)") {
-if (auto Err = Interp->Undo())
+if (auto Err = Interp->Undo()) {
   llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), "error: ");
+  HasError = true;
+}
 continue;
   }
 
-  if (auto Err = Interp->Pars

[PATCH] D130422: [clang-repl] Fix incorrect return code

2022-07-31 Thread Jun Zhang via Phabricator via cfe-commits
junaire added a comment.

@v.g.vassilev if you can take another look at the wording of the FIXME, and 
make sure you're happy about it, that will be awesome.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130422

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


[PATCH] D130422: [clang-repl] Fix incorrect return code

2022-07-31 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev accepted this revision.
v.g.vassilev added inline comments.



Comment at: clang/tools/clang-repl/ClangRepl.cpp:138
 
-  return checkDiagErrors(Interp->getCompilerInstance());
+  llvm::llvm_shutdown();
+

This seems not needed. We have already `llvm::llvm_shutdown_obj Y;`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130422

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


[PATCH] D130422: [clang-repl] Fix incorrect return code

2022-07-31 Thread Jun Zhang via Phabricator via cfe-commits
junaire added inline comments.



Comment at: clang/tools/clang-repl/ClangRepl.cpp:138
 
-  return checkDiagErrors(Interp->getCompilerInstance());
+  llvm::llvm_shutdown();
+

v.g.vassilev wrote:
> This seems not needed. We have already `llvm::llvm_shutdown_obj Y;`
> This seems not needed. We have already `llvm::llvm_shutdown_obj Y;`

Oh good catch, I think I messed it in the rebase :(


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130422

___
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-31 Thread Gabriel Ravier via Phabricator via cfe-commits
GabrielRavier added a comment.

Ooh yeah looks like there's some damage. Shouldn't have done this at 12:30 AM 
without looking at what that `git rebase` on the latest pull ended up doing... 
I'll go fix this asap


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130827

___
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-31 Thread Gabriel Ravier via Phabricator via cfe-commits
GabrielRavier added inline comments.



Comment at: clang/lib/Headers/opencl-c.h:17856
+intel_sub_group_avc_sic_payload_t __ovld intel_sub_group_avc_sic_configure_ipe(
+uchar luma_intra_partition_mask, uchar intra_neighbour_availability,
 uchar left_edge_luma_pixels, uchar upper_left_corner_luma_pixel,

junaire wrote:
> Not sure if we want to format this...
Well, it is what clang-format did, so I don't really know... Is it also legacy 
code as mentioned above ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130827

___
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-31 Thread Gabriel Ravier via Phabricator via cfe-commits
GabrielRavier updated this revision to Diff 448850.
GabrielRavier added a comment.

Fixed it so that it doesn't accidentally revert all the changes made since my 
original diff


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130827

Files:
  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/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/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/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/CodeGen/vectorcall.c
  clang/test/CodeGenCXX/target-features-error.cpp
  clang/test/SemaCXX/builtin-align-cxx.cpp
  clang/test/SemaOpenCL/usm-address-spaces-conversions.cl
  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/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
===
--- clang/utils/analyzer/exploded-graph-rewriter.py
+++ clang/utils/analyzer/exploded-graph-rewriter.py
@@ -388,7 +388,7 @@
 # Also on Windows macros __FILE__ produces specific delimiters `\`
 # and a directory or file may starts with the letter `l`.
 # Find all `\l` (like `,\l`, `}\l`, `[\l`) except `\\l`,
-# because the literal as a rule containes multiple `\` before `\l`.
+# because the literal as a rule contains multiple `\` before `\l`.
 node_label = re.sub(r'(? 1)
Index: clang/unittests/Tooling/SourceCodeTest.cpp
===
--- clang/unittests/Tooling/SourceCodeTest.cpp
+++ clang/unittests/Tooling/SourceCodeTest.cpp
@@ -255,7 +255,7 @@
   Visitor.runOverAnnotated(R"cpp(
   #define ATTR __attribute__((deprecated("message")))
   $r[[ATTR
-  // Commment.
+  // Comment.
   int x;]])cpp");
 }
 
@@ -410,7 +410,7 @@
   Visit(R"cpp(
   #define ATTR __attribute__((deprecated("message")))
   $r[[ATTR
-  // Commment.
+  // Comment.
   int x;]])cpp");
 }
 
Index: clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
===
--- clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
+++ clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
@@ -655,7 +65

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

2022-07-31 Thread Gabriel Ravier via Phabricator via cfe-commits
GabrielRavier added inline comments.



Comment at: clang/include/clang/Sema/Sema.h:4022
+  ExprResult &SrcExpr, bool DoFunctionPointerConversion = false,
+  bool Complain = false, SourceRange OpRangeForComplaining = SourceRange(),
+  QualType DestTypeForComplaining = QualType(),

junaire wrote:
> Normally we don't clang-format legacy code like this, as it's bad for git 
> blame. 
I've undone the clang-formatting on this


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130827

___
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-31 Thread Jun Zhang via Phabricator via cfe-commits
junaire added inline comments.



Comment at: clang/include/clang/Sema/Sema.h:4022
+  ExprResult &SrcExpr, bool DoFunctionPointerConversion = false,
+  bool Complain = false, SourceRange OpRangeForComplaining = SourceRange(),
+  QualType DestTypeForComplaining = QualType(),

GabrielRavier wrote:
> junaire wrote:
> > Normally we don't clang-format legacy code like this, as it's bad for git 
> > blame. 
> I've undone the clang-formatting on this
Oh, I'm sorry about it I think I missed something here. So basically if you 
touched the code then format it is a good choice. I thought there was nothing 
changed here but only formatting, that's something we usually want to avoid. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130827

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


[clang] 9caee57 - [clang-repl] Fix incorrect return code

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

Author: Jun Zhang
Date: 2022-07-31T19:07:05+08:00
New Revision: 9caee577ef0f97242a233174be8a980bc4d5446e

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

LOG: [clang-repl] Fix incorrect return code

Without this patch, clang-repl incorrectly pass some tests when there's
error occured.

Signed-off-by: Jun Zhang 

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

Added: 
clang/test/Interpreter/fail.cpp

Modified: 
clang/tools/clang-repl/ClangRepl.cpp

Removed: 




diff  --git a/clang/test/Interpreter/fail.cpp b/clang/test/Interpreter/fail.cpp
new file mode 100644
index 0..1f02dc425ece2
--- /dev/null
+++ b/clang/test/Interpreter/fail.cpp
@@ -0,0 +1,17 @@
+// FIXME: There're some inconsistencies between interactive and non-interactive
+// modes. For example, when clang-repl runs in the interactive mode, issues an
+// error, and then successfully recovers if we decide it's a success then for
+// the non-interactive mode the exit code should be a failure.
+// 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 | not clang-repl | FileCheck %s
+BOOM!
+extern "C" int printf(const char *, ...);
+int i = 42;
+auto r1 = printf("i = %d\n", i);
+// CHECK: i = 42
+%quit

diff  --git a/clang/tools/clang-repl/ClangRepl.cpp 
b/clang/tools/clang-repl/ClangRepl.cpp
index d3253738c6da1..8f661a57e9906 100644
--- a/clang/tools/clang-repl/ClangRepl.cpp
+++ b/clang/tools/clang-repl/ClangRepl.cpp
@@ -50,7 +50,7 @@ static void LLVMErrorHandler(void *UserData, const char 
*Message,
 
 // If we are running with -verify a reported has to be returned as unsuccess.
 // This is relevant especially for the test suite.
-static int checkDiagErrors(const clang::CompilerInstance *CI) {
+static int checkDiagErrors(const clang::CompilerInstance *CI, bool HasError) {
   unsigned Errs = CI->getDiagnostics().getClient()->getNumErrors();
   if (CI->getDiagnosticOpts().VerifyDiagnostics) {
 // If there was an error that came from the verifier we must return 1 as
@@ -62,7 +62,7 @@ static int checkDiagErrors(const clang::CompilerInstance *CI) 
{
 // The interpreter expects BeginSourceFile/EndSourceFiles to be balanced.
 Client->BeginSourceFile(CI->getLangOpts(), &CI->getPreprocessor());
   }
-  return Errs ? EXIT_FAILURE : EXIT_SUCCESS;
+  return (Errs || HasError) ? EXIT_FAILURE : EXIT_SUCCESS;
 }
 
 llvm::ExitOnError ExitOnErr;
@@ -107,6 +107,8 @@ int main(int argc, const char **argv) {
   llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), "error: ");
   }
 
+  bool HasError = false;
+
   if (OptInputs.empty()) {
 llvm::LineEditor LE("clang-repl");
 // FIXME: Add LE.setListCompleter
@@ -114,13 +116,17 @@ int main(int argc, const char **argv) {
   if (*Line == R"(%quit)")
 break;
   if (*Line == R"(%undo)") {
-if (auto Err = Interp->Undo())
+if (auto Err = Interp->Undo()) {
   llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), "error: ");
+  HasError = true;
+}
 continue;
   }
 
-  if (auto Err = Interp->ParseAndExecute(*Line))
+  if (auto Err = Interp->ParseAndExecute(*Line)) {
 llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), "error: ");
+HasError = true;
+  }
 }
   }
 
@@ -129,5 +135,5 @@ int main(int argc, const char **argv) {
   // later errors use the default handling behavior instead.
   llvm::remove_fatal_error_handler();
 
-  return checkDiagErrors(Interp->getCompilerInstance());
+  return checkDiagErrors(Interp->getCompilerInstance(), HasError);
 }



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


[PATCH] D130422: [clang-repl] Fix incorrect return code

2022-07-31 Thread Jun Zhang 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 rG9caee577ef0f: [clang-repl] Fix incorrect return code 
(authored by junaire).

Changed prior to commit:
  https://reviews.llvm.org/D130422?vs=448846&id=448853#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130422

Files:
  clang/test/Interpreter/fail.cpp
  clang/tools/clang-repl/ClangRepl.cpp


Index: clang/tools/clang-repl/ClangRepl.cpp
===
--- clang/tools/clang-repl/ClangRepl.cpp
+++ clang/tools/clang-repl/ClangRepl.cpp
@@ -50,7 +50,7 @@
 
 // If we are running with -verify a reported has to be returned as unsuccess.
 // This is relevant especially for the test suite.
-static int checkDiagErrors(const clang::CompilerInstance *CI) {
+static int checkDiagErrors(const clang::CompilerInstance *CI, bool HasError) {
   unsigned Errs = CI->getDiagnostics().getClient()->getNumErrors();
   if (CI->getDiagnosticOpts().VerifyDiagnostics) {
 // If there was an error that came from the verifier we must return 1 as
@@ -62,7 +62,7 @@
 // The interpreter expects BeginSourceFile/EndSourceFiles to be balanced.
 Client->BeginSourceFile(CI->getLangOpts(), &CI->getPreprocessor());
   }
-  return Errs ? EXIT_FAILURE : EXIT_SUCCESS;
+  return (Errs || HasError) ? EXIT_FAILURE : EXIT_SUCCESS;
 }
 
 llvm::ExitOnError ExitOnErr;
@@ -107,6 +107,8 @@
   llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), "error: ");
   }
 
+  bool HasError = false;
+
   if (OptInputs.empty()) {
 llvm::LineEditor LE("clang-repl");
 // FIXME: Add LE.setListCompleter
@@ -114,13 +116,17 @@
   if (*Line == R"(%quit)")
 break;
   if (*Line == R"(%undo)") {
-if (auto Err = Interp->Undo())
+if (auto Err = Interp->Undo()) {
   llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), "error: ");
+  HasError = true;
+}
 continue;
   }
 
-  if (auto Err = Interp->ParseAndExecute(*Line))
+  if (auto Err = Interp->ParseAndExecute(*Line)) {
 llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), "error: ");
+HasError = true;
+  }
 }
   }
 
@@ -129,5 +135,5 @@
   // later errors use the default handling behavior instead.
   llvm::remove_fatal_error_handler();
 
-  return checkDiagErrors(Interp->getCompilerInstance());
+  return checkDiagErrors(Interp->getCompilerInstance(), HasError);
 }
Index: clang/test/Interpreter/fail.cpp
===
--- /dev/null
+++ clang/test/Interpreter/fail.cpp
@@ -0,0 +1,17 @@
+// FIXME: There're some inconsistencies between interactive and non-interactive
+// modes. For example, when clang-repl runs in the interactive mode, issues an
+// error, and then successfully recovers if we decide it's a success then for
+// the non-interactive mode the exit code should be a failure.
+// 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 | not clang-repl | FileCheck %s
+BOOM!
+extern "C" int printf(const char *, ...);
+int i = 42;
+auto r1 = printf("i = %d\n", i);
+// CHECK: i = 42
+%quit


Index: clang/tools/clang-repl/ClangRepl.cpp
===
--- clang/tools/clang-repl/ClangRepl.cpp
+++ clang/tools/clang-repl/ClangRepl.cpp
@@ -50,7 +50,7 @@
 
 // If we are running with -verify a reported has to be returned as unsuccess.
 // This is relevant especially for the test suite.
-static int checkDiagErrors(const clang::CompilerInstance *CI) {
+static int checkDiagErrors(const clang::CompilerInstance *CI, bool HasError) {
   unsigned Errs = CI->getDiagnostics().getClient()->getNumErrors();
   if (CI->getDiagnosticOpts().VerifyDiagnostics) {
 // If there was an error that came from the verifier we must return 1 as
@@ -62,7 +62,7 @@
 // The interpreter expects BeginSourceFile/EndSourceFiles to be balanced.
 Client->BeginSourceFile(CI->getLangOpts(), &CI->getPreprocessor());
   }
-  return Errs ? EXIT_FAILURE : EXIT_SUCCESS;
+  return (Errs || HasError) ? EXIT_FAILURE : EXIT_SUCCESS;
 }
 
 llvm::ExitOnError ExitOnErr;
@@ -107,6 +107,8 @@
   llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), "error: ");
   }
 
+  bool HasError = false;
+
   if (OptInputs.empty()) {
 llvm::LineEditor LE("clang-repl");
 // FIXME: Add LE.setListCompleter
@@ -114,13 +116,17 @@
   if (*Line == R"(%quit)")
 break;
   if (*Line == R"(%undo)") {
-if (auto Err = Interp->Undo())
+if (auto Err = Interp-

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

2022-07-31 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/D130841

Files:
  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/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/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/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/CodeGen/vectorcall.c
  clang/test/CodeGenCXX/target-features-error.cpp
  clang/test/SemaCXX/builtin-align-cxx.cpp
  clang/test/SemaOpenCL/usm-address-spaces-conversions.cl
  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/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
===
--- clang/utils/analyzer/exploded-graph-rewriter.py
+++ clang/utils/analyzer/exploded-graph-rewriter.py
@@ -388,7 +388,7 @@
 # Also on Windows macros __FILE__ produces specific delimiters `\`
 # and a directory or file may starts with the letter `l`.
 # Find all `\l` (like `,\l`, `}\l`, `[\l`) except `\\l`,
-# because the literal as a rule containes multiple `\` before `\l`.
+# because the literal as a rule contains multiple `\` before `\l`.
 node_label = re.sub(r'(? 1)
Index: clang/unittests/Tooling/SourceCodeTest.cpp
===
--- clang/unittests/Tool

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

2022-07-31 Thread Gabriel Ravier via Phabricator via cfe-commits
GabrielRavier abandoned this revision.
GabrielRavier added a comment.

Nvm I'm an idiot I thought this would update https://reviews.llvm.org/D130827


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130841

___
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-31 Thread Gabriel Ravier via Phabricator via cfe-commits
GabrielRavier updated this revision to Diff 448858.
GabrielRavier added a comment.

Reverted reversion of `git clang-format` on `clang/include/clang/Sema/Sema.h`


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

https://reviews.llvm.org/D130827

Files:
  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/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/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/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/CodeGen/vectorcall.c
  clang/test/CodeGenCXX/target-features-error.cpp
  clang/test/SemaCXX/builtin-align-cxx.cpp
  clang/test/SemaOpenCL/usm-address-spaces-conversions.cl
  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/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
===
--- clang/utils/analyzer/exploded-graph-rewriter.py
+++ clang/utils/analyzer/exploded-graph-rewriter.py
@@ -388,7 +388,7 @@
 # Also on Windows macros __FILE__ produces specific delimiters `\`
 # and a directory or file may starts with the letter `l`.
 # Find all `\l` (like `,\l`, `}\l`, `[\l`) except `\\l`,
-# because the literal as a rule containes multiple `\` before `\l`.
+# because the literal as a rule contains multiple `\` before `\l`.
 node_label = re.sub(r'(? 1)
Index: clang/unittests/Tooling/SourceCodeTest.cpp
===
--- clang/unittests/Tooling/SourceCodeTest.cpp
+++ clang/unittests/Tooling/SourceCodeTest.cpp
@@ -255,7 +255,7 @@
   Visitor.runOverAnnotated(R"cpp(
   #define ATTR __attribute__((deprecated("message")))
   $r[[ATTR
-  // Commment.
+  // Comment.
   int x;]])cpp");
 }
 
@@ -410,7 +410,7 @@
   Visit(R"cpp(
   #define ATTR __attribute__((deprecated("message")))
   $r[[ATTR
-  // Commment.
+  // Comment.
   int x;]])cpp");
 }
 
Index: clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
===
--- clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
+++ clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
@@ -655,7 +655,7 @@
 CallFunctionF));
   }
 
-  // 

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

2022-07-31 Thread Gabriel Ravier via Phabricator via cfe-commits
GabrielRavier added inline comments.



Comment at: clang/include/clang/Sema/Sema.h:4022
+  ExprResult &SrcExpr, bool DoFunctionPointerConversion = false,
+  bool Complain = false, SourceRange OpRangeForComplaining = SourceRange(),
+  QualType DestTypeForComplaining = QualType(),

junaire wrote:
> GabrielRavier wrote:
> > junaire wrote:
> > > Normally we don't clang-format legacy code like this, as it's bad for git 
> > > blame. 
> > I've undone the clang-formatting on this
> Oh, I'm sorry about it I think I missed something here. So basically if you 
> touched the code then format it is a good choice. I thought there was nothing 
> changed here but only formatting, that's something we usually want to avoid. 
I've un-undone the clang-formatting on this


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

https://reviews.llvm.org/D130827

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


[PATCH] D130847: [clang] SourceManager: fix isOffsetInFileID for the case of a fake SLocEntry

2022-07-31 Thread Ivan Murashko via Phabricator via cfe-commits
ivanmurashko created this revision.
ivanmurashko added reviewers: dexonsmith, aaron.ballman.
ivanmurashko added a project: clang.
Herald added subscribers: usaxena95, kadircet.
Herald added a project: All.
ivanmurashko requested review of this revision.
Herald added subscribers: cfe-commits, ilya-biryukov.

The `getSLocEntry` might return `SourceManager::FakeSLocEntryForRecovery` 
introduced at D89748 . The result entry is not 
tested and as result the call

  return SLocOffset < getSLocEntryByID(FID.ID+1).getOffset();

might return `true` value. That would mark the tested offset as one that 
belongs to the fake `SLockEntry`.

It might cause a weird clangd crash when preamble contains some header files 
that were removed just after the preamble created. Unfortunately it's not so 
easy to reproduce the crash in the form of a LIT test thus I provided the fix 
only.

Test Plan:

  ninja check-clang


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130847

Files:
  clang/include/clang/Basic/SourceManager.h


Index: clang/include/clang/Basic/SourceManager.h
===
--- clang/include/clang/Basic/SourceManager.h
+++ clang/include/clang/Basic/SourceManager.h
@@ -1825,7 +1825,13 @@
   /// specified SourceLocation offset.  This is a very hot method.
   inline bool isOffsetInFileID(FileID FID,
SourceLocation::UIntTy SLocOffset) const {
-const SrcMgr::SLocEntry &Entry = getSLocEntry(FID);
+bool Invalid = false;
+const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &Invalid);
+
+// If the entry is invalid, it can't contain it.
+if (Invalid)
+  return false;
+
 // If the entry is after the offset, it can't contain it.
 if (SLocOffset < Entry.getOffset()) return false;
 


Index: clang/include/clang/Basic/SourceManager.h
===
--- clang/include/clang/Basic/SourceManager.h
+++ clang/include/clang/Basic/SourceManager.h
@@ -1825,7 +1825,13 @@
   /// specified SourceLocation offset.  This is a very hot method.
   inline bool isOffsetInFileID(FileID FID,
SourceLocation::UIntTy SLocOffset) const {
-const SrcMgr::SLocEntry &Entry = getSLocEntry(FID);
+bool Invalid = false;
+const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &Invalid);
+
+// If the entry is invalid, it can't contain it.
+if (Invalid)
+  return false;
+
 // If the entry is after the offset, it can't contain it.
 if (SLocOffset < Entry.getOffset()) return false;
 
___
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-31 Thread Douglas Yung via Phabricator via cfe-commits
dyung added a comment.

The test simple-exception.cpp is failing on the PS5 Windows bot after this 
change. Can you take a look?

I forced a build using the commit prior to yours which passed: 
https://lab.llvm.org/buildbot/#/builders/216/builds/7636
And then I forced a build using your commit, and the test failed: 
https://lab.llvm.org/buildbot/#/builders/216/builds/7637

   TEST 'Clang :: Interpreter/simple-exception.cpp' FAILED 

  Script:
  --
  : 'RUN: at line 4';   cat 
Z:\test\llvm-project\clang\test\Interpreter\simple-exception.cpp | 
z:\test\build\bin\clang-repl.exe | z:\test\build\bin\filecheck.exe 
Z:\test\llvm-project\clang\test\Interpreter\simple-exception.cpp
  --
  Exit Code: 1
  Command Output (stdout):
  --
  $ ":" "RUN: at line 4"
  $ "cat" "Z:\test\llvm-project\clang\test\Interpreter\simple-exception.cpp"
  $ "z:\test\build\bin\clang-repl.exe"
  # command stderr:
  JIT session error: Symbols not found: [ ??_7type_info@@6B@ ]
  error: Failed to materialize symbols: { (main, { _CT??_R0PEAX@88, ?f@@YAHXZ, 
?r1@@3HA, _CTA2PEAD, ??_C@_0BB@DPCIAKEG@Simple?5exception?$AA@, 
??_C@_03OFAPEBGM@?$CFs?6?$AA@, $.incr_module_8.__inits.0, 
?checkException@@YAHXZ, _TIC2PEAD, ??_R0PEAD@8, ??_R0PEAX@8, 
__orc_init_func.incr_module_8, ??_C@_0N@CKKDCGKM@Running?5f?$CI?$CJ?6?$AA@, 
_CT??_R0PEAD@88 }) }
  error: Failed to materialize symbols: { (main, { 
__orc_init_func.incr_module_8 }) }
  $ "z:\test\build\bin\filecheck.exe" 
"Z:\test\llvm-project\clang\test\Interpreter\simple-exception.cpp"
  # command stderr:
  Z:\test\llvm-project\clang\test\Interpreter\simple-exception.cpp:10:11: 
error: CHECK: expected string not found in input
  // CHECK: Running f()
^
  :1:1: note: scanning from here
  clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> 
clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> 
clang-repl> 
  ^
  :1:11: note: possible intended match here
  clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> 
clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> 
clang-repl> 
^
  Input file: 
  Check file: Z:\test\llvm-project\clang\test\Interpreter\simple-exception.cpp
  -dump-input=help explains the following input dump.
  Input was:
  <<
  1: clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> 
clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> 
clang-repl> clang-repl>  
  check:10'0 
X
 error: no match found
  check:10'1   ?

   possible intended match
  >>
  error: command failed with exit status: 1
  --
  


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] D130788: [clang-repl] Disable building when LLVM_STATIC_LINK_CXX_STDLIB is ON.

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

In D130788#3689693 , @dyung wrote:

> The test simple-exception.cpp is failing on the PS5 Windows bot after this 
> change. Can you take a look?
>
> I forced a build using the commit prior to yours which passed: 
> https://lab.llvm.org/buildbot/#/builders/216/builds/7636
> And then I forced a build using your commit, and the test failed: 
> https://lab.llvm.org/buildbot/#/builders/216/builds/7637
>
>    TEST 'Clang :: Interpreter/simple-exception.cpp' 
> FAILED 
>   Script:
>   --
>   : 'RUN: at line 4';   cat 
> Z:\test\llvm-project\clang\test\Interpreter\simple-exception.cpp | 
> z:\test\build\bin\clang-repl.exe | z:\test\build\bin\filecheck.exe 
> Z:\test\llvm-project\clang\test\Interpreter\simple-exception.cpp
>   --
>   Exit Code: 1
>   Command Output (stdout):
>   --
>   $ ":" "RUN: at line 4"
>   $ "cat" "Z:\test\llvm-project\clang\test\Interpreter\simple-exception.cpp"
>   $ "z:\test\build\bin\clang-repl.exe"
>   # command stderr:
>   JIT session error: Symbols not found: [ ??_7type_info@@6B@ ]
>   error: Failed to materialize symbols: { (main, { _CT??_R0PEAX@88, 
> ?f@@YAHXZ, ?r1@@3HA, _CTA2PEAD, ??_C@_0BB@DPCIAKEG@Simple?5exception?$AA@, 
> ??_C@_03OFAPEBGM@?$CFs?6?$AA@, $.incr_module_8.__inits.0, 
> ?checkException@@YAHXZ, _TIC2PEAD, ??_R0PEAD@8, ??_R0PEAX@8, 
> __orc_init_func.incr_module_8, ??_C@_0N@CKKDCGKM@Running?5f?$CI?$CJ?6?$AA@, 
> _CT??_R0PEAD@88 }) }
>   error: Failed to materialize symbols: { (main, { 
> __orc_init_func.incr_module_8 }) }
>   $ "z:\test\build\bin\filecheck.exe" 
> "Z:\test\llvm-project\clang\test\Interpreter\simple-exception.cpp"
>   # command stderr:
>   Z:\test\llvm-project\clang\test\Interpreter\simple-exception.cpp:10:11: 
> error: CHECK: expected string not found in input
>   // CHECK: Running f()
> ^
>   :1:1: note: scanning from here
>   clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> 
> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> 
> clang-repl> 
>   ^
>   :1:11: note: possible intended match here
>   clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> 
> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> 
> clang-repl> 
> ^
>   Input file: 
>   Check file: Z:\test\llvm-project\clang\test\Interpreter\simple-exception.cpp
>   -dump-input=help explains the following input dump.
>   Input was:
>   <<
>   1: clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> 
> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> 
> clang-repl> clang-repl>  
>   check:10'0 
> X
>  error: no match found
>   check:10'1   ?  
>   
>possible intended match
>   >>
>   error: command failed with exit status: 1
>   --
>   

The test isn't supposed to be ran on windows -- we don't support exception on 
windows at all yet. I guess XFAIL: windows-msvc, windows-gnu is not working out.


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] D130847: [clang] SourceManager: fix isOffsetInFileID for the case of a fake SLocEntry

2022-07-31 Thread Ivan Murashko via Phabricator via cfe-commits
ivanmurashko updated this revision to Diff 448885.
ivanmurashko added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130847

Files:
  clang/include/clang/Basic/SourceManager.h


Index: clang/include/clang/Basic/SourceManager.h
===
--- clang/include/clang/Basic/SourceManager.h
+++ clang/include/clang/Basic/SourceManager.h
@@ -1825,7 +1825,13 @@
   /// specified SourceLocation offset.  This is a very hot method.
   inline bool isOffsetInFileID(FileID FID,
SourceLocation::UIntTy SLocOffset) const {
-const SrcMgr::SLocEntry &Entry = getSLocEntry(FID);
+bool Invalid = false;
+const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &Invalid);
+
+// If the entry is invalid, it can't contain it.
+if (Invalid)
+  return false;
+
 // If the entry is after the offset, it can't contain it.
 if (SLocOffset < Entry.getOffset()) return false;
 


Index: clang/include/clang/Basic/SourceManager.h
===
--- clang/include/clang/Basic/SourceManager.h
+++ clang/include/clang/Basic/SourceManager.h
@@ -1825,7 +1825,13 @@
   /// specified SourceLocation offset.  This is a very hot method.
   inline bool isOffsetInFileID(FileID FID,
SourceLocation::UIntTy SLocOffset) const {
-const SrcMgr::SLocEntry &Entry = getSLocEntry(FID);
+bool Invalid = false;
+const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &Invalid);
+
+// If the entry is invalid, it can't contain it.
+if (Invalid)
+  return false;
+
 // If the entry is after the offset, it can't contain it.
 if (SLocOffset < Entry.getOffset()) return false;
 
___
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-31 Thread Douglas Yung via Phabricator via cfe-commits
dyung added a comment.

In D130788#3689795 , @sunho wrote:

> The test isn't supposed to be ran on windows -- we don't support exception on 
> windows at all yet. I guess XFAIL: windows-msvc, windows-gnu is not working 
> out.

If you don't want the test run on Windows, I think what you want is probably 
`system-windows` rather than `windows-msvc` and `windows-gnu`. The former will 
mark as XFAIL when it is run on Windows, while the latter will mark as XFAIL 
when the target triple includes those strings.


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] D127462: [Clang] Begin implementing Plan 9 C extensions

2022-07-31 Thread Keegan Saunders via Phabricator via cfe-commits
ksaunders added a comment.

Gentle ping. I have 2 other patches ready, and I'd like to get the discussion 
started on this if possible.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127462

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


[PATCH] D130857: [Clang] Plan 9 member resolution

2022-07-31 Thread Keegan Saunders via Phabricator via cfe-commits
ksaunders created this revision.
ksaunders added a reviewer: rsmith.
ksaunders added a project: clang.
Herald added a project: All.
ksaunders requested review of this revision.
Herald added a subscriber: cfe-commits.

This patch implements the Plan 9 member resolution algorithm which is described 
referenced in the original revision: https://reviews.llvm.org/D127462. The test 
code is illustrative as to what is considered valid, as it was derived from 
samples compiled using the Plan 9 C compiler.

It is not clear what the policy on issuing diagnostics is for extensions usage, 
so there is a warning emitted for usage of duplicated members (which is a Plan 
9 extension). However this might not be a good idea, as there could be 
potentially a large number of warnings emitted, as this is used throughout 
headers Plan 9 C.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130857

Files:
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/AST/Expr.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaLookup.cpp
  clang/test/Sema/2c-anon-record.c

Index: clang/test/Sema/2c-anon-record.c
===
--- clang/test/Sema/2c-anon-record.c
+++ clang/test/Sema/2c-anon-record.c
@@ -1,9 +1,95 @@
 // RUN: %clang_cc1 %s -fsyntax-only -Wplan9 -verify -fplan9-extensions
 
-struct A {
+typedef struct {
+  int x; // expected-note {{previous declaration is here}}
+} A;
+
+struct B {
+  A;   // expected-warning {{anonymous structs are a Plan 9 extension}}
+  char *x; // expected-warning {{duplicate member 'x' is a Plan 9 extension}}
+};
+
+char *f0(struct B *b) {
+  return b->x;
+}
+
+typedef struct {
   int x;
+} C;
+
+struct D {
+  // expected-warning@+2 {{anonymous structs are a Plan 9 extension}}
+  // expected-note@+1 {{candidate found by name lookup is 'D::(anonymous)'}}
+  C;
+  int C; // expected-note {{candidate found by name lookup is 'D::C'}}
 };
 
-struct B {
-  struct A; // expected-warning {{anonymous structs are a Plan 9 extension}}
+int f1(struct D *d) {
+  int x = d->x;
+  return d->C; // expected-error {{reference to 'C' is ambiguous}}
+}
+
+typedef struct {
+  int x; // expected-note {{previous declaration is here}}
+} E;
+
+struct F {
+  E; // expected-warning {{anonymous structs are a Plan 9 extension}}
+  int x; // expected-warning {{duplicate member 'x' is a Plan 9 extension}}
+};
+
+E f2(struct F *f) {
+  int x = f->x;
+  return f->E;
+}
+
+typedef struct {
+  // expected-note@+3 {{previous declaration is here}}
+  // expected-note@+2 {{previous declaration is here}}
+  // expected-note@+1 {{candidate found by name lookup is 'H::a'}}
+  int a;
+  // expected-warning@+3 {{duplicate member 'a' is a Plan 9 extension}}
+  // expected-warning@+2 {{duplicate member 'a' is a Plan 9 extension}}
+  // expected-note@+1 {{candidate found by name lookup is 'H::a'}}
+  int a;
+} G;
+
+struct H {
+  G; // expected-warning {{anonymous structs are a Plan 9 extension}}
+  int b;
 };
+
+int f3(struct H *h) {
+  int b = h->b;
+  return h->a; // expected-error {{reference to 'a' is ambiguous}}
+}
+
+typedef union {
+  int a;
+} I;
+
+union J {
+  I; // expected-warning {{anonymous unions are a Plan 9 extension}}
+  int b : 4;
+};
+
+int f4(union J *j) {
+  int b = j->b;
+  return j->a;
+}
+
+typedef struct K TK;
+
+struct K {
+  int x;
+};
+
+struct L {
+  TK; // expected-warning {{anonymous structs are a Plan 9 extension}}
+  int l;
+};
+
+TK f5(struct L *l) {
+  struct K k = l->K; // expected-error {{no member named 'K' in 'struct L'}}
+  return l->TK;
+}
Index: clang/lib/Sema/SemaLookup.cpp
===
--- clang/lib/Sema/SemaLookup.cpp
+++ clang/lib/Sema/SemaLookup.cpp
@@ -1085,6 +1085,99 @@
   }
 }
 
+// Resolves fields in a record like a Plan 9 compiler.  The resolution
+// is performed in 3 passes:
+//
+//   Pass 1: Look for field names that match the lookup name.
+//   Pass 2: Look for unnamed embedded records who's typedef'd name
+//   match the lookup name.
+//   Pass 3: Look for candidate fields in unnamed embedded records.
+//
+// Returns true if any matches were found.
+static bool LookupPlan9(Sema &S, LookupResult &R, const RecordDecl *RD,
+const DeclContext *Owner) {
+  bool Found = false;
+
+  // Pass 1 & 2 are fused: conflicts are an error.
+  for (FieldDecl *Field : RD->fields()) {
+// Pass 1
+if (Field->getDeclName() == R.getLookupName()) {
+  R.addDecl(Field);
+  Found = true;
+}
+
+// Pass 2
+if (isa(Field->getType()) && Field->getDeclName().isEmpty()) {
+  if (const auto *Typedef =
+  Field->getTypeSourceInfo()->getType()->getAs()) {
+if (Typedef->getDecl()->getDeclName() == R.getLookupName()) {
+  R.addDecl(Field);
+  Found = true;
+}
+  }
+}
+  }
+
+  if (Found)
+return true;
+
+  LookupRes

[clang] ed29930 - [Sema] Remove an unused forward declaration (NFC)

2022-07-31 Thread Kazu Hirata via cfe-commits

Author: Kazu Hirata
Date: 2022-07-31T15:17:00-07:00
New Revision: ed2993051994546771a1d8e8256baa960609ee11

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

LOG: [Sema] Remove an unused forward declaration (NFC)

Added: 


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

Removed: 




diff  --git a/clang/include/clang/Sema/RISCVIntrinsicManager.h 
b/clang/include/clang/Sema/RISCVIntrinsicManager.h
index 505100249d6f1..128858bb43019 100644
--- a/clang/include/clang/Sema/RISCVIntrinsicManager.h
+++ b/clang/include/clang/Sema/RISCVIntrinsicManager.h
@@ -15,7 +15,6 @@
 #define LLVM_CLANG_SEMA_RISCVINTRINSICMANAGER_H
 
 namespace clang {
-class Sema;
 class LookupResult;
 class IdentifierInfo;
 class Preprocessor;



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


[PATCH] D130858: [HLSL] emit-obj when set output.

2022-07-31 Thread Xiang Li via Phabricator via cfe-commits
python3kgae created this revision.
python3kgae added reviewers: amccarth, craig.topper, hans, rnk, 
stefan_reinalter, beanz, pow2clk, bogner.
Herald added subscribers: Anastasia, StephenFan.
Herald added a project: All.
python3kgae requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.

When not set output, set default output to stdout.
When set output with -Fo and no -fcgl, set -emit-obj to generate dx container.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130858

Files:
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/HLSL.cpp
  clang/test/Driver/dxc_Fo.hlsl


Index: clang/test/Driver/dxc_Fo.hlsl
===
--- /dev/null
+++ clang/test/Driver/dxc_Fo.hlsl
@@ -0,0 +1,15 @@
+// RUN: %clang_dxc -T lib_6_7 foo.hlsl -### %s 2>&1 | FileCheck %s 
--check-prefix=DEFAULT
+// RUN: %clang_dxc -fcgl -T lib_6_7 foo.hlsl -### %s 2>&1 | FileCheck %s 
--check-prefix=FCGL
+// RUN: %clang_dxc  -T lib_6_7 foo.hlsl -Fo foo.dxc -### %s 2>&1 | FileCheck 
%s --check-prefix=EMITOBJ
+
+
+// Make sure default use "-" as output and not emit obj.
+// DEFAULT-NOT:"-emit-obj"
+// DEFAULT:"-o" "-"
+
+// Make sure -fcgl without -Fo use "-" as output.
+// FCGL:"-o" "-"
+
+
+// Make sure emit-obj when set -Fo.
+// EMITOBJ:"-emit-obj"
Index: clang/lib/Driver/ToolChains/HLSL.cpp
===
--- clang/lib/Driver/ToolChains/HLSL.cpp
+++ clang/lib/Driver/ToolChains/HLSL.cpp
@@ -169,6 +169,15 @@
 }
 DAL->append(A);
   }
+
+  if (DAL->hasArg(options::OPT_o)) {
+// When run the whole pipeline.
+if (!DAL->hasArg(options::OPT_emit_llvm))
+  // Emit obj if write to file.
+  DAL->AddFlagArg(nullptr, Opts.getOption(options::OPT_emit_obj));
+  } else
+DAL->AddSeparateArg(nullptr, Opts.getOption(options::OPT_o), "-");
+
   // Add default validator version if not set.
   // TODO: remove this once read validator version from validator.
   if (!DAL->hasArg(options::OPT_dxil_validator_version)) {
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -3513,6 +3513,7 @@
  options::OPT_I,
  options::OPT_S,
  options::OPT_emit_llvm,
+ options::OPT_emit_obj,
  options::OPT_disable_llvm_passes,
  options::OPT_fnative_half_type};
 
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -5595,6 +5595,9 @@
 return "-";
   }
 
+  if (IsDXCMode() && !C.getArgs().hasArg(options::OPT_o))
+return "-";
+
   // Is this the assembly listing for /FA?
   if (JA.getType() == types::TY_PP_Asm &&
   (C.getArgs().hasArg(options::OPT__SLASH_FA) ||


Index: clang/test/Driver/dxc_Fo.hlsl
===
--- /dev/null
+++ clang/test/Driver/dxc_Fo.hlsl
@@ -0,0 +1,15 @@
+// RUN: %clang_dxc -T lib_6_7 foo.hlsl -### %s 2>&1 | FileCheck %s --check-prefix=DEFAULT
+// RUN: %clang_dxc -fcgl -T lib_6_7 foo.hlsl -### %s 2>&1 | FileCheck %s --check-prefix=FCGL
+// RUN: %clang_dxc  -T lib_6_7 foo.hlsl -Fo foo.dxc -### %s 2>&1 | FileCheck %s --check-prefix=EMITOBJ
+
+
+// Make sure default use "-" as output and not emit obj.
+// DEFAULT-NOT:"-emit-obj"
+// DEFAULT:"-o" "-"
+
+// Make sure -fcgl without -Fo use "-" as output.
+// FCGL:"-o" "-"
+
+
+// Make sure emit-obj when set -Fo.
+// EMITOBJ:"-emit-obj"
Index: clang/lib/Driver/ToolChains/HLSL.cpp
===
--- clang/lib/Driver/ToolChains/HLSL.cpp
+++ clang/lib/Driver/ToolChains/HLSL.cpp
@@ -169,6 +169,15 @@
 }
 DAL->append(A);
   }
+
+  if (DAL->hasArg(options::OPT_o)) {
+// When run the whole pipeline.
+if (!DAL->hasArg(options::OPT_emit_llvm))
+  // Emit obj if write to file.
+  DAL->AddFlagArg(nullptr, Opts.getOption(options::OPT_emit_obj));
+  } else
+DAL->AddSeparateArg(nullptr, Opts.getOption(options::OPT_o), "-");
+
   // Add default validator version if not set.
   // TODO: remove this once read validator version from validator.
   if (!DAL->hasArg(options::OPT_dxil_validator_version)) {
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -3513,6 +3513,7 @@
  options::OPT_I,
  options::OPT_S,

[clang] 773d51c - [clang-repl] XFAIL windows properly in simple-exception test case.

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

Author: Sunho Kim
Date: 2022-08-01T09:06:35+09:00
New Revision: 773d51ce3bedd091539aa86a5e5fc15a9174ff7b

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

LOG: [clang-repl] XFAIL windows properly in simple-exception test case.

We don't have proper exception support in LLJIT on windows yet. We have to 
xfail windows machine, but the previous check missed out some targets.

Added: 


Modified: 
clang/test/Interpreter/simple-exception.cpp

Removed: 




diff  --git a/clang/test/Interpreter/simple-exception.cpp 
b/clang/test/Interpreter/simple-exception.cpp
index dc13402d2a515..5af656396d4a3 100644
--- a/clang/test/Interpreter/simple-exception.cpp
+++ b/clang/test/Interpreter/simple-exception.cpp
@@ -1,6 +1,6 @@
 // clang-format off
 // UNSUPPORTED: system-aix
-// XFAIL: arm, arm64-apple, windows-msvc, windows-gnu
+// XFAIL: arm, arm64-apple, system-windows
 // RUN: cat %s | clang-repl | FileCheck %s
 extern "C" int printf(const char *, ...);
 



___
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-31 Thread Sunho Kim via Phabricator via cfe-commits
sunho added a comment.

In D130788#3689820 , @dyung wrote:

> In D130788#3689795 , @sunho wrote:
>
>> The test isn't supposed to be ran on windows -- we don't support exception 
>> on windows at all yet. I guess XFAIL: windows-msvc, windows-gnu is not 
>> working out.
>
> If you don't want the test run on Windows, I think what you want is probably 
> `system-windows` rather than `windows-msvc` and `windows-gnu`. The former 
> will mark as XFAIL when it is run on Windows, while the latter will mark as 
> XFAIL when the target triple includes those strings.

Should have been fixed in 
https://github.com/llvm/llvm-project/commit/773d51ce3bedd091539aa86a5e5fc15a9174ff7b.
 Can you check it out?


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] D130863: [clangd] Make git ignore index directories

2022-07-31 Thread sums via Phabricator via cfe-commits
sums created this revision.
sums added a reviewer: clang-tools-extra.
sums added a project: clang-tools-extra.
Herald added subscribers: usaxena95, kadircet, arphaman.
Herald added a project: All.
sums requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.

This change makes clangd add .gitignore files to the index directories that 
ignore everything using an asterisk (*) value. We only add these gitignore 
files when creating a new directory, to allow cases where the user doesn't want 
this behavior (unlikely but not sure).

  

This behavior is similar to meson, which automatically puts a gitignore file in 
all build directories.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130863

Files:
  clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp
  clang-tools-extra/clangd/test/background-index.test


Index: clang-tools-extra/clangd/test/background-index.test
===
--- clang-tools-extra/clangd/test/background-index.test
+++ clang-tools-extra/clangd/test/background-index.test
@@ -18,6 +18,18 @@
 # RUN: ls %/t/.cache/clangd/index/foo.cpp.*.idx
 # RUN: ls %/t/sub_dir/.cache/clangd/index/foo.h.*.idx
 
+# Test that the the newly created index directories also have a .gitignore 
file present.
+# RUN: ls %/t/.cache/clangd/index/.gitignore
+# RUN: ls %/t/sub_dir/.cache/clangd/index/.gitignore
+
+# Delete .gitignore files to test that they're not recreated when loading an 
existing index directory.
+# RUN: rm %/t/.cache/clangd/index/.gitignore
+# RUN: rm %/t/sub_dir/.cache/clangd/index/.gitignore
+
 # Test the index is read from disk: delete code and restart clangd.
 # RUN: rm %/t/foo.cpp
 # RUN: clangd -background-index -lit-test < %/t/definition.jsonrpc | FileCheck 
%/t/definition.jsonrpc --check-prefixes=CHECK,USE
+
+# Test that the existing index directories do not have recreated .gitignore 
files.
+# RUN: test ! -e %/t/.cache/clangd/index/.gitignore
+# RUN: test ! -e %/t/sub_dir/.cache/clangd/index/.gitignore
Index: clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp
===
--- clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp
+++ clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp
@@ -33,6 +33,12 @@
   return std::string(ShardRootSS.str());
 }
 
+std::string getGitignorePathForShardRoot(llvm::StringRef ShardRoot) {
+  llvm::SmallString<128> ShardRootSS(ShardRoot);
+  llvm::sys::path::append(ShardRootSS, 
llvm::sys::path::filename(".gitignore"));
+  return std::string(ShardRootSS.str());
+}
+
 // Uses disk as a storage for index shards.
 class DiskBackedIndexStorage : public BackgroundIndexStorage {
   std::string DiskShardRoot;
@@ -40,12 +46,21 @@
 public:
   // Creates `DiskShardRoot` and any parents during construction.
   DiskBackedIndexStorage(llvm::StringRef Directory) : DiskShardRoot(Directory) 
{
+bool CreatingNewDirectory = !llvm::sys::fs::is_directory(DiskShardRoot);
 std::error_code OK;
 std::error_code EC = llvm::sys::fs::create_directories(DiskShardRoot);
 if (EC != OK) {
   elog("Failed to create directory {0} for index storage: {1}",
DiskShardRoot, EC.message());
 }
+
+if (CreatingNewDirectory) {
+  llvm::Error error = addGitignore(DiskShardRoot);
+  if (error) {
+elog("Failed to add .gitignore to directory {0} for index storage: 
{1}",
+ DiskShardRoot, error);
+  }
+}
   }
 
   std::unique_ptr
@@ -73,6 +88,15 @@
return llvm::Error::success();
  });
   }
+
+private:
+  llvm::Error addGitignore(llvm::StringRef Directory) {
+auto FilePath = getGitignorePathForShardRoot(DiskShardRoot);
+return llvm::writeFileAtomically(
+FilePath + ".tmp", FilePath,
+"# This file is autogenerated by clangd. If you change or delete it, "
+"it won't be recreated.\n*");
+  }
 };
 
 // Doesn't persist index shards anywhere (used when the CDB dir is unknown).


Index: clang-tools-extra/clangd/test/background-index.test
===
--- clang-tools-extra/clangd/test/background-index.test
+++ clang-tools-extra/clangd/test/background-index.test
@@ -18,6 +18,18 @@
 # RUN: ls %/t/.cache/clangd/index/foo.cpp.*.idx
 # RUN: ls %/t/sub_dir/.cache/clangd/index/foo.h.*.idx
 
+# Test that the the newly created index directories also have a .gitignore file present.
+# RUN: ls %/t/.cache/clangd/index/.gitignore
+# RUN: ls %/t/sub_dir/.cache/clangd/index/.gitignore
+
+# Delete .gitignore files to test that they're not recreated when loading an existing index directory.
+# RUN: rm %/t/.cache/clangd/index/.gitignore
+# RUN: rm %/t/sub_dir/.cache/clangd/index/.gitignore
+
 # Test the index is read from disk: delete code and restart clangd.
 # RUN: rm %/t/foo.cpp
 # RUN: clangd -background-ind

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

2022-07-31 Thread Douglas Yung via Phabricator via cfe-commits
dyung added a comment.

In D130788#3689918 , @sunho wrote:

> In D130788#3689820 , @dyung wrote:
>
>> In D130788#3689795 , @sunho wrote:
>>
>>> The test isn't supposed to be ran on windows -- we don't support exception 
>>> on windows at all yet. I guess XFAIL: windows-msvc, windows-gnu is not 
>>> working out.
>>
>> If you don't want the test run on Windows, I think what you want is probably 
>> `system-windows` rather than `windows-msvc` and `windows-gnu`. The former 
>> will mark as XFAIL when it is run on Windows, while the latter will mark as 
>> XFAIL when the target triple includes those strings.
>
> Should have been fixed in 
> https://github.com/llvm/llvm-project/commit/773d51ce3bedd091539aa86a5e5fc15a9174ff7b.
>  Can you check it out?

https://lab.llvm.org/buildbot/#/builders/216/builds/7647

That seems to have worked. Thanks!


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] D93138: Add initial support for multilibs in Baremetal toolchain.

2022-07-31 Thread Zixuan Wu via Phabricator via cfe-commits
zixuan-wu added inline comments.



Comment at: clang/lib/Driver/ToolChains/BareMetal.cpp:177
   if (!getDriver().SysRoot.empty())
-return getDriver().SysRoot;
+return getDriver().SysRoot + SelectedMultilib.osSuffix();
 

abidh wrote:
> zixuan-wu wrote:
> > I think the multilib osSuffix added here will make every multilib contain 
> > include dir, and those include dirs are the same. For lib, there should be 
> > different multilib dir. 
> > 
> > So it's better to add osSuffix at construction function like following I 
> > think instead of be part of sysroot.
> > 
> > ```
> > if (!SysRoot.empty()) {
> > llvm::sys::path::append(SysRoot, "lib", SelectedMultilib.osSuffix());
> > getFilePaths().push_back(std::string(SysRoot));
> >   }
> > ```
> > 
> > @abidh 
> The multilib include directories are not necessarily the same.  In my 
> opinion, having a separate include and lib directory for every multilib is 
> much cleaner then having all multilib share an include directory and then you 
> put multilib specific directories inside that.
So you are going to copy times of same include headers? For now,  GCC on RISCV 
is just sharing one same include directory and having multiple multilib 
directory under lib of root.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93138

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


[PATCH] D128490: [ODRHash diagnostics] Transform method `ASTReader::diagnoseOdrViolations` into a class `ODRDiagsEmitter`. NFC.

2022-07-31 Thread Chuanqi Xu via Phabricator via cfe-commits
ChuanqiXu accepted this revision.
ChuanqiXu added a comment.
This revision is now accepted and ready to land.

LGTM then.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128490

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


[PATCH] D125291: Introduce @llvm.threadlocal.address intrinsic to access TLS variable

2022-07-31 Thread Chuanqi Xu via Phabricator via cfe-commits
ChuanqiXu updated this revision to Diff 448904.
ChuanqiXu marked an inline comment as done.
ChuanqiXu added a comment.

Address comments.


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

https://reviews.llvm.org/D125291

Files:
  llvm/docs/LangRef.rst
  llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
  llvm/include/llvm/IR/IRBuilder.h
  llvm/include/llvm/IR/Intrinsics.td
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/IR/IRBuilder.cpp
  llvm/test/CodeGen/X86/threadlocal_address.ll

Index: llvm/test/CodeGen/X86/threadlocal_address.ll
===
--- /dev/null
+++ llvm/test/CodeGen/X86/threadlocal_address.ll
@@ -0,0 +1,41 @@
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu -stop-after=finalize-isel %s -o - | FileCheck %s
+
+@i = thread_local global i32 0, align 4
+
+define noundef i32 @foo() {
+; CHECK: %0:gr64 = MOV64rm $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg :: (load (s64) from got)
+; CHECK: %1:gr32 = MOV32rm %0, 1, $noreg, 0, $fs :: (load (s32) from %ir.0)
+; CHECK: %2:gr32 = nsw INC32r %1, implicit-def dead $eflags
+; CHECK: MOV32mr %0, 1, $noreg, 0, $fs, %2 :: (store (s32) into %ir.0)
+; CHECK: $eax = COPY %2
+; CHECK: RET 0, $eax
+entry:
+  %0 = call ptr @llvm.threadlocal.address(ptr @i)
+  %1 = load i32, ptr %0, align 4
+  %inc = add nsw i32 %1, 1
+  store i32 %inc, ptr %0, align 4
+  %2 = call ptr @llvm.threadlocal.address(ptr @i)
+  %3 = load i32, ptr %2, align 4
+  ret i32 %3
+}
+
+@j =  thread_local addrspace(1) global  i32 addrspace(0)* @i, align 4
+define noundef i32 @bar() {
+; CHECK: %0:gr64 = MOV64rm $rip, 1, $noreg, target-flags(x86-gottpoff) @j, $noreg :: (load (s64) from got)
+; CHECK: %1:gr32 = MOV32rm %0, 1, $noreg, 0, $fs :: (load (s32) from %ir.0, addrspace 1)
+; CHECK: %2:gr32 = nsw INC32r %1, implicit-def dead $eflags
+; CHECK: MOV32mr %0, 1, $noreg, 0, $fs, %2 :: (store (s32) into %ir.0, addrspace 1)
+; CHECK: $eax = COPY %2
+; CHECK: RET 0, $eax
+entry:
+  %0 = call ptr addrspace(1) @llvm.threadlocal.address.p1(ptr addrspace(1) @j)
+  %1 = load i32, ptr addrspace(1) %0, align 4
+  %inc = add nsw i32 %1, 1
+  store i32 %inc, ptr addrspace(1) %0, align 4
+  %2 = call ptr addrspace(1) @llvm.threadlocal.address.p1(ptr addrspace(1) @j)
+  %3 = load i32, ptr addrspace(1) %2, align 4
+  ret i32 %3
+}
+
+declare ptr @llvm.threadlocal.address(ptr) nounwind readnone willreturn
+declare ptr addrspace(1) @llvm.threadlocal.address.p1(ptr addrspace(1)) nounwind readnone willreturn
Index: llvm/lib/IR/IRBuilder.cpp
===
--- llvm/lib/IR/IRBuilder.cpp
+++ llvm/lib/IR/IRBuilder.cpp
@@ -526,6 +526,13 @@
   return CreateCall(TheFn, Ops);
 }
 
+CallInst *IRBuilderBase::CreateThreadLocalAddress(Value *Ptr) {
+  assert(isa(Ptr) && cast(Ptr)->isThreadLocal() &&
+ "threadlocal_address only applies to thread local variables.");
+  return CreateIntrinsic(llvm::Intrinsic::threadlocal_address, {Ptr->getType()},
+ {Ptr});
+}
+
 CallInst *
 IRBuilderBase::CreateAssumption(Value *Cond,
 ArrayRef OpBundles) {
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
===
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -7178,6 +7178,10 @@
  DAG.getZExtOrTrunc(Const, sdl, PtrVT)));
 return;
   }
+  case Intrinsic::threadlocal_address: {
+setValue(&I, getValue(I.getOperand(0)));
+return;
+  }
   case Intrinsic::get_active_lane_mask: {
 EVT CCVT = TLI.getValueType(DAG.getDataLayout(), I.getType());
 SDValue Index = getValue(I.getOperand(0));
Index: llvm/include/llvm/IR/Intrinsics.td
===
--- llvm/include/llvm/IR/Intrinsics.td
+++ llvm/include/llvm/IR/Intrinsics.td
@@ -1404,6 +1404,10 @@
 def int_ptrmask: DefaultAttrsIntrinsic<[llvm_anyptr_ty], [LLVMMatchType<0>, llvm_anyint_ty],
[IntrNoMem, IntrSpeculatable, IntrWillReturn]>;
 
+// Intrinsic to wrap a thread local variable.
+def int_threadlocal_address : DefaultAttrsIntrinsic<[llvm_anyptr_ty], [LLVMMatchType<0>],
+   [IntrNoMem, IntrSpeculatable, IntrWillReturn]>;
+
 def int_experimental_stepvector : DefaultAttrsIntrinsic<[llvm_anyvector_ty],
 [], [IntrNoMem]>;
 
Index: llvm/include/llvm/IR/IRBuilder.h
===
--- llvm/include/llvm/IR/IRBuilder.h
+++ llvm/include/llvm/IR/IRBuilder.h
@@ -753,6 +753,9 @@
   /// If the pointer isn't i8* it will be converted.
   CallInst *CreateInvariantStart(Value *Ptr, ConstantInt *Size = nullptr);
 
+  /// Create a call to llvm.threadlocal.address intrinsic.
+  CallInst *CreateThreadLocalAddre

[PATCH] D125291: Introduce @llvm.threadlocal.address intrinsic to access TLS variable

2022-07-31 Thread Chuanqi Xu via Phabricator via cfe-commits
ChuanqiXu added a comment.

In D125291#3687295 , @nikic wrote:

> LG. Now that LLVM 15 has branched, I think it is safe to land this, and there 
> will be enough time before LLVM 16 to convert it to the token variant.

Yeah, thanks for reviewing!


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

https://reviews.llvm.org/D125291

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


[PATCH] D125291: Introduce @llvm.threadlocal.address intrinsic to access TLS variable

2022-07-31 Thread Chuanqi Xu via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG970105351710: Introduce @llvm.threadlocal.address intrinsic 
to access TLS variable (authored by ChuanqiXu).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125291

Files:
  llvm/docs/LangRef.rst
  llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
  llvm/include/llvm/IR/IRBuilder.h
  llvm/include/llvm/IR/Intrinsics.td
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/IR/IRBuilder.cpp
  llvm/test/CodeGen/X86/threadlocal_address.ll

Index: llvm/test/CodeGen/X86/threadlocal_address.ll
===
--- /dev/null
+++ llvm/test/CodeGen/X86/threadlocal_address.ll
@@ -0,0 +1,41 @@
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu -stop-after=finalize-isel %s -o - | FileCheck %s
+
+@i = thread_local global i32 0, align 4
+
+define noundef i32 @foo() {
+; CHECK: %0:gr64 = MOV64rm $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg :: (load (s64) from got)
+; CHECK: %1:gr32 = MOV32rm %0, 1, $noreg, 0, $fs :: (load (s32) from %ir.0)
+; CHECK: %2:gr32 = nsw INC32r %1, implicit-def dead $eflags
+; CHECK: MOV32mr %0, 1, $noreg, 0, $fs, %2 :: (store (s32) into %ir.0)
+; CHECK: $eax = COPY %2
+; CHECK: RET 0, $eax
+entry:
+  %0 = call ptr @llvm.threadlocal.address(ptr @i)
+  %1 = load i32, ptr %0, align 4
+  %inc = add nsw i32 %1, 1
+  store i32 %inc, ptr %0, align 4
+  %2 = call ptr @llvm.threadlocal.address(ptr @i)
+  %3 = load i32, ptr %2, align 4
+  ret i32 %3
+}
+
+@j =  thread_local addrspace(1) global  i32 addrspace(0)* @i, align 4
+define noundef i32 @bar() {
+; CHECK: %0:gr64 = MOV64rm $rip, 1, $noreg, target-flags(x86-gottpoff) @j, $noreg :: (load (s64) from got)
+; CHECK: %1:gr32 = MOV32rm %0, 1, $noreg, 0, $fs :: (load (s32) from %ir.0, addrspace 1)
+; CHECK: %2:gr32 = nsw INC32r %1, implicit-def dead $eflags
+; CHECK: MOV32mr %0, 1, $noreg, 0, $fs, %2 :: (store (s32) into %ir.0, addrspace 1)
+; CHECK: $eax = COPY %2
+; CHECK: RET 0, $eax
+entry:
+  %0 = call ptr addrspace(1) @llvm.threadlocal.address.p1(ptr addrspace(1) @j)
+  %1 = load i32, ptr addrspace(1) %0, align 4
+  %inc = add nsw i32 %1, 1
+  store i32 %inc, ptr addrspace(1) %0, align 4
+  %2 = call ptr addrspace(1) @llvm.threadlocal.address.p1(ptr addrspace(1) @j)
+  %3 = load i32, ptr addrspace(1) %2, align 4
+  ret i32 %3
+}
+
+declare ptr @llvm.threadlocal.address(ptr) nounwind readnone willreturn
+declare ptr addrspace(1) @llvm.threadlocal.address.p1(ptr addrspace(1)) nounwind readnone willreturn
Index: llvm/lib/IR/IRBuilder.cpp
===
--- llvm/lib/IR/IRBuilder.cpp
+++ llvm/lib/IR/IRBuilder.cpp
@@ -526,6 +526,13 @@
   return CreateCall(TheFn, Ops);
 }
 
+CallInst *IRBuilderBase::CreateThreadLocalAddress(Value *Ptr) {
+  assert(isa(Ptr) && cast(Ptr)->isThreadLocal() &&
+ "threadlocal_address only applies to thread local variables.");
+  return CreateIntrinsic(llvm::Intrinsic::threadlocal_address, {Ptr->getType()},
+ {Ptr});
+}
+
 CallInst *
 IRBuilderBase::CreateAssumption(Value *Cond,
 ArrayRef OpBundles) {
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
===
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -7178,6 +7178,10 @@
  DAG.getZExtOrTrunc(Const, sdl, PtrVT)));
 return;
   }
+  case Intrinsic::threadlocal_address: {
+setValue(&I, getValue(I.getOperand(0)));
+return;
+  }
   case Intrinsic::get_active_lane_mask: {
 EVT CCVT = TLI.getValueType(DAG.getDataLayout(), I.getType());
 SDValue Index = getValue(I.getOperand(0));
Index: llvm/include/llvm/IR/Intrinsics.td
===
--- llvm/include/llvm/IR/Intrinsics.td
+++ llvm/include/llvm/IR/Intrinsics.td
@@ -1404,6 +1404,10 @@
 def int_ptrmask: DefaultAttrsIntrinsic<[llvm_anyptr_ty], [LLVMMatchType<0>, llvm_anyint_ty],
[IntrNoMem, IntrSpeculatable, IntrWillReturn]>;
 
+// Intrinsic to wrap a thread local variable.
+def int_threadlocal_address : DefaultAttrsIntrinsic<[llvm_anyptr_ty], [LLVMMatchType<0>],
+   [IntrNoMem, IntrSpeculatable, IntrWillReturn]>;
+
 def int_experimental_stepvector : DefaultAttrsIntrinsic<[llvm_anyvector_ty],
 [], [IntrNoMem]>;
 
Index: llvm/include/llvm/IR/IRBuilder.h
===
--- llvm/include/llvm/IR/IRBuilder.h
+++ llvm/include/llvm/IR/IRBuilder.h
@@ -753,6 +753,9 @@
   /// If the pointer isn't i8* it will be converted.
   CallInst *Cr

[PATCH] D126742: [RISCV][Clang] Support RVV policy functions.

2022-07-31 Thread Kito Cheng via Phabricator via cfe-commits
kito-cheng accepted this revision.
kito-cheng added a comment.
This revision is now accepted and ready to land.

LGTM, and verified with internal testsuite :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126742

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


[PATCH] D130864: [NFC] Introduce ASTContext::isInSameModule()

2022-07-31 Thread Chuanqi Xu via Phabricator via cfe-commits
ChuanqiXu created this revision.
ChuanqiXu added reviewers: iains, ilya-biryukov, erichkeane.
ChuanqiXu added a project: clang-modules.
Herald added a project: All.
ChuanqiXu requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Previously, when we want to compare if two module units are in the same module, 
we need to compare their primary module name, which is string comparing. String 
comparing is expensive and we want to avoid it. So here is the patch. This one 
should be a NFC patch.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130864

Files:
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaLookup.cpp

Index: clang/lib/Sema/SemaLookup.cpp
===
--- clang/lib/Sema/SemaLookup.cpp
+++ clang/lib/Sema/SemaLookup.cpp
@@ -1568,38 +1568,27 @@
 }
 
 /// Determine if we could use all the declarations in the module.
-bool Sema::isUsableModule(const Module *M) {
+bool Sema::isUsableModule(const Module *M) const {
   assert(M && "We shouldn't check nullness for module here");
-  // Return quickly if we cached the result.
-  if (UsableModuleUnitsCache.count(M))
-return true;
 
   // If M is the global module fragment of the current translation unit. So it
   // should be usable.
   // [module.global.frag]p1:
   //   The global module fragment can be used to provide declarations that are
   //   attached to the global module and usable within the module unit.
-  if (M == GlobalModuleFragment ||
-  // If M is the module we're parsing, it should be usable. This covers the
-  // private module fragment. The private module fragment is usable only if
-  // it is within the current module unit. And it must be the current
-  // parsing module unit if it is within the current module unit according
-  // to the grammar of the private module fragment. NOTE: This is covered by
-  // the following condition. The intention of the check is to avoid string
-  // comparison as much as possible.
-  M == getCurrentModule() ||
-  // The module unit which is in the same module with the current module
-  // unit is usable.
-  //
-  // FIXME: Here we judge if they are in the same module by comparing the
-  // string. Is there any better solution?
-  M->getPrimaryModuleInterfaceName() ==
-  llvm::StringRef(getLangOpts().CurrentModule).split(':').first) {
-UsableModuleUnitsCache.insert(M);
-return true;
-  }
-
-  return false;
+  //
+  // If M is the module we're parsing, it should be usable. This covers the
+  // private module fragment. The private module fragment is usable only if
+  // it is within the current module unit. And it must be the current
+  // parsing module unit if it is within the current module unit according
+  // to the grammar of the private module fragment. NOTE: This is covered by
+  // the following condition. The intention of the check is to avoid
+  // expensive comparison as much as possible.
+  //
+  // The module unit which is in the same module with the current module
+  // unit is usable.
+  return isModuleUnitOfCurrentTU(M) ||
+ getASTContext().isInSameModule(M, getCurrentModule());
 }
 
 bool Sema::hasVisibleMergedDefinition(NamedDecl *Def) {
@@ -1609,7 +1598,7 @@
   return false;
 }
 
-bool Sema::hasMergedDefinitionInCurrentModule(NamedDecl *Def) {
+bool Sema::hasMergedDefinitionInCurrentModule(NamedDecl *Def) const {
   for (const Module *Merged : Context.getModulesWithMergedDefinition(Def))
 if (isUsableModule(Merged))
   return true;
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -1644,8 +1644,7 @@
   // Partitions are part of the module, but a partition could import another
   // module, so verify that the PMIs agree.
   if (NewM && OldM && (NewM->isModulePartition() || OldM->isModulePartition()))
-return NewM->getPrimaryModuleInterfaceName() ==
-   OldM->getPrimaryModuleInterfaceName();
+return getASTContext().isInSameModule(NewM, OldM);
 
   bool NewIsModuleInterface = NewM && NewM->isModulePurview();
   bool OldIsModuleInterface = OldM && OldM->isModulePurview();
Index: clang/lib/AST/ASTContext.cpp
===
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -1129,7 +1129,7 @@
 }
 
 ArrayRef
-ASTContext::getModulesWithMergedDefinition(const NamedDecl *Def) {
+ASTContext::getModulesWithMergedDefinition(const NamedDecl *Def) const {
   auto MergedIt =
   MergedDefModules.find(cast(Def->getCanonicalDecl()));
   if (MergedIt == MergedDefModules.end())
@@ -6212,6 +6212,32 @@
   llvm_unreachable("bad template name!");
 }
 
+bool ASTContext::isInSameModule(const

[PATCH] D125944: Template instantiation error recovery

2022-07-31 Thread Purva Chaudhari via Phabricator via cfe-commits
Purva-Chaudhari added a comment.

In D125944#3689022 , @v.g.vassilev 
wrote:

> @Purva-Chaudhari can you rebase this patch?

Yes. I realized I would have to rebase




Comment at: clang/lib/Interpreter/IncrementalParser.cpp:180
   DiagnosticsEngine &Diags = getCI()->getDiagnostics();
+  Sema::PerformPendingInstantiationsRAII PerformPendingInstantiations(S);
   if (Diags.hasErrorOccurred()) {

v.g.vassilev wrote:
> I suspect we should create this object earlier in this function. Can you 
> export the diff with more context like suggested here 
> https://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface
Let me try it out



Comment at: clang/test/Interpreter/execute.cpp:2
+// RUN: clang-repl "template T f() { return T(); }" "auto ptu2 = 
f(); err;" \
+// RUN: "auto ptu2 = f();" "int i = 0;"
 // RUN: clang-repl "int i = 10;" 'extern "C" int printf(const char*,...);' \

v.g.vassilev wrote:
> Can you move this test into a separate file which is dedicated for testing 
> recovery of templates?
Yes updating the commit


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] D130867: WORK-IN-PROGRESS [clang] adds builtin `std::invoke` and `std::invoke_r`

2022-07-31 Thread Christopher Di Bella via Phabricator via cfe-commits
cjdb created this revision.
cjdb added reviewers: aaron.ballman, rsmith.
Herald added a reviewer: NoQ.
Herald added a project: All.
cjdb requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

`std::invoke` and `std::invoke_r` are fairly easy to implement as
library functions using overloads, but this is an expensive
implementation. They can also be implemented using `if constexpr`, but
this requires duplicating the logic for the _noexcept-specifier_, which
makes the implementation brittle.

This commit lifts these functions into the compiler to avoid these
problems. It also adds the associated type-traits:

- `__invoke_result`
- `__is_invocable`
- `__is_invocable_r`
- `__is_nothrow_invocable`
- `__is_nothrow_invocable_r`

---

THIS IS A WORK IS PROGRESS

The following things need to be done:

- add all of the type traits
- fix up diagnostics
- benchmark against the aforementioned library implementaitons

I'm putting this up for an early review as I'd like to see if this is
headed down the right path, if there's anything I'm missing from the
function's side of things, and because I'd appreciate input on the
diagnostics (while I'm happy with the diags themselves, I'm less than
happy about how I'm handling them, and am wondering if the process
should be more invasive).

On diagnostics: it might be undesirable for the error to say the
expression, because expressions might be long. In this case, it would be
replaced with the entity kind (e.g. "can't invoke function", etc.), but
I feel this loses a lot of the diagnostic's expressability, and I'm
unhappy about that.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130867

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/Builtins.def
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ExprConstant.cpp
  clang/lib/Analysis/BodyFarm.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/test/SemaCXX/builtin-std-invoke.cpp

Index: clang/test/SemaCXX/builtin-std-invoke.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/builtin-std-invoke.cpp
@@ -0,0 +1,439 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++17 -verify %s
+
+namespace std {
+template 
+void invoke(F &&, Args &&...); // expected-note{{requires at least 1 argument, but 0 were provided}}
+
+template 
+R invoke_r(F &&, Args &&...); // expected-note{{requires at least 1 argument, but 0 were provided}}
+
+// Slightly different to the real deal to simplify test.
+template 
+class reference_wrapper {
+public:
+  constexpr reference_wrapper(T &t) : data(&t) {}
+
+  constexpr operator T &() const noexcept { return *data; }
+
+private:
+  T *data;
+};
+} // namespace std
+
+#define assert(...)   \
+  if (!(__VA_ARGS__)) \
+__builtin_unreachable();
+
+struct ThrowingInt {
+  constexpr ThrowingInt(int x) : value(x) {}
+
+  int value;
+};
+
+template 
+constexpr void bullet_1(F f, T &&t, Args... args) {
+  assert(std::invoke(f, static_cast(t), args...) == ExpectedResult);
+  static_assert(__is_same(decltype(std::invoke(f, static_cast(t), args...)), Returns));
+  static_assert(noexcept(std::invoke(f, static_cast(t), args...)) == IsNoexcept);
+
+  assert(std::invoke_r(f, static_cast(t), args...) == ExpectedResult);
+  static_assert(__is_same(decltype(std::invoke_r(f, static_cast(t), args...)), double));
+  static_assert(noexcept(std::invoke_r(f, static_cast(t), args...)) == IsNoexcept);
+
+  assert(std::invoke_r(f, static_cast(t), args...).value == ExpectedResult);
+  static_assert(__is_same(decltype(std::invoke_r(f, static_cast(t), args...)), ThrowingInt));
+  static_assert(!noexcept(std::invoke_r(f, static_cast(t), args...)));
+}
+
+template 
+constexpr void bullet_2(F f, T &t, Args... args) {
+  std::reference_wrapper rw(t);
+  assert(std::invoke(f, rw, args...) == ExpectedResult);
+  static_assert(__is_same(decltype(std::invoke(f, rw, args...)), Returns));
+  static_assert(noexcept(std::invoke(f, rw, args...)) == IsNoexcept);
+
+  assert(std::invoke_r(f, rw, args...) == ExpectedResult);
+  static_assert(__is_same(decltype(std::invoke_r(f, rw, args...)), double));
+  static_assert(noexcept(std::invoke_r(f, rw, args...)) == IsNoexcept);
+
+  assert(std::invoke_r(f, rw, args...).value == ExpectedResult);
+  static_assert(__is_same(decltype(std::invoke_r(f, rw, args...)), ThrowingInt));
+  static_assert(!noexcept(std::invoke_r(f, rw, args...)));
+}
+
+template 
+class PointerWrapper {
+public:
+  constexpr explicit PointerWrapper(T &t) noexcept : p(&t) {}
+
+  constexpr T &operator*() const noexcept { return *p; }
+
+private:
+  T *p;
+};
+
+template 
+constexpr void bullet_3(F f, T &t, Args... args) {
+  assert(std::invoke(f, &t, args...) == ExpectedResult);
+  static_assert(__is_same(decltype(std::invoke(f, &t

[PATCH] D130766: [SPIR-V] Disable opaque pointers in relese 15

2022-07-31 Thread Henry Linjamäki via Phabricator via cfe-commits
linjamaki added a comment.

In D130766#3687240 , @Anastasia wrote:

> CC to @linjamaki in case there is anything else/different needed for HIP.

LGMT.


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

https://reviews.llvm.org/D130766

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


[PATCH] D130224: [Clang][Attribute] Introduce maybe_undef attribute for function arguments which accepts undef values

2022-07-31 Thread krishna chaitanya sankisa via Phabricator via cfe-commits
skc7 added a comment.

In D130224#3688067 , @amyk wrote:

> In D130224#3688034 , @skc7 wrote:
>
>> In D130224#3687907 , 
>> @aaron.ballman wrote:
>>
>>> In D130224#3687860 , @amyk wrote:
>>>
 In D130224#3687487 , 
 @mubarizafzal wrote:

> Hi, the test cases that this patch introduces are failing on some ppc64le 
> (Linux on Power) buildbots:
> https://lab.llvm.org/buildbot/#/builders/57
> https://lab.llvm.org/buildbot/#/builders/230
> Would you mind taking a look please?

 Thanks for pinging this patch. It appears it's affecting both little 
 endian PPC:
 https://lab.llvm.org/buildbot/#/builders/230/builds/1079
 https://lab.llvm.org/buildbot/#/builders/121/builds/21978
 https://lab.llvm.org/buildbot/#/builders/57/builds/20484
 https://lab.llvm.org/buildbot/#/builders/36/builds/23702

 And big endian PPC bots:
 https://lab.llvm.org/buildbot/#/builders/231/builds/842
 https://lab.llvm.org/buildbot/#/builders/93/builds/10270
>>>
>>> If we don't hear from @skc7 in the next ~hour with a fix, feel free to 
>>> revert to get the bots back to green.
>>
>> Issue is with missing target triple in the tests. Submitted D130790 
>>  for review, which should fix the tests.
>
> I realized I didn't happen to see this comment in time and had already 
> reverted the patch. My apologies on this.

Relanded the revert with fixes to tests. commit 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130224

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


[clang] 39dd8dc - [NFC] Fix test failure in windows

2022-07-31 Thread Chuanqi Xu via cfe-commits

Author: Chuanqi Xu
Date: 2022-08-01T14:14:02+08:00
New Revision: 39dd8dcf208d24a8004f46ec0f3e912514a346b6

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

LOG: [NFC] Fix test failure in windows

Added: 


Modified: 
clang/test/CodeGenCXX/threadlocal_address.cpp

Removed: 




diff  --git a/clang/test/CodeGenCXX/threadlocal_address.cpp 
b/clang/test/CodeGenCXX/threadlocal_address.cpp
index d61b578034a86..d3b17796c3ad0 100644
--- a/clang/test/CodeGenCXX/threadlocal_address.cpp
+++ b/clang/test/CodeGenCXX/threadlocal_address.cpp
@@ -7,7 +7,7 @@ int g() {
   i++;
   return i;
 }
-// CHECK: @i = thread_local global i32 0
+// CHECK: @i = {{.*}}thread_local global i32 0
 // CHECK: @_ZZ1fvE1j = internal thread_local global i32 0
 //
 // CHECK: @_Z1gv()



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


[clang] dc900ee - [test] Fix threadlocal_address.cpp after D129833

2022-07-31 Thread Fangrui Song via cfe-commits

Author: Fangrui Song
Date: 2022-07-31T23:49:33-07:00
New Revision: dc900eeaf2af0d459c69224b2d023d8d2287944a

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

LOG: [test] Fix threadlocal_address.cpp after D129833

Older Darwin does not support thread_local:

error: thread-local storage is not supported for the current target
  thread_local int j = 0;

Added: 


Modified: 
clang/test/CodeGenCXX/threadlocal_address.cpp

Removed: 




diff  --git a/clang/test/CodeGenCXX/threadlocal_address.cpp 
b/clang/test/CodeGenCXX/threadlocal_address.cpp
index d3b17796c3ad..a55b1ee6e08d 100644
--- a/clang/test/CodeGenCXX/threadlocal_address.cpp
+++ b/clang/test/CodeGenCXX/threadlocal_address.cpp
@@ -1,7 +1,7 @@
 // Test that the use of thread local variables would be wrapped by 
@llvm.threadlocal.address intrinsics.
-// RUN: %clang_cc1 -std=c++11 -emit-llvm -triple %itanium_abi_triple -o - %s 
-disable-llvm-passes | FileCheck %s
-// RUN: %clang_cc1 -std=c++11 -emit-llvm -triple %itanium_abi_triple -o - -O1 
%s | FileCheck %s -check-prefix=CHECK-O1
-// RUN: %clang_cc1 -std=c++11 -no-opaque-pointers -emit-llvm -triple 
%itanium_abi_triple -o - %s -disable-llvm-passes | FileCheck %s 
-check-prefix=CHECK-NOOPAQUE
+// RUN: %clang_cc1 -std=c++11 -emit-llvm -triple x86_64 -o - %s 
-disable-llvm-passes | FileCheck %s
+// RUN: %clang_cc1 -std=c++11 -emit-llvm -triple aarch64 -o - -O1 %s | 
FileCheck %s -check-prefix=CHECK-O1
+// RUN: %clang_cc1 -std=c++11 -no-opaque-pointers -emit-llvm -triple x86_64 -o 
- %s -disable-llvm-passes | FileCheck %s -check-prefix=CHECK-NOOPAQUE
 thread_local int i;
 int g() {
   i++;



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