[clang] 7ba70d3 - [PR52549][clang-cl] Predefine _MSVC_EXECUTION_CHARACTER_SET

2021-11-30 Thread Markus Böck via cfe-commits

Author: Markus Böck
Date: 2021-11-30T09:13:22+01:00
New Revision: 7ba70d32736aef0c640b9d0e7b9081fc208c81c2

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

LOG: [PR52549][clang-cl] Predefine _MSVC_EXECUTION_CHARACTER_SET

Since VS 2022 17.1 MSVC predefines _MSVC_EXECUTION_CHARACTER_SET to inform the 
users of the execution character set defined at compile time. The value the 
macro expands to is a Windows Code Page Identifier which are documented here: 
https://docs.microsoft.com/en-us/windows/win32/intl/code-page-identifiers

As clang currently only supports UTF-8 it is defined as 65001. If clang-cl were 
to support a different execution character set in the future we'd have to 
change the value.

Fixes https://bugs.llvm.org/show_bug.cgi?id=52549

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

Added: 


Modified: 
clang/lib/Basic/Targets/OSTargets.cpp
clang/test/Preprocessor/init.c

Removed: 




diff  --git a/clang/lib/Basic/Targets/OSTargets.cpp 
b/clang/lib/Basic/Targets/OSTargets.cpp
index 7cd4a51901205..4d9a462b51366 100644
--- a/clang/lib/Basic/Targets/OSTargets.cpp
+++ b/clang/lib/Basic/Targets/OSTargets.cpp
@@ -201,6 +201,14 @@ static void addVisualCDefines(const LangOptions &Opts, 
MacroBuilder &Builder) {
   }
 
   Builder.defineMacro("_INTEGRAL_MAX_BITS", "64");
+
+  // Starting with VS 2022 17.1, MSVC predefines the below macro to inform
+  // users of the execution character set defined at compile time.
+  // The value given is the Windows Code Page Identifier:
+  // https://docs.microsoft.com/en-us/windows/win32/intl/code-page-identifiers
+  //
+  // Clang currently only supports UTF-8, so we'll use 65001
+  Builder.defineMacro("_MSVC_EXECUTION_CHARACTER_SET", "65001");
 }
 
 void addWindowsDefines(const llvm::Triple &Triple, const LangOptions &Opts,

diff  --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c
index 8bbfe85b9ba74..52c33d9b8b7a5 100644
--- a/clang/test/Preprocessor/init.c
+++ b/clang/test/Preprocessor/init.c
@@ -194,6 +194,7 @@
 // MSEXT:#define _INTEGRAL_MAX_BITS 64
 // MSEXT-NOT:#define _NATIVE_WCHAR_T_DEFINED 1
 // MSEXT-NOT:#define _WCHAR_T_DEFINED 1
+// MSEXT:#define _MSVC_EXECUTION_CHARACTER_SET 65001
 //
 //
 // RUN: %clang_cc1 -x c++ -fms-extensions -triple i686-pc-win32 -E -dM < 
/dev/null | FileCheck -match-full-lines -check-prefix MSEXT-CXX %s



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


[PATCH] D114576: [PR52549][clang-cl] Predefine _MSVC_EXECUTION_CHARACTER_SET

2021-11-30 Thread Markus Böck via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7ba70d32736a: [PR52549][clang-cl] Predefine 
_MSVC_EXECUTION_CHARACTER_SET (authored by zero9178).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114576

Files:
  clang/lib/Basic/Targets/OSTargets.cpp
  clang/test/Preprocessor/init.c


Index: clang/test/Preprocessor/init.c
===
--- clang/test/Preprocessor/init.c
+++ clang/test/Preprocessor/init.c
@@ -194,6 +194,7 @@
 // MSEXT:#define _INTEGRAL_MAX_BITS 64
 // MSEXT-NOT:#define _NATIVE_WCHAR_T_DEFINED 1
 // MSEXT-NOT:#define _WCHAR_T_DEFINED 1
+// MSEXT:#define _MSVC_EXECUTION_CHARACTER_SET 65001
 //
 //
 // RUN: %clang_cc1 -x c++ -fms-extensions -triple i686-pc-win32 -E -dM < 
/dev/null | FileCheck -match-full-lines -check-prefix MSEXT-CXX %s
Index: clang/lib/Basic/Targets/OSTargets.cpp
===
--- clang/lib/Basic/Targets/OSTargets.cpp
+++ clang/lib/Basic/Targets/OSTargets.cpp
@@ -201,6 +201,14 @@
   }
 
   Builder.defineMacro("_INTEGRAL_MAX_BITS", "64");
+
+  // Starting with VS 2022 17.1, MSVC predefines the below macro to inform
+  // users of the execution character set defined at compile time.
+  // The value given is the Windows Code Page Identifier:
+  // https://docs.microsoft.com/en-us/windows/win32/intl/code-page-identifiers
+  //
+  // Clang currently only supports UTF-8, so we'll use 65001
+  Builder.defineMacro("_MSVC_EXECUTION_CHARACTER_SET", "65001");
 }
 
 void addWindowsDefines(const llvm::Triple &Triple, const LangOptions &Opts,


Index: clang/test/Preprocessor/init.c
===
--- clang/test/Preprocessor/init.c
+++ clang/test/Preprocessor/init.c
@@ -194,6 +194,7 @@
 // MSEXT:#define _INTEGRAL_MAX_BITS 64
 // MSEXT-NOT:#define _NATIVE_WCHAR_T_DEFINED 1
 // MSEXT-NOT:#define _WCHAR_T_DEFINED 1
+// MSEXT:#define _MSVC_EXECUTION_CHARACTER_SET 65001
 //
 //
 // RUN: %clang_cc1 -x c++ -fms-extensions -triple i686-pc-win32 -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix MSEXT-CXX %s
Index: clang/lib/Basic/Targets/OSTargets.cpp
===
--- clang/lib/Basic/Targets/OSTargets.cpp
+++ clang/lib/Basic/Targets/OSTargets.cpp
@@ -201,6 +201,14 @@
   }
 
   Builder.defineMacro("_INTEGRAL_MAX_BITS", "64");
+
+  // Starting with VS 2022 17.1, MSVC predefines the below macro to inform
+  // users of the execution character set defined at compile time.
+  // The value given is the Windows Code Page Identifier:
+  // https://docs.microsoft.com/en-us/windows/win32/intl/code-page-identifiers
+  //
+  // Clang currently only supports UTF-8, so we'll use 65001
+  Builder.defineMacro("_MSVC_EXECUTION_CHARACTER_SET", "65001");
 }
 
 void addWindowsDefines(const llvm::Triple &Triple, const LangOptions &Opts,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D114579: [clang-tidy] Exempt _MSVC_EXECUTION_CHARACTER_SET from cppcoreguidelines-macro-usage

2021-11-30 Thread Markus Böck via Phabricator via cfe-commits
zero9178 abandoned this revision.
zero9178 added a comment.

Found another solution to the original issue


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114579

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


[PATCH] D114639: Raise the minimum Visual Studio version to VS2019

2021-11-30 Thread James Henderson via Phabricator via cfe-commits
jhenderson added a comment.

Re. the bots: I'd hope we'd have at least some bots using VS2019 rather than 
all rushing to VS2022. There's nothing worse than claiming to support a minimum 
version of something and then not actually supporting it...! Also internally, 
we are switching to a default of VS2019, not direct to VS2022, so having 
upstream coverage there would be useful to avoid downstream breakages that are 
actually upstream problems - we're working on adding our own Windows build bot, 
but I don't think it's there yet.




Comment at: clang/docs/UsersManual.rst:3546
 
-cmake -G"Visual Studio 15 2017" -T LLVM ..
+cmake -G"Visual Studio 17 2022" -T LLVM ..
 

stella.stamenova wrote:
> compnerd wrote:
> > Meinersbur wrote:
> > > jhenderson wrote:
> > > > RKSimon wrote:
> > > > > aaron.ballman wrote:
> > > > > > jhenderson wrote:
> > > > > > > I think the missing space should be fixed to :)
> > > > > > +1 to the missing space.
> > > > > This one is confusing - it isn't in my local diff, the raw diff, or 
> > > > > if I reapply the raw diff - it looks to have just appeared when you 
> > > > > quote it in phab comments?
> > > > The fact that the space is missing? It's missing in the current repo 
> > > > too.
> > > It works with and without the space, like `-GNinja` and `-G Ninja` both 
> > > work.
> > It would be nice to mention the CMake minimum version.  I think that you 
> > need 3.22 or newer for the 2022 generator/toolset definition.
> It works with or without the space, but it reads better with the space.
We should probably drop the space issue: I noticed further down that it doesn't 
have a space in either for e.g. Ninja. Don't mind either way though.



Comment at: clang/docs/UsersManual.rst:3546
 
-cmake -G"Visual Studio 15 2017" -T LLVM ..
+cmake -G"Visual Studio 16 2019" -T LLVM ..
 

stella.stamenova wrote:
> jhenderson wrote:
> > Maybe make this VS2022 instead, to help it last longer?
> I think it makes more sense to make it 2019 because I expect most people to 
> still be using 2019 and it's convenient to have instructions that just work. 
> Maybe add both?
No objections either way.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114639

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


[clang-tools-extra] 3356d88 - [clangd] Make std symbol generation script python3 friendly

2021-11-30 Thread Kadir Cetinkaya via cfe-commits

Author: Kadir Cetinkaya
Date: 2021-11-30T10:15:36+01:00
New Revision: 3356d8837e46a92446e4b9b0cbd6967e5f4e44ba

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

LOG: [clangd] Make std symbol generation script python3 friendly

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

Added: 


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

Removed: 




diff  --git a/clang-tools-extra/clangd/include-mapping/gen_std.py 
b/clang-tools-extra/clangd/include-mapping/gen_std.py
index 1cfe2c026b4b8..0a6fd8a6f9116 100755
--- a/clang-tools-extra/clangd/include-mapping/gen_std.py
+++ b/clang-tools-extra/clangd/include-mapping/gen_std.py
@@ -99,12 +99,12 @@ def main():
   index_page_path = os.path.join(page_root, "index.html")
   cppreference_modified_date = datetime.datetime.fromtimestamp(
 os.stat(index_page_path).st_mtime).strftime('%Y-%m-%d')
-  print CODE_PREFIX % (args.language.upper(), cppreference_modified_date)
+  print(CODE_PREFIX % (args.language.upper(), cppreference_modified_date))
   for symbol in symbols:
 if len(symbol.headers) == 1:
   # SYMBOL(unqualified_name, namespace, header)
-  print "SYMBOL(%s, %s, %s)" % (symbol.name, symbol.namespace,
-symbol.headers[0])
+  print("SYMBOL(%s, %s, %s)" % (symbol.name, symbol.namespace,
+symbol.headers[0]))
 elif len(symbol.headers) == 0:
   sys.stderr.write("No header found for symbol %s\n" % symbol.name)
 else:



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


[PATCH] D114723: [clangd] Make std symbol generation script python3 friendly

2021-11-30 Thread Kadir Cetinkaya via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3356d8837e46: [clangd] Make std symbol generation script 
python3 friendly (authored by kadircet).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114723

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


Index: clang-tools-extra/clangd/include-mapping/gen_std.py
===
--- clang-tools-extra/clangd/include-mapping/gen_std.py
+++ clang-tools-extra/clangd/include-mapping/gen_std.py
@@ -99,12 +99,12 @@
   index_page_path = os.path.join(page_root, "index.html")
   cppreference_modified_date = datetime.datetime.fromtimestamp(
 os.stat(index_page_path).st_mtime).strftime('%Y-%m-%d')
-  print CODE_PREFIX % (args.language.upper(), cppreference_modified_date)
+  print(CODE_PREFIX % (args.language.upper(), cppreference_modified_date))
   for symbol in symbols:
 if len(symbol.headers) == 1:
   # SYMBOL(unqualified_name, namespace, header)
-  print "SYMBOL(%s, %s, %s)" % (symbol.name, symbol.namespace,
-symbol.headers[0])
+  print("SYMBOL(%s, %s, %s)" % (symbol.name, symbol.namespace,
+symbol.headers[0]))
 elif len(symbol.headers) == 0:
   sys.stderr.write("No header found for symbol %s\n" % symbol.name)
 else:


Index: clang-tools-extra/clangd/include-mapping/gen_std.py
===
--- clang-tools-extra/clangd/include-mapping/gen_std.py
+++ clang-tools-extra/clangd/include-mapping/gen_std.py
@@ -99,12 +99,12 @@
   index_page_path = os.path.join(page_root, "index.html")
   cppreference_modified_date = datetime.datetime.fromtimestamp(
 os.stat(index_page_path).st_mtime).strftime('%Y-%m-%d')
-  print CODE_PREFIX % (args.language.upper(), cppreference_modified_date)
+  print(CODE_PREFIX % (args.language.upper(), cppreference_modified_date))
   for symbol in symbols:
 if len(symbol.headers) == 1:
   # SYMBOL(unqualified_name, namespace, header)
-  print "SYMBOL(%s, %s, %s)" % (symbol.name, symbol.namespace,
-symbol.headers[0])
+  print("SYMBOL(%s, %s, %s)" % (symbol.name, symbol.namespace,
+symbol.headers[0]))
 elif len(symbol.headers) == 0:
   sys.stderr.write("No header found for symbol %s\n" % symbol.name)
 else:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D113118: [clang][AST] Check context of record in structural equivalence.

2021-11-30 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added inline comments.



Comment at: clang/unittests/AST/StructuralEquivalenceTest.cpp:1037
+ "void foo(struct Param { int a; } *p);", Lang_C89);
+  EXPECT_TRUE(testStructuralMatch(Decls));
+}

shafik wrote:
> I expect this to be `false` the outer `Param` is not the same type as the 
> `Param` in the parameter.
There is a test **ctu-main.c** that fails if this is `false`. In that code a 
similar construct as here (`structInProto`) is imported and the import fails 
because unsupported construct. If these are structurally not equivalent then 
the failure is a ODR like error (the `Param` inside the function prototype is 
different than the `Param` outside of it). I do not know which is the correct 
behavior, I think the intent in that test is that import of this construct 
should work (if it would be supported by ASTImporter) at least in the C case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113118

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


[clang] 5cff77c - [clang][ARM] PACBTI-M assembly support

2021-11-30 Thread via cfe-commits

Author: Ties Stuij
Date: 2021-11-30T09:28:18Z
New Revision: 5cff77c23f43130887b566dd0fe237e1c482e23b

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

LOG: [clang][ARM] PACBTI-M assembly support

Introduce assembly support for Armv8.1-M PACBTI extension. This is an optional
extension in v8.1-M.

There are 10 new system registers and 5 new instructions, all predicated on the
feature.

The attribute for llvm-mc is called "pacbti". For armclang, an architecture
extension also called "pacbti" was created.

This patch is part of a series that adds support for the PACBTI-M extension of
the Armv8.1-M architecture, as detailed here:

https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/armv8-1-m-pointer-authentication-and-branch-target-identification-extension

The PACBTI-M specification can be found in the Armv8-M Architecture Reference
Manual:

https://developer.arm.com/documentation/ddi0553/latest

The following people contributed to this patch:

- Victor Campos
- Ties Stuij

Reviewed By: labrinea

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

Added: 
llvm/test/MC/ARM/armv8.1m-pacbti-error.s
llvm/test/MC/ARM/armv8.1m-pacbti.s
llvm/test/MC/ARM/implicit-it-generation-v8.s
llvm/test/MC/Disassembler/ARM/armv8.1m-pacbti.txt

Modified: 
clang/test/Driver/armv8.1m.main.c
llvm/include/llvm/Support/ARMTargetParser.def
llvm/include/llvm/Support/ARMTargetParser.h
llvm/lib/Target/ARM/ARM.td
llvm/lib/Target/ARM/ARMInstrThumb2.td
llvm/lib/Target/ARM/ARMPredicates.td
llvm/lib/Target/ARM/ARMRegisterInfo.td
llvm/lib/Target/ARM/ARMSubtarget.h
llvm/lib/Target/ARM/ARMSystemRegister.td
llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
llvm/test/CodeGen/Thumb/high-reg-clobber.mir

Removed: 




diff  --git a/clang/test/Driver/armv8.1m.main.c 
b/clang/test/Driver/armv8.1m.main.c
index 15b91237f62ea..eef395c98891e 100644
--- a/clang/test/Driver/armv8.1m.main.c
+++ b/clang/test/Driver/armv8.1m.main.c
@@ -2,6 +2,10 @@
 // RUN: FileCheck --check-prefix=CHECK-DSP < %t %s
 // CHECK-DSP: "-target-feature" "+dsp"
 
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+pacbti -### %s 
2> %t
+// RUN: FileCheck --check-prefix=CHECK-PACBTI < %t %s
+// CHECK-PACBTI: "-target-feature" "+pacbti"
+
 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+fp  -### %s 2> 
%t
 // RUN: FileCheck --check-prefix=CHECK-FP < %t %s
 // CHECK-FP-DAG: "-target-feature" "+fp-armv8d16sp"

diff  --git a/llvm/include/llvm/Support/ARMTargetParser.def 
b/llvm/include/llvm/Support/ARMTargetParser.def
index fd08f3e6960c0..7d29808f05012 100644
--- a/llvm/include/llvm/Support/ARMTargetParser.def
+++ b/llvm/include/llvm/Support/ARMTargetParser.def
@@ -201,6 +201,7 @@ ARM_ARCH_EXT_NAME("cdecp4",   ARM::AEK_CDECP4,   "+cdecp4", 
 "-cdecp4")
 ARM_ARCH_EXT_NAME("cdecp5",   ARM::AEK_CDECP5,   "+cdecp5",  "-cdecp5")
 ARM_ARCH_EXT_NAME("cdecp6",   ARM::AEK_CDECP6,   "+cdecp6",  "-cdecp6")
 ARM_ARCH_EXT_NAME("cdecp7",   ARM::AEK_CDECP7,   "+cdecp7",  "-cdecp7")
+ARM_ARCH_EXT_NAME("pacbti",   ARM::AEK_PACBTI,   "+pacbti",  "-pacbti")
 #undef ARM_ARCH_EXT_NAME
 
 #ifndef ARM_HW_DIV_NAME

