[PATCH] D110032: [analyzer] Move docs of SmartPtr to correct subcategory

2021-09-19 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD created this revision.
RedDocMD added reviewers: NoQ, teemperor, xazax.hun, vsavchenko.
Herald added subscribers: manas, steakhal, ASDenysPetrov, dkrupp, donat.nagy, 
Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware.
RedDocMD requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The docs of alpha.cplusplus.SmartPtr was incorrectly placed under
alpha.deadcode. Moved it to under alpha.cplusplus


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110032

Files:
  clang/docs/analyzer/checkers.rst


Index: clang/docs/analyzer/checkers.rst
===
--- clang/docs/analyzer/checkers.rst
+++ clang/docs/analyzer/checkers.rst
@@ -1838,6 +1838,20 @@
a.foo();// warn: method call on a 'moved-from' object 'a'
  }
 
+.. _alpha-cplusplus-SmartPtr:
+
+alpha.cplusplus.SmartPtr (C++)
+""
+Check for dereference of null smart pointers.
+
+.. code-block:: cpp
+
+ void deref_smart_ptr() {
+   std::unique_ptr P;
+   *P; // warn: dereference of a default constructed smart unique_ptr
+ }
+
+
 alpha.deadcode
 ^^
 .. _alpha-deadcode-UnreachableCode:
@@ -1872,19 +1886,6 @@
[x retain]; // warn
  }
 
-.. _alpha-cplusplus-SmartPtr:
-
-alpha.cplusplus.SmartPtr (C++)
-""
-Check for dereference of null smart pointers.
-
-.. code-block:: cpp
-
- void deref_smart_ptr() {
-   std::unique_ptr P;
-   *P; // warn: dereference of a default constructed smart unique_ptr
- }
-
 alpha.fuchsia
 ^
 


Index: clang/docs/analyzer/checkers.rst
===
--- clang/docs/analyzer/checkers.rst
+++ clang/docs/analyzer/checkers.rst
@@ -1838,6 +1838,20 @@
a.foo();// warn: method call on a 'moved-from' object 'a'
  }
 
+.. _alpha-cplusplus-SmartPtr:
+
+alpha.cplusplus.SmartPtr (C++)
+""
+Check for dereference of null smart pointers.
+
+.. code-block:: cpp
+
+ void deref_smart_ptr() {
+   std::unique_ptr P;
+   *P; // warn: dereference of a default constructed smart unique_ptr
+ }
+
+
 alpha.deadcode
 ^^
 .. _alpha-deadcode-UnreachableCode:
@@ -1872,19 +1886,6 @@
[x retain]; // warn
  }
 
-.. _alpha-cplusplus-SmartPtr:
-
-alpha.cplusplus.SmartPtr (C++)
-""
-Check for dereference of null smart pointers.
-
-.. code-block:: cpp
-
- void deref_smart_ptr() {
-   std::unique_ptr P;
-   *P; // warn: dereference of a default constructed smart unique_ptr
- }
-
 alpha.fuchsia
 ^
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D110036: [TargetInfo][LangOpts] Refactor target info and language options adjustment.

2021-09-19 Thread Anton Zabaznov via Phabricator via cfe-commits
azabaznov created this revision.
azabaznov added reviewers: aaron.ballman, Anastasia, svenvh.
Herald added subscribers: dexonsmith, kerbowa, sunfish, kbarton, 
jgravelle-google, sbc100, nhaehnle, jvesely, nemanjai, dschuff.
azabaznov requested review of this revision.
Herald added subscribers: cfe-commits, aheejin.
Herald added a project: clang.

- Function CreateTargetInfo() has an access to language options which makes 
target immutable after creation without modification of language options 
themselves. Target specific hook TargetInfo::adjustAccordingToLangOpts() can be 
used if such modification depends on certain target.

- Introduce LangOptions::adjustAccordingToTI() to apply changes to language 
options based on target info (also without modification of target info). This 
also involves adding of some hooks (hasAtomics() / hasAltivec() as this options 
are used in PPC and WebAssembly in original TargetInfo::adjust()) which 
potentially can be reused.

- Validation of OpenCL target is in CreateTargetInfo() as language options are 
available at that point.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110036

Files:
  clang/include/clang/Basic/LangOptions.h
  clang/include/clang/Basic/TargetInfo.h
  clang/lib/Basic/LangOptions.cpp
  clang/lib/Basic/TargetInfo.cpp
  clang/lib/Basic/Targets.cpp
  clang/lib/Basic/Targets/AMDGPU.cpp
  clang/lib/Basic/Targets/AMDGPU.h
  clang/lib/Basic/Targets/PPC.cpp
  clang/lib/Basic/Targets/PPC.h
  clang/lib/Basic/Targets/SPIR.h
  clang/lib/Basic/Targets/WebAssembly.cpp
  clang/lib/Basic/Targets/WebAssembly.h
  clang/lib/Frontend/ASTUnit.cpp
  clang/lib/Frontend/ChainedIncludesSource.cpp
  clang/lib/Frontend/CompilerInstance.cpp
  clang/lib/Interpreter/Interpreter.cpp
  clang/tools/clang-import-test/clang-import-test.cpp
  clang/unittests/Analysis/MacroExpansionContextTest.cpp
  clang/unittests/Basic/SourceManagerTest.cpp
  clang/unittests/CodeGen/TestCompiler.h
  clang/unittests/Lex/HeaderSearchTest.cpp
  clang/unittests/Lex/LexerTest.cpp
  clang/unittests/Lex/PPCallbacksTest.cpp
  clang/unittests/Lex/PPConditionalDirectiveRecordTest.cpp

