[PATCH] D139400: [clang] Show error when a local variables is passed as default template parameter

2023-01-20 Thread Jens Massberg via Phabricator via cfe-commits
massberg marked 2 inline comments as done.
massberg added inline comments.



Comment at: clang/test/SemaTemplate/default-template-arguments.cpp:12
+  auto lambda1 = []  {}; // expected-error {{default 
argument references local variable x_constexpr of enclosing function}}
+  auto lambda2 = []  {}; // expected-error {{default 
argument references local variable x_static of enclosing function}}
+  auto lambda3 = []  {}; // expected-error {{default 
argument references local variable x_const of enclosing function}}

shafik wrote:
> tahonermann wrote:
> > MSVC and Clang currently accept `x_static`. The resolution of [[ 
> > https://cplusplus.github.io/CWG/issues/2346.html | CWG 2346 ]] suggests 
> > that this case (and maybe `x_constexpr`) should be accepted following the 
> > adoption of [[ https://wg21.link/p0588r1 | P0588R1 (Simplifying implicit 
> > lambda capture) ]]. However, it isn't obvious to me that P0588R1 actually 
> > addresses this. It might be worth following up with CWG to understand what 
> > the intent is.
> I posted to the core reflector on this topic and there is already some 
> feedback but let me wait to see if there is a consensus of this will need 
> further discussions in core.
Hi! Is there any update on this? How should I proceed?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139400

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


[PATCH] D140875: [clangd] prototype: Implement unused include warnings with include-cleaner library.

2023-01-20 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment.

oops, sorry for the trouble it caused, and thanks for @kadircet fixing it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140875

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


[PATCH] D139704: [clang][RISCV] Added target attributes to runtime functions

2023-01-20 Thread Elena Lepilkina via Phabricator via cfe-commits
eklepilkina added a comment.

> How does this affect LTO?

More detailed answer. We work with bitcode files only when use `lto`. If we 
don't use `lto` clang produces `.o` file that are already contains target 
information. We don't work with function attributes to get subtarget without 
lto.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139704

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


[PATCH] D140619: ExtractFunction: support extracting expressions and selected part of it

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

In D140619#4058232 , @KKoovalsky 
wrote:

> Hey! I can see that the build: 
> https://reviews.llvm.org/harbormaster/build/311598/ failed, but I am not sure 
> whether this is related to my change. Could someone take a look?

I can reproduce the failures locally with the patch applied. To do so, run:

  /bin/llvm-lit /clang-tools-extra/clangd/test/check.test

and similarly for `check-fail.test` and `check-lines.test`.

You can read more about how these tests work at 
https://llvm.org/docs/CommandGuide/lit.html.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140619

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


[PATCH] D140619: ExtractFunction: support extracting expressions and selected part of it

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

By the way, I also got linker errors when trying to build this patch in a 
shared-libs build. Resolved by adding `clangASTMatchers` to 
`clang_target_link_libraries` in `clang-tools-extra/clangd/tool/CMakeLists.txt`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140619

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


[PATCH] D140619: ExtractFunction: support extracting expressions and selected part of it

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

In D140619#4067940 , @nridge wrote:

> I can reproduce the failures locally with the patch applied.

(The failures seem to have to do with `ExtractFunction` segfaulting when 
invoked at a particular location in the code in `check.test`.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140619

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


[PATCH] D139705: [clang] fix zero-initialization fix-it for variable template

2023-01-20 Thread Vincent Hong via Phabricator via cfe-commits
v1nh1shungry added a comment.

In D139705#4067774 , @lattner wrote:

> Got it this time, sorry for the confusion!

Confirmed that I received the invitation. Thanks a lot!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139705

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


[clang] e74f9e7 - [include-mapping] Parse zombie_names.html into a removed symbols map.

2023-01-20 Thread Viktoriia Bakalova via cfe-commits

Author: Viktoriia Bakalova
Date: 2023-01-20T08:53:31Z
New Revision: e74f9e7885078e7c847b2672a70b6743731aa53a

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

LOG: [include-mapping] Parse zombie_names.html into a removed symbols map.

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

Added: 


Modified: 
clang/tools/include-mapping/gen_std.py

Removed: 




diff  --git a/clang/tools/include-mapping/gen_std.py 
b/clang/tools/include-mapping/gen_std.py
index f494ff0b88679..db70771e0f52b 100755
--- a/clang/tools/include-mapping/gen_std.py
+++ b/clang/tools/include-mapping/gen_std.py
@@ -28,9 +28,11 @@
  get a "cppreference/reference" directory.
   4. Run the command:
// Generate C++ symbols
-   python3 gen_std.py -cppreference cppreference/reference -language=cpp > 
StdSymbolMap.inc
+   python3 gen_std.py -cppreference cppreference/reference -symbols=cpp > 
StdSymbolMap.inc
+   // Generate C++ removed symbols
+   python3 gen_std.py -cppreference cppreference/reference 
-symbols=cpp_removed > RemovedSymbolMap.inc
// Generate C symbols
-   python3 gen_std.py -cppreference cppreference/reference -language=c > 
CSymbolMap.inc
+   python3 gen_std.py -cppreference cppreference/reference -symbols=c > 
CSymbolMap.inc
 """
 
 
@@ -60,16 +62,16 @@ def ParseArg():
   help='path to the cppreference offline HTML directory',
   required=True
  )
-  parser.add_argument('-language',
+  parser.add_argument('-symbols',
   default='cpp',
-  help='Generate c or cpp symbols',
-  required=True)
+  help='Generate c or cpp (removed) symbols. One of {cpp, 
c, cpp_removed}.',
+  required=True) 
   return parser.parse_args()
 
 
 def main():
   args = ParseArg()
-  if args.language == 'cpp':
+  if args.symbols == 'cpp':
 page_root = os.path.join(args.cppreference, "en", "cpp")
 symbol_index_root = os.path.join(page_root, "symbol_index")
 parse_pages =  [
@@ -87,22 +89,26 @@ def main():
   (symbol_index_root, "regex_constants.html", "std::regex_constants::"),
   (symbol_index_root, "this_thread.html", "std::this_thread::"),
 ]
-  elif args.language == 'c':
+  elif args.symbols == 'cpp_removed':
+page_root = os.path.join(args.cppreference, "en", "cpp")
+symbol_index_root = os.path.join(page_root, "symbol_index")
+parse_pages = [(symbol_index_root, "zombie_names.html", "std::")]
+  elif args.symbols == 'c':
 page_root = os.path.join(args.cppreference, "en", "c")
 symbol_index_root = page_root
-parse_pages = [(page_root, "index.html", None)]
-
+parse_pages = [(page_root, "index.html", None)]  
+
   if not os.path.exists(symbol_index_root):
 exit("Path %s doesn't exist!" % symbol_index_root)
 
   symbols = cppreference_parser.GetSymbols(parse_pages)
-
+  
   # We don't have version information from the unzipped offline HTML files.
   # so we use the modified time of the symbol_index.html as the version.
   index_page_path = os.path.join(page_root, "index.html")
   cppreference_modified_date = datetime.datetime.fromtimestamp(
 os.stat(index_page_path).st_mtime).strftime('%Y-%m-%d')
-  print(CODE_PREFIX % (args.language.upper(), cppreference_modified_date))
+  print(CODE_PREFIX % (args.symbols.upper(), cppreference_modified_date))
   for symbol in symbols:
 if len(symbol.headers) == 1:
   # SYMBOL(unqualified_name, namespace, header)



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


[PATCH] D141855: [include-mapping] Parse zombie_names.html into a removed symbols map.

2023-01-20 Thread Viktoriia Bakalova 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 rGe74f9e788507: [include-mapping] Parse zombie_names.html into 
a removed symbols map. (authored by VitaNuo).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141855

Files:
  clang/tools/include-mapping/gen_std.py


Index: clang/tools/include-mapping/gen_std.py
===
--- clang/tools/include-mapping/gen_std.py
+++ clang/tools/include-mapping/gen_std.py
@@ -28,9 +28,11 @@
  get a "cppreference/reference" directory.
   4. Run the command:
// Generate C++ symbols
-   python3 gen_std.py -cppreference cppreference/reference -language=cpp > 
StdSymbolMap.inc
+   python3 gen_std.py -cppreference cppreference/reference -symbols=cpp > 
StdSymbolMap.inc
+   // Generate C++ removed symbols
+   python3 gen_std.py -cppreference cppreference/reference 
-symbols=cpp_removed > RemovedSymbolMap.inc
// Generate C symbols
-   python3 gen_std.py -cppreference cppreference/reference -language=c > 
CSymbolMap.inc
+   python3 gen_std.py -cppreference cppreference/reference -symbols=c > 
CSymbolMap.inc
 """
 
 
@@ -60,16 +62,16 @@
   help='path to the cppreference offline HTML directory',
   required=True
  )
-  parser.add_argument('-language',
+  parser.add_argument('-symbols',
   default='cpp',
-  help='Generate c or cpp symbols',
-  required=True)
+  help='Generate c or cpp (removed) symbols. One of {cpp, 
c, cpp_removed}.',
+  required=True) 
   return parser.parse_args()
 
 
 def main():
   args = ParseArg()
-  if args.language == 'cpp':
+  if args.symbols == 'cpp':
 page_root = os.path.join(args.cppreference, "en", "cpp")
 symbol_index_root = os.path.join(page_root, "symbol_index")
 parse_pages =  [
@@ -87,22 +89,26 @@
   (symbol_index_root, "regex_constants.html", "std::regex_constants::"),
   (symbol_index_root, "this_thread.html", "std::this_thread::"),
 ]
-  elif args.language == 'c':
+  elif args.symbols == 'cpp_removed':
+page_root = os.path.join(args.cppreference, "en", "cpp")
+symbol_index_root = os.path.join(page_root, "symbol_index")
+parse_pages = [(symbol_index_root, "zombie_names.html", "std::")]
+  elif args.symbols == 'c':
 page_root = os.path.join(args.cppreference, "en", "c")
 symbol_index_root = page_root
-parse_pages = [(page_root, "index.html", None)]
-
+parse_pages = [(page_root, "index.html", None)]  
+
   if not os.path.exists(symbol_index_root):
 exit("Path %s doesn't exist!" % symbol_index_root)
 
   symbols = cppreference_parser.GetSymbols(parse_pages)
-
+  
   # We don't have version information from the unzipped offline HTML files.
   # so we use the modified time of the symbol_index.html as the version.
   index_page_path = os.path.join(page_root, "index.html")
   cppreference_modified_date = datetime.datetime.fromtimestamp(
 os.stat(index_page_path).st_mtime).strftime('%Y-%m-%d')
-  print(CODE_PREFIX % (args.language.upper(), cppreference_modified_date))
+  print(CODE_PREFIX % (args.symbols.upper(), cppreference_modified_date))
   for symbol in symbols:
 if len(symbol.headers) == 1:
   # SYMBOL(unqualified_name, namespace, header)


Index: clang/tools/include-mapping/gen_std.py
===
--- clang/tools/include-mapping/gen_std.py
+++ clang/tools/include-mapping/gen_std.py
@@ -28,9 +28,11 @@
  get a "cppreference/reference" directory.
   4. Run the command:
// Generate C++ symbols
-   python3 gen_std.py -cppreference cppreference/reference -language=cpp > StdSymbolMap.inc
+   python3 gen_std.py -cppreference cppreference/reference -symbols=cpp > StdSymbolMap.inc
+   // Generate C++ removed symbols
+   python3 gen_std.py -cppreference cppreference/reference -symbols=cpp_removed > RemovedSymbolMap.inc
// Generate C symbols
-   python3 gen_std.py -cppreference cppreference/reference -language=c > CSymbolMap.inc
+   python3 gen_std.py -cppreference cppreference/reference -symbols=c > CSymbolMap.inc
 """
 
 
@@ -60,16 +62,16 @@
   help='path to the cppreference offline HTML directory',
   required=True
  )
-  parser.add_argument('-language',
+  parser.add_argument('-symbols',
   default='cpp',
-  help='Generate c or cpp symbols',
-  required=True)
+  help='Generate c or cpp (removed) symbols. One of {cpp, c, cpp_removed}.',
+  required=True) 
   return parser.parse_args()
 
 
 def main

[PATCH] D142187: [clang] Fix typos in member initializers

2023-01-20 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet created this revision.
kadircet added reviewers: hokein, cor3ntin, aaron.ballman.
Herald added a project: All.
kadircet requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This was regressed in ca619613801233ef2def8c3cc7d311d5ed0033cb 
. As we
attached InitExprs as-is to the AST, without performing transformations.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142187

Files:
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/PCH/typo3.cpp


Index: clang/test/PCH/typo3.cpp
===
--- /dev/null
+++ clang/test/PCH/typo3.cpp
@@ -0,0 +1,8 @@
+// RUN: not %clang_cc1 -emit-pch %s -o %t.pch 2>&1 | FileCheck %s
+
+struct S {
+  // Make sure TypoExprs in default init exprs are corrected before serializing
+  // in PCH.
+  int y = bar;
+  // CHECK: use of undeclared identifier 'bar'
+};
Index: clang/lib/Sema/SemaDeclCXX.cpp
===
--- clang/lib/Sema/SemaDeclCXX.cpp
+++ clang/lib/Sema/SemaDeclCXX.cpp
@@ -4098,9 +4098,10 @@
 return;
   }
 
-  ExprResult Init = InitExpr;
-  if (!FD->getType()->isDependentType() && !InitExpr->isTypeDependent()) {
-Init = ConvertMemberDefaultInitExpression(FD, InitExpr, InitLoc);
+  ExprResult Init = CorrectDelayedTyposInExpr(InitExpr, /*InitDecl=*/nullptr,
+  
/*RecoverUncorrectedTypos=*/true);
+  if (!FD->getType()->isDependentType() && !Init.get()->isTypeDependent()) {
+Init = ConvertMemberDefaultInitExpression(FD, Init.get(), InitLoc);
 // C++11 [class.base.init]p7:
 //   The initialization of each base and member constitutes a
 //   full-expression.
@@ -4112,9 +4113,7 @@
 }
   }
 
-  InitExpr = Init.get();
-
-  FD->setInClassInitializer(InitExpr);
+  FD->setInClassInitializer(Init.get());
 }
 
 /// Find the direct and/or virtual base specifiers that


Index: clang/test/PCH/typo3.cpp
===
--- /dev/null
+++ clang/test/PCH/typo3.cpp
@@ -0,0 +1,8 @@
+// RUN: not %clang_cc1 -emit-pch %s -o %t.pch 2>&1 | FileCheck %s
+
+struct S {
+  // Make sure TypoExprs in default init exprs are corrected before serializing
+  // in PCH.
+  int y = bar;
+  // CHECK: use of undeclared identifier 'bar'
+};
Index: clang/lib/Sema/SemaDeclCXX.cpp
===
--- clang/lib/Sema/SemaDeclCXX.cpp
+++ clang/lib/Sema/SemaDeclCXX.cpp
@@ -4098,9 +4098,10 @@
 return;
   }
 
-  ExprResult Init = InitExpr;
-  if (!FD->getType()->isDependentType() && !InitExpr->isTypeDependent()) {
-Init = ConvertMemberDefaultInitExpression(FD, InitExpr, InitLoc);
+  ExprResult Init = CorrectDelayedTyposInExpr(InitExpr, /*InitDecl=*/nullptr,
+  /*RecoverUncorrectedTypos=*/true);
+  if (!FD->getType()->isDependentType() && !Init.get()->isTypeDependent()) {
+Init = ConvertMemberDefaultInitExpression(FD, Init.get(), InitLoc);
 // C++11 [class.base.init]p7:
 //   The initialization of each base and member constitutes a
 //   full-expression.
@@ -4112,9 +4113,7 @@
 }
   }
 
-  InitExpr = Init.get();
-
-  FD->setInClassInitializer(InitExpr);
+  FD->setInClassInitializer(Init.get());
 }
 
 /// Find the direct and/or virtual base specifiers that
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] b7894eb - [clang][Interp] Initialize remaining InlineDescriptor fields

2023-01-20 Thread Timm Bäder via cfe-commits

Author: Timm Bäder
Date: 2023-01-20T10:04:16+01:00
New Revision: b7894ebf8439c0141614fbb8bfc1a27a0a67e946

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

LOG: [clang][Interp] Initialize remaining InlineDescriptor fields

for local variables. Hoping this will please msan.

Added: 


Modified: 
clang/lib/AST/Interp/EvalEmitter.cpp
clang/lib/AST/Interp/InterpFrame.cpp

Removed: 




diff  --git a/clang/lib/AST/Interp/EvalEmitter.cpp 
b/clang/lib/AST/Interp/EvalEmitter.cpp
index 7b6e5561d978a..3c1d48f09f9bf 100644
--- a/clang/lib/AST/Interp/EvalEmitter.cpp
+++ b/clang/lib/AST/Interp/EvalEmitter.cpp
@@ -60,6 +60,10 @@ Scope::Local EvalEmitter::createLocal(Descriptor *D) {
   Desc.Desc = D;
   Desc.Offset = sizeof(InlineDescriptor);
   Desc.IsActive = true;
+  Desc.IsBase = false;
+  Desc.IsMutable = false;
+  Desc.IsConst = false;
+  Desc.IsInitialized = false;
 
   // Register the local.
   unsigned Off = Locals.size();

diff  --git a/clang/lib/AST/Interp/InterpFrame.cpp 
b/clang/lib/AST/Interp/InterpFrame.cpp
index 19ac0bd5433a5..f6437771ccbed 100644
--- a/clang/lib/AST/Interp/InterpFrame.cpp
+++ b/clang/lib/AST/Interp/InterpFrame.cpp
@@ -40,6 +40,10 @@ InterpFrame::InterpFrame(InterpState &S, const Function 
*Func,
   ID->Desc = Local.Desc;
   ID->IsActive = true;
   ID->Offset = sizeof(InlineDescriptor);
+  ID->IsBase = false;
+  ID->IsMutable = false;
+  ID->IsConst = false;
+  ID->IsInitialized = false;
 }
   }
 }



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


[PATCH] D140838: [clang] fix crash on generic lambda with lambda in decltype

2023-01-20 Thread Vincent Hong via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGea4fd668c2cd: [clang] fix crash on generic lambda with 
lambda in decltype (authored by v1nh1shungry).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140838

Files:
  clang/lib/Sema/SemaTemplateInstantiate.cpp
  clang/test/SemaCXX/lambda-unevaluated.cpp


Index: clang/test/SemaCXX/lambda-unevaluated.cpp
===
--- clang/test/SemaCXX/lambda-unevaluated.cpp
+++ clang/test/SemaCXX/lambda-unevaluated.cpp
@@ -142,3 +142,7 @@
 using d = decltype(sizeof([] static { return 0; }));
 
 }
+
+namespace lambda_in_trailing_decltype {
+auto x = ([](auto) -> decltype([] {}()) {}(0), 2);
+}
Index: clang/lib/Sema/SemaTemplateInstantiate.cpp
===
--- clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -1231,7 +1231,7 @@
 
   // We recreated a local declaration, but not by instantiating it. There
   // may be pending dependent diagnostics to produce.
-  if (auto *DC = dyn_cast(Old))
+  if (auto *DC = dyn_cast(Old); DC && 
DC->isDependentContext())
 SemaRef.PerformDependentDiagnostics(DC, TemplateArgs);
 }
 


Index: clang/test/SemaCXX/lambda-unevaluated.cpp
===
--- clang/test/SemaCXX/lambda-unevaluated.cpp
+++ clang/test/SemaCXX/lambda-unevaluated.cpp
@@ -142,3 +142,7 @@
 using d = decltype(sizeof([] static { return 0; }));
 
 }
+
+namespace lambda_in_trailing_decltype {
+auto x = ([](auto) -> decltype([] {}()) {}(0), 2);
+}
Index: clang/lib/Sema/SemaTemplateInstantiate.cpp
===
--- clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -1231,7 +1231,7 @@
 
   // We recreated a local declaration, but not by instantiating it. There
   // may be pending dependent diagnostics to produce.
-  if (auto *DC = dyn_cast(Old))
+  if (auto *DC = dyn_cast(Old); DC && DC->isDependentContext())
 SemaRef.PerformDependentDiagnostics(DC, TemplateArgs);
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] ea4fd66 - [clang] fix crash on generic lambda with lambda in decltype

2023-01-20 Thread via cfe-commits

Author: v1nh1shungry
Date: 2023-01-20T17:11:07+08:00
New Revision: ea4fd668c2cd88d13b36a5d64e3dedb1106340bc

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

LOG: [clang] fix crash on generic lambda with lambda in decltype

Relevant issue: https://github.com/llvm/llvm-project/issues/59771

During the instantiation of a generic lambda, a non-generic lambda in
the trailing `decltype` is a `DeclContext` but not a dependent context,
so we shouldn't call `PerformDependentDiagnostics` on it.

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

Added: 


Modified: 
clang/lib/Sema/SemaTemplateInstantiate.cpp
clang/test/SemaCXX/lambda-unevaluated.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp 
b/clang/lib/Sema/SemaTemplateInstantiate.cpp
index 89502937cc30b..2790e78aa53a3 100644
--- a/clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -1231,7 +1231,7 @@ namespace {
 
   // We recreated a local declaration, but not by instantiating it. There
   // may be pending dependent diagnostics to produce.
-  if (auto *DC = dyn_cast(Old))
+  if (auto *DC = dyn_cast(Old); DC && 
DC->isDependentContext())
 SemaRef.PerformDependentDiagnostics(DC, TemplateArgs);
 }
 

diff  --git a/clang/test/SemaCXX/lambda-unevaluated.cpp 
b/clang/test/SemaCXX/lambda-unevaluated.cpp
index 6d8c3b88c2eaf..da00cb48a87fd 100644
--- a/clang/test/SemaCXX/lambda-unevaluated.cpp
+++ b/clang/test/SemaCXX/lambda-unevaluated.cpp
@@ -142,3 +142,7 @@ using c = decltype([]() static noexcept(noexcept([] { 
return 0; }())) { return 0
 using d = decltype(sizeof([] static { return 0; }));
 
 }
+
+namespace lambda_in_trailing_decltype {
+auto x = ([](auto) -> decltype([] {}()) {}(0), 2);
+}



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


[PATCH] D139704: [clang][RISCV] Added target attributes to runtime functions

2023-01-20 Thread Elena Lepilkina via Phabricator via cfe-commits
eklepilkina added a comment.

I've created one more patch connected with lto https://reviews.llvm.org/D142191 
and it also uses attributes of functions as the way to get right TargetMachine 
in linker.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139704

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


[PATCH] D142187: [clang] Fix typos in member initializers

2023-01-20 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment.

Randomly chiming in here.
I never had a good model of where `CorrectDelayedTyposInExpr`, but wanted to 
note that `ActOnFullExpr` also calls it. This may be fine, I just wanted to 
mention it as it stood out.




Comment at: clang/lib/Sema/SemaDeclCXX.cpp:4101
 
-  ExprResult Init = InitExpr;
-  if (!FD->getType()->isDependentType() && !InitExpr->isTypeDependent()) {
-Init = ConvertMemberDefaultInitExpression(FD, InitExpr, InitLoc);
+  ExprResult Init = CorrectDelayedTyposInExpr(InitExpr, /*InitDecl=*/nullptr,
+  
/*RecoverUncorrectedTypos=*/true);

Should we pass `FD` here to avoid correcting to itself?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142187

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


[PATCH] D139774: [libclang] Add API to set temporary directory location

2023-01-20 Thread Igor Kushnir via Phabricator via cfe-commits
vedgy added a comment.

One idea discussed in comments to the KDevelop merge request, which I haven't 
mentioned here is this: remove the preamble files immediately after creating 
and opening them. This is safe on Unix-like OSes, because every file that is 
still open will not actually be deleted but its directory entry cleared. It's 
an old Unix trick to mark (open) files as volatile. You could do this with any 
opened file (that you don't want to be able to close and then reopen) 
immediately after creating it in which case it'll get cleaned up even in case 
of a hard crash. However, my analysis of 
//clang/lib/Frontend/PrecompiledPreamble.cpp// shows that such unlinking isn't 
straightforward for the preamble files, e.g. because of 
`PrecompiledPreamble::getSize()`, which checks the file size at the preamble 
file path.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139774

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


[PATCH] D140584: [Clang] Refactor "Designators" into a unified implementation [NFC]

2023-01-20 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment.

Friendly ping!

BTW, I'm planning on future changes to designated initializers. This is the 
first step. I hope to get rid of the template stuff in the followup.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140584

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


[PATCH] D142196: [clang][Lex] Add back PPCallbacks::FileNotFound

2023-01-20 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld created this revision.
Hahnfeld added reviewers: jansvoboda11, ahoppen.
Herald added subscribers: shchenz, kbarton, nemanjai.
Herald added a project: All.
Hahnfeld requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This callback was removed with commit rG7a124f4859 
, but we 
use it downstream in ROOT/Cling to implement handling of a special include 
syntax. Add back a "safe" version of the callback that only takes the file name 
and return a bool to silently skip the file.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142196

Files:
  clang/include/clang/Lex/PPCallbacks.h
  clang/lib/Lex/PPDirectives.cpp


Index: clang/lib/Lex/PPDirectives.cpp
===
--- clang/lib/Lex/PPDirectives.cpp
+++ clang/lib/Lex/PPDirectives.cpp
@@ -2019,6 +2019,10 @@
   if (File)
 return File;
 
+  // Give the clients a chance to silently skip this include.
+  if (Callbacks && Callbacks->FileNotFound(Filename))
+return std::nullopt;
+
   if (SuppressIncludeNotFoundError)
 return std::nullopt;
 
Index: clang/include/clang/Lex/PPCallbacks.h
===
--- clang/include/clang/Lex/PPCallbacks.h
+++ clang/include/clang/Lex/PPCallbacks.h
@@ -83,6 +83,16 @@
const Token &FilenameTok,
SrcMgr::CharacteristicKind FileType) {}
 
+  /// Callback invoked whenever an inclusion directive results in a
+  /// file-not-found error.
+  ///
+  /// \param FileName The name of the file being included, as written in the
+  /// source code.
+  ///
+  /// \returns true to indicate that the preprocessor should skip this file
+  /// and not issue any diagnostic.
+  virtual bool FileNotFound(StringRef FileName) { return false; }
+
   /// Callback invoked whenever an inclusion directive of
   /// any kind (\c \#include, \c \#import, etc.) has been processed, regardless
   /// of whether the inclusion will actually result in an inclusion.
@@ -451,6 +461,14 @@
 Second->FileSkipped(SkippedFile, FilenameTok, FileType);
   }
 
+  bool FileNotFound(StringRef FileName) override {
+bool Skip = First->FileNotFound(FileName);
+// Make sure to invoke the second callback, no matter if the first already
+// returned true to skip the file.
+Skip |= Second->FileNotFound(FileName);
+return Skip;
+  }
+
   void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok,
   StringRef FileName, bool IsAngled,
   CharSourceRange FilenameRange,


Index: clang/lib/Lex/PPDirectives.cpp
===
--- clang/lib/Lex/PPDirectives.cpp
+++ clang/lib/Lex/PPDirectives.cpp
@@ -2019,6 +2019,10 @@
   if (File)
 return File;
 
+  // Give the clients a chance to silently skip this include.
+  if (Callbacks && Callbacks->FileNotFound(Filename))
+return std::nullopt;
+
   if (SuppressIncludeNotFoundError)
 return std::nullopt;
 
Index: clang/include/clang/Lex/PPCallbacks.h
===
--- clang/include/clang/Lex/PPCallbacks.h
+++ clang/include/clang/Lex/PPCallbacks.h
@@ -83,6 +83,16 @@
const Token &FilenameTok,
SrcMgr::CharacteristicKind FileType) {}
 
+  /// Callback invoked whenever an inclusion directive results in a
+  /// file-not-found error.
+  ///
+  /// \param FileName The name of the file being included, as written in the
+  /// source code.
+  ///
+  /// \returns true to indicate that the preprocessor should skip this file
+  /// and not issue any diagnostic.
+  virtual bool FileNotFound(StringRef FileName) { return false; }
+
   /// Callback invoked whenever an inclusion directive of
   /// any kind (\c \#include, \c \#import, etc.) has been processed, regardless
   /// of whether the inclusion will actually result in an inclusion.
@@ -451,6 +461,14 @@
 Second->FileSkipped(SkippedFile, FilenameTok, FileType);
   }
 
+  bool FileNotFound(StringRef FileName) override {
+bool Skip = First->FileNotFound(FileName);
+// Make sure to invoke the second callback, no matter if the first already
+// returned true to skip the file.
+Skip |= Second->FileNotFound(FileName);
+return Skip;
+  }
+
   void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok,
   StringRef FileName, bool IsAngled,
   CharSourceRange FilenameRange,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D119708: [clang][lex] Remove `PPCallbacks::FileNotFound()`

2023-01-20 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld added a comment.

In D119708#4062632 , @jansvoboda11 
wrote:

> If the plan is to eventually upstream that part of Cling, I'm fine with 
> re-adding a safe version of this API.

I'll be honest here and say that I personally find it unlikely that this part 
of ROOT will be upstreamed, it is very specific and also there for 
backwards-compatibility in a very specific case. Nevertheless, I understand 
that Clang should offer its clients a rich API to get all information they 
need, so I put together https://reviews.llvm.org/D142196 with a hopefully 
"safe" version of a `FileNotFound` callback, that optionally even supports 
silently skipping this file. This would provide exactly what we need.

Another possibility that I considered is extending `InclusionDirective` and 
always call it, also for missing files. However, I find this much less clear 
and we already have `FileSkipped`...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119708

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


cfe-commits@lists.llvm.org

2023-01-20 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added inline comments.



Comment at: clang/lib/Format/TokenAnnotator.cpp:2544
   SmallVector Contexts;
+  static SmallVector Scopes;
 

dkt01 wrote:
> HazardyKnusperkeks wrote:
> > Why static?
> The AnnotatingParser object lifetime is too short to track the scope 
> information I wanted.  From my testing, it seems like this object is created 
> once per line.  This is why I haven't added the scope information as part of 
> the contexts member.
> 
> I would like to make this a non-static member, but I'm not sure which object 
> it should be a member of.  Do you have a recommendation?
The `TokenAnnotator`? And then by reference to the parser.



Comment at: clang/lib/Format/TokenAnnotator.cpp:2935
 return true; // Empty parentheses.
+
   // If there is an &/&& after the r_paren, this is likely a function.

Unrelated.



Comment at: clang/unittests/Format/TokenAnnotatorTest.cpp:181
+  ASSERT_EQ(Tokens.size(), 5u) << Tokens;
+  EXPECT_TOKEN(Tokens[1], tok::amp, TT_BinaryOperator);
+

dkt01 wrote:
> MyDeveloperDay wrote:
> > how does this differentiate from 
> > 
> > `MyType & val2;`
> > 
> > is that a binary operator? I don't think so?
> The heuristic I'm using is that [symbol] & [symbol]; outside a class/struct 
> declaration is more likely an instance of operator& than an uninitialized 
> reference.  Tests on line 206 and 215 demonstrate how the two cases differ.
> The heuristic I'm using is that [symbol] & [symbol]; outside a class/struct 
> declaration is more likely an instance of operator& than an uninitialized 
> reference.  Tests on line 206 and 215 demonstrate how the two cases differ.

I'm with this one. A reference without initialization is an error.

Can you add a test with an assignment, I didn't see one right now.


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

https://reviews.llvm.org/D141959

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


[PATCH] D141811: [clang-format] Allow trailing return types in macros

2023-01-20 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added a comment.

In D141811#4064428 , @rymiel wrote:

> In D141811#4055485 , 
> @HazardyKnusperkeks wrote:
>
>> What about `decltype(auto)`?
>
> Turns out this is a problem even without this patch:
>
> `decltype(auto) a = (b) -> c;`
>
> I'm sure this could somehow be valid c++ syntax, but it does have to be at 
> the top scope. I suppose I could fix it in this patch.

I thought about `auto NAME() -> int { return 42; }`.

`decltype(auto) a = (b) -> c;` is something else...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141811

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


[PATCH] D142024: [clang] Optimize clang::Builtin::Info density

2023-01-20 Thread Nikita Popov via Phabricator via cfe-commits
nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.

LGTM. The task-clock improvement is likely noise, but there's definitely a code 
size / max-rss win here.




Comment at: clang/include/clang/Basic/BuiltinHeaders.def:9
+//
+// This file defines the standard builtin function header locations.  Users of 
this file
+// must define the HEADER macro to make use of this information.

Probably overlong line?



Comment at: clang/include/clang/Basic/Builtins.h:68
+};
+  }
+};

It might make more sense to define this out of line in a C++ file. (Doesn't 
seem performance critical, and probably generates a bunch of redundant strings 
and a lookup table in each object file...)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142024

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


[PATCH] D140959: RFC: Multilib prototype

2023-01-20 Thread Michael Platings via Phabricator via cfe-commits
michaelplatings added a comment.

A constraint is that the user should be able to choose the library with a 
single list of arguments, as displayed with `-print-multi-lib`. Therefore I'm 
sceptical about making the selection mechanism too expressive, because 
`-print-multi-lib` can't explain that to the user. Already the presence of 
negation is stretching that.

Nevertheless let's pick an example of something that can't be directly 
expressed in the prototype: `NOT (a AND b)`. (I don't know why you'd want to do 
that, if you have a motivating example of something genuinely useful then that 
would be better)

The expression can be rearranged to `(a AND NOT b) OR (b AND NOT a) OR ((NOT a) 
AND NOT b)` which can be represented in an ugly way:

  variants:
  - path: p
args: [-a]
attrs: [a, not-b]
  - path: p
args: [-b]
attrs: [not-a, b]
  - path: p
args: []
attrs: [not-a, not-b]
  arguments:
  - regex: -a
matchAttrs: [a]
noMatchAttrs: [not-a]
  - regex: -b
matchAttrs: [b]
noMatchAttrs: [not-b]

I think this fits with the spirit of "Make the easy things easy, and the hard 
things possible."

> perhaps it's enough to just make sure there's extension room in the syntax so 
> that this can be added later

One of the many nice things about JSON & YAML is it gives you loads of room for 
extension, so yes. For example, currently `attrs` must be an array, but the 
option could be added later that it could be an object like `attrs: {not: [a, 
b]}`. But I hope it doesn't prove necessary ;)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140959

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


[PATCH] D76062: [PATCH] [ARM] ARMv8.6-a command-line + BFloat16 Asm Support

2023-01-20 Thread Ties Stuij via Phabricator via cfe-commits
stuij added inline comments.



Comment at: llvm/include/llvm/Support/AArch64TargetParser.def:52
+  AArch64::AEK_RDM  | AArch64::AEK_RCPC | AArch64::AEK_DOTPROD |
+  AArch64::AEK_SM4  | AArch64::AEK_SHA3 | AArch64::AEK_BF16|
+  AArch64::AEK_SHA2 | AArch64::AEK_AES  | AArch64::AEK_I8MM))

ab wrote:
> stuij wrote:
> > SjoerdMeijer wrote:
> > > just double checking (because I can't remember): BF16 is a mandatory 
> > > extension?
> > for 8.2 it isn't, for 8.6 it is
> Belated question: what's the rationale for replacing `AEK_CRYPTO` with 
> SM4+SHA3+SHA2(+AES)?  I'm not aware of the required crypto bits changing, but 
> maybe I missed something.  There's a related question around how we should 
> deal with crypto here in the first place (remove FK, remove the crypto 
> exts?), but that seems orthogonal to v8.6a+ vs. v8.5a- implying different 
> crypto extensions.
> 
> For context, this comes up in D134351 where specifying `V8_6A` would enable 
> SM4, which we don't support.
Belated (initial) answer: yes unfortunately our crypto story is a bit of a mess 
(mostly related to it mandatory yes or no). we have a catch-all ticket on our 
backlog to deal with crypto inconsistencies, which will hopefully be picked up 
soon.

I've added your point, and so again hopefully soon we can provide clarity and 
smooth things out.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76062

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


[PATCH] D131915: [MLIR][OpenMP] Added target data, exit data, and enter data operation definition for MLIR.

2023-01-20 Thread Akash Banerjee via Phabricator via cfe-commits
TIFitis marked 2 inline comments as done.
TIFitis added a comment.

I'm planning on merging the patch early next week. If you'd like to see any 
changes or need more time to review, please let me know :)

Akash


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131915

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


[PATCH] D142033: [OpenCL] Always add nounwind attribute for OpenCL

2023-01-20 Thread Sven van Haastregt via Phabricator via cfe-commits
svenvh added a comment.

In D142033#4062671 , @bader wrote:

> Should we generalize and rename `clang/test/CodeGenOpenCL/convergent.cl` to 
> validate function attributes other than `convergent`? It's not obvious that 
> presence of `nounwind` attribute is validated by 
> `clang/test/CodeGenOpenCL/convergent.cl`.

I think the main goal of `clang/test/CodeGenOpenCL/convergent.cl` remains 
testing `convergent`, so I'd rather not generalize this particular test.  
`nounwind` is somewhat coincidentally tested by various tests now, but we could 
add a separate test for generic attributes such as `nounwind` if you think it's 
worth doing so.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142033

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


[clang] 1495210 - [OpenCL] Always add nounwind attribute for OpenCL

2023-01-20 Thread Sven van Haastregt via cfe-commits

Author: Sven van Haastregt
Date: 2023-01-20T12:01:22Z
New Revision: 1495210914997bcd0ca6937be0ae3cd6809b5ef5

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

LOG: [OpenCL] Always add nounwind attribute for OpenCL

Neither OpenCL nor C++ for OpenCL support exceptions, so add the
`nounwind` attribute unconditionally for those languages.

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

Added: 


Modified: 
clang/lib/CodeGen/CGCall.cpp
clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl
clang/test/CodeGenOpenCL/convergent.cl

Removed: 




diff  --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 276d91fa2758d..dfa552161d7ca 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -1969,11 +1969,11 @@ void 
CodeGenModule::getDefaultFunctionAttributes(StringRef Name,
 FuncAttrs.addAttribute(llvm::Attribute::Convergent);
   }
 
-  // TODO: NoUnwind attribute should be added for other GPU modes OpenCL, HIP,
+  // TODO: NoUnwind attribute should be added for other GPU modes HIP,
   // SYCL, OpenMP offload. AFAIK, none of them support exceptions in device
   // code.
-  if (getLangOpts().CUDA && getLangOpts().CUDAIsDevice) {
-// Exceptions aren't supported in CUDA device code.
+  if ((getLangOpts().CUDA && getLangOpts().CUDAIsDevice) ||
+  getLangOpts().OpenCL) {
 FuncAttrs.addAttribute(llvm::Attribute::NoUnwind);
   }
 

diff  --git a/clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl 
b/clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl
index 210014d14c086..4277dbbc20530 100644
--- a/clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl
+++ b/clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl
@@ -298,7 +298,7 @@ kernel void test(global char *a, char b, global long *c, 
long d) {
 // CHECK: attributes #2 = { nocallback nofree nounwind willreturn 
memory(argmem: readwrite) }
 // CHECK: attributes #3 = { convergent noinline nounwind optnone 
"no-trapping-math"="true" "stack-protector-buffer-size"="8" 
"target-cpu"="gfx900" 
"target-features"="+16-bit-insts,+ci-insts,+dpp,+gfx8-insts,+gfx9-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64"
 }
 // CHECK: attributes #4 = { nounwind "enqueued-block" }
-// CHECK: attributes #5 = { convergent }
+// CHECK: attributes #5 = { convergent nounwind }
 //.
 // CHECK: !0 = !{i32 1, !"amdgpu_code_object_version", i32 400}
 // CHECK: !1 = !{i32 1, !"wchar_size", i32 4}

diff  --git a/clang/test/CodeGenOpenCL/convergent.cl 
b/clang/test/CodeGenOpenCL/convergent.cl
index f764cf0fc782d..123adba7b40d2 100644
--- a/clang/test/CodeGenOpenCL/convergent.cl
+++ b/clang/test/CodeGenOpenCL/convergent.cl
@@ -139,4 +139,5 @@ kernel void assume_convergent_asm()
 // CHECK: attributes #3 = { {{[^}]*}}convergent noduplicate{{[^}]*}} }
 // CHECK: attributes #4 = { {{[^}]*}}convergent{{[^}]*}} }
 // CHECK: attributes #5 = { {{[^}]*}}convergent{{[^}]*}} }
-// CHECK: attributes #6 = { {{[^}]*}}convergent noduplicate{{[^}]*}} }
+// CHECK: attributes #6 = { {{[^}]*}}nounwind{{[^}]*}} }
+// CHECK: attributes #7 = { {{[^}]*}}convergent noduplicate nounwind{{[^}]*}} }



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


[PATCH] D142033: [OpenCL] Always add nounwind attribute for OpenCL

2023-01-20 Thread Sven van Haastregt 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 rG149521091499: [OpenCL] Always add nounwind attribute for 
OpenCL (authored by svenvh).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142033

Files:
  clang/lib/CodeGen/CGCall.cpp
  clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl
  clang/test/CodeGenOpenCL/convergent.cl


Index: clang/test/CodeGenOpenCL/convergent.cl
===
--- clang/test/CodeGenOpenCL/convergent.cl
+++ clang/test/CodeGenOpenCL/convergent.cl
@@ -139,4 +139,5 @@
 // CHECK: attributes #3 = { {{[^}]*}}convergent noduplicate{{[^}]*}} }
 // CHECK: attributes #4 = { {{[^}]*}}convergent{{[^}]*}} }
 // CHECK: attributes #5 = { {{[^}]*}}convergent{{[^}]*}} }
-// CHECK: attributes #6 = { {{[^}]*}}convergent noduplicate{{[^}]*}} }
+// CHECK: attributes #6 = { {{[^}]*}}nounwind{{[^}]*}} }
+// CHECK: attributes #7 = { {{[^}]*}}convergent noduplicate nounwind{{[^}]*}} }
Index: clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl
===
--- clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl
+++ clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl
@@ -298,7 +298,7 @@
 // CHECK: attributes #2 = { nocallback nofree nounwind willreturn 
memory(argmem: readwrite) }
 // CHECK: attributes #3 = { convergent noinline nounwind optnone 
"no-trapping-math"="true" "stack-protector-buffer-size"="8" 
"target-cpu"="gfx900" 
"target-features"="+16-bit-insts,+ci-insts,+dpp,+gfx8-insts,+gfx9-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64"
 }
 // CHECK: attributes #4 = { nounwind "enqueued-block" }
-// CHECK: attributes #5 = { convergent }
+// CHECK: attributes #5 = { convergent nounwind }
 //.
 // CHECK: !0 = !{i32 1, !"amdgpu_code_object_version", i32 400}
 // CHECK: !1 = !{i32 1, !"wchar_size", i32 4}
Index: clang/lib/CodeGen/CGCall.cpp
===
--- clang/lib/CodeGen/CGCall.cpp
+++ clang/lib/CodeGen/CGCall.cpp
@@ -1969,11 +1969,11 @@
 FuncAttrs.addAttribute(llvm::Attribute::Convergent);
   }
 
-  // TODO: NoUnwind attribute should be added for other GPU modes OpenCL, HIP,
+  // TODO: NoUnwind attribute should be added for other GPU modes HIP,
   // SYCL, OpenMP offload. AFAIK, none of them support exceptions in device
   // code.
-  if (getLangOpts().CUDA && getLangOpts().CUDAIsDevice) {
-// Exceptions aren't supported in CUDA device code.
+  if ((getLangOpts().CUDA && getLangOpts().CUDAIsDevice) ||
+  getLangOpts().OpenCL) {
 FuncAttrs.addAttribute(llvm::Attribute::NoUnwind);
   }
 


Index: clang/test/CodeGenOpenCL/convergent.cl
===
--- clang/test/CodeGenOpenCL/convergent.cl
+++ clang/test/CodeGenOpenCL/convergent.cl
@@ -139,4 +139,5 @@
 // CHECK: attributes #3 = { {{[^}]*}}convergent noduplicate{{[^}]*}} }
 // CHECK: attributes #4 = { {{[^}]*}}convergent{{[^}]*}} }
 // CHECK: attributes #5 = { {{[^}]*}}convergent{{[^}]*}} }
-// CHECK: attributes #6 = { {{[^}]*}}convergent noduplicate{{[^}]*}} }
+// CHECK: attributes #6 = { {{[^}]*}}nounwind{{[^}]*}} }
+// CHECK: attributes #7 = { {{[^}]*}}convergent noduplicate nounwind{{[^}]*}} }
Index: clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl
===
--- clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl
+++ clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl
@@ -298,7 +298,7 @@
 // CHECK: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
 // CHECK: attributes #3 = { convergent noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="gfx900" "target-features"="+16-bit-insts,+ci-insts,+dpp,+gfx8-insts,+gfx9-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64" }
 // CHECK: attributes #4 = { nounwind "enqueued-block" }
-// CHECK: attributes #5 = { convergent }
+// CHECK: attributes #5 = { convergent nounwind }
 //.
 // CHECK: !0 = !{i32 1, !"amdgpu_code_object_version", i32 400}
 // CHECK: !1 = !{i32 1, !"wchar_size", i32 4}
Index: clang/lib/CodeGen/CGCall.cpp
===
--- clang/lib/CodeGen/CGCall.cpp
+++ clang/lib/CodeGen/CGCall.cpp
@@ -1969,11 +1969,11 @@
 FuncAttrs.addAttribute(llvm::Attribute::Convergent);
   }
 
-  // TODO: NoUnwind attribute should be added for other GPU modes OpenCL, HIP,
+  // TODO: NoUnwind attribute should be added for other GPU modes HIP,
   // SYCL, OpenMP offload. AFAIK, none of them support exceptions in device
   // code.
-  if (getLangOpts().CUDA && getLangOpts().CUDAIsDevice) {
-// Exceptions aren't supported in CUDA device code.
+  if ((getLangOpts().CUDA && getLangOpts().CUDAIsDevice) ||
+  getLangOp

[PATCH] D142199: [Docs] Replace recommonmark with myst-parser

2023-01-20 Thread Luke Lau via Phabricator via cfe-commits
luke created this revision.
luke added reviewers: kuhnel, Shivamgupta1234, mehdi_amini.
Herald added subscribers: kosarev, pmatos, kerbowa, arphaman, jvesely.
Herald added a reviewer: sscalpone.
Herald added projects: Flang, All.
luke requested review of this revision.
Herald added subscribers: llvm-commits, cfe-commits, jdoerfert.
Herald added a reviewer: nicolasvasilache.
Herald added projects: clang, LLVM.

Now that recommonmark is deprecated 
https://github.com/readthedocs/recommonmark/issues/221,
myst-parser seems to be the generally accepted drop in replacement.
This swaps recommonmark out of the sphinx config and upgrades any
markdown document that needs adjustment due to myst-parser's stricter
parsing.
In particular, these things needed addressed as myst-parser complained
about them:

- Broken references were replaced
- Invalid lexers in code blocks were replaced or removed (It didn't look like 
they were being syntax highlighted anyway)
- Non-contiguous headers (# -> ###) were made contiguous  (# -> ##)

Closes #55787


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142199

Files:
  .github/workflows/release-tasks.yml
  clang/docs/conf.py
  flang/docs/ComplexOperations.md
  flang/docs/DiagnosticsReference.md
  flang/docs/FIRArrayOperations.md
  flang/docs/FlangDriver.md
  flang/docs/HighLevelFIR.md
  flang/docs/OptionComparison.md
  flang/docs/ParameterizedDerivedTypes.md
  flang/docs/PullRequestChecklist.md
  flang/docs/conf.py
  flang/docs/index.md
  flang/include/flang/Optimizer/Dialect/FIROps.td
  
llvm/docs/AMDGPUDwarfExtensionAllowLocationDescriptionOnTheDwarfExpressionStack/AMDGPUDwarfExtensionAllowLocationDescriptionOnTheDwarfExpressionStack.md
  llvm/docs/DeveloperPolicy.rst
  llvm/docs/GitRepositoryPolicy.md
  llvm/docs/MarkdownQuickstartTemplate.md
  llvm/docs/PointerAuth.md
  llvm/docs/SpeculativeLoadHardening.md
  llvm/docs/SphinxQuickstartTemplate.rst
  llvm/docs/conf.py
  llvm/utils/release/build-docs.sh

Index: llvm/utils/release/build-docs.sh
===
--- llvm/utils/release/build-docs.sh
+++ llvm/utils/release/build-docs.sh
@@ -15,7 +15,7 @@
 # ninja-build gcc-c++
 #   * pip install sphinx-markdown-tables
 # * Ubuntu:
-#   * apt-get install doxygen sphinx-common python3-recommonmark \
+#   * apt-get install doxygen sphinx-common python3-myst-parser \
 # ninja-build graphviz texlive-font-utils
 #   * pip install sphinx-markdown-tables
 #======#
Index: llvm/docs/conf.py
===
--- llvm/docs/conf.py
+++ llvm/docs/conf.py
@@ -37,7 +37,7 @@
 }
 
 try:
-  import recommonmark
+  import myst_parser
 except ImportError:
   # manpages do not use any .md sources
   if not tags.has('builder-man'):
@@ -46,10 +46,11 @@
   import sphinx
   if sphinx.version_info >= (3, 0):
 # This requires 0.5 or later.
-extensions.append('recommonmark')
+extensions.append('myst_parser')
   else:
-source_parsers = {'.md': 'recommonmark.parser.CommonMarkParser'}
+source_parsers = {'.md': 'myst_parser.parsers.sphinx_.MystParser'}
   source_suffix['.md'] = 'markdown'
+  myst_heading_anchors = 7
 
 # The encoding of source files.
 #source_encoding = 'utf-8-sig'
Index: llvm/docs/SphinxQuickstartTemplate.rst
===
--- llvm/docs/SphinxQuickstartTemplate.rst
+++ llvm/docs/SphinxQuickstartTemplate.rst
@@ -164,7 +164,8 @@
  .++:..
   ...
 
-
+.. _generating the documentation:
+			 
 Generating the documentation
 
 
@@ -172,19 +173,19 @@
 see what they would look like. In addition to the normal
 `build tools `_
 you need to install `Sphinx`_ and the
-`recommonmark `_ extension.
+`myst-parser `_ extension.
 
 On Debian you can install these with:
 
 .. code-block:: console
 
-   sudo apt install -y sphinx-doc python-recommonmark-doc
+   sudo apt install -y sphinx-doc python3-myst-parser
 
-On Ubuntu use pip to get an up-to-date version of recommonmark:
+On Ubuntu use pip to get an up-to-date version of myst-parser:
 
 .. code-block:: console
 
-   sudo pip install sphinx recommonmark
+   sudo pip install sphinx myst-parser
 
 Then run cmake to build the documentation inside the ``llvm-project`` checkout:
 
Index: llvm/docs/SpeculativeLoadHardening.md
===
--- llvm/docs/SpeculativeLoadHardening.md
+++ llvm/docs/SpeculativeLoadHardening.md
@@ -1,6 +1,6 @@
 # Speculative Load Hardening
 
-### A Spectre Variant #1 Mitigation Technique
+## A Spectre Variant #1 Mitigation Technique
 
 Author: Chandler Carruth - [chandl...@google.com](mailto:chandl...@google.com)
 
Index: llvm/docs/Point

[PATCH] D142199: [Docs] Replace recommonmark with myst-parser

2023-01-20 Thread Luke Lau via Phabricator via cfe-commits
luke added inline comments.



Comment at: flang/docs/DiagnosticsReference.md:1
+% This file intentionally left blank. Silences a warning about a missing 
reference from the automatically generated FlangCommandLineReference.rst

This is pretty hairy and it will link users to a blank document. Open to any 
other ideas to workaround this


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142199

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


[PATCH] D141871: [Clang][OpenMP] Add parse and sema for iterator map modifier

2023-01-20 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev accepted this revision.
ABataev added a comment.
This revision is now accepted and ready to land.

LG


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

https://reviews.llvm.org/D141871

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


[PATCH] D78028: move shebangs from python2 to python3

2023-01-20 Thread Simon Pilgrim via Phabricator via cfe-commits
RKSimon added a comment.

@LocutusOfBorg - a grep of llvm-project *.py files is not finding many matches 
for python2 - I'm assuming this was handled (e.g. update_cc_test_checks.py was 
updated in D129590 ).

There might still be a few missed cases (or references to python2 in comments)?


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

https://reviews.llvm.org/D78028

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


[PATCH] D141886: [Clang][test] Avoid FileCheck error when matching `-cc1`

2023-01-20 Thread Bryan Chan via Phabricator via cfe-commits
bryanpkc accepted this revision.
bryanpkc added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141886

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


[PATCH] D139705: [clang] fix zero-initialization fix-it for variable template

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

In D139705#4067774 , @lattner wrote:

> Got it this time, sorry for the confusion!

Thank you for the help, Chris!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139705

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


[PATCH] D131915: [MLIR][OpenMP] Added target data, exit data, and enter data operation definition for MLIR.

2023-01-20 Thread Valentin Clement via Phabricator via cfe-commits
clementval added a comment.

Just small nit




Comment at: mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp:628-629
+int64_t mapTypeBits = 0x00;
+auto mapOp = map_operands[i];
+auto mapTypeOp = map_types[i];
+

auto should be spelled out here. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131915

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


[PATCH] D142196: [clang][Lex] Add back PPCallbacks::FileNotFound

2023-01-20 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld added a comment.

I just checked and this "simplified" version of the callback would give us 
enough information to implement all we need in ROOT (plus some, the `bool` 
return value is nicer than temporarily playing with 
`SuppressIncludeNotFoundError`). For an upstream test, I could implement a unit 
test in `clang/unittests/Lex/PPCallbacksTest.cpp` or a "toy" tooling where 
`#include ` is ignored if `file.h` doesn't exist? What do you think 
(assuming the general idea of adding this callback is fine)?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142196

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


[PATCH] D141324: [clang] extend external_source_symbol attribute with the USR clause

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



Comment at: clang/utils/TableGen/ClangAttrEmitter.cpp:3318
+for (const auto &Spelling : Attr->getValueAsListOfDefs("Spellings")) {
+  if (Spelling->getValueAsString("Variety") == Variety ||
+  Spelling->getValueAsString("Variety") == "Clang") {

erichkeane wrote:
> arphaman wrote:
> > erichkeane wrote:
> > > Why is this =="Clang" specific?  Since you've added the Version to the 
> > > spelling, I'd anticipate us to just be able to grab it for the current 
> > > spelling.  I wouldn't want an individual spelling here to override it, 
> > > particularly since with this change Clang could potentially override the 
> > > standards version.
> > I needed it since there's no specific "Clang" variety that's being called 
> > for this function. Otherwise the "GNU" variety passed to the function 
> > doesn't match "Clang" variety in the record. What's the best way to compute 
> > the current spelling in this case?
> Hmm... that is strange.  I would have expected this to be called for each of 
> the individual spellings, it doesn't really make sense that it wouldn't pick 
> it up from the base 'Spellings'.  I've unfortunately not debugged this code 
> generation in a while.  BUT, we care about the 'version' on a per-spelling 
> basis, so it would presumably need to 'pick' an actual spelling.
This does get called for each of the base spellings: 
https://github.com/llvm/llvm-project/blob/main/clang/utils/TableGen/ClangAttrEmitter.cpp#L3393

I think the issue is that, in Attr.td, the `GNU` spelling has no version 
information associated with it. I think what should happen is that spelling 
should get a `Version` field the same as `CXX11` and `C2X` do, and the `Clang` 
spelling can pass that information along to the `GNU` spelling so that it gets 
picked up here during tablegen.

One thing we should probably be careful of is compatibility with GCC. I *think* 
GCC just returns 0 or 1 from `__has_attribute` but we should find out if they 
return specific values for any of the attributes we already support (a 
follow-up patch can correct those values so we match GCC if necessary).


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

https://reviews.llvm.org/D141324

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


[PATCH] D142187: [clang] Fix typos in member initializers

2023-01-20 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment.

In D142187#4068092 , @ilya-biryukov 
wrote:

> Randomly chiming in here.
> I never had a good model of where `CorrectDelayedTyposInExpr`, but wanted to 
> note that `ActOnFullExpr` also calls it. This may be fine, I just wanted to 
> mention it as it stood out.

+1, we seem to call `CorrectDelayedTyposInExpr` in an ad-hoc way.

The fix looks good to me, but I will leave the final stamp to @aaron.ballman, 
@cor3ntin.




Comment at: clang/test/PCH/typo3.cpp:6
+  // in PCH.
+  int y = bar;
+  // CHECK: use of undeclared identifier 'bar'

IIUC, the issue is that, we have a dangling `TypoExpr` under the `FieldDecl` in 
the final AST, which violates the contract of `TypoExpr`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142187

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


[PATCH] D142187: [clang] Fix typos in member initializers

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



Comment at: clang/lib/Sema/SemaDeclCXX.cpp:4103
+  
/*RecoverUncorrectedTypos=*/true);
+  if (!FD->getType()->isDependentType() && !Init.get()->isTypeDependent()) {
+Init = ConvertMemberDefaultInitExpression(FD, Init.get(), InitLoc);

Should we be checking for `Init.isUsable()` before calling `.get()`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142187

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


[PATCH] D142199: [Docs] Replace recommonmark with myst-parser

2023-01-20 Thread Tom Stellard via Phabricator via cfe-commits
tstellar added inline comments.
Herald added a subscriber: asb.



Comment at: flang/docs/ComplexOperations.md:37
 **FIR**
-```c
 func.func @_QPpow_self(%arg0: !fir.ref>) -> !fir.complex<4> {

Do these changes have any affected on the output html?  Is there another way to 
specify the language?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142199

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


[PATCH] D142187: [clang] Fix typos in member initializers

2023-01-20 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet marked 3 inline comments as done.
kadircet added inline comments.



Comment at: clang/lib/Sema/SemaDeclCXX.cpp:4101
 
-  ExprResult Init = InitExpr;
-  if (!FD->getType()->isDependentType() && !InitExpr->isTypeDependent()) {
-Init = ConvertMemberDefaultInitExpression(FD, InitExpr, InitLoc);
+  ExprResult Init = CorrectDelayedTyposInExpr(InitExpr, /*InitDecl=*/nullptr,
+  
/*RecoverUncorrectedTypos=*/true);

ilya-biryukov wrote:
> Should we pass `FD` here to avoid correcting to itself?
unfortunately the interface requires a VarDecl, hence we can't pass a FieldDecl.



Comment at: clang/lib/Sema/SemaDeclCXX.cpp:4103
+  
/*RecoverUncorrectedTypos=*/true);
+  if (!FD->getType()->isDependentType() && !Init.get()->isTypeDependent()) {
+Init = ConvertMemberDefaultInitExpression(FD, Init.get(), InitLoc);

aaron.ballman wrote:
> Should we be checking for `Init.isUsable()` before calling `.get()`?
because InitExpr is never null here (we bail out early), and because we're 
converting any leftover TypoExprs to RecoveryExpr `Init` should always be 
`Usable` here. adding an assert.



Comment at: clang/test/PCH/typo3.cpp:6
+  // in PCH.
+  int y = bar;
+  // CHECK: use of undeclared identifier 'bar'

hokein wrote:
> IIUC, the issue is that, we have a dangling `TypoExpr` under the `FieldDecl` 
> in the final AST, which violates the contract of `TypoExpr`.
yes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142187

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


[PATCH] D142187: [clang] Fix typos in member initializers

2023-01-20 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 490793.
kadircet marked 3 inline comments as done.
kadircet added a comment.

assert on usability of initializer


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142187

Files:
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/PCH/typo3.cpp


Index: clang/test/PCH/typo3.cpp
===
--- /dev/null
+++ clang/test/PCH/typo3.cpp
@@ -0,0 +1,8 @@
+// RUN: not %clang_cc1 -emit-pch %s -o %t.pch 2>&1 | FileCheck %s
+
+struct S {
+  // Make sure TypoExprs in default init exprs are corrected before serializing
+  // in PCH.
+  int y = bar;
+  // CHECK: use of undeclared identifier 'bar'
+};
Index: clang/lib/Sema/SemaDeclCXX.cpp
===
--- clang/lib/Sema/SemaDeclCXX.cpp
+++ clang/lib/Sema/SemaDeclCXX.cpp
@@ -4098,9 +4098,11 @@
 return;
   }
 
-  ExprResult Init = InitExpr;
-  if (!FD->getType()->isDependentType() && !InitExpr->isTypeDependent()) {
-Init = ConvertMemberDefaultInitExpression(FD, InitExpr, InitLoc);
+  ExprResult Init = CorrectDelayedTyposInExpr(InitExpr, /*InitDecl=*/nullptr,
+  
/*RecoverUncorrectedTypos=*/true);
+  assert(Init.isUsable() && "Init should at least have a RecoveryExpr");
+  if (!FD->getType()->isDependentType() && !Init.get()->isTypeDependent()) {
+Init = ConvertMemberDefaultInitExpression(FD, Init.get(), InitLoc);
 // C++11 [class.base.init]p7:
 //   The initialization of each base and member constitutes a
 //   full-expression.
@@ -4112,9 +4114,7 @@
 }
   }
 
-  InitExpr = Init.get();
-
-  FD->setInClassInitializer(InitExpr);
+  FD->setInClassInitializer(Init.get());
 }
 
 /// Find the direct and/or virtual base specifiers that


Index: clang/test/PCH/typo3.cpp
===
--- /dev/null
+++ clang/test/PCH/typo3.cpp
@@ -0,0 +1,8 @@
+// RUN: not %clang_cc1 -emit-pch %s -o %t.pch 2>&1 | FileCheck %s
+
+struct S {
+  // Make sure TypoExprs in default init exprs are corrected before serializing
+  // in PCH.
+  int y = bar;
+  // CHECK: use of undeclared identifier 'bar'
+};
Index: clang/lib/Sema/SemaDeclCXX.cpp
===
--- clang/lib/Sema/SemaDeclCXX.cpp
+++ clang/lib/Sema/SemaDeclCXX.cpp
@@ -4098,9 +4098,11 @@
 return;
   }
 
-  ExprResult Init = InitExpr;
-  if (!FD->getType()->isDependentType() && !InitExpr->isTypeDependent()) {
-Init = ConvertMemberDefaultInitExpression(FD, InitExpr, InitLoc);
+  ExprResult Init = CorrectDelayedTyposInExpr(InitExpr, /*InitDecl=*/nullptr,
+  /*RecoverUncorrectedTypos=*/true);
+  assert(Init.isUsable() && "Init should at least have a RecoveryExpr");
+  if (!FD->getType()->isDependentType() && !Init.get()->isTypeDependent()) {
+Init = ConvertMemberDefaultInitExpression(FD, Init.get(), InitLoc);
 // C++11 [class.base.init]p7:
 //   The initialization of each base and member constitutes a
 //   full-expression.
@@ -4112,9 +4114,7 @@
 }
   }
 
-  InitExpr = Init.get();
-
-  FD->setInClassInitializer(InitExpr);
+  FD->setInClassInitializer(Init.get());
 }
 
 /// Find the direct and/or virtual base specifiers that
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D142092: [include-mapping] Allow multiple headers for the same symbol. Choose the first header of available ones.

2023-01-20 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment.

since we modify the python script, could you please update its artifacts 
(`StdSymbolMap.inc`, `CSymbolMap`) as well?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142092

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


[PATCH] D142187: [clang] Fix typos in member initializers

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

LGTM!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142187

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


[PATCH] D142199: [Docs] Replace recommonmark with myst-parser

2023-01-20 Thread Luke Lau via Phabricator via cfe-commits
luke added inline comments.



Comment at: flang/docs/ComplexOperations.md:37
 **FIR**
-```c
 func.func @_QPpow_self(%arg0: !fir.ref>) -> !fir.complex<4> {

tstellar wrote:
> Do these changes have any affected on the output html?  Is there another way 
> to specify the language?
I’m not sure, I think I might be able to add this back in though since I 
suppressed a warning about highlight errors.
I had to remove the ones that specified MLIR as the lexer though since there 
didn’t seem to be an option to suppress those warnings. They didn’t seem to 
receive any syntax highlighting in the output html anyway


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142199

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


[PATCH] D142001: [clang] Use FP options from AST for emitting code for casts

2023-01-20 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff added a comment.

Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142001

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


[clang] 58751f9 - [clang-format] SortUsingDeclarations support lexicographic order

2023-01-20 Thread via cfe-commits

Author: Backl1ght
Date: 2023-01-20T21:34:57+08:00
New Revision: 58751f943f2f6dd78dd3363fc70ea1728044ee0b

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

LOG: [clang-format] SortUsingDeclarations support lexicographic order

fix https://github.com/llvm/llvm-project/issues/59930

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

Added: 


Modified: 
clang/docs/ClangFormatStyleOptions.rst
clang/include/clang/Format/Format.h
clang/lib/Format/Format.cpp
clang/lib/Format/UsingDeclarationsSorter.cpp
clang/unittests/Format/ConfigParseTest.cpp
clang/unittests/Format/UsingDeclarationsSorterTest.cpp

Removed: 




diff  --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index 5acaf752826bf..da5af2645f18e 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -4505,22 +4505,54 @@ the configuration (without a prefix: ``Auto``).
 
 .. _SortUsingDeclarations:
 
-**SortUsingDeclarations** (``Boolean``) :versionbadge:`clang-format 5` :ref:`¶ 
`
-  If ``true``, clang-format will sort using declarations.
+**SortUsingDeclarations** (``SortUsingDeclarationsOptions``) 
:versionbadge:`clang-format 5` :ref:`¶ `
+  Controls if and how clang-format will sort using declarations.
 
-  The order of using declarations is defined as follows:
-  Split the strings by "::" and discard any initial empty strings. The last
-  element of each list is a non-namespace name; all others are namespace
-  names. Sort the lists of names lexicographically, where the sort order of
-  individual names is that all non-namespace names come before all namespace
-  names, and within those groups, names are in case-insensitive
-  lexicographic order.
+  Possible values:
+
+  * ``SUD_Never`` (in configuration: ``Never``)
+Using declarations are never sorted.
+
+.. code-block:: c++
+
+   using std::chrono::duration_cast;
+   using std::move;
+   using boost::regex;
+   using boost::regex_constants::icase;
+   using std::string;
+
+  * ``SUD_Lexicographic`` (in configuration: ``Lexicographic``)
+Using declarations are sorted in the order defined as follows:
+Split the strings by "::" and discard any initial empty strings. Sort
+the lists of names lexicographically, and within those groups, names are
+in case-insensitive lexicographic order.
+
+.. code-block:: c++
+
+   using boost::regex;
+   using boost::regex_constants::icase;
+   using std::chrono::duration_cast;
+   using std::move;
+   using std::string;
+
+  * ``SUD_LexicographicNumeric`` (in configuration: ``LexicographicNumeric``)
+Using declarations are sorted in the order defined as follows:
+Split the strings by "::" and discard any initial empty strings. The
+last element of each list is a non-namespace name; all others are
+namespace names. Sort the lists of names lexicographically, where the
+sort order of individual names is that all non-namespace names come
+before all namespace names, and within those groups, names are in
+case-insensitive lexicographic order.
+
+.. code-block:: c++
+
+   using boost::regex;
+   using boost::regex_constants::icase;
+   using std::move;
+   using std::string;
+   using std::chrono::duration_cast;
 
-  .. code-block:: c++
 
- false: true:
- using std::cout;   vs. using std::cin;
- using std::cin;using std::cout;
 
 .. _SpaceAfterCStyleCast:
 

diff  --git a/clang/include/clang/Format/Format.h 
b/clang/include/clang/Format/Format.h
index 02d48de59f596..72efd3be1cc72 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -3510,22 +3510,49 @@ struct FormatStyle {
   /// \version 12
   SortJavaStaticImportOptions SortJavaStaticImport;
 
-  /// If ``true``, clang-format will sort using declarations.
-  ///
-  /// The order of using declarations is defined as follows:
-  /// Split the strings by "::" and discard any initial empty strings. The last
-  /// element of each list is a non-namespace name; all others are namespace
-  /// names. Sort the lists of names lexicographically, where the sort order of
-  /// individual names is that all non-namespace names come before all 
namespace
-  /// names, and within those groups, names are in case-insensitive
-  /// lexicographic order.
-  /// \code
-  ///false: true:
-  ///using std::cout;   vs. using std::cin;
-  ///using std::cin;using std::cout;
-  /// \endcode
+  /// Using declaration sorting options.
+  enum SortUsingDeclarationsOptions : int8_t {
+/// Usin

[PATCH] D141694: [clang-format] SortUsingDeclarations support lexicographic order

2023-01-20 Thread Zhikai Zeng 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 rG58751f943f2f: [clang-format] SortUsingDeclarations support 
lexicographic order (authored by Backl1ght).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141694

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/include/clang/Format/Format.h
  clang/lib/Format/Format.cpp
  clang/lib/Format/UsingDeclarationsSorter.cpp
  clang/unittests/Format/ConfigParseTest.cpp
  clang/unittests/Format/UsingDeclarationsSorterTest.cpp

Index: clang/unittests/Format/UsingDeclarationsSorterTest.cpp
===
--- clang/unittests/Format/UsingDeclarationsSorterTest.cpp
+++ clang/unittests/Format/UsingDeclarationsSorterTest.cpp
@@ -41,88 +41,162 @@
 };
 
 TEST_F(UsingDeclarationsSorterTest, SwapsTwoConsecutiveUsingDeclarations) {
+  FormatStyle Style = getLLVMStyle();
+  EXPECT_EQ(FormatStyle::SUD_LexicographicNumeric, Style.SortUsingDeclarations);
   EXPECT_EQ("using a;\n"
 "using b;",
 sortUsingDeclarations("using a;\n"
-  "using b;"));
+  "using b;",
+  Style));
   EXPECT_EQ("using a;\n"
 "using aa;",
 sortUsingDeclarations("using aa;\n"
-  "using a;"));
+  "using a;",
+  Style));
   EXPECT_EQ("using a;\n"
 "using ::a;",
 sortUsingDeclarations("using a;\n"
-  "using ::a;"));
+  "using ::a;",
+  Style));
 
   EXPECT_EQ("using a::bcd;\n"
 "using a::cd;",
 sortUsingDeclarations("using a::cd;\n"
-  "using a::bcd;"));
+  "using a::bcd;",
+  Style));
 
   EXPECT_EQ("using a;\n"
 "using a::a;",
 sortUsingDeclarations("using a::a;\n"
-  "using a;"));
+  "using a;",
+  Style));
 
   EXPECT_EQ("using a::ba::aa;\n"
 "using a::bb::ccc;",
 sortUsingDeclarations("using a::bb::ccc;\n"
-  "using a::ba::aa;"));
+  "using a::ba::aa;",
+  Style));
 
   EXPECT_EQ("using a;\n"
 "using typename a;",
 sortUsingDeclarations("using typename a;\n"
-  "using a;"));
+  "using a;",
+  Style));
 
   EXPECT_EQ("using typename z;\n"
 "using typenamea;",
 sortUsingDeclarations("using typenamea;\n"
-  "using typename z;"));
+  "using typename z;",
+  Style));
 
   EXPECT_EQ("using a, b;\n"
 "using aa;",
 sortUsingDeclarations("using aa;\n"
-  "using a, b;"));
+  "using a, b;",
+  Style));
+
+  Style.SortUsingDeclarations = FormatStyle::SUD_Lexicographic;
+  EXPECT_EQ("using a;\n"
+"using b;",
+sortUsingDeclarations("using a;\n"
+  "using b;",
+  Style));
+  EXPECT_EQ("using a;\n"
+"using aa;",
+sortUsingDeclarations("using aa;\n"
+  "using a;",
+  Style));
+  EXPECT_EQ("using a;\n"
+"using ::a;",
+sortUsingDeclarations("using a;\n"
+  "using ::a;",
+  Style));
+
+  EXPECT_EQ("using a::bcd;\n"
+"using a::cd;",
+sortUsingDeclarations("using a::cd;\n"
+  "using a::bcd;",
+  Style));
+
+  EXPECT_EQ("using a;\n"
+"using a::a;",
+sortUsingDeclarations("using a::a;\n"
+  "using a;",
+  Style));
+
+  EXPECT_EQ("using a::ba::aa;\n"
+"using a::bb::ccc;",
+sortUsingDeclarations("using a::bb::ccc;\n"
+  "using a::ba::aa;",
+  Style));
+
+  EXPECT_EQ("using a;\n"
+"using typename a;",
+sortUsingDeclarations("using typename a;\n"
+  "using a;",
+  Style));
+
+  EXPECT_EQ("using typename z;\n"
+"using typenam

[clang] 65cf77d - [clang] Use FP options from AST for emitting code for casts

2023-01-20 Thread Serge Pavlov via cfe-commits

Author: Serge Pavlov
Date: 2023-01-20T20:47:43+07:00
New Revision: 65cf77d218cf8b6aee2dbe252f55120311c8

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

LOG: [clang] Use FP options from AST for emitting code for casts

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

Added: 


Modified: 
clang/lib/CodeGen/CGExprScalar.cpp
clang/test/CodeGen/X86/avx512dq-builtins-constrained.c
clang/test/CodeGen/aarch64-v8.2a-neon-intrinsics-constrained.c

Removed: 




diff  --git a/clang/lib/CodeGen/CGExprScalar.cpp 
b/clang/lib/CodeGen/CGExprScalar.cpp
index 6b265afa5a057..a0dcb978b1ac1 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/lib/CodeGen/CGExprScalar.cpp
@@ -2021,6 +2021,7 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
   Expr *E = CE->getSubExpr();
   QualType DestTy = CE->getType();
   CastKind Kind = CE->getCastKind();
+  CodeGenFunction::CGFPOptionsRAII FPOptions(CGF, CE);
 
   // These cases are generally not written to ignore the result of
   // evaluating their sub-expressions, so we clear this now.

diff  --git a/clang/test/CodeGen/X86/avx512dq-builtins-constrained.c 
b/clang/test/CodeGen/X86/avx512dq-builtins-constrained.c
index 907e190fe370a..fc7c3361c9b76 100644
--- a/clang/test/CodeGen/X86/avx512dq-builtins-constrained.c
+++ b/clang/test/CodeGen/X86/avx512dq-builtins-constrained.c
@@ -1,10 +1,11 @@
 // REQUIRES: x86-registered-target
 // RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s 
-triple=x86_64-apple-darwin -target-feature +avx512dq -emit-llvm -o - -Wall 
-Werror | FileCheck %s --check-prefix=UNCONSTRAINED --check-prefix=COMMON 
--check-prefix=COMMONIR
-// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s 
-triple=x86_64-apple-darwin -target-feature +avx512dq 
-ffp-exception-behavior=maytrap -DSTRICT=1 -emit-llvm -o - -Wall -Werror | 
FileCheck %s --check-prefix=CONSTRAINED --check-prefix=COMMON 
--check-prefix=COMMONIR
+// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s 
-triple=x86_64-apple-darwin -target-feature +avx512dq 
-ffp-exception-behavior=maytrap -DSTRICT=1 -emit-llvm -o - -Wall -Werror | 
FileCheck %s --check-prefix=CONSTRAINED --check-prefix=COMMON 
--check-prefix=COMMONIR --implicit-check-not=fpexcept.maytrap
 // RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s 
-triple=x86_64-apple-darwin -target-feature +avx512dq -S -o - -Wall -Werror | 
FileCheck %s --check-prefix=CHECK-ASM --check-prefix=COMMON
-// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s 
-triple=x86_64-apple-darwin -target-feature +avx512dq 
-ffp-exception-behavior=maytrap -DSTRICT=1 -S -o - -Wall -Werror | FileCheck %s 
--check-prefix=CHECK-ASM --check-prefix=COMMON
+// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s 
-triple=x86_64-apple-darwin -target-feature +avx512dq 
-ffp-exception-behavior=maytrap -DSTRICT=1 -S -o - -Wall -Werror | FileCheck %s 
--check-prefix=CHECK-ASM --check-prefix=COMMON 
--implicit-check-not=fpexcept.maytrap
+
+// Any cases of "fpexcept.maytrap" in this test are clang bugs.
 
-// FIXME: Every instance of "fpexcept.maytrap" is wrong.
 #ifdef STRICT
 // Test that the constrained intrinsics are picking up the exception
 // metadata from the AST instead of the global default from the command line.
@@ -18,7 +19,7 @@
 __m512d test_mm512_cvtepi64_pd(__m512i __A) {
   // COMMON-LABEL: test_mm512_cvtepi64_pd
   // UNCONSTRAINED: sitofp <8 x i64> %{{.*}} to <8 x double>
-  // CONSTRAINED: call <8 x double> 
@llvm.experimental.constrained.sitofp.v8f64.v8i64(<8 x i64> %{{.*}}, metadata 
!"round.tonearest", metadata !"fpexcept.maytrap")
+  // CONSTRAINED: call <8 x double> 
@llvm.experimental.constrained.sitofp.v8f64.v8i64(<8 x i64> %{{.*}}, metadata 
!"round.tonearest", metadata !"fpexcept.strict")
   // CHECK-ASM: vcvtqq2pd
   return _mm512_cvtepi64_pd(__A);
 }
@@ -26,7 +27,7 @@ __m512d test_mm512_cvtepi64_pd(__m512i __A) {
 __m512d test_mm512_mask_cvtepi64_pd(__m512d __W, __mmask8 __U, __m512i __A) {
   // COMMON-LABEL: test_mm512_mask_cvtepi64_pd
   // UNCONSTRAINED: sitofp <8 x i64> %{{.*}} to <8 x double>
-  // CONSTRAINED: call <8 x double> 
@llvm.experimental.constrained.sitofp.v8f64.v8i64(<8 x i64> %{{.*}}, metadata 
!"round.tonearest", metadata !"fpexcept.maytrap")
+  // CONSTRAINED: call <8 x double> 
@llvm.experimental.constrained.sitofp.v8f64.v8i64(<8 x i64> %{{.*}}, metadata 
!"round.tonearest", metadata !"fpexcept.strict")
   // COMMONIR: select <8 x i1> %{{.*}}, <8 x double> %{{.*}}, <8 x double> 
%{{.*}}
   // CHECK-ASM: vcvtqq2pd
   return _mm512_mask_cvtepi64_pd(__W, __U, __A);
@@ -35,7 +36,7 @@ __m512d test_mm512_mask_cvtepi64_pd(__m512d __W, __mmask8 
__U, __m512i __A) {
 __m512d test_mm512_maskz_cvtepi64_pd(__mmask8 _

[PATCH] D142001: [clang] Use FP options from AST for emitting code for casts

2023-01-20 Thread Serge Pavlov 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 rG65cf77d218cf: [clang] Use FP options from AST for emitting 
code for casts (authored by sepavloff).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142001

Files:
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/test/CodeGen/X86/avx512dq-builtins-constrained.c
  clang/test/CodeGen/aarch64-v8.2a-neon-intrinsics-constrained.c

Index: clang/test/CodeGen/aarch64-v8.2a-neon-intrinsics-constrained.c
===
--- clang/test/CodeGen/aarch64-v8.2a-neon-intrinsics-constrained.c
+++ clang/test/CodeGen/aarch64-v8.2a-neon-intrinsics-constrained.c
@@ -6,7 +6,7 @@
 // RUN: -ffp-exception-behavior=maytrap -DEXCEPT=1 \
 // RUN: -flax-vector-conversions=none -S -disable-O0-optnone -emit-llvm -o - %s \
 // RUN: | opt -S -passes=mem2reg \
-// RUN: | FileCheck --check-prefix=COMMON --check-prefix=COMMONIR --check-prefix=CONSTRAINED %s
+// RUN: | FileCheck --check-prefix=COMMON --check-prefix=COMMONIR --check-prefix=CONSTRAINED --implicit-check-not=fpexcept.maytrap %s
 // RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon -target-feature +fullfp16 -target-feature +v8.2a\
 // RUN: -flax-vector-conversions=none -S -disable-O0-optnone -emit-llvm -o - %s \
 // RUN: | opt -S -passes=mem2reg | llc -o=- - \
@@ -15,13 +15,13 @@
 // RUN: -ffp-exception-behavior=maytrap -DEXCEPT=1 \
 // RUN: -flax-vector-conversions=none -S -disable-O0-optnone -emit-llvm -o - %s \
 // RUN: | opt -S -passes=mem2reg | llc -o=- - \
-// RUN: | FileCheck --check-prefix=COMMON --check-prefix=CHECK-ASM %s
+// RUN: | FileCheck --check-prefix=COMMON --check-prefix=CHECK-ASM --implicit-check-not=fpexcept.maytrap  %s
 
 // REQUIRES: aarch64-registered-target
 
 // Test that the constrained intrinsics are picking up the exception
 // metadata from the AST instead of the global default from the command line.
-// FIXME: All cases of "fpexcept.maytrap" in this test are wrong.
+// Any cases of "fpexcept.maytrap" in this test are clang bugs.
 
 #if EXCEPT
 #pragma float_control(except, on)
@@ -31,7 +31,7 @@
 
 // COMMON-LABEL: test_vsqrt_f16
 // UNCONSTRAINED:  [[SQR:%.*]] = call <4 x half> @llvm.sqrt.v4f16(<4 x half> %a)
-// CONSTRAINED:[[SQR:%.*]] = call <4 x half> @llvm.experimental.constrained.sqrt.v4f16(<4 x half> %a, metadata !"round.tonearest", metadata !"fpexcept.maytrap")
+// CONSTRAINED:[[SQR:%.*]] = call <4 x half> @llvm.experimental.constrained.sqrt.v4f16(<4 x half> %a, metadata !"round.tonearest", metadata !"fpexcept.strict")
 // CHECK-ASM:  fsqrt v{{[0-9]+}}.4h, v{{[0-9]+}}.4h
 // COMMONIR:   ret <4 x half> [[SQR]]
 float16x4_t test_vsqrt_f16(float16x4_t a) {
@@ -40,7 +40,7 @@
 
 // COMMON-LABEL: test_vsqrtq_f16
 // UNCONSTRAINED:  [[SQR:%.*]] = call <8 x half> @llvm.sqrt.v8f16(<8 x half> %a)
-// CONSTRAINED:[[SQR:%.*]] = call <8 x half> @llvm.experimental.constrained.sqrt.v8f16(<8 x half> %a, metadata !"round.tonearest", metadata !"fpexcept.maytrap")
+// CONSTRAINED:[[SQR:%.*]] = call <8 x half> @llvm.experimental.constrained.sqrt.v8f16(<8 x half> %a, metadata !"round.tonearest", metadata !"fpexcept.strict")
 // CHECK-ASM:  fsqrt v{{[0-9]+}}.8h, v{{[0-9]+}}.8h
 // COMMONIR:   ret <8 x half> [[SQR]]
 float16x8_t test_vsqrtq_f16(float16x8_t a) {
@@ -49,7 +49,7 @@
 
 // COMMON-LABEL: test_vfma_f16
 // UNCONSTRAINED:  [[ADD:%.*]] = call <4 x half> @llvm.fma.v4f16(<4 x half> %b, <4 x half> %c, <4 x half> %a)
-// CONSTRAINED:[[ADD:%.*]] = call <4 x half> @llvm.experimental.constrained.fma.v4f16(<4 x half> %b, <4 x half> %c, <4 x half> %a, metadata !"round.tonearest", metadata !"fpexcept.maytrap")
+// CONSTRAINED:[[ADD:%.*]] = call <4 x half> @llvm.experimental.constrained.fma.v4f16(<4 x half> %b, <4 x half> %c, <4 x half> %a, metadata !"round.tonearest", metadata !"fpexcept.strict")
 // CHECK-ASM:  fmla v{{[0-9]+}}.4h, v{{[0-9]+}}.4h, v{{[0-9]+}}.4h
 // COMMONIR:   ret <4 x half> [[ADD]]
 float16x4_t test_vfma_f16(float16x4_t a, float16x4_t b, float16x4_t c) {
@@ -58,7 +58,7 @@
 
 // COMMON-LABEL: test_vfmaq_f16
 // UNCONSTRAINED:  [[ADD:%.*]] = call <8 x half> @llvm.fma.v8f16(<8 x half> %b, <8 x half> %c, <8 x half> %a)
-// CONSTRAINED:[[ADD:%.*]] = call <8 x half> @llvm.experimental.constrained.fma.v8f16(<8 x half> %b, <8 x half> %c, <8 x half> %a, metadata !"round.tonearest", metadata !"fpexcept.maytrap")
+// CONSTRAINED:[[ADD:%.*]] = call <8 x half> @llvm.experimental.constrained.fma.v8f16(<8 x half> %b, <8 x half> %c, <8 x half> %a, metadata !"round.tonearest", metadata !"fpexcept.strict")
 // CHECK-ASM:  fmla v{{[0-9]+}}.8h, v{{[0-9]+}}.8h, v{{[0-9]+}}.8h
 // COMMONIR:   ret <8 x half> [[ADD]]
 float16x8_t test_vfmaq_f16(float16x8_t a, float16x8_t b, float16x8_t c) {
@@ -68,7 +68,7 @@
 // COMMO

[PATCH] D141310: [clang] add -Wcompare-function-pointers

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

The code changes look good to me, the only real question I have left is whether 
this will be enabled by enough folks to be worth adding a default-off 
diagnostic. My intuition is that this is useful functionality for the folks who 
use `-icf=all` and when I look around to see if that option is being used, I 
see a terrifying number of uses of it given how broken I consider its semantics 
to be: 
https://sourcegraph.com/search?q=context:global+-icf%3Dall+-file:.*test.*&patternType=standard&sm=1&groupBy=repo

My thinking is that it's worthwhile to add this even though it's 
off-by-default, but hopefully we can find ways to encourage its use better. For 
example. it might be nice to suggest users enable this warning from the linker 
documentation about the `icf` option, or a blog post on the warning, etc. But I 
don't think that's a requirement to accept this. That said, I'm also curious 
about the details of how well users are able to react to this diagnostic 
(what's the false positive rate, can users make the corrections they need from 
the diagnostic, etc), so I'd prefer to hold off on landing this for a little 
bit until we have some idea of that from the chromium folks. (Given the branch 
is happening next week, I think this should wait to land until after the branch 
anyway so it has more time to bake.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141310

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


[PATCH] D140972: [flang] Add -fstack-arrays flag

2023-01-20 Thread Tom Eccles via Phabricator via cfe-commits
tblah updated this revision to Diff 490801.
tblah added a comment.

Update to ensure that generated code for Options.td does not try to reference
clang::CodegenOpts::StackArrays.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140972

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/Flang.cpp
  flang/docs/FlangDriver.md
  flang/include/flang/Frontend/CodeGenOptions.def
  flang/include/flang/Tools/CLOptions.inc
  flang/lib/Frontend/CompilerInvocation.cpp
  flang/lib/Frontend/FrontendActions.cpp
  flang/test/Driver/driver-help-hidden.f90
  flang/test/Driver/driver-help.f90
  flang/test/Driver/fast_math.f90
  flang/test/Transforms/stack-arrays.f90

Index: flang/test/Transforms/stack-arrays.f90
===
--- flang/test/Transforms/stack-arrays.f90
+++ flang/test/Transforms/stack-arrays.f90
@@ -1,5 +1,10 @@
 ! RUN: %flang_fc1 -emit-fir %s -o - | fir-opt --array-value-copy | fir-opt --stack-arrays | FileCheck %s
 
+! In order to verify the whole MLIR pipeline, make the driver generate LLVM IR.
+! This is only to check that -fstack-arrays enables the stack-arrays pass so
+! only check the first example
+! RUN: %flang_fc1 -emit-llvm -o - -fstack-arrays %s | FileCheck --check-prefix=LLVM-IR %s
+
 ! check simple array value copy case
 subroutine array_value_copy_simple(arr)
   integer, intent(inout) :: arr(4)
@@ -14,6 +19,15 @@
 ! CHECK: return
 ! CHECK-NEXT: }
 
+! LLVM-IR: array_value_copy_simple
+! LLVM-IR-NOT: malloc
+! LLVM-IR-NOT: free
+! LLVM-IR: alloca [4 x i32]
+! LLVM-IR-NOT: malloc
+! LLVM-IR-NOT: free
+! LLVM-IR: ret void
+! LLVM-IR-NEXT: }
+
 ! check complex array value copy case
 module stuff
   type DerivedWithAllocatable
Index: flang/test/Driver/fast_math.f90
===
--- flang/test/Driver/fast_math.f90
+++ flang/test/Driver/fast_math.f90
@@ -1,25 +1,35 @@
 ! Test for correct forwarding of fast-math flags from the compiler driver to the
 ! frontend driver
 
-! -Ofast => -ffast-math -O3
+! -Ofast => -ffast-math -O3 -fstack-arrays
 ! RUN: %flang -Ofast -fsyntax-only -### %s -o %t 2>&1 \
 ! RUN: | FileCheck --check-prefix=CHECK-OFAST %s
 ! CHECK-OFAST: -fc1
 ! CHECK-OFAST-SAME: -ffast-math
+! CHECK-OFAST-SAME: -fstack-arrays
 ! CHECK-OFAST-SAME: -O3
 
-! TODO: update once -fstack-arays is added
-! RUN: %flang -fstack-arrays -fsyntax-only %s -o %t 2>&1 \
+! RUN: %flang -fstack-arrays -fsyntax-only -### %s -o %t 2>&1 \
 ! RUN: | FileCheck --check-prefix=CHECK-STACK-ARRAYS %s
-! CHECK-STACK-ARRAYS: warning: argument unused during compilation: '-fstack-arrays'
+! CHECK-STACK-ARRAYS: -fc1
+! CHECK-STACK-ARRAYS-SAME: -fstack-arrays
 
-! -Ofast -fno-fast-math => -O3
+! -Ofast -fno-fast-math => -O3 -fstack-arrays
 ! RUN: %flang -Ofast -fno-fast-math -fsyntax-only -### %s -o %t 2>&1 \
 ! RUN: | FileCheck --check-prefix=CHECK-OFAST-NO-FAST %s
 ! CHECK-OFAST-NO-FAST: -fc1
 ! CHECK-OFAST-NO-FAST-NOT: -ffast-math
+! CHECK-OFAST-NO-FAST-SAME: -fstack-arrays
 ! CHECK-OFAST-NO-FAST-SAME: -O3
 
+! -Ofast -fno-stack-arrays -> -O3 -ffast-math
+! RUN: %flang -Ofast -fno-stack-arrays -fsyntax-only -### %s -o %t 2>&1 \
+! RUN: | FileCheck --check-prefix=CHECK-OFAST-NO-SA %s
+! CHECK-OFAST-NO-SA: -fc1
+! CHECK-OFAST-NO-SA-SAME: -ffast-math
+! CHECK-OFAST-NO-SA-NOT: -fstack-arrays
+! CHECK-OFAST-NO-SA-SAME: -O3
+
 ! -ffast-math => -ffast-math
 ! RUN: %flang -ffast-math -fsyntax-only -### %s -o %t 2>&1 \
 ! RUN: | FileCheck --check-prefix=CHECK-FFAST %s
Index: flang/test/Driver/driver-help.f90
===
--- flang/test/Driver/driver-help.f90
+++ flang/test/Driver/driver-help.f90
@@ -45,10 +45,12 @@
 ! HELP-NEXT: -fno-color-diagnostics  Disable colors in diagnostics
 ! HELP-NEXT: -fno-integrated-as  Disable the integrated assembler
 ! HELP-NEXT: -fno-signed-zeros  Allow optimizations that ignore the sign of floating point zeros
+! HELP-NEXT: -fno-stack-arrays  Allocate array temporaries on the heap (default)
 ! HELP-NEXT: -fopenacc  Enable OpenACC
 ! HELP-NEXT: -fopenmp   Parse OpenMP pragmas and generate parallel code.
 ! HELP-NEXT: -fpass-plugin= Load pass plugin from a dynamic shared object file (only with new pass manager).
 ! HELP-NEXT: -freciprocal-math  Allow division operations to be reassociated
+! HELP-NEXT: -fstack-arrays Attempt to allocate array temporaries on the stack, no matter their size
 ! HELP-NEXT: -fsyntax-only  Run the preprocessor, parser and semantic analysis stages
 ! HELP-NEXT: -fxor-operator Enable .XOR. as a synonym of .NEQV.
 ! HELP-NEXT: -help  Display available options
@@ -130,10 +132,12 @@
 ! HELP-FC1-NEXT: -fno-debug-pass-manager Disables debug printing for the new pass manager
 ! HELP-FC1-NEXT: -fno-reformat

[PATCH] D142181: [OptTable] Store llvm::cl::Option into a DenseMap instead of a StringMap

2023-01-20 Thread serge via Phabricator via cfe-commits
serge-sans-paille updated this revision to Diff 490804.
serge-sans-paille added a comment.
Herald added subscribers: cfe-commits, kadircet, arphaman.
Herald added a project: clang-tools-extra.

Fix build + make StringLiteral initialization constexpr.


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

https://reviews.llvm.org/D142181

Files:
  clang-tools-extra/clangd/tool/ClangdMain.cpp
  clang/include/clang/Tooling/Refactoring/RefactoringOption.h
  clang/lib/Tooling/Refactoring/RefactoringActions.cpp
  llvm/include/llvm/Option/OptTable.h
  llvm/include/llvm/Option/Option.h
  llvm/include/llvm/Support/CommandLine.h
  llvm/lib/CodeGen/TargetPassConfig.cpp
  llvm/lib/Support/CommandLine.cpp
  llvm/unittests/Support/CommandLineInit/CommandLineInitTest.cpp
  llvm/unittests/Support/CommandLineTest.cpp

Index: llvm/unittests/Support/CommandLineTest.cpp
===
--- llvm/unittests/Support/CommandLineTest.cpp
+++ llvm/unittests/Support/CommandLineTest.cpp
@@ -98,7 +98,7 @@
   static const char ArgString[] = "new-test-option";
   static const char ValueString[] = "Integer";
 
-  StringMap &Map =
+  DenseMap &Map =
   cl::getRegisteredOptions(cl::SubCommand::getTopLevel());
 
   ASSERT_EQ(Map.count("test-option"), 1u) << "Could not find option in map.";
@@ -419,7 +419,7 @@
   ASSERT_EQ(cl::NotHidden, TestOption2.getOptionHiddenFlag())
   << "Hid extra option that should be visable.";
 
-  StringMap &Map =
+  DenseMap &Map =
   cl::getRegisteredOptions(cl::SubCommand::getTopLevel());
   ASSERT_TRUE(Map.count("help") == (size_t)0 ||
   cl::NotHidden == Map["help"]->getOptionHiddenFlag())
@@ -445,7 +445,7 @@
   ASSERT_EQ(cl::NotHidden, TestOption3.getOptionHiddenFlag())
   << "Hid extra option that should be visable.";
 
-  StringMap &Map =
+  DenseMap &Map =
   cl::getRegisteredOptions(cl::SubCommand::getTopLevel());
   ASSERT_TRUE(Map.count("help") == (size_t)0 ||
   cl::NotHidden == Map["help"]->getOptionHiddenFlag())
@@ -1319,7 +1319,7 @@
   }
 
   enum class OptionValue { Val };
-  const StringRef Opt = "some-option";
+  const StringLiteral Opt = "some-option";
   const StringRef HelpText = "some help";
 
 private:
@@ -1421,7 +1421,7 @@
   enum class OptionValue { Val };
 
   template 
-  size_t runTest(StringRef ArgName, Ts... OptionAttributes) {
+  size_t runTest(StringLiteral ArgName, Ts... OptionAttributes) {
 StackOption TestOption(ArgName, cl::desc("some help"),
 OptionAttributes...);
 return getOptionWidth(TestOption);
@@ -1435,7 +1435,7 @@
 };
 
 TEST_F(GetOptionWidthTest, GetOptionWidthArgNameLonger) {
-  StringRef ArgName("a-long-argument-name");
+  StringLiteral ArgName("a-long-argument-name");
   size_t ExpectedStrSize = ("  --" + ArgName + "= - ").str().size();
   EXPECT_EQ(
   runTest(ArgName, cl::values(clEnumValN(OptionValue::Val, "v", "help"))),
@@ -1443,7 +1443,7 @@
 }
 
 TEST_F(GetOptionWidthTest, GetOptionWidthFirstOptionNameLonger) {
-  StringRef OptName("a-long-option-name");
+  StringLiteral OptName("a-long-option-name");
   size_t ExpectedStrSize = ("=" + OptName + " - ").str().size();
   EXPECT_EQ(
   runTest("a", cl::values(clEnumValN(OptionValue::Val, OptName, "help"),
@@ -1452,7 +1452,7 @@
 }
 
 TEST_F(GetOptionWidthTest, GetOptionWidthSecondOptionNameLonger) {
-  StringRef OptName("a-long-option-name");
+  StringLiteral OptName("a-long-option-name");
   size_t ExpectedStrSize = ("=" + OptName + " - ").str().size();
   EXPECT_EQ(
   runTest("a", cl::values(clEnumValN(OptionValue::Val, "b", "help"),
@@ -1472,7 +1472,7 @@
 
 TEST_F(GetOptionWidthTest,
GetOptionWidthValueOptionalEmptyOptionWithNoDescription) {
-  StringRef ArgName("a");
+  StringLiteral ArgName("a");
   // The length of a= (including indentation) is actually the same as the
   // = string, so it is impossible to distinguish via testing the case
   // where the empty string is ignored from where it is not ignored.
Index: llvm/unittests/Support/CommandLineInit/CommandLineInitTest.cpp
===
--- llvm/unittests/Support/CommandLineInit/CommandLineInitTest.cpp
+++ llvm/unittests/Support/CommandLineInit/CommandLineInitTest.cpp
@@ -50,7 +50,7 @@
 }
 
 TEST(CommandLineInitTest, GetPresetOptions) {
-  StringMap &Map =
+  DenseMap &Map =
   cl::getRegisteredOptions(cl::SubCommand::getTopLevel());
 
   for (auto *Str :
Index: llvm/lib/Support/CommandLine.cpp
===
--- llvm/lib/Support/CommandLine.cpp
+++ llvm/lib/Support/CommandLine.cpp
@@ -275,7 +275,7 @@
 auto End = Sub.OptionsMap.end();
 for (auto Name : OptionNames) {
   auto I = Sub.OptionsMap.find(Name);
-  if (I != End && I->getValue() == O)
+  if (I != End && I->second == O)
 Sub.OptionsMap.erase(I);
 }
 
@@ -381,7 +381,7 @@
  

[clang] ebd9a24 - [clang] Fix typos in member initializers

2023-01-20 Thread Kadir Cetinkaya via cfe-commits

Author: Kadir Cetinkaya
Date: 2023-01-20T15:20:31+01:00
New Revision: ebd9a2477e69ed35b83256ae93cc7e069f5a37c4

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

LOG: [clang] Fix typos in member initializers

This was regressed in ca619613801233ef2def8c3cc7d311d5ed0033cb. As we
attached InitExprs as-is to the AST, without performing transformations.

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

Added: 
clang/test/PCH/typo3.cpp

Modified: 
clang/lib/Sema/SemaDeclCXX.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 80cc6b0c01f37..749025c1258ff 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -4098,9 +4098,11 @@ void Sema::ActOnFinishCXXInClassMemberInitializer(Decl 
*D,
 return;
   }
 
-  ExprResult Init = InitExpr;
-  if (!FD->getType()->isDependentType() && !InitExpr->isTypeDependent()) {
-Init = ConvertMemberDefaultInitExpression(FD, InitExpr, InitLoc);
+  ExprResult Init = CorrectDelayedTyposInExpr(InitExpr, /*InitDecl=*/nullptr,
+  
/*RecoverUncorrectedTypos=*/true);
+  assert(Init.isUsable() && "Init should at least have a RecoveryExpr");
+  if (!FD->getType()->isDependentType() && !Init.get()->isTypeDependent()) {
+Init = ConvertMemberDefaultInitExpression(FD, Init.get(), InitLoc);
 // C++11 [class.base.init]p7:
 //   The initialization of each base and member constitutes a
 //   full-expression.
@@ -4112,9 +4114,7 @@ void Sema::ActOnFinishCXXInClassMemberInitializer(Decl *D,
 }
   }
 
-  InitExpr = Init.get();
-
-  FD->setInClassInitializer(InitExpr);
+  FD->setInClassInitializer(Init.get());
 }
 
 /// Find the direct and/or virtual base specifiers that

diff  --git a/clang/test/PCH/typo3.cpp b/clang/test/PCH/typo3.cpp
new file mode 100644
index 0..c286039400469
--- /dev/null
+++ b/clang/test/PCH/typo3.cpp
@@ -0,0 +1,8 @@
+// RUN: not %clang_cc1 -emit-pch %s -o %t.pch 2>&1 | FileCheck %s
+
+struct S {
+  // Make sure TypoExprs in default init exprs are corrected before serializing
+  // in PCH.
+  int y = bar;
+  // CHECK: use of undeclared identifier 'bar'
+};



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


[PATCH] D142187: [clang] Fix typos in member initializers

2023-01-20 Thread Kadir Cetinkaya 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 rGebd9a2477e69: [clang] Fix typos in member initializers 
(authored by kadircet).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142187

Files:
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/PCH/typo3.cpp


Index: clang/test/PCH/typo3.cpp
===
--- /dev/null
+++ clang/test/PCH/typo3.cpp
@@ -0,0 +1,8 @@
+// RUN: not %clang_cc1 -emit-pch %s -o %t.pch 2>&1 | FileCheck %s
+
+struct S {
+  // Make sure TypoExprs in default init exprs are corrected before serializing
+  // in PCH.
+  int y = bar;
+  // CHECK: use of undeclared identifier 'bar'
+};
Index: clang/lib/Sema/SemaDeclCXX.cpp
===
--- clang/lib/Sema/SemaDeclCXX.cpp
+++ clang/lib/Sema/SemaDeclCXX.cpp
@@ -4098,9 +4098,11 @@
 return;
   }
 
-  ExprResult Init = InitExpr;
-  if (!FD->getType()->isDependentType() && !InitExpr->isTypeDependent()) {
-Init = ConvertMemberDefaultInitExpression(FD, InitExpr, InitLoc);
+  ExprResult Init = CorrectDelayedTyposInExpr(InitExpr, /*InitDecl=*/nullptr,
+  
/*RecoverUncorrectedTypos=*/true);
+  assert(Init.isUsable() && "Init should at least have a RecoveryExpr");
+  if (!FD->getType()->isDependentType() && !Init.get()->isTypeDependent()) {
+Init = ConvertMemberDefaultInitExpression(FD, Init.get(), InitLoc);
 // C++11 [class.base.init]p7:
 //   The initialization of each base and member constitutes a
 //   full-expression.
@@ -4112,9 +4114,7 @@
 }
   }
 
-  InitExpr = Init.get();
-
-  FD->setInClassInitializer(InitExpr);
+  FD->setInClassInitializer(Init.get());
 }
 
 /// Find the direct and/or virtual base specifiers that


Index: clang/test/PCH/typo3.cpp
===
--- /dev/null
+++ clang/test/PCH/typo3.cpp
@@ -0,0 +1,8 @@
+// RUN: not %clang_cc1 -emit-pch %s -o %t.pch 2>&1 | FileCheck %s
+
+struct S {
+  // Make sure TypoExprs in default init exprs are corrected before serializing
+  // in PCH.
+  int y = bar;
+  // CHECK: use of undeclared identifier 'bar'
+};
Index: clang/lib/Sema/SemaDeclCXX.cpp
===
--- clang/lib/Sema/SemaDeclCXX.cpp
+++ clang/lib/Sema/SemaDeclCXX.cpp
@@ -4098,9 +4098,11 @@
 return;
   }
 
-  ExprResult Init = InitExpr;
-  if (!FD->getType()->isDependentType() && !InitExpr->isTypeDependent()) {
-Init = ConvertMemberDefaultInitExpression(FD, InitExpr, InitLoc);
+  ExprResult Init = CorrectDelayedTyposInExpr(InitExpr, /*InitDecl=*/nullptr,
+  /*RecoverUncorrectedTypos=*/true);
+  assert(Init.isUsable() && "Init should at least have a RecoveryExpr");
+  if (!FD->getType()->isDependentType() && !Init.get()->isTypeDependent()) {
+Init = ConvertMemberDefaultInitExpression(FD, Init.get(), InitLoc);
 // C++11 [class.base.init]p7:
 //   The initialization of each base and member constitutes a
 //   full-expression.
@@ -4112,9 +4114,7 @@
 }
   }
 
-  InitExpr = Init.get();
-
-  FD->setInClassInitializer(InitExpr);
+  FD->setInClassInitializer(Init.get());
 }
 
 /// Find the direct and/or virtual base specifiers that
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D142027: [Assignment Tracking][NFC] Replace LLVM command line option with a new module flag

2023-01-20 Thread Orlando Cazalet-Hyams via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Orlando marked an inline comment as done.
Closed by commit rG4ece50737d53: [Assignment Tracking][NFC] Replace LLVM 
command line option with a module flag (authored by Orlando).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Changed prior to commit:
  https://reviews.llvm.org/D142027?vs=490171&id=490808#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142027

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/assignment-tracking-opts.c
  llvm/docs/AssignmentTracking.md
  llvm/include/llvm/IR/DebugInfo.h
  llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
  llvm/lib/IR/DebugInfo.cpp
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
  llvm/lib/Transforms/Utils/InlineFunction.cpp
  llvm/test/DebugInfo/Generic/assignment-tracking/adce/no-delete.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/codegenprepare/sunk-addr.ll
  
llvm/test/DebugInfo/Generic/assignment-tracking/dse/dse-after-memcpyopt-merge.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/dse/shorten.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/inline/id.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/inline/inline-stores.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/inline/use-before-def.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/instcombine/alloca-bitcast.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/instcombine/memset.ll
  
llvm/test/DebugInfo/Generic/assignment-tracking/instcombine/remove-redundant-dbg.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/instcombine/sink-store.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/instcombine/sink.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/instcombine/storemerge.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/licm/merge.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/licm/multi-exit.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/loop-deletion/dead-loop.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/mem2reg/phi.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/mem2reg/single-block-alloca.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/mem2reg/single-store-alloca.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/memcpyopt/merge-stores.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/mldst-motion/diamond.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/parse-and-verify/distinct.ll
  
llvm/test/DebugInfo/Generic/assignment-tracking/parse-and-verify/instruction-type.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/parse-and-verify/operands.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/parse-and-verify/roundtrip.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/parse-and-verify/verify.ll
  
llvm/test/DebugInfo/Generic/assignment-tracking/remove-redundant-fwd-scan-linked.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/remove-redundant.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/salvage-value.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/simplifycfg/empty-block.ll
  
llvm/test/DebugInfo/Generic/assignment-tracking/simplifycfg/speculated-store.ll
  
llvm/test/DebugInfo/Generic/assignment-tracking/slp-vectorizer/merge-scalars.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/sroa/after-inlining.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/sroa/alloca-single-slice.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/sroa/complex.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/sroa/frag-2.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/sroa/frag.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/sroa/id.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/sroa/memcpy.ll
  
llvm/test/DebugInfo/Generic/assignment-tracking/sroa/memmove-to-from-same-alloca.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/sroa/rewrite.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/sroa/store.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/sroa/unspecified-var-size.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/sroa/user-memcpy.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/sroa/vec-1.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/sroa/vec-2.ll
  llvm/test/DebugInfo/Generic/assignment-tracking/track-assignments.ll
  llvm/test/DebugInfo/assignment-tracking/X86/DSE.ll
  llvm/test/DebugInfo/assignment-tracking/X86/dbg-phi-produces-undef.ll
  llvm/test/DebugInfo/assignment-tracking/X86/diamond-1.ll
  llvm/test/DebugInfo/assignment-tracking/X86/diamond-2.ll
  llvm/test/DebugInfo/assignment-tracking/X86/diamond-3.ll
  llvm/test/DebugInfo/assignment-tracking/X86/loop-hoist.ll
  llvm/test/DebugInfo/assignment-tracking/X86/loop-sink.ll
  llvm/t

[PATCH] D140415: [flang] stack arrays pass

2023-01-20 Thread Tom Eccles via Phabricator via cfe-commits
tblah updated this revision to Diff 490810.
tblah added a comment.

Fix newly added tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140415

Files:
  clang/docs/tools/clang-formatted-files.txt
  flang/include/flang/Optimizer/Builder/MutableBox.h
  flang/include/flang/Optimizer/Dialect/FIRAttr.h
  flang/include/flang/Optimizer/Transforms/Passes.h
  flang/include/flang/Optimizer/Transforms/Passes.td
  flang/lib/Lower/Allocatable.cpp
  flang/lib/Optimizer/Builder/MutableBox.cpp
  flang/lib/Optimizer/Transforms/CMakeLists.txt
  flang/lib/Optimizer/Transforms/StackArrays.cpp
  flang/test/Lower/HLFIR/allocatable-and-pointer-status-change.f90
  flang/test/Lower/Intrinsics/c_loc.f90
  flang/test/Lower/Intrinsics/system_clock.f90
  flang/test/Transforms/stack-arrays.f90
  flang/test/Transforms/stack-arrays.fir

Index: flang/test/Transforms/stack-arrays.fir
===
--- /dev/null
+++ flang/test/Transforms/stack-arrays.fir
@@ -0,0 +1,242 @@
+// RUN: fir-opt --stack-arrays %s | FileCheck %s
+
+// Simplest transformation
+func.func @simple() {
+  %0 = fir.allocmem !fir.array<42xi32>
+  fir.freemem %0 : !fir.heap>
+  return
+}
+// CHECK: func.func @simple() {
+// CHECK-NEXT: fir.alloca !fir.array<42xi32>
+// CHECK-NEXT: return
+// CHECK-NEXT: }
+
+// Check fir.must_be_heap allocations are not moved
+func.func @must_be_heap() {
+  %0 = fir.allocmem !fir.array<42xi32> {fir.must_be_heap = true}
+  fir.freemem %0 : !fir.heap>
+  return
+}
+// CHECK:  func.func @must_be_heap() {
+// CHECK-NEXT:   %[[ALLOC:.*]] = fir.allocmem !fir.array<42xi32> {fir.must_be_heap = true}
+// CHECK-NEXT:   fir.freemem %[[ALLOC]] : !fir.heap>
+// CHECK-NEXT:   return
+// CHECK-NEXT: }
+
+// Check the data-flow-analysis can detect cases where we aren't sure if memory
+// is freed by the end of the function
+func.func @dfa1(%arg0: !fir.ref> {fir.bindc_name = "cond"}) {
+  %7 = arith.constant 42 : index
+  %8 = fir.allocmem !fir.array, %7 {uniq_name = "_QFdfa1Earr.alloc"}
+  %9 = fir.load %arg0 : !fir.ref>
+  %10 = fir.convert %9 : (!fir.logical<4>) -> i1
+  fir.if %10 {
+fir.freemem %8 : !fir.heap>
+  } else {
+  }
+  return
+}
+// CHECK:  func.func @dfa1(%arg0: !fir.ref> {fir.bindc_name = "cond"}) {
+// CHECK-NEXT:   %c42 = arith.constant 42 : index
+// CHECK-NEXT:   %0 = fir.allocmem !fir.array, %c42 {uniq_name = "_QFdfa1Earr.alloc"}
+// CHECK-NEXT:   %1 = fir.load %arg0 : !fir.ref>
+// CHECK-NEXT:   %2 = fir.convert %1 : (!fir.logical<4>) -> i1
+// CHECK-NEXT:   fir.if %2 {
+// CHECK-NEXT: fir.freemem %0 : !fir.heap>
+// CHECK-NEXT:   } else {
+// CHECK-NEXT:   }
+// CHECK-NEXT:   return
+// CHECK-NEXT: }
+
+// Check scf.if (fir.if is not considered a branch operation)
+func.func @dfa2(%arg0: i1) {
+  %a = fir.allocmem !fir.array<1xi8>
+  scf.if %arg0 {
+fir.freemem %a : !fir.heap>
+  } else {
+  }
+  return
+}
+// CHECK: func.func @dfa2(%arg0: i1) {
+// CHECK-NEXT:  %[[MEM:.*]] = fir.allocmem !fir.array<1xi8>
+// CHECK-NEXT:  scf.if %arg0 {
+// CHECK-NEXT:fir.freemem %[[MEM]] : !fir.heap>
+// CHECK-NEXT:  } else {
+// CHECK-NEXT:  }
+// CHECK-NEXT:  return
+// CHECK-NEXT:  }
+
+// check the alloca is placed after all operands become available
+func.func @placement1() {
+  // do some stuff with other ssa values
+  %1 = arith.constant 1 : index
+  %2 = arith.constant 2 : index
+  %3 = arith.addi %1, %2 : index
+  // operand is now available
+  %4 = fir.allocmem !fir.array, %3
+  // ...
+  fir.freemem %4 : !fir.heap>
+  return
+}
+// CHECK:  func.func @placement1() {
+// CHECK-NEXT:   %[[ONE:.*]] = arith.constant 1 : index
+// CHECK-NEXT:   %[[TWO:.*]] = arith.constant 2 : index
+// CHECK-NEXT:   %[[ARG:.*]] = arith.addi %[[ONE]], %[[TWO]] : index
+// CHECK-NEXT:   %[[MEM:.*]] = fir.alloca !fir.array, %[[ARG]]
+// CHECK-NEXT:   return
+// CHECK-NEXT: }
+
+// check that if there are no operands, then the alloca is placed early
+func.func @placement2() {
+  // do some stuff with other ssa values
+  %1 = arith.constant 1 : index
+  %2 = arith.constant 2 : index
+  %3 = arith.addi %1, %2 : index
+  %4 = fir.allocmem !fir.array<42xi32>
+  // ...
+  fir.freemem %4 : !fir.heap>
+  return
+}
+// CHECK:  func.func @placement2() {
+// CHECK-NEXT:   %[[MEM:.*]] = fir.alloca !fir.array<42xi32>
+// CHECK-NEXT:   %[[ONE:.*]] = arith.constant 1 : index
+// CHECK-NEXT:   %[[TWO:.*]] = arith.constant 2 : index
+// CHECK-NEXT:   %[[SUM:.*]] = arith.addi %[[ONE]], %[[TWO]] : index
+// CHECK-NEXT:   return
+// CHECK-NEXT: }
+
+// check that stack allocations which must be placed in loops use stacksave
+func.func @placement3() {
+  %c1 = arith.constant 1 : index
+  %c1_i32 = fir.convert %c1 : (index) -> i32
+  %c2 = arith.constant 2 : index
+  %c10 = arith.constant 10 : index
+  %0:2 = fir.do_loop %arg0 = %c1 to %c10 step %c1 iter_args(%arg1 = %c1_i32) -> (index, i32) {
+%3 = arit

[clang] 0a996c8 - [Assignment Tracking] Fix -fexperimental-assignment-tracking cc1 flag

2023-01-20 Thread via cfe-commits

Author: OCHyams
Date: 2023-01-20T14:36:16Z
New Revision: 0a996c82a75f330f3d01541381569c8cd2cd6190

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

LOG: [Assignment Tracking] Fix -fexperimental-assignment-tracking cc1 flag

This change allows `-fexperimental-assignment-tracking` to be negated using the
negative equivalent `-fno-experimental-assignment-tracking`, and fixes the flag
so that the default behaviour can be changed (currently the default is still
false / disabled).

Reviewed By: StephenTozer

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

Added: 


Modified: 
clang/include/clang/Driver/Options.td
clang/test/CodeGen/assignment-tracking/flag.cpp

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index ba49b335cf287..dd3e86f214255 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5702,10 +5702,11 @@ def fctor_dtor_return_this : Flag<["-"], 
"fctor-dtor-return-this">,
"and non-deleting destructors. (No effect on Microsoft ABI)">,
   MarshallingInfoFlag>;
 
-def fexperimental_assignment_tracking :
-  Flag<["-"], "fexperimental-assignment-tracking">, Group,
-  HelpText<"Enable assignment tracking debug info">,
-  MarshallingInfoFlag>;
+defm experimental_assignment_tracking :
+  BoolOption<"f", "experimental-assignment-tracking",
+  CodeGenOpts<"EnableAssignmentTracking">, DefaultFalse,
+  PosFlag, NegFlag, BothFlags<[CoreOption]>>,
+  Group;
 
 } // let Flags = [CC1Option, NoDriverOption]
 

diff  --git a/clang/test/CodeGen/assignment-tracking/flag.cpp 
b/clang/test/CodeGen/assignment-tracking/flag.cpp
index 911fa1aca70d8..c4e85738fb272 100644
--- a/clang/test/CodeGen/assignment-tracking/flag.cpp
+++ b/clang/test/CodeGen/assignment-tracking/flag.cpp
@@ -1,18 +1,24 @@
+ Explicitly enabled:
 // RUN: %clang_cc1 -triple x86_64-none-linux-gnu -debug-info-kind=standalone 
-O0 \
 // RUN: -emit-llvm  -fexperimental-assignment-tracking %s -o - 
  \
-// RUN: | FileCheck %s --check-prefixes=FLAG
+// RUN: | FileCheck %s --check-prefixes=ENABLE
+ Disabled by default:
 // RUN: %clang_cc1 -triple x86_64-none-linux-gnu -debug-info-kind=standalone 
-O0 \
 // RUN: -emit-llvm  %s -o -
  \
-// RUN: | FileCheck %s --check-prefixes=NO-FLAG
+// RUN: | FileCheck %s --check-prefixes=DISABLE
+ Explicitly disabled:
+// RUN: %clang_cc1 -triple x86_64-none-linux-gnu -debug-info-kind=standalone 
-O0 \
+// RUN: -emit-llvm  %s -o - -fno-experimental-assignment-tracking  
  \
+// RUN: | FileCheck %s --check-prefixes=DISABLE
 
 // Check some assignment-tracking stuff appears in the output when the flag
-// -fexperimental-assignment-tracking is used, and that it doesn't when
-// the flag is not used (default behaviour: no assignment tracking).
+// -fexperimental-assignment-tracking is used, that it doesn't when
+// -fno-experimental-assignment-tracking is used or neither flag is specified.
 
-// FLAG: DIAssignID
-// FLAG: dbg.assign
+// ENABLE: DIAssignID
+// ENABLE: dbg.assign
 
-// NO-FLAG-NOT: DIAssignID
-// NO-FLAG-NOT: dbg.assign
+// DISABLE-NOT: DIAssignID
+// DISABLE-NOT: dbg.assign
 
 void fun(int a) {}



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


[PATCH] D142029: [Assignment Tracking] Fix -fexperimental-assignment-tracking cc1 flag

2023-01-20 Thread Orlando Cazalet-Hyams 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 rG0a996c82a75f: [Assignment Tracking] Fix 
-fexperimental-assignment-tracking cc1 flag (authored by Orlando).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142029

Files:
  clang/include/clang/Driver/Options.td
  clang/test/CodeGen/assignment-tracking/flag.cpp


Index: clang/test/CodeGen/assignment-tracking/flag.cpp
===
--- clang/test/CodeGen/assignment-tracking/flag.cpp
+++ clang/test/CodeGen/assignment-tracking/flag.cpp
@@ -1,18 +1,24 @@
+ Explicitly enabled:
 // RUN: %clang_cc1 -triple x86_64-none-linux-gnu -debug-info-kind=standalone 
-O0 \
 // RUN: -emit-llvm  -fexperimental-assignment-tracking %s -o - 
  \
-// RUN: | FileCheck %s --check-prefixes=FLAG
+// RUN: | FileCheck %s --check-prefixes=ENABLE
+ Disabled by default:
 // RUN: %clang_cc1 -triple x86_64-none-linux-gnu -debug-info-kind=standalone 
-O0 \
 // RUN: -emit-llvm  %s -o -
  \
-// RUN: | FileCheck %s --check-prefixes=NO-FLAG
+// RUN: | FileCheck %s --check-prefixes=DISABLE
+ Explicitly disabled:
+// RUN: %clang_cc1 -triple x86_64-none-linux-gnu -debug-info-kind=standalone 
-O0 \
+// RUN: -emit-llvm  %s -o - -fno-experimental-assignment-tracking  
  \
+// RUN: | FileCheck %s --check-prefixes=DISABLE
 
 // Check some assignment-tracking stuff appears in the output when the flag
-// -fexperimental-assignment-tracking is used, and that it doesn't when
-// the flag is not used (default behaviour: no assignment tracking).
+// -fexperimental-assignment-tracking is used, that it doesn't when
+// -fno-experimental-assignment-tracking is used or neither flag is specified.
 
-// FLAG: DIAssignID
-// FLAG: dbg.assign
+// ENABLE: DIAssignID
+// ENABLE: dbg.assign
 
-// NO-FLAG-NOT: DIAssignID
-// NO-FLAG-NOT: dbg.assign
+// DISABLE-NOT: DIAssignID
+// DISABLE-NOT: dbg.assign
 
 void fun(int a) {}
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -5702,10 +5702,11 @@
"and non-deleting destructors. (No effect on Microsoft ABI)">,
   MarshallingInfoFlag>;
 
-def fexperimental_assignment_tracking :
-  Flag<["-"], "fexperimental-assignment-tracking">, Group,
-  HelpText<"Enable assignment tracking debug info">,
-  MarshallingInfoFlag>;
+defm experimental_assignment_tracking :
+  BoolOption<"f", "experimental-assignment-tracking",
+  CodeGenOpts<"EnableAssignmentTracking">, DefaultFalse,
+  PosFlag, NegFlag, BothFlags<[CoreOption]>>,
+  Group;
 
 } // let Flags = [CC1Option, NoDriverOption]
 


Index: clang/test/CodeGen/assignment-tracking/flag.cpp
===
--- clang/test/CodeGen/assignment-tracking/flag.cpp
+++ clang/test/CodeGen/assignment-tracking/flag.cpp
@@ -1,18 +1,24 @@
+ Explicitly enabled:
 // RUN: %clang_cc1 -triple x86_64-none-linux-gnu -debug-info-kind=standalone -O0 \
 // RUN: -emit-llvm  -fexperimental-assignment-tracking %s -o -   \
-// RUN: | FileCheck %s --check-prefixes=FLAG
+// RUN: | FileCheck %s --check-prefixes=ENABLE
+ Disabled by default:
 // RUN: %clang_cc1 -triple x86_64-none-linux-gnu -debug-info-kind=standalone -O0 \
 // RUN: -emit-llvm  %s -o -  \
-// RUN: | FileCheck %s --check-prefixes=NO-FLAG
+// RUN: | FileCheck %s --check-prefixes=DISABLE
+ Explicitly disabled:
+// RUN: %clang_cc1 -triple x86_64-none-linux-gnu -debug-info-kind=standalone -O0 \
+// RUN: -emit-llvm  %s -o - -fno-experimental-assignment-tracking\
+// RUN: | FileCheck %s --check-prefixes=DISABLE
 
 // Check some assignment-tracking stuff appears in the output when the flag
-// -fexperimental-assignment-tracking is used, and that it doesn't when
-// the flag is not used (default behaviour: no assignment tracking).
+// -fexperimental-assignment-tracking is used, that it doesn't when
+// -fno-experimental-assignment-tracking is used or neither flag is specified.
 
-// FLAG: DIAssignID
-// FLAG: dbg.assign
+// ENABLE: DIAssignID
+// ENABLE: dbg.assign
 
-// NO-FLAG-NOT: DIAssignID
-// NO-FLAG-NOT: dbg.assign
+// DISABLE-NOT: DIAssignID
+// DISABLE-NOT: dbg.assign
 
 void fun(int a) {}
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -5702,10 +5702,11 @@
"and non-deleting destructors. (No effect on Microsoft ABI)">,
   MarshallingInfoFlag>;
 
-d

[PATCH] D141441: [clang] Add ElaboratedType sugaring for types on implicit special members

2023-01-20 Thread Brad King via Phabricator via cfe-commits
brad.king added a comment.

Thanks rsmith! Since I do not have commit privileges, can you land this for me, 
please?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141441

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


[PATCH] D142092: [include-mapping] Allow multiple headers for the same symbol. Choose the first header of available ones.

2023-01-20 Thread Viktoriia Bakalova via Phabricator via cfe-commits
VitaNuo updated this revision to Diff 490824.
VitaNuo added a comment.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.

Add re-generated symbol maps.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142092

Files:
  clang/include/clang/Tooling/Inclusions/CSymbolMap.inc
  clang/include/clang/Tooling/Inclusions/RemovedStdSymbolMap.inc
  clang/include/clang/Tooling/Inclusions/StdSymbolMap.inc
  clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp
  clang/tools/include-mapping/cppreference_parser.py
  clang/tools/include-mapping/gen_std.py

Index: clang/tools/include-mapping/gen_std.py
===
--- clang/tools/include-mapping/gen_std.py
+++ clang/tools/include-mapping/gen_std.py
@@ -14,10 +14,7 @@
 The generated files are located in clang/include/Tooling/Inclusions.
 
 Caveats and FIXMEs:
-  - only symbols directly in "std" namespace are added, we should also add std's
-subnamespace symbols (e.g. chrono).
-  - symbols with multiple variants or defined in multiple headers aren't added,
-e.g. std::move, std::swap
+  - symbols with multiple variants aren't added, e.g., std::move, std::swap
 
 Usage:
   1. Install BeautifulSoup dependency, see instruction:
@@ -110,17 +107,12 @@
 os.stat(index_page_path).st_mtime).strftime('%Y-%m-%d')
   print(CODE_PREFIX % (args.symbols.upper(), cppreference_modified_date))
   for symbol in symbols:
-if len(symbol.headers) == 1:
-  # SYMBOL(unqualified_name, namespace, header)
-  print("SYMBOL(%s, %s, %s)" % (symbol.name, symbol.namespace,
-symbol.headers[0]))
-elif len(symbol.headers) == 0:
+if len(symbol.headers) == 0:
   sys.stderr.write("No header found for symbol %s\n" % symbol.name)
 else:
-  # FIXME: support symbols with multiple headers (e.g. std::move).
-  sys.stderr.write("Ambiguous header for symbol %s: %s\n" % (
-  symbol.name, ', '.join(symbol.headers)))
-
-
+  for header in symbol.headers:
+# SYMBOL(unqualified_name, namespace, header)
+print("SYMBOL(%s, %s, %s)" % (symbol.name, symbol.namespace,
+  header))
 if __name__ == '__main__':
   main()
Index: clang/tools/include-mapping/cppreference_parser.py
===
--- clang/tools/include-mapping/cppreference_parser.py
+++ clang/tools/include-mapping/cppreference_parser.py
@@ -118,7 +118,7 @@
 return _ParseSymbolPage(f.read(), name)
 
 
-def _GetSymbols(pool, root_dir, index_page_name, namespace, variants_to_accept):
+def _GetSymbols(pool, root_dir, index_page_name, namespace):
   """Get all symbols listed in the index page. All symbols should be in the
   given namespace.
 
