[PATCH] D112235: [HIP][OpenMP] Fix assertion in deferred diag due to incomplete class definition

2021-10-23 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

Minor grammar nit with a comment, but otherwise LGTM.




Comment at: clang/test/OpenMP/deferred-diags.cpp:40
+// Test deleting object with incomplete class definition does not causing
+// assertion.
+namespace TestDeleteIncompleteClassDefinition {

"Test that deleting an incomplete class type doesn't cause an assertion."


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

https://reviews.llvm.org/D112235

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


[clang-tools-extra] 4ba9d9c - Use StringRef::contains (NFC)

2021-10-23 Thread Kazu Hirata via cfe-commits

Author: Kazu Hirata
Date: 2021-10-23T20:41:46-07:00
New Revision: 4ba9d9c84f4ce05eec341dc5f2d1c95934ab3d2c

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

LOG: Use StringRef::contains (NFC)

Added: 


Modified: 
clang-tools-extra/modularize/CoverageChecker.cpp
lld/COFF/PDB.cpp
lldb/source/Commands/CommandObjectWatchpoint.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
lldb/source/Plugins/Language/CPlusPlus/MSVCUndecoratedNameParser.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/tools/lldb-vscode/lldb-vscode.cpp
mlir/lib/IR/MLIRContext.cpp

Removed: 




diff  --git a/clang-tools-extra/modularize/CoverageChecker.cpp 
b/clang-tools-extra/modularize/CoverageChecker.cpp
index b115d59aaba85..b1c787862c02d 100644
--- a/clang-tools-extra/modularize/CoverageChecker.cpp
+++ b/clang-tools-extra/modularize/CoverageChecker.cpp
@@ -381,8 +381,7 @@ bool CoverageChecker::collectFileSystemHeaders(StringRef 
IncludePath) {
   continue;
 // Assume directories or files starting with '.' are private and not to
 // be considered.
-if ((file.find("\\.") != StringRef::npos) ||
-(file.find("/.") != StringRef::npos))
+if (file.contains("\\.") || file.contains("/."))
   continue;
 // If the file does not have a common header extension, ignore it.
 if (!ModularizeUtilities::isHeader(file))

diff  --git a/lld/COFF/PDB.cpp b/lld/COFF/PDB.cpp
index 73feddaa202d8..00e171017f4bf 100644
--- a/lld/COFF/PDB.cpp
+++ b/lld/COFF/PDB.cpp
@@ -1347,8 +1347,8 @@ static std::string quote(ArrayRef args) {
   for (StringRef a : args) {
 if (!r.empty())
   r.push_back(' ');
-bool hasWS = a.find(' ') != StringRef::npos;
-bool hasQ = a.find('"') != StringRef::npos;
+bool hasWS = a.contains(' ');
+bool hasQ = a.contains('"');
 if (hasWS || hasQ)
   r.push_back('"');
 if (hasQ) {

diff  --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp 
b/lldb/source/Commands/CommandObjectWatchpoint.cpp
index d7a446fc366c5..9fbf036a19d1a 100644
--- a/lldb/source/Commands/CommandObjectWatchpoint.cpp
+++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp
@@ -56,7 +56,7 @@ static int32_t WithRSAIndex(llvm::StringRef Arg) {
 
   uint32_t i;
   for (i = 0; i < 4; ++i)
-if (Arg.find(RSA[i]) != llvm::StringRef::npos)
+if (Arg.contains(RSA[i]))
   return i;
   return -1;
 }

diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
index d9ab17eece888..a0cff3cc9bf8e 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -1309,7 +1309,7 @@ static bool FindFunctionInModule(ConstString 
_name,
  llvm::Module *module, const char *orig_name) {
   for (const auto  : module->getFunctionList()) {
 const StringRef  = func.getName();
-if (name.find(orig_name) != StringRef::npos) {
+if (name.contains(orig_name)) {
   mangled_name.SetString(name);
   return true;
 }

diff  --git 
a/lldb/source/Plugins/Language/CPlusPlus/MSVCUndecoratedNameParser.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/MSVCUndecoratedNameParser.cpp
index b24bcc1344e23..8ecf6712eace2 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/MSVCUndecoratedNameParser.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/MSVCUndecoratedNameParser.cpp
@@ -72,7 +72,7 @@ 
MSVCUndecoratedNameParser::MSVCUndecoratedNameParser(llvm::StringRef name) {
 }
 
 bool MSVCUndecoratedNameParser::IsMSVCUndecoratedName(llvm::StringRef name) {
-  return name.find('`') != llvm::StringRef::npos;
+  return name.contains('`');
 }
 
 bool MSVCUndecoratedNameParser::ExtractContextAndIdentifier(

diff  --git 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index 9550cb53e9e83..a43f8c004aaae 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -1543,17 +1543,17 @@ Status 
GDBRemoteCommunicationClient::GetMemoryRegionInfo(
region_info.GetRange().IsValid()) {
   saw_permissions = true;
   if (region_info.GetRange().Contains(addr)) {
-if (value.find('r') != llvm::StringRef::npos)
+if (value.contains('r'))
   region_info.SetReadable(MemoryRegionInfo::eYes);
 else
   region_info.SetReadable(MemoryRegionInfo::eNo);
 
-if (value.find('w') != llvm::StringRef::npos)
+if 

[PATCH] D112284: [Clang][NFC] Clang CUDA codegen: a dyn_cast -> cast instance + clang-tidy fixes

2021-10-23 Thread Uday Bondhugula via Phabricator via cfe-commits
bondhugula added a comment.

Gentle ping to reviewers @tra @yaxunl on this NFC PR.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112284

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


[PATCH] D109557: Adds a BlockIndent option to AlignAfterOpenBracket

2021-10-23 Thread Cameron Mulhern via Phabricator via cfe-commits
csmulhern updated this revision to Diff 381765.
csmulhern added a comment.

Absent feedback, I have gone ahead and added a BlockIndent option to 
AlignAfterOpenBracket.

Please take a look.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109557

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Format/Format.h
  clang/lib/Format/ContinuationIndenter.cpp
  clang/lib/Format/ContinuationIndenter.h
  clang/lib/Format/Format.cpp
  clang/lib/Format/TokenAnnotator.cpp
  clang/unittests/Format/FormatTest.cpp

Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -18539,6 +18539,8 @@
   FormatStyle::BAS_DontAlign);
   CHECK_PARSE("AlignAfterOpenBracket: AlwaysBreak", AlignAfterOpenBracket,
   FormatStyle::BAS_AlwaysBreak);
+  CHECK_PARSE("AlignAfterOpenBracket: BlockIndent", AlignAfterOpenBracket,
+  FormatStyle::BAS_BlockIndent);
   // For backward compatibility:
   CHECK_PARSE("AlignAfterOpenBracket: false", AlignAfterOpenBracket,
   FormatStyle::BAS_DontAlign);
@@ -22397,6 +22399,192 @@
   EXPECT_EQ(Code, format(Code, Style));
 }
 
+TEST_F(FormatTest, AlignAfterOpenBracketBlockIndent) {
+  auto Style = getLLVMStyle();
+
+  StringRef Short = "functionCall(paramA, paramB, paramC);\n"
+"void functionDecl(int a, int b, int c);";
+
+  StringRef Medium = "functionCall(paramA, paramB, paramC, paramD, paramE, "
+ "paramF, paramG, paramH, paramI);\n"
+ "void functionDecl(int argumentA, int argumentB, int "
+ "argumentC, int argumentD, int argumentE);";
+
+  verifyFormat(Short, Style);
+
+  StringRef NoBreak = "functionCall(paramA, paramB, paramC, paramD, paramE, "
+  "paramF, paramG, paramH,\n"
+  " paramI);\n"
+  "void functionDecl(int argumentA, int argumentB, int "
+  "argumentC, int argumentD,\n"
+  "  int argumentE);";
+
+  verifyFormat(NoBreak, Medium, Style);
+  verifyFormat(NoBreak,
+   "functionCall(\n"
+   "paramA,\n"
+   "paramB,\n"
+   "paramC,\n"
+   "paramD,\n"
+   "paramE,\n"
+   "paramF,\n"
+   "paramG,\n"
+   "paramH,\n"
+   "paramI\n"
+   ");\n"
+   "void functionDecl(\n"
+   "int argumentA,\n"
+   "int argumentB,\n"
+   "int argumentC,\n"
+   "int argumentD,\n"
+   "int argumentE\n"
+   ");",
+   Style);
+
+  verifyFormat("outerFunctionCall(nestedFunctionCall(argument1),\n"
+   "  nestedLongFunctionCall(argument1, "
+   "argument2, argument3,\n"
+   " argument4, "
+   "argument5));",
+   Style);
+
+  Style.AlignAfterOpenBracket = FormatStyle::BAS_BlockIndent;
+  Style.AllowAllArgumentsOnNextLine = false;
+  Style.AllowAllConstructorInitializersOnNextLine = false;
+  Style.AllowAllParametersOfDeclarationOnNextLine = false;
+
+  verifyFormat(Short, Style);
+  verifyFormat(
+  "functionCall(\n"
+  "paramA, paramB, paramC, paramD, paramE, paramF, paramG, paramH, "
+  "paramI\n"
+  ");\n"
+  "void functionDecl(\n"
+  "int argumentA, int argumentB, int argumentC, int argumentD, int "
+  "argumentE\n"
+  ");",
+  Medium, Style);
+
+  Style.BinPackArguments = false;
+  Style.BinPackParameters = false;
+
+  verifyFormat(Short, Style);
+
+  verifyFormat("functionCall(\n"
+   "paramA,\n"
+   "paramB,\n"
+   "paramC,\n"
+   "paramD,\n"
+   "paramE,\n"
+   "paramF,\n"
+   "paramG,\n"
+   "paramH,\n"
+   "paramI\n"
+   ");\n"
+   "void functionDecl(\n"
+   "int argumentA,\n"
+   "int argumentB,\n"
+   "int argumentC,\n"
+   "int argumentD,\n"
+   "int argumentE\n"
+   ");",
+   Medium, Style);
+
+  verifyFormat("outerFunctionCall(\n"
+   "nestedFunctionCall(argument1),\n"
+   "nestedLongFunctionCall(\n"
+   "argument1,\n"
+   "argument2,\n"
+   "argument3,\n"
+   "argument4,\n"
+   "argument5\n"
+   ")\n"
+   ");",
+ 

[PATCH] D112356: [NFC] Tidy up spelling, grammar, and inconsistencies in clang-tidy documentation

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

In D112356#3082218 , @Quuxplusone 
wrote:

> Definitely an improvement! I looked at all the changed places and found some 
> more improvements you can make. I don't need to see this again, though.

Thanks for the suggestions. Good spotting.

My commit was addressing the low hanging fruit - obvious issues like spelling 
mistakes and missing words.
To get the documentation to a state where it reads well from start to finish 
will require a deeper inspection, which I am happy to do over the coming days.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112356

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


[PATCH] D105447: [analyzer] Allow cmake options to be passed to satest container

2021-10-23 Thread Manas Gupta via Phabricator via cfe-commits
manas added a comment.

Gentle ping! I think landing it will make collecting analyzer information 
easier (in terms of faster build) as more (appropriate) cmake options can be 
passed via cmdline.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105447

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


[PATCH] D106102: [analyzer][solver] Introduce reasoning for not equal to operator

2021-10-23 Thread Manas Gupta via Phabricator via cfe-commits
manas added a comment.

Based on the information from debugger, the logs 
 show RangeSets `[0, 255]` and 
`[INT_MIN, 0]` from different types 
 are causing the failure.
I tried producing a compact test case . The 
essential part is the comparison between different types, as in this case 
`unsigned int` and `int`. In other binary operators (BO_And, BO_Rem, etc.), 
this gets handled by coarsing RangeSets to Ranges and converting those Ranges 
to resulting type for comparison. This is missing in `BO_NE`. I suppose, this 
may be the reason behind the signedness mismatch.

One way to solve this would be to let the specialization of 
`VisitBinaryOperator` (definition here 
)
 handle the coarse/convert, and then `VisitBinaryOperator` checking for 
any reasonable result which can be inferred from those Ranges.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106102

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


[PATCH] D111457: [clang][test] Add lit helper for windows paths

2021-10-23 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo added a comment.

In D111457#3073726 , @keith wrote:

> In D111457#3066508 , @mstorsjo 
> wrote:
>
>> Wouldn't this one also be solved pretty much the same, but differently, by 
>> changing `if (llvm::sys::path::is_absolute(RemappedFile)) {` into 
>> `is_absolute_gnu`?
>
> I think it //could// but also users could still remap to native window's 
> paths, so likely we'd want this test as well I think either way?

I guess this might be a good addition as a new test, yeah, but I think it would 
be good to keep this test as is too, and change the code to use 
`is_absolute_gnu` (and fix up the test reference here to expect an empty 
directory in the output).

>> Since we're remapping debug paths, it's plausible that the target path can 
>> be a different style (when cross compiling, where debug prefix remapping is 
>> kinda important), and then it's probably good to use a more lax definition 
>> of whether a path is absolute. (Alternatively, we maybe should try to detect 
>> the kind of path used and use the appropriate style as argument to 
>> `is_absolute`, but I don't think that necessarily helps here.)
>
> Good point here, I could definitely see wanting to support the entire matrix 
> of host windows paths vs not, and target windows paths vs not, but I think 
> that would require significantly more changes for other places that call 
> `llvm::sys::path::*` APIs and also use the default `native` argument (I'm not 
> sure how difficult this would be, but it would require a bit of auditing)

I would expect that to mostly work so far, except for corner cases like these. 
Auditing probably doesn't hurt if one wants to spend the effort, otherwise I'd 
just expect it to work and try it out and see if one runs into any issues 
somewhere, if someone has such a usecase.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111457

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


[PATCH] D112349: [Verifier] Add verification logic for GlobalIFuncs

2021-10-23 Thread Itay Bookstein via Phabricator via cfe-commits
ibookstein updated this revision to Diff 381760.
ibookstein edited the summary of this revision.
ibookstein added a comment.
Herald added a subscriber: nemanjai.

Added check to BitcodeReader, fixed clang tests, hoisted
logic to shared static function on GlobalIFunc.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112349

Files:
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/test/CodeGen/ifunc.c
  clang/test/CodeGen/semantic-interposition.c
  llvm/include/llvm/IR/GlobalIFunc.h
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/IR/Globals.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/test/Assembler/ifunc-asm.ll
  llvm/test/Assembler/ifunc-dsolocal.ll
  llvm/test/Assembler/ifunc-use-list-order.ll
  llvm/test/Bindings/llvm-c/echo.ll
  llvm/test/Bitcode/compatibility-6.0.ll
  llvm/test/Bitcode/compatibility-6.0.ll.bc
  llvm/test/Bitcode/compatibility.ll
  llvm/test/Bitcode/dso_local_equivalent.ll
  llvm/test/Bitcode/dso_location.ll
  llvm/test/CodeGen/PowerPC/ifunc.ll
  llvm/test/CodeGen/X86/addrsig.ll
  llvm/test/CodeGen/X86/dso_local_equivalent.ll
  llvm/test/CodeGen/X86/ifunc-asm.ll
  llvm/test/CodeGen/X86/partition.ll
  llvm/test/LTO/Resolution/X86/Inputs/ifunc2.ll
  llvm/test/LTO/Resolution/X86/ifunc.ll
  llvm/test/LTO/Resolution/X86/ifunc2.ll
  llvm/test/Linker/ifunc.ll
  llvm/test/Object/X86/nm-ir.ll
  llvm/test/ThinLTO/X86/empty-module.ll
  llvm/test/Transforms/GlobalDCE/global-ifunc.ll

Index: llvm/test/Transforms/GlobalDCE/global-ifunc.ll
===
--- llvm/test/Transforms/GlobalDCE/global-ifunc.ll
+++ llvm/test/Transforms/GlobalDCE/global-ifunc.ll
@@ -2,12 +2,12 @@
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
-@if = ifunc void (), void ()* @fn
+@if = ifunc void (), void ()* ()* @fn
 
-define internal void @fn() {
+define internal void ()* @fn() {
 entry:
-  ret void
+  ret void ()* null
 }
 
-; CHECK-DAG: @if = ifunc void (), void ()* @fn
-; CHECK-DAG: define internal void @fn(
+; CHECK-DAG: @if = ifunc void (), void ()* ()* @fn
+; CHECK-DAG: define internal void ()* @fn(
Index: llvm/test/ThinLTO/X86/empty-module.ll
===
--- llvm/test/ThinLTO/X86/empty-module.ll
+++ llvm/test/ThinLTO/X86/empty-module.ll
@@ -10,9 +10,9 @@
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
-@foo = ifunc i32 (i32), i64 ()* @foo_ifunc
+@foo = ifunc i32 (i32), i32 (i32)* ()* @foo_ifunc
 
-define internal i64 @foo_ifunc() {
+define internal i32 (i32)* @foo_ifunc() {
 entry:
-  ret i64 0
+  ret i32 (i32)* null
 }
Index: llvm/test/Object/X86/nm-ir.ll
===
--- llvm/test/Object/X86/nm-ir.ll
+++ llvm/test/Object/X86/nm-ir.ll
@@ -32,12 +32,12 @@
 @a1 = alias i32, i32* @g1
 @a2 = internal alias i32, i32* @g1
 
-define void @f1() {
+define void ()* @f1() {
   call void @f5()
-  ret void
+  ret void ()* null
 }
 
-@ifunc_f1 = ifunc void (), void ()* @f1
+@ifunc_f1 = ifunc void (), void ()* ()* @f1
 
 define internal void @f2() {
   ret void
Index: llvm/test/Linker/ifunc.ll
===
--- llvm/test/Linker/ifunc.ll
+++ llvm/test/Linker/ifunc.ll
@@ -3,18 +3,18 @@
 
 ;; Check that ifuncs are linked in properly.
 
-; CHECK-DAG: @foo = ifunc void (), bitcast (void ()* ()* @foo_resolve to void ()*)
+; CHECK-DAG: @foo = ifunc void (), void ()* ()* @foo_resolve
 ; CHECK-DAG: define internal void ()* @foo_resolve() {
 
-; CHECK-DAG: @bar = ifunc void (), bitcast (void ()* ()* @bar_resolve to void ()*)
+; CHECK-DAG: @bar = ifunc void (), void ()* ()* @bar_resolve
 ; CHECK-DAG: define internal void ()* @bar_resolve() {
 
 ;--- a.ll
 declare void @bar()
 
 ;--- b.ll
-@foo = ifunc void (), bitcast (void ()* ()* @foo_resolve to void ()*)
-@bar = ifunc void (), bitcast (void ()* ()* @bar_resolve to void ()*)
+@foo = ifunc void (), void ()* ()* @foo_resolve
+@bar = ifunc void (), void ()* ()* @bar_resolve
 
 define internal void ()* @foo_resolve() {
   ret void ()* null
Index: llvm/test/LTO/Resolution/X86/ifunc2.ll
===
--- llvm/test/LTO/Resolution/X86/ifunc2.ll
+++ llvm/test/LTO/Resolution/X86/ifunc2.ll
@@ -6,14 +6,14 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
-; CHECK: @foo = ifunc i32 (), i32 ()* @foo_resolver.2
-@foo = ifunc i32 (), i32 ()* @foo_resolver
+; CHECK: @foo = ifunc i32 (), i32 ()* ()* @foo_resolver.2
+@foo = ifunc i32 (), i32 ()* ()* @foo_resolver
 
-; CHECK: define internal i32 @foo_resolver.2() {
-; CHECK-NEXT: ret i32 1
-define weak i32 @foo_resolver() {
-  ret i32 1
+; CHECK: define internal i32 ()* @foo_resolver.2() {
+; CHECK-NEXT: ret i32 ()* inttoptr (i32 1 

[clang] a709787 - Add support of the next Ubuntu (Ubuntu 22.04 - Jammy Jellyfish)

2021-10-23 Thread Sylvestre Ledru via cfe-commits

Author: Sylvestre Ledru
Date: 2021-10-23T23:55:50+02:00
New Revision: a709787cd988aaca847995bd08cc9348c9c6c956

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

LOG: Add support of the next Ubuntu (Ubuntu 22.04 - Jammy Jellyfish)

It is going to be a LTS release

Added: 


Modified: 
clang/include/clang/Driver/Distro.h
clang/lib/Driver/Distro.cpp

Removed: 




diff  --git a/clang/include/clang/Driver/Distro.h 
b/clang/include/clang/Driver/Distro.h
index d9909bcf96968..2723f75e89458 100644
--- a/clang/include/clang/Driver/Distro.h
+++ b/clang/include/clang/Driver/Distro.h
@@ -73,6 +73,7 @@ class Distro {
 UbuntuGroovy,
 UbuntuHirsute,
 UbuntuImpish,
+UbuntuJammy,
 UnknownDistro
   };
 
@@ -124,7 +125,7 @@ class Distro {
   }
 
   bool IsUbuntu() const {
-return DistroVal >= UbuntuHardy && DistroVal <= UbuntuImpish;
+return DistroVal >= UbuntuHardy && DistroVal <= UbuntuJammy;
   }
 
   bool IsAlpineLinux() const { return DistroVal == AlpineLinux; }

diff  --git a/clang/lib/Driver/Distro.cpp b/clang/lib/Driver/Distro.cpp
index 6a11bacb41e5b..5ac38c34d1128 100644
--- a/clang/lib/Driver/Distro.cpp
+++ b/clang/lib/Driver/Distro.cpp
@@ -90,6 +90,7 @@ static Distro::DistroType 
DetectLsbRelease(llvm::vfs::FileSystem ) {
 .Case("groovy", Distro::UbuntuGroovy)
 .Case("hirsute", Distro::UbuntuHirsute)
 .Case("impish", Distro::UbuntuImpish)
+.Case("jammy", Distro::UbuntuJammy)
 .Default(Distro::UnknownDistro);
   return Version;
 }



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


[PATCH] D106102: [analyzer][solver] Introduce reasoning for not equal to operator

2021-10-23 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment.

In D106102#3081178 , @bjope wrote:

> I get failures after having merged this patch:
> [...]
> Here is the crash.c input F19785350: crash.c 
> 
>
> I see lots of these. Probably worth a revert.

Yeah, actually our nightlies are also crying for the same reason, thus I'm 
reverting this.
@martong, we should have run some measurement jobs. We definitely need tighter 
integration with the upstream changes, regarding our build jobs.

@bjope, thanks for the quick report.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106102

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


[clang] f9db6a4 - Revert "[analyzer][solver] Introduce reasoning for not equal to operator"

2021-10-23 Thread Balazs Benics via cfe-commits

Author: Balazs Benics
Date: 2021-10-23T21:01:59+02:00
New Revision: f9db6a44eb37fe4c97521e033ff2e30e9558d86a

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

LOG: Revert "[analyzer][solver] Introduce reasoning for not equal to operator"

This reverts commit cac8808f154cef6446e507d55aba5721c3bd5352.

 #5 0x7f28ec629859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x25859)
 #6 0x7f28ec629729 (/lib/x86_64-linux-gnu/libc.so.6+0x25729)
 #7 0x7f28ec63af36 (/lib/x86_64-linux-gnu/libc.so.6+0x36f36)
 #8 0x7f28ecc2cc46 llvm::APInt::compareSigned(llvm::APInt const&) const 
(libLLVMSupport.so.14git+0xeac46)
 #9 0x7f28e7bbf957 (anonymous 
namespace)::SymbolicRangeInferrer::VisitBinaryOperator(clang::ento::RangeSet, 
clang::BinaryOperatorKind, clang::ento::RangeSet, clang::QualType) 
(libclangStaticAnalyzerCore.so.14git+0x1df957)
 #10 0x7f28e7bbf2db (anonymous 
namespace)::SymbolicRangeInferrer::infer(clang::ento::SymExpr const*) 
(libclangStaticAnalyzerCore.so.14git+0x1df2db)
 #11 0x7f28e7bb2b5e (anonymous 
namespace)::RangeConstraintManager::assumeSymNE(llvm::IntrusiveRefCntPtr, clang::ento::SymExpr const*, llvm::APSInt const&, llvm::APSInt const&) 
(libclangStaticAnalyzerCore.so.14git+0x1d2b5e)
 #12 0x7f28e7bc67af 
clang::ento::RangedConstraintManager::assumeSymUnsupported(llvm::IntrusiveRefCntPtr, clang::ento::SymExpr const*, bool) 
(libclangStaticAnalyzerCore.so.14git+0x1e67af)
 #13 0x7f28e7be3578 
clang::ento::SimpleConstraintManager::assumeAux(llvm::IntrusiveRefCntPtr, clang::ento::NonLoc, bool) 
(libclangStaticAnalyzerCore.so.14git+0x203578)
 #14 0x7f28e7be33d8 
clang::ento::SimpleConstraintManager::assume(llvm::IntrusiveRefCntPtr, clang::ento::NonLoc, bool) 
(libclangStaticAnalyzerCore.so.14git+0x2033d8)
 #15 0x7f28e7be32fb 
clang::ento::SimpleConstraintManager::assume(llvm::IntrusiveRefCntPtr, clang::ento::DefinedSVal, bool) 
(libclangStaticAnalyzerCore.so.14git+0x2032fb)
 #16 0x7f28e7b15dbc 
clang::ento::ConstraintManager::assumeDual(llvm::IntrusiveRefCntPtr, clang::ento::DefinedSVal) 
(libclangStaticAnalyzerCore.so.14git+0x135dbc)
 #17 0x7f28e7b4780f 
clang::ento::ExprEngine::evalEagerlyAssumeBinOpBifurcation(clang::ento::ExplodedNodeSet&,
 clang::ento::ExplodedNodeSet&, clang::Expr const*) 
(libclangStaticAnalyzerCore.so.14git+0x16780f)

This is known to be triggered on curl, tinyxml2, tmux, twin and on xerces.
But @bjope also reported similar crashes.
So, I'm reverting it to make our internal bots happy again.

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

Added: 


Modified: 
clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
clang/test/Analysis/constant-folding.c

Removed: 




diff  --git a/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp 
b/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
index 2f69191a1792..e75a207ee86a 100644
--- a/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
+++ b/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
@@ -20,8 +20,8 @@
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/ImmutableSet.h"
 #include "llvm/ADT/STLExtras.h"
-#include "llvm/ADT/SmallSet.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/SmallSet.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/raw_ostream.h"
 #include 
@@ -955,7 +955,18 @@ class SymbolicRangeInferrer
   }
 
   RangeSet VisitBinaryOperator(RangeSet LHS, BinaryOperator::Opcode Op,
-   RangeSet RHS, QualType T);
+   RangeSet RHS, QualType T) {
+switch (Op) {
+case BO_Or:
+  return VisitBinaryOperator(LHS, RHS, T);
+case BO_And:
+  return VisitBinaryOperator(LHS, RHS, T);
+case BO_Rem:
+  return VisitBinaryOperator(LHS, RHS, T);
+default:
+  return infer(T);
+}
+  }
 
   
//===--===//
   // Ranges and operators
@@ -1220,29 +1231,6 @@ class SymbolicRangeInferrer
 //   Range-based reasoning about symbolic operations
 
//===--===//
 
-template <>
-RangeSet SymbolicRangeInferrer::VisitBinaryOperator(RangeSet LHS,
-   RangeSet RHS,
-   QualType T) {
-  // When both the RangeSets are non-overlapping then all possible pairs of
-  // (x, y) in LHS, RHS respectively, will satisfy expression (x != y).
-  if ((LHS.getMaxValue() < RHS.getMinValue()) ||
-  (LHS.getMinValue() > RHS.getMaxValue())) {
-return getTrueRange(T);
-  }
-
-  // If both RangeSets contain only one Point which is equal then the
-  // expression will 

[PATCH] D77776: [Driver] Default to libc++ on FreeBSD

2021-10-23 Thread Greg V via Phabricator via cfe-commits
myfreeweb added a comment.
Herald added a subscriber: pengfei.

It's been over a year and no solutions have been merged! The problem just 
popped up again in Firefox after a pull. With clang 13.0, and the discussion 
above was before 11.0 release >_<

Can someone commit something already?!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D6

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


[PATCH] D112349: [Verifier] Add verification logic for GlobalIFuncs

2021-10-23 Thread Itay Bookstein via Phabricator via cfe-commits
ibookstein added a comment.

Because this commit changes an existing binary bitcode file, and because that 
file specifically tests backwards compatibility, does that mean I need to avoid 
changing it and instead add a backwards compatibility fix to the BitcodeReader? 
(Something like always bitcasting to the required type?)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112349

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


[PATCH] D112349: [Verifier] Add verification logic for GlobalIFuncs

2021-10-23 Thread Itay Bookstein via Phabricator via cfe-commits
ibookstein updated this revision to Diff 381754.
ibookstein added a comment.

Now using arcanist because commit includes change to binary file.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112349

Files:
  clang/lib/CodeGen/CodeGenModule.cpp
  llvm/lib/IR/Globals.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/test/Assembler/ifunc-asm.ll
  llvm/test/Assembler/ifunc-dsolocal.ll
  llvm/test/Assembler/ifunc-use-list-order.ll
  llvm/test/Bindings/llvm-c/echo.ll
  llvm/test/Bitcode/compatibility-6.0.ll
  llvm/test/Bitcode/compatibility-6.0.ll.bc
  llvm/test/Bitcode/compatibility.ll
  llvm/test/Bitcode/dso_local_equivalent.ll
  llvm/test/Bitcode/dso_location.ll
  llvm/test/CodeGen/X86/addrsig.ll
  llvm/test/CodeGen/X86/dso_local_equivalent.ll
  llvm/test/CodeGen/X86/ifunc-asm.ll
  llvm/test/CodeGen/X86/partition.ll
  llvm/test/LTO/Resolution/X86/Inputs/ifunc2.ll
  llvm/test/LTO/Resolution/X86/ifunc.ll
  llvm/test/LTO/Resolution/X86/ifunc2.ll
  llvm/test/Linker/ifunc.ll
  llvm/test/Object/X86/nm-ir.ll
  llvm/test/ThinLTO/X86/empty-module.ll
  llvm/test/Transforms/GlobalDCE/global-ifunc.ll

Index: llvm/test/Transforms/GlobalDCE/global-ifunc.ll
===
--- llvm/test/Transforms/GlobalDCE/global-ifunc.ll
+++ llvm/test/Transforms/GlobalDCE/global-ifunc.ll
@@ -2,12 +2,12 @@
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
-@if = ifunc void (), void ()* @fn
+@if = ifunc void (), void ()* ()* @fn
 
-define internal void @fn() {
+define internal void ()* @fn() {
 entry:
-  ret void
+  ret void ()* null
 }
 
-; CHECK-DAG: @if = ifunc void (), void ()* @fn
-; CHECK-DAG: define internal void @fn(
+; CHECK-DAG: @if = ifunc void (), void ()* ()* @fn
+; CHECK-DAG: define internal void ()* @fn(
Index: llvm/test/ThinLTO/X86/empty-module.ll
===
--- llvm/test/ThinLTO/X86/empty-module.ll
+++ llvm/test/ThinLTO/X86/empty-module.ll
@@ -10,9 +10,9 @@
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
-@foo = ifunc i32 (i32), i64 ()* @foo_ifunc
+@foo = ifunc i32 (i32), i32 (i32)* ()* @foo_ifunc
 
-define internal i64 @foo_ifunc() {
+define internal i32 (i32)* @foo_ifunc() {
 entry:
-  ret i64 0
+  ret i32 (i32)* null
 }
Index: llvm/test/Object/X86/nm-ir.ll
===
--- llvm/test/Object/X86/nm-ir.ll
+++ llvm/test/Object/X86/nm-ir.ll
@@ -32,12 +32,12 @@
 @a1 = alias i32, i32* @g1
 @a2 = internal alias i32, i32* @g1
 
-define void @f1() {
+define void ()* @f1() {
   call void @f5()
-  ret void
+  ret void ()* null
 }
 
-@ifunc_f1 = ifunc void (), void ()* @f1
+@ifunc_f1 = ifunc void (), void ()* ()* @f1
 
 define internal void @f2() {
   ret void
Index: llvm/test/Linker/ifunc.ll
===
--- llvm/test/Linker/ifunc.ll
+++ llvm/test/Linker/ifunc.ll
@@ -3,18 +3,18 @@
 
 ;; Check that ifuncs are linked in properly.
 
-; CHECK-DAG: @foo = ifunc void (), bitcast (void ()* ()* @foo_resolve to void ()*)
+; CHECK-DAG: @foo = ifunc void (), void ()* ()* @foo_resolve
 ; CHECK-DAG: define internal void ()* @foo_resolve() {
 
-; CHECK-DAG: @bar = ifunc void (), bitcast (void ()* ()* @bar_resolve to void ()*)
+; CHECK-DAG: @bar = ifunc void (), void ()* ()* @bar_resolve
 ; CHECK-DAG: define internal void ()* @bar_resolve() {
 
 ;--- a.ll
 declare void @bar()
 
 ;--- b.ll
-@foo = ifunc void (), bitcast (void ()* ()* @foo_resolve to void ()*)
-@bar = ifunc void (), bitcast (void ()* ()* @bar_resolve to void ()*)
+@foo = ifunc void (), void ()* ()* @foo_resolve
+@bar = ifunc void (), void ()* ()* @bar_resolve
 
 define internal void ()* @foo_resolve() {
   ret void ()* null
Index: llvm/test/LTO/Resolution/X86/ifunc2.ll
===
--- llvm/test/LTO/Resolution/X86/ifunc2.ll
+++ llvm/test/LTO/Resolution/X86/ifunc2.ll
@@ -6,14 +6,14 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
-; CHECK: @foo = ifunc i32 (), i32 ()* @foo_resolver.2
-@foo = ifunc i32 (), i32 ()* @foo_resolver
+; CHECK: @foo = ifunc i32 (), i32 ()* ()* @foo_resolver.2
+@foo = ifunc i32 (), i32 ()* ()* @foo_resolver
 
-; CHECK: define internal i32 @foo_resolver.2() {
-; CHECK-NEXT: ret i32 1
-define weak i32 @foo_resolver() {
-  ret i32 1
+; CHECK: define internal i32 ()* @foo_resolver.2() {
+; CHECK-NEXT: ret i32 ()* inttoptr (i32 1 to i32 ()*)
+define weak i32 ()* @foo_resolver() {
+  ret i32 ()* inttoptr (i32 1 to i32 ()*)
 }
 
-; CHECK: define i32 @foo_resolver() {
-; CHECK-NEXT: ret i32 2
+; CHECK: define i32 ()* @foo_resolver() {
+; CHECK-NEXT: ret i32 ()* inttoptr (i32 2 to i32 ()*)
Index: llvm/test/LTO/Resolution/X86/ifunc.ll

[PATCH] D112349: [Verifier] Add verification logic for GlobalIFuncs

2021-10-23 Thread Itay Bookstein via Phabricator via cfe-commits
ibookstein updated this revision to Diff 381751.
ibookstein added a comment.

rebase


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

https://reviews.llvm.org/D112349

Files:
  clang/lib/CodeGen/CodeGenModule.cpp
  llvm/lib/IR/Globals.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/test/Assembler/ifunc-asm.ll
  llvm/test/Assembler/ifunc-dsolocal.ll
  llvm/test/Assembler/ifunc-use-list-order.ll
  llvm/test/Bindings/llvm-c/echo.ll
  llvm/test/Bitcode/compatibility-6.0.ll
  llvm/test/Bitcode/compatibility-6.0.ll.bc
  llvm/test/Bitcode/compatibility.ll
  llvm/test/Bitcode/dso_local_equivalent.ll
  llvm/test/Bitcode/dso_location.ll
  llvm/test/CodeGen/X86/addrsig.ll
  llvm/test/CodeGen/X86/dso_local_equivalent.ll
  llvm/test/CodeGen/X86/ifunc-asm.ll
  llvm/test/CodeGen/X86/partition.ll
  llvm/test/LTO/Resolution/X86/Inputs/ifunc2.ll
  llvm/test/LTO/Resolution/X86/ifunc.ll
  llvm/test/LTO/Resolution/X86/ifunc2.ll
  llvm/test/Linker/ifunc.ll
  llvm/test/Object/X86/nm-ir.ll
  llvm/test/ThinLTO/X86/empty-module.ll
  llvm/test/Transforms/GlobalDCE/global-ifunc.ll

Index: llvm/test/Transforms/GlobalDCE/global-ifunc.ll
===
--- llvm/test/Transforms/GlobalDCE/global-ifunc.ll
+++ llvm/test/Transforms/GlobalDCE/global-ifunc.ll
@@ -2,12 +2,12 @@
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
-@if = ifunc void (), void ()* @fn
+@if = ifunc void (), void ()* ()* @fn
 
-define internal void @fn() {
+define internal void ()* @fn() {
 entry:
-  ret void
+  ret void ()* null
 }
 
-; CHECK-DAG: @if = ifunc void (), void ()* @fn
-; CHECK-DAG: define internal void @fn(
+; CHECK-DAG: @if = ifunc void (), void ()* ()* @fn
+; CHECK-DAG: define internal void ()* @fn(
Index: llvm/test/ThinLTO/X86/empty-module.ll
===
--- llvm/test/ThinLTO/X86/empty-module.ll
+++ llvm/test/ThinLTO/X86/empty-module.ll
@@ -10,9 +10,9 @@
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
-@foo = ifunc i32 (i32), i64 ()* @foo_ifunc
+@foo = ifunc i32 (i32), i32 (i32)* ()* @foo_ifunc
 
-define internal i64 @foo_ifunc() {
+define internal i32 (i32)* @foo_ifunc() {
 entry:
-  ret i64 0
+  ret i32 (i32)* null
 }
Index: llvm/test/Object/X86/nm-ir.ll
===
--- llvm/test/Object/X86/nm-ir.ll
+++ llvm/test/Object/X86/nm-ir.ll
@@ -32,12 +32,12 @@
 @a1 = alias i32, i32* @g1
 @a2 = internal alias i32, i32* @g1
 
-define void @f1() {
+define void ()* @f1() {
   call void @f5()
-  ret void
+  ret void ()* null
 }
 
-@ifunc_f1 = ifunc void (), void ()* @f1
+@ifunc_f1 = ifunc void (), void ()* ()* @f1
 
 define internal void @f2() {
   ret void
Index: llvm/test/Linker/ifunc.ll
===
--- llvm/test/Linker/ifunc.ll
+++ llvm/test/Linker/ifunc.ll
@@ -3,18 +3,18 @@
 
 ;; Check that ifuncs are linked in properly.
 
-; CHECK-DAG: @foo = ifunc void (), bitcast (void ()* ()* @foo_resolve to void ()*)
+; CHECK-DAG: @foo = ifunc void (), void ()* ()* @foo_resolve
 ; CHECK-DAG: define internal void ()* @foo_resolve() {
 
-; CHECK-DAG: @bar = ifunc void (), bitcast (void ()* ()* @bar_resolve to void ()*)
+; CHECK-DAG: @bar = ifunc void (), void ()* ()* @bar_resolve
 ; CHECK-DAG: define internal void ()* @bar_resolve() {
 
 ;--- a.ll
 declare void @bar()
 
 ;--- b.ll
-@foo = ifunc void (), bitcast (void ()* ()* @foo_resolve to void ()*)
-@bar = ifunc void (), bitcast (void ()* ()* @bar_resolve to void ()*)
+@foo = ifunc void (), void ()* ()* @foo_resolve
+@bar = ifunc void (), void ()* ()* @bar_resolve
 
 define internal void ()* @foo_resolve() {
   ret void ()* null
Index: llvm/test/LTO/Resolution/X86/ifunc2.ll
===
--- llvm/test/LTO/Resolution/X86/ifunc2.ll
+++ llvm/test/LTO/Resolution/X86/ifunc2.ll
@@ -6,14 +6,14 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
-; CHECK: @foo = ifunc i32 (), i32 ()* @foo_resolver.2
-@foo = ifunc i32 (), i32 ()* @foo_resolver
+; CHECK: @foo = ifunc i32 (), i32 ()* ()* @foo_resolver.2
+@foo = ifunc i32 (), i32 ()* ()* @foo_resolver
 
-; CHECK: define internal i32 @foo_resolver.2() {
-; CHECK-NEXT: ret i32 1
-define weak i32 @foo_resolver() {
-  ret i32 1
+; CHECK: define internal i32 ()* @foo_resolver.2() {
+; CHECK-NEXT: ret i32 ()* inttoptr (i32 1 to i32 ()*)
+define weak i32 ()* @foo_resolver() {
+  ret i32 ()* inttoptr (i32 1 to i32 ()*)
 }
 
-; CHECK: define i32 @foo_resolver() {
-; CHECK-NEXT: ret i32 2
+; CHECK: define i32 ()* @foo_resolver() {
+; CHECK-NEXT: ret i32 ()* inttoptr (i32 2 to i32 ()*)
Index: llvm/test/LTO/Resolution/X86/ifunc.ll
===
--- llvm/test/LTO/Resolution/X86/ifunc.ll

[PATCH] D112367: [Clang][AST] Temporarily undefine IBAction/IBOutlet ObjC macros in attribute headers

2021-10-23 Thread Alf via Phabricator via cfe-commits
gAlfonso-bit created this revision.
gAlfonso-bit requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Taken from a downstream fork: 
https://github.com/apple/llvm-project/pull/3461/files.

IBAction and IBOutlet are defined when compiling with ObjC/ObjC++ enabled. This 
can cause issues due to macro expansion when we look through these header files 
while compiling in ObjC++ mode. This patch temporarily undefs these macros so 
that the compiler doesn't try to expand them when looking through these 
attribute headers.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112367

Files:
  clang/include/clang/AST/Attr.h
  clang/include/clang/AST/RecursiveASTVisitor.h


Index: clang/include/clang/AST/RecursiveASTVisitor.h
===
--- clang/include/clang/AST/RecursiveASTVisitor.h
+++ clang/include/clang/AST/RecursiveASTVisitor.h
@@ -13,18 +13,23 @@
 #ifndef LLVM_CLANG_AST_RECURSIVEASTVISITOR_H
 #define LLVM_CLANG_AST_RECURSIVEASTVISITOR_H
 
+#pragma push_macro("IBAction")
+#pragma push_macro("IBOutlet")
+#undef IBAction
+#undef IBOutlet
+
 #include "clang/AST/Attr.h"
 #include "clang/AST/Decl.h"
-#include "clang/AST/DeclarationName.h"
 #include "clang/AST/DeclBase.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclFriend.h"
 #include "clang/AST/DeclObjC.h"
 #include "clang/AST/DeclOpenMP.h"
 #include "clang/AST/DeclTemplate.h"
+#include "clang/AST/DeclarationName.h"
 #include "clang/AST/Expr.h"
-#include "clang/AST/ExprConcepts.h"
 #include "clang/AST/ExprCXX.h"
+#include "clang/AST/ExprConcepts.h"
 #include "clang/AST/ExprObjC.h"
 #include "clang/AST/ExprOpenMP.h"
 #include "clang/AST/LambdaCapture.h"
@@ -3702,4 +3707,7 @@
 
 } // end namespace clang
 
+#pragma pop_macro("IBAction")
+#pragma pop_macro("IBOutlet")
+
 #endif // LLVM_CLANG_AST_RECURSIVEASTVISITOR_H
Index: clang/include/clang/AST/Attr.h
===
--- clang/include/clang/AST/Attr.h
+++ clang/include/clang/AST/Attr.h
@@ -13,14 +13,19 @@
 #ifndef LLVM_CLANG_AST_ATTR_H
 #define LLVM_CLANG_AST_ATTR_H
 
+#pragma push_macro("IBAction")
+#pragma push_macro("IBOutlet")
+#undef IBAction
+#undef IBOutlet
+
 #include "clang/AST/ASTFwd.h"
 #include "clang/AST/AttrIterator.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/Type.h"
 #include "clang/Basic/AttrKinds.h"
 #include "clang/Basic/AttributeCommonInfo.h"
-#include "clang/Basic/LangOptions.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Basic/LangOptions.h"
 #include "clang/Basic/OpenMPKinds.h"
 #include "clang/Basic/Sanitizers.h"
 #include "clang/Basic/SourceLocation.h"
@@ -379,4 +384,7 @@
 }
 }  // end namespace clang
 
+#pragma pop_macro("IBAction")
+#pragma pop_macro("IBOutlet")
+
 #endif


Index: clang/include/clang/AST/RecursiveASTVisitor.h
===
--- clang/include/clang/AST/RecursiveASTVisitor.h
+++ clang/include/clang/AST/RecursiveASTVisitor.h
@@ -13,18 +13,23 @@
 #ifndef LLVM_CLANG_AST_RECURSIVEASTVISITOR_H
 #define LLVM_CLANG_AST_RECURSIVEASTVISITOR_H
 
+#pragma push_macro("IBAction")
+#pragma push_macro("IBOutlet")
+#undef IBAction
+#undef IBOutlet
+
 #include "clang/AST/Attr.h"
 #include "clang/AST/Decl.h"
-#include "clang/AST/DeclarationName.h"
 #include "clang/AST/DeclBase.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclFriend.h"
 #include "clang/AST/DeclObjC.h"
 #include "clang/AST/DeclOpenMP.h"
 #include "clang/AST/DeclTemplate.h"
+#include "clang/AST/DeclarationName.h"
 #include "clang/AST/Expr.h"
-#include "clang/AST/ExprConcepts.h"
 #include "clang/AST/ExprCXX.h"
+#include "clang/AST/ExprConcepts.h"
 #include "clang/AST/ExprObjC.h"
 #include "clang/AST/ExprOpenMP.h"
 #include "clang/AST/LambdaCapture.h"
@@ -3702,4 +3707,7 @@
 
 } // end namespace clang
 
+#pragma pop_macro("IBAction")
+#pragma pop_macro("IBOutlet")
+
 #endif // LLVM_CLANG_AST_RECURSIVEASTVISITOR_H
Index: clang/include/clang/AST/Attr.h
===
--- clang/include/clang/AST/Attr.h
+++ clang/include/clang/AST/Attr.h
@@ -13,14 +13,19 @@
 #ifndef LLVM_CLANG_AST_ATTR_H
 #define LLVM_CLANG_AST_ATTR_H
 
+#pragma push_macro("IBAction")
+#pragma push_macro("IBOutlet")
+#undef IBAction
+#undef IBOutlet
+
 #include "clang/AST/ASTFwd.h"
 #include "clang/AST/AttrIterator.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/Type.h"
 #include "clang/Basic/AttrKinds.h"
 #include "clang/Basic/AttributeCommonInfo.h"
-#include "clang/Basic/LangOptions.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Basic/LangOptions.h"
 #include "clang/Basic/OpenMPKinds.h"
 #include "clang/Basic/Sanitizers.h"
 #include "clang/Basic/SourceLocation.h"
@@ -379,4 +384,7 @@
 }
 }  // end namespace clang
 
+#pragma pop_macro("IBAction")
+#pragma pop_macro("IBOutlet")
+
 #endif
___
cfe-commits 

[PATCH] D108694: [WIP][RISCV] Add the zvl extension according to the v1.0-rc2 spec

2021-10-23 Thread Yueh-Ting Chen via Phabricator via cfe-commits
eopXD updated this revision to Diff 381747.
eopXD added a comment.

Rebase.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108694

Files:
  clang/lib/Basic/Targets/RISCV.cpp
  clang/test/Driver/riscv-arch.c
  clang/test/Preprocessor/riscv-target-features.c
  llvm/include/llvm/Support/RISCVISAInfo.h
  llvm/lib/Support/RISCVISAInfo.cpp
  llvm/lib/Target/RISCV/RISCV.td
  llvm/lib/Target/RISCV/RISCVSubtarget.cpp
  llvm/lib/Target/RISCV/RISCVSubtarget.h
  llvm/test/CodeGen/RISCV/attributes.ll
  llvm/test/MC/RISCV/attribute-arch.s

Index: llvm/test/MC/RISCV/attribute-arch.s
===
--- llvm/test/MC/RISCV/attribute-arch.s
+++ llvm/test/MC/RISCV/attribute-arch.s
@@ -34,7 +34,7 @@
 # CHECK: attribute  5, "rv32i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"
 
 .attribute arch, "rv32iv"
-# CHECK: attribute  5, "rv32i2p0_v0p10_zvlsseg0p10"
+# CHECK: attribute  5, "rv32i2p0_v0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10_zvlsseg0p10"
 
 .attribute arch, "rv32izba"
 # CHECK: attribute  5, "rv32i2p0_zba1p0"
@@ -70,7 +70,43 @@
 # CHECK: attribute  5, "rv32i2p0_f2p0_zfh0p1"
 
 .attribute arch, "rv32ivzvamo_zvlsseg"
-# CHECK: attribute  5, "rv32i2p0_v0p10_zvamo0p10_zvlsseg0p10"
+# CHECK: attribute  5, "rv32i2p0_v0p10_zvamo0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10_zvlsseg0p10"
 
 .attribute arch, "rv32iv_zvamo0p10_zvlsseg"
-# CHECK: attribute  5, "rv32i2p0_v0p10_zvamo0p10_zvlsseg0p10"
+# CHECK: attribute  5, "rv32i2p0_v0p10_zvamo0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10_zvlsseg0p10"
+
+.attribute arch, "rv32ifdv_zvl32b"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10_zvlsseg0p10"
+
+.attribute arch, "rv32ifdv_zvl64b"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10_zvlsseg0p10"
+
+.attribute arch, "rv32ifdv_zvl128b"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10_zvlsseg0p10"
+
+.attribute arch, "rv32ifdv_zvl256b"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl128b0p10_zvl256b0p10_zvl32b0p10_zvl64b0p10_zvlsseg0p10"
+
+.attribute arch, "rv32ifdv_zvl512b"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl128b0p10_zvl256b0p10_zvl32b0p10_zvl512b0p10_zvl64b0p10_zvlsseg0p10"
+
+.attribute arch, "rv32ifdv_zvl1024b"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl1024b0p10_zvl128b0p10_zvl256b0p10_zvl32b0p10_zvl512b0p10_zvl64b0p10_zvlsseg0p10"
+
+.attribute arch, "rv32ifdv_zvl2048b"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl1024b0p10_zvl128b0p10_zvl2048b0p10_zvl256b0p10_zvl32b0p10_zvl512b0p10_zvl64b0p10_zvlsseg0p10"
+
+.attribute arch, "rv32ifdv_zvl4096b"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl1024b0p10_zvl128b0p10_zvl2048b0p10_zvl256b0p10_zvl32b0p10_zvl4096b0p10_zvl512b0p10_zvl64b0p10_zvlsseg0p10"
+
+.attribute arch, "rv32ifdv_zvl8192b"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl1024b0p10_zvl128b0p10_zvl2048b0p10_zvl256b0p10_zvl32b0p10_zvl4096b0p10_zvl512b0p10_zvl64b0p10_zvl8192b0p10_zvlsseg0p10"
+
+.attribute arch, "rv32ifdv_zvl16384b"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl1024b0p10_zvl128b0p10_zvl16384b0p10_zvl2048b0p10_zvl256b0p10_zvl32b0p10_zvl4096b0p10_zvl512b0p10_zvl64b0p10_zvl8192b0p10_zvlsseg0p10"
+
+.attribute arch, "rv32ifdv_zvl32768b"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl1024b0p10_zvl128b0p10_zvl16384b0p10_zvl2048b0p10_zvl256b0p10_zvl32768b0p10_zvl32b0p10_zvl4096b0p10_zvl512b0p10_zvl64b0p10_zvl8192b0p10_zvlsseg0p10"
+
+.attribute arch, "rv32ifdv_zvl65536b"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl1024b0p10_zvl128b0p10_zvl16384b0p10_zvl2048b0p10_zvl256b0p10_zvl32768b0p10_zvl32b0p10_zvl4096b0p10_zvl512b0p10_zvl64b0p10_zvl65536b0p10_zvl8192b0p10_zvlsseg0p10"
Index: llvm/test/CodeGen/RISCV/attributes.ll
===
--- llvm/test/CodeGen/RISCV/attributes.ll
+++ llvm/test/CodeGen/RISCV/attributes.ll
@@ -42,7 +42,7 @@
 ; RV32F: .attribute 5, "rv32i2p0_f2p0"
 ; RV32D: .attribute 5, "rv32i2p0_f2p0_d2p0"
 ; RV32C: .attribute 5, "rv32i2p0_c2p0"
-; RV32V: .attribute 5, "rv32i2p0_v0p10_zvamo0p10_zvlsseg0p10"
+; RV32V: .attribute 5, "rv32i2p0_v0p10_zvamo0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10_zvlsseg0p10"
 ; RV32ZFH: .attribute 5, "rv32i2p0_f2p0_zfh0p1"
 ; RV32ZBA: .attribute 5, "rv32i2p0_zba1p0"
 ; RV32ZBB: .attribute 5, "rv32i2p0_zbb1p0"
@@ -54,7 +54,7 @@
 ; RV32ZBR: .attribute 5, "rv32i2p0_zbr0p93"
 ; RV32ZBS: .attribute 5, "rv32i2p0_zbs1p0"
 ; RV32ZBT: .attribute 5, "rv32i2p0_zbt0p93"
-; RV32COMBINED: .attribute 5, "rv32i2p0_f2p0_v0p10_zfh0p1_zbb1p0_zvamo0p10_zvlsseg0p10"
+; RV32COMBINED: .attribute 5, "rv32i2p0_f2p0_v0p10_zfh0p1_zbb1p0_zvamo0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10_zvlsseg0p10"
 
 ; RV64M: .attribute 5, "rv64i2p0_m2p0"
 ; RV64A: .attribute 5, "rv64i2p0_a2p0"
@@ -72,8 

[PATCH] D112359: [NFC][RISCV] Unify depedency check and extension implication parsing logics

2021-10-23 Thread Yueh-Ting Chen via Phabricator via cfe-commits
eopXD updated this revision to Diff 381745.
eopXD added a comment.

Remove debug code.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112359

Files:
  clang/test/CodeGen/RISCV/riscv-metadata.c
  clang/test/CodeGen/RISCV/riscv32-ilp32-ilp32f-ilp32d-abi.c
  clang/test/CodeGen/RISCV/riscv32-ilp32d-abi.c
  clang/test/CodeGen/RISCV/riscv32-ilp32f-ilp32d-abi.c
  clang/test/CodeGen/RISCV/riscv64-lp64-lp64f-lp64d-abi.c
  clang/test/CodeGen/RISCV/riscv64-lp64d-abi.c
  clang/test/CodeGen/RISCV/riscv64-lp64f-lp64d-abi.c
  clang/test/CodeGen/riscv32-ilp32d-abi.cpp
  llvm/include/llvm/Support/RISCVISAInfo.h
  llvm/lib/Support/RISCVISAInfo.cpp

Index: llvm/lib/Support/RISCVISAInfo.cpp
===
--- llvm/lib/Support/RISCVISAInfo.cpp
+++ llvm/lib/Support/RISCVISAInfo.cpp
@@ -411,7 +411,6 @@
   assert(XLen == 32 || XLen == 64);
   std::unique_ptr ISAInfo(new RISCVISAInfo(XLen));
 
-  bool HasE = false;
   for (auto  : Features) {
 StringRef ExtName = Feature;
 bool Experimental = false;
@@ -430,29 +429,19 @@
 if (ExtensionInfoIterator == ExtensionInfos.end())
   continue;
 
-if (Add) {
-  if (ExtName == "e") {
-if (XLen != 32)
-  return createStringError(
-  errc::invalid_argument,
-  "standard user-level extension 'e' requires 'rv32'");
-HasE = true;
-  }
-
+if (Add)
   ISAInfo->addExtension(ExtName, ExtensionInfoIterator->Version.Major,
 ExtensionInfoIterator->Version.Minor);
-} else
-  ISAInfo->Exts.erase(ExtName.str());
-  }
-  if (!HasE) {
-if (auto Version = findDefaultVersion("i"))
-  ISAInfo->addExtension("i", Version->Major, Version->Minor);
 else
-  llvm_unreachable("Default extension version for 'i' not found?");
+  ISAInfo->Exts.erase(ExtName.str());
   }
 
+  ISAInfo->updateImplication();
   ISAInfo->updateFLen();
 
+  if (Error Result = ISAInfo->checkDependency())
+return std::move(Result);
+
   return std::move(ISAInfo);
 }
 
@@ -478,7 +467,6 @@
   // The canonical order specified in ISA manual.
   // Ref: Table 22.1 in RISC-V User-Level ISA V2.2
   StringRef StdExts = AllStdExts;
-  bool HasF = false, HasD = false;
   char Baseline = Arch[4];
 
   // First letter should be 'e', 'i' or 'g'.
@@ -499,8 +487,6 @@
   case 'g':
 // g = imafd
 StdExts = StdExts.drop_front(4);
-HasF = true;
-HasD = true;
 break;
   }
 
@@ -581,34 +567,14 @@
 
 // The order is OK, then push it into features.
 // TODO: Use version number when setting target features
-switch (C) {
-default:
-  // Currently LLVM supports only "mafdcbv".
+// Currently LLVM supports only "mafdcbv".
+StringRef SupportedStandardExtension = "mafdcbv";
+if (SupportedStandardExtension.find(C) == StringRef::npos)
   return createStringError(errc::invalid_argument,
"unsupported standard user-level extension '%c'",
C);
-case 'm':
-  ISAInfo->addExtension("m", Major, Minor);
-  break;
-case 'a':
-  ISAInfo->addExtension("a", Major, Minor);
-  break;
-case 'f':
-  ISAInfo->addExtension("f", Major, Minor);
-  HasF = true;
-  break;
-case 'd':
-  ISAInfo->addExtension("d", Major, Minor);
-  HasD = true;
-  break;
-case 'c':
-  ISAInfo->addExtension("c", Major, Minor);
-  break;
-case 'v':
-  ISAInfo->addExtension("v", Major, Minor);
-  ISAInfo->addExtension("zvlsseg", Major, Minor);
-  break;
-}
+ISAInfo->addExtension(std::string(1, C), Major, Minor);
+
 // Consume full extension name and version, including any optional '_'
 // between this extension and the next
 ++I;
@@ -616,21 +582,6 @@
 if (*I == '_')
   ++I;
   }
-  // Dependency check.
-  // It's illegal to specify the 'd' (double-precision floating point)
-  // extension without also specifying the 'f' (single precision
-  // floating-point) extension.
-  // TODO: This has been removed in later specs, which specify that D implies F
-  if (HasD && !HasF)
-return createStringError(errc::invalid_argument,
- "d requires f extension to also be specified");
-
-  // Additional dependency checks.
-  // TODO: The 'q' extension requires rv64.
-  // TODO: It is illegal to specify 'e' extensions with 'f' and 'd'.
-
-  if (OtherExts.empty())
-return std::move(ISAInfo);
 
   // Handle other types of extensions other than the standard
   // general purpose and standard user-level extensions.
@@ -651,52 +602,53 @@
   std::array Prefix{"z", "x", "s", "sx"};
   auto I = Prefix.begin();
   auto E = Prefix.end();
+  if (Split.size() > 1 || Split[0] != "") {
+for (StringRef Ext : Split) {
+  if (Ext.empty())
+return createStringError(errc::invalid_argument,
+ 

[PATCH] D112359: [NFC][RISCV] Unify depedency check and extension implication parsing logics

2021-10-23 Thread Yueh-Ting Chen via Phabricator via cfe-commits
eopXD updated this revision to Diff 381744.
eopXD added a comment.

Minor update.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112359

Files:
  clang/test/CodeGen/RISCV/riscv-metadata.c
  clang/test/CodeGen/RISCV/riscv32-ilp32-ilp32f-ilp32d-abi.c
  clang/test/CodeGen/RISCV/riscv32-ilp32d-abi.c
  clang/test/CodeGen/RISCV/riscv32-ilp32f-ilp32d-abi.c
  clang/test/CodeGen/RISCV/riscv64-lp64-lp64f-lp64d-abi.c
  clang/test/CodeGen/RISCV/riscv64-lp64d-abi.c
  clang/test/CodeGen/RISCV/riscv64-lp64f-lp64d-abi.c
  clang/test/CodeGen/riscv32-ilp32d-abi.cpp
  llvm/include/llvm/Support/RISCVISAInfo.h
  llvm/lib/Support/RISCVISAInfo.cpp

Index: llvm/lib/Support/RISCVISAInfo.cpp
===
--- llvm/lib/Support/RISCVISAInfo.cpp
+++ llvm/lib/Support/RISCVISAInfo.cpp
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace llvm;
 
@@ -411,7 +412,6 @@
   assert(XLen == 32 || XLen == 64);
   std::unique_ptr ISAInfo(new RISCVISAInfo(XLen));
 
-  bool HasE = false;
   for (auto  : Features) {
 StringRef ExtName = Feature;
 bool Experimental = false;
@@ -430,29 +430,19 @@
 if (ExtensionInfoIterator == ExtensionInfos.end())
   continue;
 
-if (Add) {
-  if (ExtName == "e") {
-if (XLen != 32)
-  return createStringError(
-  errc::invalid_argument,
-  "standard user-level extension 'e' requires 'rv32'");
-HasE = true;
-  }
-
+if (Add)
   ISAInfo->addExtension(ExtName, ExtensionInfoIterator->Version.Major,
 ExtensionInfoIterator->Version.Minor);
-} else
-  ISAInfo->Exts.erase(ExtName.str());
-  }
-  if (!HasE) {
-if (auto Version = findDefaultVersion("i"))
-  ISAInfo->addExtension("i", Version->Major, Version->Minor);
 else
-  llvm_unreachable("Default extension version for 'i' not found?");
+  ISAInfo->Exts.erase(ExtName.str());
   }
 
+  ISAInfo->updateImplication();
   ISAInfo->updateFLen();
 
+  if (Error Result = ISAInfo->checkDependency())
+return std::move(Result);
+
   return std::move(ISAInfo);
 }
 
@@ -478,7 +468,6 @@
   // The canonical order specified in ISA manual.
   // Ref: Table 22.1 in RISC-V User-Level ISA V2.2
   StringRef StdExts = AllStdExts;
-  bool HasF = false, HasD = false;
   char Baseline = Arch[4];
 
   // First letter should be 'e', 'i' or 'g'.
@@ -499,8 +488,6 @@
   case 'g':
 // g = imafd
 StdExts = StdExts.drop_front(4);
-HasF = true;
-HasD = true;
 break;
   }
 
@@ -518,6 +505,8 @@
 Exts = Exts.substr(0, Pos);
   }
 
+  dbgs() << OtherExts << "\n";
+
   unsigned Major, Minor, ConsumeLength;
   if (auto E = getExtensionVersion(std::string(1, Baseline), Exts, Major, Minor,
ConsumeLength, EnableExperimentalExtension,
@@ -581,34 +570,14 @@
 
 // The order is OK, then push it into features.
 // TODO: Use version number when setting target features
-switch (C) {
-default:
-  // Currently LLVM supports only "mafdcbv".
+// Currently LLVM supports only "mafdcbv".
+StringRef SupportedStandardExtension = "mafdcbv";
+if (SupportedStandardExtension.find(C) == StringRef::npos)
   return createStringError(errc::invalid_argument,
"unsupported standard user-level extension '%c'",
C);
-case 'm':
-  ISAInfo->addExtension("m", Major, Minor);
-  break;
-case 'a':
-  ISAInfo->addExtension("a", Major, Minor);
-  break;
-case 'f':
-  ISAInfo->addExtension("f", Major, Minor);
-  HasF = true;
-  break;
-case 'd':
-  ISAInfo->addExtension("d", Major, Minor);
-  HasD = true;
-  break;
-case 'c':
-  ISAInfo->addExtension("c", Major, Minor);
-  break;
-case 'v':
-  ISAInfo->addExtension("v", Major, Minor);
-  ISAInfo->addExtension("zvlsseg", Major, Minor);
-  break;
-}
+ISAInfo->addExtension(std::string(1, C), Major, Minor);
+
 // Consume full extension name and version, including any optional '_'
 // between this extension and the next
 ++I;
@@ -616,21 +585,6 @@
 if (*I == '_')
   ++I;
   }
-  // Dependency check.
-  // It's illegal to specify the 'd' (double-precision floating point)
-  // extension without also specifying the 'f' (single precision
-  // floating-point) extension.
-  // TODO: This has been removed in later specs, which specify that D implies F
-  if (HasD && !HasF)
-return createStringError(errc::invalid_argument,
- "d requires f extension to also be specified");
-
-  // Additional dependency checks.
-  // TODO: The 'q' extension requires rv64.
-  // TODO: It is illegal to specify 'e' extensions with 'f' and 'd'.
-
-  if (OtherExts.empty())
-return std::move(ISAInfo);
 
   // Handle other types of 

[PATCH] D112359: [NFC][RISCV] Unify depedency check and extension implication parsing logics

2021-10-23 Thread Yueh-Ting Chen via Phabricator via cfe-commits
eopXD updated this revision to Diff 381742.
eopXD added a comment.

Rebase.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112359

Files:
  clang/test/CodeGen/RISCV/riscv-metadata.c
  clang/test/CodeGen/RISCV/riscv32-ilp32-ilp32f-ilp32d-abi.c
  clang/test/CodeGen/RISCV/riscv32-ilp32d-abi.c
  clang/test/CodeGen/RISCV/riscv32-ilp32f-ilp32d-abi.c
  clang/test/CodeGen/RISCV/riscv64-lp64-lp64f-lp64d-abi.c
  clang/test/CodeGen/RISCV/riscv64-lp64d-abi.c
  clang/test/CodeGen/RISCV/riscv64-lp64f-lp64d-abi.c
  clang/test/CodeGen/riscv32-ilp32d-abi.cpp
  llvm/include/llvm/Support/RISCVISAInfo.h
  llvm/lib/Support/RISCVISAInfo.cpp

Index: llvm/lib/Support/RISCVISAInfo.cpp
===
--- llvm/lib/Support/RISCVISAInfo.cpp
+++ llvm/lib/Support/RISCVISAInfo.cpp
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace llvm;
 
@@ -411,7 +412,6 @@
   assert(XLen == 32 || XLen == 64);
   std::unique_ptr ISAInfo(new RISCVISAInfo(XLen));
 
-  bool HasE = false;
   for (auto  : Features) {
 StringRef ExtName = Feature;
 bool Experimental = false;
@@ -430,28 +430,18 @@
 if (ExtensionInfoIterator == ExtensionInfos.end())
   continue;
 
-if (Add) {
-  if (ExtName == "e") {
-if (XLen != 32)
-  return createStringError(
-  errc::invalid_argument,
-  "standard user-level extension 'e' requires 'rv32'");
-HasE = true;
-  }
-
+if (Add)
   ISAInfo->addExtension(ExtName, ExtensionInfoIterator->Version.Major,
 ExtensionInfoIterator->Version.Minor);
-} else
-  ISAInfo->Exts.erase(ExtName.str());
-  }
-  if (!HasE) {
-if (auto Version = findDefaultVersion("i"))
-  ISAInfo->addExtension("i", Version->Major, Version->Minor);
 else
-  llvm_unreachable("Default extension version for 'i' not found?");
+  ISAInfo->Exts.erase(ExtName.str());
   }
 
   ISAInfo->updateFLen();
+  ISAInfo->updateImplication();
+
+  if (Error Result = ISAInfo->checkDependency())
+return std::move(Result);
 
   return std::move(ISAInfo);
 }
@@ -478,7 +468,6 @@
   // The canonical order specified in ISA manual.
   // Ref: Table 22.1 in RISC-V User-Level ISA V2.2
   StringRef StdExts = AllStdExts;
-  bool HasF = false, HasD = false;
   char Baseline = Arch[4];
 
   // First letter should be 'e', 'i' or 'g'.
@@ -499,8 +488,6 @@
   case 'g':
 // g = imafd
 StdExts = StdExts.drop_front(4);
-HasF = true;
-HasD = true;
 break;
   }
 
@@ -518,6 +505,8 @@
 Exts = Exts.substr(0, Pos);
   }
 
+  dbgs() << OtherExts << "\n";
+
   unsigned Major, Minor, ConsumeLength;
   if (auto E = getExtensionVersion(std::string(1, Baseline), Exts, Major, Minor,
ConsumeLength, EnableExperimentalExtension,
@@ -581,34 +570,14 @@
 
 // The order is OK, then push it into features.
 // TODO: Use version number when setting target features
-switch (C) {
-default:
-  // Currently LLVM supports only "mafdcbv".
+// Currently LLVM supports only "mafdcbv".
+StringRef SupportedStandardExtension = "mafdcbv";
+if (SupportedStandardExtension.find(C) == StringRef::npos)
   return createStringError(errc::invalid_argument,
"unsupported standard user-level extension '%c'",
C);
-case 'm':
-  ISAInfo->addExtension("m", Major, Minor);
-  break;
-case 'a':
-  ISAInfo->addExtension("a", Major, Minor);
-  break;
-case 'f':
-  ISAInfo->addExtension("f", Major, Minor);
-  HasF = true;
-  break;
-case 'd':
-  ISAInfo->addExtension("d", Major, Minor);
-  HasD = true;
-  break;
-case 'c':
-  ISAInfo->addExtension("c", Major, Minor);
-  break;
-case 'v':
-  ISAInfo->addExtension("v", Major, Minor);
-  ISAInfo->addExtension("zvlsseg", Major, Minor);
-  break;
-}
+ISAInfo->addExtension(std::string(1, C), Major, Minor);
+
 // Consume full extension name and version, including any optional '_'
 // between this extension and the next
 ++I;
@@ -616,21 +585,6 @@
 if (*I == '_')
   ++I;
   }
-  // Dependency check.
-  // It's illegal to specify the 'd' (double-precision floating point)
-  // extension without also specifying the 'f' (single precision
-  // floating-point) extension.
-  // TODO: This has been removed in later specs, which specify that D implies F
-  if (HasD && !HasF)
-return createStringError(errc::invalid_argument,
- "d requires f extension to also be specified");
-
-  // Additional dependency checks.
-  // TODO: The 'q' extension requires rv64.
-  // TODO: It is illegal to specify 'e' extensions with 'f' and 'd'.
-
-  if (OtherExts.empty())
-return std::move(ISAInfo);
 
   // Handle other types of extensions 

[clang] d8e4170 - Ensure newlines at the end of files (NFC)

2021-10-23 Thread Kazu Hirata via cfe-commits

Author: Kazu Hirata
Date: 2021-10-23T08:45:29-07:00
New Revision: d8e4170b0a1431edee939efc16b60b409affcb4d

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

LOG: Ensure newlines at the end of files (NFC)

Added: 


Modified: 
clang-tools-extra/clangd/HeuristicResolver.cpp
clang/docs/analyzer/developer-docs.rst
clang/lib/Driver/ToolChains/AMDGPU.cpp
clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
libc/test/src/string/memory_utils/CMakeLists.txt
libcxx/benchmarks/algorithms.bench.cpp
lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h
llvm/docs/TableGen/BackGuide.rst
llvm/include/llvm/CodeGen/GlobalISel/GenericMachineInstrs.h
llvm/lib/Analysis/OverflowInstAnalysis.cpp
llvm/lib/CodeGen/CodeGenCommonISel.cpp
llvm/lib/Support/DebugOptions.h
llvm/lib/Target/AMDGPU/MCA/CMakeLists.txt
llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp
llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp
llvm/lib/Target/CSKY/CSKYInstrFormats.td
llvm/lib/Target/CSKY/CSKYInstrInfo.td
llvm/lib/Target/CSKY/CSKYSubtarget.cpp
llvm/lib/Target/CSKY/CSKYSubtarget.h
llvm/lib/Target/CSKY/MCTargetDesc/CSKYFixupKinds.h
llvm/lib/Target/CSKY/MCTargetDesc/CSKYInstPrinter.h
llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCCodeEmitter.cpp
llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCCodeEmitter.h
llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.cpp
llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.h
llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCTargetDesc.h
llvm/tools/llvm-exegesis/lib/SnippetFile.h
mlir/lib/Bindings/Python/Pass.h
mlir/lib/Dialect/Linalg/Transforms/LinalgStrategyPasses.cpp
openmp/libomptarget/plugins/ppc64/CMakeLists.txt
openmp/libomptarget/plugins/ppc64le/CMakeLists.txt
openmp/libomptarget/plugins/x86_64/CMakeLists.txt

Removed: 




diff  --git a/clang-tools-extra/clangd/HeuristicResolver.cpp 
b/clang-tools-extra/clangd/HeuristicResolver.cpp
index b0a7448a04ef0..2505280ffa9aa 100644
--- a/clang-tools-extra/clangd/HeuristicResolver.cpp
+++ b/clang-tools-extra/clangd/HeuristicResolver.cpp
@@ -266,4 +266,4 @@ std::vector 
HeuristicResolver::resolveDependentMember(
 }
 
 } // namespace clangd
-} // namespace clang
\ No newline at end of file
+} // namespace clang

diff  --git a/clang/docs/analyzer/developer-docs.rst 
b/clang/docs/analyzer/developer-docs.rst
index a3d74a765f933..5f430ca7e11bd 100644
--- a/clang/docs/analyzer/developer-docs.rst
+++ b/clang/docs/analyzer/developer-docs.rst
@@ -11,4 +11,4 @@ Contents:
developer-docs/InitializerLists
developer-docs/nullability
developer-docs/RegionStore
-   
\ No newline at end of file
+   

diff  --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp 
b/clang/lib/Driver/ToolChains/AMDGPU.cpp
index a29ed0bdc6b4c..586a1484cd248 100644
--- a/clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -927,4 +927,4 @@ ROCMToolChain::getCommonDeviceLibNames(const 
llvm::opt::ArgList ,
   return RocmInstallation.getCommonBitcodeLibs(
   DriverArgs, LibDeviceFile, Wave64, DAZ, FiniteOnly, UnsafeMathOpt,
   FastRelaxedMath, CorrectSqrt);
-}
\ No newline at end of file
+}

diff  --git a/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
index dd65f8c035aa1..cc27bd27abe79 100644
--- a/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
@@ -1118,4 +1118,4 @@ void ento::registerStreamTesterChecker(CheckerManager 
) {
 
 bool ento::shouldRegisterStreamTesterChecker(const CheckerManager ) {
   return true;
-}
\ No newline at end of file
+}

diff  --git a/libc/test/src/string/memory_utils/CMakeLists.txt 
b/libc/test/src/string/memory_utils/CMakeLists.txt
index a1e2c90234063..9f2950dc56582 100644
--- a/libc/test/src/string/memory_utils/CMakeLists.txt
+++ b/libc/test/src/string/memory_utils/CMakeLists.txt
@@ -12,4 +12,4 @@ add_libc_unittest(
   COMPILE_OPTIONS
 ${LIBC_COMPILE_OPTIONS_NATIVE}
 -ffreestanding
-)
\ No newline at end of file
+)

diff  --git a/libcxx/benchmarks/algorithms.bench.cpp 
b/libcxx/benchmarks/algorithms.bench.cpp
index 93383e2b9cd6a..564d89d659cb0 100644
--- a/libcxx/benchmarks/algorithms.bench.cpp
+++ b/libcxx/benchmarks/algorithms.bench.cpp
@@ -334,4 +334,4 @@ int main(int argc, char** argv) {
   makeCartesianProductBenchmark(Quantities);
   makeCartesianProductBenchmark(Quantities);
   benchmark::RunSpecifiedBenchmarks();
-}
\ No newline at end of file
+}

diff  --git a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h 
b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h
index 1d67505d736ec..f4017fb663840 100644
--- 

[clang-tools-extra] d8e4170 - Ensure newlines at the end of files (NFC)

2021-10-23 Thread Kazu Hirata via cfe-commits

Author: Kazu Hirata
Date: 2021-10-23T08:45:29-07:00
New Revision: d8e4170b0a1431edee939efc16b60b409affcb4d

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

LOG: Ensure newlines at the end of files (NFC)

Added: 


Modified: 
clang-tools-extra/clangd/HeuristicResolver.cpp
clang/docs/analyzer/developer-docs.rst
clang/lib/Driver/ToolChains/AMDGPU.cpp
clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
libc/test/src/string/memory_utils/CMakeLists.txt
libcxx/benchmarks/algorithms.bench.cpp
lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h
llvm/docs/TableGen/BackGuide.rst
llvm/include/llvm/CodeGen/GlobalISel/GenericMachineInstrs.h
llvm/lib/Analysis/OverflowInstAnalysis.cpp
llvm/lib/CodeGen/CodeGenCommonISel.cpp
llvm/lib/Support/DebugOptions.h
llvm/lib/Target/AMDGPU/MCA/CMakeLists.txt
llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp
llvm/lib/Target/CSKY/AsmParser/CSKYAsmParser.cpp
llvm/lib/Target/CSKY/CSKYInstrFormats.td
llvm/lib/Target/CSKY/CSKYInstrInfo.td
llvm/lib/Target/CSKY/CSKYSubtarget.cpp
llvm/lib/Target/CSKY/CSKYSubtarget.h
llvm/lib/Target/CSKY/MCTargetDesc/CSKYFixupKinds.h
llvm/lib/Target/CSKY/MCTargetDesc/CSKYInstPrinter.h
llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCCodeEmitter.cpp
llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCCodeEmitter.h
llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.cpp
llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.h
llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCTargetDesc.h
llvm/tools/llvm-exegesis/lib/SnippetFile.h
mlir/lib/Bindings/Python/Pass.h
mlir/lib/Dialect/Linalg/Transforms/LinalgStrategyPasses.cpp
openmp/libomptarget/plugins/ppc64/CMakeLists.txt
openmp/libomptarget/plugins/ppc64le/CMakeLists.txt
openmp/libomptarget/plugins/x86_64/CMakeLists.txt

Removed: 




diff  --git a/clang-tools-extra/clangd/HeuristicResolver.cpp 
b/clang-tools-extra/clangd/HeuristicResolver.cpp
index b0a7448a04ef0..2505280ffa9aa 100644
--- a/clang-tools-extra/clangd/HeuristicResolver.cpp
+++ b/clang-tools-extra/clangd/HeuristicResolver.cpp
@@ -266,4 +266,4 @@ std::vector 
HeuristicResolver::resolveDependentMember(
 }
 
 } // namespace clangd
-} // namespace clang
\ No newline at end of file
+} // namespace clang

diff  --git a/clang/docs/analyzer/developer-docs.rst 
b/clang/docs/analyzer/developer-docs.rst
index a3d74a765f933..5f430ca7e11bd 100644
--- a/clang/docs/analyzer/developer-docs.rst
+++ b/clang/docs/analyzer/developer-docs.rst
@@ -11,4 +11,4 @@ Contents:
developer-docs/InitializerLists
developer-docs/nullability
developer-docs/RegionStore
-   
\ No newline at end of file
+   

diff  --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp 
b/clang/lib/Driver/ToolChains/AMDGPU.cpp
index a29ed0bdc6b4c..586a1484cd248 100644
--- a/clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -927,4 +927,4 @@ ROCMToolChain::getCommonDeviceLibNames(const 
llvm::opt::ArgList ,
   return RocmInstallation.getCommonBitcodeLibs(
   DriverArgs, LibDeviceFile, Wave64, DAZ, FiniteOnly, UnsafeMathOpt,
   FastRelaxedMath, CorrectSqrt);
-}
\ No newline at end of file
+}

diff  --git a/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
index dd65f8c035aa1..cc27bd27abe79 100644
--- a/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
@@ -1118,4 +1118,4 @@ void ento::registerStreamTesterChecker(CheckerManager 
) {
 
 bool ento::shouldRegisterStreamTesterChecker(const CheckerManager ) {
   return true;
-}
\ No newline at end of file
+}

diff  --git a/libc/test/src/string/memory_utils/CMakeLists.txt 
b/libc/test/src/string/memory_utils/CMakeLists.txt
index a1e2c90234063..9f2950dc56582 100644
--- a/libc/test/src/string/memory_utils/CMakeLists.txt
+++ b/libc/test/src/string/memory_utils/CMakeLists.txt
@@ -12,4 +12,4 @@ add_libc_unittest(
   COMPILE_OPTIONS
 ${LIBC_COMPILE_OPTIONS_NATIVE}
 -ffreestanding
-)
\ No newline at end of file
+)

diff  --git a/libcxx/benchmarks/algorithms.bench.cpp 
b/libcxx/benchmarks/algorithms.bench.cpp
index 93383e2b9cd6a..564d89d659cb0 100644
--- a/libcxx/benchmarks/algorithms.bench.cpp
+++ b/libcxx/benchmarks/algorithms.bench.cpp
@@ -334,4 +334,4 @@ int main(int argc, char** argv) {
   makeCartesianProductBenchmark(Quantities);
   makeCartesianProductBenchmark(Quantities);
   benchmark::RunSpecifiedBenchmarks();
-}
\ No newline at end of file
+}

diff  --git a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h 
b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h
index 1d67505d736ec..f4017fb663840 100644
--- 

[PATCH] D112356: [NFC] Tidy up spelling, grammar, and inconsistencies in clang-tidy documentation

2021-10-23 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone added a comment.

Definitely an improvement! I looked at all the changed places and found some 
more improvements you can make. I don't need to see this again, though.

The only disimprovement I found was "Jaro–Winkler" becoming "Jaro-Winkler".




Comment at: clang-tools-extra/docs/clang-tidy/Contributing.rst:444-445
   ``run-clang-tidy.py clang-tidy/.*Check\.cpp`` will only analyze clang-tidy
-  checks. It may also be necessary to restrict the header files warnings are
-  displayed from using the ``-header-filter`` flag. It has the same behavior
+  checks. It may also be necessary to restrict the header files that warnings
+  are displayed from using the ``-header-filter`` flag. It has the same 
behavior
   as the corresponding :program:`clang-tidy` flag.

Naïve grammar fix:
```
It may also be necessary to restrict the header files from which warnings are 
displayed using the ``-header-filter`` flag.
```
But, better, active-voice fix:
```
You can also use the ``-header-filter`` flag to silence warnings from certain 
header files.
```



Comment at: 
clang-tools-extra/docs/clang-tidy/checks/abseil-no-internal-dependencies.rst:9
+it because it's an implementation detail. They cannot friend it, include it,
 you mention it or refer to it in any way. Doing so violates Abseil's
 compatibility guidelines and may result in breakage. See

What is "you mention it"? Should this just say "mention it"? but even then, I 
don't know the technical definition of "mention" in this context.



Comment at: 
clang-tools-extra/docs/clang-tidy/checks/android-cloexec-pipe2.rst:6-7
 
-This checks ensures that pipe2() is called with the O_CLOEXEC flag. The check 
also
+This check ensures that pipe2() is called with the O_CLOEXEC flag. The check 
also
 adds the O_CLOEXEC flag that marks the file descriptor to be closed in child 
processes.
 Without this flag a sensitive file descriptor can be leaked to a child process,

Should `pipe2()` and `O_CLOEXEC` be double-backticked here? I think so.



Comment at: clang-tools-extra/docs/clang-tidy/checks/boost-use-to-string.rst:10
 
 It doesn't replace conversion from floating points despite the ``to_string``
+overloads, because it would change the behavior.

`s/floating points/floating-point types/`



Comment at: 
clang-tools-extra/docs/clang-tidy/checks/bugprone-easily-swappable-parameters.rst:122
 By default, the following parameter names, and their Uppercase-initial
 variants are ignored:
 `""` (unnamed parameters), `iterator`, `begin`, `end`, `first`, `last`,

`s/variants/variants,/`



Comment at: 
clang-tools-extra/docs/clang-tidy/checks/bugprone-easily-swappable-parameters.rst:157
   parameter of that function, of the same overload.
-  E.g. ``f(a, 1)`` and ``f(b, 2)`` to some ``f(T, int)``.
+  e.g. ``f(a, 1)`` and ``f(b, 2)`` to some ``f(T, int)``.
 

This letter is at the beginning of a sentence, so `E.g.` is correct. Arguably. 
It //is// a sentence fragment. ;)
Perhaps:
```
The heuristics suppress the easily-swappable-parameters warning for pairs of 
parameters that:
* Are used together in the same expression, such as ``f(a, b)`` or ``a < b``.
* Are passed in the same argument position to the same function, such as ``f(a, 
1)`` and ``f(b, 1)``, as long as both of those expressions call the same 
overload ``f(SomeT, int)``.
```
This section definitely needs better examples.



Comment at: 
clang-tools-extra/docs/clang-tidy/checks/bugprone-implicit-widening-of-multiplication-result.rst:11
 
-This is mainly useful when operating on a very large buffers.
+This is mainly useful when operating on very large buffers.
 For example, consider:

`This is useful mainly when`



Comment at: 
clang-tools-extra/docs/clang-tidy/checks/bugprone-not-null-terminated-result.rst:64
 
-- If the new function is could be safe version and C++ files are analysed and
+- If the new function is could be safe version and C++ files are analyzed and
   the destination array is plain ``char``/``wchar_t`` without ``un/signed`` 
then

Here and line 68: "is could be safe" doesn't make sense, but I'm not sure what 
is meant. My guess is that the writer is trying to refer to a set of functions, 
the "could-be-safe functions," like:
```
If we're in C++, and the new function is a could-be-safe function, and the 
destination array is...
```
but I haven't found whether the notion of "could-be-safe" functions is actually 
defined anywhere.



Comment at: 
clang-tools-extra/docs/clang-tidy/checks/bugprone-suspicious-string-compare.rst:17
 
-Checks that compare function results (i,e, ``strcmp``) are compared to valid
+Checks that compare function results (i.e., ``strcmp``) are compared to valid
 constant. The resulting 

[PATCH] D109215: [RISCV] Fix arch string parsing for multi-character extensions

2021-10-23 Thread Yueh-Ting Chen via Phabricator via cfe-commits
eopXD updated this revision to Diff 381738.
eopXD added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Fix test case fail.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109215

Files:
  clang/test/Driver/riscv-arch.c
  llvm/lib/Support/RISCVISAInfo.cpp


Index: llvm/lib/Support/RISCVISAInfo.cpp
===
--- llvm/lib/Support/RISCVISAInfo.cpp
+++ llvm/lib/Support/RISCVISAInfo.cpp
@@ -71,6 +71,28 @@
   return Ext.consume_front("experimental-");
 }
 
+// This function finds the first character that doesn't belong to a version
+// (e.g. zbe0p93 is extension 'zbe' of version '0p93'). So the function will
+// consume [0-9]*p[0-9]* starting from the backward. An extension name will not
+// end with a digit or the letter 'p', so this function will parse correctly.
+// NOTE: This function is NOT able to take empty strings or strings that only
+// have version numbers and no extension name. It assumes the extension name
+// will be at least more than one character.
+static size_t findFirstNonVersionCharacter(const StringRef ) {
+  if (Ext.size() == 0)
+llvm_unreachable("Already guarded by if-statement in ::parseArchString");
+
+  int Pos = Ext.size() - 1;
+  while (Pos > 0 && isDigit(Ext[Pos]))
+Pos--;
+  if (Pos > 0 && Ext[Pos] == 'p' && isDigit(Ext[Pos - 1])) {
+Pos--;
+while (Pos > 0 && isDigit(Ext[Pos]))
+  Pos--;
+  }
+  return Pos;
+}
+
 struct FindByName {
   FindByName(StringRef Ext) : Ext(Ext){};
   StringRef Ext;
@@ -637,7 +659,7 @@
 
 StringRef Type = getExtensionType(Ext);
 StringRef Desc = getExtensionTypeDesc(Ext);
-auto Pos = Ext.find_if(isDigit);
+size_t Pos = findFirstNonVersionCharacter(Ext) + 1;
 StringRef Name(Ext.substr(0, Pos));
 StringRef Vers(Ext.substr(Pos));
 
Index: clang/test/Driver/riscv-arch.c
===
--- clang/test/Driver/riscv-arch.c
+++ clang/test/Driver/riscv-arch.c
@@ -392,7 +392,7 @@
 
 // RUN: %clang -target riscv32-unknown-elf -march=rv32izbb1p0zbp0p93 
-menable-experimental-extensions -### %s \
 // RUN: -fsyntax-only 2>&1 | FileCheck 
-check-prefix=RV32-EXPERIMENTAL-ZBB-ZBP-UNDERSCORE %s
-// RV32-EXPERIMENTAL-ZBB-ZBP-UNDERSCORE: error: invalid arch name 
'rv32izbb1p0zbp0p93', multi-character extensions must be separated by 
underscores
+// RV32-EXPERIMENTAL-ZBB-ZBP-UNDERSCORE: error: invalid arch name 
'rv32izbb1p0zbp0p93', unsupported version number 0.93 for extension 'zbb1p0zbp'
 
 // RUN: %clang -target riscv32-unknown-elf -march=rv32izba1p0 
-menable-experimental-extensions -### %s \
 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-ZBA %s


Index: llvm/lib/Support/RISCVISAInfo.cpp
===
--- llvm/lib/Support/RISCVISAInfo.cpp
+++ llvm/lib/Support/RISCVISAInfo.cpp
@@ -71,6 +71,28 @@
   return Ext.consume_front("experimental-");
 }
 
+// This function finds the first character that doesn't belong to a version
+// (e.g. zbe0p93 is extension 'zbe' of version '0p93'). So the function will
+// consume [0-9]*p[0-9]* starting from the backward. An extension name will not
+// end with a digit or the letter 'p', so this function will parse correctly.
+// NOTE: This function is NOT able to take empty strings or strings that only
+// have version numbers and no extension name. It assumes the extension name
+// will be at least more than one character.
+static size_t findFirstNonVersionCharacter(const StringRef ) {
+  if (Ext.size() == 0)
+llvm_unreachable("Already guarded by if-statement in ::parseArchString");
+
+  int Pos = Ext.size() - 1;
+  while (Pos > 0 && isDigit(Ext[Pos]))
+Pos--;
+  if (Pos > 0 && Ext[Pos] == 'p' && isDigit(Ext[Pos - 1])) {
+Pos--;
+while (Pos > 0 && isDigit(Ext[Pos]))
+  Pos--;
+  }
+  return Pos;
+}
+
 struct FindByName {
   FindByName(StringRef Ext) : Ext(Ext){};
   StringRef Ext;
@@ -637,7 +659,7 @@
 
 StringRef Type = getExtensionType(Ext);
 StringRef Desc = getExtensionTypeDesc(Ext);
-auto Pos = Ext.find_if(isDigit);
+size_t Pos = findFirstNonVersionCharacter(Ext) + 1;
 StringRef Name(Ext.substr(0, Pos));
 StringRef Vers(Ext.substr(Pos));
 
Index: clang/test/Driver/riscv-arch.c
===
--- clang/test/Driver/riscv-arch.c
+++ clang/test/Driver/riscv-arch.c
@@ -392,7 +392,7 @@
 
 // RUN: %clang -target riscv32-unknown-elf -march=rv32izbb1p0zbp0p93 -menable-experimental-extensions -### %s \
 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-ZBB-ZBP-UNDERSCORE %s
-// RV32-EXPERIMENTAL-ZBB-ZBP-UNDERSCORE: error: invalid arch name 'rv32izbb1p0zbp0p93', multi-character extensions must be separated by underscores
+// RV32-EXPERIMENTAL-ZBB-ZBP-UNDERSCORE: error: invalid arch 

[PATCH] D108694: [RISCV] Add the zvl extension according to the v1.0-rc1 spec

2021-10-23 Thread Yueh-Ting Chen via Phabricator via cfe-commits
eopXD updated this revision to Diff 381737.
eopXD added a comment.
Herald added subscribers: cfe-commits, achieveartificialintelligence, jdoerfert.
Herald added a project: clang.

Address comments and add macro in clang.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108694

Files:
  clang/lib/Basic/Targets/RISCV.cpp
  clang/test/CodeGen/RISCV/riscv-metadata.c
  clang/test/CodeGen/RISCV/riscv32-ilp32-ilp32f-ilp32d-abi.c
  clang/test/CodeGen/RISCV/riscv32-ilp32d-abi.c
  clang/test/CodeGen/RISCV/riscv32-ilp32f-ilp32d-abi.c
  clang/test/CodeGen/RISCV/riscv64-lp64-lp64f-lp64d-abi.c
  clang/test/CodeGen/RISCV/riscv64-lp64d-abi.c
  clang/test/CodeGen/RISCV/riscv64-lp64f-lp64d-abi.c
  clang/test/CodeGen/riscv32-ilp32d-abi.cpp
  clang/test/Driver/riscv-arch.c
  clang/test/Preprocessor/riscv-target-features.c
  llvm/include/llvm/Support/RISCVISAInfo.h
  llvm/lib/Support/RISCVISAInfo.cpp
  llvm/lib/Target/RISCV/RISCV.td
  llvm/lib/Target/RISCV/RISCVSubtarget.cpp
  llvm/lib/Target/RISCV/RISCVSubtarget.h
  llvm/test/CodeGen/RISCV/attributes.ll
  llvm/test/MC/RISCV/attribute-arch.s

Index: llvm/test/MC/RISCV/attribute-arch.s
===
--- llvm/test/MC/RISCV/attribute-arch.s
+++ llvm/test/MC/RISCV/attribute-arch.s
@@ -34,7 +34,7 @@
 # CHECK: attribute  5, "rv32i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"
 
 .attribute arch, "rv32iv"
-# CHECK: attribute  5, "rv32i2p0_v0p10_zvlsseg0p10"
+# CHECK: attribute  5, "rv32i2p0_v0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10_zvlsseg0p10"
 
 .attribute arch, "rv32izba"
 # CHECK: attribute  5, "rv32i2p0_zba1p0"
@@ -70,7 +70,43 @@
 # CHECK: attribute  5, "rv32i2p0_f2p0_zfh0p1"
 
 .attribute arch, "rv32ivzvamo_zvlsseg"
-# CHECK: attribute  5, "rv32i2p0_v0p10_zvamo0p10_zvlsseg0p10"
+# CHECK: attribute  5, "rv32i2p0_v0p10_zvamo0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10_zvlsseg0p10"
 
 .attribute arch, "rv32iv_zvamo0p10_zvlsseg"
-# CHECK: attribute  5, "rv32i2p0_v0p10_zvamo0p10_zvlsseg0p10"
+# CHECK: attribute  5, "rv32i2p0_v0p10_zvamo0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10_zvlsseg0p10"
+
+.attribute arch, "rv32ifdv_zvl32b"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10_zvlsseg0p10"
+
+.attribute arch, "rv32ifdv_zvl64b"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10_zvlsseg0p10"
+
+.attribute arch, "rv32ifdv_zvl128b"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10_zvlsseg0p10"
+
+.attribute arch, "rv32ifdv_zvl256b"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl128b0p10_zvl256b0p10_zvl32b0p10_zvl64b0p10_zvlsseg0p10"
+
+.attribute arch, "rv32ifdv_zvl512b"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl128b0p10_zvl256b0p10_zvl32b0p10_zvl512b0p10_zvl64b0p10_zvlsseg0p10"
+
+.attribute arch, "rv32ifdv_zvl1024b"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl1024b0p10_zvl128b0p10_zvl256b0p10_zvl32b0p10_zvl512b0p10_zvl64b0p10_zvlsseg0p10"
+
+.attribute arch, "rv32ifdv_zvl2048b"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl1024b0p10_zvl128b0p10_zvl2048b0p10_zvl256b0p10_zvl32b0p10_zvl512b0p10_zvl64b0p10_zvlsseg0p10"
+
+.attribute arch, "rv32ifdv_zvl4096b"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl1024b0p10_zvl128b0p10_zvl2048b0p10_zvl256b0p10_zvl32b0p10_zvl4096b0p10_zvl512b0p10_zvl64b0p10_zvlsseg0p10"
+
+.attribute arch, "rv32ifdv_zvl8192b"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl1024b0p10_zvl128b0p10_zvl2048b0p10_zvl256b0p10_zvl32b0p10_zvl4096b0p10_zvl512b0p10_zvl64b0p10_zvl8192b0p10_zvlsseg0p10"
+
+.attribute arch, "rv32ifdv_zvl16384b"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl1024b0p10_zvl128b0p10_zvl16384b0p10_zvl2048b0p10_zvl256b0p10_zvl32b0p10_zvl4096b0p10_zvl512b0p10_zvl64b0p10_zvl8192b0p10_zvlsseg0p10"
+
+.attribute arch, "rv32ifdv_zvl32768b"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl1024b0p10_zvl128b0p10_zvl16384b0p10_zvl2048b0p10_zvl256b0p10_zvl32768b0p10_zvl32b0p10_zvl4096b0p10_zvl512b0p10_zvl64b0p10_zvl8192b0p10_zvlsseg0p10"
+
+.attribute arch, "rv32ifdv_zvl65536b"
+# CHECK: attribute  5, "rv32i2p0_f2p0_d2p0_v0p10_zvl1024b0p10_zvl128b0p10_zvl16384b0p10_zvl2048b0p10_zvl256b0p10_zvl32768b0p10_zvl32b0p10_zvl4096b0p10_zvl512b0p10_zvl64b0p10_zvl65536b0p10_zvl8192b0p10_zvlsseg0p10"
Index: llvm/test/CodeGen/RISCV/attributes.ll
===
--- llvm/test/CodeGen/RISCV/attributes.ll
+++ llvm/test/CodeGen/RISCV/attributes.ll
@@ -42,7 +42,7 @@
 ; RV32F: .attribute 5, "rv32i2p0_f2p0"
 ; RV32D: .attribute 5, "rv32i2p0_f2p0_d2p0"
 ; RV32C: .attribute 5, "rv32i2p0_c2p0"
-; RV32V: .attribute 5, "rv32i2p0_v0p10_zvamo0p10_zvlsseg0p10"
+; RV32V: .attribute 5, "rv32i2p0_v0p10_zvamo0p10_zvl128b0p10_zvl32b0p10_zvl64b0p10_zvlsseg0p10"
 ; RV32ZFH: .attribute 5, 

[PATCH] D112349: [Verifier] Add verification logic for GlobalIFuncs

2021-10-23 Thread Itay Bookstein via Phabricator via cfe-commits
ibookstein updated this revision to Diff 381735.
ibookstein set the repository for this revision to rG LLVM Github Monorepo.
ibookstein added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Changed type verification to look at the resolver operand rather than the 
ultimate resolver function, added comments, fixed clang CodeGenModule to give 
the correct type to the resolver operand.
Might still need to fix some clang tests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112349

Files:
  clang/lib/CodeGen/CodeGenModule.cpp
  llvm/lib/IR/Globals.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/test/Assembler/ifunc-asm.ll
  llvm/test/Assembler/ifunc-dsolocal.ll
  llvm/test/Assembler/ifunc-use-list-order.ll
  llvm/test/Bindings/llvm-c/echo.ll
  llvm/test/Bitcode/compatibility-6.0.ll
  llvm/test/Bitcode/compatibility-6.0.ll.bc
  llvm/test/Bitcode/compatibility.ll
  llvm/test/Bitcode/dso_local_equivalent.ll
  llvm/test/Bitcode/dso_location.ll
  llvm/test/CodeGen/X86/addrsig.ll
  llvm/test/CodeGen/X86/dso_local_equivalent.ll
  llvm/test/CodeGen/X86/ifunc-asm.ll
  llvm/test/CodeGen/X86/partition.ll
  llvm/test/LTO/Resolution/X86/Inputs/ifunc2.ll
  llvm/test/LTO/Resolution/X86/ifunc.ll
  llvm/test/LTO/Resolution/X86/ifunc2.ll
  llvm/test/Linker/ifunc.ll
  llvm/test/Object/X86/nm-ir.ll
  llvm/test/ThinLTO/X86/empty-module.ll
  llvm/test/Transforms/GlobalDCE/global-ifunc.ll

Index: llvm/test/Transforms/GlobalDCE/global-ifunc.ll
===
--- llvm/test/Transforms/GlobalDCE/global-ifunc.ll
+++ llvm/test/Transforms/GlobalDCE/global-ifunc.ll
@@ -2,12 +2,12 @@
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
-@if = ifunc void (), void ()* @fn
+@if = ifunc void (), void ()* ()* @fn
 
-define internal void @fn() {
+define internal void ()* @fn() {
 entry:
-  ret void
+  ret void ()* null
 }
 
-; CHECK-DAG: @if = ifunc void (), void ()* @fn
-; CHECK-DAG: define internal void @fn(
+; CHECK-DAG: @if = ifunc void (), void ()* ()* @fn
+; CHECK-DAG: define internal void ()* @fn(
Index: llvm/test/ThinLTO/X86/empty-module.ll
===
--- llvm/test/ThinLTO/X86/empty-module.ll
+++ llvm/test/ThinLTO/X86/empty-module.ll
@@ -10,9 +10,9 @@
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
-@foo = ifunc i32 (i32), i64 ()* @foo_ifunc
+@foo = ifunc i32 (i32), i32 (i32)* ()* @foo_ifunc
 
-define internal i64 @foo_ifunc() {
+define internal i32 (i32)* @foo_ifunc() {
 entry:
-  ret i64 0
+  ret i32 (i32)* null
 }
Index: llvm/test/Object/X86/nm-ir.ll
===
--- llvm/test/Object/X86/nm-ir.ll
+++ llvm/test/Object/X86/nm-ir.ll
@@ -32,12 +32,12 @@
 @a1 = alias i32, i32* @g1
 @a2 = internal alias i32, i32* @g1
 
-define void @f1() {
+define void ()* @f1() {
   call void @f5()
-  ret void
+  ret void ()* null
 }
 
-@ifunc_f1 = ifunc void (), void ()* @f1
+@ifunc_f1 = ifunc void (), void ()* ()* @f1
 
 define internal void @f2() {
   ret void
Index: llvm/test/Linker/ifunc.ll
===
--- llvm/test/Linker/ifunc.ll
+++ llvm/test/Linker/ifunc.ll
@@ -3,18 +3,18 @@
 
 ;; Check that ifuncs are linked in properly.
 
-; CHECK-DAG: @foo = ifunc void (), bitcast (void ()* ()* @foo_resolve to void ()*)
+; CHECK-DAG: @foo = ifunc void (), void ()* ()* @foo_resolve
 ; CHECK-DAG: define internal void ()* @foo_resolve() {
 
-; CHECK-DAG: @bar = ifunc void (), bitcast (void ()* ()* @bar_resolve to void ()*)
+; CHECK-DAG: @bar = ifunc void (), void ()* ()* @bar_resolve
 ; CHECK-DAG: define internal void ()* @bar_resolve() {
 
 ;--- a.ll
 declare void @bar()
 
 ;--- b.ll
-@foo = ifunc void (), bitcast (void ()* ()* @foo_resolve to void ()*)
-@bar = ifunc void (), bitcast (void ()* ()* @bar_resolve to void ()*)
+@foo = ifunc void (), void ()* ()* @foo_resolve
+@bar = ifunc void (), void ()* ()* @bar_resolve
 
 define internal void ()* @foo_resolve() {
   ret void ()* null
Index: llvm/test/LTO/Resolution/X86/ifunc2.ll
===
--- llvm/test/LTO/Resolution/X86/ifunc2.ll
+++ llvm/test/LTO/Resolution/X86/ifunc2.ll
@@ -6,14 +6,14 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
-; CHECK: @foo = ifunc i32 (), i32 ()* @foo_resolver.2
-@foo = ifunc i32 (), i32 ()* @foo_resolver
+; CHECK: @foo = ifunc i32 (), i32 ()* ()* @foo_resolver.2
+@foo = ifunc i32 (), i32 ()* ()* @foo_resolver
 
-; CHECK: define internal i32 @foo_resolver.2() {
-; CHECK-NEXT: ret i32 1
-define weak i32 @foo_resolver() {
-  ret i32 1
+; CHECK: define internal i32 ()* @foo_resolver.2() {
+; CHECK-NEXT: ret i32 ()* inttoptr (i32 1 

[PATCH] D111992: [MLIR][OpenMP] Added omp.atomic.read and omp.atomic.write

2021-10-23 Thread Shraiysh via Phabricator via cfe-commits
shraiysh added a comment.

In D111992#3080308 , 
@kiranchandramohan wrote:

> LGTM.
>
> My preference is the following one. If you agree then please make the change, 
> otherwise, you can keep it as is. Also, wait a couple of days to see whether 
> others have comments.
>
>   %8 = omp.atomic.read %addr hint(speculative, contended) 
> memory_order(seq_cst) : memref -> i32

Sure, will wait for other's comments. Meanwhile, I will update it with this 
syntax.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111992

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


[PATCH] D112356: [NFC] Tidy up spelling, grammar, and inconsistencies in clang-tidy documentation

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

In D112356#3082084 , @carlosgalvezp 
wrote:

> Awesome @salman-javed-nz , thanks for fixing the docs! May I ask how did you 
> create these "smaller commits"? It's very nice to click on each of them and 
> see only what changed. I believe I followed your same procedure (use the 
> "Update Revision" thingy) but it always displays the full commit with all 
> changes, so it's hard to see what each new update did.

I created a patch for each my commits on my local disk like so:

  git show HEAD -U99 > HEAD.patch
  git show HEAD~1 -U99 > HEAD~1.patch
  git show HEAD~2 -U99 > HEAD~2.patch
(and so on...)

I uploaded them one by one through Phab's web interface. This process is just 
something I stumbled though myself that worked for me.

I wouldn't be surprised if arcanist has something that makes this easier, but I 
don't use it so I wouldn't know.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112356

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


[PATCH] D112356: [NFC] Tidy up spelling, grammar, and inconsistencies in clang-tidy documentation

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

Awesome @salman-javed-nz , thanks for fixing the docs! May I ask how did you 
create these "smaller commits"? It's very nice to click on each of them and see 
only what changed. I believe I followed your same procedure (use the "Update 
Revision" thingy) but it always displays the full commit with all changes, so 
it's hard to see what each new update did.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112356

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


[PATCH] D112257: [www] Fix Ninja build instructions on Windows

2021-10-23 Thread Shivam Gupta 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 rGc5348355ee66: [www] Fix Ninja build instructions on Windows 
(authored by triplef, committed by xgupta).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112257

Files:
  clang/www/get_started.html


Index: clang/www/get_started.html
===
--- clang/www/get_started.html
+++ clang/www/get_started.html
@@ -206,7 +206,7 @@
   set CC=cl (necessary to force CMake to choose MSVC over mingw 
GCC
 if you have it installed)
   set CXX=cl
-  cmake -GNinja ..\llvm
+  cmake -GNinja -DLLVM_ENABLE_PROJECTS=clang ..\llvm
   ninja clang This will build just clang.
   ninja check-clang This will run the clang tests.
 


Index: clang/www/get_started.html
===
--- clang/www/get_started.html
+++ clang/www/get_started.html
@@ -206,7 +206,7 @@
   set CC=cl (necessary to force CMake to choose MSVC over mingw GCC
 if you have it installed)
   set CXX=cl
-  cmake -GNinja ..\llvm
+  cmake -GNinja -DLLVM_ENABLE_PROJECTS=clang ..\llvm
   ninja clang This will build just clang.
   ninja check-clang This will run the clang tests.
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] c534835 - [www] Fix Ninja build instructions on Windows

2021-10-23 Thread Shivam Gupta via cfe-commits

Author: Frederik Seiffert
Date: 2021-10-23T16:09:04+05:30
New Revision: c5348355ee66fbfc97e0dbb0234398792c4b68d9

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

LOG: [www] Fix Ninja build instructions on Windows

The `clang` target used in the line below is only generated with 
`LLVM_ENABLE_PROJECTS=clang`.

Without this change, running `ninja clang` will fail with:
```
ninja: error: unknown target 'clang', did you mean 'clean'?
```

Reviewed By: xgupta

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

Added: 


Modified: 
clang/www/get_started.html

Removed: 




diff  --git a/clang/www/get_started.html b/clang/www/get_started.html
index 40a05d92fb491..bc9629d7e2ff2 100755
--- a/clang/www/get_started.html
+++ b/clang/www/get_started.html
@@ -206,7 +206,7 @@ Using Ninja alongside Visual 
Studio
   set CC=cl (necessary to force CMake to choose MSVC over mingw 
GCC
 if you have it installed)
   set CXX=cl
-  cmake -GNinja ..\llvm
+  cmake -GNinja -DLLVM_ENABLE_PROJECTS=clang ..\llvm
   ninja clang This will build just clang.
   ninja check-clang This will run the clang tests.
 



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


[PATCH] D112359: [RISCV] Unify depedency check and extension implication parsing logics

2021-10-23 Thread Yueh-Ting Chen via Phabricator via cfe-commits
eopXD created this revision.
eopXD added reviewers: kito.cheng, craig.topper.
Herald added subscribers: achieveartificialintelligence, vkmr, frasercrmck, 
evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, 
jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, 
zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, 
rbar, asb, hiraditya.
eopXD requested review of this revision.
Herald added subscribers: llvm-commits, cfe-commits, MaskRay.
Herald added projects: clang, LLVM.

Originially there are two places that does parsing - `parseArchString` and
`parseFeatures`, it would be much clearer to extract implication into a
separate function and have both place to use it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112359

Files:
  clang/test/CodeGen/RISCV/riscv-metadata.c
  clang/test/CodeGen/RISCV/riscv32-ilp32-ilp32f-ilp32d-abi.c
  clang/test/CodeGen/RISCV/riscv32-ilp32d-abi.c
  clang/test/CodeGen/RISCV/riscv32-ilp32f-ilp32d-abi.c
  clang/test/CodeGen/RISCV/riscv64-lp64-lp64f-lp64d-abi.c
  clang/test/CodeGen/RISCV/riscv64-lp64d-abi.c
  clang/test/CodeGen/RISCV/riscv64-lp64f-lp64d-abi.c
  clang/test/CodeGen/riscv32-ilp32d-abi.cpp
  clang/test/Driver/riscv-arch.c
  llvm/include/llvm/Support/RISCVISAInfo.h
  llvm/lib/Support/RISCVISAInfo.cpp

Index: llvm/lib/Support/RISCVISAInfo.cpp
===
--- llvm/lib/Support/RISCVISAInfo.cpp
+++ llvm/lib/Support/RISCVISAInfo.cpp
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace llvm;
 
@@ -401,7 +402,6 @@
   assert(XLen == 32 || XLen == 64);
   std::unique_ptr ISAInfo(new RISCVISAInfo(XLen));
 
-  bool HasE = false;
   for (auto  : Features) {
 StringRef ExtName = Feature;
 bool Experimental = false;
@@ -420,28 +420,18 @@
 if (ExtensionInfoIterator == ExtensionInfos.end())
   continue;
 
-if (Add) {
-  if (ExtName == "e") {
-if (XLen != 32)
-  return createStringError(
-  errc::invalid_argument,
-  "standard user-level extension 'e' requires 'rv32'");
-HasE = true;
-  }
-
+if (Add)
   ISAInfo->addExtension(ExtName, ExtensionInfoIterator->Version.Major,
 ExtensionInfoIterator->Version.Minor);
-} else
-  ISAInfo->Exts.erase(ExtName.str());
-  }
-  if (!HasE) {
-if (auto Version = findDefaultVersion("i"))
-  ISAInfo->addExtension("i", Version->Major, Version->Minor);
 else
-  llvm_unreachable("Default extension version for 'i' not found?");
+  ISAInfo->Exts.erase(ExtName.str());
   }
 
   ISAInfo->updateFLen();
+  ISAInfo->updateImplication();
+
+  if (Error Result = ISAInfo->checkDependency())
+return std::move(Result);
 
   return std::move(ISAInfo);
 }
@@ -468,7 +458,6 @@
   // The canonical order specified in ISA manual.
   // Ref: Table 22.1 in RISC-V User-Level ISA V2.2
   StringRef StdExts = AllStdExts;
-  bool HasF = false, HasD = false;
   char Baseline = Arch[4];
 
   // First letter should be 'e', 'i' or 'g'.
@@ -489,8 +478,6 @@
   case 'g':
 // g = imafd
 StdExts = StdExts.drop_front(4);
-HasF = true;
-HasD = true;
 break;
   }
 
@@ -508,6 +495,8 @@
 Exts = Exts.substr(0, Pos);
   }
 
+  dbgs() << OtherExts << "\n";
+
   unsigned Major, Minor, ConsumeLength;
   if (auto E = getExtensionVersion(std::string(1, Baseline), Exts, Major, Minor,
ConsumeLength, EnableExperimentalExtension,
@@ -571,34 +560,14 @@
 
 // The order is OK, then push it into features.
 // TODO: Use version number when setting target features
-switch (C) {
-default:
-  // Currently LLVM supports only "mafdcbv".
+// Currently LLVM supports only "mafdcbv".
+StringRef SupportedStandardExtension = "mafdcbv";
+if (SupportedStandardExtension.find(C) == StringRef::npos)
   return createStringError(errc::invalid_argument,
"unsupported standard user-level extension '%c'",
C);
-case 'm':
-  ISAInfo->addExtension("m", Major, Minor);
-  break;
-case 'a':
-  ISAInfo->addExtension("a", Major, Minor);
-  break;
-case 'f':
-  ISAInfo->addExtension("f", Major, Minor);
-  HasF = true;
-  break;
-case 'd':
-  ISAInfo->addExtension("d", Major, Minor);
-  HasD = true;
-  break;
-case 'c':
-  ISAInfo->addExtension("c", Major, Minor);
-  break;
-case 'v':
-  ISAInfo->addExtension("v", Major, Minor);
-  ISAInfo->addExtension("zvlsseg", Major, Minor);
-  break;
-}
+ISAInfo->addExtension(std::string(1, C), Major, Minor);
+
 // Consume full extension name and version, including any optional '_'
 // between this extension and the next
 ++I;
@@ -606,21 +575,6 @@
 if (*I == '_')
   ++I;
   }
-  // Dependency check.
-  // It's illegal to 

[PATCH] D112356: [NFC] Tidy up spelling, grammar, and inconsistencies in clang-tidy documentation

2021-10-23 Thread Kazu Hirata 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 rG5de69e16ea9a: [clang-tidy] Tidy up spelling, grammar, and 
inconsistencies in documentation… (authored by salman-javed-nz, committed by 
kazu).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112356

Files:
  clang-tools-extra/docs/clang-tidy/Contributing.rst
  clang-tools-extra/docs/clang-tidy/checks/abseil-duration-conversion-cast.rst
  clang-tools-extra/docs/clang-tidy/checks/abseil-no-internal-dependencies.rst
  clang-tools-extra/docs/clang-tidy/checks/abseil-string-find-str-contains.rst
  clang-tools-extra/docs/clang-tidy/checks/android-cloexec-open.rst
  clang-tools-extra/docs/clang-tidy/checks/android-cloexec-pipe2.rst
  clang-tools-extra/docs/clang-tidy/checks/boost-use-to-string.rst
  clang-tools-extra/docs/clang-tidy/checks/bugprone-branch-clone.rst
  
clang-tools-extra/docs/clang-tidy/checks/bugprone-easily-swappable-parameters.rst
  
clang-tools-extra/docs/clang-tidy/checks/bugprone-implicit-widening-of-multiplication-result.rst
  clang-tools-extra/docs/clang-tidy/checks/bugprone-macro-parentheses.rst
  
clang-tools-extra/docs/clang-tidy/checks/bugprone-misplaced-operator-in-strlen-in-alloc.rst
  
clang-tools-extra/docs/clang-tidy/checks/bugprone-not-null-terminated-result.rst
  clang-tools-extra/docs/clang-tidy/checks/bugprone-sizeof-expression.rst
  
clang-tools-extra/docs/clang-tidy/checks/bugprone-suspicious-string-compare.rst
  clang-tools-extra/docs/clang-tidy/checks/bugprone-too-small-loop-variable.rst
  
clang-tools-extra/docs/clang-tidy/checks/bugprone-unhandled-exception-at-new.rst
  clang-tools-extra/docs/clang-tidy/checks/bugprone-virtual-near-miss.rst
  clang-tools-extra/docs/clang-tidy/checks/cert-dcl21-cpp.rst
  clang-tools-extra/docs/clang-tidy/checks/cert-err09-cpp.rst
  clang-tools-extra/docs/clang-tidy/checks/cert-oop11-cpp.rst
  clang-tools-extra/docs/clang-tidy/checks/concurrency-mt-unsafe.rst
  clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-init-variables.rst
  
clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-narrowing-conversions.rst
  
clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-special-member-functions.rst
  
clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-virtual-class-destructor.rst
  clang-tools-extra/docs/clang-tidy/checks/hicpp-multiway-paths-covered.rst
  clang-tools-extra/docs/clang-tidy/checks/hicpp-signed-bitwise.rst
  clang-tools-extra/docs/clang-tidy/checks/misc-static-assert.rst
  
clang-tools-extra/docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst
  clang-tools-extra/docs/clang-tidy/checks/modernize-avoid-bind.rst
  clang-tools-extra/docs/clang-tidy/checks/modernize-avoid-c-arrays.rst
  clang-tools-extra/docs/clang-tidy/checks/modernize-loop-convert.rst
  clang-tools-extra/docs/clang-tidy/checks/modernize-pass-by-value.rst
  
clang-tools-extra/docs/clang-tidy/checks/modernize-replace-disallow-copy-and-assign-macro.rst
  clang-tools-extra/docs/clang-tidy/checks/modernize-use-auto.rst
  clang-tools-extra/docs/clang-tidy/checks/modernize-use-default-member-init.rst
  clang-tools-extra/docs/clang-tidy/checks/modernize-use-noexcept.rst
  clang-tools-extra/docs/clang-tidy/checks/modernize-use-nullptr.rst
  
clang-tools-extra/docs/clang-tidy/checks/objc-nsinvocation-argument-lifetime.rst
  clang-tools-extra/docs/clang-tidy/checks/openmp-exception-escape.rst
  clang-tools-extra/docs/clang-tidy/checks/openmp-use-default-none.rst
  clang-tools-extra/docs/clang-tidy/checks/performance-inefficient-algorithm.rst
  clang-tools-extra/docs/clang-tidy/checks/readability-const-return-type.rst
  clang-tools-extra/docs/clang-tidy/checks/readability-data-pointer.rst
  clang-tools-extra/docs/clang-tidy/checks/readability-else-after-return.rst
  
clang-tools-extra/docs/clang-tidy/checks/readability-function-cognitive-complexity.rst
  clang-tools-extra/docs/clang-tidy/checks/readability-identifier-length.rst
  clang-tools-extra/docs/clang-tidy/checks/readability-identifier-naming.rst
  clang-tools-extra/docs/clang-tidy/checks/readability-magic-numbers.rst
  clang-tools-extra/docs/clang-tidy/checks/readability-qualified-auto.rst
  clang-tools-extra/docs/clang-tidy/checks/readability-redundant-declaration.rst
  clang-tools-extra/docs/clang-tidy/checks/readability-string-compare.rst
  
clang-tools-extra/docs/clang-tidy/checks/readability-suspicious-call-argument.rst
  clang-tools-extra/docs/clang-tidy/index.rst

Index: clang-tools-extra/docs/clang-tidy/index.rst
===
--- clang-tools-extra/docs/clang-tidy/index.rst
+++ clang-tools-extra/docs/clang-tidy/index.rst
@@ -91,7 +91,7 @@
 Clang diagnostics are treated in a similar way as check diagnostics. Clang
 diagnostics are displayed by :program:`clang-tidy` and can be filtered out 

[clang-tools-extra] 5de69e1 - [clang-tidy] Tidy up spelling, grammar, and inconsistencies in documentation (NFC)

2021-10-23 Thread Kazu Hirata via cfe-commits

Author: Salman Javed
Date: 2021-10-23T00:07:36-07:00
New Revision: 5de69e16ea9ab916401f4a8390fff91f18bbba2a

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

LOG: [clang-tidy] Tidy up spelling, grammar, and inconsistencies in 
documentation (NFC)

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

Added: 


Modified: 
clang-tools-extra/docs/clang-tidy/Contributing.rst
clang-tools-extra/docs/clang-tidy/checks/abseil-duration-conversion-cast.rst
clang-tools-extra/docs/clang-tidy/checks/abseil-no-internal-dependencies.rst
clang-tools-extra/docs/clang-tidy/checks/abseil-string-find-str-contains.rst
clang-tools-extra/docs/clang-tidy/checks/android-cloexec-open.rst
clang-tools-extra/docs/clang-tidy/checks/android-cloexec-pipe2.rst
clang-tools-extra/docs/clang-tidy/checks/boost-use-to-string.rst
clang-tools-extra/docs/clang-tidy/checks/bugprone-branch-clone.rst

clang-tools-extra/docs/clang-tidy/checks/bugprone-easily-swappable-parameters.rst

clang-tools-extra/docs/clang-tidy/checks/bugprone-implicit-widening-of-multiplication-result.rst
clang-tools-extra/docs/clang-tidy/checks/bugprone-macro-parentheses.rst

clang-tools-extra/docs/clang-tidy/checks/bugprone-misplaced-operator-in-strlen-in-alloc.rst

clang-tools-extra/docs/clang-tidy/checks/bugprone-not-null-terminated-result.rst
clang-tools-extra/docs/clang-tidy/checks/bugprone-sizeof-expression.rst

clang-tools-extra/docs/clang-tidy/checks/bugprone-suspicious-string-compare.rst

clang-tools-extra/docs/clang-tidy/checks/bugprone-too-small-loop-variable.rst

clang-tools-extra/docs/clang-tidy/checks/bugprone-unhandled-exception-at-new.rst
clang-tools-extra/docs/clang-tidy/checks/bugprone-virtual-near-miss.rst
clang-tools-extra/docs/clang-tidy/checks/cert-dcl21-cpp.rst
clang-tools-extra/docs/clang-tidy/checks/cert-err09-cpp.rst
clang-tools-extra/docs/clang-tidy/checks/cert-oop11-cpp.rst
clang-tools-extra/docs/clang-tidy/checks/concurrency-mt-unsafe.rst

clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-init-variables.rst

clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-narrowing-conversions.rst

clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-special-member-functions.rst

clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-virtual-class-destructor.rst
clang-tools-extra/docs/clang-tidy/checks/hicpp-multiway-paths-covered.rst
clang-tools-extra/docs/clang-tidy/checks/hicpp-signed-bitwise.rst
clang-tools-extra/docs/clang-tidy/checks/misc-static-assert.rst

clang-tools-extra/docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst
clang-tools-extra/docs/clang-tidy/checks/modernize-avoid-bind.rst
clang-tools-extra/docs/clang-tidy/checks/modernize-avoid-c-arrays.rst
clang-tools-extra/docs/clang-tidy/checks/modernize-loop-convert.rst
clang-tools-extra/docs/clang-tidy/checks/modernize-pass-by-value.rst

clang-tools-extra/docs/clang-tidy/checks/modernize-replace-disallow-copy-and-assign-macro.rst
clang-tools-extra/docs/clang-tidy/checks/modernize-use-auto.rst

clang-tools-extra/docs/clang-tidy/checks/modernize-use-default-member-init.rst
clang-tools-extra/docs/clang-tidy/checks/modernize-use-noexcept.rst
clang-tools-extra/docs/clang-tidy/checks/modernize-use-nullptr.rst

clang-tools-extra/docs/clang-tidy/checks/objc-nsinvocation-argument-lifetime.rst
clang-tools-extra/docs/clang-tidy/checks/openmp-exception-escape.rst
clang-tools-extra/docs/clang-tidy/checks/openmp-use-default-none.rst

clang-tools-extra/docs/clang-tidy/checks/performance-inefficient-algorithm.rst
clang-tools-extra/docs/clang-tidy/checks/readability-const-return-type.rst
clang-tools-extra/docs/clang-tidy/checks/readability-data-pointer.rst
clang-tools-extra/docs/clang-tidy/checks/readability-else-after-return.rst

clang-tools-extra/docs/clang-tidy/checks/readability-function-cognitive-complexity.rst
clang-tools-extra/docs/clang-tidy/checks/readability-identifier-length.rst
clang-tools-extra/docs/clang-tidy/checks/readability-identifier-naming.rst
clang-tools-extra/docs/clang-tidy/checks/readability-magic-numbers.rst
clang-tools-extra/docs/clang-tidy/checks/readability-qualified-auto.rst

clang-tools-extra/docs/clang-tidy/checks/readability-redundant-declaration.rst
clang-tools-extra/docs/clang-tidy/checks/readability-string-compare.rst

clang-tools-extra/docs/clang-tidy/checks/readability-suspicious-call-argument.rst
clang-tools-extra/docs/clang-tidy/index.rst

Removed: 




diff  --git a/clang-tools-extra/docs/clang-tidy/Contributing.rst 
b/clang-tools-extra/docs/clang-tidy/Contributing.rst
index 

[PATCH] D112356: [NFC] Tidy up spelling, grammar, and inconsistencies in clang-tidy documentation

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

Thanks for the review.
Are you able to commit for me?

Salman Javed 

Thank you very much.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112356

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


[PATCH] D112356: [NFC] Tidy up spelling, grammar, and inconsistencies in clang-tidy documentation

2021-10-23 Thread Kazu Hirata via Phabricator via cfe-commits
kazu accepted this revision.
kazu added a comment.
This revision is now accepted and ready to land.

LGTM.  Thanks for fixing the docs!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112356

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