Index: clang/unittests/Lex/PPConditionalDirectiveRecordTest.cpp
===
--- clang/unittests/Lex/PPConditionalDirectiveRecordTest.cpp
+++ clang/unittests/Lex/PPConditionalDirectiveRecordTest.cpp
@@ -36,7 +36,7 @@
   TargetOpts(new TargetOptions)
   {
 TargetOpts->Triple = "x86_64-apple-darwin11.1.0";
-Target = TargetInfo::CreateTargetInfo(Diags, TargetOpts);
+Target = TargetInfo::CreateTargetInfo(Diags, TargetOpts, LangOpts);
   }
 
   FileSystemOptions FileMgrOpts;
Index: clang/unittests/Lex/PPCallbacksTest.cpp
===
--- clang/unittests/Lex/PPCallbacksTest.cpp
+++ clang/unittests/Lex/PPCallbacksTest.cpp
@@ -136,7 +136,7 @@
 Diags(DiagID, DiagOpts.get(), new IgnoringDiagConsumer()),
 SourceMgr(Diags, FileMgr), TargetOpts(new TargetOptions()) {
 TargetOpts->Triple = "x86_64-apple-darwin11.1.0";
-Target = TargetInfo::CreateTargetInfo(Diags, TargetOpts);
+Target = TargetInfo::CreateTargetInfo(Diags, TargetOpts, LangOpts);
   }
 
   IntrusiveRefCntPtr InMemoryFileSystem;