diff  --git a/llvm/include/llvm/Support/ARMTargetParser.h 
b/llvm/include/llvm/Support/ARMTargetParser.h
index b1ffcfb34552a..b40704c24e87c 100644
--- a/llvm/include/llvm/Support/ARMTargetParser.h
+++ b/llvm/include/llvm/Support/ARMTargetParser.h
@@ -59,7 +59,7 @@ enum ArchExtKind : uint64_t {
   AEK_CDECP5 =  1 << 27,
   AEK_CDECP6 =  1 << 28,
   AEK_CDECP7 =  1 << 29,
-
+  AEK_PACBTI =  1 << 30,
   // Unsupported extensions.
   AEK_OS   =1ULL << 59,
   AEK_IWMMXT   =1ULL << 60,

diff  --git a/llvm/lib/Target/ARM/ARM.td b/llvm/lib/Target/ARM/ARM.td
index 8cbd80f1bf652..e03dd597eb650 100644
--- a/llvm/lib/Target/ARM/ARM.td
+++ b/llvm/lib/Target/ARM/ARM.td
@@ -442,6 +442,10 @@ def FeatureFixCMSE_CVE_2021_35465 : 
SubtargetFeature<"fix-cmse-cve-2021-35465",
 "Mitigate against the cve-2021-35465 "
 "security vulnurability">;
 
+def FeaturePACBTI : SubtargetFeature<"pacbti", "HasPACBTI", "true",
+ "Enable Pointer Authentication 
and Branch "
+ "Target Identification">;
+
 
//===--===//
 // ARM architecture class
 //

diff  --git a/llvm/lib/Target/ARM/ARMInstrThumb2.td 
b/llvm/lib/Target/ARM/ARMInstrThumb2.td
index 5b9ae7ac8730f..d216207a97fc7 100644
--- a/llvm/lib/Target/ARM/ARMInstrThumb2.td
+++ b/llvm/lib/Target/ARM/ARMInstrThumb2.td
@@ -

[PATCH] D112420: [clang][ARM] PACBTI-M assembly support

2021-11-30 Thread 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 rG5cff77c23f43: [clang][ARM] PACBTI-M assembly support 
(authored by stuij, committed by Zeno ).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112420

Files:
  clang/test/Driver/armv8.1m.main.c
  llvm/include/llvm/Support/ARMTargetParser.def
  llvm/include/llvm/Support/ARMTargetParser.h
  llvm/lib/Target/ARM/ARM.td
  llvm/lib/Target/ARM/ARMInstrThumb2.td
  llvm/lib/Target/ARM/ARMPredicates.td
  llvm/lib/Target/ARM/ARMRegisterInfo.td
  llvm/lib/Target/ARM/ARMSubtarget.h
  llvm/lib/Target/ARM/ARMSystemRegister.td
  llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
  llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
  llvm/test/CodeGen/Thumb/high-reg-clobber.mir
  llvm/test/MC/ARM/armv8.1m-pacbti-error.s
  llvm/test/MC/ARM/armv8.1m-pacbti.s
  llvm/test/MC/ARM/implicit-it-generation-v8.s
  llvm/test/MC/Disassembler/ARM/armv8.1m-pacbti.txt

Index: llvm/test/MC/Disassembler/ARM/armv8.1m-pacbti.txt
===
--- /dev/null
+++ llvm/test/MC/Disassembler/ARM/armv8.1m-pacbti.txt
@@ -0,0 +1,137 @@
+# RUN: llvm-mc -triple thumbv8.1m.main-arm-none-eabi -mattr=+pacbti -disassemble %s 2> /dev/null | FileCheck %s
+
+0x51,0xfb,0x02,0x0f
+0x5e,0xfb,0x0d,0xcf
+0xaf,0xf3,0x2d,0x80
+0x51,0xfb,0x12,0x0f
+0xaf,0xf3,0x0f,0x80
+0x61,0xfb,0x02,0xf0
+0x6e,0xfb,0x0d,0xfc
+0xaf,0xf3,0x1d,0x80
+0xaf,0xf3,0x0d,0x80
+0x80,0xf3,0x20,0x88
+0x80,0xf3,0x21,0x88
+0x80,0xf3,0x22,0x88
+0x80,0xf3,0x23,0x88
+0x80,0xf3,0x24,0x88
+0x80,0xf3,0x25,0x88
+0x80,0xf3,0x26,0x88
+0x80,0xf3,0x27,0x88
+0x80,0xf3,0xa0,0x88
+0x80,0xf3,0xa1,0x88
+0x80,0xf3,0xa2,0x88
+0x80,0xf3,0xa3,0x88
+0x80,0xf3,0xa4,0x88
+0x80,0xf3,0xa5,0x88
+0x80,0xf3,0xa6,0x88
+0x80,0xf3,0xa7,0x88
+0xef,0xf3,0x20,0x80
+0xef,0xf3,0x21,0x80
+0xef,0xf3,0x22,0x80
+0xef,0xf3,0x23,0x80
+0xef,0xf3,0x24,0x80
+0xef,0xf3,0x25,0x80
+0xef,0xf3,0x26,0x80
+0xef,0xf3,0x27,0x80
+0xef,0xf3,0xa0,0x80
+0xef,0xf3,0xa1,0x80
+0xef,0xf3,0xa2,0x80
+0xef,0xf3,0xa3,0x80
+0xef,0xf3,0xa4,0x80
+0xef,0xf3,0xa5,0x80
+0xef,0xf3,0xa6,0x80
+0xef,0xf3,0xa7,0x80
+
+# Test softfail encodings
+0xa7,0xf3,0x1d,0x80
+0xab,0xf3,0x1d,0x80
+0xad,0xf3,0x1d,0x80
+0xae,0xf3,0x1d,0x80
+0xaf,0xf3,0x1d,0x88
+0xaf,0xf3,0x1d,0xa0
+0xaf,0xf3,0x2d,0x80
+0xab,0xf3,0x2d,0x80
+0xad,0xf3,0x2d,0x80
+0xae,0xf3,0x2d,0x80
+0xaf,0xf3,0x2d,0x88
+0xaf,0xf3,0x2d,0xa0
+0xa7,0xf3,0x0f,0x80
+0xab,0xf3,0x0f,0x80
+0xad,0xf3,0x0f,0x80
+0xae,0xf3,0x0f,0x80
+0xaf,0xf3,0x0f,0x88
+0xaf,0xf3,0x0f,0xa0
+0xa7,0xf3,0x0d,0x80
+0xab,0xf3,0x0d,0x80
+0xad,0xf3,0x0d,0x80
+0xae,0xf3,0x0d,0x80
+0xaf,0xf3,0x0d,0x88
+0xaf,0xf3,0x0d,0xa0
+
+# CHECK: autg	r0, r1, r2
+# CHECK: autg r12, lr, sp
+# CHECK: aut  r12, lr, sp
+# CHECK: bxautr0, r1, r2
+# CHECK: bti
+# CHECK: pacg	r0, r1, r2
+# CHECK: pacg	r12, lr, sp
+# CHECK: pac  r12, lr, sp
+# CHECK: pacbti   r12, lr, sp
+# CHECK: msr	pac_key_p_0, r0
+# CHECK: msr	pac_key_p_1, r0
+# CHECK: msr	pac_key_p_2, r0
+# CHECK: msr	pac_key_p_3, r0
+# CHECK: msr	pac_key_u_0, r0
+# CHECK: msr	pac_key_u_1, r0
+# CHECK: msr	pac_key_u_2, r0
+# CHECK: msr	pac_key_u_3, r0
+# CHECK: msr	pac_key_p_0_ns, r0
+# CHECK: msr	pac_key_p_1_ns, r0
+# CHECK: msr	pac_key_p_2_ns, r0
+# CHECK: msr	pac_key_p_3_ns, r0
+# CHECK: msr	pac_key_u_0_ns, r0
+# CHECK: msr	pac_key_u_1_ns, r0
+# CHECK: msr	pac_key_u_2_ns, r0
+# CHECK: msr	pac_key_u_3_ns, r0
+# CHECK: mrs	r0, pac_key_p_0
+# CHECK: mrs	r0, pac_key_p_1
+# CHECK: mrs	r0, pac_key_p_2
+# CHECK: mrs	r0, pac_key_p_3
+# CHECK: mrs	r0, pac_key_u_0
+# CHECK: mrs	r0, pac_key_u_1
+# CHECK: mrs	r0, pac_key_u_2
+# CHECK: mrs	r0, pac_key_u_3
+# CHECK: mrs	r0, pac_key_p_0_ns
+# CHECK: mrs	r0, pac_key_p_1_ns
+# CHECK: mrs	r0, pac_key_p_2_ns
+# CHECK: mrs	r0, pac_key_p_3_ns
+# CHECK: mrs	r0, pac_key_u_0_ns
+# CHECK: mrs	r0, pac_key_u_1_ns
+# CHECK: mrs	r0, pac_key_u_2_ns
+# CHECK: mrs	r0, pac_key_u_3_ns
+
+# Softfail encodings
+# CHECK: pac  r12, lr, sp
+# CHECK: pac  r12, lr, sp
+# CHECK: pac  r12, lr, sp
+# CHECK: pac  r12, lr, sp
+# CHECK: pac  r12, lr, sp
+# CHECK: pac  r12, lr, sp
+# CHECK: aut  r12, lr, sp
+# CHECK: aut  r12, lr, sp
+# CHECK: aut  r12, lr, sp
+# CHECK: aut  r12, lr, sp
+# CHECK: aut  r12, lr, sp
+# CHECK: aut  r12, lr, sp
+# CHECK: bti
+# CHECK: bti
+# CHECK: bti
+# CHECK: bti
+# CHECK: bti
+# CHECK: bti
+# CHECK: pacbti   r12, lr, sp
+# CHECK: pacbti   r12, lr, sp
+# CHECK: pacbti   r12, lr, sp
+# CHECK: pacbti   r12, lr, sp
+# CHECK: pacbti   r12, lr, sp
+# CHECK: pacbti   r12, lr, sp
Index: llvm/test/MC/ARM/implicit-it-generation-v8.s
===
--- /dev/null
+++ llvm/test/MC/ARM/implicit-it-generation-v8.s
@@ -0,0 +1,9 @@
+@ RUN: llvm-mc -triple thumbv8.1

[PATCH] D110155: [OpenCL] Allow optional __generic in __remove_address_space utility

2021-11-30 Thread Justas Janickas via Phabricator via cfe-commits
Topotuna updated this revision to Diff 390617.
Topotuna added a comment.

Run line argument reordering


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

https://reviews.llvm.org/D110155

Files:
  clang/lib/Headers/opencl-c-base.h
  clang/test/CodeGenOpenCLCXX/remove-address-space.clcpp
  clang/test/SemaOpenCLCXX/remove-address-space.clcpp


Index: clang/test/SemaOpenCLCXX/remove-address-space.clcpp
===
--- clang/test/SemaOpenCLCXX/remove-address-space.clcpp
+++ clang/test/SemaOpenCLCXX/remove-address-space.clcpp
@@ -1,4 +1,8 @@
-// RUN: %clang_cc1 %s -cl-std=clc++ -fdeclare-opencl-builtins 
-finclude-default-header
+// RUN: %clang_cc1 %s -cl-std=clc++1.0 -triple spir-unknown-unknown 
-fdeclare-opencl-builtins -finclude-default-header -verify
+// RUN: %clang_cc1 %s -cl-std=clc++2021 -triple spir-unknown-unknown 
-fdeclare-opencl-builtins -finclude-default-header -verify
+// RUN: %clang_cc1 %s -cl-std=clc++2021 
-cl-ext=-__opencl_c_generic_address_space,-__opencl_c_pipes -triple 
spir-unknown-unknown -fdeclare-opencl-builtins -finclude-default-header -verify
+
+// expected-no-diagnostics
 
 template
 struct is_same {
@@ -19,8 +23,10 @@
 void test_remove_address_space() {
   static_assert(is_same<__remove_address_space::type, int>::value,
 "type without an address space unexpectedly modified by 
__remove_address_space");
+#if defined(__opencl_c_generic_address_space)
   static_assert(is_same<__remove_address_space<__generic int>::type, 
int>::value,
 "__generic address space not removed by 
__remove_address_space");
+#endif
   static_assert(is_same<__remove_address_space<__global char>::type, 
char>::value,
 "__global address space not removed by 
__remove_address_space");
   static_assert(is_same<__remove_address_space<__private ulong>::type, 
ulong>::value,
Index: clang/lib/Headers/opencl-c-base.h
===
--- clang/lib/Headers/opencl-c-base.h
+++ clang/lib/Headers/opencl-c-base.h
@@ -600,9 +600,11 @@
 // C++ for OpenCL - __remove_address_space
 #if defined(__OPENCL_CPP_VERSION__)
 template  struct __remove_address_space { using type = _Tp; };
+#if defined(__opencl_c_generic_address_space)
 template  struct __remove_address_space<__generic _Tp> {
   using type = _Tp;
 };
+#endif
 template  struct __remove_address_space<__global _Tp> {
   using type = _Tp;
 };


Index: clang/test/SemaOpenCLCXX/remove-address-space.clcpp
===
--- clang/test/SemaOpenCLCXX/remove-address-space.clcpp
+++ clang/test/SemaOpenCLCXX/remove-address-space.clcpp
@@ -1,4 +1,8 @@
-// RUN: %clang_cc1 %s -cl-std=clc++ -fdeclare-opencl-builtins -finclude-default-header
+// RUN: %clang_cc1 %s -cl-std=clc++1.0 -triple spir-unknown-unknown -fdeclare-opencl-builtins -finclude-default-header -verify
+// RUN: %clang_cc1 %s -cl-std=clc++2021 -triple spir-unknown-unknown -fdeclare-opencl-builtins -finclude-default-header -verify
+// RUN: %clang_cc1 %s -cl-std=clc++2021 -cl-ext=-__opencl_c_generic_address_space,-__opencl_c_pipes -triple spir-unknown-unknown -fdeclare-opencl-builtins -finclude-default-header -verify
+
+// expected-no-diagnostics
 
 template
 struct is_same {
@@ -19,8 +23,10 @@
 void test_remove_address_space() {
   static_assert(is_same<__remove_address_space::type, int>::value,
 "type without an address space unexpectedly modified by __remove_address_space");
+#if defined(__opencl_c_generic_address_space)
   static_assert(is_same<__remove_address_space<__generic int>::type, int>::value,
 "__generic address space not removed by __remove_address_space");
+#endif
   static_assert(is_same<__remove_address_space<__global char>::type, char>::value,
 "__global address space not removed by __remove_address_space");
   static_assert(is_same<__remove_address_space<__private ulong>::type, ulong>::value,
Index: clang/lib/Headers/opencl-c-base.h
===
--- clang/lib/Headers/opencl-c-base.h
+++ clang/lib/Headers/opencl-c-base.h
@@ -600,9 +600,11 @@
 // C++ for OpenCL - __remove_address_space
 #if defined(__OPENCL_CPP_VERSION__)
 template  struct __remove_address_space { using type = _Tp; };
+#if defined(__opencl_c_generic_address_space)
 template  struct __remove_address_space<__generic _Tp> {
   using type = _Tp;
 };
+#endif
 template  struct __remove_address_space<__global _Tp> {
   using type = _Tp;
 };
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D114639: Raise the minimum Visual Studio version to VS2019

2021-11-30 Thread Simon Pilgrim via Phabricator via cfe-commits
RKSimon added a comment.

Thanks - I think all the MSVC bot admins are now on this patch, so I can avoid 
writing yet another email!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114639

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


[PATCH] D110185: [OpenCL] Reuse C++ for OpenCL 1.0 address space tests for version 2021

2021-11-30 Thread Justas Janickas via Phabricator via cfe-commits
Topotuna updated this revision to Diff 390622.
Topotuna added a comment.
Herald added a subscriber: Naghasan.

Test coverage expanded


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

https://reviews.llvm.org/D110185

Files:
  clang/test/CodeGenOpenCLCXX/address-space-castoperators.cpp
  clang/test/CodeGenOpenCLCXX/address-space-deduction.clcpp
  clang/test/CodeGenOpenCLCXX/address-space-deduction2.clcpp
  clang/test/CodeGenOpenCLCXX/addrspace-conversion.clcpp
  clang/test/CodeGenOpenCLCXX/addrspace-derived-base.clcpp
  clang/test/CodeGenOpenCLCXX/addrspace-new-delete.clcpp
  clang/test/CodeGenOpenCLCXX/addrspace-of-this.clcpp
  clang/test/CodeGenOpenCLCXX/addrspace-operators.clcpp
  clang/test/CodeGenOpenCLCXX/addrspace-references.clcpp
  clang/test/CodeGenOpenCLCXX/addrspace-with-class.clcpp
  clang/test/CodeGenOpenCLCXX/addrspace_cast.clcpp
  clang/test/SemaOpenCLCXX/address-space-castoperators.clcpp
  clang/test/SemaOpenCLCXX/address-space-cond.clcpp
  clang/test/SemaOpenCLCXX/address-space-deduction.clcpp
  clang/test/SemaOpenCLCXX/address-space-lambda.clcpp
  clang/test/SemaOpenCLCXX/address-space-of-this-class-scope.clcpp
  clang/test/SemaOpenCLCXX/address-space-of-this.clcpp
  clang/test/SemaOpenCLCXX/address-space-references.clcpp
  clang/test/SemaOpenCLCXX/address-space-templates.clcpp
  clang/test/SemaOpenCLCXX/address_space_overloading.clcpp
  clang/test/SemaOpenCLCXX/addrspace-auto.clcpp
  clang/test/SemaOpenCLCXX/addrspace-constructors.clcpp
  clang/test/SemaOpenCLCXX/addrspace_cast.clcpp
  clang/test/SemaOpenCLCXX/addrspace_cast_ast_dump.clcpp

Index: clang/test/SemaOpenCLCXX/addrspace_cast_ast_dump.clcpp
===
--- clang/test/SemaOpenCLCXX/addrspace_cast_ast_dump.clcpp
+++ clang/test/SemaOpenCLCXX/addrspace_cast_ast_dump.clcpp
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 %s -cl-std=clc++1.0 -triple spir-unknown-unknown -pedantic -verify -ast-dump | FileCheck %s
+// RUN: %clang_cc1 %s -cl-std=clc++2021 -triple spir-unknown-unknown -pedantic -verify -ast-dump | FileCheck %s
 
 // expected-no-diagnostics
 
Index: clang/test/SemaOpenCLCXX/addrspace_cast.clcpp
===
--- clang/test/SemaOpenCLCXX/addrspace_cast.clcpp
+++ clang/test/SemaOpenCLCXX/addrspace_cast.clcpp
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 %s -cl-std=clc++1.0 -triple spir-unknown-unknown -pedantic -verify -fsyntax-only
+// RUN: %clang_cc1 %s -cl-std=clc++2021 -triple spir-unknown-unknown -pedantic -verify -fsyntax-only
 
 void foo(global int *gl, const global int *gl_const, global int &gl_ref) {
   //FIXME: Diagnostics can be improved to be more specific in some cases.
Index: clang/test/SemaOpenCLCXX/addrspace-constructors.clcpp
===
--- clang/test/SemaOpenCLCXX/addrspace-constructors.clcpp
+++ clang/test/SemaOpenCLCXX/addrspace-constructors.clcpp
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 %s -cl-std=clc++1.0 -triple spir-unknown-unknown -pedantic -ast-dump -verify | FileCheck %s
+// RUN: %clang_cc1 %s -cl-std=clc++2021 -triple spir-unknown-unknown -pedantic -ast-dump -verify | FileCheck %s
 
 __constant int g1; // expected-error {{variable in constant address space must be initialized}}
 __constant int g2 = 0;
Index: clang/test/SemaOpenCLCXX/addrspace-auto.clcpp
===
--- clang/test/SemaOpenCLCXX/addrspace-auto.clcpp
+++ clang/test/SemaOpenCLCXX/addrspace-auto.clcpp
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 %s -cl-std=clc++1.0 -triple spir-unknown-unknown -pedantic -ast-dump -verify | FileCheck %s
+// RUN: %clang_cc1 %s -cl-std=clc++2021 -triple spir-unknown-unknown -pedantic -ast-dump -verify | FileCheck %s
 
 __constant int i = 1;
 //CHECK: |-VarDecl {{.*}} ai '__global int':'__global int'
Index: clang/test/SemaOpenCLCXX/address_space_overloading.clcpp
===
--- clang/test/SemaOpenCLCXX/address_space_overloading.clcpp
+++ clang/test/SemaOpenCLCXX/address_space_overloading.clcpp
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 %s -cl-std=clc++1.0 -triple spir-unknown-unknown -verify -pedantic -fsyntax-only
+// RUN: %clang_cc1 %s -cl-std=clc++2021 -triple spir-unknown-unknown -verify -pedantic -fsyntax-only
 // expected-no-diagnostics
 
 struct RetGlob {
Index: clang/test/SemaOpenCLCXX/address-space-templates.clcpp
===
--- clang/test/SemaOpenCLCXX/address-space-templates.clcpp
+++ clang/test/SemaOpenCLCXX/address-space-templates.clcpp
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 %s -cl-std=clc++1.0 -triple spir-unknown-unknown -pedantic -verify -ast-dump | FileCheck %s
+// RUN: %clang_cc1 %s -cl-std=clc++2021 -triple spir-unknown-unknown -pedantic -verify -ast-dump | FileCheck %s
 
 template 
 struct S {
Index: clang/test/SemaOpenCLCXX/address-space-references.clcpp
==

[PATCH] D114077: [clangd] Basic IncludeCleaner support for c/c++ standard library

2021-11-30 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev added a comment.

Mostly LG, few nits.




Comment at: clang-tools-extra/clangd/Headers.h:32
 namespace clang {
+class NamespaceDecl;
 namespace clangd {

Do we need a forward decl here?



Comment at: clang-tools-extra/clangd/Headers.h:42
+public:
+  static llvm::Optional named(llvm::StringRef);
+

nit: maybe mention the parameter name? it seems redundant but consistent with 
what we have around here.



Comment at: clang-tools-extra/clangd/Headers.h:72
+  Header header() const;
+  llvm::SmallVector headers() const;
+

What's the difference between header() and headers()? Without looking at the 
code below, I presume this is for symbols that could be defined in multiple 
headers?



Comment at: clang-tools-extra/clangd/Headers.h:330
+  static inline clang::clangd::stdlib::Header getEmptyKey() {
+return clang::clangd::stdlib::Header(-1);
+  }

maybe `DenseMapInfo::getEmptyKey()` and 
`DenseMapInfo::getTombstoneKey()` just like above?



Comment at: clang-tools-extra/clangd/IncludeCleaner.cpp:116
+  Result.User.insert(Redecl->getLocation());
+if (auto SS = StdRecognizer(D))
+  Result.Stdlib.insert(*SS);

Maybe pull this upstairs and use early return instead? It's either user code or 
Stdlib, so maybe add exclusively to one of the sets.



Comment at: clang-tools-extra/clangd/IncludeCleaner.h:90
+/// FIXME: remove this hack once the implementation is good enough.
+void setIncludeCleanerAnalyzesStdlib(bool B);
+

Not sure but: don't we want a config option instead? We can remove it just as 
easily since it's all "hidden" right now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114077

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


[PATCH] D114703: [AArch64] Use Feature for A53 Erratum 835769 Fix

2021-11-30 Thread Tomas Matheson via Phabricator via cfe-commits
tmatheson accepted this revision.
tmatheson added a comment.
This revision is now accepted and ready to land.

Makes sense to me


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114703

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


[PATCH] D114782: [X86][clang] Emit diagnostic for float and double when we have features -x87 and -sse on 64-bits

2021-11-30 Thread Phoebe Wang via Phabricator via cfe-commits
pengfei created this revision.
pengfei added reviewers: asavonic, erichkeane, nickdesaulniers.
pengfei requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

A follow up of D114162 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114782

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Basic/Targets/X86.cpp
  clang/lib/Sema/Sema.cpp
  clang/test/Sema/x86_64-no-x87.cpp

Index: clang/test/Sema/x86_64-no-x87.cpp
===
--- clang/test/Sema/x86_64-no-x87.cpp
+++ clang/test/Sema/x86_64-no-x87.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -triple x86_64-linux-gnu -target-feature -x87
+// RUN: %clang_cc1 -fsyntax-only -verify %s -triple x86_64-linux-gnu -target-feature -x87 -target-feature -sse -DERROR_LONGDOUBLE -DERROR_NOSSE
+// RUN: %clang_cc1 -fsyntax-only -verify %s -triple x86_64-linux-gnu -target-feature -x87 -DERROR_LONGDOUBLE
 // RUN: %clang_cc1 -fsyntax-only -verify %s -triple x86_64-linux-gnu -DNOERROR
 
 #ifdef NOERROR
@@ -18,45 +19,45 @@
 double decl_ld_del(double) = delete;
 float decl_ld_del(float) = delete;
 
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
 // expected-error@+4{{'def' requires  'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
 // expected-note@+3{{'def' defined here}}
 // expected-note@+2{{'x' defined here}}
 #endif
 int def(long_double x) {
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
 // expected-error@+2{{'x' requires  'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
 #endif
   return (int)x;
 }
 
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
 // expected-note@+3{{'ld_args' defined here}}
 // expected-note@+2{{'ld_args' defined here}}
 #endif
 int ld_args(long_double x, long_double y);
 
 int call1(float x, float y) {
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
   // expected-error@+2 2{{'ld_args' requires  'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
 #endif
   return ld_args(x, y);
 }
 
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
 // expected-note@+2{{'ld_ret' defined here}}
 #endif
 long_double ld_ret(double x, double y);
 
 int call2(float x, float y) {
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
   // expected-error@+2{{'ld_ret' requires  'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
 #endif
   return (int)ld_ret(x, y);
 }
 
 int binop(double x, double y) {
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
   // expected-error@+2 2{{expression requires  'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
 #endif
   double z = (long_double)x * (long_double)y;
@@ -64,28 +65,28 @@
 }
 
 void assign1(long_double *ret, double x) {
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
   // expected-error@+2{{expression requires  'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
 #endif
   *ret = x;
 }
 
 struct st_long_double1 {
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
   // expected-note@+2{{'ld' defined here}}
 #endif
   long_double ld;
 };
 
 struct st_long_double2 {
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
   // expected-note@+2{{'ld' defined here}}
 #endif
   long_double ld;
 };
 
 struct st_long_double3 {
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
   // expected-note@+2{{'ld' defined here}}
 #endif
   long_double ld;
@@ -93,7 +94,7 @@
 
 void assign2() {
   struct st_long_double1 st;
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
   // expected-error@+3{{expression requires  'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
   // expected-error@+2{{'ld' requires  'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
 #endif
@@ -102,7 +103,7 @@
 
 void assign3() {
   struct st_long_double2 st;
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
   // expected-error@+3{{expression requires  'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
   // expected-error@+2{{'ld' requires  'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
 #endif
@@ -111,7 +112,7 @@
 
 void assign4(double d) {
   struct st_long_double3 st;
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
   // expected-error@+3{{expression requires  'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
   // expected-error@+2{{'ld' requires  'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
 #endif
@@ -124,22 +125,42 @@
 }
 
 // Double and Float return type on x86_64 do not use x87 registers

[PATCH] D113995: [clangd] Dex Trigrams: Improve query trigram generation

2021-11-30 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev updated this revision to Diff 390627.
kbobyrev marked 3 inline comments as done.
kbobyrev added a comment.

Address review comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113995

Files:
  clang-tools-extra/clangd/index/dex/Trigram.cpp
  clang-tools-extra/clangd/unittests/DexTests.cpp

Index: clang-tools-extra/clangd/unittests/DexTests.cpp
===
--- clang-tools-extra/clangd/unittests/DexTests.cpp
+++ clang-tools-extra/clangd/unittests/DexTests.cpp
@@ -386,30 +386,35 @@
   trigramsAre({"c", "cl", "cla", "lan", "ang", "ngd"}));
 
   EXPECT_THAT(identifierTrigramTokens("abc_def"),
-  trigramsAre({"a", "ab", "ad", "abc", "abd", "ade", "bcd", "bde",
-   "cde", "def"}));
+  trigramsAre({"a", "d", "ab", "ad", "de", "abc", "abd", "ade",
+   "bcd", "bde", "cde", "def"}));
 
   EXPECT_THAT(identifierTrigramTokens("a_b_c_d_e_"),
-  trigramsAre({"a", "a_", "ab", "abc", "bcd", "cde"}));
+  trigramsAre({"a", "b", "ab", "bc", "abc", "bcd", "cde"}));
 
   EXPECT_THAT(identifierTrigramTokens("unique_ptr"),
-  trigramsAre({"u", "un", "up", "uni", "unp", "upt", "niq", "nip",
-   "npt", "iqu", "iqp", "ipt", "que", "qup", "qpt",
-   "uep", "ept", "ptr"}));
+  trigramsAre({"u",   "p",   "un",  "up",  "pt",  "uni", "unp",
+   "upt", "niq", "nip", "npt", "iqu", "iqp", "ipt",
+   "que", "qup", "qpt", "uep", "ept", "ptr"}));
 
-  EXPECT_THAT(
-  identifierTrigramTokens("TUDecl"),
-  trigramsAre({"t", "tu", "td", "tud", "tde", "ude", "dec", "ecl"}));
+  EXPECT_THAT(identifierTrigramTokens("TUDecl"),
+  trigramsAre({"t", "d", "tu", "td", "de", "tud", "tde", "ude",
+   "dec", "ecl"}));
 
   EXPECT_THAT(identifierTrigramTokens("IsOK"),
-  trigramsAre({"i", "is", "io", "iso", "iok", "sok"}));
+  trigramsAre({"i", "o", "is", "ok", "io", "iso", "iok", "sok"}));
 
-  EXPECT_THAT(
-  identifierTrigramTokens("abc_defGhij__klm"),
-  trigramsAre({"a",   "ab",  "ad",  "abc", "abd", "ade", "adg", "bcd",
-   "bde", "bdg", "cde", "cdg", "def", "deg", "dgh", "dgk",
-   "efg", "egh", "egk", "fgh", "fgk", "ghi", "ghk", "gkl",
-   "hij", "hik", "hkl", "ijk", "ikl", "jkl", "klm"}));
+  EXPECT_THAT(identifierTrigramTokens("_pb"),
+  trigramsAre({"_", "_p", "p", "pb"}));
+  EXPECT_THAT(identifierTrigramTokens("__pb"),
+  trigramsAre({"_", "_p", "p", "pb"}));
+
+  EXPECT_THAT(identifierTrigramTokens("abc_defGhij__klm"),
+  trigramsAre({"a",   "d",   "ab",  "ad",  "dg",  "de",  "abc",
+   "abd", "ade", "adg", "bcd", "bde", "bdg", "cde",
+   "cdg", "def", "deg", "dgh", "dgk", "efg", "egh",
+   "egk", "fgh", "fgk", "ghi", "ghk", "gkl", "hij",
+   "hik", "hkl", "ijk", "ikl", "jkl", "klm"}));
 }
 
 TEST(DexTrigrams, QueryTrigrams) {
@@ -419,8 +424,16 @@
 
   EXPECT_THAT(generateQueryTrigrams(""), trigramsAre({}));
   EXPECT_THAT(generateQueryTrigrams("_"), trigramsAre({"_"}));
-  EXPECT_THAT(generateQueryTrigrams("__"), trigramsAre({"__"}));
-  EXPECT_THAT(generateQueryTrigrams("___"), trigramsAre({}));
+  EXPECT_THAT(generateQueryTrigrams("__"), trigramsAre({"_"}));
+  EXPECT_THAT(generateQueryTrigrams("___"), trigramsAre({"_"}));
+
+  EXPECT_THAT(generateQueryTrigrams("m_"), trigramsAre({"m"}));
+
+  EXPECT_THAT(generateQueryTrigrams("p_b"), trigramsAre({"pb"}));
+  EXPECT_THAT(generateQueryTrigrams("pb_"), trigramsAre({"pb"}));
+  EXPECT_THAT(generateQueryTrigrams("_p"), trigramsAre({"_p"}));
+  EXPECT_THAT(generateQueryTrigrams("_pb_"), trigramsAre({"pb"}));
+  EXPECT_THAT(generateQueryTrigrams("__pb"), trigramsAre({"pb"}));
 
   EXPECT_THAT(generateQueryTrigrams("X86"), trigramsAre({"x86"}));
 
@@ -525,25 +538,45 @@
 }
 
 TEST(DexTest, ShortQuery) {
-  auto I = Dex::build(generateSymbols({"OneTwoThreeFour"}), RefSlab(),
+  auto I = Dex::build(generateSymbols({"_OneTwoFourSix"}), RefSlab(),
   RelationSlab());
   FuzzyFindRequest Req;
   Req.AnyScope = true;
   bool Incomplete;
 
-  EXPECT_THAT(match(*I, Req, &Incomplete), ElementsAre("OneTwoThreeFour"));
+  EXPECT_THAT(match(*I, Req, &Incomplete), ElementsAre("_OneTwoFourSix"));
   EXPECT_FALSE(Incomplete) << "Empty string is not a short query";
 
-  Req.Query = "t";
-  EXPECT_THAT(match(*I, Req, &Incomplete), ElementsAre());
-  EXPECT_TRUE(Incomplete) << "Short queries have different semantics";
+  Req.Query = "o";
+  EXPECT_THAT(match(*I, Req, &Incomplete), ElementsAre("_OneTwoFourSix"));
+  EXPECT_TRUE(Incomplete) << "Using first head as unigram

[PATCH] D113995: [clangd] Dex Trigrams: Improve query trigram generation

2021-11-30 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev added inline comments.



Comment at: clang-tools-extra/clangd/index/dex/Trigram.cpp:47
+  const size_t NPOS = std::numeric_limits::max();
+  llvm::SmallVector> 
Next(LowercaseIdentifier.size());
+  size_t NextTail = NPOS, NextHead = NPOS;

sammccall wrote:
> why the change from array to pair and 0 to NPOS?
- Array of two elements is confusing: we had it since we had 3 elements, with 2 
it doesn't make sense anymore. Also, makes it easier to decompose the items 
(`std::tie(Tail, Head)` vs `size_t Tail = Next[I][0], Head = Next[I][1]`).
- NPOS is more explicit than 0 in our intent: 0 is a valid index and it feels 
awkward to use a valid index as NOT_FOUND. Yes, it's the one that can't appear 
in the Next but it's not clear from the code and requires some explanation for 
understanding. Why NPOS can't be found in `Next` is obvious.



Comment at: clang-tools-extra/clangd/index/dex/Trigram.cpp:102
+  LowercaseIdentifier[NextHead]));
+Position = NextHead;
+  }

sammccall wrote:
> (if the change to NPOS is just to avoid hitting Position == 0 on the first 
> iteration, you could check it here instead)
It's not only for that but this was the trigger, having the `Position == 0` 
check here makes the logic slightly confusing, I think it's better to just use 
NPOS instead for the reasons above.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113995

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


[PATCH] D114072: [clangd] Record IWYU pragma keep in the IncludeStructure

2021-11-30 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev updated this revision to Diff 390631.
kbobyrev marked an inline comment as done.
kbobyrev added a comment.

Change the API, update the patch. It's crashing ATM, investigating the
problems.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114072

Files:
  clang-tools-extra/clangd/CodeComplete.cpp
  clang-tools-extra/clangd/Headers.cpp
  clang-tools-extra/clangd/Headers.h
  clang-tools-extra/clangd/ParsedAST.cpp
  clang-tools-extra/clangd/Preamble.cpp
  clang-tools-extra/clangd/unittests/HeadersTests.cpp

Index: clang-tools-extra/clangd/unittests/HeadersTests.cpp
===
--- clang-tools-extra/clangd/unittests/HeadersTests.cpp
+++ clang-tools-extra/clangd/unittests/HeadersTests.cpp
@@ -80,7 +80,9 @@
 EXPECT_TRUE(
 Action.BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0]));
 IncludeStructure Includes;
-Clang->getPreprocessor().addPPCallbacks(Includes.collect(*Clang));
+auto Collector = Includes.collect(*Clang);
+Clang->getPreprocessor().addCommentHandler(Collector.get());
+Clang->getPreprocessor().addPPCallbacks(move(Collector));
 EXPECT_FALSE(Action.Execute());
 Action.EndSourceFile();
 return Includes;
@@ -142,6 +144,7 @@
 MATCHER_P(Resolved, Name, "") { return arg.Resolved == Name; }
 MATCHER_P(IncludeLine, N, "") { return arg.HashLine == N; }
 MATCHER_P(Directive, D, "") { return arg.Directive == D; }
+MATCHER_P(HasPragmaKeep, H, "") { return arg.BehindPragmaKeep == H; }
 
 MATCHER_P2(Distance, File, D, "") {
   if (arg.getFirst() != File)
@@ -257,6 +260,18 @@
Directive(tok::pp_include_next)));
 }
 
+TEST_F(HeadersTest, IWYUPragmaKeep) {
+  FS.Files[MainFile] = R"cpp(
+#include "bar.h" // IWYU pragma: keep
+#include "foo.h"
+)cpp";
+
+  EXPECT_THAT(
+  collectIncludes().MainFileIncludes,
+  UnorderedElementsAre(AllOf(Written("\"foo.h\""), HasPragmaKeep(false)),
+   AllOf(Written("\"bar.h\""), HasPragmaKeep(true;
+}
+
 TEST_F(HeadersTest, InsertInclude) {
   std::string Path = testPath("sub/bar.h");
   FS.Files[Path] = "";
Index: clang-tools-extra/clangd/Preamble.cpp
===
--- clang-tools-extra/clangd/Preamble.cpp
+++ clang-tools-extra/clangd/Preamble.cpp
@@ -288,7 +288,9 @@
 return error("failed BeginSourceFile");
   Preprocessor &PP = Clang->getPreprocessor();
   IncludeStructure Includes;
-  PP.addPPCallbacks(Includes.collect(*Clang));
+  auto Collector = Includes.collect(*Clang);
+  PP.addCommentHandler(Collector.get());
+  PP.addPPCallbacks(move(Collector));
   ScannedPreamble SP;
   SP.Bounds = Bounds;
   PP.addPPCallbacks(
Index: clang-tools-extra/clangd/ParsedAST.cpp
===
--- clang-tools-extra/clangd/ParsedAST.cpp
+++ clang-tools-extra/clangd/ParsedAST.cpp
@@ -446,7 +446,9 @@
   // Important: collectIncludeStructure is registered *after* ReplayPreamble!
   // Otherwise we would collect the replayed includes again...
   // (We can't *just* use the replayed includes, they don't have Resolved path).
-  Clang->getPreprocessor().addPPCallbacks(Includes.collect(*Clang));
+  auto Collector = Includes.collect(*Clang);
+  Clang->getPreprocessor().addCommentHandler(Collector.get());
+  Clang->getPreprocessor().addPPCallbacks(move(Collector));
   // Copy over the macros in the preamble region of the main file, and combine
   // with non-preamble macros below.
   MainFileMacros Macros;
Index: clang-tools-extra/clangd/Headers.h
===
--- clang-tools-extra/clangd/Headers.h
+++ clang-tools-extra/clangd/Headers.h
@@ -20,6 +20,7 @@
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Lex/HeaderSearch.h"
 #include "clang/Lex/PPCallbacks.h"
+#include "clang/Lex/Preprocessor.h"
 #include "clang/Tooling/Inclusions/HeaderIncludes.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseSet.h"
@@ -64,6 +65,7 @@
   int HashLine = 0;// Line number containing the directive, 0-indexed.
   SrcMgr::CharacteristicKind FileKind = SrcMgr::C_User;
   llvm::Optional HeaderID;
+  bool BehindPragmaKeep = false; // Has IWYU pragma: keep right after.
 };
 llvm::raw_ostream &operator<<(llvm::raw_ostream &, const Inclusion &);
 bool operator==(const Inclusion &LHS, const Inclusion &RHS);
@@ -123,9 +125,21 @@
 RealPathNames.emplace_back();
   }
 
+  class IncludeCollector : public PPCallbacks, public CommentHandler {};
   // Returns a PPCallback that visits all inclusions in the main file and
-  // populates the structure.
-  std::unique_ptr collect(const CompilerInstance &CI);
+  // populates the structure. IncludeCollector can also scan the comments for
+  // IWYU pragmas but it needs to be explicitly added to as a preprocessor
+  // comment handler. P

[PATCH] D114782: [X86][clang] Emit diagnostic for float and double when we have features -x87 and -sse on 64-bits

2021-11-30 Thread Phoebe Wang via Phabricator via cfe-commits
pengfei updated this revision to Diff 390632.
pengfei added a comment.

Fix a lit fail.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114782

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Basic/Targets/X86.cpp
  clang/lib/Sema/Sema.cpp
  clang/test/CodeGen/X86/x86_64-mno-sse.c
  clang/test/Sema/x86_64-no-x87.cpp

Index: clang/test/Sema/x86_64-no-x87.cpp
===
--- clang/test/Sema/x86_64-no-x87.cpp
+++ clang/test/Sema/x86_64-no-x87.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -triple x86_64-linux-gnu -target-feature -x87
+// RUN: %clang_cc1 -fsyntax-only -verify %s -triple x86_64-linux-gnu -target-feature -x87 -target-feature -sse -DERROR_LONGDOUBLE -DERROR_NOSSE
+// RUN: %clang_cc1 -fsyntax-only -verify %s -triple x86_64-linux-gnu -target-feature -x87 -DERROR_LONGDOUBLE
 // RUN: %clang_cc1 -fsyntax-only -verify %s -triple x86_64-linux-gnu -DNOERROR
 
 #ifdef NOERROR
@@ -18,45 +19,45 @@
 double decl_ld_del(double) = delete;
 float decl_ld_del(float) = delete;
 
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
 // expected-error@+4{{'def' requires  'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
 // expected-note@+3{{'def' defined here}}
 // expected-note@+2{{'x' defined here}}
 #endif
 int def(long_double x) {
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
 // expected-error@+2{{'x' requires  'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
 #endif
   return (int)x;
 }
 
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
 // expected-note@+3{{'ld_args' defined here}}
 // expected-note@+2{{'ld_args' defined here}}
 #endif
 int ld_args(long_double x, long_double y);
 
 int call1(float x, float y) {
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
   // expected-error@+2 2{{'ld_args' requires  'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
 #endif
   return ld_args(x, y);
 }
 
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
 // expected-note@+2{{'ld_ret' defined here}}
 #endif
 long_double ld_ret(double x, double y);
 
 int call2(float x, float y) {
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
   // expected-error@+2{{'ld_ret' requires  'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
 #endif
   return (int)ld_ret(x, y);
 }
 
 int binop(double x, double y) {
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
   // expected-error@+2 2{{expression requires  'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
 #endif
   double z = (long_double)x * (long_double)y;
@@ -64,28 +65,28 @@
 }
 
 void assign1(long_double *ret, double x) {
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
   // expected-error@+2{{expression requires  'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
 #endif
   *ret = x;
 }
 
 struct st_long_double1 {
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
   // expected-note@+2{{'ld' defined here}}
 #endif
   long_double ld;
 };
 
 struct st_long_double2 {
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
   // expected-note@+2{{'ld' defined here}}
 #endif
   long_double ld;
 };
 
 struct st_long_double3 {
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
   // expected-note@+2{{'ld' defined here}}
 #endif
   long_double ld;
@@ -93,7 +94,7 @@
 
 void assign2() {
   struct st_long_double1 st;
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
   // expected-error@+3{{expression requires  'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
   // expected-error@+2{{'ld' requires  'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
 #endif
@@ -102,7 +103,7 @@
 
 void assign3() {
   struct st_long_double2 st;
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
   // expected-error@+3{{expression requires  'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
   // expected-error@+2{{'ld' requires  'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
 #endif
@@ -111,7 +112,7 @@
 
 void assign4(double d) {
   struct st_long_double3 st;
-#ifndef NOERROR
+#ifdef ERROR_LONGDOUBLE
   // expected-error@+3{{expression requires  'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
   // expected-error@+2{{'ld' requires  'long_double' (aka 'long double') type support, but target 'x86_64-unknown-linux-gnu' does not support it}}
 #endif
@@ -124,22 +125,42 @@
 }
 
 // Double and Float return type on x86_64 do not use x87 registers
+#ifdef ERROR_NOSSE
+  // expected-error@+3{{SSE register return with S

[PATCH] D112427: [ARM] Implement setjmp BTI placement for PACBTI-M

2021-11-30 Thread Ties Stuij via Phabricator via cfe-commits
stuij updated this revision to Diff 390633.
stuij added a comment.

slight rewording


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112427

Files:
  clang/docs/ClangCommandLineReference.rst
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/Arch/ARM.cpp
  clang/test/Driver/arm-bti-return-twice.c
  llvm/lib/Target/ARM/ARM.td
  llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/lib/Target/ARM/ARMISelLowering.h
  llvm/lib/Target/ARM/ARMInstrThumb2.td
  llvm/lib/Target/ARM/ARMSubtarget.h
  llvm/test/CodeGen/ARM/setjmp-bti-basic.ll
  llvm/test/CodeGen/ARM/setjmp-bti-outliner.ll

Index: llvm/test/CodeGen/ARM/setjmp-bti-outliner.ll
===
--- /dev/null
+++ llvm/test/CodeGen/ARM/setjmp-bti-outliner.ll
@@ -0,0 +1,92 @@
+; RUN: llc -mtriple=thumbv8.1m.main-arm-none-eabi -enable-machine-outliner < %s | \
+; RUN: FileCheck %s --check-prefix=BTI
+; RUN: llc -mtriple=thumbv8.1m.main-arm-none-eabi -enable-machine-outliner -mattr=+no-bti-at-return-twice < %s | FileCheck %s --check-prefix=NOBTI
+
+; C source
+; 
+; jmp_buf buf;
+;
+; extern void h(int a, int b, int *c);
+;
+; int f(int a, int b, int c, int d) {
+;   if (setjmp(buf) != 0)
+; return -1;
+;   h(a, b, &a);
+;   return 2 + a * (a + b) / (c + d);
+; }
+;
+; int g(int a, int b, int c, int d) {
+;   if (setjmp(buf) != 0)
+; return -1;
+;   h(a, b, &a);
+;   return 1 + a * (a + b) / (c + d);
+; }
+
+@buf = global [20 x i64] zeroinitializer, align 8
+
+define i32 @f(i32 %a, i32 %b, i32 %c, i32 %d) {
+; BTI-LABEL: f:
+; BTI:   bl OUTLINED_FUNCTION_0
+; BTI-NEXT:  bti
+; NOBTI-LABEL: f:
+; NOBTI:   bl OUTLINED_FUNCTION_0
+; NOBTI-NEXT:   cbz	r0, .LBB0_2
+entry:
+  %a.addr = alloca i32, align 4
+  store i32 %a, i32* %a.addr, align 4
+  %call = call i32 @setjmp(i64* getelementptr inbounds ([20 x i64], [20 x i64]* @buf, i32 0, i32 0)) #0
+  %cmp.not = icmp eq i32 %call, 0
+  br i1 %cmp.not, label %if.end, label %return
+
+if.end:   ; preds = %entry
+  call void @h(i32 %a, i32 %b, i32* nonnull %a.addr)
+  %0 = load i32, i32* %a.addr, align 4
+  %add = add nsw i32 %0, %b
+  %mul = mul nsw i32 %add, %0
+  %add1 = add nsw i32 %d, %c
+  %div = sdiv i32 %mul, %add1
+  %add2 = add nsw i32 %div, 2
+  br label %return
+
+return:   ; preds = %entry, %if.end
+  %retval.0 = phi i32 [ %add2, %if.end ], [ -1, %entry ]
+  ret i32 %retval.0
+}
+
+define i32 @g(i32 %a, i32 %b, i32 %c, i32 %d) {
+; BTI-LABEL: g:
+; BTI:   bl OUTLINED_FUNCTION_0
+; BTI-NEXT:  bti
+; NOBTI-LABEL: g:
+; NOBTI:   bl OUTLINED_FUNCTION_0
+; NOBTI-NEXT:  cbz	r0, .LBB1_2
+entry:
+  %a.addr = alloca i32, align 4
+  store i32 %a, i32* %a.addr, align 4
+  %call = call i32 @setjmp(i64* getelementptr inbounds ([20 x i64], [20 x i64]* @buf, i32 0, i32 0)) #0
+  %cmp.not = icmp eq i32 %call, 0
+  br i1 %cmp.not, label %if.end, label %return
+
+if.end:   ; preds = %entry
+  call void @h(i32 %a, i32 %b, i32* nonnull %a.addr)
+  %0 = load i32, i32* %a.addr, align 4
+  %add = add nsw i32 %0, %b
+  %mul = mul nsw i32 %add, %0
+  %add1 = add nsw i32 %d, %c
+  %div = sdiv i32 %mul, %add1
+  %add2 = add nsw i32 %div, 1
+  br label %return
+
+return:   ; preds = %entry, %if.end
+  %retval.0 = phi i32 [ %add2, %if.end ], [ -1, %entry ]
+  ret i32 %retval.0
+}
+
+declare void @h(i32, i32, i32*)
+declare i32 @setjmp(i64*) #0
+
+attributes #0 = { returns_twice }
+
+!llvm.module.flags = !{!0}
+
+!0 = !{i32 1, !"branch-target-enforcement", i32 1}
Index: llvm/test/CodeGen/ARM/setjmp-bti-basic.ll
===
--- /dev/null
+++ llvm/test/CodeGen/ARM/setjmp-bti-basic.ll
@@ -0,0 +1,50 @@
+; RUN: llc -mtriple=thumbv8.1m.main-arm-none-eabi < %s | FileCheck %s --check-prefix=BTI
+; RUN: llc -mtriple=thumbv8.1m.main-arm-none-eabi -mattr=+no-bti-at-return-twice < %s | \
+; RUN: FileCheck %s --check-prefix=NOBTI
+
+; C source
+; 
+; jmp_buf buf;
+;
+; extern void bar(int x);
+;
+; int foo(int x) {
+;   if (setjmp(buf))
+; x = 0;
+;   else
+; bar(x);
+;   return x;
+; }
+
+@buf = global [20 x i64] zeroinitializer, align 8
+
+define i32 @foo(i32 %x) {
+; BTI-LABEL: foo:
+; BTI:   bl setjmp
+; BTI-NEXT:  bti
+; NOBTI-LABEL: foo:
+; NOBTI:   bl setjmp
+; NOBTI-NOT:   bti
+
+entry:
+  %call = call i32 @setjmp(i64* getelementptr inbounds ([20 x i64], [20 x i64]* @buf, i32 0, i32 0)) #0
+  %tobool.not = icmp eq i32 %call, 0
+  br i1 %tobool.not, label %if.else, label %if.end
+
+if.else:  ; preds = %entry
+  call void @bar(i32 %x)
+  br label %if.end
+
+if.end:   ; preds = %entry, %if.else
+  %x.addr.0 

[PATCH] D113995: [clangd] Dex Trigrams: Improve query trigram generation

2021-11-30 Thread Sam McCall via Phabricator via cfe-commits
sammccall added inline comments.



Comment at: clang-tools-extra/clangd/index/dex/Trigram.cpp:47
+  const size_t NPOS = std::numeric_limits::max();
+  llvm::SmallVector> 
Next(LowercaseIdentifier.size());
+  size_t NextTail = NPOS, NextHead = NPOS;

you've changed unsigned -> size_t here, can you revert that please?



Comment at: clang-tools-extra/clangd/index/dex/Trigram.cpp:91
+std::tie(NextTail, NextHead) = Next[Position];
+if (NextTail != NPOS)
+  Out(Trigram(LowercaseIdentifier[Position],

You're not treating head vs tail differently, this should just be iterating 
over Next as above.



Comment at: clang-tools-extra/clangd/index/dex/Trigram.cpp:47
+  const size_t NPOS = std::numeric_limits::max();
+  llvm::SmallVector> 
Next(LowercaseIdentifier.size());
+  size_t NextTail = NPOS, NextHead = NPOS;

kbobyrev wrote:
> sammccall wrote:
> > why the change from array to pair and 0 to NPOS?
> - Array of two elements is confusing: we had it since we had 3 elements, with 
> 2 it doesn't make sense anymore. Also, makes it easier to decompose the items 
> (`std::tie(Tail, Head)` vs `size_t Tail = Next[I][0], Head = Next[I][1]`).
> - NPOS is more explicit than 0 in our intent: 0 is a valid index and it feels 
> awkward to use a valid index as NOT_FOUND. Yes, it's the one that can't 
> appear in the Next but it's not clear from the code and requires some 
> explanation for understanding. Why NPOS can't be found in `Next` is obvious.
I disagree on the style points here and they don't seem particularly related to 
the patch. Do they need to be included here?

> Array of two elements is confusing

Well, I disagree here: the difference between array and pair is 
homogeneous vs heterogeneous. The usage here is almost entirely homogeneous.
3 vs 2 doesn't make a difference, we could have used `tuple`, same 
would apply.

> Also, makes it easier to decompose the items

As far as ergonomics go, this comes at the cost of not being able to iterate 
over them, which we do much more often. (And AFAICT you never need NextTail 
decomposed.)

`NPOS` is not a common convention so I don't think it's more obvious. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113995

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


[clang] f02c5f3 - [Analyzer][solver] Do not remove the simplified symbol from the eq class

2021-11-30 Thread Gabor Marton via cfe-commits

Author: Gabor Marton
Date: 2021-11-30T11:13:13+01:00
New Revision: f02c5f3478318075d1a469203900e452ba651421

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

LOG: [Analyzer][solver] Do not remove the simplified symbol from the eq class

Currently, during symbol simplification we remove the original member symbol
from the equivalence class (`ClassMembers` trait). However, we keep the
reverse link (`ClassMap` trait), in order to be able the query the
related constraints even for the old member. This asymmetry can lead to
a problem when we merge equivalence classes:
```
ClassA: [a, b]   // ClassMembers trait,
a->a, b->a   // ClassMap trait, a is the representative symbol
```
Now lets delete `a`:
```
ClassA: [b]
a->a, b->a
```
Let's merge the trivial class `c` into ClassA:
```
ClassA: [c, b]
c->c, b->c, a->a
```
Now after the merge operation, `c` and `a` are actually in different
equivalence classes, which is inconsistent.

One solution to this problem is to simply avoid removing the original
member and this is what this patch does.

Other options I have considered:
1) Always merge the trivial class into the non-trivial class. This might
   work most of the time, however, will fail if we have to merge two
   non-trivial classes (in that case we no longer can track equivalences
   precisely).
2) In `removeMember`, update the reverse link as well. This would cease
   the inconsistency, but we'd loose precision since we could not query
   the constraints for the removed member.

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

Added: 


Modified: 
clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
clang/test/Analysis/expr-inspection-printState-eq-classes.c
clang/test/Analysis/symbol-simplification-disequality-info.cpp
clang/test/Analysis/symbol-simplification-fixpoint-one-iteration.cpp
clang/test/Analysis/symbol-simplification-fixpoint-two-iterations.cpp

Removed: 




diff  --git a/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp 
b/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
index 74403a160b8e..3f8d9e4298a0 100644
--- a/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
+++ b/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
@@ -601,10 +601,6 @@ class EquivalenceClass : public llvm::FoldingSetNode {
   LLVM_NODISCARD static inline Optional
   areEqual(ProgramStateRef State, SymbolRef First, SymbolRef Second);
 
-  /// Remove one member from the class.
-  LLVM_NODISCARD ProgramStateRef removeMember(ProgramStateRef State,
-  const SymbolRef Old);
-
   /// Iterate over all symbols and try to simplify them.
   LLVM_NODISCARD static inline ProgramStateRef simplify(SValBuilder &SVB,
 RangeSet::Factory &F,
@@ -2136,34 +2132,6 @@ inline Optional 
EquivalenceClass::areEqual(ProgramStateRef State,
   return llvm::None;
 }
 
-LLVM_NODISCARD ProgramStateRef
-EquivalenceClass::removeMember(ProgramStateRef State, const SymbolRef Old) {
-
-  SymbolSet ClsMembers = getClassMembers(State);
-  assert(ClsMembers.contains(Old));
-
-  // We don't remove `Old`'s Sym->Class relation for two reasons:
-  // 1) This way constraints for the old symbol can still be found via it's
-  // equivalence class that it used to be the member of.
-  // 2) Performance and resource reasons. We can spare one removal and thus one
-  // additional tree in the forest of `ClassMap`.
-
-  // Remove `Old`'s Class->Sym relation.
-  SymbolSet::Factory &F = getMembersFactory(State);
-  ClassMembersTy::Factory &EMFactory = State->get_context();
-  ClsMembers = F.remove(ClsMembers, Old);
-  // Ensure another precondition of the removeMember function (we can check
-  // this only with isEmpty, thus we have to do the remove first).
-  assert(!ClsMembers.isEmpty() &&
- "Class should have had at least two members before member removal");
-  // Overwrite the existing members assigned to this class.
-  ClassMembersTy ClassMembersMap = State->get();
-  ClassMembersMap = EMFactory.add(ClassMembersMap, *this, ClsMembers);
-  State = State->set(ClassMembersMap);
-
-  return State;
-}
-
 // Re-evaluate an SVal with top-level `State->assume` logic.
 LLVM_NODISCARD ProgramStateRef reAssume(ProgramStateRef State,
 const RangeSet *Constraint,
@@ -2228,8 +2196,6 @@ EquivalenceClass::simplify(SValBuilder &SVB, 
RangeSet::Factory &F,
 continue;
 
   assert(find(State, MemberSym) == find(State, SimplifiedMemberSym));
-  // Remove the old and more complex symbol.
-  State = find(State, MemberSym).removeMember(State, MemberSym);
 
   // Query the class constraint again b/c that may have changed during the
   // mer

[PATCH] D114619: [Analyzer][solver] Do not remove the simplified symbol from the eq class

2021-11-30 Thread Gabor Marton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf02c5f347831: [Analyzer][solver] Do not remove the 
simplified symbol from the eq class (authored by martong).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114619

Files:
  clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
  clang/test/Analysis/expr-inspection-printState-eq-classes.c
  clang/test/Analysis/symbol-simplification-disequality-info.cpp
  clang/test/Analysis/symbol-simplification-fixpoint-one-iteration.cpp
  clang/test/Analysis/symbol-simplification-fixpoint-two-iterations.cpp

Index: clang/test/Analysis/symbol-simplification-fixpoint-two-iterations.cpp
===
--- clang/test/Analysis/symbol-simplification-fixpoint-two-iterations.cpp
+++ clang/test/Analysis/symbol-simplification-fixpoint-two-iterations.cpp
@@ -27,17 +27,20 @@
   if (b != 0)
 return;
   clang_analyzer_printState();
-  // CHECK:   "constraints": [
-  // CHECK-NEXT:{ "symbol": "(reg_$0) != (reg_$3)", "range": "{ [0, 0] }" },
-  // CHECK-NEXT:{ "symbol": "reg_$1", "range": "{ [0, 0] }" },
-  // CHECK-NEXT:{ "symbol": "reg_$2", "range": "{ [0, 0] }" }
-  // CHECK-NEXT:  ],
-  // CHECK-NEXT:  "equivalence_classes": [
-  // CHECK-NEXT:[ "(reg_$0) != (reg_$3)" ],
-  // CHECK-NEXT:[ "reg_$0", "reg_$3" ],
-  // CHECK-NEXT:[ "reg_$2" ]
-  // CHECK-NEXT:  ],
-  // CHECK-NEXT:  "disequality_info": null,
+  // CHECK:  "constraints": [
+  // CHECK-NEXT:   { "symbol": "(((reg_$0) + (reg_$1)) + (reg_$2)) != (reg_$3)", "range": "{ [0, 0] }" },
+  // CHECK-NEXT:   { "symbol": "((reg_$0) + (reg_$2)) != (reg_$3)", "range": "{ [0, 0] }" },
+  // CHECK-NEXT:   { "symbol": "(reg_$0) != (reg_$3)", "range": "{ [0, 0] }" },
+  // CHECK-NEXT:   { "symbol": "(reg_$2) + (reg_$1)", "range": "{ [0, 0] }" },
+  // CHECK-NEXT:   { "symbol": "reg_$1", "range": "{ [0, 0] }" },
+  // CHECK-NEXT:   { "symbol": "reg_$2", "range": "{ [0, 0] }" }
+  // CHECK-NEXT: ],
+  // CHECK-NEXT: "equivalence_classes": [
+  // CHECK-NEXT:   [ "(((reg_$0) + (reg_$1)) + (reg_$2)) != (reg_$3)", "((reg_$0) + (reg_$2)) != (reg_$3)", "(reg_$0) != (reg_$3)" ],
+  // CHECK-NEXT:   [ "((reg_$0) + (reg_$1)) + (reg_$2)", "(reg_$0) + (reg_$2)", "reg_$0", "reg_$3" ],
+  // CHECK-NEXT:   [ "(reg_$2) + (reg_$1)", "reg_$2" ]
+  // CHECK-NEXT: ],
+  // CHECK-NEXT: "disequality_info": null,
 
   // Keep the symbols and the constraints! alive.
   (void)(a * b * c * d);
Index: clang/test/Analysis/symbol-simplification-fixpoint-one-iteration.cpp
===
--- clang/test/Analysis/symbol-simplification-fixpoint-one-iteration.cpp
+++ clang/test/Analysis/symbol-simplification-fixpoint-one-iteration.cpp
@@ -24,14 +24,15 @@
   if (b != 0)
 return;
   clang_analyzer_printState();
-  // CHECK:"constraints": [
-  // CHECK-NEXT: { "symbol": "(reg_$0) != (reg_$2)", "range": "{ [0, 0] }" },
-  // CHECK-NEXT: { "symbol": "reg_$1", "range": "{ [0, 0] }" }
-  // CHECK-NEXT:   ],
-  // CHECK-NEXT:   "equivalence_classes": [
-  // CHECK-NEXT: [ "(reg_$0) != (reg_$2)" ],
-  // CHECK-NEXT: [ "reg_$0", "reg_$2" ]
-  // CHECK-NEXT:   ],
+  // CHECK:  "constraints": [
+  // CHECK-NEXT:   { "symbol": "((reg_$0) + (reg_$1)) != (reg_$2)", "range": "{ [0, 0] }" },
+  // CHECK-NEXT:   { "symbol": "(reg_$0) != (reg_$2)", "range": "{ [0, 0] }" },
+  // CHECK-NEXT:   { "symbol": "reg_$1", "range": "{ [0, 0] }" }
+  // CHECK-NEXT: ],
+  // CHECK-NEXT: "equivalence_classes": [
+  // CHECK-NEXT:   [ "((reg_$0) + (reg_$1)) != (reg_$2)", "(reg_$0) != (reg_$2)" ],
+  // CHECK-NEXT:   [ "(reg_$0) + (reg_$1)", "reg_$0", "reg_$2" ]
+  // CHECK-NEXT: ],
   // CHECK-NEXT: "disequality_info": null,
 
   // Keep the symbols and the constraints! alive.
Index: clang/test/Analysis/symbol-simplification-disequality-info.cpp
===
--- clang/test/Analysis/symbol-simplification-disequality-info.cpp
+++ clang/test/Analysis/symbol-simplification-disequality-info.cpp
@@ -12,18 +12,18 @@
   if (a + b + c == d)
 return;
   clang_analyzer_printState();
-  // CHECK:   "disequality_info": [
-  // CHECK-NEXT:{
-  // CHECK-NEXT:  "class": [ "((reg_$0) + (reg_$1)) + (reg_$2)" ],
-  // CHECK-NEXT:  "disequal_to": [
-  // CHECK-NEXT:[ "reg_$3" ]]
-  // CHECK-NEXT:},
-  // CHECK-NEXT:{
-  // CHECK-NEXT:  "class": [ "reg_$3" ],
-  // CHECK-NEXT:  "disequal_to": [
-  // CHECK-NEXT:[ "((reg_$0) + (reg_$1)) + (reg_$2)" ]]
-  // CHECK-NEXT:}
-  // CHECK-NEXT:  ],
+  // CHECK:  "disequality_info": [
+  // CHECK-NEXT:   {
+  // CHECK-NEXT: "class": [ "((reg_$0) + (reg_$1)) + (reg_$2)" ],
+  // CHECK-NEXT: "disequal_to": [
+  // CHECK-NEXT:   [ "reg_$3" ]]
+  // CHECK-NEXT:

[clang] 0a17896 - [Analyzer][Core] Make SValBuilder to better simplify svals with 3 symbols in the tree

2021-11-30 Thread Gabor Marton via cfe-commits

Author: Gabor Marton
Date: 2021-11-30T11:24:59+01:00
New Revision: 0a17896fe6fdbbde1f9d3ffbb10a4f3bfa8960f9

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

LOG: [Analyzer][Core] Make SValBuilder to better simplify svals with 3 symbols 
in the tree

Add the capability to simplify more complex constraints where there are 3
symbols in the tree. In this change I extend simplifySVal to query constraints
of children sub-symbols in a symbol tree. (The constraint for the parent is
asked in getKnownValue.)

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

Added: 
clang/test/Analysis/svalbuilder-simplify-compound-svals.cpp

Modified: 
clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
clang/test/Analysis/taint-tester.c

Removed: 




diff  --git a/clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp 
b/clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
index e179ecc33481..4ca35dd06ae5 100644
--- a/clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
+++ b/clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
@@ -1102,7 +1102,6 @@ const llvm::APSInt 
*SimpleSValBuilder::getKnownValue(ProgramStateRef state,
   if (SymbolRef Sym = V.getAsSymbol())
 return state->getConstraintManager().getSymVal(state, Sym);
 
-  // FIXME: Add support for SymExprs.
   return nullptr;
 }
 
@@ -1134,6 +1133,24 @@ SVal SimpleSValBuilder::simplifySVal(ProgramStateRef 
State, SVal V) {
   return cache(Sym, SVB.makeSymbolVal(Sym));
 }
 
+// Return the known const value for the Sym if available, or return Undef
+// otherwise.
+SVal getConst(SymbolRef Sym) {
+  const llvm::APSInt *Const =
+  State->getConstraintManager().getSymVal(State, Sym);
+  if (Const)
+return Loc::isLocType(Sym->getType()) ? (SVal)SVB.makeIntLocVal(*Const)
+  : (SVal)SVB.makeIntVal(*Const);
+  return UndefinedVal();
+}
+
+SVal getConstOrVisit(SymbolRef Sym) {
+  const SVal Ret = getConst(Sym);
+  if (Ret.isUndef())
+return Visit(Sym);
+  return Ret;
+}
+
   public:
 Simplifier(ProgramStateRef State)
 : State(State), SVB(State->getStateManager().getSValBuilder()) {}
@@ -1147,15 +1164,14 @@ SVal SimpleSValBuilder::simplifySVal(ProgramStateRef 
State, SVal V) {
   return SVB.makeSymbolVal(S);
 }
 
-// TODO: Support SymbolCast. Support IntSymExpr when/if we actually
-// start producing them.
+// TODO: Support SymbolCast.
 
 SVal VisitSymIntExpr(const SymIntExpr *S) {
   auto I = Cached.find(S);
   if (I != Cached.end())
 return I->second;
 
-  SVal LHS = Visit(S->getLHS());
+  SVal LHS = getConstOrVisit(S->getLHS());
   if (isUnchanged(S->getLHS(), LHS))
 return skip(S);
 
@@ -1187,9 +1203,10 @@ SVal SimpleSValBuilder::simplifySVal(ProgramStateRef 
State, SVal V) {
   if (I != Cached.end())
 return I->second;
 
-  SVal RHS = Visit(S->getRHS());
+  SVal RHS = getConstOrVisit(S->getRHS());
   if (isUnchanged(S->getRHS(), RHS))
 return skip(S);
+
   SVal LHS = SVB.makeIntVal(S->getLHS());
   return cache(
   S, SVB.evalBinOp(State, S->getOpcode(), LHS, RHS, S->getType()));
@@ -1208,8 +1225,9 @@ SVal SimpleSValBuilder::simplifySVal(ProgramStateRef 
State, SVal V) {
   Loc::isLocType(S->getRHS()->getType()))
 return skip(S);
 
-  SVal LHS = Visit(S->getLHS());
-  SVal RHS = Visit(S->getRHS());
+  SVal LHS = getConstOrVisit(S->getLHS());
+  SVal RHS = getConstOrVisit(S->getRHS());
+
   if (isUnchanged(S->getLHS(), LHS) && isUnchanged(S->getRHS(), RHS))
 return skip(S);
 

diff  --git a/clang/test/Analysis/svalbuilder-simplify-compound-svals.cpp 
b/clang/test/Analysis/svalbuilder-simplify-compound-svals.cpp
new file mode 100644
index ..0417507476ee
--- /dev/null
+++ b/clang/test/Analysis/svalbuilder-simplify-compound-svals.cpp
@@ -0,0 +1,76 @@
+// RUN: %clang_analyze_cc1 %s \
+// RUN:   -analyzer-checker=core \
+// RUN:   -analyzer-checker=debug.ExprInspection \
+// RUN:   -analyzer-config eagerly-assume=false \
+// RUN:   -verify
+
+// Here we test whether the SValBuilder is capable to simplify existing
+// compound SVals (where there are at leaset 3 symbols in the tree) based on
+// newly added constraints.
+
+void clang_analyzer_eval(bool);
+void clang_analyzer_warnIfReached();
+
+void test_left_tree_constrained(int x, int y, int z) {
+  if (x + y + z != 0)
+return;
+  if (x + y != 0)
+return;
+  clang_analyzer_eval(x + y + z == 0); // expected-warning{{TRUE}}
+  clang_analyzer_eval(x + y == 0); // expected-warning{{TRUE}}
+  clang_analyzer_eval(z == 0); // expected-warning{{TRUE}}
+  x = y = z = 1;
+  return;
+}
+
+void 

[PATCH] D103317: [Analyzer][Core] Make SValBuilder to better simplify svals with 3 symbols in the tree

2021-11-30 Thread Gabor Marton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0a17896fe6fd: [Analyzer][Core] Make SValBuilder to better 
simplify svals with 3 symbols in… (authored by martong).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103317

Files:
  clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
  clang/test/Analysis/svalbuilder-simplify-compound-svals.cpp
  clang/test/Analysis/taint-tester.c

Index: clang/test/Analysis/taint-tester.c
===
--- clang/test/Analysis/taint-tester.c
+++ clang/test/Analysis/taint-tester.c
@@ -59,7 +59,7 @@
   int tty = xy.y; // expected-warning + {{tainted}}
 }
 
-void BitwiseOp(int in, char inn) {
+void BitwiseOp(int in, char inn, int zz) {
   // Taint on bitwise operations, integer to integer cast.
   int m;
   int x = 0;
@@ -67,11 +67,12 @@
   int y = (in << (x << in)) * 5;// expected-warning + {{tainted}}
   // The next line tests integer to integer cast.
   int z = y & inn; // expected-warning + {{tainted}}
-  if (y == 5) // expected-warning + {{tainted}}
+  if (y == zz) { // expected-warning + {{tainted}}
 m = z | z;// expected-warning + {{tainted}}
+  }
   else
 m = inn;
-  int mm = m; // expected-warning + {{tainted}}
+  int mm = m; // expected-warning 1 {{tainted}}
 }
 
 // Test getenv.
Index: clang/test/Analysis/svalbuilder-simplify-compound-svals.cpp
===
--- /dev/null
+++ clang/test/Analysis/svalbuilder-simplify-compound-svals.cpp
@@ -0,0 +1,76 @@
+// RUN: %clang_analyze_cc1 %s \
+// RUN:   -analyzer-checker=core \
+// RUN:   -analyzer-checker=debug.ExprInspection \
+// RUN:   -analyzer-config eagerly-assume=false \
+// RUN:   -verify
+
+// Here we test whether the SValBuilder is capable to simplify existing
+// compound SVals (where there are at leaset 3 symbols in the tree) based on
+// newly added constraints.
+
+void clang_analyzer_eval(bool);
+void clang_analyzer_warnIfReached();
+
+void test_left_tree_constrained(int x, int y, int z) {
+  if (x + y + z != 0)
+return;
+  if (x + y != 0)
+return;
+  clang_analyzer_eval(x + y + z == 0); // expected-warning{{TRUE}}
+  clang_analyzer_eval(x + y == 0); // expected-warning{{TRUE}}
+  clang_analyzer_eval(z == 0); // expected-warning{{TRUE}}
+  x = y = z = 1;
+  return;
+}
+
+void test_right_tree_constrained(int x, int y, int z) {
+  if (x + y * z != 0)
+return;
+  if (y * z != 0)
+return;
+  clang_analyzer_eval(x + y * z == 0); // expected-warning{{TRUE}}
+  clang_analyzer_eval(y * z == 0); // expected-warning{{TRUE}}
+  clang_analyzer_eval(x == 0); // expected-warning{{TRUE}}
+  return;
+}
+
+void test_left_tree_constrained_minus(int x, int y, int z) {
+  if (x - y - z != 0)
+return;
+  if (x - y != 0)
+return;
+  clang_analyzer_eval(x - y - z == 0); // expected-warning{{TRUE}}
+  clang_analyzer_eval(x - y == 0); // expected-warning{{TRUE}}
+  clang_analyzer_eval(z == 0); // expected-warning{{TRUE}}
+  x = y = z = 1;
+  return;
+}
+
+void test_SymInt_constrained(int x, int y, int z) {
+  if (x * y * z != 4)
+return;
+  if (z != 2)
+return;
+  if (x * y == 3) {
+clang_analyzer_warnIfReached(); // no-warning
+return;
+  }
+  (void)(x * y * z);
+}
+
+void test_SValBuilder_simplifies_IntSym(int x, int y, int z) {
+  // Most IntSym BinOps are transformed to SymInt in SimpleSValBuilder.
+  // Division is one exception.
+  x = 77 / (y + z);
+  if (y + z != 1)
+return;
+  clang_analyzer_eval(x == 77); // expected-warning{{TRUE}}
+  (void)(x * y * z);
+}
+
+void recurring_symbol(int b) {
+  if (b * b != b)
+if ((b * b) * b * b != (b * b) * b)
+  if (b * b == 1)   // no-crash (assert should not fire)
+clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
+}
Index: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
===
--- clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
+++ clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
@@ -1102,7 +1102,6 @@
   if (SymbolRef Sym = V.getAsSymbol())
 return state->getConstraintManager().getSymVal(state, Sym);
 
-  // FIXME: Add support for SymExprs.
   return nullptr;
 }
 
@@ -1134,6 +1133,24 @@
   return cache(Sym, SVB.makeSymbolVal(Sym));
 }
 
+// Return the known const value for the Sym if available, or return Undef
+// otherwise.
+SVal getConst(SymbolRef Sym) {
+  const llvm::APSInt *Const =
+  State->getConstraintManager().getSymVal(State, Sym);
+  if (Const)
+return Loc::isLocType(Sym->getType()) ? (SVal)SVB.makeIntLocVal(*Const)
+  : (SVal)SVB.makeIntVal(*Const);
+  return UndefinedVal();
+}
+
+SVal getConstOrVisit(SymbolRef Sym) {
+  c

[PATCH] D114072: [clangd] Record IWYU pragma keep in the IncludeStructure

2021-11-30 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev updated this revision to Diff 390639.
kbobyrev marked an inline comment as done.
kbobyrev added a comment.

Fix failures, address review comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114072

Files:
  clang-tools-extra/clangd/CodeComplete.cpp
  clang-tools-extra/clangd/Headers.cpp
  clang-tools-extra/clangd/Headers.h
  clang-tools-extra/clangd/ParsedAST.cpp
  clang-tools-extra/clangd/Preamble.cpp
  clang-tools-extra/clangd/unittests/HeadersTests.cpp

Index: clang-tools-extra/clangd/unittests/HeadersTests.cpp
===
--- clang-tools-extra/clangd/unittests/HeadersTests.cpp
+++ clang-tools-extra/clangd/unittests/HeadersTests.cpp
@@ -80,7 +80,9 @@
 EXPECT_TRUE(
 Action.BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0]));
 IncludeStructure Includes;
-Clang->getPreprocessor().addPPCallbacks(Includes.collect(*Clang));
+auto Collector = Includes.collect(*Clang);
+Clang->getPreprocessor().addCommentHandler(Collector.get());
+Clang->getPreprocessor().addPPCallbacks(move(Collector));
 EXPECT_FALSE(Action.Execute());
 Action.EndSourceFile();
 return Includes;
@@ -142,6 +144,7 @@
 MATCHER_P(Resolved, Name, "") { return arg.Resolved == Name; }
 MATCHER_P(IncludeLine, N, "") { return arg.HashLine == N; }
 MATCHER_P(Directive, D, "") { return arg.Directive == D; }
+MATCHER_P(HasPragmaKeep, H, "") { return arg.BehindPragmaKeep == H; }
 
 MATCHER_P2(Distance, File, D, "") {
   if (arg.getFirst() != File)
@@ -257,6 +260,18 @@
Directive(tok::pp_include_next)));
 }
 
+TEST_F(HeadersTest, IWYUPragmaKeep) {
+  FS.Files[MainFile] = R"cpp(
+#include "bar.h" // IWYU pragma: keep
+#include "foo.h"
+)cpp";
+
+  EXPECT_THAT(
+  collectIncludes().MainFileIncludes,
+  UnorderedElementsAre(AllOf(Written("\"foo.h\""), HasPragmaKeep(false)),
+   AllOf(Written("\"bar.h\""), HasPragmaKeep(true;
+}
+
 TEST_F(HeadersTest, InsertInclude) {
   std::string Path = testPath("sub/bar.h");
   FS.Files[Path] = "";
Index: clang-tools-extra/clangd/Preamble.cpp
===
--- clang-tools-extra/clangd/Preamble.cpp
+++ clang-tools-extra/clangd/Preamble.cpp
@@ -288,7 +288,9 @@
 return error("failed BeginSourceFile");
   Preprocessor &PP = Clang->getPreprocessor();
   IncludeStructure Includes;
-  PP.addPPCallbacks(Includes.collect(*Clang));
+  auto Collector = Includes.collect(*Clang);
+  PP.addCommentHandler(Collector.get());
+  PP.addPPCallbacks(move(Collector));
   ScannedPreamble SP;
   SP.Bounds = Bounds;
   PP.addPPCallbacks(
Index: clang-tools-extra/clangd/ParsedAST.cpp
===
--- clang-tools-extra/clangd/ParsedAST.cpp
+++ clang-tools-extra/clangd/ParsedAST.cpp
@@ -446,7 +446,9 @@
   // Important: collectIncludeStructure is registered *after* ReplayPreamble!
   // Otherwise we would collect the replayed includes again...
   // (We can't *just* use the replayed includes, they don't have Resolved path).
-  Clang->getPreprocessor().addPPCallbacks(Includes.collect(*Clang));
+  auto Collector = Includes.collect(*Clang);
+  Clang->getPreprocessor().addCommentHandler(Collector.get());
+  Clang->getPreprocessor().addPPCallbacks(move(Collector));
   // Copy over the macros in the preamble region of the main file, and combine
   // with non-preamble macros below.
   MainFileMacros Macros;
Index: clang-tools-extra/clangd/Headers.h
===
--- clang-tools-extra/clangd/Headers.h
+++ clang-tools-extra/clangd/Headers.h
@@ -20,6 +20,7 @@
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Lex/HeaderSearch.h"
 #include "clang/Lex/PPCallbacks.h"
+#include "clang/Lex/Preprocessor.h"
 #include "clang/Tooling/Inclusions/HeaderIncludes.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseSet.h"
@@ -64,6 +65,7 @@
   int HashLine = 0;// Line number containing the directive, 0-indexed.
   SrcMgr::CharacteristicKind FileKind = SrcMgr::C_User;
   llvm::Optional HeaderID;
+  bool BehindPragmaKeep = false; // Has IWYU pragma: keep right after.
 };
 llvm::raw_ostream &operator<<(llvm::raw_ostream &, const Inclusion &);
 bool operator==(const Inclusion &LHS, const Inclusion &RHS);
@@ -123,9 +125,21 @@
 RealPathNames.emplace_back();
   }
 
+  class IncludeCollector : public PPCallbacks, public CommentHandler {};
   // Returns a PPCallback that visits all inclusions in the main file and
-  // populates the structure.
-  std::unique_ptr collect(const CompilerInstance &CI);
+  // populates the structure. IncludeCollector can also scan the comments for
+  // IWYU pragmas but it needs to be explicitly added to as a preprocessor
+  // comment handler. PP wants to own the PPCallbacks, so the typ

[PATCH] D114072: [clangd] Record IWYU pragma keep in the IncludeStructure

2021-11-30 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev added inline comments.



Comment at: clang-tools-extra/clangd/Headers.h:130
+  // IWYU pragmas but it needs to be explicitly added to as a preprocessor
+  // comment handler. PP wants to own the PPCallbacks, so the typical way to
+  // do both is:

sammccall wrote:
> Alternatively we could just give up on having a pure-ish API and say `void 
> collect(Preprocessor&)`.
> Again there's not really any other sensible way to use it.
`PrecompiledPreamble.cpp` requires PPCallbacks being returned directly, so I 
think we can't easily have `void IncludeStructure::collect(PP &).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114072

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


[PATCH] D114724: [clangd][StdSymbolMap] Prefer std::remove from algorithm

2021-11-30 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added inline comments.



Comment at: clang-tools-extra/clangd/StdSymbolMap.inc:958
 SYMBOL(remainder, std::, )
-SYMBOL(remove, std::, )
 SYMBOL(remove_all_extents, std::, )

sammccall wrote:
> Is the stdio version so uncommon we are willing to be wrong about it? For 
> `move` we omit it from here and consider it case-by-case, I'd have imagined 
> doing the same here 
> 
> (BTW at some point we may want to extend this to list alternative headers for 
> ambiguous symbols)
>Is the stdio version so uncommon we are willing to be wrong about it?

Waiting for permissions on a big codebase with lots of third_party code to 
perform some analysis.

>  For move we omit it from here and consider it case-by-case, I'd have 
> imagined doing the same here

`std::move` is different, both occurrences are marked as variants. We don't 
really drop it during post-processing saying there are multiple options, it 
just never makes it to the final list.

```
move<>() (algorithm) (since C++11)
move<>() (utility) (since C++11)
```

I am not sure how we ended up with this ignore the `variant`ed symbols behavior.

> (BTW at some point we may want to extend this to list alternative headers for 
> ambiguous symbols)

I agree, there is some room for improvement, like also listing different 
overloads with expected number of parameters and language versions.
It's unclear whether we need such detail today though.



Comment at: clang-tools-extra/clangd/include-mapping/cppreference_parser.py:138
   # FIXME: use these as a fallback rather than ignoring entirely.
-  if variant:
+  if variant != (namespace+symbol_name in variants_to_accept):
 continue

sammccall wrote:
> This logic seems a bit weird and non-general: it allows us to accept any 
> variant and reject any non-variant, but it doesn't allow us to accept 
> a*specific* variant (they are named) and doesn't allow us to accept both 
> (which currently would lead to the symbol being dropped as ambiguous).
I was trying to keep the change to a minimum. Happy to go with a solution that 
accepts a dictionary in the form of `(FQN, list_of_accepted_variants)`, where 
the list can have `""` variant, or instead of a list we can also have a glob, 
but I don't think it'll provide much value considering the irregularity of std 
header names.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114724

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


[PATCH] D113995: [clangd] Dex Trigrams: Improve query trigram generation

2021-11-30 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev updated this revision to Diff 390641.
kbobyrev marked 5 inline comments as done.
kbobyrev added a comment.

Address review comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113995

Files:
  clang-tools-extra/clangd/index/dex/Trigram.cpp
  clang-tools-extra/clangd/unittests/DexTests.cpp

Index: clang-tools-extra/clangd/unittests/DexTests.cpp
===
--- clang-tools-extra/clangd/unittests/DexTests.cpp
+++ clang-tools-extra/clangd/unittests/DexTests.cpp
@@ -386,30 +386,35 @@
   trigramsAre({"c", "cl", "cla", "lan", "ang", "ngd"}));
 
   EXPECT_THAT(identifierTrigramTokens("abc_def"),
-  trigramsAre({"a", "ab", "ad", "abc", "abd", "ade", "bcd", "bde",
-   "cde", "def"}));
+  trigramsAre({"a", "d", "ab", "ad", "de", "abc", "abd", "ade",
+   "bcd", "bde", "cde", "def"}));
 
   EXPECT_THAT(identifierTrigramTokens("a_b_c_d_e_"),
-  trigramsAre({"a", "a_", "ab", "abc", "bcd", "cde"}));
+  trigramsAre({"a", "b", "ab", "bc", "abc", "bcd", "cde"}));
 
   EXPECT_THAT(identifierTrigramTokens("unique_ptr"),
-  trigramsAre({"u", "un", "up", "uni", "unp", "upt", "niq", "nip",
-   "npt", "iqu", "iqp", "ipt", "que", "qup", "qpt",
-   "uep", "ept", "ptr"}));
+  trigramsAre({"u",   "p",   "un",  "up",  "pt",  "uni", "unp",
+   "upt", "niq", "nip", "npt", "iqu", "iqp", "ipt",
+   "que", "qup", "qpt", "uep", "ept", "ptr"}));
 
-  EXPECT_THAT(
-  identifierTrigramTokens("TUDecl"),
-  trigramsAre({"t", "tu", "td", "tud", "tde", "ude", "dec", "ecl"}));
+  EXPECT_THAT(identifierTrigramTokens("TUDecl"),
+  trigramsAre({"t", "d", "tu", "td", "de", "tud", "tde", "ude",
+   "dec", "ecl"}));
 
   EXPECT_THAT(identifierTrigramTokens("IsOK"),
-  trigramsAre({"i", "is", "io", "iso", "iok", "sok"}));
+  trigramsAre({"i", "o", "is", "ok", "io", "iso", "iok", "sok"}));
 
-  EXPECT_THAT(
-  identifierTrigramTokens("abc_defGhij__klm"),
-  trigramsAre({"a",   "ab",  "ad",  "abc", "abd", "ade", "adg", "bcd",
-   "bde", "bdg", "cde", "cdg", "def", "deg", "dgh", "dgk",
-   "efg", "egh", "egk", "fgh", "fgk", "ghi", "ghk", "gkl",
-   "hij", "hik", "hkl", "ijk", "ikl", "jkl", "klm"}));
+  EXPECT_THAT(identifierTrigramTokens("_pb"),
+  trigramsAre({"_", "_p", "p", "pb"}));
+  EXPECT_THAT(identifierTrigramTokens("__pb"),
+  trigramsAre({"_", "_p", "p", "pb"}));
+
+  EXPECT_THAT(identifierTrigramTokens("abc_defGhij__klm"),
+  trigramsAre({"a",   "d",   "ab",  "ad",  "dg",  "de",  "abc",
+   "abd", "ade", "adg", "bcd", "bde", "bdg", "cde",
+   "cdg", "def", "deg", "dgh", "dgk", "efg", "egh",
+   "egk", "fgh", "fgk", "ghi", "ghk", "gkl", "hij",
+   "hik", "hkl", "ijk", "ikl", "jkl", "klm"}));
 }
 
 TEST(DexTrigrams, QueryTrigrams) {
@@ -419,8 +424,16 @@
 
   EXPECT_THAT(generateQueryTrigrams(""), trigramsAre({}));
   EXPECT_THAT(generateQueryTrigrams("_"), trigramsAre({"_"}));
-  EXPECT_THAT(generateQueryTrigrams("__"), trigramsAre({"__"}));
-  EXPECT_THAT(generateQueryTrigrams("___"), trigramsAre({}));
+  EXPECT_THAT(generateQueryTrigrams("__"), trigramsAre({"_"}));
+  EXPECT_THAT(generateQueryTrigrams("___"), trigramsAre({"_"}));
+
+  EXPECT_THAT(generateQueryTrigrams("m_"), trigramsAre({"m"}));
+
+  EXPECT_THAT(generateQueryTrigrams("p_b"), trigramsAre({"pb"}));
+  EXPECT_THAT(generateQueryTrigrams("pb_"), trigramsAre({"pb"}));
+  EXPECT_THAT(generateQueryTrigrams("_p"), trigramsAre({"_p"}));
+  EXPECT_THAT(generateQueryTrigrams("_pb_"), trigramsAre({"pb"}));
+  EXPECT_THAT(generateQueryTrigrams("__pb"), trigramsAre({"pb"}));
 
   EXPECT_THAT(generateQueryTrigrams("X86"), trigramsAre({"x86"}));
 
@@ -525,25 +538,45 @@
 }
 
 TEST(DexTest, ShortQuery) {
-  auto I = Dex::build(generateSymbols({"OneTwoThreeFour"}), RefSlab(),
+  auto I = Dex::build(generateSymbols({"_OneTwoFourSix"}), RefSlab(),
   RelationSlab());
   FuzzyFindRequest Req;
   Req.AnyScope = true;
   bool Incomplete;
 
-  EXPECT_THAT(match(*I, Req, &Incomplete), ElementsAre("OneTwoThreeFour"));
+  EXPECT_THAT(match(*I, Req, &Incomplete), ElementsAre("_OneTwoFourSix"));
   EXPECT_FALSE(Incomplete) << "Empty string is not a short query";
 
-  Req.Query = "t";
-  EXPECT_THAT(match(*I, Req, &Incomplete), ElementsAre());
-  EXPECT_TRUE(Incomplete) << "Short queries have different semantics";
+  Req.Query = "o";
+  EXPECT_THAT(match(*I, Req, &Incomplete), ElementsAre("_OneTwoFourSix"));
+  EXPECT_TRUE(Incomplete) << "Using first head as unigram

[PATCH] D113995: [clangd] Dex Trigrams: Improve query trigram generation

2021-11-30 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev updated this revision to Diff 390643.
kbobyrev added a comment.

Remove refactoring leftovers.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113995

Files:
  clang-tools-extra/clangd/index/dex/Trigram.cpp
  clang-tools-extra/clangd/unittests/DexTests.cpp

Index: clang-tools-extra/clangd/unittests/DexTests.cpp
===
--- clang-tools-extra/clangd/unittests/DexTests.cpp
+++ clang-tools-extra/clangd/unittests/DexTests.cpp
@@ -386,30 +386,35 @@
   trigramsAre({"c", "cl", "cla", "lan", "ang", "ngd"}));
 
   EXPECT_THAT(identifierTrigramTokens("abc_def"),
-  trigramsAre({"a", "ab", "ad", "abc", "abd", "ade", "bcd", "bde",
-   "cde", "def"}));
+  trigramsAre({"a", "d", "ab", "ad", "de", "abc", "abd", "ade",
+   "bcd", "bde", "cde", "def"}));
 
   EXPECT_THAT(identifierTrigramTokens("a_b_c_d_e_"),
-  trigramsAre({"a", "a_", "ab", "abc", "bcd", "cde"}));
+  trigramsAre({"a", "b", "ab", "bc", "abc", "bcd", "cde"}));
 
   EXPECT_THAT(identifierTrigramTokens("unique_ptr"),
-  trigramsAre({"u", "un", "up", "uni", "unp", "upt", "niq", "nip",
-   "npt", "iqu", "iqp", "ipt", "que", "qup", "qpt",
-   "uep", "ept", "ptr"}));
+  trigramsAre({"u",   "p",   "un",  "up",  "pt",  "uni", "unp",
+   "upt", "niq", "nip", "npt", "iqu", "iqp", "ipt",
+   "que", "qup", "qpt", "uep", "ept", "ptr"}));
 
-  EXPECT_THAT(
-  identifierTrigramTokens("TUDecl"),
-  trigramsAre({"t", "tu", "td", "tud", "tde", "ude", "dec", "ecl"}));
+  EXPECT_THAT(identifierTrigramTokens("TUDecl"),
+  trigramsAre({"t", "d", "tu", "td", "de", "tud", "tde", "ude",
+   "dec", "ecl"}));
 
   EXPECT_THAT(identifierTrigramTokens("IsOK"),
-  trigramsAre({"i", "is", "io", "iso", "iok", "sok"}));
+  trigramsAre({"i", "o", "is", "ok", "io", "iso", "iok", "sok"}));
 
-  EXPECT_THAT(
-  identifierTrigramTokens("abc_defGhij__klm"),
-  trigramsAre({"a",   "ab",  "ad",  "abc", "abd", "ade", "adg", "bcd",
-   "bde", "bdg", "cde", "cdg", "def", "deg", "dgh", "dgk",
-   "efg", "egh", "egk", "fgh", "fgk", "ghi", "ghk", "gkl",
-   "hij", "hik", "hkl", "ijk", "ikl", "jkl", "klm"}));
+  EXPECT_THAT(identifierTrigramTokens("_pb"),
+  trigramsAre({"_", "_p", "p", "pb"}));
+  EXPECT_THAT(identifierTrigramTokens("__pb"),
+  trigramsAre({"_", "_p", "p", "pb"}));
+
+  EXPECT_THAT(identifierTrigramTokens("abc_defGhij__klm"),
+  trigramsAre({"a",   "d",   "ab",  "ad",  "dg",  "de",  "abc",
+   "abd", "ade", "adg", "bcd", "bde", "bdg", "cde",
+   "cdg", "def", "deg", "dgh", "dgk", "efg", "egh",
+   "egk", "fgh", "fgk", "ghi", "ghk", "gkl", "hij",
+   "hik", "hkl", "ijk", "ikl", "jkl", "klm"}));
 }
 
 TEST(DexTrigrams, QueryTrigrams) {
@@ -419,8 +424,16 @@
 
   EXPECT_THAT(generateQueryTrigrams(""), trigramsAre({}));
   EXPECT_THAT(generateQueryTrigrams("_"), trigramsAre({"_"}));
-  EXPECT_THAT(generateQueryTrigrams("__"), trigramsAre({"__"}));
-  EXPECT_THAT(generateQueryTrigrams("___"), trigramsAre({}));
+  EXPECT_THAT(generateQueryTrigrams("__"), trigramsAre({"_"}));
+  EXPECT_THAT(generateQueryTrigrams("___"), trigramsAre({"_"}));
+
+  EXPECT_THAT(generateQueryTrigrams("m_"), trigramsAre({"m"}));
+
+  EXPECT_THAT(generateQueryTrigrams("p_b"), trigramsAre({"pb"}));
+  EXPECT_THAT(generateQueryTrigrams("pb_"), trigramsAre({"pb"}));
+  EXPECT_THAT(generateQueryTrigrams("_p"), trigramsAre({"_p"}));
+  EXPECT_THAT(generateQueryTrigrams("_pb_"), trigramsAre({"pb"}));
+  EXPECT_THAT(generateQueryTrigrams("__pb"), trigramsAre({"pb"}));
 
   EXPECT_THAT(generateQueryTrigrams("X86"), trigramsAre({"x86"}));
 
@@ -525,25 +538,45 @@
 }
 
 TEST(DexTest, ShortQuery) {
-  auto I = Dex::build(generateSymbols({"OneTwoThreeFour"}), RefSlab(),
+  auto I = Dex::build(generateSymbols({"_OneTwoFourSix"}), RefSlab(),
   RelationSlab());
   FuzzyFindRequest Req;
   Req.AnyScope = true;
   bool Incomplete;
 
-  EXPECT_THAT(match(*I, Req, &Incomplete), ElementsAre("OneTwoThreeFour"));
+  EXPECT_THAT(match(*I, Req, &Incomplete), ElementsAre("_OneTwoFourSix"));
   EXPECT_FALSE(Incomplete) << "Empty string is not a short query";
 
-  Req.Query = "t";
-  EXPECT_THAT(match(*I, Req, &Incomplete), ElementsAre());
-  EXPECT_TRUE(Incomplete) << "Short queries have different semantics";
+  Req.Query = "o";
+  EXPECT_THAT(match(*I, Req, &Incomplete), ElementsAre("_OneTwoFourSix"));
+  EXPECT_TRUE(Incomplete) << "Using first head as unigram";
+
+  Req.Query = "_o";
+  EXPECT_TH

[PATCH] D114713: [AArch64][SVE][NEON] Add NEON-SVE-Bridge intrinsics

2021-11-30 Thread Peter Waller via Phabricator via cfe-commits
peterwaller-arm added inline comments.



Comment at: 
clang/test/CodeGen/aarch64_neon_sve_bridge_intrinsics/acle_neon_sve_bridge_dup_neonq.c:8
+
+#define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4
+

Do you also want to test the overloaded forms here via SVE_OVERLOADED_FORMS?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114713

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


[PATCH] D114787: [clang][PR51931] Enable `-Wdeclaration-after-statement` for all C versions

2021-11-30 Thread Markus Böck via Phabricator via cfe-commits
zero9178 created this revision.
zero9178 added reviewers: dblaikie, aaron.ballman, rsmith.
zero9178 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

`-Wdeclaration-after-statement` currently only outputs an diagnostic if the 
user is compiling in C versions older than C99, even if the warning was 
explicitly requested by the user. 
This patch makes the warning also available in later C versions. If the C 
version is C99 or later it is simply a normal warning that is disabled by 
default (as it is valid C99) and has to be enabled by users. In older versions 
it remains an extension warning, and therefore affected by -pedantic.

The above behaviour also matches GCCs behaviour.

Fixes https://bugs.llvm.org/show_bug.cgi?id=51931


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114787

Files:
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaStmt.cpp
  clang/test/Sema/warn-mixed-decls.c


Index: clang/test/Sema/warn-mixed-decls.c
===
--- /dev/null
+++ clang/test/Sema/warn-mixed-decls.c
@@ -0,0 +1,11 @@
+/* RUN: %clang_cc1 -fsyntax-only -verify -std=c89 -pedantic %s
+ */
+/* RUN: %clang_cc1 -fsyntax-only -verify -std=c99 
-Wdeclaration-after-statement %s
+ */
+
+int foo(int i)
+{
+  i += 1;
+  int f = i; /* expected-warning {{ISO C90 forbids mixing declarations and 
code}}*/
+  return f;
+}
Index: clang/lib/Sema/SemaStmt.cpp
===
--- clang/lib/Sema/SemaStmt.cpp
+++ clang/lib/Sema/SemaStmt.cpp
@@ -410,9 +410,10 @@
ArrayRef Elts, bool isStmtExpr) {
   const unsigned NumElts = Elts.size();
 
-  // If we're in C89 mode, check that we don't have any decls after stmts.  If
-  // so, emit an extension diagnostic.
-  if (!getLangOpts().C99 && !getLangOpts().CPlusPlus) {
+  // If we're in C mode, check that we don't have any decls after stmts.  If
+  // so, emit an extension diagnostic in C89 and potentially a warning in later
+  // versions.
+  if (!getLangOpts().CPlusPlus) {
 // Note that __extension__ can be around a decl.
 unsigned i = 0;
 // Skip over all declarations.
@@ -425,7 +426,8 @@
 
 if (i != NumElts) {
   Decl *D = *cast(Elts[i])->decl_begin();
-  Diag(D->getLocation(), diag::ext_mixed_decls_code);
+  Diag(D->getLocation(), !getLangOpts().C99 ? diag::ext_mixed_decls_code
+: diag::warn_mixed_decls_code);
 }
   }
 
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -9837,7 +9837,10 @@
 
 def ext_mixed_decls_code : Extension<
   "ISO C90 forbids mixing declarations and code">,
-  InGroup>;
+  InGroup;
+def warn_mixed_decls_code : Warning<
+  ext_mixed_decls_code.Text>,
+  InGroup, DefaultIgnore;
 
 def err_non_local_variable_decl_in_for : Error<
   "declaration of non-local variable in 'for' loop">;
Index: clang/include/clang/Basic/DiagnosticGroups.td
===
--- clang/include/clang/Basic/DiagnosticGroups.td
+++ clang/include/clang/Basic/DiagnosticGroups.td
@@ -239,6 +239,7 @@
 
 def EmptyBody : DiagGroup<"empty-body">;
 def Exceptions : DiagGroup<"exceptions">;
+def DeclarationAfterStatement : DiagGroup<"declaration-after-statement">;
 
 def GNUEmptyInitializer : DiagGroup<"gnu-empty-initializer">;
 def GNUEmptyStruct : DiagGroup<"gnu-empty-struct">;


Index: clang/test/Sema/warn-mixed-decls.c
===
--- /dev/null
+++ clang/test/Sema/warn-mixed-decls.c
@@ -0,0 +1,11 @@
+/* RUN: %clang_cc1 -fsyntax-only -verify -std=c89 -pedantic %s
+ */
+/* RUN: %clang_cc1 -fsyntax-only -verify -std=c99 -Wdeclaration-after-statement %s
+ */
+
+int foo(int i)
+{
+  i += 1;
+  int f = i; /* expected-warning {{ISO C90 forbids mixing declarations and code}}*/
+  return f;
+}
Index: clang/lib/Sema/SemaStmt.cpp
===
--- clang/lib/Sema/SemaStmt.cpp
+++ clang/lib/Sema/SemaStmt.cpp
@@ -410,9 +410,10 @@
ArrayRef Elts, bool isStmtExpr) {
   const unsigned NumElts = Elts.size();
 
-  // If we're in C89 mode, check that we don't have any decls after stmts.  If
-  // so, emit an extension diagnostic.
-  if (!getLangOpts().C99 && !getLangOpts().CPlusPlus) {
+  // If we're in C mode, check that we don't have any decls after stmts.  If
+  // so, emit an extension diagnostic in C89 and potentially a warning in later
+  // versions.
+  if (!getLangOpts().CPlusPlus) {
 // Note that __extension__ can be around a decl.
 unsigned i = 0;
 // Skip over all declar

[PATCH] D114540: Big-endian version of vpermxor

2021-11-30 Thread Nemanja Ivanovic via Phabricator via cfe-commits
nemanjai accepted this revision.
nemanjai added a comment.
This revision is now accepted and ready to land.

LGTM.




Comment at: llvm/lib/Target/PowerPC/PPCInstrVSX.td:2506
+  def : Pat<(v16i8 (int_ppc_altivec_crypto_vpermxor_be v16i8:$a,
+v16i8:$b, v16i8:$c)),
+(v16i8 (VPERMXOR $a, $b, $c))>;

Nit: the `v16i8` should be aligned with the `v16i8` above.



Comment at: llvm/test/CodeGen/PowerPC/crypto_bifs_be.ll:8
+; RUN:   -mcpu=pwr8 < %s | FileCheck %s --check-prefixes=CHECK-BE-P8
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \
+; RUN:   -mcpu=pwr9 < %s | FileCheck %s --check-prefixes=CHECK-P9

There isn't really any difference in how we handle this on P9 so this run line 
is probably superfluous. Feel free to get rid of it when pushing this upstream.


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

https://reviews.llvm.org/D114540

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


[PATCH] D102669: [analyzer][ctu] Fix wrong 'multiple definitions' errors caused by space characters in lookup names when parsing the ctu index file

2021-11-30 Thread Ella Ma via Phabricator via cfe-commits
OikawaKirie updated this revision to Diff 390653.
OikawaKirie marked an inline comment as done.
OikawaKirie edited the summary of this revision.
OikawaKirie added a comment.
Herald added a subscriber: manas.

It has been a long period since the last discussion, I hope you can still 
remember this bug. And apologize for the delay.

Updated as required, the lookup name generator 
`CrossTranslationUnitContext::getLookupName` and parser `parseCrossTUIndex` are 
modified.
And assertions are added before accessing the CTU index mapping for input 
lookup names to be searched.

Corresponding test cases and documents are also updated.

Please let me know if there are other files to be updated.


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

https://reviews.llvm.org/D102669

Files:
  clang/docs/analyzer/user-docs/CrossTranslationUnit.rst
  clang/include/clang/Basic/DiagnosticCrossTUKinds.td
  clang/lib/CrossTU/CrossTranslationUnit.cpp
  clang/test/Analysis/Inputs/ctu-import.c.externalDefMap.ast-dump.txt
  clang/test/Analysis/Inputs/ctu-lookup-name-with-space.cpp
  clang/test/Analysis/Inputs/ctu-other.c.externalDefMap.ast-dump.txt
  clang/test/Analysis/Inputs/ctu-other.cpp.externalDefMap.ast-dump.txt
  
clang/test/Analysis/Inputs/plist-macros-with-expansion-ctu.c.externalDefMap.txt
  clang/test/Analysis/ctu-inherited-default-ctor.cpp
  clang/test/Analysis/ctu-lookup-name-with-space.cpp
  clang/test/Analysis/func-mapping-test.cpp
  clang/unittests/CrossTU/CrossTranslationUnitTest.cpp

Index: clang/unittests/CrossTU/CrossTranslationUnitTest.cpp
===
--- clang/unittests/CrossTU/CrossTranslationUnitTest.cpp
+++ clang/unittests/CrossTU/CrossTranslationUnitTest.cpp
@@ -61,7 +61,7 @@
 ASSERT_FALSE(llvm::sys::fs::createTemporaryFile("index", "txt", IndexFD,
 IndexFileName));
 llvm::ToolOutputFile IndexFile(IndexFileName, IndexFD);
-IndexFile.os() << "c:@F@f#I# " << ASTFileName << "\n";
+IndexFile.os() << "9:c:@F@f#I# " << ASTFileName << "\n";
 IndexFile.os().flush();
 EXPECT_TRUE(llvm::sys::fs::exists(IndexFileName));
 
@@ -154,9 +154,9 @@
 
 TEST(CrossTranslationUnit, IndexFormatCanBeParsed) {
   llvm::StringMap Index;
-  Index["a"] = "/b/f1";
-  Index["c"] = "/d/f2";
-  Index["e"] = "/f/f3";
+  Index["1:a"] = "/b/f1";
+  Index["1:c"] = "/d/f2";
+  Index["1:e"] = "/f/f3";
   std::string IndexText = createCrossTUIndexString(Index);
 
   int IndexFD;
Index: clang/test/Analysis/func-mapping-test.cpp
===
--- clang/test/Analysis/func-mapping-test.cpp
+++ clang/test/Analysis/func-mapping-test.cpp
@@ -3,10 +3,10 @@
 int f(int) {
   return 0;
 }
-// CHECK-DAG: c:@F@f#I#
+// CHECK-DAG: 9:c:@F@f#I#
 
 extern const int x = 5;
-// CHECK-DAG: c:@x
+// CHECK-DAG: 4:c:@x
 
 // Non-const variables should not be collected.
 int y = 5;
@@ -18,29 +18,29 @@
   int a;
 };
 extern S const s = {.a = 2};
-// CHECK-DAG: c:@s
+// CHECK-DAG: 4:c:@s
 
 struct SF {
   const int a;
 };
 SF sf = {.a = 2};
-// CHECK-DAG: c:@sf
+// CHECK-DAG: 5:c:@sf
 
 struct SStatic {
   static const int a = 4;
 };
 const int SStatic::a;
-// CHECK-DAG: c:@S@SStatic@a
+// CHECK-DAG: 14:c:@S@SStatic@a
 
 extern int const arr[5] = { 0, 1 };
-// CHECK-DAG: c:@arr
+// CHECK-DAG: 6:c:@arr
 
 union U {
   const int a;
   const unsigned int b;
 };
 U u = {.a = 6};
-// CHECK-DAG: c:@u
+// CHECK-DAG: 4:c:@u
 
 // No USR can be generated for this.
 // Check for no crash in this case.
Index: clang/test/Analysis/ctu-lookup-name-with-space.cpp
===
--- /dev/null
+++ clang/test/Analysis/ctu-lookup-name-with-space.cpp
@@ -0,0 +1,22 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+
+// RUN: cp %s %t/trigger.cpp
+// RUN: cp %S/Inputs/ctu-lookup-name-with-space.cpp %t/importee.cpp
+// RUN: echo '"%t/importee.cpp" : ["g++", "-c", "%t/importee.cpp"]' > %t/invocations.yaml
+// RUN: echo '[{"directory": "%t", "command": "g++ -c %t/importee.cpp", "file": "%t/importee.cpp"}, {"directory": "%t", "command": "g++ -c %t/trigger.cpp", "file": "%t/trigger.cpp"}]' > %t/compile_commands.json
+
+// RUN: %clang_extdef_map -p %t %t/importee.cpp > %t/externalDefMap.txt
+
+// RUN: cd %t && %clang_cc1 -fsyntax-only -analyze \
+// RUN:   -analyzer-checker=core \
+// RUN:   -analyzer-config experimental-enable-naive-ctu-analysis=true \
+// RUN:   -analyzer-config ctu-dir=. \
+// RUN:   -analyzer-config ctu-invocation-list=invocations.yaml \
+// RUN:   -verify trigger.cpp 2>&1 | FileCheck --allow-empty importee.cpp
+
+int importee(int);
+
+void trigger() {
+  importee(0); // expected-warn...@importee.cpp:13 {{Division by zero}}
+}
Index: clang/test/Analysis/ctu-inherited-default-ctor.cpp
===
--- clang/test/Analysis/ctu-inherited-default-ctor.cpp
+++ clang/test/Analysis/ctu-in

[PATCH] D114713: [AArch64][SVE][NEON] Add NEON-SVE-Bridge intrinsics

2021-11-30 Thread Peter Waller via Phabricator via cfe-commits
peterwaller-arm added inline comments.



Comment at: clang/include/clang/Basic/BuiltinsAArch64NeonSVEBridge.def:2
+#ifdef GET_SVE_BUILTINS
+BUILTIN(__builtin_sve_svget_neonq_s8, "q4iq16bq4i", "n")
+BUILTIN(__builtin_sve_svget_neonq_s16, "q4iq16bq4i", "n")

Looks like these aren't correct, the number should indicate the number of 
lanes, and it should be 16 for an s8. `q` indicates scalable, which is also not 
right for this builtin.

The code which parses these strings can be found here:

https://github.com/llvm/llvm-project/blob/14c4051122bf4070d624b82189f1093758ecdf69/clang/lib/AST/ASTContext.cpp#L10417


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114713

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


[PATCH] D102149: [analyzer][ctu] Allow loading invocation list from a compilation database automatically detected from the ctu-dir

2021-11-30 Thread Ella Ma via Phabricator via cfe-commits
OikawaKirie abandoned this revision.
OikawaKirie added a comment.
Herald added a subscriber: manas.

It seems that this issue has better solutions outside the CTU module, I will 
drop this revision as mentioned above.
Sorry for the delay.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102149

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


[PATCH] D114497: [PowerPC] Drop stdlib paths in freestanding tests

2021-11-30 Thread Nemanja Ivanovic via Phabricator via cfe-commits
nemanjai accepted this revision.
nemanjai added a comment.
This revision is now accepted and ready to land.

Seems fine to me but maybe give @MaskRay a couple of days to see if this 
adequately addresses his comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114497

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


[PATCH] D114699: Fixed a memory leak in the PDLToPDLInterp RootOrderingTest.

2021-11-30 Thread Stanislav Funiak via Phabricator via cfe-commits
sfuniak updated this revision to Diff 390477.
sfuniak added a comment.
Herald added subscribers: cfe-commits, llvm-commits, libcxx-commits, 
lldb-commits, Sanitizers, luke957, asavonic, carlosgalvezp, armkevincheng, 
foad, jsmolens, eric-k256, frasercrmck, dang, martong, kerbowa, csigg, 
luismarques, apazos, sameer.abuasal, pengfei, s.egerton, dmgreen, Jim, jocewei, 
PkmX, arphaman, the_o, brucehoult, MartinMosbeck, rogfer01, atanasyan, 
edward-jones, zzheng, MaskRay, jrtc27, niosHD, sabuasal, simoncook, johnrusso, 
rbar, asb, javed.absar, fedor.sergeev, kbarton, arichardson, mgorny, nhaehnle, 
jvesely, nemanjai, sdardis, emaste, jyknight, arsenm, qcolombet, MatzeB, 
jholewinski.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: sstefan1.
Herald added a reviewer: nicolasvasilache.
Herald added a reviewer: aartbik.
Herald added a reviewer: MaskRay.
Herald added a reviewer: sscalpone.
Herald added a reviewer: baziotis.
Herald added a reviewer: sjarus.
Herald added projects: clang, Sanitizers, LLDB, libc++, LLVM, 
clang-tools-extra, Flang.
Herald added a reviewer: libc++.

Review feedback.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114699

Files:
  clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
  clang-tools-extra/clang-tidy/altera/StructPackAlignCheck.cpp
  clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp
  clang-tools-extra/clang-tidy/cppcoreguidelines/VirtualClassDestructorCheck.cpp
  
clang-tools-extra/test/clang-tidy/checkers/altera-struct-pack-align-invalid-decl-no-crash.cpp
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-bitfields.cpp
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-virtual-class-destructor.cpp
  clang-tools-extra/test/clang-tidy/infrastructure/export-diagnostics.cpp
  clang-tools-extra/unittests/clang-tidy/ClangTidyDiagnosticConsumerTest.cpp
  clang/docs/JSONCompilationDatabase.rst
  clang/docs/analyzer/checkers.rst
  clang/docs/analyzer/user-docs.rst
  clang/docs/analyzer/user-docs/TaintAnalysisConfiguration.rst
  clang/lib/Driver/ToolChains/Arch/AArch64.cpp
  clang/lib/Driver/ToolChains/Linux.cpp
  clang/lib/Sema/AnalysisBasedWarnings.cpp
  clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
  clang/test/Driver/aarch64-target-as-march.s
  clang/test/Driver/linux-ld.c
  clang/test/SemaObjC/return-noreturn.m
  compiler-rt/lib/sanitizer_common/sanitizer_stack_store.cpp
  compiler-rt/lib/sanitizer_common/sanitizer_stack_store.h
  compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp
  flang/include/flang/Optimizer/Builder/Runtime/Assign.h
  flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h
  flang/include/flang/Optimizer/Builder/Runtime/Transformational.h
  flang/include/flang/Optimizer/Transforms/Passes.h
  flang/include/flang/Optimizer/Transforms/Passes.td
  flang/lib/Evaluate/check-expression.cpp
  flang/lib/Optimizer/Builder/CMakeLists.txt
  flang/lib/Optimizer/Builder/Runtime/Assign.cpp
  flang/lib/Optimizer/Builder/Runtime/Transformational.cpp
  flang/lib/Optimizer/Transforms/CMakeLists.txt
  flang/lib/Optimizer/Transforms/MemRefDataFlowOpt.cpp
  flang/test/Evaluate/folding09.f90
  flang/test/Fir/memref-data-flow.fir
  flang/unittests/Optimizer/Builder/Runtime/AssignTest.cpp
  flang/unittests/Optimizer/Builder/Runtime/RuntimeCallTestBase.h
  flang/unittests/Optimizer/Builder/Runtime/TransformationalTest.cpp
  flang/unittests/Optimizer/CMakeLists.txt
  libcxx/CREDITS.TXT
  libcxx/benchmarks/format.bench.cpp
  libcxx/benchmarks/format_to.bench.cpp
  libcxx/benchmarks/format_to_n.bench.cpp
  libcxx/benchmarks/formatted_size.bench.cpp
  libcxx/include/type_traits
  lld/ELF/Arch/ARM.cpp
  lld/ELF/Driver.cpp
  lld/ELF/InputSection.cpp
  lld/ELF/InputSection.h
  lld/ELF/LinkerScript.cpp
  lld/ELF/LinkerScript.h
  lld/ELF/MapFile.cpp
  lld/ELF/Options.td
  lld/ELF/OutputSections.cpp
  lld/ELF/OutputSections.h
  lld/ELF/Writer.cpp
  lld/test/ELF/arm-adr-err-long.s
  lld/test/ELF/arm-adr-err.s
  lld/test/ELF/arm-adr-long.s
  lld/test/ELF/arm-adr.s
  lld/test/ELF/fill-trap-ppc.s
  lld/test/ELF/fill-trap.s
  lld/test/ELF/oformat-binary.s
  lldb/test/Shell/Process/Windows/lit.local.cfg
  llvm/include/llvm/Analysis/ScalarEvolution.h
  llvm/include/llvm/CodeGen/TargetLowering.h
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
  llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
  llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp
  llvm/lib/CodeGen/BranchFolding.cpp
  llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp
  llvm/lib/CodeGen/GlobalMerge.cpp
  llvm/lib/CodeGen/InlineSpiller.cpp
  llvm/lib/CodeGen/LatencyPriorityQueue.cpp
  llvm/lib/CodeGen/MachinePipeliner.cpp
  llvm/lib/CodeGen/MachineVerifier.cpp
  llvm/lib/CodeGen/ModuloSchedule.cpp
  llvm/lib/CodeGen/RegAllocFast.cpp
  llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
  llvm/lib/CodeGen/SelectionD

[PATCH] D114699: Fixed a memory leak in the PDLToPDLInterp RootOrderingTest.

2021-11-30 Thread Stanislav Funiak via Phabricator via cfe-commits
sfuniak abandoned this revision.
sfuniak added a comment.
Herald added a subscriber: JDevlieghere.

Messed up a rebase, will submit a new diff.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114699

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


[PATCH] D114699: Fixed a memory leak in the PDLToPDLInterp RootOrderingTest.

2021-11-30 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini added inline comments.



Comment at: mlir/unittests/Conversion/PDLToPDLInterp/RootOrderingTest.cpp:37
+  ~RootOrderingTest() {
+for (int i = 0; i < 4; ++i)
+  v[i].getDefiningOp()->destroy();

bondhugula wrote:
> bondhugula wrote:
> > You need to be erasing those ops using `erase()`. 
> Nit: `unsigned` here and below.
@bondhugula unsigned is an anti-pattern (unless working with bit-fields or 
other bit-manipulation), this has been widely documented I believe, both in C++ 
standardization paper (they are stuck with size_t in the standard library) and 
with conference talks like this one: https://www.youtube.com/watch?v=yG1OZ69H_-o


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114699

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


[PATCH] D114413: [OpenMPIRBuilder] Implement static-chunked workshare-loop schedules.

2021-11-30 Thread Peixin Qiao via Phabricator via cfe-commits
peixin added a comment.

In D114413#3159095 , @Meinersbur 
wrote:

> In D114413#3154936 , @peixin wrote:
>
>> @Meinersbur Please rebase on main. The function "getPreheader()" was moved 
>> into OMPIRBuilder.h.
>
> I rebased, but I am not sure what you are referring to. `getPreheader()` 
> always was in `OMPIRBuilder.h`

`getPreheader()` was in `OMPIRBuilder.cpp` before you rebase in your last 
update here. That's why I let you rebase since I failed to git apply your last 
patch in main branch. It's not important now. Please forget about that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114413

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


[PATCH] D114631: [DebugInfo][InstrRef] Turn instruction referencing on by default for x86

2021-11-30 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro accepted this revision.
djtodoro added a comment.
This revision is now accepted and ready to land.

lgtm, thanks!


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

https://reviews.llvm.org/D114631

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


[PATCH] D114631: [DebugInfo][InstrRef] Turn instruction referencing on by default for x86

2021-11-30 Thread Jeremy Morse via Phabricator via cfe-commits
jmorse added inline comments.



Comment at: llvm/lib/Target/X86/X86TargetMachine.cpp:29
 #include "llvm/Analysis/TargetTransformInfo.h"
+#include "llvm/CodeGen/CommandFlags.h"
 #include "llvm/CodeGen/ExecutionDomainFix.h"

Orlando wrote:
> nit: Is this change necessary?
Nope, will strip that out.


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

https://reviews.llvm.org/D114631

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


[clang] 651122f - [DebugInfo][InstrRef] Pre-land on-by-default-for-x86 changes

2021-11-30 Thread Jeremy Morse via cfe-commits

Author: Jeremy Morse
Date: 2021-11-30T12:40:59Z
New Revision: 651122fc4ac92b93f36aab3b194de21065a0c48e

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

LOG: [DebugInfo][InstrRef] Pre-land on-by-default-for-x86 changes

Over in D114631 and [0] there's a plan for turning instruction referencing
on by default for x86. This patch adds / removes all the relevant bits of
code, with the aim that the final patch is extremely small, for an easy
revert. It should just be a condition in CommandFlags.cpp and removing the
XFail on instr-ref-flag.ll.

[0] https://lists.llvm.org/pipermail/llvm-dev/2021-November/153653.html

Added: 
llvm/test/DebugInfo/X86/instr-ref-flag.ll

Modified: 
clang/include/clang/Driver/Options.td
llvm/include/llvm/CodeGen/CommandFlags.h
llvm/lib/CodeGen/CommandFlags.cpp

Removed: 
clang/test/Driver/debug-var-experimental-switch.c



diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index cf314bc73bf31..724eedd05da44 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5180,10 +5180,6 @@ defm debug_pass_manager : BoolOption<"f", 
"debug-pass-manager",
   CodeGenOpts<"DebugPassManager">, DefaultFalse,
   PosFlag,
   NegFlag>;
-def fexperimental_debug_variable_locations : Flag<["-"],
-"fexperimental-debug-variable-locations">,
-HelpText<"Use experimental new value-tracking variable locations">,
-MarshallingInfoFlag>;
 def fverify_debuginfo_preserve
 : Flag<["-"], "fverify-debuginfo-preserve">,
   HelpText<"Enable Debug Info Metadata preservation testing in "

diff  --git a/clang/test/Driver/debug-var-experimental-switch.c 
b/clang/test/Driver/debug-var-experimental-switch.c
deleted file mode 100644
index 9c7a782e9e2bb..0
--- a/clang/test/Driver/debug-var-experimental-switch.c
+++ /dev/null
@@ -1,2 +0,0 @@
-// RUN: %clang -Xclang -fexperimental-debug-variable-locations -fsyntax-only 
-disable-llvm-passes %s
-int main() {}

diff  --git a/llvm/include/llvm/CodeGen/CommandFlags.h 
b/llvm/include/llvm/CodeGen/CommandFlags.h
index ed3cd54df2727..73d39fecc268d 100644
--- a/llvm/include/llvm/CodeGen/CommandFlags.h
+++ b/llvm/include/llvm/CodeGen/CommandFlags.h
@@ -130,6 +130,7 @@ bool getEnableMachineFunctionSplitter();
 bool getEnableDebugEntryValues();
 
 bool getValueTrackingVariableLocations();
+Optional getExplicitValueTrackingVariableLocations();
 
 bool getForceDwarfFrameSection();
 
@@ -170,6 +171,10 @@ void setFunctionAttributes(StringRef CPU, StringRef 
Features, Function &F);
 /// Set function attributes of functions in Module M based on CPU,
 /// Features, and command line flags.
 void setFunctionAttributes(StringRef CPU, StringRef Features, Module &M);
+
+/// Should value-tracking variable locations / instruction referencing be
+/// enabled by default for this triple?
+bool getDefaultValueTrackingVariableLocations(const llvm::Triple &T);
 } // namespace codegen
 } // namespace llvm
 

diff  --git a/llvm/lib/CodeGen/CommandFlags.cpp 
b/llvm/lib/CodeGen/CommandFlags.cpp
index a1ff02178ffae..ecf3d931fc33b 100644
--- a/llvm/lib/CodeGen/CommandFlags.cpp
+++ b/llvm/lib/CodeGen/CommandFlags.cpp
@@ -90,7 +90,7 @@ CGOPT(bool, EnableAddrsig)
 CGOPT(bool, EmitCallSiteInfo)
 CGOPT(bool, EnableMachineFunctionSplitter)
 CGOPT(bool, EnableDebugEntryValues)
-CGOPT(bool, ValueTrackingVariableLocations)
+CGOPT_EXP(bool, ValueTrackingVariableLocations)
 CGOPT(bool, ForceDwarfFrameSection)
 CGOPT(bool, XRayOmitFunctionIndex)
 CGOPT(bool, DebugStrictDwarf)
@@ -534,12 +534,17 @@ codegen::InitTargetOptionsFromCodeGenFlags(const Triple 
&TheTriple) {
   Options.EmitAddrsig = getEnableAddrsig();
   Options.EmitCallSiteInfo = getEmitCallSiteInfo();
   Options.EnableDebugEntryValues = getEnableDebugEntryValues();
-  Options.ValueTrackingVariableLocations = getValueTrackingVariableLocations();
   Options.ForceDwarfFrameSection = getForceDwarfFrameSection();
   Options.XRayOmitFunctionIndex = getXRayOmitFunctionIndex();
   Options.DebugStrictDwarf = getDebugStrictDwarf();
   Options.LoopAlignment = getAlignLoops();
 
+  if (auto Opt = getExplicitValueTrackingVariableLocations())
+Options.ValueTrackingVariableLocations = *Opt;
+  else
+Options.ValueTrackingVariableLocations =
+getDefaultValueTrackingVariableLocations(TheTriple);
+
   Options.MCOptions = mc::InitMCTargetOptionsFromFlags();
 
   Options.ThreadModel = getThreadModel();
@@ -692,3 +697,7 @@ void codegen::setFunctionAttributes(StringRef CPU, 
StringRef Features,
   for (Function &F : M)
 setFunctionAttributes(CPU, Features, F);
 }
+
+bool codegen::getDefaultValueTrackingVariableLocations(const llvm::Triple &T) {
+  return false;
+}

diff  --git a/llvm/test/DebugInfo/X86/instr-ref-flag.l

[PATCH] D114769: [C++20] [Modules] [Concepts] Recognize same concepts more precisely in Serialization

2021-11-30 Thread Chuanqi Xu via Phabricator via cfe-commits
ChuanqiXu updated this revision to Diff 390668.
ChuanqiXu added a comment.

Fix tests under Debug mode. I need to remember run debug tests : (


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114769

Files:
  clang/lib/Serialization/ASTReaderDecl.cpp
  clang/test/Modules/Inputs/concept/A.cppm
  clang/test/Modules/Inputs/concept/foo.h
  clang/test/Modules/concept.cppm


Index: clang/test/Modules/concept.cppm
===
--- /dev/null
+++ clang/test/Modules/concept.cppm
@@ -0,0 +1,10 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: %clang -std=c++20 %S/Inputs/concept/A.cppm --precompile -o %t/A.pcm
+// RUN: %clang -std=c++20 -fprebuilt-module-path=%t -I%S/Inputs/concept %s -c 
-Xclang -verify
+// expected-no-diagnostics
+
+module;
+#include "foo.h"
+export module B;
+import A;
Index: clang/test/Modules/Inputs/concept/foo.h
===
--- /dev/null
+++ clang/test/Modules/Inputs/concept/foo.h
@@ -0,0 +1,13 @@
+#ifndef FOO_H
+#define FOO_H
+
+template< class T >
+concept Range = requires(T& t) { t.begin(); };
+
+struct A {
+public:
+template 
+using range_type = T;
+};
+
+#endif
Index: clang/test/Modules/Inputs/concept/A.cppm
===
--- /dev/null
+++ clang/test/Modules/Inputs/concept/A.cppm
@@ -0,0 +1,3 @@
+module;
+#include "foo.h"
+export module A;
Index: clang/lib/Serialization/ASTReaderDecl.cpp
===
--- clang/lib/Serialization/ASTReaderDecl.cpp
+++ clang/lib/Serialization/ASTReaderDecl.cpp
@@ -2948,6 +2948,7 @@
 static bool isSameTemplateParameterList(const ASTContext &C,
 const TemplateParameterList *X,
 const TemplateParameterList *Y);
+static bool isSameEntity(NamedDecl *X, NamedDecl *Y);
 
 /// Determine whether two template parameters are similar enough
 /// that they may be used in declarations of the same template.
@@ -2967,7 +2968,7 @@
 if (!TXTC != !TYTC)
   return false;
 if (TXTC && TYTC) {
-  if (TXTC->getNamedConcept() != TYTC->getNamedConcept())
+  if (!isSameEntity(TXTC->getNamedConcept(), TYTC->getNamedConcept()))
 return false;
   if (TXTC->hasExplicitTemplateArgs() != TYTC->hasExplicitTemplateArgs())
 return false;
@@ -3111,11 +3112,12 @@
 
 /// Determine whether the two declarations refer to the same entity.
 static bool isSameEntity(NamedDecl *X, NamedDecl *Y) {
-  assert(X->getDeclName() == Y->getDeclName() && "Declaration name mismatch!");
-
   if (X == Y)
 return true;
 
+  if (X->getDeclName() != Y->getDeclName())
+return false;
+
   // Must be in the same context.
   //
   // Note that we can't use DeclContext::Equals here, because the DeclContexts


Index: clang/test/Modules/concept.cppm
===
--- /dev/null
+++ clang/test/Modules/concept.cppm
@@ -0,0 +1,10 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: %clang -std=c++20 %S/Inputs/concept/A.cppm --precompile -o %t/A.pcm
+// RUN: %clang -std=c++20 -fprebuilt-module-path=%t -I%S/Inputs/concept %s -c -Xclang -verify
+// expected-no-diagnostics
+
+module;
+#include "foo.h"
+export module B;
+import A;
Index: clang/test/Modules/Inputs/concept/foo.h
===
--- /dev/null
+++ clang/test/Modules/Inputs/concept/foo.h
@@ -0,0 +1,13 @@
+#ifndef FOO_H
+#define FOO_H
+
+template< class T >
+concept Range = requires(T& t) { t.begin(); };
+
+struct A {
+public:
+template 
+using range_type = T;
+};
+
+#endif
Index: clang/test/Modules/Inputs/concept/A.cppm
===
--- /dev/null
+++ clang/test/Modules/Inputs/concept/A.cppm
@@ -0,0 +1,3 @@
+module;
+#include "foo.h"
+export module A;
Index: clang/lib/Serialization/ASTReaderDecl.cpp
===
--- clang/lib/Serialization/ASTReaderDecl.cpp
+++ clang/lib/Serialization/ASTReaderDecl.cpp
@@ -2948,6 +2948,7 @@
 static bool isSameTemplateParameterList(const ASTContext &C,
 const TemplateParameterList *X,
 const TemplateParameterList *Y);
+static bool isSameEntity(NamedDecl *X, NamedDecl *Y);
 
 /// Determine whether two template parameters are similar enough
 /// that they may be used in declarations of the same template.
@@ -2967,7 +2968,7 @@
 if (!TXTC != !TYTC)
   return false;
 if (TXTC && TYTC) {
-  if (TXTC->getNamedConcept() != TYTC->getNamedConcept())
+  if (!isSameEntity(TXTC->getNamedConcept(), TYTC->getNamedConcept()))
 return false;
   if (TXTC->hasExplicitTemplateArgs

[PATCH] D114790: [syntax][pseudo] Add grammar facilities for the pseudo-parser

2021-11-30 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision.
hokein added a reviewer: sammccall.
Herald added subscribers: mgrang, mgorny.
hokein requested review of this revision.
Herald added a project: clang.

This patch introduces basic structures for the grammar, which is used to
build a grammar-based parser.

As the first patch, the scope is limited:

- base types of modeling the grammar rules, symbols
- grammar parsing bit (annotations are excluded, and will be added afterwards)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114790

Files:
  clang/include/clang/Tooling/Syntax/Pseudo/Grammar.h
  clang/lib/Tooling/Syntax/CMakeLists.txt
  clang/lib/Tooling/Syntax/Pseudo/CMakeLists.txt
  clang/lib/Tooling/Syntax/Pseudo/Grammar.cpp
  clang/unittests/Tooling/Syntax/CMakeLists.txt
  clang/unittests/Tooling/Syntax/Pseudo/CMakeLists.txt
  clang/unittests/Tooling/Syntax/Pseudo/GrammarTest.cpp

Index: clang/unittests/Tooling/Syntax/Pseudo/GrammarTest.cpp
===
--- /dev/null
+++ clang/unittests/Tooling/Syntax/Pseudo/GrammarTest.cpp
@@ -0,0 +1,114 @@
+//===--- GrammarTest.cpp - grammar tests  *- C++-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "clang/Tooling/Syntax/Pseudo/Grammar.h"
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+namespace clang {
+namespace syntax {
+namespace pseudo {
+namespace {
+
+using testing::AllOf;
+using testing::ElementsAre;
+using testing::Field;
+using testing::HasSubstr;
+using testing::Not;
+using testing::UnorderedElementsAre;
+
+MATCHER_P(SName, Name, "") { return arg.Symbol == Name; }
+MATCHER_P(Target, Name, "") { return arg.Target == Name; }
+template 
+testing::Matcher withSequence(T... Name) {
+  return Field(&Grammar::RuleSpec::Sequence, ElementsAre(SName(Name)...));
+}
+
+MATCHER_P(Name, N, "") { return arg.Name == N; }
+MATCHER(Null, "") { return arg.Nullable; }
+
+MATCHER_P(TargetID, SID, "") { return arg.target() == SID; }
+template 
+testing::Matcher withSequenceID(T... IDs) {
+  return testing::Property(&Rule::seq, ElementsAre(IDs...));
+}
+SymbolID symbolID(llvm::StringRef Name, const Grammar &G) {
+  return G.lookupSymbol(Name);
+}
+
+TEST(GrammarTest, Basic) {
+  auto RS = cantFail(Grammar::RuleSpec::parseRaw(
+  "expression := IDENTIFIER + expression # comment"));
+  EXPECT_THAT(RS, AllOf(Target("expression"),
+withSequence("IDENTIFIER", "+", "expression")));
+
+  auto Error = Grammar::RuleSpec::parseRaw("abc");
+  EXPECT_FALSE(Error);
+  EXPECT_THAT(llvm::toString(Error.takeError()), testing::HasSubstr("Failed"));
+}
+
+TEST(GrammarTest, EliminatedOptional) {
+  auto RS = cantFail(Grammar::RuleSpec::parseRaw("list := IDENTIFIER ,_opt"));
+  EXPECT_THAT(RS, AllOf(Target("list"), withSequence("IDENTIFIER", ",_opt")));
+
+  const auto &InlinedRules = Grammar::RuleSpec::eliminateOptional({RS});
+  EXPECT_THAT(InlinedRules,
+  UnorderedElementsAre(
+  AllOf(Target("list"), withSequence("IDENTIFIER", ",")),
+  AllOf(Target("list"), withSequence("IDENTIFIER";
+
+  const auto &G = Grammar::build(InlinedRules);
+  EXPECT_THAT(
+  G.lookupRules(G.lookupSymbol("list")),
+  UnorderedElementsAre(
+  AllOf(TargetID(symbolID("list", G)),
+withSequenceID(symbolID("IDENTIFIER", G), symbolID(",", G))),
+  AllOf(TargetID(symbolID("list", G)),
+withSequenceID(symbolID("IDENTIFIER", G);
+}
+
+TEST(GrammarTest, Nullable) {
+  llvm::StringRef Text = R"(
+ # This is a comment.
+ null1 := +_opt
+ null2 := null1
+ null3 := null1 +_opt
+ null4 := +
+ null4 :=
+
+ non-null := +
+  )";
+  const auto RSpecs = cantFail(Grammar::RuleSpec::parseAll(Text));
+
+  const auto &G = Grammar::build(RSpecs);
+  EXPECT_THAT(G.table().Nonterminals,
+  UnorderedElementsAre(
+  AllOf(Name("null1"), Null()), AllOf(Name("null2"), Null()),
+  AllOf(Name("null3"), Null()), AllOf(Name("null4"), Null()),
+  AllOf(Name("non-null"), Not(Null();
+}
+
+TEST(GrammarTest, Diagnose) {
+  llvm::StringRef Text = R"(
+ _ := undefined
+ unused := IDENTIFIER
+
+ _ := IDENFIFIE # a typo of the terminal IDENFITIER 
+  )";
+  const auto RSpecs = cantFail(Grammar::RuleSpec::parseAll(Text));
+  EXPECT_THAT(
+  Grammar::build(RSpecs).diagnose(),
+  UnorderedElementsAre(HasSubstr("No rules for nonterminal: undefined"),
+   HasSubstr("never used"), HasSubstr("Token-like"),
+   HasSubstr("No rules for nonterminal: IDENFIFIE")));
+}
+
+} // namespace
+} // namespace pseudo
+} // namespace syntax
+} 

[PATCH] D113422: [clang-tidy][NFC] Move CachedGlobList to GlobList.h

2021-11-30 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp added a comment.

Kind ping to reviewers.


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

https://reviews.llvm.org/D113422

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


[PATCH] D114631: [DebugInfo][InstrRef] Turn instruction referencing on by default for x86

2021-11-30 Thread Jeremy Morse via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3c045070882f: [DebugInfo] Turn instruction referencing on by 
default for x86 (authored by jmorse).

Changed prior to commit:
  https://reviews.llvm.org/D114631?vs=390003&id=390673#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114631

Files:
  llvm/lib/CodeGen/CommandFlags.cpp
  llvm/test/DebugInfo/X86/instr-ref-flag.ll


Index: llvm/test/DebugInfo/X86/instr-ref-flag.ll
===
--- llvm/test/DebugInfo/X86/instr-ref-flag.ll
+++ llvm/test/DebugInfo/X86/instr-ref-flag.ll
@@ -13,10 +13,6 @@
 ;; by llc by default, and that it can be turned explicitly on or off as
 ;; desired.
 
-;; XFail it for pre-landing the patch, and to allow a minimal delta if it
-;; has to be reverted.
-; XFAIL: *
-
 ; INSTRREFON: DBG_INSTR_REF
 ; INSTRREFOFF: DBG_VALUE
 
Index: llvm/lib/CodeGen/CommandFlags.cpp
===
--- llvm/lib/CodeGen/CommandFlags.cpp
+++ llvm/lib/CodeGen/CommandFlags.cpp
@@ -699,5 +699,7 @@
 }
 
 bool codegen::getDefaultValueTrackingVariableLocations(const llvm::Triple &T) {
+  if (T.getArch() == llvm::Triple::x86_64)
+return true;
   return false;
 }


Index: llvm/test/DebugInfo/X86/instr-ref-flag.ll
===
--- llvm/test/DebugInfo/X86/instr-ref-flag.ll
+++ llvm/test/DebugInfo/X86/instr-ref-flag.ll
@@ -13,10 +13,6 @@
 ;; by llc by default, and that it can be turned explicitly on or off as
 ;; desired.
 
-;; XFail it for pre-landing the patch, and to allow a minimal delta if it
-;; has to be reverted.
-; XFAIL: *
-
 ; INSTRREFON: DBG_INSTR_REF
 ; INSTRREFOFF: DBG_VALUE
 
Index: llvm/lib/CodeGen/CommandFlags.cpp
===
--- llvm/lib/CodeGen/CommandFlags.cpp
+++ llvm/lib/CodeGen/CommandFlags.cpp
@@ -699,5 +699,7 @@
 }
 
 bool codegen::getDefaultValueTrackingVariableLocations(const llvm::Triple &T) {
+  if (T.getArch() == llvm::Triple::x86_64)
+return true;
   return false;
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D114631: [DebugInfo][InstrRef] Turn instruction referencing on by default for x86

2021-11-30 Thread Jeremy Morse via Phabricator via cfe-commits
jmorse added a comment.

Cheers all, especially for the latest reviews; we'll now see whether there are 
extra edge cases I haven't caught!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114631

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


[PATCH] D102669: [analyzer][ctu] Fix wrong 'multiple definitions' errors caused by space characters in lookup names when parsing the ctu index file

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

Looks good.
Please get rid of the macro stuff, consider something along the lines I 
proposed for the parsing stuff.
Also clang-format the code you touch.
I haven't checked the docs and the comments of the codebase, but I'll assume 
you grepped and fixed all occurrences.
I look forward to this, thank you for working on this @OikawaKirie.




Comment at: clang/docs/analyzer/user-docs/CrossTranslationUnit.rst:84
 The next step is to create a CTU index file which holds the `USR` name and 
location of external definitions in the
-source files:
+source files in format `USR-Length:USR File-Path`:
 





Comment at: clang/lib/CrossTU/CrossTranslationUnit.cpp:154-172
+  // Find the length delimiter.
+  const size_t LengthDelimiter = LineRef.find(':');
+  if (StringRef::npos == LengthDelimiter)
+return false;
+
+  // Parse the length of LookupName as USRLength.
+  size_t USRLength = 0;





Comment at: clang/lib/CrossTU/CrossTranslationUnit.cpp:175-180
+#define IS_CTU_INDEX_KEY_VALID(FUNCTION_NAME)  
\
+  ([](StringRef N) {   
\
+std::string FN = N.str() + ' ';
\
+StringRef LN, FP;  
\
+return parseCrossTUIndexItem(FN, LN, FP) && N == LN && FP.empty(); 
\
+  }(FUNCTION_NAME))

Please do something about this macro.
Encapsulate the logic in some other way.



Comment at: clang/lib/CrossTU/CrossTranslationUnit.cpp:464
 
 // Check if there is and entry in the index for the function.
+assert(IS_CTU_INDEX_KEY_VALID(FunctionName) &&





Comment at: clang/test/Analysis/func-mapping-test.cpp:50
   const int ui;
 };

I think you could add your lambda stuff to this file.
This is really the place for testing this.
The test you created actually demonstrating the CTU issue is also valuable IMO, 
so you can leave it, but have a copy here.


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

https://reviews.llvm.org/D102669

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


[PATCH] D91000: [clang-tidy] Add cert-msc24-c checker.

2021-11-30 Thread Whisperity via Phabricator via cfe-commits
whisperity added a comment.

Should/does this work in C++ mode for `std::whatever`?




Comment at: clang-tools-extra/clang-tidy/cert/ObsolescentFunctionsCheck.cpp:48
+  // Matching functions with safe replacements in annex K.
+  auto FunctionNamesWithAnnexKReplacementMatcher = hasAnyName(
+  "::asctime", "::ctime", "::fopen", "::freopen", "::bsearch", "::fprintf",

Is this ordering specific in any way? Is the rule listing them in this order? 
If not, can we have them listed alphabetically, for easier search and potential 
later change?



Comment at: clang-tools-extra/docs/clang-tidy/checks/cert-msc24-c.rst:10
+For the listed functions, an alternative, more secure replacement is 
suggested, if available.
+The checker heavily relies on the functions from annex K (Bounds-checking 
interfaces) of C11.
+

(And consistent capitalisation later.)



Comment at: clang-tools-extra/docs/clang-tidy/checks/cert-msc24-c.rst:29
+Both macros have to be defined to suggest replacement functions from annex K. 
`__STDC_LIB_EXT1__` is
+defined by the library implementation, and `__STDC_WANT_LIB_EXT1__` must be 
define to "1" by the user 
+before including any system headers.




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

https://reviews.llvm.org/D91000

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


[PATCH] D114639: Raise the minimum Visual Studio version to VS2019

2021-11-30 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

IMO, if we're updating the MSVC versions, we should do the same for the 
GCC/Clang/AppleClang versions too.  For example, GCC 5.1 is from 2015, and 
Clang 3.5 is from 2014.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114639

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


[PATCH] D114639: Raise the minimum Visual Studio version to VS2019

2021-11-30 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D114639#3161303 , @erichkeane 
wrote:

> IMO, if we're updating the MSVC versions, we should do the same for the 
> GCC/Clang/AppleClang versions too.  For example, GCC 5.1 is from 2015, and 
> Clang 3.5 is from 2014.

I'd be in favor of that; we could even see if we're ready to allow C++17 in the 
code base (which would be a pretty nice win for if init statements alone). 
However, it's also a bit orthogonal to this particular patch. Do you (or 
someone else) want to start an RFC?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114639

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


[PATCH] D114540: Big-endian version of vpermxor

2021-11-30 Thread Tarique Islam via Phabricator via cfe-commits
tislam updated this revision to Diff 390683.
tislam marked 2 inline comments as done.
tislam added a comment.

- The P9  RUN step on big-endian platform is 
removed from the lit test.
- Fixed formatting in `llvm/lib/Target/PowerPC/PPCInstrVSX.td`


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

https://reviews.llvm.org/D114540

Files:
  clang/include/clang/Basic/BuiltinsPPC.def
  clang/test/CodeGen/builtins-ppc-crypto.c
  llvm/include/llvm/IR/IntrinsicsPowerPC.td
  llvm/lib/Target/PowerPC/PPCInstrVSX.td
  llvm/test/CodeGen/PowerPC/crypto_bifs_be.ll

Index: llvm/test/CodeGen/PowerPC/crypto_bifs_be.ll
===
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/crypto_bifs_be.ll
@@ -0,0 +1,165 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
+; RUN:   -mcpu=pwr8 < %s | FileCheck %s --check-prefixes=CHECK-LE-P8
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
+; RUN:   -mcpu=pwr9 < %s | FileCheck %s --check-prefixes=CHECK-P9
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \
+; RUN:   -mcpu=pwr8 < %s | FileCheck %s --check-prefixes=CHECK-BE-P8
+
+define <16 x i8> @test_vpermxorb() local_unnamed_addr {
+; CHECK-LE-P8-LABEL: test_vpermxorb:
+; CHECK-LE-P8:   # %bb.0: # %entry
+; CHECK-LE-P8-NEXT:addis 3, 2, .LCPI0_0@toc@ha
+; CHECK-LE-P8-NEXT:addis 4, 2, .LCPI0_1@toc@ha
+; CHECK-LE-P8-NEXT:addi 3, 3, .LCPI0_0@toc@l
+; CHECK-LE-P8-NEXT:lvx 2, 0, 3
+; CHECK-LE-P8-NEXT:addi 3, 4, .LCPI0_1@toc@l
+; CHECK-LE-P8-NEXT:lvx 3, 0, 3
+; CHECK-LE-P8-NEXT:vpermxor 2, 3, 2, 2
+; CHECK-LE-P8-NEXT:blr
+;
+; CHECK-P9-LABEL: test_vpermxorb:
+; CHECK-P9:   # %bb.0: # %entry
+; CHECK-P9-NEXT:addis 3, 2, .LCPI0_0@toc@ha
+; CHECK-P9-NEXT:addi 3, 3, .LCPI0_0@toc@l
+; CHECK-P9-NEXT:lxv 34, 0(3)
+; CHECK-P9-NEXT:addis 3, 2, .LCPI0_1@toc@ha
+; CHECK-P9-NEXT:addi 3, 3, .LCPI0_1@toc@l
+; CHECK-P9-NEXT:lxv 35, 0(3)
+; CHECK-P9-NEXT:vpermxor 2, 3, 2, 2
+; CHECK-P9-NEXT:blr
+;
+; CHECK-BE-P8-LABEL: test_vpermxorb:
+; CHECK-BE-P8:   # %bb.0: # %entry
+; CHECK-BE-P8-NEXT:addis 3, 2, .LCPI0_0@toc@ha
+; CHECK-BE-P8-NEXT:addis 4, 2, .LCPI0_1@toc@ha
+; CHECK-BE-P8-NEXT:addi 3, 3, .LCPI0_0@toc@l
+; CHECK-BE-P8-NEXT:addi 4, 4, .LCPI0_1@toc@l
+; CHECK-BE-P8-NEXT:lxvw4x 34, 0, 3
+; CHECK-BE-P8-NEXT:lxvw4x 35, 0, 4
+; CHECK-BE-P8-NEXT:vpermxor 2, 3, 2, 2
+; CHECK-BE-P8-NEXT:blr
+entry:
+  %0 = tail call <16 x i8> @llvm.ppc.altivec.crypto.vpermxor.be(<16 x i8> , <16 x i8> , <16 x i8> )
+  ret <16 x i8> %0
+}
+
+declare <16 x i8> @llvm.ppc.altivec.crypto.vpermxor.be(<16 x i8>, <16 x i8>, <16 x i8>)
+
+define <8 x i16> @test_vpermxorh() local_unnamed_addr {
+; CHECK-LE-P8-LABEL: test_vpermxorh:
+; CHECK-LE-P8:   # %bb.0: # %entry
+; CHECK-LE-P8-NEXT:addis 3, 2, .LCPI1_0@toc@ha
+; CHECK-LE-P8-NEXT:addis 4, 2, .LCPI1_1@toc@ha
+; CHECK-LE-P8-NEXT:addi 3, 3, .LCPI1_0@toc@l
+; CHECK-LE-P8-NEXT:lvx 2, 0, 3
+; CHECK-LE-P8-NEXT:addi 3, 4, .LCPI1_1@toc@l
+; CHECK-LE-P8-NEXT:lvx 3, 0, 3
+; CHECK-LE-P8-NEXT:vpermxor 2, 3, 2, 2
+; CHECK-LE-P8-NEXT:blr
+;
+; CHECK-P9-LABEL: test_vpermxorh:
+; CHECK-P9:   # %bb.0: # %entry
+; CHECK-P9-NEXT:addis 3, 2, .LCPI1_0@toc@ha
+; CHECK-P9-NEXT:addi 3, 3, .LCPI1_0@toc@l
+; CHECK-P9-NEXT:lxv 34, 0(3)
+; CHECK-P9-NEXT:addis 3, 2, .LCPI1_1@toc@ha
+; CHECK-P9-NEXT:addi 3, 3, .LCPI1_1@toc@l
+; CHECK-P9-NEXT:lxv 35, 0(3)
+; CHECK-P9-NEXT:vpermxor 2, 3, 2, 2
+; CHECK-P9-NEXT:blr
+;
+; CHECK-BE-P8-LABEL: test_vpermxorh:
+; CHECK-BE-P8:   # %bb.0: # %entry
+; CHECK-BE-P8-NEXT:addis 3, 2, .LCPI1_0@toc@ha
+; CHECK-BE-P8-NEXT:addis 4, 2, .LCPI1_1@toc@ha
+; CHECK-BE-P8-NEXT:addi 3, 3, .LCPI1_0@toc@l
+; CHECK-BE-P8-NEXT:addi 4, 4, .LCPI1_1@toc@l
+; CHECK-BE-P8-NEXT:lxvw4x 34, 0, 3
+; CHECK-BE-P8-NEXT:lxvw4x 35, 0, 4
+; CHECK-BE-P8-NEXT:vpermxor 2, 3, 2, 2
+; CHECK-BE-P8-NEXT:blr
+entry:
+  %0 = tail call <16 x i8> @llvm.ppc.altivec.crypto.vpermxor.be(<16 x i8> , <16 x i8> , <16 x i8> )
+  %1 = bitcast <16 x i8> %0 to <8 x i16>
+  ret <8 x i16> %1
+}
+
+define <4 x i32> @test_vpermxorw() local_unnamed_addr {
+; CHECK-LE-P8-LABEL: test_vpermxorw:
+; CHECK-LE-P8:   # %bb.0: # %entry
+; CHECK-LE-P8-NEXT:addis 3, 2, .LCPI2_0@toc@ha
+; CHECK-LE-P8-NEXT:addis 4, 2, .LCPI2_1@toc@ha
+; CHECK-LE-P8-NEXT:addi 3, 3, .LCPI2_0@toc@l
+; CHECK-LE-P8-NEXT:lvx 2, 0, 3
+; CHECK-LE-P8-NEXT:addi 3, 4, .LCPI2_1@toc@l
+; CHECK-LE-P8-NEXT:lvx 3, 0, 3
+; CHECK-LE-P8-NEXT:vpermxor 2, 3, 2, 2
+; CHECK-LE-P8-NEXT:blr
+;
+; CHECK-P9-LABEL: test_vpermxorw:
+; CHECK-P9:   # %bb.0: # %entry
+; CHECK-P9-NEXT:addis 3, 2, .LCPI2_0@toc@ha
+; CHECK-P9-NEXT:addi 3, 3, .L

[PATCH] D114639: Raise the minimum Visual Studio version to VS2019

2021-11-30 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

In D114639#3161362 , @aaron.ballman 
wrote:

> In D114639#3161303 , @erichkeane 
> wrote:
>
>> IMO, if we're updating the MSVC versions, we should do the same for the 
>> GCC/Clang/AppleClang versions too.  For example, GCC 5.1 is from 2015, and 
>> Clang 3.5 is from 2014.
>
> I'd be in favor of that; we could even see if we're ready to allow C++17 in 
> the code base (which would be a pretty nice win for if init statements 
> alone). However, it's also a bit orthogonal to this particular patch. Do you 
> (or someone else) want to start an RFC?

I believe the C++17 RFC was already on LLVM-dev last I saw?

That said, I commented because we typically try to update the 'minimum 
versions' in lockstep best we can.  Bumping these versions is particularly 
arduous, so I'd be against trying to do it piece-meal like this, particularly 
as we're updating the NEWEST requirement (that is, VS2017 is newer than Clang 
3.5/GCC5.1!).

Also note that we have a 'policy' for bumping versions: 
https://llvm.org/docs/DeveloperPolicy.html#toolchain

(From the looks of it, I think we ARE following the policy, but others should 
take a look).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114639

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


[PATCH] D114639: Raise the minimum Visual Studio version to VS2019

2021-11-30 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D114639#3161440 , @erichkeane 
wrote:

> In D114639#3161362 , @aaron.ballman 
> wrote:
>
>> In D114639#3161303 , @erichkeane 
>> wrote:
>>
>>> IMO, if we're updating the MSVC versions, we should do the same for the 
>>> GCC/Clang/AppleClang versions too.  For example, GCC 5.1 is from 2015, and 
>>> Clang 3.5 is from 2014.
>>
>> I'd be in favor of that; we could even see if we're ready to allow C++17 in 
>> the code base (which would be a pretty nice win for if init statements 
>> alone). However, it's also a bit orthogonal to this particular patch. Do you 
>> (or someone else) want to start an RFC?
>
> I believe the C++17 RFC was already on LLVM-dev last I saw?

Ah, I had missed that, thanks!

> That said, I commented because we typically try to update the 'minimum 
> versions' in lockstep best we can.  Bumping these versions is particularly 
> arduous, so I'd be against trying to do it piece-meal like this, particularly 
> as we're updating the NEWEST requirement (that is, VS2017 is newer than Clang 
> 3.5/GCC5.1!).

Fair point, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114639

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


[PATCH] D114639: Raise the minimum Visual Studio version to VS2019

2021-11-30 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

See: https://lists.llvm.org/pipermail/llvm-dev/2021-November/153882.html for 
what I was thinking of.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114639

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


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

2021-11-30 Thread Balázs Benics via Phabricator via cfe-commits
steakhal requested changes to this revision.
steakhal added a comment.
This revision now requires changes to proceed.

In D112621#3160082 , @manas wrote:

> I have made few changes:
>
> 1. The failed assertions  due to 
> comparison between different types have been fixed by converting all the 
> Ranges to a given type. This will allow comparisons without throwing errors.
> 2. There was also a build error due to `explicit specialization in 
> non-namespace scope`. This was fixed by @martong previously, but that patch 
> led to the above mentioned bug. So I used @martong 's patch here to make GCC 
> happy.
> 3. I have added a small check for comparison between different types.
>
> https://reviews.llvm.org/D106102 differential contains the background story.

I'm not quite happy.
Next time please make sure that the tests you provide actually exercise the 
changed code segments.
I deleted all the old lines of the `constant-folding.c` test file and placed a 
`llvm_unreachable()` into `SymbolicRangeInferrer::VisitBinaryOperator()` 
and the test did not cause a crash, which is a clear indication that the test 
does not test the modified code segments.
Unless I'm overly anxious I would draw false conclusions about the results of 
the tests and if I approve we could get crashes and complaints, and reverts.

I would kindly ask you to double-check your tests prior to submitting them to 
review.

---

About the technical content of this patch.

I would recommend following the same pattern as in the rest of the functions. 
So, `fillGaps()` then `convert()`. That way you would reduce the 
time-complexity of your code to `O(1)` from `O(N)`.
I would like to ask for a coverage report that shows that all of the branches 
of the modified code have been exercised by the `constant-folding.c` test file.

That being said, I would like to thank you for your effort in fixing this, I'm 
really looking forward!




Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:1272-1273
+  // (x != y).
+  if ((ConvertedLHS.getMaxValue() < ConvertedRHS.getMinValue()) ||
+  (ConvertedLHS.getMinValue() > ConvertedRHS.getMaxValue())) {
+return getTrueRange(T);

This and the subsequent similar block could be implemented by a member function 
of a `RangeSet`.
It's highly likely that many of these `VisitBinaryOperator()` functions 
could benefit from reusing them in the future if we decide to handle more of 
them.



Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:1279-1281
+  if ((ConvertedLHS.getMinValue() == ConvertedRHS.getMaxValue()) &&
+  (ConvertedLHS.getMaxValue() == ConvertedRHS.getMaxValue()) &&
+  (ConvertedLHS.getMinValue() == ConvertedRHS.getMinValue())) {

`ConvertedLHS.getConcreteValue() && ConvertedLHS.getConcreteValue() == 
ConvertedRHS.getConcreteValue()`



Comment at: clang/test/Analysis/constant-folding.c:326
+  if (s1 >= -1000 && s1 <= -500 && s2 <= -500 && s2 >= -750) {
+// s1: [-1000,-500], s2: [-500,-750]
+clang_analyzer_eval((s1 != s2) == 0); // expected-warning{{UNKNOWN}}

I would assume from `[x, y]` that `x <= y`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112621

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


[clang] 6e2aecd - [clang][dataflow] Add base types for building dataflow analyses

2021-11-30 Thread Yitzhak Mandelbaum via cfe-commits

Author: Stanislav Gatev
Date: 2021-11-30T14:44:40Z
New Revision: 6e2aecd759dc3f8bf664323388365ac234271e9b

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

LOG: [clang][dataflow] Add base types for building dataflow analyses

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Reviewed By: ymandel, xazax.hun, gribozavr2

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

Added: 
clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
clang/include/clang/Analysis/FlowSensitive/DataflowLattice.h
clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h
clang/lib/Analysis/FlowSensitive/CMakeLists.txt
clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp

Modified: 
clang/lib/Analysis/CMakeLists.txt

Removed: 




diff  --git a/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h 
b/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
new file mode 100644
index 0..975d618e99edc
--- /dev/null
+++ b/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
@@ -0,0 +1,134 @@
+//===- DataflowAnalysis.h ---*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+//  This file defines base types and functions for building dataflow analyses
+//  that run over Control-Flow Graphs (CFGs).
+//
+//===--===//
+
+#ifndef LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_DATAFLOWANALYSIS_H
+#define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_DATAFLOWANALYSIS_H
+
+#include 
+#include 
+#include 
+
+#include "clang/AST/ASTContext.h"
+#include "clang/AST/Stmt.h"
+#include "clang/Analysis/CFG.h"
+#include "clang/Analysis/FlowSensitive/DataflowEnvironment.h"
+#include "clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h"
+#include "llvm/ADT/Any.h"
+#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/STLExtras.h"
+
+namespace clang {
+namespace dataflow {
+
+/// Base class template for dataflow analyses built on a single lattice type.
+///
+/// Requirements:
+///
+///  `Derived` must be derived from a specialization of this class template and
+///  must provide the following public members:
+///   * `LatticeT initialElement()` - returns a lattice element that models the
+/// initial state of a basic block;
+///   * `LatticeT transfer(const Stmt *, const LatticeT &, Environment &)` -
+/// applies the analysis transfer function for a given statement and 
lattice
+/// element.
+///
+///  `LatticeT` is a bounded join-semilattice that is used by `Derived` and 
must
+///  provide the following public members:
+///   * `LatticeJoinEffect join(const LatticeT &)` - joins the object and the
+/// argument by computing their least upper bound, modifies the object if
+/// necessary, and returns an effect indicating whether any changes were
+/// made to it;
+///   * `bool operator==(const LatticeT &) const` - returns true if and only if
+/// the object is equal to the argument.
+template 
+class DataflowAnalysis : public TypeErasedDataflowAnalysis {
+public:
+  /// Bounded join-semilattice that is used in the analysis.
+  using Lattice = LatticeT;
+
+  explicit DataflowAnalysis(ASTContext &Context) : Context(Context) {}
+
+  ASTContext &getASTContext() final { return Context; }
+
+  AnyLatticeElement typeErasedInitialElement() final {
+return {static_cast(this)->initialElement()};
+  }
+
+  LatticeJoinEffect joinTypeErased(TypeErasedLattice &E1,
+   const TypeErasedLattice &E2) final {
+Lattice &L1 = llvm::any_cast(E1.Value);
+const Lattice &L2 = llvm::any_cast(E2.Value);
+return L1.join(L2);
+  }
+
+  bool isEqualTypeErased(const TypeErasedLattice &E1,
+ const TypeErasedLattice &E2) final {
+const Lattice &L1 = llvm::any_cast(E1.Value);
+const Lattice &L2 = llvm::any_cast(E2.Value);
+return L1 == L2;
+  }
+
+  AnyLatticeElement transferTypeErased(const Stmt *Stmt,
+   const AnyLatticeElement &E,
+   Environment &Env) final {
+const Lattice &L = llvm::any_cast(E.Value);
+return {static_cast(this)->transfer(Stmt, L, Env)};
+  }
+
+private:
+  ASTContext &Context;
+};
+
+// Model of the program at a given program point.
+template  struct DataflowAnalysis

[PATCH] D114234: [clang][dataflow] Add base types for building dataflow analyses

2021-11-30 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6e2aecd759dc: [clang][dataflow] Add base types for building 
dataflow analyses (authored by sgatev, committed by ymandel).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114234

Files:
  clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
  clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
  clang/include/clang/Analysis/FlowSensitive/DataflowLattice.h
  clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h
  clang/lib/Analysis/CMakeLists.txt
  clang/lib/Analysis/FlowSensitive/CMakeLists.txt
  clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp

Index: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
===
--- /dev/null
+++ clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
@@ -0,0 +1,35 @@
+//===- TypeErasedDataflowAnalysis.cpp -===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+//  This file defines type-erased base types and functions for building dataflow
+//  analyses that run over Control-Flow Graphs (CFGs).
+//
+//===--===//
+
+#include 
+
+#include "clang/Analysis/CFG.h"
+#include "clang/Analysis/FlowSensitive/DataflowEnvironment.h"
+#include "clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h"
+#include "llvm/ADT/Optional.h"
+
+using namespace clang;
+using namespace dataflow;
+
+std::vector>
+runTypeErasedDataflowAnalysis(const CFG &Cfg,
+  TypeErasedDataflowAnalysis &Analysis,
+  const Environment &InitEnv) {
+  // FIXME: Consider enforcing that `Cfg` meets the requirements that
+  // are specified in the header. This could be done by remembering
+  // what options were used to build `Cfg` and asserting on them here.
+
+  // FIXME: Implement work list-based algorithm to compute the fixed
+  // point of `Analysis::transform` for every basic block in `Cfg`.
+  return {};
+}
Index: clang/lib/Analysis/FlowSensitive/CMakeLists.txt
===
--- /dev/null
+++ clang/lib/Analysis/FlowSensitive/CMakeLists.txt
@@ -0,0 +1,7 @@
+add_clang_library(clangAnalysisFlowSensitive
+  TypeErasedDataflowAnalysis.cpp
+
+  LINK_LIBS
+  clangAnalysis
+  clangAST
+  )
Index: clang/lib/Analysis/CMakeLists.txt
===
--- clang/lib/Analysis/CMakeLists.txt
+++ clang/lib/Analysis/CMakeLists.txt
@@ -44,3 +44,4 @@
   )
 
 add_subdirectory(plugins)
+add_subdirectory(FlowSensitive)
Index: clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h
===
--- /dev/null
+++ clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h
@@ -0,0 +1,93 @@
+//===- TypeErasedDataflowAnalysis.h -*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+//  This file defines type-erased base types and functions for building dataflow
+//  analyses that run over Control-Flow Graphs (CFGs).
+//
+//===--===//
+
+#ifndef LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_TYPEERASEDDATAFLOWANALYSIS_H
+#define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_TYPEERASEDDATAFLOWANALYSIS_H
+
+#include 
+
+#include "clang/AST/ASTContext.h"
+#include "clang/AST/Stmt.h"
+#include "clang/Analysis/CFG.h"
+#include "clang/Analysis/FlowSensitive/DataflowEnvironment.h"
+#include "clang/Analysis/FlowSensitive/DataflowLattice.h"
+#include "llvm/ADT/Any.h"
+#include "llvm/ADT/Optional.h"
+
+namespace clang {
+namespace dataflow {
+
+/// Type-erased lattice element container.
+///
+/// Requirements:
+///
+///  The type of the object stored in the container must be a bounded
+///  join-semilattice.
+struct TypeErasedLattice {
+  llvm::Any Value;
+};
+
+/// Type-erased base class for dataflow analyses built on a single lattice type.
+class TypeErasedDataflowAnalysis {
+public:
+  /// Returns the `ASTContext` that is used by the analysis.
+  virtual ASTContext &getASTContext() = 0;
+
+  /// Returns a type-erased lattice element that models the initial state of a
+  /// basic block.
+  virtual TypeErasedLattice typeErasedI

[PATCH] D114713: [AArch64][SVE][NEON] Add NEON-SVE-Bridge intrinsics

2021-11-30 Thread Matt Devereau via Phabricator via cfe-commits
MattDevereau added inline comments.



Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:1325
   setOperationAction(ISD::MLOAD, VT, Custom);
+  setOperationAction(ISD::INSERT_SUBVECTOR, VT, Custom);
 }

paulwalker-arm wrote:
> Can you extract this into its own patch as it's really not relevant to the 
> rest of the patch and is currently missing tests.  Presumably 
> `llvm/test/CodeGen/AArch64/sve-insert-vector.ll` needs updating?
i've been adding some tests to assert this block of code. i've got tests for 
`insert(vscale x n x bfloat, n x bfloat, idx)` and `insert(vscale x n x bfloat, 
vscale x n x bfloat, idx)`.
the n = 4 and n = 8 tests are fine, but n = 2 for `insert(vscale x 2 x bfloat, 
2 x bfloat, idx)`  fails an assertion. i've had a quick poke around but haven't 
seen an obvious reason why its failing, should I worry about this and spend 
more time on it or just submit the tests i've already got for `4bf16` and 
`8bf16`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114713

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


[PATCH] D113422: [clang-tidy][NFC] Move CachedGlobList to GlobList.h

2021-11-30 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp updated this revision to Diff 390708.
carlosgalvezp added a comment.

Switch to public inheritance + mutable cached data. This seems to be a valid 
use case  for mutable, even though I'm 
not sure if there's anything against it in the LLVM coding guidelines. Looking 
forward to your feedback!


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

https://reviews.llvm.org/D113422

Files:
  clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
  clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
  clang-tools-extra/clang-tidy/GlobList.cpp
  clang-tools-extra/clang-tidy/GlobList.h
  clang-tools-extra/unittests/clang-tidy/GlobListTest.cpp

Index: clang-tools-extra/unittests/clang-tidy/GlobListTest.cpp
===
--- clang-tools-extra/unittests/clang-tidy/GlobListTest.cpp
+++ clang-tools-extra/unittests/clang-tidy/GlobListTest.cpp
@@ -4,15 +4,20 @@
 namespace clang {
 namespace tidy {
 
-TEST(GlobList, Empty) {
-  GlobList Filter("");
+template  struct GlobListTest : public ::testing::Test {};
+
+using GlobListTypes = ::testing::Types;
+TYPED_TEST_SUITE(GlobListTest, GlobListTypes);
+
+TYPED_TEST(GlobListTest, Empty) {
+  TypeParam Filter("");
 
   EXPECT_TRUE(Filter.contains(""));
   EXPECT_FALSE(Filter.contains("aaa"));
 }
 
-TEST(GlobList, Nothing) {
-  GlobList Filter("-*");
+TYPED_TEST(GlobListTest, Nothing) {
+  TypeParam Filter("-*");
 
   EXPECT_FALSE(Filter.contains(""));
   EXPECT_FALSE(Filter.contains("a"));
@@ -21,8 +26,8 @@
   EXPECT_FALSE(Filter.contains("*"));
 }
 
-TEST(GlobList, Everything) {
-  GlobList Filter("*");
+TYPED_TEST(GlobListTest, Everything) {
+  TypeParam Filter("*");
 
   EXPECT_TRUE(Filter.contains(""));
   EXPECT_TRUE(Filter.contains(""));
@@ -31,8 +36,8 @@
   EXPECT_TRUE(Filter.contains("*"));
 }
 
-TEST(GlobList, OneSimplePattern) {
-  GlobList Filter("aaa");
+TYPED_TEST(GlobListTest, OneSimplePattern) {
+  TypeParam Filter("aaa");
 
   EXPECT_TRUE(Filter.contains("aaa"));
   EXPECT_FALSE(Filter.contains(""));
@@ -41,8 +46,8 @@
   EXPECT_FALSE(Filter.contains("bbb"));
 }
 
-TEST(GlobList, TwoSimplePatterns) {
-  GlobList Filter("aaa,bbb");
+TYPED_TEST(GlobListTest, TwoSimplePatterns) {
+  TypeParam Filter("aaa,bbb");
 
   EXPECT_TRUE(Filter.contains("aaa"));
   EXPECT_TRUE(Filter.contains("bbb"));
@@ -52,11 +57,11 @@
   EXPECT_FALSE(Filter.contains(""));
 }
 
-TEST(GlobList, PatternPriority) {
+TYPED_TEST(GlobListTest, PatternPriority) {
   // The last glob that matches the string decides whether that string is
   // included or excluded.
   {
-GlobList Filter("a*,-aaa");
+TypeParam Filter("a*,-aaa");
 
 EXPECT_FALSE(Filter.contains(""));
 EXPECT_TRUE(Filter.contains("a"));
@@ -65,7 +70,7 @@
 EXPECT_TRUE(Filter.contains(""));
   }
   {
-GlobList Filter("-aaa,a*");
+TypeParam Filter("-aaa,a*");
 
 EXPECT_FALSE(Filter.contains(""));
 EXPECT_TRUE(Filter.contains("a"));
@@ -75,15 +80,16 @@
   }
 }
 
-TEST(GlobList, WhitespacesAtBegin) {
-  GlobList Filter("-*,   a.b.*");
+TYPED_TEST(GlobListTest, WhitespacesAtBegin) {
+  TypeParam Filter("-*,   a.b.*");
 
   EXPECT_TRUE(Filter.contains("a.b.c"));
   EXPECT_FALSE(Filter.contains("b.c"));
 }
 
-TEST(GlobList, Complex) {
-  GlobList Filter("*,-a.*, -b.*, \r  \n  a.1.* ,-a.1.A.*,-..,-...,-..+,-*$, -*qwe* ");
+TYPED_TEST(GlobListTest, Complex) {
+  TypeParam Filter(
+  "*,-a.*, -b.*, \r  \n  a.1.* ,-a.1.A.*,-..,-...,-..+,-*$, -*qwe* ");
 
   EXPECT_TRUE(Filter.contains("aaa"));
   EXPECT_TRUE(Filter.contains("qqq"));
Index: clang-tools-extra/clang-tidy/GlobList.h
===
--- clang-tools-extra/clang-tidy/GlobList.h
+++ clang-tools-extra/clang-tidy/GlobList.h
@@ -11,6 +11,7 @@
 
 #include "clang/Basic/LLVM.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Regex.h"
 
@@ -24,6 +25,8 @@
 /// them in the order of appearance in the list.
 class GlobList {
 public:
+  virtual ~GlobList() = default;
+
   /// \p Globs is a comma-separated list of globs (only the '*' metacharacter is
   /// supported) with an optional '-' prefix to denote exclusion.
   ///
@@ -36,10 +39,9 @@
 
   /// Returns \c true if the pattern matches \p S. The result is the last
   /// matching glob's Positive flag.
-  bool contains(StringRef S) const;
+  virtual bool contains(StringRef S) const;
 
 private:
-
   struct GlobListItem {
 bool IsPositive;
 llvm::Regex Regex;
@@ -47,7 +49,21 @@
   SmallVector Items;
 };
 
-} // end namespace tidy
-} // end namespace clang
+/// A \p GlobList that caches search results, so that search is performed only
+/// once for the same query.
+class CachedGlobList final : public GlobList {
+public:
+  using GlobList::GlobList;
+
+  /// \see GlobList::contains
+  bool contains(StringRef S) const override;
+
+p

[PATCH] D112024: [clang] diagnose_as attribute for Fortify diagnosing like builtins.

2021-11-30 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang/include/clang/Basic/AttrDocs.td:5956
+given. In addition, the order in which arguments should be applied must also
+be given.
+

We should mention that the attribute cannot be applied to a member function 
(and if you decide it shouldn't apply to a static member function either, I'd 
call that out explicitly as well).



Comment at: clang/include/clang/Basic/AttrDocs.td:5975
+
+For variadic functions, the variadic arguments must simply come in the same
+order as they would to the builtin function, after all normal arguments. For





Comment at: clang/include/clang/Basic/AttrDocs.td:5987
+Then the call `mysscanf("abc def", "%4s %4s", buf1, buf2)` will be diagnosed as
+if it were the call `mysscanf("abc def", "%4s %4s", buf1, buf2)`.
+}];





Comment at: clang/lib/AST/Decl.cpp:2021
   redeclarable_base(C) {
+
   static_assert(sizeof(VarDeclBitfields) <= sizeof(unsigned),

Spurious whitespace change can be reverted.



Comment at: clang/lib/Sema/SemaDeclAttr.cpp:1006-1009
+  const auto *DeclFD = dyn_cast(D);
+  if (!DeclFD)
+// User will have already been warned.
+return;

Sorry, I should have suggested this earlier -- might as well assert if `D` is 
something we should have already validated is a `FunctionDecl` before calling 
this helper.



Comment at: clang/lib/Sema/SemaDeclAttr.cpp:1011-1014
+  if (isa(DeclFD)) {
+S.Diag(AL.getLoc(), diag::err_attribute_no_member_function) << AL;
+return;
+  }

Hmm, this is getting into real nit territory, but, shouldn't it be fine to use 
a static member function?



Comment at: clang/lib/Sema/SemaDeclAttr.cpp:1021-1022
+return Union.get()->getBeginLoc();
+  else
+return Union.get()->Loc;
+}();

Sorry, missed this one earlier as well (no `else` after a `return` per our 
usual coding guidelines).



Comment at: clang/lib/Sema/SemaDeclAttr.cpp:1059-1061
+if (!checkUInt32Argument(S, AL, IndexExpr, Index, I + 1, false)) {
+  return;
+}





Comment at: clang/lib/Sema/SemaDeclAttr.cpp:1065
+  S.Diag(AL.getLoc(), diag::err_attribute_bounds_for_function)
+  << AL << Index << DeclFD->getName() << DeclFD->getNumParams();
+  return;





Comment at: clang/test/Sema/attr-diagnose-as-builtin.c:104
+struct S {
+  __attribute__((diagnose_as_builtin(__builtin_memset))) void f(); // 
expected-error{{'diagnose_as_builtin' attribute only applies to non-member 
functions}}
+};

It'd be good to add another test case for static member functions just to show 
whether we do or do not support them.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112024

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


[PATCH] D114560: [OPENMP]Fix PR51327: Range based for loop not working if range's type is a template.

2021-11-30 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev updated this revision to Diff 390714.
ABataev added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114560

Files:
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/OpenMP/for_loop_auto.cpp


Index: clang/test/OpenMP/for_loop_auto.cpp
===
--- /dev/null
+++ clang/test/OpenMP/for_loop_auto.cpp
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -verify -fopenmp -ast-print -std=c++20 %s -Wsign-conversion 
| FileCheck %s
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++20 -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -std=c++20 -include-pch %t -fsyntax-only -verify 
%s -ast-print | FileCheck %s
+
+// RUN: %clang_cc1 -verify -fopenmp-simd -ast-print -std=c++20 %s 
-Wsign-conversion | FileCheck %s
+// RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++20 -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp-simd -std=c++20 -include-pch %t -fsyntax-only 
-verify %s -ast-print | FileCheck %s
+// expected-no-diagnostics
+
+#ifndef HEADER
+#define HEADER
+
+// CHECK:  template <> void do_loop(const auto &v) {
+// CHECK-NEXT: #pragma omp parallel for
+// CHECK-NEXT:for (const auto &i : v)
+// CHECK-NEXT:  ;
+// CHECK-NEXT: }
+
+void do_loop(const auto &v) {
+#pragma omp parallel for
+  for (const auto &i : v)
+;
+}
+#endif
Index: clang/lib/Sema/SemaOpenMP.cpp
===
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -8804,6 +8804,9 @@
   }
   assert(((For && For->getBody()) || (CXXFor && CXXFor->getBody())) &&
  "No loop body.");
+  // Postpone analysis in dependent contexts for ranged for loops.
+  if (CXXFor && SemaRef.CurContext->isDependentContext())
+return false;
 
   OpenMPIterationSpaceChecker ISC(SemaRef, SupportsNonRectangular, DSA,
   For ? For->getForLoc() : 
CXXFor->getForLoc());


Index: clang/test/OpenMP/for_loop_auto.cpp
===
--- /dev/null
+++ clang/test/OpenMP/for_loop_auto.cpp
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -verify -fopenmp -ast-print -std=c++20 %s -Wsign-conversion | FileCheck %s
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++20 -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -std=c++20 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
+
+// RUN: %clang_cc1 -verify -fopenmp-simd -ast-print -std=c++20 %s -Wsign-conversion | FileCheck %s
+// RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++20 -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp-simd -std=c++20 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
+// expected-no-diagnostics
+
+#ifndef HEADER
+#define HEADER
+
+// CHECK:  template <> void do_loop(const auto &v) {
+// CHECK-NEXT: #pragma omp parallel for
+// CHECK-NEXT:for (const auto &i : v)
+// CHECK-NEXT:  ;
+// CHECK-NEXT: }
+
+void do_loop(const auto &v) {
+#pragma omp parallel for
+  for (const auto &i : v)
+;
+}
+#endif
Index: clang/lib/Sema/SemaOpenMP.cpp
===
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -8804,6 +8804,9 @@
   }
   assert(((For && For->getBody()) || (CXXFor && CXXFor->getBody())) &&
  "No loop body.");
+  // Postpone analysis in dependent contexts for ranged for loops.
+  if (CXXFor && SemaRef.CurContext->isDependentContext())
+return false;
 
   OpenMPIterationSpaceChecker ISC(SemaRef, SupportsNonRectangular, DSA,
   For ? For->getForLoc() : CXXFor->getForLoc());
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D113946: [libc][clang-tidy] fix namespace check for externals

2021-11-30 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.

LGTM aside from a tiny nit with the documentation.




Comment at: libc/docs/clang_tidy_checks.rst:71
+There are exceptions for the following functions: 
+``__errno_location`` so that errno can be set
+``malloc``, ``calloc``, ``realloc``, and ``free`` since they are always 
external




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113946

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


[PATCH] D114546: [OPENMP]Fix PR52117: Crash caused by target region inside of task construct.

2021-11-30 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev updated this revision to Diff 390716.
ABataev added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114546

Files:
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/Analysis/cfg-openmp.cpp
  clang/test/OpenMP/task_target_device_codegen.c
  clang/test/OpenMP/taskloop_codegen.cpp

Index: clang/test/OpenMP/taskloop_codegen.cpp
===
--- clang/test/OpenMP/taskloop_codegen.cpp
+++ clang/test/OpenMP/taskloop_codegen.cpp
@@ -238,8 +238,8 @@
 // CHECK-LABEL: taskloop_with_class
 void taskloop_with_class() {
   St s1;
-  // CHECK: [[TD:%.+]] = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* @{{.+}}, i32 [[GTID:%.+]], i32 1, i64 88, i64 8, i32 (i32, i8*)* bitcast (i32 (i32, [[TD_TYPE:%.+]]*)* @{{.+}} to i32 (i32, i8*)*))
-  // CHECK: call void @__kmpc_taskloop(%struct.ident_t* @{{.+}}, i32 [[GTID]], i8* [[TD]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 1, i32 0, i64 0, i8* bitcast (void ([[TD_TYPE]]*, [[TD_TYPE]]*, i32)* @{{.+}} to i8*))
+  // CHECK: [[TD:%.+]] = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* @{{.+}}, i32 [[GTID:%.+]], i32 1, i64 80, i64 8, i32 (i32, i8*)* bitcast (i32 (i32, [[TD_TYPE:%.+]]*)* @{{.+}} to i32 (i32, i8*)*))
+  // CHECK: call void @__kmpc_taskloop(%struct.ident_t* @{{.+}}, i32 [[GTID]], i8* [[TD]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 1, i32 0, i64 0, i8* null)
 #pragma omp taskloop
   for (St s = St(); s < s1; s += 1) {
   }
Index: clang/test/OpenMP/task_target_device_codegen.c
===
--- /dev/null
+++ clang/test/OpenMP/task_target_device_codegen.c
@@ -0,0 +1,105 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --include-generated-funcs --replace-value-regex "__omp_offloading_[0-9a-z]+_[0-9a-z]+" "reduction_size[.].+[.]" "pl_cond[   .].+[.|,]" --prefix-filecheck-ir-name _
+// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fopenmp-version=50 -x c -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -x c -triple x86_64-apple-darwin10 -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -x c -triple x86_64-apple-darwin10 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
+
+// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp-simd -fopenmp-version=50 -x c -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -x c -triple x86_64-apple-darwin10 -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -x c -triple x86_64-apple-darwin10 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
+// SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
+// expected-no-diagnostics
+#ifndef HEADER
+#define HEADER
+
+void test_task_affinity() {
+  int t;
+#pragma omp task
+  {
+#pragma omp target device(t)
+;
+  }
+}
+#endif
+// CHECK-LABEL: define {{[^@]+}}@test_task_affinity
+// CHECK-SAME: () #[[ATTR0:[0-9]+]] {
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[T:%.*]] = alloca i32, align 4
+// CHECK-NEXT:[[AGG_CAPTURED:%.*]] = alloca [[STRUCT_ANON:%.*]], align 1
+// CHECK-NEXT:[[TMP0:%.*]] = call i32 @__kmpc_global_thread_num(%struct.ident_t* @[[GLOB1:[0-9]+]])
+// CHECK-NEXT:[[TMP1:%.*]] = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* @[[GLOB1]], i32 [[TMP0]], i32 1, i64 48, i64 0, i32 (i32, i8*)* bitcast (i32 (i32, %struct.kmp_task_t_with_privates*)* @.omp_task_entry. to i32 (i32, i8*)*))
+// CHECK-NEXT:[[TMP2:%.*]] = bitcast i8* [[TMP1]] to %struct.kmp_task_t_with_privates*
+// CHECK-NEXT:[[TMP3:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_T_WITH_PRIVATES:%.*]], %struct.kmp_task_t_with_privates* [[TMP2]], i32 0, i32 0
+// CHECK-NEXT:[[TMP4:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_T_WITH_PRIVATES]], %struct.kmp_task_t_with_privates* [[TMP2]], i32 0, i32 1
+// CHECK-NEXT:[[TMP5:%.*]] = getelementptr inbounds [[STRUCT__KMP_PRIVATES_T:%.*]], %struct..kmp_privates.t* [[TMP4]], i32 0, i32 0
+// CHECK-NEXT:[[TMP6:%.*]] = load i32, i32* [[T]], align 4
+// CHECK-NEXT:store i32 [[TMP6]], i32* [[TMP5]], align 8
+// CHECK-NEXT:[[TMP7:%.*]] = call i32 @__kmpc_omp_task(%struct.ident_t* @[[GLOB1]], i32 [[TMP0]], i8* [[TMP1]])
+// CHECK-NEXT:ret void
+//
+//
+// CHECK-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_test_task_affinity_l18
+// CHECK-SAME: () #[[ATTR1:[0-9]+]] {
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:ret void
+//
+//
+// CHECK-LABEL: define {{[^@]+}}@.omp_task_privates_map.
+// CHECK-SAME: (%struct..kmp_privates.t* noalias [[TMP0:%.*]], i32** noalias [[TMP1:%.*]]) #[[ATTR2:[0-9]+]] {
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[DOTADDR:%.*]] = alloca %struct..kmp_privates.t*, align 8
+// CHECK-NEXT:[[DOTADDR1:%.*]] = alloca i32**

[PATCH] D114163: Use VersionTuple for parsing versions in Triple. This makes it possible to distinguish between "16" and "16.0" after parsing, which previously was not possible.

2021-11-30 Thread James Farrell via Phabricator via cfe-commits
jamesfarrell added a comment.

In D114163#3160292 , @arphaman wrote:

> Sorry for delay, this LGTM. Thanks for doing this cleanup!

Thanks, and no worries about the time (I was out last week as well)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114163

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


[PATCH] D114653: [OPENMP]Fix error emission for dependent expressions in iterators for depend clauses.

2021-11-30 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev updated this revision to Diff 390718.
ABataev added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114653

Files:
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/OpenMP/target_enter_data_depend_messages.cpp
  clang/test/OpenMP/target_exit_data_depend_messages.cpp
  clang/test/OpenMP/target_update_depend_messages.cpp
  clang/test/OpenMP/task_depend_template_call_ast_print.cpp

Index: clang/test/OpenMP/task_depend_template_call_ast_print.cpp
===
--- /dev/null
+++ clang/test/OpenMP/task_depend_template_call_ast_print.cpp
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 -ast-print %s | FileCheck %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -x c++ -std=c++11 -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
+
+// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 -ast-print %s | FileCheck %s
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -x c++ -std=c++11 -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
+// expected-no-diagnostics
+
+#ifndef HEADER
+#define HEADER
+
+template  class vector {
+public:
+  int &at(long);
+};
+
+// CHECK:  template  void foo(int n) {
+// CHECK-NEXT:   vector v;
+// CHECK-NEXT:   vector iv1;
+// CHECK-NEXT: #pragma omp task depend(iterator(int i = 0:n), in : v.at(i),iv1.at(i))
+// CHECK-NEXT: ;
+// CHECK-NEXT: }
+
+template  void foo(int n) {
+  vector v;
+  vector iv1;
+#pragma omp task depend(iterator(i = 0 : n), in : v.at(i), iv1.at(i))
+  ;
+}
+#endif
Index: clang/test/OpenMP/target_update_depend_messages.cpp
===
--- clang/test/OpenMP/target_update_depend_messages.cpp
+++ clang/test/OpenMP/target_update_depend_messages.cpp
@@ -39,7 +39,7 @@
 #pragma omp target update to(z) depend(out:)// expected-error {{expected expression}}
 #pragma omp target update to(z) depend(inout : foobool(argc)), depend(in, argc) // omp4-error {{expected addressable lvalue expression, array element or array section}} omp5-error {{expected addressable lvalue expression, array element, array section or array shaping expression of non 'omp_depend_t' type}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected expression}}
 #pragma omp target update to(z) depend(out : S1) // expected-error {{'S1' does not refer to a value}}
-#pragma omp target update to(z) depend(in : argv[1][1] = '2') // omp4-error {{expected addressable lvalue expression, array element or array section}} omp5-error {{expected addressable lvalue expression, array element, array section or array shaping expression of non 'omp_depend_t' type}}
+#pragma omp target update to(z) depend(in : argv[1][1] = '2')
 #pragma omp target update to(z) depend(in : vec[1]) // omp4-error {{expected addressable lvalue expression, array element or array section}} omp5-error {{expected addressable lvalue expression, array element, array section or array shaping expression of non 'omp_depend_t' type}}
 #pragma omp target update to(z) depend(in : argv[0])
 #pragma omp target update to(z) depend(in:) // expected-error {{expected expression}}
Index: clang/test/OpenMP/target_exit_data_depend_messages.cpp
===
--- clang/test/OpenMP/target_exit_data_depend_messages.cpp
+++ clang/test/OpenMP/target_exit_data_depend_messages.cpp
@@ -46,7 +46,7 @@
   foo();
   #pragma omp target exit data map(from: i) depend (out :S1) // expected-error {{'S1' does not refer to a value}}
   foo();
-#pragma omp target exit data map(from : i) depend(in : argv[1][1] = '2') // omp4-error {{expected addressable lvalue expression, array element or array section}} omp5-error {{expected addressable lvalue expression, array element, array section or array shaping expression of non 'omp_depend_t' type}}
+#pragma omp target exit data map(from : i) depend(in : argv[1][1] = '2')
   foo();
 #pragma omp target exit data map(from : i) depend(in : vec[1]) // omp4-error {{expected addressable lvalue expression, array element or array section}} omp5-error {{expected addressable lvalue expression, array element, array section or array shaping expression of non 'omp_depend_t' type}}
   foo();
Index: clang/test/OpenMP/target_enter_data_depend_messages.cpp
===
--- clang/test/OpenMP/target_enter_data_depend_messages.cpp
+++ clang/test/OpenMP/target_enter_data_depend_messages.cpp
@@ -46,7 +46,7 @@
   foo();
   #pragma omp target enter data map(to: i) depend (out :S1) // expected-error {{'S1' does not refer to a value}}
   foo();
-#pragma omp target enter data map(to

[clang] 3e32f82 - [clang][dataflow] Fix broken build in ClangStaticAnalyzer

2021-11-30 Thread Yitzhak Mandelbaum via cfe-commits

Author: Yitzhak Mandelbaum
Date: 2021-11-30T15:31:49Z
New Revision: 3e32f827e2647b6fa8022cbc76eac384b3c4e2b4

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

LOG: [clang][dataflow] Fix broken build in ClangStaticAnalyzer

Adds a missing virtual destructor.

Added: 


Modified: 
clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h

Removed: 




diff  --git 
a/clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h 
b/clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h
index 21647411ef5bd..9448b911f4718 100644
--- a/clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h
+++ b/clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h
@@ -40,6 +40,8 @@ struct TypeErasedLattice {
 /// Type-erased base class for dataflow analyses built on a single lattice 
type.
 class TypeErasedDataflowAnalysis {
 public:
+  virtual ~TypeErasedDataflowAnalysis() {}
+
   /// Returns the `ASTContext` that is used by the analysis.
   virtual ASTContext &getASTContext() = 0;
 



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


[clang] 1e82864 - Use VersionTuple for parsing versions in Triple. This makes it possible to distinguish between "16" and "16.0" after parsing, which previously was not possible.

2021-11-30 Thread James Farrell via cfe-commits

Author: James Farrell
Date: 2021-11-30T15:44:23Z
New Revision: 1e8286467036d8ef1a972de723f805a4981b2692

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

LOG: Use VersionTuple for parsing versions in Triple. This makes it possible to 
distinguish between "16" and "16.0" after parsing, which previously was not 
possible.

See also https://github.com/android/ndk/issues/1455.

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

Added: 


Modified: 
clang/lib/ARCMigrate/ARCMT.cpp
clang/lib/Basic/Targets/OSTargets.cpp
clang/lib/Basic/Targets/OSTargets.h
clang/lib/Basic/Targets/X86.h
clang/lib/Driver/ToolChains/Darwin.cpp
clang/lib/Driver/ToolChains/Linux.cpp
clang/lib/Driver/ToolChains/MSVC.cpp
clang/lib/Driver/ToolChains/NetBSD.cpp
clang/test/Sema/attr-availability-android.c
clang/test/Sema/attr-availability.c
clang/test/Sema/availability-guard-format.mm
clang/test/SemaObjC/attr-availability.m
clang/test/SemaObjC/property-deprecated-warning.m
clang/test/SemaObjC/unguarded-availability-maccatalyst.m
clang/test/SemaObjC/unguarded-availability.m
llvm/include/llvm/ADT/Triple.h
llvm/lib/Analysis/TargetLibraryInfo.cpp
llvm/lib/MC/MCStreamer.cpp
llvm/lib/Support/Triple.cpp
llvm/lib/Target/AArch64/AArch64Subtarget.cpp
llvm/lib/Target/AArch64/AArch64Subtarget.h
llvm/lib/Target/X86/X86Subtarget.h
llvm/unittests/ADT/TripleTest.cpp

Removed: 




diff  --git a/clang/lib/ARCMigrate/ARCMT.cpp b/clang/lib/ARCMigrate/ARCMT.cpp
index 4851c434d7652..68ee7c59270e0 100644
--- a/clang/lib/ARCMigrate/ARCMT.cpp
+++ b/clang/lib/ARCMigrate/ARCMT.cpp
@@ -162,9 +162,7 @@ static bool HasARCRuntime(CompilerInvocation &origCI) {
 return triple.getOSMajorVersion() >= 11;
 
   if (triple.getOS() == llvm::Triple::MacOSX) {
-unsigned Major, Minor, Micro;
-triple.getOSVersion(Major, Minor, Micro);
-return Major > 10 || (Major == 10 && Minor >= 7);
+return triple.getOSVersion() >= VersionTuple(10, 7);
   }
 
   return false;

diff  --git a/clang/lib/Basic/Targets/OSTargets.cpp 
b/clang/lib/Basic/Targets/OSTargets.cpp
index 4d9a462b51366..a17c2238f05d5 100644
--- a/clang/lib/Basic/Targets/OSTargets.cpp
+++ b/clang/lib/Basic/Targets/OSTargets.cpp
@@ -48,12 +48,12 @@ void getDarwinDefines(MacroBuilder &Builder, const 
LangOptions &Opts,
 Builder.defineMacro("_REENTRANT");
 
   // Get the platform type and version number from the triple.
-  unsigned Maj, Min, Rev;
+  VersionTuple OsVersion;
   if (Triple.isMacOSX()) {
-Triple.getMacOSXVersion(Maj, Min, Rev);
+Triple.getMacOSXVersion(OsVersion);
 PlatformName = "macos";
   } else {
-Triple.getOSVersion(Maj, Min, Rev);
+OsVersion = Triple.getOSVersion();
 PlatformName = llvm::Triple::getOSTypeName(Triple.getOS());
 if (PlatformName == "ios" && Triple.isMacCatalystEnvironment())
   PlatformName = "maccatalyst";
@@ -63,29 +63,29 @@ void getDarwinDefines(MacroBuilder &Builder, const 
LangOptions &Opts,
   // generating code for Win32 ABI. No need to emit
   // __ENVIRONMENT_XX_OS_VERSION_MIN_REQUIRED__.
   if (PlatformName == "win32") {
-PlatformMinVersion = VersionTuple(Maj, Min, Rev);
+PlatformMinVersion = OsVersion;
 return;
   }
 
   // Set the appropriate OS version define.
   if (Triple.isiOS()) {
-assert(Maj < 100 && Min < 100 && Rev < 100 && "Invalid version!");
+assert(OsVersion < VersionTuple(100) && "Invalid version!");
 char Str[7];
-if (Maj < 10) {
-  Str[0] = '0' + Maj;
-  Str[1] = '0' + (Min / 10);
-  Str[2] = '0' + (Min % 10);
-  Str[3] = '0' + (Rev / 10);
-  Str[4] = '0' + (Rev % 10);
+if (OsVersion.getMajor() < 10) {
+  Str[0] = '0' + OsVersion.getMajor();
+  Str[1] = '0' + (OsVersion.getMinor().getValueOr(0) / 10);
+  Str[2] = '0' + (OsVersion.getMinor().getValueOr(0) % 10);
+  Str[3] = '0' + (OsVersion.getSubminor().getValueOr(0) / 10);
+  Str[4] = '0' + (OsVersion.getSubminor().getValueOr(0) % 10);
   Str[5] = '\0';
 } else {
   // Handle versions >= 10.
-  Str[0] = '0' + (Maj / 10);
-  Str[1] = '0' + (Maj % 10);
-  Str[2] = '0' + (Min / 10);
-  Str[3] = '0' + (Min % 10);
-  Str[4] = '0' + (Rev / 10);
-  Str[5] = '0' + (Rev % 10);
+  Str[0] = '0' + (OsVersion.getMajor() / 10);
+  Str[1] = '0' + (OsVersion.getMajor() % 10);
+  Str[2] = '0' + (OsVersion.getMinor().getValueOr(0) / 10);
+  Str[3] = '0' + (OsVersion.getMinor().getValueOr(0) % 10);
+  Str[4] = '0' + (OsVersion.getSubminor().getValueOr(0) / 10);
+  Str[5] = '0' + (OsVersion.getSubminor().getValueOr(0) % 10);
   Str[6] = '\0';
 }
 if (Triple.isTvOS())
@@ -95,13 +95,13 @@ void getDarwinDefines(MacroBuilder &Bu

[PATCH] D114163: Use VersionTuple for parsing versions in Triple. This makes it possible to distinguish between "16" and "16.0" after parsing, which previously was not possible.

2021-11-30 Thread James Farrell 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 rG1e8286467036: Use VersionTuple for parsing versions in 
Triple. This makes it possible to… (authored by jamesfarrell).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114163

Files:
  clang/lib/ARCMigrate/ARCMT.cpp
  clang/lib/Basic/Targets/OSTargets.cpp
  clang/lib/Basic/Targets/OSTargets.h
  clang/lib/Basic/Targets/X86.h
  clang/lib/Driver/ToolChains/Darwin.cpp
  clang/lib/Driver/ToolChains/Linux.cpp
  clang/lib/Driver/ToolChains/MSVC.cpp
  clang/lib/Driver/ToolChains/NetBSD.cpp
  clang/test/Sema/attr-availability-android.c
  clang/test/Sema/attr-availability.c
  clang/test/Sema/availability-guard-format.mm
  clang/test/SemaObjC/attr-availability.m
  clang/test/SemaObjC/property-deprecated-warning.m
  clang/test/SemaObjC/unguarded-availability-maccatalyst.m
  clang/test/SemaObjC/unguarded-availability.m
  llvm/include/llvm/ADT/Triple.h
  llvm/lib/Analysis/TargetLibraryInfo.cpp
  llvm/lib/MC/MCStreamer.cpp
  llvm/lib/Support/Triple.cpp
  llvm/lib/Target/AArch64/AArch64Subtarget.cpp
  llvm/lib/Target/AArch64/AArch64Subtarget.h
  llvm/lib/Target/X86/X86Subtarget.h
  llvm/unittests/ADT/TripleTest.cpp

Index: llvm/unittests/ADT/TripleTest.cpp
===
--- llvm/unittests/ADT/TripleTest.cpp
+++ llvm/unittests/ADT/TripleTest.cpp
@@ -117,6 +117,18 @@
   EXPECT_EQ(Triple::Linux, T.getOS());
   EXPECT_EQ(Triple::MuslX32, T.getEnvironment());
 
+  T = Triple("arm-unknown-linux-android16");
+  EXPECT_EQ(Triple::arm, T.getArch());
+  EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
+  EXPECT_EQ(Triple::Linux, T.getOS());
+  EXPECT_EQ(Triple::Android, T.getEnvironment());
+
+  T = Triple("aarch64-unknown-linux-android21");
+  EXPECT_EQ(Triple::aarch64, T.getArch());
+  EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
+  EXPECT_EQ(Triple::Linux, T.getOS());
+  EXPECT_EQ(Triple::Android, T.getEnvironment());
+
   // PS4 has two spellings for the vendor.
   T = Triple("x86_64-scei-ps4");
   EXPECT_EQ(Triple::x86_64, T.getArch());
@@ -1261,7 +1273,7 @@
 
 TEST(TripleTest, getOSVersion) {
   Triple T;
-  unsigned Major, Minor, Micro;
+  VersionTuple Version;
 
   T = Triple("i386-apple-darwin9");
   EXPECT_TRUE(T.isMacOSX());
@@ -1269,14 +1281,10 @@
   EXPECT_FALSE(T.isArch16Bit());
   EXPECT_TRUE(T.isArch32Bit());
   EXPECT_FALSE(T.isArch64Bit());
-  T.getMacOSXVersion(Major, Minor, Micro);
-  EXPECT_EQ((unsigned)10, Major);
-  EXPECT_EQ((unsigned)5, Minor);
-  EXPECT_EQ((unsigned)0, Micro);
-  T.getiOSVersion(Major, Minor, Micro);
-  EXPECT_EQ((unsigned)5, Major);
-  EXPECT_EQ((unsigned)0, Minor);
-  EXPECT_EQ((unsigned)0, Micro);
+  T.getMacOSXVersion(Version);
+  EXPECT_EQ(VersionTuple(10, 5), Version);
+  Version = T.getiOSVersion();
+  EXPECT_EQ(VersionTuple(5), Version);
 
   T = Triple("x86_64-apple-darwin9");
   EXPECT_TRUE(T.isMacOSX());
@@ -1284,14 +1292,10 @@
   EXPECT_FALSE(T.isArch16Bit());
   EXPECT_FALSE(T.isArch32Bit());
   EXPECT_TRUE(T.isArch64Bit());
-  T.getMacOSXVersion(Major, Minor, Micro);
-  EXPECT_EQ((unsigned)10, Major);
-  EXPECT_EQ((unsigned)5, Minor);
-  EXPECT_EQ((unsigned)0, Micro);
-  T.getiOSVersion(Major, Minor, Micro);
-  EXPECT_EQ((unsigned)5, Major);
-  EXPECT_EQ((unsigned)0, Minor);
-  EXPECT_EQ((unsigned)0, Micro);
+  T.getMacOSXVersion(Version);
+  EXPECT_EQ(VersionTuple(10, 5), Version);
+  Version = T.getiOSVersion();
+  EXPECT_EQ(VersionTuple(5), Version);
 
   T = Triple("x86_64-apple-macosx");
   EXPECT_TRUE(T.isMacOSX());
@@ -1299,14 +1303,10 @@
   EXPECT_FALSE(T.isArch16Bit());
   EXPECT_FALSE(T.isArch32Bit());
   EXPECT_TRUE(T.isArch64Bit());
-  T.getMacOSXVersion(Major, Minor, Micro);
-  EXPECT_EQ((unsigned)10, Major);
-  EXPECT_EQ((unsigned)4, Minor);
-  EXPECT_EQ((unsigned)0, Micro);
-  T.getiOSVersion(Major, Minor, Micro);
-  EXPECT_EQ((unsigned)5, Major);
-  EXPECT_EQ((unsigned)0, Minor);
-  EXPECT_EQ((unsigned)0, Micro);
+  T.getMacOSXVersion(Version);
+  EXPECT_EQ(VersionTuple(10, 4), Version);
+  Version = T.getiOSVersion();
+  EXPECT_EQ(VersionTuple(5), Version);
 
   T = Triple("x86_64-apple-macosx10.7");
   EXPECT_TRUE(T.isMacOSX());
@@ -1314,14 +1314,10 @@
   EXPECT_FALSE(T.isArch16Bit());
   EXPECT_FALSE(T.isArch32Bit());
   EXPECT_TRUE(T.isArch64Bit());
-  T.getMacOSXVersion(Major, Minor, Micro);
-  EXPECT_EQ((unsigned)10, Major);
-  EXPECT_EQ((unsigned)7, Minor);
-  EXPECT_EQ((unsigned)0, Micro);
-  T.getiOSVersion(Major, Minor, Micro);
-  EXPECT_EQ((unsigned)5, Major);
-  EXPECT_EQ((unsigned)0, Minor);
-  EXPECT_EQ((unsigned)0, Micro);
+  T.getMacOSXVersion(Version);
+  EXPECT_EQ(VersionTuple(10, 7), Version);
+  Version = T.getiOSVersion();
+  EXPECT_EQ(VersionTuple(5), Version);
 
   T = Triple("x86_64-apple-macos11.0");
   EXPECT_TRUE(T.isMacOSX());
@@ -1329,10 +1325,8 

[PATCH] D114776: [clang-offload-bundler] Reuse original file extension for device archive member

2021-11-30 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev accepted this revision.
ABataev added a comment.
This revision is now accepted and ready to land.

LG


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114776

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


[PATCH] D114713: [AArch64][SVE][NEON] Add NEON-SVE-Bridge intrinsics

2021-11-30 Thread Matt Devereau via Phabricator via cfe-commits
MattDevereau updated this revision to Diff 390731.
MattDevereau added a comment.

updated builtin signatures in 
`clang/include/clang/Basic/BuiltinsAArch64NeonSVEBridge.def`
removed irrelevant change in `llvm/lib/Target/AArch64/AArch64ISelLowering.cpp`
ran clang-format


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

https://reviews.llvm.org/D114713

Files:
  clang/include/clang/Basic/BuiltinsAArch64NeonSVEBridge.def
  clang/include/clang/Basic/BuiltinsAArch64NeonSVEBridge_cg.def
  clang/include/clang/Basic/BuiltinsSVE.def
  clang/lib/Basic/Targets/AArch64.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Headers/arm_neon_sve_bridge.h
  
clang/test/CodeGen/aarch64_neon_sve_bridge_intrinsics/acle_neon_sve_bridge_dup_neonq.c
  
clang/test/CodeGen/aarch64_neon_sve_bridge_intrinsics/acle_neon_sve_bridge_get_neonq.c
  
clang/test/CodeGen/aarch64_neon_sve_bridge_intrinsics/acle_neon_sve_bridge_set_neonq.c

Index: clang/test/CodeGen/aarch64_neon_sve_bridge_intrinsics/acle_neon_sve_bridge_set_neonq.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64_neon_sve_bridge_intrinsics/acle_neon_sve_bridge_set_neonq.c
@@ -0,0 +1,176 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
+// REQUIRES: aarch64-registered-target
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +neon -target-feature +sve2 -target-feature +bf16 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +neon -target-feature +sve2 -target-feature +bf16 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefix=CPP-CHECK
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +neon -target-feature +sve2 -target-feature +bf16 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -o /dev/null %s
+#include 
+
+#define SVE_ACLE_FUNC(A1, A2, A3, A4) A1##A2##A3##A4
+
+// CHECK-LABEL: @test_svset_neonq_s8(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = call  @llvm.experimental.vector.insert.nxv16i8.v16i8( [[S:%.*]], <16 x i8> [[N:%.*]], i64 0)
+// CHECK-NEXT:ret  [[TMP0]]
+//
+// CPP-CHECK-LABEL: @_Z19test_svset_neonq_s8u10__SVInt8_t11__Int8x16_t(
+// CPP-CHECK-NEXT:  entry:
+// CPP-CHECK-NEXT:[[TMP0:%.*]] = call  @llvm.experimental.vector.insert.nxv16i8.v16i8( [[S:%.*]], <16 x i8> [[N:%.*]], i64 0)
+// CPP-CHECK-NEXT:ret  [[TMP0]]
+//
+svint8_t test_svset_neonq_s8(svint8_t s, int8x16_t n) {
+  return SVE_ACLE_FUNC(svset_neonq, _s8, , )(s, n);
+}
+
+// CHECK-LABEL: @test_svset_neonq_s16(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = call  @llvm.experimental.vector.insert.nxv8i16.v8i16( [[S:%.*]], <8 x i16> [[N:%.*]], i64 0)
+// CHECK-NEXT:ret  [[TMP0]]
+//
+// CPP-CHECK-LABEL: @_Z20test_svset_neonq_s16u11__SVInt16_t11__Int16x8_t(
+// CPP-CHECK-NEXT:  entry:
+// CPP-CHECK-NEXT:[[TMP0:%.*]] = call  @llvm.experimental.vector.insert.nxv8i16.v8i16( [[S:%.*]], <8 x i16> [[N:%.*]], i64 0)
+// CPP-CHECK-NEXT:ret  [[TMP0]]
+//
+svint16_t test_svset_neonq_s16(svint16_t s, int16x8_t n) {
+  return SVE_ACLE_FUNC(svset_neonq, _s16, , )(s, n);
+}
+
+// CHECK-LABEL: @test_svset_neonq_s32(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = call  @llvm.experimental.vector.insert.nxv4i32.v4i32( [[S:%.*]], <4 x i32> [[N:%.*]], i64 0)
+// CHECK-NEXT:ret  [[TMP0]]
+//
+// CPP-CHECK-LABEL: @_Z20test_svset_neonq_s32u11__SVInt32_t11__Int32x4_t(
+// CPP-CHECK-NEXT:  entry:
+// CPP-CHECK-NEXT:[[TMP0:%.*]] = call  @llvm.experimental.vector.insert.nxv4i32.v4i32( [[S:%.*]], <4 x i32> [[N:%.*]], i64 0)
+// CPP-CHECK-NEXT:ret  [[TMP0]]
+//
+svint32_t test_svset_neonq_s32(svint32_t s, int32x4_t n) {
+  return SVE_ACLE_FUNC(svset_neonq, _s32, , )(s, n);
+}
+
+// CHECK-LABEL: @test_svset_neonq_s64(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = call  @llvm.experimental.vector.insert.nxv2i64.v2i64( [[S:%.*]], <2 x i64> [[N:%.*]], i64 0)
+// CHECK-NEXT:ret  [[TMP0]]
+//
+// CPP-CHECK-LABEL: @_Z20test_svset_neonq_s64u11__SVInt64_t11__Int64x2_t(
+// CPP-CHECK-NEXT:  entry:
+// CPP-CHECK-NEXT:[[TMP0:%.*]] = call  @llvm.experimental.vector.insert.nxv2i64.v2i64( [[S:%.*]], <2 x i64> [[N:%.*]], i64 0)
+// CPP-CHECK-NEXT:ret  [[TMP0]]
+//
+svint64_t test_svset_neonq_s64(svint64_t s, int64x2_t n) {
+  return SVE_ACLE_FUNC(svset_neonq, _s64, , )(s, n);
+}
+
+// CHECK-LABEL: @test_svset_neonq_u8(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = call  @llvm.experimental.vector.insert.nxv16i8.v16i8( [[S:%.*]], <16 x i8> [[N:%.*]], i64 0)
+// CHECK-NEXT:ret  [[TMP0]]
+//
+// CPP-CHECK-LABEL: @_Z19test_svset_neonq_u8u11__SVUint8_t12__Uint8x16_t(
+// CPP-CHECK-NEXT:  entry:
+// CPP-CHECK-NEXT:[[TMP0:%.*]] = call  @llvm.experimental.vector.insert.nxv16i8.v16i8( [[S:%.*]], <16 x i8>

[PATCH] D112626: Convert float to double on __builtin_dump_struct

2021-11-30 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a reviewer: paulsemel.
aaron.ballman added a subscriber: paulsemel.
aaron.ballman added a comment.

Adding @paulsemel to the reviewer list as he was the original author of this 
functionality (I commit on his behalf which is how I showed up on the git 
blame).




Comment at: clang/lib/CodeGen/CGBuiltin.cpp:2090-2094
+// Variadic functions expect the caller to promote float to double.
+if (CanonicalType == Context.FloatTy) {
+  FieldPtr =
+  CGF.Builder.CreateFPExt(FieldPtr, CGF.ConvertType(Context.DoubleTy));
+}

This change is an improvement as far as it goes, but I think we might be 
missing other floating-point promotions here. For example, `__fp16` fields also 
seem to be unusable: https://godbolt.org/z/z3a45f9YE

Also, we don't seem to handle the integer promotions at all (but still get 
correct results there), so I think we're getting the correct behavior there by 
chance rather than by design. Oh, yeah, note the differences here: 
https://godbolt.org/z/f13eq3668

```
foo:
  ...
  %7 = load i8, i8* %4, align 1, !dbg !217
  %8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x 
i8]* @2, i32 0, i32 0), i8 %7), !dbg !217
  ...

bar:
  ...
  %2 = load i8, i8* %1, align 1, !dbg !222
  %3 = zext i8 %2 to i32, !dbg !222
  %4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x 
i8]* @.str, i64 0, i64 0), i32 %3), !dbg !223
  ...
```
I think we should probably fix all of the promotion problems at once rather 
than piecemeal.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112626

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


[PATCH] D114718: [analyzer] Implement a new checker for Strict Aliasing Rule.

2021-11-30 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments.



Comment at: clang/lib/StaticAnalyzer/Checkers/StrictAliasingChecker.cpp:48-49
+  //
+  // NOTE: User must provide canonical and unqualified QualType's for the
+  // correct result.
+  static bool canAccess(QualType From, QualType To, ASTContext &Ctx) {

NoQ wrote:
> `assert()` it? Or maybe canonicalize defensively so that not to duplicate 
> code in the caller, given that there's really only one correct way to do that?
>Or maybe canonicalize defensively so that not to duplicate code in the caller,
We need canonical types in the bug report as well, so we have to get them on 
the caller side.



Comment at: clang/lib/StaticAnalyzer/Checkers/StrictAliasingChecker.cpp:58
+  : From(From), To(To), Ctx(Ctx) {}
+  bool canAccessImpl() {
+return isSame() || isCharOrByte() || isOppositeSign();

xazax.hun wrote:
> I'd love to see some detailed descriptions of the strict aliasing rule, what 
> parts are we checking for and what parts we don't. E.g. it would be nice to 
> document the differences between C and C++ aliasing rules. I do remember 
> something about prefixes, i.e.: it would be well defined to access something 
> with the dynamic type `struct { int x, y; };` and read `struct{ int x; };` 
> from it. Does that not apply to C++?
>I'd love to see some detailed descriptions of the strict aliasing rule, 
I've added a description in the header.
>it would be nice to document the differences between C and C++ aliasing rules.
I need some time to gather those differences and will add them to the 
description as well.
> it would be well defined to access something with the dynamic type struct { 
> int x, y; }; and read struct{ int x; }; from it. Does that not apply to C++?
AFAIK it's UB if you do any access to the object which lifetime is not started 
in C++.



Comment at: clang/lib/StaticAnalyzer/Checkers/StrictAliasingChecker.cpp:80
+class StrictAliasingChecker : public Checker {
+  mutable std::unique_ptr BT;
+

NoQ wrote:
> The modern solution is
> ```lang=c++
> BugType BT{this, "...", "..."};
> ```
Got it.



Comment at: clang/lib/StaticAnalyzer/Checkers/StrictAliasingChecker.cpp:113
+  QualType getOriginalType(CheckerContext &C, SVal V, QualType T) const {
+assert(V.getAs() && "Location shall be a Loc.");
+V = C.getState()->getSVal(V.castAs(), T);

NoQ wrote:
> I suspect it might also be `UnknownVal` (?) It usually makes sense to protect 
> against such scenarios with an early return.
I'll try to add some tests to model this.



Comment at: clang/lib/StaticAnalyzer/Checkers/StrictAliasingChecker.cpp:141-145
+auto ER = dyn_cast(R);
+while (ER) {
+  R = ER->getSuperRegion();
+  ER = dyn_cast(R);
+}

NoQ wrote:
> You're basically running into https://bugs.llvm.org/show_bug.cgi?id=43364 
> here. The element region is not necessarily a consequence of a pointer cast; 
> it may also be a legitimate array element access, and there's no way to 
> figure out what it really was. So I suspect that you may fail the following 
> test case:
> ```lang=c++
> void foo() {
>   int x[10];
>   int *p = &x[1];
>   *p = 1; // int incompatible with int[10]
> }
> ```
> 
> Separately from that, ultimatetly you'll most likely have to handle //regions 
> with symbolic base// separately. These regions are special because they are 
> built when the information about the original type is not really unavailable. 
> For now you're dodging this problem by only supporting `VarRegion`s with 
> element sub-regions. But in the general case you may encounter code like this
> ```lang=c++
> void foo(void *p) {
>   int *x = p;
>   float *y = x;
>   *y = 1.0;
> }
> ```
> which may be valid if the original pointer `p` points to a `float`. But this 
> can be delayed until later.
Oh, unfortunately I've stumbled upon these representation issues:
```
int arr[2][8]
auto p1 = (int(*)[8])arr[0]; // &Element{arr,0 S64b,int[8]}
auto p2 = (int(*)[8])arr;// &Element{arr,0 S64b,int[8]}
auto p3 = (int(*)[7])arr[0]; // &Element{arr,0 S64b,int[7]}
auto x = *p1; // OK
auto y = *p2; // UB
auto z = *p3; // UB
```
I think we need some sort of a new region `CastRegion` that we can store the 
**provenance/origin** and **cast** type separately (in a canonical form), like 
I did for integers in  D103096. I can investigate it soon. And `ElementRegion` 
would be in charge of arrays only.
Or
We could modificate `ElementRegion` to be always in a canonical form which we 
could easily differentiate.



Comment at: clang/lib/StaticAnalyzer/Checkers/StrictAliasingChecker.cpp:157
+
+ExplodedNode *Node = C.generateNonFatalErrorNode();
+if (!BT)

NoQ wrote:
> I suggest a fatal error node. Undefined behavior already occured, there's 
> nothing interesting in the follow-up.
> I suggest a fatal error node. 
That's a 

[PATCH] D114713: [AArch64][SVE][NEON] Add NEON-SVE-Bridge intrinsics

2021-11-30 Thread Paul Walker via Phabricator via cfe-commits
paulwalker-arm added inline comments.



Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:1325
   setOperationAction(ISD::MLOAD, VT, Custom);
+  setOperationAction(ISD::INSERT_SUBVECTOR, VT, Custom);
 }

MattDevereau wrote:
> paulwalker-arm wrote:
> > Can you extract this into its own patch as it's really not relevant to the 
> > rest of the patch and is currently missing tests.  Presumably 
> > `llvm/test/CodeGen/AArch64/sve-insert-vector.ll` needs updating?
> i've been adding some tests to assert this block of code. i've got tests for 
> `insert(vscale x n x bfloat, n x bfloat, idx)` and `insert(vscale x n x 
> bfloat, vscale x n x bfloat, idx)`.
> the n = 4 and n = 8 tests are fine, but n = 2 for `insert(vscale x 2 x 
> bfloat, 2 x bfloat, idx)`  fails an assertion. i've had a quick poke around 
> but haven't seen an obvious reason why its failing, should I worry about this 
> and spend more time on it or just submit the tests i've already got for 
> `4bf16` and `8bf16`?
Obviously it would be nice for all combinations to work but that's not 
something you have to fix if it's not directly affecting what you need.

I've checked and it seems `2 x half` doesn't work out of the box either so it 
sounds reasonable to me for your new `bfloat` handling to mirror the existing 
supported `half` use cases only.


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

https://reviews.llvm.org/D114713

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


[clang] fd1d8e4 - [clang][dataflow] Make header parse

2021-11-30 Thread Benjamin Kramer via cfe-commits

Author: Benjamin Kramer
Date: 2021-11-30T17:53:19+01:00
New Revision: fd1d8e45f488b28db8d63ab51733ddd1e37e751c

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

LOG: [clang][dataflow] Make header parse

Looks like this is actually dead code?

Added: 


Modified: 
clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h

Removed: 




diff  --git a/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h 
b/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
index 975d618e99edc..a5d4a5d6ba407 100644
--- a/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
+++ b/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
@@ -60,7 +60,7 @@ class DataflowAnalysis : public TypeErasedDataflowAnalysis {
 
   ASTContext &getASTContext() final { return Context; }
 
-  AnyLatticeElement typeErasedInitialElement() final {
+  TypeErasedLattice typeErasedInitialElement() final {
 return {static_cast(this)->initialElement()};
   }
 
@@ -78,8 +78,8 @@ class DataflowAnalysis : public TypeErasedDataflowAnalysis {
 return L1 == L2;
   }
 
-  AnyLatticeElement transferTypeErased(const Stmt *Stmt,
-   const AnyLatticeElement &E,
+  TypeErasedLattice transferTypeErased(const Stmt *Stmt,
+   const TypeErasedLattice &E,
Environment &Env) final {
 const Lattice &L = llvm::any_cast(E.Value);
 return {static_cast(this)->transfer(Stmt, L, Env)};



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


[PATCH] D112663: [clang-repl] Allow Interpreter::getSymbolAddress to take a mangled name.

2021-11-30 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

There is no information in this patch as to why the changes are needed or 
useful; please use a more descriptive summary next time.




Comment at: clang/unittests/Interpreter/InterpreterTest.cpp:205-207
+  // FIXME: We cannot yet handle delayed template parsing. If we run with
+  // -fdelayed-template-parsing we try adding the newly created decl to the
+  // active PTU which causes an assert.

FWIW, Intel's internal testing is hitting crashes with this test. With 
`-fno-delayed-template-parsing` enabled, we get a failed assertion:
```
Assertion failed: OffsetBytes <= AllocationSize && "Offset out of bounds!", 
file d:\iusers\ayrivera\dev-xmain-web\llvm\l
lvm\lib\executionengine\runtimedyld\RuntimeDyldImpl.h, line 90
```
and when we enable the delayed template parsing, we get a different assertion:
```
Assertion failed: DC->getLexicalParent() == CurContext && "The next DeclContext 
should be lexically contained in the current one.", file 
D:/iusers/ayrivera/dev-xmain-web/llvm/clang/lib/Sema/SemaDecl.cpp, line 1305
```

I think this FIXME either needs to be addressed or the patch reverted until 
this is addressed.



Comment at: clang/unittests/Interpreter/InterpreterTest.cpp:237-240
+  std::string MangledName = MangleName(TmpltSpec);
+  typedef int (*TemplateSpecFn)(void *);
+  auto fn = (TemplateSpecFn)cantFail(Interp->getSymbolAddress(MangledName));
+  EXPECT_EQ(42, fn(NewA));

This test is broken for some of our internal build bots at Intel. I think 
something suspicious is going on here, but I'm not certain of the intent behind 
the test, so I'm not certain the best way to fix it. The behavior of the test 
is that on an x86 Windows machine, sometimes this particular test fails:
```
[ RUN ] IncrementalProcessing.InstantiateTemplate^M
unknown file: error: SEH exception with code 0x3221225477 thrown in the test 
body.^M
[ FAILED ] IncrementalProcessing.InstantiateTemplate (35 ms)^M
```
but it's not a consistent failure (seems to happen about one out of every three 
runs).

`callme` is a templated member function of `B` but here we're trying to call it 
like it's a free function. That's... not good. We could either make `callme` a 
`static` member function so that it can be called in this manner, or we could 
try to come up with a magic incantation to call it as a PMF.

Can you investigate, @v.g.vassilev? If it is going to take considerable time to 
resolve, it might be worth reverting temporarily. Thanks!


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

https://reviews.llvm.org/D112663

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


[PATCH] D112663: [clang-repl] Allow Interpreter::getSymbolAddress to take a mangled name.

2021-11-30 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments.



Comment at: clang/unittests/Interpreter/InterpreterTest.cpp:237-240
+  std::string MangledName = MangleName(TmpltSpec);
+  typedef int (*TemplateSpecFn)(void *);
+  auto fn = (TemplateSpecFn)cantFail(Interp->getSymbolAddress(MangledName));
+  EXPECT_EQ(42, fn(NewA));

aaron.ballman wrote:
> This test is broken for some of our internal build bots at Intel. I think 
> something suspicious is going on here, but I'm not certain of the intent 
> behind the test, so I'm not certain the best way to fix it. The behavior of 
> the test is that on an x86 Windows machine, sometimes this particular test 
> fails:
> ```
> [ RUN ] IncrementalProcessing.InstantiateTemplate^M
> unknown file: error: SEH exception with code 0x3221225477 thrown in the test 
> body.^M
> [ FAILED ] IncrementalProcessing.InstantiateTemplate (35 ms)^M
> ```
> but it's not a consistent failure (seems to happen about one out of every 
> three runs).
> 
> `callme` is a templated member function of `B` but here we're trying to call 
> it like it's a free function. That's... not good. We could either make 
> `callme` a `static` member function so that it can be called in this manner, 
> or we could try to come up with a magic incantation to call it as a PMF.
> 
> Can you investigate, @v.g.vassilev? If it is going to take considerable time 
> to resolve, it might be worth reverting temporarily. Thanks!
To be perhaps succinct, the problem is calling Pointer-to-member-function as a 
free-function.  The cast on line 239 is completely invalid, and can't be done 
in C++ code itself without UB.

We believe this shows up on x86 in particular since there is ALSO a 
calling-convention mismatch here, but this cast to TemplateSpecFn seems 
completely invalid to me.


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

https://reviews.llvm.org/D112663

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


[clang] b8e03be - [PS4][DWARF] Explicitly set default DWARF version to 4

2021-11-30 Thread Paul Robinson via cfe-commits

Author: Paul Robinson
Date: 2021-11-30T08:58:40-08:00
New Revision: b8e03be88dc87303f7401ea7b9906947ac67a6db

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

LOG: [PS4][DWARF] Explicitly set default DWARF version to 4

Added: 


Modified: 
clang/lib/Driver/ToolChains/PS4CPU.h

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/PS4CPU.h 
b/clang/lib/Driver/ToolChains/PS4CPU.h
index 82f9523f84fb8..4bedabaf267c0 100644
--- a/clang/lib/Driver/ToolChains/PS4CPU.h
+++ b/clang/lib/Driver/ToolChains/PS4CPU.h
@@ -80,6 +80,7 @@ class LLVM_LIBRARY_VISIBILITY PS4CPU : public Generic_ELF {
 return LangOptions::SSPStrong;
   }
 
+  unsigned GetDefaultDwarfVersion() const override { return 4; }
   llvm::DebuggerKind getDefaultDebuggerTuning() const override {
 return llvm::DebuggerKind::SCE;
   }



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


[PATCH] D112663: [clang-repl] Allow Interpreter::getSymbolAddress to take a mangled name.

2021-11-30 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang/unittests/Interpreter/InterpreterTest.cpp:205-207
+  // FIXME: We cannot yet handle delayed template parsing. If we run with
+  // -fdelayed-template-parsing we try adding the newly created decl to the
+  // active PTU which causes an assert.

aaron.ballman wrote:
> FWIW, Intel's internal testing is hitting crashes with this test. With 
> `-fno-delayed-template-parsing` enabled, we get a failed assertion:
> ```
> Assertion failed: OffsetBytes <= AllocationSize && "Offset out of bounds!", 
> file d:\iusers\ayrivera\dev-xmain-web\llvm\l
> lvm\lib\executionengine\runtimedyld\RuntimeDyldImpl.h, line 90
> ```
> and when we enable the delayed template parsing, we get a different assertion:
> ```
> Assertion failed: DC->getLexicalParent() == CurContext && "The next 
> DeclContext should be lexically contained in the current one.", file 
> D:/iusers/ayrivera/dev-xmain-web/llvm/clang/lib/Sema/SemaDecl.cpp, line 1305
> ```
> 
> I think this FIXME either needs to be addressed or the patch reverted until 
> this is addressed.
Ignore this -- this comment was saved in my Phab drafts from an earlier 
investigation and I managed to not delete it when sending my other comment 
(below). Oops!


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

https://reviews.llvm.org/D112663

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


[PATCH] D114651: [clang-cl] Expose -Wall to clang-cl by unaliasing -Wall, keeping /Wall as alias to -Weverything

2021-11-30 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

It looks like this Wall -> Weverything alias is from my 2017 change:
https://reviews.llvm.org/rGf9b08a382cc1e0669805991849ad69efbd4703e8

The commit message doesn't link to any bugs or any other motivating material. 
All I said is that this is being done for MSVC compatibility. I remember having 
some motivating reason, but it looks like I won't be able to find it. I see 
Hans thanked me for the behavior change, maybe he recalls.

Anyway, I would approve a patch to remove the alias, but I'd want to confirm 
with Hans that he is also on board with it, since I suspect he was the one who 
talked me into adding the alias. I don't have more time to follow up on this at 
the moment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114651

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


[PATCH] D114725: [clang-format] add back tests which didn't cause a regression

2021-11-30 Thread C. Rayroud via Phabricator via cfe-commits
crayroud added inline comments.



Comment at: clang/unittests/Format/FormatTest.cpp:14277
+  // FIXME these tests regressed behaviour.
   // verifyFormat("T A::operator() () {}", SpaceFuncDef);
   verifyFormat("auto lambda = [] () { return 0; };", SpaceFuncDef);

crayroud wrote:
> What do you think of enabling this test and to remove the space before the 
> opening parenthesis ? As it is now the expected behaviour to have no space.
In https://reviews.llvm.org/D114696, you proposed to add an operator 
overloading option to SpaceBeforeParensOptions. This example: "T A::operator() 
() {}" should be configured from AfterFunctionDefinitionName or operator 
overloading ?


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

https://reviews.llvm.org/D114725

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


[clang] 40d5eea - Revert "Use VersionTuple for parsing versions in Triple. This makes it possible to distinguish between "16" and "16.0" after parsing, which previously was not possible."

2021-11-30 Thread Nikita Popov via cfe-commits

Author: Nikita Popov
Date: 2021-11-30T18:36:32+01:00
New Revision: 40d5eeac6cd89a2360c3ba997cbaa816abca828c

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

LOG: Revert "Use VersionTuple for parsing versions in Triple. This makes it 
possible to distinguish between "16" and "16.0" after parsing, which previously 
was not possible."

This reverts commit 1e8286467036d8ef1a972de723f805a4981b2692.

llvm/test/Transforms/LoopStrengthReduce/X86/2009-11-10-LSRCrash.ll fails
with assertion failure:

llc: /home/nikic/llvm-project/llvm/include/llvm/ADT/Optional.h:196: T& 
llvm::optional_detail::OptionalStorage::getValue() & [with T = 
unsigned int]: Assertion `hasVal' failed.
...
 #8 0x5633843af5cb llvm::MCStreamer::emitVersionForTarget(llvm::Triple 
const&, llvm::VersionTuple const&)
 #9 0x563383b47f14 llvm::AsmPrinter::doInitialization(llvm::Module&)

Added: 


Modified: 
clang/lib/ARCMigrate/ARCMT.cpp
clang/lib/Basic/Targets/OSTargets.cpp
clang/lib/Basic/Targets/OSTargets.h
clang/lib/Basic/Targets/X86.h
clang/lib/Driver/ToolChains/Darwin.cpp
clang/lib/Driver/ToolChains/Linux.cpp
clang/lib/Driver/ToolChains/MSVC.cpp
clang/lib/Driver/ToolChains/NetBSD.cpp
clang/test/Sema/attr-availability-android.c
clang/test/Sema/attr-availability.c
clang/test/Sema/availability-guard-format.mm
clang/test/SemaObjC/attr-availability.m
clang/test/SemaObjC/property-deprecated-warning.m
clang/test/SemaObjC/unguarded-availability-maccatalyst.m
clang/test/SemaObjC/unguarded-availability.m
llvm/include/llvm/ADT/Triple.h
llvm/lib/Analysis/TargetLibraryInfo.cpp
llvm/lib/MC/MCStreamer.cpp
llvm/lib/Support/Triple.cpp
llvm/lib/Target/AArch64/AArch64Subtarget.cpp
llvm/lib/Target/AArch64/AArch64Subtarget.h
llvm/lib/Target/X86/X86Subtarget.h
llvm/unittests/ADT/TripleTest.cpp

Removed: 




diff  --git a/clang/lib/ARCMigrate/ARCMT.cpp b/clang/lib/ARCMigrate/ARCMT.cpp
index 68ee7c59270e0..4851c434d7652 100644
--- a/clang/lib/ARCMigrate/ARCMT.cpp
+++ b/clang/lib/ARCMigrate/ARCMT.cpp
@@ -162,7 +162,9 @@ static bool HasARCRuntime(CompilerInvocation &origCI) {
 return triple.getOSMajorVersion() >= 11;
 
   if (triple.getOS() == llvm::Triple::MacOSX) {
-return triple.getOSVersion() >= VersionTuple(10, 7);
+unsigned Major, Minor, Micro;
+triple.getOSVersion(Major, Minor, Micro);
+return Major > 10 || (Major == 10 && Minor >= 7);
   }
 
   return false;

diff  --git a/clang/lib/Basic/Targets/OSTargets.cpp 
b/clang/lib/Basic/Targets/OSTargets.cpp
index a17c2238f05d5..4d9a462b51366 100644
--- a/clang/lib/Basic/Targets/OSTargets.cpp
+++ b/clang/lib/Basic/Targets/OSTargets.cpp
@@ -48,12 +48,12 @@ void getDarwinDefines(MacroBuilder &Builder, const 
LangOptions &Opts,
 Builder.defineMacro("_REENTRANT");
 
   // Get the platform type and version number from the triple.
-  VersionTuple OsVersion;
+  unsigned Maj, Min, Rev;
   if (Triple.isMacOSX()) {
-Triple.getMacOSXVersion(OsVersion);
+Triple.getMacOSXVersion(Maj, Min, Rev);
 PlatformName = "macos";
   } else {
-OsVersion = Triple.getOSVersion();
+Triple.getOSVersion(Maj, Min, Rev);
 PlatformName = llvm::Triple::getOSTypeName(Triple.getOS());
 if (PlatformName == "ios" && Triple.isMacCatalystEnvironment())
   PlatformName = "maccatalyst";
@@ -63,29 +63,29 @@ void getDarwinDefines(MacroBuilder &Builder, const 
LangOptions &Opts,
   // generating code for Win32 ABI. No need to emit
   // __ENVIRONMENT_XX_OS_VERSION_MIN_REQUIRED__.
   if (PlatformName == "win32") {
-PlatformMinVersion = OsVersion;
+PlatformMinVersion = VersionTuple(Maj, Min, Rev);
 return;
   }
 
   // Set the appropriate OS version define.
   if (Triple.isiOS()) {
-assert(OsVersion < VersionTuple(100) && "Invalid version!");
+assert(Maj < 100 && Min < 100 && Rev < 100 && "Invalid version!");
 char Str[7];
-if (OsVersion.getMajor() < 10) {
-  Str[0] = '0' + OsVersion.getMajor();
-  Str[1] = '0' + (OsVersion.getMinor().getValueOr(0) / 10);
-  Str[2] = '0' + (OsVersion.getMinor().getValueOr(0) % 10);
-  Str[3] = '0' + (OsVersion.getSubminor().getValueOr(0) / 10);
-  Str[4] = '0' + (OsVersion.getSubminor().getValueOr(0) % 10);
+if (Maj < 10) {
+  Str[0] = '0' + Maj;
+  Str[1] = '0' + (Min / 10);
+  Str[2] = '0' + (Min % 10);
+  Str[3] = '0' + (Rev / 10);
+  Str[4] = '0' + (Rev % 10);
   Str[5] = '\0';
 } else {
   // Handle versions >= 10.
-  Str[0] = '0' + (OsVersion.getMajor() / 10);
-  Str[1] = '0' + (OsVersion.getMajor() % 10);
-  Str[2] = '0' + (OsVersion.getMinor().getValueOr(0) / 10);
-  Str[3] = '0' + (OsVersion.getMinor().getValueOr(0) % 10);
-  Str[4] = '0' + (

[PATCH] D114082: [WIP] Normalize String Attributes

2021-11-30 Thread serge via Phabricator via cfe-commits
serge-sans-paille added a comment.

In D114082#3149631 , @rnk wrote:

>> it is possible to list all internal keys in one place
>
> I think one of the original goals of adding support for string attributes 
> (maybe @void will give some input) was specifically to avoid having one giant 
> list with all the attributes supported by all the backends. String attributes 
> were initially called "target dependent attributes", or something like that. 
> I think we had a `td_attrs` accessor at some point. There was this idea that 
> LLVM should not know about x86-specific attributes. There should be some kind 
> of indirection and delegation to the target backend. LLVM has not always 
> succeeded in following this vision, see for example the target-specific 
> intrinsic enums, which were one giant enum until D71320 
> .
>
> I think, even if LLVM IR has to know all of the target-specific internally 
> used attributes, we can try to honor that target independent vision by having 
> separate headers for different target specific attributes. Does that sound 
> reasonable? It's at least consistent with how we handle intrinsics 
> (IntrinsicsX86.h, IntrinsicsAArch64.h etc).

The sub-review I proposed in https://reviews.llvm.org/D114394 does not 
introduce any list, so that should be a decent first step. As a second step, 
many passes already register their attribute in some local header and I can 
just generalize that: no big list but some local explicit definition.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114082

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


[PATCH] D114394: Compile-time computation of string attribute hashes

2021-11-30 Thread serge via Phabricator via cfe-commits
serge-sans-paille added a comment.

Gentle ping :-)


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

https://reviews.llvm.org/D114394

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


[PATCH] D114394: Compile-time computation of string attribute hashes

2021-11-30 Thread Nikita Popov via Phabricator via cfe-commits
nikic added a comment.

Compile-time: 
https://llvm-compile-time-tracker.com/compare.php?from=3608e18a946e77a474a468304b6c3904c55dbce0&to=0ce74a09cc8533a10fb67fdec4fb6ad8de4f1153&stat=instructions
 Some improvement at `O3`, not much change for optimized builds.

A concern I have is that this may be pessimizing non-clang frontends in favor 
of clang. Frontends not written in C++ will always be going through the 
`AttributeKey::get()` API, which will be slower than the initial state (I think 
-- we still have to calculate the hash dynamically, but now we also need to 
intern an AttributeKey by performing an actual hash table lookup.)

As a more general thought, I believe a core (performance) problem in the 
current attribute design is that AttrBuilder represents string attributes as a 
pair of strings, and most of our attribute manipulation is indirected through 
AttrBuilders. This means that we end up converting string `Attribute`s into a 
pair of strings and then construct an `Attribute` again via FoldingSet lookup. 
This is of course a lot of unnecessary work. Similarly, there are many hot 
attributes (like `"target-cpu"`) which are basically always the same, and we 
could just construct the `Attribute` upfront and always use that. That would 
save more than just the attribute name hash calculation. I think we may want to 
reconsider the AttrBuilder design to store `Attribute`s at least for string 
attributes, though of course that does make it Context-dependent.


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

https://reviews.llvm.org/D114394

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


[PATCH] D114163: Use VersionTuple for parsing versions in Triple. This makes it possible to distinguish between "16" and "16.0" after parsing, which previously was not possible.

2021-11-30 Thread Nikita Popov via Phabricator via cfe-commits
nikic added a comment.

FYI I reverted this due to test failures -- one specific assertion failure is 
mentioned in https://reviews.llvm.org/rG40d5eeac6cd8.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114163

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


[PATCH] D114163: Use VersionTuple for parsing versions in Triple. This makes it possible to distinguish between "16" and "16.0" after parsing, which previously was not possible.

2021-11-30 Thread Florian Hahn via Phabricator via cfe-commits
fhahn added a comment.

It is also breaking building `llvm-project/llvm/unittests/Support/Host.cpp` on 
macOS: 
https://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/25781/consoleFull

  FAILED: unittests/Support/CMakeFiles/SupportTests.dir/Host.cpp.o 
  
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
  -DBUILD_EXAMPLES -DGTEST_HAS_RTTI=0 -D_DEBUG -D__STDC_CONSTANT_MACROS 
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iunittests/Support 
-I/Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm-project/llvm/unittests/Support
 -Iinclude 
-I/Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm-project/llvm/include
 
-I/Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm-project/llvm/utils/unittest/googletest/include
 
-I/Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm-project/llvm/utils/unittest/googlemock/include
 -fPIC -fvisibility-inlines-hidden -Werror=date-time 
-Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter 
-Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic 
-Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough 
-Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor 
-Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -O3 -DNDEBUG 
-isysroot 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
 -mmacosx-version-min=10.9-Wno-variadic-macros 
-Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -fno-rtti -UNDEBUG 
-std=c++14 -MD -MT unittests/Support/CMakeFiles/SupportTests.dir/Host.cpp.o -MF 
unittests/Support/CMakeFiles/SupportTests.dir/Host.cpp.o.d -o 
unittests/Support/CMakeFiles/SupportTests.dir/Host.cpp.o -c 
/Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm-project/llvm/unittests/Support/Host.cpp
  
/Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm-project/llvm/unittests/Support/Host.cpp:428:48:
 error: too many arguments to function call, expected single argument 
'Version', have 3 arguments
  .getMacOSXVersion(SystemMajor, SystemMinor, SystemMicro),
  ~  ^~~~
  
/Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm-project/llvm/utils/unittest/googletest/include/gtest/gtest.h:2057:48:
 note: expanded from macro 'ASSERT_EQ'
  # define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)
 ^~~~
  
/Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm-project/llvm/utils/unittest/googletest/include/gtest/gtest.h:2041:63:
 note: expanded from macro 'GTEST_ASSERT_EQ'
ASSERT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
^~~~
  
/Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm-project/llvm/utils/unittest/googletest/include/gtest/gtest_pred_impl.h:168:36:
 note: expanded from macro 'ASSERT_PRED_FORMAT2'
GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
 ^~
  
/Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm-project/llvm/utils/unittest/googletest/include/gtest/gtest_pred_impl.h:149:39:
 note: expanded from macro 'GTEST_PRED_FORMAT2_'
GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
^~
  
/Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm-project/llvm/utils/unittest/googletest/include/gtest/gtest_pred_impl.h:77:52:
 note: expanded from macro 'GTEST_ASSERT_'
if (const ::testing::AssertionResult gtest_ar = (expression)) \
 ^~
  
/Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm-project/llvm/include/llvm/ADT/Triple.h:353:3:
 note: 'getMacOSXVersion' declared here
bool getMacOSXVersion(VersionTuple &Version) const;
^
  
/Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm-project/llvm/unittests/Support/Host.cpp:431:52:
 error: too many arguments to function call, expected single argument 
'Version', have 3 arguments
ASSERT_EQ(HostTriple.getMacOSXVersion(HostMajor, HostMinor, HostMicro), 
true);
  ~~~^~~~
  
/Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm-project/llvm/utils/unittest/googletest/include/gtest/gtest.h:2057:48:
 note: expanded from macro 'ASSERT_EQ'
  # define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)
 ^~~~
  
/Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm-project/llvm/utils/unittest/googletest/include/gtest/gtest.h:2041:63:
 note: expanded from macro 'GTEST_ASSERT_EQ'
  

[PATCH] D114163: Use VersionTuple for parsing versions in Triple. This makes it possible to distinguish between "16" and "16.0" after parsing, which previously was not possible.

2021-11-30 Thread James Farrell via Phabricator via cfe-commits
jamesfarrell added a comment.

In D114163#3161978 , @nikic wrote:

> FYI I reverted this due to test failures -- one specific assertion failure is 
> mentioned in https://reviews.llvm.org/rG40d5eeac6cd8.

Thanks! I saw the failures and was going to revert, but you beat me to it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114163

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


[PATCH] D114565: [InstrProf] Attach debug info to counters

2021-11-30 Thread Kyungwoo Lee via Phabricator via cfe-commits
kyulee added inline comments.



Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp:851
+  addString(AnnotationDie, dwarf::DW_AT_const_value, Value->getString());
+else if (const auto *Expr = dyn_cast(ValueOp))
+  addConstantValue(

It checks an expression but appears to apply the constant case below. Should it 
check a constant expression, instead?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114565

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


[PATCH] D44605: [Driver] Default to DWARF 5 for Fuchsia

2021-11-30 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.
Herald added a subscriber: abrachet.

@mcgrathr This might be ready to land now.


Repository:
  rC Clang

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

https://reviews.llvm.org/D44605

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


[PATCH] D114115: [Driver] Support for compressed debug info on Fuchsia

2021-11-30 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

@mcgrathr Ping.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114115

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


[PATCH] D114639: Raise the minimum Visual Studio version to VS2019

2021-11-30 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini added a comment.

In D114639#3161303 , @erichkeane 
wrote:

> IMO, if we're updating the MSVC versions, we should do the same for the 
> GCC/Clang/AppleClang versions too.  For example, GCC 5.1 is from 2015, and 
> Clang 3.5 is from 2014.

We've always handled MSVC update separately I believe, we can't just take the 
"last two version of MSVC" guideline and update every compiler each time.
(I'm not against updating our toolchain to support c++17, but that's orthogonal 
to the MSVC-specific update)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114639

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


[PATCH] D114023: [Driver] Pass --fix-cortex-a53-843419 automatically on Fuchsia

2021-11-30 Thread Petr Hosek via Phabricator via cfe-commits
phosek added inline comments.



Comment at: clang/lib/Driver/ToolChains/Fuchsia.cpp:91
+std::string CPU = getCPUName(D, Args, Triple);
+if (CPU.empty() || CPU == "generic" || CPU == "cortex-a53")
+  CmdArgs.push_back("--fix-cortex-a53-843419");

mcgrathr wrote:
> How does this relate to -march, -mtune, and/or -mcpu?
> It's not at all clear to me how we discern automatically when a A53 might be 
> included in the supported target CPU set.  I'm not entirely sure we should 
> have automatic injection in some cases where A53 is a valid target but not 
> all.  That is, if some compiler option combinations that produce code meant 
> to be compatible with an A53 won't automatically get the --fix option, then 
> perhaps it's better to require the explicit --fix option when supporting A53 
> is the explicit intent.
This is the same logic as used by the [Gnu 
driver](https://github.com/llvm/llvm-project/blob/7a7c059d867554e116244ad5639d05d75ed1a7cd/clang/lib/Driver/ToolChains/Gnu.cpp#L451).
 `getCPUName` only considers `-mcpu`, it ignores `-march` and `-mtune` as far 
as I can tell.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114023

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


[PATCH] D114639: Raise the minimum Visual Studio version to VS2019

2021-11-30 Thread Simon Pilgrim via Phabricator via cfe-commits
RKSimon added a comment.

In D114639#3162000 , @mehdi_amini 
wrote:

> In D114639#3161303 , @erichkeane 
> wrote:
>
>> IMO, if we're updating the MSVC versions, we should do the same for the 
>> GCC/Clang/AppleClang versions too.  For example, GCC 5.1 is from 2015, and 
>> Clang 3.5 is from 2014.
>
> We've always handled MSVC update separately I believe, we can't just take the 
> "last two version of MSVC" guideline and update every compiler each time.
> (I'm not against updating our toolchain to support c++17, but that's 
> orthogonal to the MSVC-specific update)

I recently started a C++17 conversation here, but I agree its orthogonal to the 
VS version bump: 
https://lists.llvm.org/pipermail/llvm-dev/2021-November/153882.html


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114639

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


[PATCH] D114809: Fix documentation for `forEachLambdaCapture` and `hasAnyCapture`

2021-11-30 Thread James King via Phabricator via cfe-commits
jcking1034 created this revision.
jcking1034 added reviewers: ymandel, tdl-g, aaron.ballman.
jcking1034 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Updates the return types of these matchers' definitions to use
`internal::Matcher` instead of `LambdaCaptureMatcher`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114809

Files:
  clang/docs/LibASTMatchersReference.html
  clang/include/clang/ASTMatchers/ASTMatchers.h

Index: clang/include/clang/ASTMatchers/ASTMatchers.h
===
--- clang/include/clang/ASTMatchers/ASTMatchers.h
+++ clang/include/clang/ASTMatchers/ASTMatchers.h
@@ -4227,8 +4227,8 @@
 /// lambdaExpr(forEachLambdaCapture(
 /// lambdaCapture(capturesVar(varDecl(hasType(isInteger()))
 /// will trigger two matches, binding for 'x' and 'y' respectively.
-AST_MATCHER_P(LambdaExpr, forEachLambdaCapture, LambdaCaptureMatcher,
-  InnerMatcher) {
+AST_MATCHER_P(LambdaExpr, forEachLambdaCapture,
+  internal::Matcher, InnerMatcher) {
   BoundNodesTreeBuilder Result;
   bool Matched = false;
   for (const auto &Capture : Node.captures()) {
@@ -4655,7 +4655,8 @@
 /// lambdaExpr(hasAnyCapture(lambdaCapture())) and
 /// lambdaExpr(hasAnyCapture(lambdaCapture(refersToVarDecl(hasName("t")
 ///   both match `[=](){ return t; }`.
-AST_MATCHER_P(LambdaExpr, hasAnyCapture, LambdaCaptureMatcher, InnerMatcher) {
+AST_MATCHER_P(LambdaExpr, hasAnyCapture, internal::Matcher,
+  InnerMatcher) {
   for (const LambdaCapture &Capture : Node.captures()) {
 clang::ast_matchers::internal::BoundNodesTreeBuilder Result(*Builder);
 if (InnerMatcher.matches(Capture, Finder, &Result)) {
Index: clang/docs/LibASTMatchersReference.html
===
--- clang/docs/LibASTMatchersReference.html
+++ clang/docs/LibASTMatchersReference.html
@@ -4550,35 +4550,6 @@
 
 
 
-MatcherLambdaExpr>forEachLambdaCaptureLambdaCaptureMatcher InnerMatcher
-Matches each lambda capture in a lambda expression.
-
-Given
-  int main() {
-int x, y;
-float z;
-auto f = [=]() { return x + y + z; };
-  }
-lambdaExpr(forEachLambdaCapture(
-lambdaCapture(capturesVar(varDecl(hasType(isInteger()))
-will trigger two matches, binding for 'x' and 'y' respectively.
-
-
-
-MatcherLambdaExpr>hasAnyCaptureLambdaCaptureMatcher InnerMatcher
-Matches any capture in a lambda expression.
-
-Given
-  void foo() {
-int t = 5;
-auto f = [=](){ return t; };
-  }
-lambdaExpr(hasAnyCapture(lambdaCapture())) and
-lambdaExpr(hasAnyCapture(lambdaCapture(refersToVarDecl(hasName("t")
-  both match `[=](){ return t; }`.
-
-
-
 MatcherMemberExpr>isArrow
 Matches member expressions that are called with '->' as opposed
 to '.'.
@@ -8405,6 +8376,35 @@
 
 
 
+MatcherLambdaExpr>forEachLambdaCaptureMatcherLambdaCapture> InnerMatcher
+Matches each lambda capture in a lambda expression.
+
+Given
+  int main() {
+int x, y;
+float z;
+auto f = [=]() { return x + y + z; };
+  }
+lambdaExpr(forEachLambdaCapture(
+lambdaCapture(capturesVar(varDecl(hasType(isInteger()))
+will trigger two matches, binding for 'x' and 'y' respectively.
+
+
+
+MatcherLambdaExpr>hasAnyCaptureMatcherLambdaCapture> InnerMatcher
+Matches any capture in a lambda expression.
+
+Given
+  void foo() {
+int t = 5;
+auto f = [=](){ return t; };
+  }
+lambdaExpr(hasAnyCapture(lambdaCapture())) and
+lambdaExpr(hasAnyCapture(lambdaCapture(refersToVarDecl(hasName("t")
+  both match `[=](){ return t; }`.
+
+
+
 MatcherMemberExpr>hasDeclarationMatcherDecl>  InnerMatcher
 Matches a node if the declaration associated with that node
 matches the given matcher.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D114382: [clang] Fix wrong -Wunused-local-typedef warning within a template function

2021-11-30 Thread Kristina Bessonova via Phabricator via cfe-commits
krisb added a comment.

Ping


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114382

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


[PATCH] D114809: Fix documentation for `forEachLambdaCapture` and `hasAnyCapture`

2021-11-30 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
ymandel accepted this revision.
ymandel added a comment.
This revision is now accepted and ready to land.

#TIL :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114809

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


[PATCH] D114639: Raise the minimum Visual Studio version to VS2019

2021-11-30 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a subscriber: jfb.
erichkeane added a comment.

In D114639#3162032 , @RKSimon wrote:

> In D114639#3162000 , @mehdi_amini 
> wrote:
>
>> In D114639#3161303 , @erichkeane 
>> wrote:
>>
>>> IMO, if we're updating the MSVC versions, we should do the same for the 
>>> GCC/Clang/AppleClang versions too.  For example, GCC 5.1 is from 2015, and 
>>> Clang 3.5 is from 2014.
>>
>> We've always handled MSVC update separately I believe, we can't just take 
>> the "last two version of MSVC" guideline and update every compiler each time.

My understanding is this would only be the ~3rd time we've done this.  The last 
time we did this, we did them all together.

>> (I'm not against updating our toolchain to support c++17, but that's 
>> orthogonal to the MSVC-specific update)
>
> I recently started a C++17 conversation here, but I agree its orthogonal to 
> the VS version bump: 
> https://lists.llvm.org/pipermail/llvm-dev/2021-November/153882.html

I also am not particularly 'interested' in the C++17 conversation here.  My 
bigger concern is that the last time we did the version bumps (which @jfb and I 
lead), there was significant interest to minimize the changes to the toolchains 
across platforms, which was a significant motivator to change them all at once 
the last time. If there is sufficient justification here to update based on the 
'last 2 releases', I'd strongly suspect/believe there are similar 
justifications for the other two, of which C++17 is just one.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114639

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


  1   2   >