@@ -137,9 +137,7 @@
 for symbol_name, symbol_page_path, variant in _ParseIndexPage(f.read()):
   # Variant symbols (e.g. the std::locale version of isalpha) add ambiguity.
   # FIXME: use these as a fallback rather than ignoring entirely.
-  variants_for_symbol = variants_to_accept.get(
-  (namespace or "") + symbol_name, ())
-  if variant and variant not in variants_for_symbol:
+  if variant:
 continue
   path = os.path.join(root_dir, symbol_page_path)
   if os.path.isfile(path):
@@ -166,13 +164,6 @@
   Args:
 parse_pages: a list of tuples (page_root_dir, index_page_name, namespace)
   """
-  # By default we prefer the non-variant versions, as they're more common. But
-  # there are some symbols, whose variant is more common. This list describes
-  # those symbols.
-  variants_to_accept = {
-  # std::remove<> has variant algorithm.
-  "std::remove": ("algorithm"),
-  }
   symbols = []
   # Run many workers to process individual symbol pages under the symbol index.
   # Don't allow workers to capture Ctrl-C.
@@ -180,8 +171,7 @@
   initializer=lambda: signal.signal(signal.SIGINT, signal.SIG_IGN))
   try:
 for root_dir, page_name, namespace in parse_pages:
-  symbols.extend(_GetSymbols(pool, root_dir, page_name, namespace,
- variants_to_accept))
+  symbols.extend(_GetSymbols(pool, root_dir, page_name, namespace))
   finally:
 pool.terminate()
 pool.join()
Index: clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp
===
--- clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp
+++ clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp
@@ -8,6 +8,7 @@
 
 #include "clang/Tooling/Inclusions/StandardLibrary.h"
 #include "clang/AST/Decl.h"
+#include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Casting.h"
 
@@ -16,8 +17,9 @@
 namespace stdlib {
 
 static llvm::StringRef *HeaderNames;
-static std::pair *SymbolNames;
-static unsigned *SymbolHeaderIDs;
+static llvm::Dense

[PATCH] D142092: [include-mapping] Allow multiple headers for the same symbol. Choose the first header of available ones.

2023-01-20 Thread Viktoriia Bakalova via Phabricator via cfe-commits
VitaNuo added a comment.

Added the re-generated symbol maps to this patch as per @hokein's request.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142092

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


[clang] 75fbb5d - [clang][nfc] refactor Module::Header to use OptionalFileEntryRef

2023-01-20 Thread Richard Howell via cfe-commits

Author: Richard Howell
Date: 2023-01-20T07:23:11-08:00
New Revision: 75fbb5d2238f1824f03d205b699061a115d5effc

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

LOG: [clang][nfc] refactor Module::Header to use OptionalFileEntryRef

Refactor the `Module::Header` class to use an `OptionalFileEntryRef`
instead of a `FileEntry*`. This is preparation for refactoring the
`TopHeaderNames` to use `FileEntryRef` so that we preserve the
lookup path of the headers when serializing.

This is mostly based on https://reviews.llvm.org/D90497

Reviewed By: jansvoboda11

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

Added: 


Modified: 
clang/include/clang/Basic/Module.h
clang/include/clang/Lex/ModuleMap.h
clang/lib/Frontend/FrontendAction.cpp
clang/lib/Lex/ModuleMap.cpp
clang/lib/Sema/SemaModule.cpp
clang/lib/Serialization/ASTReader.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/Module.h 
b/clang/include/clang/Basic/Module.h
index 1b87e6628e31e..fc0ca163fe355 100644
--- a/clang/include/clang/Basic/Module.h
+++ b/clang/include/clang/Basic/Module.h
@@ -144,7 +144,8 @@ class alignas(8) Module {
   std::string PresumedModuleMapFile;
 
   /// The umbrella header or directory.
-  llvm::PointerUnion Umbrella;
+  llvm::PointerUnion
+  Umbrella;
 
   /// The module signature.
   ASTFileSignature Signature;
@@ -214,9 +215,9 @@ class alignas(8) Module {
   struct Header {
 std::string NameAsWritten;
 std::string PathRelativeToRootModuleDirectory;
-const FileEntry *Entry;
+OptionalFileEntryRefDegradesToFileEntryPtr Entry;
 
-explicit operator bool() { return Entry; }
+explicit operator bool() { return Entry.has_value(); }
   };
 
   /// Information about a directory name as found in the module map
@@ -622,9 +623,9 @@ class alignas(8) Module {
   /// Retrieve the header that serves as the umbrella header for this
   /// module.
   Header getUmbrellaHeader() const {
-if (auto *FE = Umbrella.dyn_cast())
+if (auto *ME = Umbrella.dyn_cast())
   return Header{UmbrellaAsWritten, UmbrellaRelativeToRootModuleDirectory,
-FE};
+FileEntryRef(*ME)};
 return Header{};
   }
 

diff  --git a/clang/include/clang/Lex/ModuleMap.h 
b/clang/include/clang/Lex/ModuleMap.h
index 77a1bdab0bdd1..f9eb0be538c00 100644
--- a/clang/include/clang/Lex/ModuleMap.h
+++ b/clang/include/clang/Lex/ModuleMap.h
@@ -676,7 +676,7 @@ class ModuleMap {
 
   /// Sets the umbrella header of the given module to the given
   /// header.
-  void setUmbrellaHeader(Module *Mod, const FileEntry *UmbrellaHeader,
+  void setUmbrellaHeader(Module *Mod, FileEntryRef UmbrellaHeader,
  const Twine &NameAsWritten,
  const Twine &PathRelativeToRootModuleDirectory);
 

diff  --git a/clang/lib/Frontend/FrontendAction.cpp 
b/clang/lib/Frontend/FrontendAction.cpp
index 6ec6fa0499178..1e276642016d1 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -12,6 +12,7 @@
 #include "clang/AST/DeclGroup.h"
 #include "clang/Basic/Builtins.h"
 #include "clang/Basic/DiagnosticOptions.h"
+#include "clang/Basic/FileEntry.h"
 #include "clang/Basic/LangStandard.h"
 #include "clang/Basic/Sarif.h"
 #include "clang/Frontend/ASTUnit.h"
@@ -376,7 +377,9 @@ static std::error_code collectModuleHeaderIncludes(
 llvm::sys::path::native(UmbrellaDir.Entry->getName(), DirNative);
 
 llvm::vfs::FileSystem &FS = FileMgr.getVirtualFileSystem();
-SmallVector, 8> Headers;
+SmallVector<
+std::pair, 8>
+Headers;
 for (llvm::vfs::recursive_directory_iterator Dir(FS, DirNative, EC), End;
  Dir != End && !EC; Dir.increment(EC)) {
   // Check whether this entry has an extension typically associated with
@@ -386,7 +389,7 @@ static std::error_code collectModuleHeaderIncludes(
.Default(false))
 continue;
 
-  auto Header = FileMgr.getFile(Dir->path());
+  auto Header = FileMgr.getOptionalFileRef(Dir->path());
   // FIXME: This shouldn't happen unless there is a file system race. Is
   // that worth diagnosing?
   if (!Header)

diff  --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index 106e9c37ce227..ee2cca4e0814e 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/lib/Lex/ModuleMap.cpp
@@ -304,7 +304,7 @@ bool ModuleMap::resolveAsBuiltinHeader(
   // supplied by Clang. Find that builtin header.
   SmallString<128> Path;
   llvm::sys::path::append(Path, BuiltinIncludeDir->getName(), Header.FileName);
-  auto File = SourceMgr.getFileManager().getFile(Path);
+  auto File = SourceMgr.getFileManager().getOptionalFileRef(Path);
   if (!File)
 return false;
 
@@ -1024,7 +1024,7 @@ Modul

[PATCH] D142113: [clang][nfc] refactor Module::Header to use OptionalFileEntryRef

2023-01-20 Thread Richard Howell 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 rG75fbb5d2238f: [clang][nfc] refactor Module::Header to use 
OptionalFileEntryRef (authored by rmaz).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142113

Files:
  clang/include/clang/Basic/Module.h
  clang/include/clang/Lex/ModuleMap.h
  clang/lib/Frontend/FrontendAction.cpp
  clang/lib/Lex/ModuleMap.cpp
  clang/lib/Sema/SemaModule.cpp
  clang/lib/Serialization/ASTReader.cpp

Index: clang/lib/Serialization/ASTReader.cpp
===
--- clang/lib/Serialization/ASTReader.cpp
+++ clang/lib/Serialization/ASTReader.cpp
@@ -1947,7 +1947,7 @@
   Reader.ResolveImportedPath(M, Filename);
 // FIXME: NameAsWritten
 Module::Header H = {std::string(key.Filename), "",
-*FileMgr.getFile(Filename)};
+FileMgr.getOptionalFileRef(Filename)};
 ModMap.addHeader(Mod, H, HeaderRole, /*Imported*/true);
 HFI.isModuleHeader |= ModuleMap::isModular(HeaderRole);
   }
@@ -5661,7 +5661,7 @@
   //`Headers/`, so this path will never exist.
   std::string Filename = std::string(Blob);
   ResolveImportedPath(F, Filename);
-  if (auto Umbrella = PP.getFileManager().getFile(Filename)) {
+  if (auto Umbrella = PP.getFileManager().getOptionalFileRef(Filename)) {
 if (!CurrentModule->getUmbrellaHeader()) {
   // FIXME: NameAsWritten
   ModMap.setUmbrellaHeader(CurrentModule, *Umbrella, Blob, "");
Index: clang/lib/Sema/SemaModule.cpp
===
--- clang/lib/Sema/SemaModule.cpp
+++ clang/lib/Sema/SemaModule.cpp
@@ -120,12 +120,12 @@
   // TODO: Make the C++20 header lookup independent.
   // When the input is pre-processed source, we need a file ref to the original
   // file for the header map.
-  auto F = SourceMgr.getFileManager().getFile(HUName);
+  auto F = SourceMgr.getFileManager().getOptionalFileRef(HUName);
   // For the sake of error recovery (if someone has moved the original header
   // after creating the pre-processed output) fall back to obtaining the file
   // ref for the input file, which must be present.
   if (!F)
-F = SourceMgr.getFileEntryForID(SourceMgr.getMainFileID());
+F = SourceMgr.getFileEntryRefForID(SourceMgr.getMainFileID());
   assert(F && "failed to find the header unit source?");
   Module::Header H{HUName.str(), HUName.str(), *F};
   auto &Map = PP.getHeaderSearchInfo().getModuleMap();
Index: clang/lib/Lex/ModuleMap.cpp
===
--- clang/lib/Lex/ModuleMap.cpp
+++ clang/lib/Lex/ModuleMap.cpp
@@ -304,7 +304,7 @@
   // supplied by Clang. Find that builtin header.
   SmallString<128> Path;
   llvm::sys::path::append(Path, BuiltinIncludeDir->getName(), Header.FileName);
-  auto File = SourceMgr.getFileManager().getFile(Path);
+  auto File = SourceMgr.getFileManager().getOptionalFileRef(Path);
   if (!File)
 return false;
 
@@ -1024,7 +1024,7 @@
   // Look for an umbrella header.
   SmallString<128> UmbrellaName = StringRef(FrameworkDir->getName());
   llvm::sys::path::append(UmbrellaName, "Headers", ModuleName + ".h");
-  auto UmbrellaHeader = FileMgr.getFile(UmbrellaName);
+  auto UmbrellaHeader = FileMgr.getOptionalFileRef(UmbrellaName);
 
   // FIXME: If there's no umbrella header, we could probably scan the
   // framework to load *everything*. But, it's not clear that this is a good
@@ -1136,14 +1136,14 @@
 }
 
 void ModuleMap::setUmbrellaHeader(
-Module *Mod, const FileEntry *UmbrellaHeader, const Twine &NameAsWritten,
+Module *Mod, FileEntryRef UmbrellaHeader, const Twine &NameAsWritten,
 const Twine &PathRelativeToRootModuleDirectory) {
   Headers[UmbrellaHeader].push_back(KnownHeader(Mod, NormalHeader));
-  Mod->Umbrella = UmbrellaHeader;
+  Mod->Umbrella = &UmbrellaHeader.getMapEntry();
   Mod->UmbrellaAsWritten = NameAsWritten.str();
   Mod->UmbrellaRelativeToRootModuleDirectory =
   PathRelativeToRootModuleDirectory.str();
-  UmbrellaDirs[UmbrellaHeader->getDir()] = Mod;
+  UmbrellaDirs[UmbrellaHeader.getDir()] = Mod;
 
   // Notify callbacks that we just added a new header.
   for (const auto &Cb : Callbacks)
@@ -2510,8 +2510,8 @@
 SourceMgr.getFileManager().getVirtualFileSystem();
 for (llvm::vfs::recursive_directory_iterator I(FS, Dir->getName(), EC), E;
  I != E && !EC; I.increment(EC)) {
-  if (auto FE = SourceMgr.getFileManager().getFile(I->path())) {
-Module::Header Header = {"", std::string(I->path()), *FE};
+  if (auto FE = SourceMgr.getFileManager().getOptionalFileRef(I->path())) {
+Module::Header Header = {"", std::string(I->path()), FE};
 Headers.push_back(std::move(Header));
   }
 }
Ind

[PATCH] D139774: [libclang] Add API to set temporary directory location

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

In D139774#4066920 , @dblaikie wrote:

> Don't let me hold this up - I think it all feels a bit too ad-hoc for my own 
> preferences (feels like there should be fairly general solutions to this - 
> rather than playing whack-a-mole on only the biggest temporary files - both 
> in terms of the options KDevelop developers have 
> considered/accepted/declined, and in terms of what's being proposed to be 
> added to Clang), but I don't feel strongly enough about any of that to 
> veto/push very hard here.

I think the general solution would be what's proposed here -- allow overriding 
the system temp directory at the LLVM filesystem API level. But that continues 
to feel wrong to me -- asking for the system temp directory should get you the 
system temp directory. For example, nothing says that libclang's need for the 
temp directory is the same as someone else using the LLVM filesystem APIs 
within the same library but for totally unrelated purposes. It seems like the 
wrong layer at which to add this logic -- the base API should get you the 
system directory, and the caller should be responsible for deciding if they 
wanted something different than that or not. I realize that turns into a bit of 
a game of whack-a-mole to find all of the places where we make such decisions, 
but that seems like the more correct approach to me. If we want this to be 
controlled by the programmer (and it sounds like KDevelop has very good reasons 
to want this to be controlled), I think it should become a part of the API 
interface rather than a hidden one-time setter that impacts the entire process.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139774

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


[PATCH] D139774: [libclang] Add API to set temporary directory location

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



Comment at: llvm/lib/Support/Unix/Path.inc:1450
 
 void system_temp_directory(bool ErasedOnReboot, SmallVectorImpl &Result) 
{
   Result.clear();

So I was asked to take a look at this, and I believe that changing this 
function is absolutely the wrong approach.  The purpose of this API is to be 
used to get what the system/terminal owner has set as the temporary directory.  
Allowing a user of the API to change the meaning of this is improper.

If we want to change where certain files are stored, the logic for that needs 
to happen at a higher level than this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139774

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


[PATCH] D142187: [clang] Fix typos in member initializers

2023-01-20 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments.



Comment at: clang/lib/Sema/SemaDeclCXX.cpp:4101
 
-  ExprResult Init = InitExpr;
-  if (!FD->getType()->isDependentType() && !InitExpr->isTypeDependent()) {
-Init = ConvertMemberDefaultInitExpression(FD, InitExpr, InitLoc);
+  ExprResult Init = CorrectDelayedTyposInExpr(InitExpr, /*InitDecl=*/nullptr,
+  
/*RecoverUncorrectedTypos=*/true);

kadircet wrote:
> ilya-biryukov wrote:
> > Should we pass `FD` here to avoid correcting to itself?
> unfortunately the interface requires a VarDecl, hence we can't pass a 
> FieldDecl.
Ah, it also does not seem to suggest any `FieldDecl`s for typo correction. 
Nevermind then, sorry for the noise.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142187

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


[PATCH] D141581: [clang] Make clangBasic and clangDriver depend on LLVMTargetParser.

2023-01-20 Thread Tom Stellard via Phabricator via cfe-commits
tstellar added a comment.

Is LLVMTargetParser a library

In D141581#4057177 , @fpetrogalli 
wrote:

> In D141581#4056825 , @barannikov88 
> wrote:
>
>> clangBasic and clangDriver already have a dependency on TargetParser (see 
>> LLVM_LINK_COMPONENTS at the beginning of corresponding files). Is that not 
>> enough?
>> Will it build if you just remove the additional dependency?
>
> No - if we just specify the dependency in `LLVM_LINK_COMPONENTS`, there are 
> build failures, as explained in the commit message of 
> https://reviews.llvm.org/rGac1ffd3caca12c254e0b8c847aa8ce8e51b6cfbf.

It's still not clear to me why LLVM_LINK_COMPONENTS does not work.  Is 
LLVMTargetParser a library?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141581

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


[PATCH] D140805: [clang][Interp] Add ArrayElemPtr{,Pop} opcode

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

LGTM!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140805

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


[PATCH] D141581: [clang] Make clangBasic and clangDriver depend on LLVMTargetParser.

2023-01-20 Thread Tom Stellard via Phabricator via cfe-commits
tstellar added a comment.

So, what's the actual dependency here?  Do libBasic and libDriver just need the 
header to be generated or does it actually need to link to the library?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141581

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


[PATCH] D141581: [clang] Make clangBasic and clangDriver depend on LLVMTargetParser.

2023-01-20 Thread Francesco Petrogalli via Phabricator via cfe-commits
fpetrogalli added a comment.

In D141581#4069053 , @tstellar wrote:

> [...]
> It's still not clear to me why LLVM_LINK_COMPONENTS does not work.  Is 
> LLVMTargetParser a library?

Yes, `LLVMTargetParser` is a library built located in `llvm/lib/TargetParser`. 
`LLVM_LINK_COMPONENTS` does not work if `clangBasic` or  `clangDriver` start 
building before `LLVMTargetParser`, because the header file 
`llvm/TargetParser/RISCVTargetParserDefs.inc` has not been generated yet. This 
didn't happen on my local build, but on some bot I had the following error 
reported even if `TargetParser` was added to `LLVM_LINK_COMPONENTS`.

/llvm-project/llvm/include/llvm/TargetParser/RISCVTargetParser.h:29:10:
 fatal error: llvm/TargetParser/RISCVTargetParserDef.inc: No such file or 
directory

  29 | #include "llvm/TargetParser/RISCVTargetParserDef.inc"
 |  ^~~~

By adding `LLVMTargetParser` to the `DEPENDS` of `clangBasic` and `clangDriver` 
it seems that the order of building LLVMTargetParser before any of the 
dependents is enforced.

To put in other words, it seems that just specifying` LINK_COMPONENTS = A` for 
a library `B` allows `A` and `B` to be built in parallel.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141581

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


[PATCH] D141581: [clang] Make clangBasic and clangDriver depend on LLVMTargetParser.

2023-01-20 Thread Francesco Petrogalli via Phabricator via cfe-commits
fpetrogalli added a comment.

In D141581#4069078 , @tstellar wrote:

> So, what's the actual dependency here?  Do libBasic and libDriver just need 
> the header to be generated or does it actually need to link to the library?

Just the header.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141581

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


[PATCH] D142181: [OptTable] Store llvm::cl::Option into a DenseMap instead of a StringMap

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

  FAILED: 
tools/mlir/test/lib/Dialect/Linalg/CMakeFiles/MLIRLinalgTestPasses.dir/TestLinalgHoisting.cpp.o
  CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /usr/bin/clang++ 
-DBUILD_EXAMPLES -DGTEST_HAS_RTTI=0 -DMLIR_CUDA_CONVERSIONS_ENABLED=1 
-DMLIR_INCLUDE_TESTS -DMLIR_ROCM_CONVERSIONS_ENABLED=1 -D_DEBUG -D_GNU_SOURCE 
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-Itools/mlir/test/lib/Dialect/Linalg 
-I/var/lib/buildkite-agent/builds/llvm-project/mlir/test/lib/Dialect/Linalg 
-Iinclude -I/var/lib/buildkite-agent/builds/llvm-project/llvm/include 
-I/var/lib/buildkite-agent/builds/llvm-project/mlir/include 
-Itools/mlir/include -gmlt -fPIC -fno-semantic-interposition 
-fvisibility-inlines-hidden -Werror=date-time 
-Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter 
-Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic 
-Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough 
-Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor 
-Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion 
-Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color 
-ffunction-sections -fdata-sections -Werror=mismatched-tags -O3 -DNDEBUG  
-fno-exceptions -fno-rtti -UNDEBUG -std=c++17 -MD -MT 
tools/mlir/test/lib/Dialect/Linalg/CMakeFiles/MLIRLinalgTestPasses.dir/TestLinalgHoisting.cpp.o
 -MF 
tools/mlir/test/lib/Dialect/Linalg/CMakeFiles/MLIRLinalgTestPasses.dir/TestLinalgHoisting.cpp.o.d
 -o 
tools/mlir/test/lib/Dialect/Linalg/CMakeFiles/MLIRLinalgTestPasses.dir/TestLinalgHoisting.cpp.o
 -c 
/var/lib/buildkite-agent/builds/llvm-project/mlir/test/lib/Dialect/Linalg/TestLinalgHoisting.cpp
  In file included from 
/var/lib/buildkite-agent/builds/llvm-project/mlir/test/lib/Dialect/Linalg/TestLinalgHoisting.cpp:17:
  In file included from 
/var/lib/buildkite-agent/builds/llvm-project/mlir/include/mlir/Pass/Pass.h:13:
  In file included from 
/var/lib/buildkite-agent/builds/llvm-project/mlir/include/mlir/Pass/PassRegistry.h:17:
  In file included from 
/var/lib/buildkite-agent/builds/llvm-project/mlir/include/mlir/Pass/PassOptions.h:21:
  
/var/lib/buildkite-agent/builds/llvm-project/llvm/include/llvm/Support/CommandLine.h:1254:66:
 error: no member named 'apply' in 'llvm::StringRef'
template  static void opt(const Mod &M, Opt &O) { M.apply(O); }
 ~ ^
  
/var/lib/buildkite-agent/builds/llvm-project/llvm/include/llvm/Support/CommandLine.h:1302:20:
 note: in instantiation of function template specialization 
'llvm::cl::applicator::opt>' requested here
applicator::opt(M, *O);
 ^
  
/var/lib/buildkite-agent/builds/llvm-project/llvm/include/llvm/Support/CommandLine.h:1494:5:
 note: in instantiation of function template specialization 
'llvm::cl::apply, llvm::StringRef, llvm::cl::sub, 
llvm::cl::desc, llvm::cl::initializer>' requested here
  apply(this, Ms...);
  ^
  
/var/lib/buildkite-agent/builds/llvm-project/mlir/include/mlir/Pass/PassOptions.h:164:11:
 note: in instantiation of function template specialization 
'llvm::cl::opt::opt>' requested here
  : llvm::cl::opt(
^
  
/var/lib/buildkite-agent/builds/llvm-project/mlir/include/mlir/Pass/Pass.h:98:11:
 note: in instantiation of function template specialization 
'mlir::detail::PassOptions::Option>::Option>' 
requested here
  : detail::PassOptions::Option(
^
  
/var/lib/buildkite-agent/builds/llvm-project/mlir/test/lib/Dialect/Linalg/TestLinalgHoisting.cpp:39:43:
 note: in instantiation of function template specialization 
'mlir::Pass::Option>::Option>' requested here
Option testHoistRedundantTransfers{
^
  1 error generated.


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

https://reviews.llvm.org/D142181

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


[PATCH] D142222: [PowerPC] Remove the lax warning for explicit casts

2023-01-20 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo created this revision.
Herald added subscribers: shchenz, nemanjai.
Herald added a project: All.
maryammo requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch is to remove the erroneous lax vector conversion warning for CStyle; 
explicit; casts
that was added as part of D126540 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D14

Files:
  clang/lib/Sema/SemaOverload.cpp
  clang/test/Parser/cxx-altivec.cpp
  clang/test/Parser/lax-conv.cpp

Index: clang/test/Parser/lax-conv.cpp
===
--- /dev/null
+++ clang/test/Parser/lax-conv.cpp
@@ -0,0 +1,58 @@
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +altivec -target-feature +vsx -fsyntax-only -verify=expected,nonaix %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature +altivec -target-feature -vsx -fsyntax-only -verify=expected,novsx %s
+// RUN: %clang_cc1 -triple=powerpc64-ibm-aix -target-feature +altivec -target-feature -vsx -fsyntax-only -verify=expected,aix %s
+
+void dummy(vector unsigned int a);
+
+vector unsigned int test1(vector unsigned char RetImplicitConv) {
+  return RetImplicitConv; // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}} 
+}
+vector unsigned int test2(vector unsigned char RetImplicitConvAddConst) {
+  return RetImplicitConvAddConst + 5; // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}} 
+}
+vector unsigned int test3(vector unsigned char RetExplicitConv) {
+  return (vector unsigned int)RetExplicitConv;
+}
+vector unsigned int test4(vector unsigned char RetExplicitConvAddConst) {
+  return (vector unsigned int)RetExplicitConvAddConst + 5;
+}
+vector unsigned int test5(vector unsigned char RetImplicitConvAddSame1,
+  vector unsigned char RetImplicitConvAddSame2) {
+  return RetImplicitConvAddSame1 + RetImplicitConvAddSame2; // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}} 
+}
+vector unsigned int test6(vector unsigned char RetExplicitConvAddSame1,
+  vector unsigned char RetExplicitConvAddSame2) {
+  return (vector unsigned int)RetExplicitConvAddSame1 +
+ (vector unsigned int)RetExplicitConvAddSame2;
+}
+vector unsigned int test7(vector unsigned char RetExplicitConvAddSame1Full,
+  vector unsigned char RetExplicitConvAddSame2Full) {
+  return (vector unsigned int)(RetExplicitConvAddSame1Full +
+   RetExplicitConvAddSame2Full);
+}
+void test1a(vector unsigned char ArgImplicitConv) {
+  return dummy(ArgImplicitConv); // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}}
+}
+void test2a(vector unsigned char ArgImplicitConvAddConst) {
+  return dummy(ArgImplicitConvAddConst + 5); // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}}
+}
+void test3a(vector unsigned char ArgExplicitConv) {
+  return dummy((vector unsigned int)ArgExplicitConv);
+}
+void test4a(vector unsigned char ArgExplicitConvAddConst) {
+  return dummy((vector unsigned int)ArgExplicitConvAddConst + 5);
+}
+void test5a(vector unsigned char ArgImplicitConvAddSame1,
+vector unsigned char ArgImplicitConvAddSame2) {
+  return dummy(ArgImplicitConvAddSame1 + ArgImplicitConvAddSame2); // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}}
+}
+void test6a(vector unsigned char ArgExplicitConvAddSame1,
+vector unsigned char ArgExplicitConvAddS

[PATCH] D141581: [clang] Make clangBasic and clangDriver depend on LLVMTargetParser.

2023-01-20 Thread Tom Stellard via Phabricator via cfe-commits
tstellar added a comment.

I don't think this is the correct way to specify dependencies if it's just an 
issue of the header being included before a generated file it needs has been 
generated.  Are there other places in the code where a generated header file is 
included by another header?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141581

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


cfe-commits@lists.llvm.org

2023-01-20 Thread David K Turner via Phabricator via cfe-commits
dkt01 marked an inline comment as done.
dkt01 added inline comments.



Comment at: clang/lib/Format/TokenAnnotator.cpp:2544
   SmallVector Contexts;
+  static SmallVector Scopes;
 

HazardyKnusperkeks wrote:
> dkt01 wrote:
> > HazardyKnusperkeks wrote:
> > > Why static?
> > The AnnotatingParser object lifetime is too short to track the scope 
> > information I wanted.  From my testing, it seems like this object is 
> > created once per line.  This is why I haven't added the scope information 
> > as part of the contexts member.
> > 
> > I would like to make this a non-static member, but I'm not sure which 
> > object it should be a member of.  Do you have a recommendation?
> The `TokenAnnotator`? And then by reference to the parser.
I was over-thinking it...  Adding to `TokenAnnotator` works great!
I did have to re-introduce the size checks before popping scopes because 
otherwise the UnbalancedStructuralElements test fails.



Comment at: clang/unittests/Format/TokenAnnotatorTest.cpp:181
+  ASSERT_EQ(Tokens.size(), 5u) << Tokens;
+  EXPECT_TOKEN(Tokens[1], tok::amp, TT_BinaryOperator);
+

HazardyKnusperkeks wrote:
> dkt01 wrote:
> > MyDeveloperDay wrote:
> > > how does this differentiate from 
> > > 
> > > `MyType & val2;`
> > > 
> > > is that a binary operator? I don't think so?
> > The heuristic I'm using is that [symbol] & [symbol]; outside a class/struct 
> > declaration is more likely an instance of operator& than an uninitialized 
> > reference.  Tests on line 206 and 215 demonstrate how the two cases differ.
> > The heuristic I'm using is that [symbol] & [symbol]; outside a class/struct 
> > declaration is more likely an instance of operator& than an uninitialized 
> > reference.  Tests on line 206 and 215 demonstrate how the two cases differ.
> 
> I'm with this one. A reference without initialization is an error.
> 
> Can you add a test with an assignment, I didn't see one right now.
Added two new tests for assignment to pointer using unary operator & and 
initializing assignment to reference because neither of these assignments was 
in existing format tests I could find.


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

https://reviews.llvm.org/D141959

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


cfe-commits@lists.llvm.org

2023-01-20 Thread David K Turner via Phabricator via cfe-commits
dkt01 updated this revision to Diff 490859.
dkt01 added a comment.

Changes as suggested by HazardyKnusperkeks in review.


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

https://reviews.llvm.org/D141959

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

Index: clang/unittests/Format/TokenAnnotatorTest.cpp
===
--- clang/unittests/Format/TokenAnnotatorTest.cpp
+++ clang/unittests/Format/TokenAnnotatorTest.cpp
@@ -175,6 +175,57 @@
   ASSERT_EQ(Tokens.size(), 17u) << Tokens;
   EXPECT_TOKEN(Tokens[9], tok::ampamp, TT_PointerOrReference);
   EXPECT_TOKEN(Tokens[12], tok::ampamp, TT_PointerOrReference);
+
+  Tokens = annotate("Type1 &val1 = val2;");
+  ASSERT_EQ(Tokens.size(), 7u) << Tokens;
+  EXPECT_TOKEN(Tokens[1], tok::amp, TT_PointerOrReference);
+
+  Tokens = annotate("Type1 *val1 = &val2;");
+  ASSERT_EQ(Tokens.size(), 8u) << Tokens;
+  EXPECT_TOKEN(Tokens[1], tok::star, TT_PointerOrReference);
+  EXPECT_TOKEN(Tokens[4], tok::amp, TT_UnaryOperator);
+
+  Tokens = annotate("val1 & val2;");
+  ASSERT_EQ(Tokens.size(), 5u) << Tokens;
+  EXPECT_TOKEN(Tokens[1], tok::amp, TT_BinaryOperator);
+
+  Tokens = annotate("val1 & val2.member;");
+  ASSERT_EQ(Tokens.size(), 7u) << Tokens;
+  EXPECT_TOKEN(Tokens[1], tok::amp, TT_BinaryOperator);
+
+  Tokens = annotate("val1 & val2 & val3;");
+  ASSERT_EQ(Tokens.size(), 7u) << Tokens;
+  EXPECT_TOKEN(Tokens[1], tok::amp, TT_BinaryOperator);
+  EXPECT_TOKEN(Tokens[3], tok::amp, TT_BinaryOperator);
+
+  Tokens = annotate("val1 & val2 // comment\n"
+" & val3;");
+  ASSERT_EQ(Tokens.size(), 8u) << Tokens;
+  EXPECT_TOKEN(Tokens[1], tok::amp, TT_BinaryOperator);
+  EXPECT_TOKEN(Tokens[4], tok::amp, TT_BinaryOperator);
+
+  Tokens =
+  annotate("val1 & val2.member & val3.member() & val4 & val5->member;");
+  ASSERT_EQ(Tokens.size(), 19u) << Tokens;
+  EXPECT_TOKEN(Tokens[1], tok::amp, TT_BinaryOperator);
+  EXPECT_TOKEN(Tokens[5], tok::amp, TT_BinaryOperator);
+  EXPECT_TOKEN(Tokens[11], tok::amp, TT_BinaryOperator);
+  EXPECT_TOKEN(Tokens[13], tok::amp, TT_BinaryOperator);
+
+  Tokens = annotate("class c {\n"
+"  void func(type &a) { a & member; }\n"
+"  anotherType &member;\n"
+"}");
+  ASSERT_EQ(Tokens.size(), 22u) << Tokens;
+  EXPECT_TOKEN(Tokens[7], tok::amp, TT_PointerOrReference);
+  EXPECT_TOKEN(Tokens[12], tok::amp, TT_BinaryOperator);
+  EXPECT_TOKEN(Tokens[17], tok::amp, TT_PointerOrReference);
+
+  Tokens = annotate("struct S {\n"
+"  auto Mem = C & D;\n"
+"}");
+  ASSERT_EQ(Tokens.size(), 12u) << Tokens;
+  EXPECT_TOKEN(Tokens[7], tok::amp, TT_BinaryOperator);
 }
 
 TEST_F(TokenAnnotatorTest, UnderstandsUsesOfPlusAndMinus) {
Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -11267,6 +11267,13 @@
 
   verifyFormat("int operator()(T (&&)[N]) { return 1; }");
   verifyFormat("int operator()(T (&)[N]) { return 0; }");
+
+  verifyFormat("val1 & val2;");
+  verifyFormat("val1 & val2 & val3;");
+  verifyFormat("class c {\n"
+   "  void func(type &a) { a & member; }\n"
+   "  anotherType &member;\n"
+   "}");
 }
 
 TEST_F(FormatTest, UnderstandsAttributes) {
Index: clang/lib/Format/TokenAnnotator.h
===
--- clang/lib/Format/TokenAnnotator.h
+++ clang/lib/Format/TokenAnnotator.h
@@ -170,17 +170,27 @@
 /// \c UnwrappedLine.
 class TokenAnnotator {
 public:
-  TokenAnnotator(const FormatStyle &Style, const AdditionalKeywords &Keywords)
-  : Style(Style), Keywords(Keywords) {}
+  TokenAnnotator(const FormatStyle &Style, const AdditionalKeywords &Keywords);
 
   /// Adapts the indent levels of comment lines to the indent of the
   /// subsequent line.
   // FIXME: Can/should this be done in the UnwrappedLineParser?
   void setCommentLineLevels(SmallVectorImpl &Lines) const;
 
-  void annotate(AnnotatedLine &Line) const;
+  void annotate(AnnotatedLine &Line);
   void calculateFormattingInformation(AnnotatedLine &Line) const;
 
+  enum class ScopeType : std::int8_t {
+// Not contained within scope block.
+None,
+// Contained in class declaration/definition.
+Class,
+// Contained within function definition.
+Function,
+// Contained within other scope block (loop, if/else, etc).
+Other,
+  };
+
 private:
   /// Calculate the penalty for splitting before \c Tok.
   unsigned splitPenalty(const AnnotatedLine &Line, const FormatToken &Tok,
@@ -220,6 +230,8 @@
   const FormatStyle &Style;
 
   const AdditionalKeywords &Keywords;
+
+  SmallVector Scopes;
 };
 
 } // end namespace

[PATCH] D141581: [clang] Make clangBasic and clangDriver depend on LLVMTargetParser.

2023-01-20 Thread Francesco Petrogalli via Phabricator via cfe-commits
fpetrogalli added a comment.

In D141581#4069123 , @tstellar wrote:

> I don't think this is the correct way to specify dependencies if it's just an 
> issue of the header being included before a generated file it needs has been 
> generated.  Are there other places in the code where a generated header file 
> is included by another header?



  % grep -r "RISCVTargetParser.h" *
  include/llvm/module.modulemap:header "TargetParser/RISCVTargetParser.h"
  lib/Target/RISCV/RISCVISelLowering.h:#include 
"llvm/TargetParser/RISCVTargetParser.h"
  lib/TargetParser/RISCVTargetParser.cpp:#include 
"llvm/TargetParser/RISCVTargetParser.h"

`RISCVTargetParser.h` is the one that references the generated file via :

  enum CPUKind : unsigned {
  #define PROC(ENUM, NAME, FEATURES, DEFAULT_MARCH) CK_##ENUM,
  #define TUNE_PROC(ENUM, NAME) CK_##ENUM,
  #include "llvm/TargetParser/RISCVTargetParserDef.inc"
  };


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141581

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


[PATCH] D124286: [modules] Allow parsing a duplicate Obj-C interface if a previous one comes from a hidden [sub]module.

2023-01-20 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai added a comment.

Thanks for the review, Bruno!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124286

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


[clang] 6ba4afb - [ODRHash] Hash `ObjCInterfaceDecl` and diagnose discovered mismatches.

2023-01-20 Thread Volodymyr Sapsai via cfe-commits

Author: Volodymyr Sapsai
Date: 2023-01-20T10:18:18-06:00
New Revision: 6ba4afb4d6f2f8f293ad704a37de4139c5c8c0f0

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

LOG: [ODRHash] Hash `ObjCInterfaceDecl` and diagnose discovered mismatches.

When two modules contain interfaces with the same name, check the
definitions are equivalent and diagnose if they are not.

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

Added: 
clang/test/Modules/compare-objc-interface.m

Modified: 
clang/include/clang/AST/DeclObjC.h
clang/include/clang/AST/ODRDiagsEmitter.h
clang/include/clang/AST/ODRHash.h
clang/include/clang/Basic/DiagnosticASTKinds.td
clang/include/clang/Serialization/ASTReader.h
clang/lib/AST/DeclObjC.cpp
clang/lib/AST/ODRDiagsEmitter.cpp
clang/lib/AST/ODRHash.cpp
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTReaderDecl.cpp
clang/lib/Serialization/ASTWriter.cpp
clang/lib/Serialization/ASTWriterDecl.cpp
clang/test/Modules/interface-diagnose-missing-import.m
clang/test/Modules/method_pool.m

Removed: 




diff  --git a/clang/include/clang/AST/DeclObjC.h 
b/clang/include/clang/AST/DeclObjC.h
index 7c72ec9507bf1..77fde99b6b60b 100644
--- a/clang/include/clang/AST/DeclObjC.h
+++ b/clang/include/clang/AST/DeclObjC.h
@@ -1146,6 +1146,7 @@ class ObjCContainerDecl : public NamedDecl, public 
DeclContext {
 class ObjCInterfaceDecl : public ObjCContainerDecl
 , public Redeclarable {
   friend class ASTContext;
+  friend class ODRDiagsEmitter;
 
   /// TypeForDecl - This indicates the Type object that represents this
   /// TypeDecl.  It is a cache maintained by ASTContext::getObjCInterfaceType
@@ -1203,6 +1204,12 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
 /// One of the \c InheritedDesignatedInitializersState enumeratos.
 mutable unsigned InheritedDesignatedInitializers : 2;
 
+/// Tracks whether a ODR hash has been computed for this interface.
+unsigned HasODRHash : 1;
+
+/// A hash of parts of the class to help in ODR checking.
+unsigned ODRHash = 0;
+
 /// The location of the last location in this declaration, before
 /// the properties/methods. For example, this will be the '>', '}', or
 /// identifier,
@@ -1211,7 +1218,7 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
 DefinitionData()
 : ExternallyCompleted(false), IvarListMissingImplementation(true),
   HasDesignatedInitializers(false),
-  InheritedDesignatedInitializers(IDI_Unknown) {}
+  InheritedDesignatedInitializers(IDI_Unknown), HasODRHash(false) {}
   };
 
   /// The type parameters associated with this class, if any.
@@ -1892,10 +1899,17 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
   const Type *getTypeForDecl() const { return TypeForDecl; }
   void setTypeForDecl(const Type *TD) const { TypeForDecl = TD; }
 
+  /// Get precomputed ODRHash or add a new one.
+  unsigned getODRHash();
+
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classofKind(Kind K) { return K == ObjCInterface; }
 
 private:
+  /// True if a valid hash is stored in ODRHash.
+  bool hasODRHash() const;
+  void setHasODRHash(bool HasHash);
+
   const ObjCInterfaceDecl *findInterfaceWithDesignatedInitializers() const;
   bool inheritsDesignatedInitializers() const;
 };

diff  --git a/clang/include/clang/AST/ODRDiagsEmitter.h 
b/clang/include/clang/AST/ODRDiagsEmitter.h
index 00a681b78a5eb..fdbd85cb10e5b 100644
--- a/clang/include/clang/AST/ODRDiagsEmitter.h
+++ b/clang/include/clang/AST/ODRDiagsEmitter.h
@@ -51,6 +51,13 @@ class ODRDiagsEmitter {
   bool diagnoseMismatch(const RecordDecl *FirstRecord,
 const RecordDecl *SecondRecord) const;
 
+  /// Diagnose ODR mismatch between 2 ObjCInterfaceDecl.
+  ///
+  /// Returns true if found a mismatch and diagnosed it.
+  bool diagnoseMismatch(
+  const ObjCInterfaceDecl *FirstID, const ObjCInterfaceDecl *SecondID,
+  const struct ObjCInterfaceDecl::DefinitionData *SecondDD) const;
+
   /// Diagnose ODR mismatch between 2 ObjCProtocolDecl.
   ///
   /// Returns true if found a mismatch and diagnosed it.
@@ -97,6 +104,7 @@ class ODRDiagsEmitter {
 Friend,
 FunctionTemplate,
 ObjCMethod,
+ObjCIvar,
 ObjCProperty,
 Other
   };

diff  --git a/clang/include/clang/AST/ODRHash.h 
b/clang/include/clang/AST/ODRHash.h
index a489bb73deb67..cedf644520fc3 100644
--- a/clang/include/clang/AST/ODRHash.h
+++ b/clang/include/clang/AST/ODRHash.h
@@ -59,6 +59,10 @@ class ODRHash {
   // method compares more information than the AddDecl class.
   void AddRecordDecl(const RecordDecl *Record);
 
+  // Use this for ODR checking ObjC interfaces. Th

[clang] ed7a46a - [modules] Allow parsing a duplicate Obj-C interface if a previous one comes from a hidden [sub]module.

2023-01-20 Thread Volodymyr Sapsai via cfe-commits

Author: Volodymyr Sapsai
Date: 2023-01-20T10:18:18-06:00
New Revision: ed7a46a8de77087447936965044e2faf734102e5

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

LOG: [modules] Allow parsing a duplicate Obj-C interface if a previous one 
comes from a hidden [sub]module.

Instead of emitting a redefinition error, check that definitions are
equivalent and allow such scenario.

A few non-obvious implementation details:
* to avoid multiple definitions in the redeclaration chain we just drop
  the new definition after checking for equivalence;
* for checking definition equivalence use ODR hash instead of
  ASTStructuralEquivalence because it avoids excessive recursive
  deserialization. Though after detecting a mismatch we do deserialize
  multiple entities to provide a better error message.

rdar://82908223

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

Added: 


Modified: 
clang/include/clang/AST/DeclObjC.h
clang/include/clang/AST/ODRDiagsEmitter.h
clang/include/clang/Basic/DiagnosticASTKinds.td
clang/include/clang/Sema/Sema.h
clang/lib/AST/DeclObjC.cpp
clang/lib/AST/ODRDiagsEmitter.cpp
clang/lib/Parse/ParseObjc.cpp
clang/lib/Sema/SemaDeclObjC.cpp
clang/test/Modules/compare-objc-interface.m
clang/test/Modules/hidden-duplicates.m

Removed: 




diff  --git a/clang/include/clang/AST/DeclObjC.h 
b/clang/include/clang/AST/DeclObjC.h
index 77fde99b6b60b..3d650b82f2b9b 100644
--- a/clang/include/clang/AST/DeclObjC.h
+++ b/clang/include/clang/AST/DeclObjC.h
@@ -1542,6 +1542,13 @@ class ObjCInterfaceDecl : public ObjCContainerDecl
   /// a forward declaration (\@class) to a definition (\@interface).
   void startDefinition();
 
+  /// Starts the definition without sharing it with other redeclarations.
+  /// Such definition shouldn't be used for anything but only to compare if
+  /// a duplicate is compatible with previous definition or if it is
+  /// a distinct duplicate.
+  void startDuplicateDefinitionForComparison();
+  void mergeDuplicateDefinitionWithCommon(const ObjCInterfaceDecl *Definition);
+
   /// Retrieve the superclass type.
   const ObjCObjectType *getSuperClassType() const {
 if (TypeSourceInfo *TInfo = getSuperClassTInfo())

diff  --git a/clang/include/clang/AST/ODRDiagsEmitter.h 
b/clang/include/clang/AST/ODRDiagsEmitter.h
index fdbd85cb10e5b..1f7faaa06e540 100644
--- a/clang/include/clang/AST/ODRDiagsEmitter.h
+++ b/clang/include/clang/AST/ODRDiagsEmitter.h
@@ -58,6 +58,15 @@ class ODRDiagsEmitter {
   const ObjCInterfaceDecl *FirstID, const ObjCInterfaceDecl *SecondID,
   const struct ObjCInterfaceDecl::DefinitionData *SecondDD) const;
 
+  /// Diagnose ODR mismatch between ObjCInterfaceDecl with 
diff erent
+  /// definitions.
+  bool diagnoseMismatch(const ObjCInterfaceDecl *FirstID,
+const ObjCInterfaceDecl *SecondID) const {
+assert(FirstID->data().Definition != SecondID->data().Definition &&
+   "Don't diagnose 
diff erences when definitions are merged already");
+return diagnoseMismatch(FirstID, SecondID, &SecondID->data());
+  }
+
   /// Diagnose ODR mismatch between 2 ObjCProtocolDecl.
   ///
   /// Returns true if found a mismatch and diagnosed it.

diff  --git a/clang/include/clang/Basic/DiagnosticASTKinds.td 
b/clang/include/clang/Basic/DiagnosticASTKinds.td
index 715249b9d6f5e..28120d13fd9e7 100644
--- a/clang/include/clang/Basic/DiagnosticASTKinds.td
+++ b/clang/include/clang/Basic/DiagnosticASTKinds.td
@@ -624,12 +624,12 @@ def err_module_odr_violation_objc_interface : Error <
 "%select{|@private|@protected|@public|@package}5"
   "}3">;
 def note_module_odr_violation_objc_interface : Note <
-  "but in '%0' found "
+  "but in %select{'%1'|definition here}0 found "
   "%select{"
-  "%select{no super class|super class with type %3}2|"
-  "instance variable '%2' access control is "
-"%select{|@private|@protected|@public|@package}3"
-  "}1">;
+  "%select{no super class|super class with type %4}3|"
+  "instance variable '%3' access control is "
+"%select{|@private|@protected|@public|@package}4"
+  "}2">;
 
 def err_module_odr_violation_template_parameter : Error <
   "%q0 has 
diff erent definitions in 
diff erent modules; first 
diff erence is "
@@ -778,16 +778,17 @@ def err_module_odr_violation_field : Error<
   "field %4 with %select{no|an}5 initalizer|"
   "field %4 with an initializer"
   "}3">;
-def note_module_odr_violation_field : Note<"but in '%0' found "
+def note_module_odr_violation_field : Note<
+  "but in %select{'%1'|definition here}0 found "
   "%select{"
-  "field %2|"
-  "field %2 with type %3|"
-  "%select{non-|}3bitfield %2|"
-  "bitfield %2 with 
diff erent width expression|"
-  "%select{non-|}3mutable field %2|"
-  "field %2 with

[PATCH] D140073: [ODRHash] Hash `ObjCInterfaceDecl` and diagnose discovered mismatches.

2023-01-20 Thread Volodymyr Sapsai via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6ba4afb4d6f2: [ODRHash] Hash `ObjCInterfaceDecl` and 
diagnose discovered mismatches. (authored by vsapsai).

Changed prior to commit:
  https://reviews.llvm.org/D140073?vs=487045&id=490868#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140073

Files:
  clang/include/clang/AST/DeclObjC.h
  clang/include/clang/AST/ODRDiagsEmitter.h
  clang/include/clang/AST/ODRHash.h
  clang/include/clang/Basic/DiagnosticASTKinds.td
  clang/include/clang/Serialization/ASTReader.h
  clang/lib/AST/DeclObjC.cpp
  clang/lib/AST/ODRDiagsEmitter.cpp
  clang/lib/AST/ODRHash.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTReaderDecl.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/lib/Serialization/ASTWriterDecl.cpp
  clang/test/Modules/compare-objc-interface.m
  clang/test/Modules/interface-diagnose-missing-import.m
  clang/test/Modules/method_pool.m

Index: clang/test/Modules/method_pool.m
===
--- clang/test/Modules/method_pool.m
+++ clang/test/Modules/method_pool.m
@@ -28,6 +28,8 @@
 }
 
 @import MethodPoolB;
+// expected-error@MethodPoolB.h:* {{'B' has different definitions in different modules; first difference is definition in module 'MethodPoolB' found no super class}}
+// expected-note@MethodPoolA.h:* {{but in 'MethodPoolA' found super class with type 'A'}}
 
 void testMethod1Again(id object) {
   [object method1];
Index: clang/test/Modules/interface-diagnose-missing-import.m
===
--- clang/test/Modules/interface-diagnose-missing-import.m
+++ clang/test/Modules/interface-diagnose-missing-import.m
@@ -1,7 +1,8 @@
 // RUN: rm -rf %t
 // RUN: %clang_cc1 %s -fsyntax-only -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -F%S/Inputs/interface-diagnose-missing-import -verify
 // expected-no-diagnostics
-@interface Buggy
+@interface NSObject @end
+@interface Buggy : NSObject
 @end
 
 @import Foo.Bar;
Index: clang/test/Modules/compare-objc-interface.m
===
--- /dev/null
+++ clang/test/Modules/compare-objc-interface.m
@@ -0,0 +1,424 @@
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+
+// Build first header file
+// RUN: echo "#define FIRST" >> %t/include/first.h
+// RUN: cat %t/test.m>> %t/include/first.h
+// RUN: echo "#undef FIRST"  >> %t/include/first.h
+
+// Build second header file
+// RUN: echo "#define SECOND" >> %t/include/second.h
+// RUN: cat %t/test.m >> %t/include/second.h
+// RUN: echo "#undef SECOND"  >> %t/include/second.h
+
+// Test that each header can compile
+// RUN: %clang_cc1 -fsyntax-only -x objective-c %t/include/first.h -fblocks -fobjc-arc
+// RUN: %clang_cc1 -fsyntax-only -x objective-c %t/include/second.h -fblocks -fobjc-arc
+
+// Run test
+// RUN: %clang_cc1 -I%t/include -verify %t/test.m -fblocks -fobjc-arc \
+// RUN:-fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache
+
+// Test that we don't accept different class definitions with the same name
+// from multiple modules but detect mismatches and provide actionable
+// diagnostic.
+
+//--- include/common.h
+#ifndef COMMON_H
+#define COMMON_H
+@interface NSObject @end
+@protocol CommonProtocol @end
+@protocol ExtraProtocol @end
+#endif
+
+//--- include/first-empty.h
+//--- include/module.modulemap
+module First {
+  module Empty {
+header "first-empty.h"
+  }
+  module Hidden {
+header "first.h"
+export *
+  }
+}
+module Second {
+  header "second.h"
+  export *
+}
+
+//--- test.m
+#if defined(FIRST) || defined(SECOND)
+# include "common.h"
+#endif
+
+#if !defined(FIRST) && !defined(SECOND)
+# include "first-empty.h"
+# include "second.h"
+#endif
+
+#if defined(FIRST)
+@class CompareForwardDeclaration1;
+@interface CompareForwardDeclaration2: NSObject @end
+#elif defined(SECOND)
+@interface CompareForwardDeclaration1: NSObject @end
+@class CompareForwardDeclaration2;
+#else
+CompareForwardDeclaration1 *compareForwardDeclaration1;
+CompareForwardDeclaration2 *compareForwardDeclaration2;
+#endif
+
+#if defined(FIRST)
+@interface CompareMatchingSuperclass: NSObject @end
+
+@interface CompareSuperclassPresence1: NSObject @end
+@interface CompareSuperclassPresence2 @end
+
+@interface CompareDifferentSuperclass: NSObject @end
+#elif defined(SECOND)
+@interface CompareMatchingSuperclass: NSObject @end
+
+@interface CompareSuperclassPresence1 @end
+@interface CompareSuperclassPresence2: NSObject @end
+
+@interface DifferentSuperclass: NSObject @end
+@interface CompareDifferentSuperclass: DifferentSuperclass @end
+#else
+CompareMatchingSuperclass *compareMatchingSuperclass;
+CompareSuperclassPresence1 *compareSuperclassPresence1;
+// expected-error@first.h:* {{'CompareSuperclassPresence1' has different defini

[PATCH] D124286: [modules] Allow parsing a duplicate Obj-C interface if a previous one comes from a hidden [sub]module.

2023-01-20 Thread Volodymyr Sapsai 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 rGed7a46a8de77: [modules] Allow parsing a duplicate Obj-C 
interface if a previous one comes… (authored by vsapsai).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124286

Files:
  clang/include/clang/AST/DeclObjC.h
  clang/include/clang/AST/ODRDiagsEmitter.h
  clang/include/clang/Basic/DiagnosticASTKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/DeclObjC.cpp
  clang/lib/AST/ODRDiagsEmitter.cpp
  clang/lib/Parse/ParseObjc.cpp
  clang/lib/Sema/SemaDeclObjC.cpp
  clang/test/Modules/compare-objc-interface.m
  clang/test/Modules/hidden-duplicates.m

Index: clang/test/Modules/hidden-duplicates.m
===
--- clang/test/Modules/hidden-duplicates.m
+++ clang/test/Modules/hidden-duplicates.m
@@ -30,6 +30,12 @@
 id forwardDeclaredProtocol(
 id t);
 
+@interface NSObject @end
+@class ForwardDeclaredInterfaceWithoutDefinition;
+
+NSObject *interfaceDefinition(NSObject *o);
+NSObject *forwardDeclaredInterface(NSObject *o);
+
 #endif
 
 //--- include/empty.h
Index: clang/test/Modules/compare-objc-interface.m
===
--- clang/test/Modules/compare-objc-interface.m
+++ clang/test/Modules/compare-objc-interface.m
@@ -19,6 +19,11 @@
 // RUN: %clang_cc1 -I%t/include -verify %t/test.m -fblocks -fobjc-arc \
 // RUN:-fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache
 
+// Run the same test with second.h being modular
+// RUN: cat %t/include/second.modulemap >> %t/include/module.modulemap
+// RUN: %clang_cc1 -I%t/include -verify %t/test.m -fblocks -fobjc-arc -DTEST_MODULAR=1 \
+// RUN:-fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache
+
 // Test that we don't accept different class definitions with the same name
 // from multiple modules but detect mismatches and provide actionable
 // diagnostic.
@@ -42,6 +47,8 @@
 export *
   }
 }
+
+//--- include/second.modulemap
 module Second {
   header "second.h"
   export *
@@ -87,13 +94,13 @@
 CompareMatchingSuperclass *compareMatchingSuperclass;
 CompareSuperclassPresence1 *compareSuperclassPresence1;
 // expected-error@first.h:* {{'CompareSuperclassPresence1' has different definitions in different modules; first difference is definition in module 'First.Hidden' found super class with type 'NSObject'}}
-// expected-note@second.h:* {{but in 'Second' found no super class}}
+// expected-note-re@second.h:* {{but in {{'Second'|definition here}} found no super class}}
 CompareSuperclassPresence2 *compareSuperclassPresence2;
 // expected-error@first.h:* {{'CompareSuperclassPresence2' has different definitions in different modules; first difference is definition in module 'First.Hidden' found no super class}}
-// expected-note@second.h:* {{but in 'Second' found super class with type 'NSObject'}}
+// expected-note-re@second.h:* {{but in {{'Second'|definition here}} found super class with type 'NSObject'}}
 CompareDifferentSuperclass *compareDifferentSuperclass;
 // expected-error@first.h:* {{'CompareDifferentSuperclass' has different definitions in different modules; first difference is definition in module 'First.Hidden' found super class with type 'NSObject'}}
-// expected-note@second.h:* {{but in 'Second' found super class with type 'DifferentSuperclass'}}
+// expected-note-re@second.h:* {{but in {{'Second'|definition here}} found super class with type 'DifferentSuperclass'}}
 #endif
 
 #if defined(FIRST)
@@ -122,17 +129,17 @@
 
 CompareProtocolPresence1 *compareProtocolPresence1;
 // expected-error@first.h:* {{'CompareProtocolPresence1' has different definitions in different modules; first difference is definition in module 'First.Hidden' found 1 referenced protocol}}
-// expected-note@second.h:* {{but in 'Second' found 0 referenced protocols}}
+// expected-note-re@second.h:* {{but in {{'Second'|definition here}} found 0 referenced protocols}}
 CompareProtocolPresence2 *compareProtocolPresence2;
 // expected-error@first.h:* {{'CompareProtocolPresence2' has different definitions in different modules; first difference is definition in module 'First.Hidden' found 0 referenced protocols}}
-// expected-note@second.h:* {{but in 'Second' found 1 referenced protocol}}
+// expected-note-re@second.h:* {{but in {{'Second'|definition here}} found 1 referenced protocol}}
 
 CompareDifferentProtocols *compareDifferentProtocols;
 // expected-error@first.h:* {{'CompareDifferentProtocols' has different definitions in different modules; first difference is definition in module 'First.Hidden' found 1st referenced protocol with name 'CommonProtocol'}}
-// expected-note@second.h:* {{but in 'Second' found 1st referenced protocol with different name 'ExtraProtocol'}}
+// expected-note-

[clang] cf17561 - [NFC] Reformat isBuiltinSupported with early exit

2023-01-20 Thread via cfe-commits

Author: serge-sans-paille
Date: 2023-01-20T17:20:14+01:00
New Revision: cf1756146d386667a80501fb8161505d12950804

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

LOG: [NFC] Reformat isBuiltinSupported with early exit

Added: 


Modified: 
clang/lib/Basic/Builtins.cpp

Removed: 




diff  --git a/clang/lib/Basic/Builtins.cpp b/clang/lib/Basic/Builtins.cpp
index 375f474f84ad6..c9426a7b0cf6c 100644
--- a/clang/lib/Basic/Builtins.cpp
+++ b/clang/lib/Basic/Builtins.cpp
@@ -64,37 +64,49 @@ bool Builtin::Context::isBuiltinFunc(llvm::StringRef 
FuncName) {
 /// Is this builtin supported according to the given language options?
 static bool builtinIsSupported(const Builtin::Info &BuiltinInfo,
const LangOptions &LangOpts) {
-  bool BuiltinsUnsupported =
-  LangOpts.NoBuiltin && strchr(BuiltinInfo.Attributes, 'f') != nullptr;
-  bool CorBuiltinsUnsupported =
-  !LangOpts.Coroutines && (BuiltinInfo.Langs & COR_LANG);
-  bool MathBuiltinsUnsupported =
-LangOpts.NoMathBuiltin && BuiltinInfo.HeaderName &&
-llvm::StringRef(BuiltinInfo.HeaderName).equals("math.h");
-  bool GnuModeUnsupported = !LangOpts.GNUMode && (BuiltinInfo.Langs & 
GNU_LANG);
-  bool MSModeUnsupported =
-  !LangOpts.MicrosoftExt && (BuiltinInfo.Langs & MS_LANG);
-  bool ObjCUnsupported = !LangOpts.ObjC && BuiltinInfo.Langs == OBJC_LANG;
-  bool OclCUnsupported =
-  !LangOpts.OpenCL && (BuiltinInfo.Langs & ALL_OCL_LANGUAGES);
-  bool OclGASUnsupported =
-  !LangOpts.OpenCLGenericAddressSpace && (BuiltinInfo.Langs & OCL_GAS);
-  bool OclPipeUnsupported =
-  !LangOpts.OpenCLPipes && (BuiltinInfo.Langs & OCL_PIPE);
+  if (bool BuiltinsUnsupported =
+  LangOpts.NoBuiltin && strchr(BuiltinInfo.Attributes, 'f') != nullptr)
+return false;
+  if (bool CorBuiltinsUnsupported =
+  !LangOpts.Coroutines && (BuiltinInfo.Langs & COR_LANG))
+return false;
+  if (bool MathBuiltinsUnsupported =
+  LangOpts.NoMathBuiltin && BuiltinInfo.HeaderName &&
+  llvm::StringRef(BuiltinInfo.HeaderName).equals("math.h"))
+return false;
+  if (bool GnuModeUnsupported =
+  !LangOpts.GNUMode && (BuiltinInfo.Langs & GNU_LANG))
+return false;
+  if (bool MSModeUnsupported =
+  !LangOpts.MicrosoftExt && (BuiltinInfo.Langs & MS_LANG))
+return false;
+  if (bool ObjCUnsupported = !LangOpts.ObjC && BuiltinInfo.Langs == OBJC_LANG)
+return false;
+  if (bool OclCUnsupported =
+  !LangOpts.OpenCL && (BuiltinInfo.Langs & ALL_OCL_LANGUAGES))
+return false;
+  if (bool OclGASUnsupported =
+  !LangOpts.OpenCLGenericAddressSpace && (BuiltinInfo.Langs & OCL_GAS))
+return false;
+  if (bool OclPipeUnsupported =
+  !LangOpts.OpenCLPipes && (BuiltinInfo.Langs & OCL_PIPE))
+return false;
+
   // Device side enqueue is not supported until OpenCL 2.0. In 2.0 and higher
   // support is indicated with language option for blocks.
-  bool OclDSEUnsupported =
-  (LangOpts.getOpenCLCompatibleVersion() < 200 || !LangOpts.Blocks) &&
-  (BuiltinInfo.Langs & OCL_DSE);
-  bool OpenMPUnsupported = !LangOpts.OpenMP && BuiltinInfo.Langs == OMP_LANG;
-  bool CUDAUnsupported = !LangOpts.CUDA && BuiltinInfo.Langs == CUDA_LANG;
-  bool CPlusPlusUnsupported =
-  !LangOpts.CPlusPlus && BuiltinInfo.Langs == CXX_LANG;
-  return !BuiltinsUnsupported && !CorBuiltinsUnsupported &&
- !MathBuiltinsUnsupported && !OclCUnsupported && !OclGASUnsupported &&
- !OclPipeUnsupported && !OclDSEUnsupported && !OpenMPUnsupported &&
- !GnuModeUnsupported && !MSModeUnsupported && !ObjCUnsupported &&
- !CPlusPlusUnsupported && !CUDAUnsupported;
+  if (bool OclDSEUnsupported =
+  (LangOpts.getOpenCLCompatibleVersion() < 200 || !LangOpts.Blocks) &&
+  (BuiltinInfo.Langs & OCL_DSE))
+return false;
+  if (bool OpenMPUnsupported =
+  !LangOpts.OpenMP && BuiltinInfo.Langs == OMP_LANG)
+return false;
+  if (bool CUDAUnsupported = !LangOpts.CUDA && BuiltinInfo.Langs == CUDA_LANG)
+return false;
+  if (bool CPlusPlusUnsupported =
+  !LangOpts.CPlusPlus && BuiltinInfo.Langs == CXX_LANG)
+return false;
+  return true;
 }
 
 /// initializeBuiltins - Mark the identifiers for all the builtins with their



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


[clang] 4707468 - Add support for clang-cl's option `-fexcess-precision`.

2023-01-20 Thread Zahira Ammarguellat via cfe-commits

Author: Zahira Ammarguellat
Date: 2023-01-20T11:25:36-05:00
New Revision: 47074683c906f920cb7bba462beeb57ca4b84ab0

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

LOG: Add support for clang-cl's option `-fexcess-precision`.

This option is useful for clang and clang-cl.

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

Added: 


Modified: 
clang/include/clang/Driver/Options.td
clang/test/Driver/fexcess-precision.c

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index dd3e86f21425..ec7b5bfa1554 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1579,6 +1579,7 @@ def fignore_exceptions : Flag<["-"], 
"fignore-exceptions">, Group, Flag
   HelpText<"Enable support for ignoring exception handling constructs">,
   MarshallingInfoFlag>;
 def fexcess_precision_EQ : Joined<["-"], "fexcess-precision=">, Group,
+  Flags<[CoreOption]>,
   HelpText<"Allows control over excess precision on targets where native "
   "support for the precision types is not available. By default, excess "
   "precision is used to calculate intermediate results following the "

diff  --git a/clang/test/Driver/fexcess-precision.c 
b/clang/test/Driver/fexcess-precision.c
index 05f1ddbdb70e..436751807387 100644
--- a/clang/test/Driver/fexcess-precision.c
+++ b/clang/test/Driver/fexcess-precision.c
@@ -1,29 +1,62 @@
 // RUN: %clang -### -target i386 -fexcess-precision=fast -c %s 2>&1  \
 // RUN:   | FileCheck --check-prefix=CHECK-FAST %s
+// RUN: %clang_cl -### -target i386 -fexcess-precision=fast -c %s 2>&1  \
+// RUN:   | FileCheck --check-prefix=CHECK-FAST %s
+
 // RUN: %clang -### -target i386 -fexcess-precision=standard -c %s 2>&1  \
 // RUN:   | FileCheck --check-prefix=CHECK-STD %s
+// RUN: %clang_cl -### -target i386 -fexcess-precision=standard -c %s 2>&1  \
+// RUN:   | FileCheck --check-prefix=CHECK-STD %s
+
 // RUN: %clang -### -target i386 -fexcess-precision=16 -c %s 2>&1  \
 // RUN:   | FileCheck --check-prefix=CHECK-NONE %s
+// RUN: %clang_cl -### -target i386 -fexcess-precision=16 -c %s 2>&1  \
+// RUN:   | FileCheck --check-prefix=CHECK-NONE %s
+
 // RUN: %clang -### -target i386 -fexcess-precision=none -c %s 2>&1  \
 // RUN:   | FileCheck --check-prefix=CHECK-ERR-NONE %s
+// RUN: %clang_cl -### -target i386 -fexcess-precision=none -c %s 2>&1  \
+// RUN:   | FileCheck --check-prefix=CHECK-ERR-NONE %s
 
 // RUN: %clang -### -target x86_64 -fexcess-precision=fast -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-FAST %s
+// RUN: %clang_cl -### -target x86_64 -fexcess-precision=fast -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-FAST %s
+
 // RUN: %clang -### -target x86_64 -fexcess-precision=standard -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-STD %s
+// RUN: %clang_cl -### -target x86_64 -fexcess-precision=standard -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-STD %s
+
 // RUN: %clang -### -target x86_64 -fexcess-precision=16 -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NONE %s
+// RUN: %clang_cl -### -target x86_64 -fexcess-precision=16 -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NONE %s
+
 // RUN: %clang -### -target x86_64 -fexcess-precision=none -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefixes=CHECK-ERR-NONE %s
+// RUN: %clang_cl -### -target x86_64 -fexcess-precision=none -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefixes=CHECK-ERR-NONE %s
 
 // RUN: %clang -### -target aarch64 -fexcess-precision=fast -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK %s
+// RUN: %clang_cl -### -target aarch64 -fexcess-precision=fast -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK %s
+
 // RUN: %clang -### -target aarch64 -fexcess-precision=standard -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK %s
+// RUN: %clang_cl -### -target aarch64 -fexcess-precision=standard -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK %s
+
 // RUN: %clang -### -target aarch64 -fexcess-precision=16 -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-ERR-16 %s
+// RUN: %clang_cl -### -target aarch64 -fexcess-precision=16 -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-ERR-16 %s
+
 // RUN: %clang -### -target aarch64 -fexcess-precision=none -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-ERR-NONE %s
+// RUN: %clang_cl -### -target aarch64 -fexcess-precision=none -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-ERR-NONE %s
 
 // CHECK-FAST: "-ffloat16-excess-precision=fast"
 // CHECK-STD: "-ffloat16-excess-precision=standard"



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

[PATCH] D141929: Add support for clang-cl's option -fexcess-precision.

2023-01-20 Thread Zahira Ammarguellat 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 rG47074683c906: Add support for clang-cl's option 
`-fexcess-precision`. (authored by zahiraam).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141929

Files:
  clang/include/clang/Driver/Options.td
  clang/test/Driver/fexcess-precision.c


Index: clang/test/Driver/fexcess-precision.c
===
--- clang/test/Driver/fexcess-precision.c
+++ clang/test/Driver/fexcess-precision.c
@@ -1,29 +1,62 @@
 // RUN: %clang -### -target i386 -fexcess-precision=fast -c %s 2>&1  \
 // RUN:   | FileCheck --check-prefix=CHECK-FAST %s
+// RUN: %clang_cl -### -target i386 -fexcess-precision=fast -c %s 2>&1  \
+// RUN:   | FileCheck --check-prefix=CHECK-FAST %s
+
 // RUN: %clang -### -target i386 -fexcess-precision=standard -c %s 2>&1  \
 // RUN:   | FileCheck --check-prefix=CHECK-STD %s
+// RUN: %clang_cl -### -target i386 -fexcess-precision=standard -c %s 2>&1  \
+// RUN:   | FileCheck --check-prefix=CHECK-STD %s
+
 // RUN: %clang -### -target i386 -fexcess-precision=16 -c %s 2>&1  \
 // RUN:   | FileCheck --check-prefix=CHECK-NONE %s
+// RUN: %clang_cl -### -target i386 -fexcess-precision=16 -c %s 2>&1  \
+// RUN:   | FileCheck --check-prefix=CHECK-NONE %s
+
 // RUN: %clang -### -target i386 -fexcess-precision=none -c %s 2>&1  \
 // RUN:   | FileCheck --check-prefix=CHECK-ERR-NONE %s
+// RUN: %clang_cl -### -target i386 -fexcess-precision=none -c %s 2>&1  \
+// RUN:   | FileCheck --check-prefix=CHECK-ERR-NONE %s
 
 // RUN: %clang -### -target x86_64 -fexcess-precision=fast -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-FAST %s
+// RUN: %clang_cl -### -target x86_64 -fexcess-precision=fast -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-FAST %s
+
 // RUN: %clang -### -target x86_64 -fexcess-precision=standard -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-STD %s
+// RUN: %clang_cl -### -target x86_64 -fexcess-precision=standard -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-STD %s
+
 // RUN: %clang -### -target x86_64 -fexcess-precision=16 -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NONE %s
+// RUN: %clang_cl -### -target x86_64 -fexcess-precision=16 -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NONE %s
+
 // RUN: %clang -### -target x86_64 -fexcess-precision=none -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefixes=CHECK-ERR-NONE %s
+// RUN: %clang_cl -### -target x86_64 -fexcess-precision=none -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefixes=CHECK-ERR-NONE %s
 
 // RUN: %clang -### -target aarch64 -fexcess-precision=fast -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK %s
+// RUN: %clang_cl -### -target aarch64 -fexcess-precision=fast -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK %s
+
 // RUN: %clang -### -target aarch64 -fexcess-precision=standard -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK %s
+// RUN: %clang_cl -### -target aarch64 -fexcess-precision=standard -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK %s
+
 // RUN: %clang -### -target aarch64 -fexcess-precision=16 -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-ERR-16 %s
+// RUN: %clang_cl -### -target aarch64 -fexcess-precision=16 -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-ERR-16 %s
+
 // RUN: %clang -### -target aarch64 -fexcess-precision=none -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-ERR-NONE %s
+// RUN: %clang_cl -### -target aarch64 -fexcess-precision=none -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-ERR-NONE %s
 
 // CHECK-FAST: "-ffloat16-excess-precision=fast"
 // CHECK-STD: "-ffloat16-excess-precision=standard"
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -1579,6 +1579,7 @@
   HelpText<"Enable support for ignoring exception handling constructs">,
   MarshallingInfoFlag>;
 def fexcess_precision_EQ : Joined<["-"], "fexcess-precision=">, Group,
+  Flags<[CoreOption]>,
   HelpText<"Allows control over excess precision on targets where native "
   "support for the precision types is not available. By default, excess "
   "precision is used to calculate intermediate results following the "


Index: clang/test/Driver/fexcess-precision.c
===
--- clang/test/Driver/fexcess-precision.c
+++ clang/test/Driver/fexcess-precision.c
@@ -1,29 +1,62 @@
 // RUN: %clang -### -target i386 -fexcess-precision=fast -c %s 2>&1  \
 // RUN:   | FileCheck --check-prefix=CHECK-FAST %s
+// RUN: %clang_cl -### -target i386 -fexcess-precision=fast -c %s 2>&1  \
+// RUN:   | FileCheck --check-prefix=CHECK-FAST %s
+
 // RUN: %clang -###

[PATCH] D142222: [PowerPC] Remove the lax warning for explicit casts

2023-01-20 Thread Nemanja Ivanovic via Phabricator via cfe-commits
nemanjai accepted this revision.
nemanjai added a comment.
This revision is now accepted and ready to land.

LGTM other than the missing template test.




Comment at: clang/test/Parser/lax-conv.cpp:4
+// RUN: %clang_cc1 -triple=powerpc64-ibm-aix -target-feature +altivec 
-target-feature -vsx -fsyntax-only -verify=expected,aix %s
+
+void dummy(vector unsigned int a);

Can you also add one template test?
```
template  VEC __attribute__((noinline)) test(vector unsigned char 
a, vector unsigned char b) {
  return (VEC)(a * b);
}

vector unsigned char test1(vector unsigned char a, vector unsigned char b) {
  return test(a, b);
}

vector unsigned long long test2(vector unsigned char a, vector unsigned char b) 
{
  return test(a, b);
}
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D14

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


[clang] 7c59dea - [NFC]Fix github identification.

2023-01-20 Thread Alexey Bataev via cfe-commits

Author: Alexey Bataev
Date: 2023-01-20T08:40:38-08:00
New Revision: 7c59deaa1150a1bccf8090ba798ba93fdfe335e0

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

LOG: [NFC]Fix github identification.

Added: 


Modified: 
clang/CodeOwners.rst

Removed: 




diff  --git a/clang/CodeOwners.rst b/clang/CodeOwners.rst
index 30a164f99034..b2183a72b0a7 100644
--- a/clang/CodeOwners.rst
+++ b/clang/CodeOwners.rst
@@ -229,7 +229,7 @@ Objective-C/C++ conformance
 OpenMP conformance
 ~~
 | Alexey Bataev
-| a.bataev\@hotmail.com (email), ABataev (Phabricator), cilkplus (GitHub)
+| a.bataev\@hotmail.com (email), ABataev (Phabricator), alexey-bataev (GitHub)
 
 
 OpenCL conformance



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


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

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

These tests explicitly make use of POSIX absolute paths.


https://reviews.llvm.org/D142228

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


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


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


[PATCH] D141666: [RISCV] Proper support of extensions Zicsr and Zifencei

2023-01-20 Thread Elena Lepilkina via Phabricator via cfe-commits
eklepilkina added a comment.

> Maybe multi-lib handling should split into another patch?

I can do this. But if I separate I still can't choose one that should be merged 
firstly, they will be needed to merge both at once, because tests will fail. If 
separate them right way (fixes for multilibs in baremetal.cpp and gnu.cpp). 
Separate?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141666

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


[PATCH] D142233: [Clang][OpenMP] Bail out early if `Scope` is nullptr in case of any crash

2023-01-20 Thread Shilei Tian via Phabricator via cfe-commits
tianshilei1992 created this revision.
tianshilei1992 added reviewers: jdoerfert, ABataev, sandeepkosuri, cchen, jyu2.
Herald added subscribers: guansong, yaxunl.
Herald added a project: All.
tianshilei1992 requested review of this revision.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

When there is any compile error, clang still tries to compile as many code as
possible, therefore `Scope` can be `nullptr` here. However, we didn't check it
beforehand, causing compiler crash.

Fix #59944.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142233

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


Index: clang/test/OpenMP/bug59944.c
===
--- /dev/null
+++ clang/test/OpenMP/bug59944.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -x c -triple 
x86_64-apple-darwin10 %s -o - 2>&1 | FileCheck %s --check-prefix=CHECK
+
+extern void *omp_get_mapped_ptr(void *, int);
+
+void t() {
+  omp_get_mapped_ptr(&x, omp_get_initial_device());
+}
+
+// CHECK: error: use of undeclared identifier 'x'
+// CHECK-NOT: crash
Index: clang/lib/Sema/SemaOpenMP.cpp
===
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -7239,6 +7239,10 @@
   if (!CalleeFnDecl)
 return Call;
 
+  // Scope can be nullptr here if any compile error is encountered before.
+  if (!Scope)
+return Call;
+
   if (LangOpts.OpenMP >= 51 && CalleeFnDecl->getIdentifier() &&
   CalleeFnDecl->getName().startswith_insensitive("omp_")) {
 // checking for any calls inside an Order region


Index: clang/test/OpenMP/bug59944.c
===
--- /dev/null
+++ clang/test/OpenMP/bug59944.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -x c -triple x86_64-apple-darwin10 %s -o - 2>&1 | FileCheck %s --check-prefix=CHECK
+
+extern void *omp_get_mapped_ptr(void *, int);
+
+void t() {
+  omp_get_mapped_ptr(&x, omp_get_initial_device());
+}
+
+// CHECK: error: use of undeclared identifier 'x'
+// CHECK-NOT: crash
Index: clang/lib/Sema/SemaOpenMP.cpp
===
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -7239,6 +7239,10 @@
   if (!CalleeFnDecl)
 return Call;
 
+  // Scope can be nullptr here if any compile error is encountered before.
+  if (!Scope)
+return Call;
+
   if (LangOpts.OpenMP >= 51 && CalleeFnDecl->getIdentifier() &&
   CalleeFnDecl->getName().startswith_insensitive("omp_")) {
 // checking for any calls inside an Order region
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D142233: [Clang][OpenMP] Bail out early if `Scope` is nullptr in case of any crash

2023-01-20 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: clang/lib/Sema/SemaOpenMP.cpp:7249
 // checking for any calls inside an Order region
 if (Scope->isOpenMPOrderClauseScope())
   Diag(LParenLoc, diag::err_omp_unexpected_call_to_omp_runtime_api);

Maybe better to check it here to avoid too early exit?
```
if (Scope && Scope->...)
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142233

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


[PATCH] D142233: [Clang][OpenMP] Bail out early if `Scope` is nullptr in case of any crash

2023-01-20 Thread Shilei Tian via Phabricator via cfe-commits
tianshilei1992 added inline comments.



Comment at: clang/lib/Sema/SemaOpenMP.cpp:7249
 // checking for any calls inside an Order region
 if (Scope->isOpenMPOrderClauseScope())
   Diag(LParenLoc, diag::err_omp_unexpected_call_to_omp_runtime_api);

ABataev wrote:
> Maybe better to check it here to avoid too early exit?
> ```
> if (Scope && Scope->...)
> ```
But does it make sense to continue? I'm not that sure.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142233

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


[PATCH] D142233: [Clang][OpenMP] Bail out early if `Scope` is nullptr in case of any crash

2023-01-20 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: clang/lib/Sema/SemaOpenMP.cpp:7249
 // checking for any calls inside an Order region
 if (Scope->isOpenMPOrderClauseScope())
   Diag(LParenLoc, diag::err_omp_unexpected_call_to_omp_runtime_api);

tianshilei1992 wrote:
> ABataev wrote:
> > Maybe better to check it here to avoid too early exit?
> > ```
> > if (Scope && Scope->...)
> > ```
> But does it make sense to continue? I'm not that sure.
Yes, we can get some extra diagnostics, which may be helpful


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142233

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


[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

2023-01-20 Thread Steven Wu via Phabricator via cfe-commits
steven_wu added a comment.

In D136315#4067205 , @calebzulawski 
wrote:

> One thing to throw into the mix: Apple's clang has a default sysroot 
> configured, so with the default system compiler, there is no way to replicate 
> this "build without a sysroot" scenario as far as I can tell.  For the system 
> compiler, I believe this behavior is a strict improvement.

No, apple's clang doesn't have a default sysroot. When you run 
`/usr/bin/clang`, which is a shim that calls `xcrun`, it finds the clang in 
your toolchain and invokes it with `SDKROOT` environment variable. That is the 
behavior of the shim, not the behavior of clang.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136315

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


[PATCH] D142222: [PowerPC] Remove the lax warning for explicit casts

2023-01-20 Thread Maryam Moghadas via Phabricator via cfe-commits
maryammo updated this revision to Diff 490895.
maryammo added a comment.

Adding test for template


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D14

Files:
  clang/lib/Sema/SemaOverload.cpp
  clang/test/Parser/cxx-altivec.cpp
  clang/test/Parser/lax-conv.cpp

Index: clang/test/Parser/lax-conv.cpp
===
--- /dev/null
+++ clang/test/Parser/lax-conv.cpp
@@ -0,0 +1,67 @@
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +altivec -target-feature +vsx -target-cpu pwr8 -fsyntax-only -verify=expected,nonaix %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature +altivec -target-feature +vsx -target-cpu pwr8 -fsyntax-only -verify=expected,novsx %s
+// RUN: %clang_cc1 -triple=powerpc64-ibm-aix -target-feature +altivec -target-feature +vsx -target-cpu pwr8 -fsyntax-only -verify=expected,aix %s
+
+void dummy(vector unsigned int a);
+template  VEC __attribute__((noinline)) test(vector unsigned char a, vector unsigned char b) {
+return (VEC)(a * b);
+}
+vector unsigned int test1(vector unsigned char RetImplicitConv) {
+  return RetImplicitConv; // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}} 
+}
+vector unsigned int test2(vector unsigned char RetImplicitConvAddConst) {
+  return RetImplicitConvAddConst + 5; // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}} 
+}
+vector unsigned int test3(vector unsigned char RetExplicitConv) {
+  return (vector unsigned int)RetExplicitConv;
+}
+vector unsigned int test4(vector unsigned char RetExplicitConvAddConst) {
+  return (vector unsigned int)RetExplicitConvAddConst + 5;
+}
+vector unsigned int test5(vector unsigned char RetImplicitConvAddSame1,
+  vector unsigned char RetImplicitConvAddSame2) {
+  return RetImplicitConvAddSame1 + RetImplicitConvAddSame2; // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}} 
+}
+vector unsigned int test6(vector unsigned char RetExplicitConvAddSame1,
+  vector unsigned char RetExplicitConvAddSame2) {
+  return (vector unsigned int)RetExplicitConvAddSame1 +
+ (vector unsigned int)RetExplicitConvAddSame2;
+}
+vector unsigned int test7(vector unsigned char RetExplicitConvAddSame1Full,
+  vector unsigned char RetExplicitConvAddSame2Full) {
+  return (vector unsigned int)(RetExplicitConvAddSame1Full +
+   RetExplicitConvAddSame2Full);
+}
+vector unsigned char test8(vector unsigned char a, vector unsigned char b) {
+return test(a, b);
+}
+
+vector unsigned long long test9(vector unsigned char a, vector unsigned char b) {
+return test(a, b);
+}
+void test1a(vector unsigned char ArgImplicitConv) {
+  return dummy(ArgImplicitConv); // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}}
+}
+void test2a(vector unsigned char ArgImplicitConvAddConst) {
+  return dummy(ArgImplicitConvAddConst + 5); // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by '-fno-lax-vector-conversions' will be the default.}}
+}
+void test3a(vector unsigned char ArgExplicitConv) {
+  return dummy((vector unsigned int)ArgExplicitConv);
+}
+void test4a(vector unsigned char ArgExplicitConvAddConst) {
+  return dummy((vector unsigned int)ArgExplicitConvAddConst + 5);
+}
+void test5a(vector unsigned char ArgImplicitConvAddSame1,
+vector unsigned char ArgImplicitConvAddSame2) {
+  return dummy(ArgImplicitConvAddSame1 + ArgImplicitConvAddSame2); // expected-warning {{Implicit conversion between vector types (''__vector unsigned char' (vector of 16 'unsigned char' values)' and ''__vector unsigned int' (vector of 4 'unsigned int' values)') is deprecated. In the future, the behavior implied by 

[PATCH] D142233: [Clang][OpenMP] Bail out early if `Scope` is nullptr in case of any crash

2023-01-20 Thread Shilei Tian via Phabricator via cfe-commits
tianshilei1992 updated this revision to Diff 490896.
tianshilei1992 added a comment.

fix comment


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142233

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


Index: clang/test/OpenMP/bug59944.c
===
--- /dev/null
+++ clang/test/OpenMP/bug59944.c
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -x c -triple 
x86_64-apple-darwin10 %s -o - 2>&1 | FileCheck %s --check-prefix=CHECK
+
+extern int omp_get_initial_device();
+extern void *omp_get_mapped_ptr(void *, int);
+
+void t() {
+  omp_get_mapped_ptr(&x, omp_get_initial_device());
+}
+
+// CHECK: error: use of undeclared identifier 'x'
+// CHECK-NOT: crash
Index: clang/lib/Sema/SemaOpenMP.cpp
===
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -7242,7 +7242,7 @@
   if (LangOpts.OpenMP >= 51 && CalleeFnDecl->getIdentifier() &&
   CalleeFnDecl->getName().startswith_insensitive("omp_")) {
 // checking for any calls inside an Order region
-if (Scope->isOpenMPOrderClauseScope())
+if (Scope && Scope->isOpenMPOrderClauseScope())
   Diag(LParenLoc, diag::err_omp_unexpected_call_to_omp_runtime_api);
   }
 


Index: clang/test/OpenMP/bug59944.c
===
--- /dev/null
+++ clang/test/OpenMP/bug59944.c
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -x c -triple x86_64-apple-darwin10 %s -o - 2>&1 | FileCheck %s --check-prefix=CHECK
+
+extern int omp_get_initial_device();
+extern void *omp_get_mapped_ptr(void *, int);
+
+void t() {
+  omp_get_mapped_ptr(&x, omp_get_initial_device());
+}
+
+// CHECK: error: use of undeclared identifier 'x'
+// CHECK-NOT: crash
Index: clang/lib/Sema/SemaOpenMP.cpp
===
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -7242,7 +7242,7 @@
   if (LangOpts.OpenMP >= 51 && CalleeFnDecl->getIdentifier() &&
   CalleeFnDecl->getName().startswith_insensitive("omp_")) {
 // checking for any calls inside an Order region
-if (Scope->isOpenMPOrderClauseScope())
+if (Scope && Scope->isOpenMPOrderClauseScope())
   Diag(LParenLoc, diag::err_omp_unexpected_call_to_omp_runtime_api);
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D142077: [Clang][SemaCXX][Coroutines] Fix misleading diagnostics with -Wunsequenced

2023-01-20 Thread Bruno Cardoso Lopes via Phabricator via cfe-commits
bruno added a comment.

Test failure is unrelated.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142077

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


[PATCH] D142233: [Clang][OpenMP] Bail out early if `Scope` is nullptr in case of any crash

2023-01-20 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev accepted this revision.
ABataev added a comment.
This revision is now accepted and ready to land.

LG


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142233

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


[clang] c4fa504 - [AArch64] Enable libm vectorized functions via SLEEF

2023-01-20 Thread Daniel Kiss via cfe-commits

Author: Daniel Kiss
Date: 2023-01-20T18:52:38+01:00
New Revision: c4fa504f797f68297c252dc91a24c7d37c1de4df

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

LOG: [AArch64] Enable libm vectorized functions via SLEEF

It enables trigonometry functions vectorization via SLEEF: http://sleef.org/.

  - A new vectorization library enum is added to TargetLibraryInfo.h: SLEEF.
  - A new option is added to TargetLibraryInfoImpl - ClVectorLibrary: SLEEF.
  - A comprehensive test case is included in this changeset.
  - A new vectorization library argument is added to -fveclib: -fveclib=SLEEF.

Trigonometry functions that are vectorized by sleef:
acos
asin
atan
atanh
cos
cosh
exp
exp2
exp10
lgamma
log10
log2
log
sin
sinh
sqrt
tan
tanh
tgamma

Co-authored-by: Stefan Teleman

Reviewed By: paulwalker-arm

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

Added: 
llvm/test/Transforms/LoopVectorize/AArch64/sleef-calls-aarch64.ll

Modified: 
clang/include/clang/Basic/CodeGenOptions.h
clang/include/clang/Driver/Options.td
clang/lib/CodeGen/BackendUtil.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/autocomplete.c
clang/test/Driver/fveclib.c
llvm/include/llvm/Analysis/TargetLibraryInfo.h
llvm/include/llvm/Analysis/VecFuncs.def
llvm/lib/Analysis/TargetLibraryInfo.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/CodeGenOptions.h 
b/clang/include/clang/Basic/CodeGenOptions.h
index 4cc0d05d177b3..4175fe3072ab8 100644
--- a/clang/include/clang/Basic/CodeGenOptions.h
+++ b/clang/include/clang/Basic/CodeGenOptions.h
@@ -60,6 +60,7 @@ class CodeGenOptions : public CodeGenOptionsBase {
 LIBMVEC,   // GLIBC vector math library.
 MASSV, // IBM MASS vector library.
 SVML,  // Intel short vector math library.
+SLEEF, // SLEEF SIMD Library for Evaluating Elementary 
Functions.
 Darwin_libsystem_m // Use Darwin's libsytem_m vector functions.
   };
 

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index ec7b5bfa1554a..343cc77a18c43 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -2473,9 +2473,9 @@ def fno_experimental_isel : Flag<["-"], 
"fno-experimental-isel">, Group;
 def fveclib : Joined<["-"], "fveclib=">, Group, Flags<[CC1Option]>,
 HelpText<"Use the given vector functions library">,
-Values<"Accelerate,libmvec,MASSV,SVML,Darwin_libsystem_m,none">,
+Values<"Accelerate,libmvec,MASSV,SVML,SLEEF,Darwin_libsystem_m,none">,
 NormalizedValuesScope<"CodeGenOptions">,
-NormalizedValues<["Accelerate", "LIBMVEC", "MASSV", "SVML",
+NormalizedValues<["Accelerate", "LIBMVEC", "MASSV", "SVML", "SLEEF",
   "Darwin_libsystem_m", "NoLibrary"]>,
 MarshallingInfoEnum, "NoLibrary">;
 def fno_lax_vector_conversions : Flag<["-"], "fno-lax-vector-conversions">, 
Group,

diff  --git a/clang/lib/CodeGen/BackendUtil.cpp 
b/clang/lib/CodeGen/BackendUtil.cpp
index 937a8dc40667e..ecc727d6dd281 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -271,27 +271,28 @@ static TargetLibraryInfoImpl *createTLII(llvm::Triple 
&TargetTriple,
 
   switch (CodeGenOpts.getVecLib()) {
   case CodeGenOptions::Accelerate:
-
TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::Accelerate);
+TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::Accelerate,
+ TargetTriple);
 break;
   case CodeGenOptions::LIBMVEC:
-switch(TargetTriple.getArch()) {
-  default:
-break;
-  case llvm::Triple::x86_64:
-TLII->addVectorizableFunctionsFromVecLib
-(TargetLibraryInfoImpl::LIBMVEC_X86);
-break;
-}
+
TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::LIBMVEC_X86,
+ TargetTriple);
 break;
   case CodeGenOptions::MASSV:
-TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::MASSV);
+TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::MASSV,
+ TargetTriple);
 break;
   case CodeGenOptions::SVML:
-TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::SVML);
+TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::SVML,
+ TargetTriple);
+break;
+  case CodeGenOptions::SLEEF:
+
TLII->addVectorizableFunctionsFromVecLib(TargetLibraryInfoImpl::SLEEFGNUABI,
+ TargetTriple);
 break;
   case CodeGenOptions::Darwin_libsystem_m:
 TLII->addVectorizableFunctionsFromVecLib(
-

  1   2   >