Index: clang/unittests/Lex/LexerTest.cpp
===
--- clang/unittests/Lex/LexerTest.cpp
+++ clang/unittests/Lex/LexerTest.cpp
@@ -43,7 +43,7 @@
   TargetOpts(new TargetOptions)
   {
 TargetOpts->Triple = "x86_64-apple-darwin11.1.0";
-Target = TargetInfo::CreateTargetInfo(Diags, TargetOpts);
+Target = TargetInfo::CreateTargetInfo(Diags, TargetOpts, LangOpts);
   }
 
   std::unique_ptr CreatePP(StringRef Source,
Index: clang/unittests/Lex/HeaderSearchTest.cpp
===
--- clang/unittests/Lex/HeaderSearchTest.cpp
+++ clang/unittests/Lex/HeaderSearchTest.cpp
@@ -34,7 +34,7 @@
 Search(std::make_shared(), SourceMgr, Diags,
LangOpts, Target.get()) {
 TargetOpts->Triple = "x86_64-apple-darwin11.1.0";
-Target = TargetInfo::CreateTargetInfo(Diags, TargetOpts);
+Target = TargetInfo::CreateTargetInfo(Diags, TargetOpts, LangOpts);
   }
 
   void addSearchDir(llvm::StringRef Dir) {
Index: clang/unittests/CodeGen/TestCompiler.h
===
--- clang/unittests/CodeGen/TestCompiler.h
+++ clang/unittests/CodeGen/TestCompiler.h
@@ -45,7 +45,8 @@
 compiler.getTargetOpts().Triple = Tr.getTriple();
 compiler.setTarget(clang::TargetInfo::CreateTargetInfo(
 compiler.getDiagnostics(),
-std::make_shared(compiler.getTargetOpts(;
+std::make_shared(compiler.getTargetOpts()),
+compiler.getLangOpts()));
 
 const clang::TargetInfo &TInfo = compiler.getTarget();
 PtrSize = TInfo.getPointerWidth(0) / 8;
Index: clang/unittests/Basic/SourceManagerTest.

[PATCH] D110037: [X86] Always check the size of SourceTy before getting the next type

2021-09-19 Thread Pengfei Wang via Phabricator via cfe-commits
pengfei created this revision.
pengfei added reviewers: LuoYuanke, Meinersbur, craig.topper, RKSimon.
pengfei requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

D109607  results in a regression in 
llvm-test-suite.
The reason is we didn't check the size of SourceTy, so that we will
return wrong SSE type when SourceTy is overlapped.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110037

Files:
  clang/lib/CodeGen/TargetInfo.cpp
  clang/test/CodeGen/X86/va-arg-sse.c


Index: clang/test/CodeGen/X86/va-arg-sse.c
===
--- clang/test/CodeGen/X86/va-arg-sse.c
+++ clang/test/CodeGen/X86/va-arg-sse.c
@@ -17,23 +17,30 @@
 // CHECK-NEXT:[[FITS_IN_FP:%.*]] = icmp ult i32 [[FP_OFFSET]], 145
 // CHECK-NEXT:br i1 [[FITS_IN_FP]], label [[VAARG_IN_REG:%.*]], label 
[[VAARG_IN_MEM:%.*]]
 // CHECK:   vaarg.in_reg:
-// CHECK-NEXT:[[TMP1:%.*]] = add nuw nsw i32 [[FP_OFFSET]], 32
-// CHECK-NEXT:store i32 [[TMP1]], i32* [[FP_OFFSET_P]], align 4
+// CHECK-NEXT:[[TMP1:%.*]] = getelementptr inbounds [1 x 
%struct.__va_list_tag], [1 x %struct.__va_list_tag]* [[AP]], i64 0, i64 0, i32 3
+// CHECK-NEXT:[[REG_SAVE_AREA:%.*]] = load i8*, i8** [[TMP1]], align 16
+// CHECK-NEXT:[[TMP2:%.*]] = zext i32 [[FP_OFFSET]] to i64
+// CHECK-NEXT:[[TMP3:%.*]] = getelementptr i8, i8* [[REG_SAVE_AREA]], i64 
[[TMP2]]
+// CHECK-NEXT:[[TMP4:%.*]] = getelementptr inbounds i8, i8* [[TMP3]], i64 
16
+// CHECK-NEXT:[[TMP5:%.*]] = bitcast i8* [[TMP4]] to float*
+// CHECK-NEXT:[[TMP6:%.*]] = load float, float* [[TMP5]], align 16
+// CHECK-NEXT:[[TMP7:%.*]] = add nuw nsw i32 [[FP_OFFSET]], 32
+// CHECK-NEXT:store i32 [[TMP7]], i32* [[FP_OFFSET_P]], align 4
 // CHECK-NEXT:br label [[VAARG_END:%.*]]
 // CHECK:   vaarg.in_mem:
 // CHECK-NEXT:[[OVERFLOW_ARG_AREA_P:%.*]] = getelementptr inbounds [1 x 
%struct.__va_list_tag], [1 x %struct.__va_list_tag]* [[AP]], i64 0, i64 0, i32 2
 // CHECK-NEXT:[[OVERFLOW_ARG_AREA:%.*]] = load i8*, i8** 
[[OVERFLOW_ARG_AREA_P]], align 8
 // CHECK-NEXT:[[DOTSROA_GEP:%.*]] = getelementptr inbounds i8, i8* 
[[OVERFLOW_ARG_AREA]], i64 8
-// CHECK-NEXT:[[TMP2:%.*]] = bitcast i8* [[DOTSROA_GEP]] to float*
+// CHECK-NEXT:[[TMP8:%.*]] = bitcast i8* [[DOTSROA_GEP]] to float*
 // CHECK-NEXT:[[OVERFLOW_ARG_AREA_NEXT:%.*]] = getelementptr i8, i8* 
[[OVERFLOW_ARG_AREA]], i64 16
 // CHECK-NEXT:store i8* [[OVERFLOW_ARG_AREA_NEXT]], i8** 
[[OVERFLOW_ARG_AREA_P]], align 8
-// CHECK-NEXT:[[VAARG_ADDR_SROA_PHI_SROA_SPECULATE_LOAD_VAARG_IN_MEM:%.*]] 
= load float, float* [[TMP2]], align 4, !tbaa.struct !2
+// CHECK-NEXT:[[VAARG_ADDR_SROA_PHI_SROA_SPECULATE_LOAD_VAARG_IN_MEM:%.*]] 
= load float, float* [[TMP8]], align 4, !tbaa.struct !2
 // CHECK-NEXT:br label [[VAARG_END]]
 // CHECK:   vaarg.end:
-// CHECK-NEXT:[[VAARG_ADDR_SROA_PHI_SROA_SPECULATED:%.*]] = phi float [ 
undef, [[VAARG_IN_REG]] ], [ 
[[VAARG_ADDR_SROA_PHI_SROA_SPECULATE_LOAD_VAARG_IN_MEM]], [[VAARG_IN_MEM]] ]
+// CHECK-NEXT:[[VAARG_ADDR_SROA_PHI_SROA_SPECULATED:%.*]] = phi float [ 
[[TMP6]], [[VAARG_IN_REG]] ], [ 
[[VAARG_ADDR_SROA_PHI_SROA_SPECULATE_LOAD_VAARG_IN_MEM]], [[VAARG_IN_MEM]] ]
 // CHECK-NEXT:call void @llvm.va_end(i8* nonnull [[TMP0]])
-// CHECK-NEXT:[[TMP3:%.*]] = load float, float* getelementptr inbounds ([5 
x %struct.S], [5 x %struct.S]* @a, i64 0, i64 2, i32 0, i64 2), align 16, !tbaa 
[[TBAA6:![0-9]+]]
-// CHECK-NEXT:[[CMP:%.*]] = fcmp oeq float [[TMP3]], 
[[VAARG_ADDR_SROA_PHI_SROA_SPECULATED]]
+// CHECK-NEXT:[[TMP9:%.*]] = load float, float* getelementptr inbounds ([5 
x %struct.S], [5 x %struct.S]* @a, i64 0, i64 2, i32 0, i64 2), align 16, !tbaa 
[[TBAA6:![0-9]+]]
+// CHECK-NEXT:[[CMP:%.*]] = fcmp oeq float [[TMP9]], 
[[VAARG_ADDR_SROA_PHI_SROA_SPECULATED]]
 // CHECK-NEXT:[[RETVAL_0:%.*]] = zext i1 [[CMP]] to i32
 // CHECK-NEXT:call void @llvm.lifetime.end.p0i8(i64 24, i8* nonnull 
[[TMP0]]) #[[ATTR3]]
 // CHECK-NEXT:ret i32 [[RETVAL_0]]
Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -3438,17 +3438,21 @@
 GetSSETypeAtOffset(llvm::Type *IRType, unsigned IROffset,
QualType SourceTy, unsigned SourceOffset) const {
   const llvm::DataLayout &TD = getDataLayout();
+  unsigned SourceSize =
+  (unsigned)getContext().getTypeSize(SourceTy) / 8 - SourceOffset;
   llvm::Type *T0 = getFPTypeAtOffset(IRType, IROffset, TD);
   if (!T0 || T0->isDoubleTy())
 return llvm::Type::getDoubleTy(getVMContext());
 
   // Get the adjacent FP type.
-  llvm::Type *T1 =
-  getFPTypeAtOffset(IRType, IROffset + TD.getTypeAllocSize(T0), TD);
+  llvm::Type *T1 = nullptr;
+  unsigned T0Size = TD.getTypeAllocSize(

[PATCH] D109607: [X86] Refactor GetSSETypeAtOffset to fix pr51813

2021-09-19 Thread Pengfei Wang via Phabricator via cfe-commits
pengfei added a comment.

In D109607#3007860 , @Meinersbur 
wrote:

> This patch seem to have broken `GCC-C-execute-pr44575` from the 
> llvm-test-suite. See http://meinersbur.de:8011/#/builders/76/builds/761 (this 
> builder compiles with Polly, but it also crashes without Polly)

@Meinersbur, sorry for the late response. I just managed to reproduce the 
failure. I create D110037  to try to fix this 
problem. The test passed locally.
By the way, does this bot send notification to authors when it fails? I didn't 
receive this fail, so I'm not aware of it at the first time.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109607

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


[PATCH] D110037: [X86] Always check the size of SourceTy before getting the next type

2021-09-19 Thread Pengfei Wang via Phabricator via cfe-commits
pengfei added a comment.

I'm wondering whether the test case is required or not for this patch. Reasons:

1. We have a test in llvm-test-suite can cover this and the test is just a 
snippet of it;
2. The test case can not reflect the direct effect of this change;
3. There're many variables in IR which may be easily affected by unrelated 
changes, which is annoying to others.

What do you think?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110037

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


[PATCH] D110037: [X86] Always check the size of SourceTy before getting the next type

2021-09-19 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added inline comments.



Comment at: clang/test/CodeGen/X86/va-arg-sse.c:2
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
 // RUN: %clang_cc1 %s -O2 -emit-llvm -o - -triple x86_64-unknown-unknown | 
FileCheck %s
 

Please don't use `-O*` in clang irgen tests.
This should *only* test what IR is produced by clang itself.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110037

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


[PATCH] D110041: [clang] Use portable "#!/usr/bin/env bash" shebang for tools and utils.

2021-09-19 Thread Frederic Cambus via Phabricator via cfe-commits
fcambus created this revision.
fcambus added a reviewer: JDevlieghere.
fcambus requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110041

Files:
  clang/tools/diag-build/diag-build.sh
  clang/utils/make-ast-dump-check.sh


Index: clang/utils/make-ast-dump-check.sh
===
--- clang/utils/make-ast-dump-check.sh
+++ clang/utils/make-ast-dump-check.sh
@@ -1,4 +1,4 @@
-#! /bin/bash
+#!/usr/bin/env bash
 
 # This script is intended as a FileCheck replacement to update the test
 # expectations in a -ast-dump test.
Index: clang/tools/diag-build/diag-build.sh
===
--- clang/tools/diag-build/diag-build.sh
+++ clang/tools/diag-build/diag-build.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # diag-build: a tool showing enabled warnings in a project.
 #


Index: clang/utils/make-ast-dump-check.sh
===
--- clang/utils/make-ast-dump-check.sh
+++ clang/utils/make-ast-dump-check.sh
@@ -1,4 +1,4 @@
-#! /bin/bash
+#!/usr/bin/env bash
 
 # This script is intended as a FileCheck replacement to update the test
 # expectations in a -ast-dump test.
Index: clang/tools/diag-build/diag-build.sh
===
--- clang/tools/diag-build/diag-build.sh
+++ clang/tools/diag-build/diag-build.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # diag-build: a tool showing enabled warnings in a project.
 #
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109800: [clang] don't mark as Elidable CXXConstruct expressions used in NRVO

2021-09-19 Thread Dimitry Andric via Phabricator via cfe-commits
dim added inline comments.



Comment at: clang/lib/AST/ExprConstant.cpp:9937
+  if (E->isElidable() && !ZeroInit) {
+// FIXME: This only handles the simples case, where the source object
+//is passed directly as the first argument to the constructor.

`s/simples/simplest/`




Comment at: clang/lib/CodeGen/CGExprCXX.cpp:613
   if (getLangOpts().ElideConstructors && E->isElidable()) {
-assert(getContext().hasSameUnqualifiedType(E->getType(),
-   E->getArg(0)->getType()));
-if (E->getArg(0)->isTemporaryObject(getContext(), CD->getParent())) {
-  EmitAggExpr(E->getArg(0), Dest);
-  return;
-}
+// FIXME: This only handles the simples case, where the source object
+//is passed directly as the first argument to the constructor.

`s/simples/simplest/`



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109800

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


[PATCH] D110044: Print nullptr_t namespace qualified within std::

2021-09-19 Thread David Blaikie via Phabricator via cfe-commits
dblaikie created this revision.
dblaikie added reviewers: aaron.ballman, rtrieu.
dblaikie requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

This improves diagnostic (& important to me, DWARF) accuracy - otherwise
there could be ambiguities between "std::nullptr_t" and some user-defined
type that's /actually/ "nullptr_t" defined in the global namespace.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110044

Files:
  clang/lib/AST/Type.cpp
  clang/test/AST/ast-dump-recovery.cpp
  clang/test/Analysis/plist-diagnostics-template-record.cpp
  clang/test/CXX/drs/dr15xx.cpp
  clang/test/CXX/drs/dr6xx.cpp
  clang/test/CXX/temp/temp.arg/temp.arg.nontype/p1-11.cpp
  clang/test/CXX/temp/temp.param/p10-2a.cpp
  clang/test/OpenMP/task_affinity_messages.cpp
  clang/test/OpenMP/task_depend_messages.cpp
  clang/test/Sema/builtins-arm64-mte.c
  clang/test/Sema/format-strings-pedantic.c
  clang/test/SemaCXX/cxx0x-noexcept-expression.cpp
  clang/test/SemaCXX/cxx2a-explicit-bool.cpp
  clang/test/SemaCXX/nullability.cpp
  clang/test/SemaCXX/nullptr.cpp
  clang/test/SemaTemplate/deduction-guide.cpp
  clang/test/SemaTemplate/deduction.cpp
  clang/test/SemaTemplate/friend.cpp
  clang/test/SemaTemplate/instantiate-local-class.cpp

Index: clang/test/SemaTemplate/instantiate-local-class.cpp
===
--- clang/test/SemaTemplate/instantiate-local-class.cpp
+++ clang/test/SemaTemplate/instantiate-local-class.cpp
@@ -489,7 +489,7 @@
 namespace PR45000 {
   template 
   void f(int x = [](T x = nullptr) -> int { return x; }());
-  // expected-error@-1 {{cannot initialize a parameter of type 'int' with an rvalue of type 'nullptr_t'}}
+  // expected-error@-1 {{cannot initialize a parameter of type 'int' with an rvalue of type 'std::nullptr_t'}}
   // expected-note@-2 {{passing argument to parameter 'x' here}}
 
   void g() { f(); }
Index: clang/test/SemaTemplate/friend.cpp
===
--- clang/test/SemaTemplate/friend.cpp
+++ clang/test/SemaTemplate/friend.cpp
@@ -146,5 +146,5 @@
   template struct T { friend auto f(X*) { return nullptr; } };
   struct X1 { friend auto f(X1*); };
   template struct T;
-  int n = f((X1*)nullptr); // expected-error {{cannot initialize a variable of type 'int' with an rvalue of type 'nullptr_t'}}
+  int n = f((X1*)nullptr); // expected-error {{cannot initialize a variable of type 'int' with an rvalue of type 'std::nullptr_t'}}
 }
Index: clang/test/SemaTemplate/deduction.cpp
===
--- clang/test/SemaTemplate/deduction.cpp
+++ clang/test/SemaTemplate/deduction.cpp
@@ -313,7 +313,7 @@
   }
 
   template class X, typename T, int *P>
-void f0(X) {} // expected-note {{deduced non-type template argument does not have the same type as the corresponding template parameter ('nullptr_t' vs 'int *')}}
+void f0(X) {} // expected-note {{deduced non-type template argument does not have the same type as the corresponding template parameter ('std::nullptr_t' vs 'int *')}}
   void h0() {
 f0(X());
 f0(X()); // expected-error {{no matching function}}
Index: clang/test/SemaTemplate/deduction-guide.cpp
===
--- clang/test/SemaTemplate/deduction-guide.cpp
+++ clang/test/SemaTemplate/deduction-guide.cpp
@@ -73,7 +73,7 @@
 // CHECK: `-CXXDeductionGuideDecl {{.*}} 'auto (X) -> B'
 // CHECK:   |-TemplateArgument type 'char'
 // CHECK:   |-TemplateArgument integral 120
-// CHECK:   |-TemplateArgument type 'nullptr_t'
+// CHECK:   |-TemplateArgument type 'std::nullptr_t'
 // CHECK:   |-TemplateArgument nullptr
 // CHECK:   `-ParmVarDecl {{.*}} 'X':'X'
 // CHECK: FunctionProtoType {{.*}} 'auto (X) -> B' dependent trailing_return
Index: clang/test/SemaCXX/nullptr.cpp
===
--- clang/test/SemaCXX/nullptr.cpp
+++ clang/test/SemaCXX/nullptr.cpp
@@ -57,7 +57,7 @@
   o2(nullptr); // expected-error {{ambiguous}}
 
   // nullptr is an rvalue, null is an lvalue
-  (void)&nullptr; // expected-error {{cannot take the address of an rvalue of type 'nullptr_t'}}
+  (void)&nullptr; // expected-error {{cannot take the address of an rvalue of type 'std::nullptr_t'}}
   nullptr_t *pn = &null;
 
   // You can reinterpret_cast nullptr to an integer.
Index: clang/test/SemaCXX/nullability.cpp
===
--- clang/test/SemaCXX/nullability.cpp
+++ clang/test/SemaCXX/nullability.cpp
@@ -15,7 +15,7 @@
 // Nullability applies to all pointer types.
 typedef int (X::* _Nonnull member_function_type_1)(int);
 typedef int X::* _Nonnull member_data_type_1;
-typedef nullptr_t _Nonnull nonnull_nullptr_t; // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-point

[PATCH] D109607: [X86] Refactor GetSSETypeAtOffset to fix pr51813

2021-09-19 Thread Michael Kruse via Phabricator via cfe-commits
Meinersbur added a comment.

In D109607#3008290 , @pengfei wrote:

> By the way, does this bot send notification to authors when it fails? I 
> didn't receive this fail, so I'm not aware of it at the first time.

This is my personal staging buildbot server to park my worker until my zorg 
patches are greenlit. Hence, I disabled sending any email notification. 
However, my other one that is connected to lab.llvm.org has failed as well and 
should have sent an email: 
https://lab.llvm.org/buildbot/#/builders/102/builds/2722. Unfortunately it is 
slow and packing to many commits together, which I am trying to improve: 
D110048 

Independent of that, it seems no other builder running the test-suite on x86_64 
(there are armv7, s390x and ppc64le ones)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109607

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


[PATCH] D110037: [X86] Always check the size of SourceTy before getting the next type

2021-09-19 Thread Michael Kruse via Phabricator via cfe-commits
Meinersbur added a comment.

In D110037#3008292 , @pengfei wrote:

> What do you think?

The test-suite is an end-to-end/integration test while tests monorepository are 
unit/regression tests. They have different purposes.
(Personally, I would prefer to reduce the amount of unit/regression testing 
that can already be covered by the test-suite, but that would be a bigger story)




Comment at: clang/test/CodeGen/X86/va-arg-sse.c:2
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
 // RUN: %clang_cc1 %s -O2 -emit-llvm -o - -triple x86_64-unknown-unknown | 
FileCheck %s
 

lebedev.ri wrote:
> Please don't use `-O*` in clang irgen tests.
> This should *only* test what IR is produced by clang itself.
I agree here, testing `-O*` output will break easily with any unrelated change 
in LLVM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110037

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


[PATCH] D108560: [clang-tidy] Add support for NOLINTBEGIN ... NOLINTEND comments to suppress clang-tidy warnings over multiple lines

2021-09-19 Thread Salman Javed via Phabricator via cfe-commits
salman-javed-nz updated this revision to Diff 373483.
salman-javed-nz added a comment.

Minor update to function signatures

- Remove arguments that are not absolutely required
- Added `const`s

This really should have been incorporated in my previous patch, so sorry about 
the double notification.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108560

Files:
  clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
  clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/index.rst
  
clang-tools-extra/test/clang-tidy/infrastructure/Inputs/nolintbeginend/error_in_include.inc
  
clang-tools-extra/test/clang-tidy/infrastructure/Inputs/nolintbeginend/nolint_in_include.inc
  clang-tools-extra/test/clang-tidy/infrastructure/nolint.cpp
  
clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-without-end.cpp
  
clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-end-without-begin.cpp
  
clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-mismatched-delims.cpp
  clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend.cpp
  clang-tools-extra/test/clang-tidy/infrastructure/nolintnextline.cpp

Index: clang-tools-extra/test/clang-tidy/infrastructure/nolintnextline.cpp
===
--- clang-tools-extra/test/clang-tidy/infrastructure/nolintnextline.cpp
+++ clang-tools-extra/test/clang-tidy/infrastructure/nolintnextline.cpp
@@ -1,49 +1,51 @@
+// NOLINTNEXTLINE
 class A { A(int i); };
+
+class B { B(int i); };
 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: single-argument constructors must be marked explicit
 
 // NOLINTNEXTLINE
-class B { B(int i); };
+class C { C(int i); };
 
 // NOLINTNEXTLINE(for-some-other-check)
-class C { C(int i); };
+class D { D(int i); };
 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: single-argument constructors must be marked explicit
 
 // NOLINTNEXTLINE(*)
-class C1 { C1(int i); };
+class D1 { D1(int i); };
 
 // NOLINTNEXTLINE(not-closed-bracket-is-treated-as-skip-all
-class C2 { C2(int i); };
+class D2 { D2(int i); };
 
 // NOLINTNEXTLINE(google-explicit-constructor)
-class C3 { C3(int i); };
+class D3 { D3(int i); };
 
 // NOLINTNEXTLINE(some-check, google-explicit-constructor)
-class C4 { C4(int i); };
+class D4 { D4(int i); };
 
 // NOLINTNEXTLINE without-brackets-skip-all, another-check
-class C5 { C5(int i); };
-
+class D5 { D5(int i); };
 
 // NOLINTNEXTLINE
 
-class D { D(int i); };
+class E { E(int i); };
 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: single-argument constructors must be marked explicit
 
 // NOLINTNEXTLINE
 //
-class E { E(int i); };
+class F { F(int i); };
 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: single-argument constructors must be marked explicit
 
 #define MACRO(X) class X { X(int i); };
-MACRO(F)
+MACRO(G)
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: single-argument constructors must be marked explicit
 // NOLINTNEXTLINE
-MACRO(G)
+MACRO(H)
 
-#define MACRO_NOARG class H { H(int i); };
+#define MACRO_NOARG class I { I(int i); };
 // NOLINTNEXTLINE
 MACRO_NOARG
 
-// CHECK-MESSAGES: Suppressed 8 warnings (8 NOLINT)
+// CHECK-MESSAGES: Suppressed 9 warnings (9 NOLINT)
 
 // RUN: %check_clang_tidy %s google-explicit-constructor %t --
Index: clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend.cpp
@@ -0,0 +1,127 @@
+// RUN: %check_clang_tidy %s google-explicit-constructor %t -- --header-filter=.* -system-headers -- -isystem %S/Inputs/nolintbeginend
+
+class A { A(int i); };
+// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: single-argument constructors must be marked explicit
+
+// NOLINTBEGIN
+class B1 { B1(int i); };
+// NOLINTEND
+
+// NOLINTBEGIN
+// NOLINTEND
+// NOLINTBEGIN
+class B2 { B2(int i); };
+// NOLINTEND
+
+// NOLINTBEGIN
+// NOLINTBEGIN
+class B3 { B3(int i); };
+// NOLINTEND
+// NOLINTEND
+
+// NOLINTBEGIN
+// NOLINTBEGIN
+// NOLINTEND
+class B4 { B4(int i); };
+// NOLINTEND
+
+// NOLINTBEGIN
+// NOLINTEND
+class B5 { B5(int i); };
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: single-argument constructors must be marked explicit
+
+// NOLINTBEGIN(google-explicit-constructor)
+class C1 { C1(int i); };
+// NOLINTEND(google-explicit-constructor)
+
+// NOLINTBEGIN(*)
+class C2 { C2(int i); };
+// NOLINTEND(*)
+
+// NOLINTBEGIN(some-other-check)
+class C3 { C3(int i); };
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: single-argument constructors must be marked explicit
+// NOLINTEND(some-other-check)
+
+// NOLINTBEGIN(some-other-check, google-explicit-constructor)
+class C4 { C4(int i); };
+// NOLINTEND(some-other-check, google-explicit-constructor)
+
+// NOLINTBEGIN(some-other-check, google-explicit-constructor)
+// NOL

[PATCH] D110032: [analyzer] Move docs of SmartPtr to correct subcategory

2021-09-19 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

Absolutely.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110032

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


[PATCH] D110029: [OpenMP][Offloading] Use bitset to indicate execution mode instead of value

2021-09-19 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added inline comments.



Comment at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp:1118
+  llvm::GlobalValue::WeakAnyLinkage,
+  llvm::ConstantInt::get(CGM.Int8Ty, Mode ? 0x2 : 0x1),
+  Twine(Name, "_exec_mode"));

The magic constants need to go into OpenMPConstans.h as enum values.



Comment at: llvm/lib/Transforms/IPO/OpenMPOpt.cpp:3294
+assert(ExecModeVal & 0x1 &&
+   "Initially non-SPMD kernel has SPMD exec mode!");
+ExecMode->setInitializer(ConstantInt::get(

Same here.



Comment at: openmp/libomptarget/plugins/cuda/src/rtl.cpp:78
+  GENERIC = 0x1, // everything else
 };
 

I think you can include OpenMPConstants.h here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110029

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


[PATCH] D109727: [Driver] Remove unneeded *-suse-* triples

2021-09-19 Thread Luís Marques via Phabricator via cfe-commits
luismarques added a comment.

In D109727#3004125 , @MaskRay wrote:

> The code change of D74399  should be 
> reverted. The test can stay, but I won't think we need too many 
> riscv64-$distro-linux-gnu tests.

Makes sense. Do you want to update this patch to also remove that?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109727

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


[PATCH] D110051: [clangd] Deduplicate inlay hints

2021-09-19 Thread Nathan Ridge via Phabricator via cfe-commits
nridge created this revision.
nridge added reviewers: kadircet, sammccall.
Herald added subscribers: usaxena95, arphaman, mgrang.
nridge requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.

Duplicates can sometimes appear due to e.g. explicit template
instantiations


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110051

Files:
  clang-tools-extra/clangd/InlayHints.cpp
  clang-tools-extra/clangd/Protocol.cpp
  clang-tools-extra/clangd/Protocol.h
  clang-tools-extra/clangd/unittests/InlayHintTests.cpp


Index: clang-tools-extra/clangd/unittests/InlayHintTests.cpp
===
--- clang-tools-extra/clangd/unittests/InlayHintTests.cpp
+++ clang-tools-extra/clangd/unittests/InlayHintTests.cpp
@@ -591,6 +591,18 @@
   )cpp");
 }
 
+TEST(TypeHints, Deduplication) {
+  assertTypeHints(R"cpp(
+template 
+void foo() {
+  auto $var[[var]] = 42;
+}
+template void foo();
+template void foo();
+  )cpp",
+  ExpectedHint{": int", "var"});
+}
+
 // FIXME: Low-hanging fruit where we could omit a type hint:
 //  - auto x = TypeName(...);
 //  - auto x = (TypeName) (...);
Index: clang-tools-extra/clangd/Protocol.h
===
--- clang-tools-extra/clangd/Protocol.h
+++ clang-tools-extra/clangd/Protocol.h
@@ -1548,6 +1548,8 @@
   std::string label;
 };
 llvm::json::Value toJSON(const InlayHint &);
+bool operator==(const InlayHint &, const InlayHint &);
+bool operator<(const InlayHint &, const InlayHint &);
 
 struct ReferenceContext {
   /// Include the declaration of the current symbol.
Index: clang-tools-extra/clangd/Protocol.cpp
===
--- clang-tools-extra/clangd/Protocol.cpp
+++ clang-tools-extra/clangd/Protocol.cpp
@@ -1326,6 +1326,14 @@
   return llvm::json::Object{
   {"range", H.range}, {"kind", H.kind}, {"label", H.label}};
 }
+bool operator==(const InlayHint &A, const InlayHint &B) {
+  return std::tie(A.kind, A.range, A.label) ==
+ std::tie(B.kind, B.range, B.label);
+}
+bool operator<(const InlayHint &A, const InlayHint &B) {
+  return std::tie(A.kind, A.range, A.label) <
+ std::tie(B.kind, B.range, B.label);
+}
 
 static const char *toString(OffsetEncoding OE) {
   switch (OE) {
Index: clang-tools-extra/clangd/InlayHints.cpp
===
--- clang-tools-extra/clangd/InlayHints.cpp
+++ clang-tools-extra/clangd/InlayHints.cpp
@@ -347,6 +347,12 @@
   std::vector Results;
   InlayHintVisitor Visitor(Results, AST);
   Visitor.TraverseAST(AST.getASTContext());
+
+  // De-duplicate hints. Duplicates can sometimes occur due to e.g. explicit
+  // template instantiations.
+  std::sort(Results.begin(), Results.end());
+  Results.erase(std::unique(Results.begin(), Results.end()), Results.end());
+
   return Results;
 }
 


Index: clang-tools-extra/clangd/unittests/InlayHintTests.cpp
===
--- clang-tools-extra/clangd/unittests/InlayHintTests.cpp
+++ clang-tools-extra/clangd/unittests/InlayHintTests.cpp
@@ -591,6 +591,18 @@
   )cpp");
 }
 
+TEST(TypeHints, Deduplication) {
+  assertTypeHints(R"cpp(
+template 
+void foo() {
+  auto $var[[var]] = 42;
+}
+template void foo();
+template void foo();
+  )cpp",
+  ExpectedHint{": int", "var"});
+}
+
 // FIXME: Low-hanging fruit where we could omit a type hint:
 //  - auto x = TypeName(...);
 //  - auto x = (TypeName) (...);
Index: clang-tools-extra/clangd/Protocol.h
===
--- clang-tools-extra/clangd/Protocol.h
+++ clang-tools-extra/clangd/Protocol.h
@@ -1548,6 +1548,8 @@
   std::string label;
 };
 llvm::json::Value toJSON(const InlayHint &);
+bool operator==(const InlayHint &, const InlayHint &);
+bool operator<(const InlayHint &, const InlayHint &);
 
 struct ReferenceContext {
   /// Include the declaration of the current symbol.
Index: clang-tools-extra/clangd/Protocol.cpp
===
--- clang-tools-extra/clangd/Protocol.cpp
+++ clang-tools-extra/clangd/Protocol.cpp
@@ -1326,6 +1326,14 @@
   return llvm::json::Object{
   {"range", H.range}, {"kind", H.kind}, {"label", H.label}};
 }
+bool operator==(const InlayHint &A, const InlayHint &B) {
+  return std::tie(A.kind, A.range, A.label) ==
+ std::tie(B.kind, B.range, B.label);
+}
+bool operator<(const InlayHint &A, const InlayHint &B) {
+  return std::tie(A.kind, A.range, A.label) <
+ std::tie(B.kind, B.range, B.label);
+}
 
 static const char *toString(OffsetEncoding OE) {
   switch (OE) {
Index: clang-tools-extra/clangd/InlayHints.cpp
===
---