[PATCH] D98574: [Sparc] Define the same macros for -mcpu=v9 as GCC on Linux and the BSDs

2021-03-28 Thread John Paul Adrian Glaubitz via Phabricator via cfe-commits
glaubitz added a comment.

Gentle ping.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98574

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


[clang] 8e2f5f9 - [Driver] Simplify mips multilib path and fix comments. NFC

2021-03-28 Thread Fangrui Song via cfe-commits

Author: Fangrui Song
Date: 2021-03-28T00:30:38-07:00
New Revision: 8e2f5f95b5432a6bce14c86a7f2de67fbb5f9dfc

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

LOG: [Driver] Simplify mips multilib path and fix comments. NFC

Added: 


Modified: 
clang/lib/Driver/ToolChains/Gnu.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Gnu.cpp 
b/clang/lib/Driver/ToolChains/Gnu.cpp
index 15be200655dc..7136df94c528 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2766,15 +2766,6 @@ bool Generic_GCC::IsIntegratedAssemblerDefault() const {
   }
 }
 
-static void addMultilibsFilePaths(const Driver &D, const MultilibSet 
&Multilibs,
-  const Multilib &Multilib,
-  StringRef InstallPath,
-  ToolChain::path_list &Paths) {
-  if (const auto &PathsCallback = Multilibs.filePathsCallback())
-for (const auto &Path : PathsCallback(Multilib))
-  addPathIfExists(D, InstallPath + Path, Paths);
-}
-
 void Generic_GCC::PushPPaths(ToolChain::path_list &PPaths) {
   // Cross-compiling binutils and GCC installations (vanilla and openSUSE at
   // least) put various tools in a triple-prefixed directory off of the parent
@@ -2801,12 +2792,13 @@ void Generic_GCC::AddMultilibPaths(const Driver &D,
 const std::string &LibPath =
 std::string(GCCInstallation.getParentLibPath());
 
-// Add toolchain / multilib specific file paths.
-addMultilibsFilePaths(D, Multilibs, SelectedMultilib,
-  GCCInstallation.getInstallPath(), Paths);
-
 // Sourcery CodeBench MIPS toolchain holds some libraries under
 // a biarch-like suffix of the GCC installation.
+if (const auto &PathsCallback = Multilibs.filePathsCallback())
+  for (const auto &Path : PathsCallback(SelectedMultilib))
+addPathIfExists(D, GCCInstallation.getInstallPath() + Path, Paths);
+
+// Add lib/gcc/$triple/$version, with an optional /multilib suffix.
 addPathIfExists(
 D, GCCInstallation.getInstallPath() + SelectedMultilib.gccSuffix(),
 Paths);



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


[PATCH] D99425: [OpenCL] Fix parsing of opencl-c.h in CL 3.0

2021-03-28 Thread Kévin Petit via Phabricator via cfe-commits
kpet added a comment.

Thanks! I'll wait for a couple of days before committing then.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99425

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


[clang-tools-extra] ea2225a - [clang-tidy] Simplify readability checks to not need ignoring* matchers

2021-03-28 Thread Stephen Kelly via cfe-commits

Author: Stephen Kelly
Date: 2021-03-28T11:25:41+01:00
New Revision: ea2225a10be986d226e041d20d36dff17e78daed

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

LOG: [clang-tidy] Simplify readability checks to not need ignoring* matchers

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

Added: 


Modified: 
clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp
clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.h
clang-tools-extra/clang-tidy/readability/ElseAfterReturnCheck.cpp
clang-tools-extra/clang-tidy/readability/ElseAfterReturnCheck.h

clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp

clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.h
clang-tools-extra/clang-tidy/readability/MisleadingIndentationCheck.cpp
clang-tools-extra/clang-tidy/readability/MisleadingIndentationCheck.h
clang-tools-extra/clang-tidy/readability/NamedParameterCheck.cpp
clang-tools-extra/clang-tidy/readability/NamedParameterCheck.h
clang-tools-extra/clang-tidy/readability/NonConstParameterCheck.cpp
clang-tools-extra/clang-tidy/readability/NonConstParameterCheck.h
clang-tools-extra/clang-tidy/readability/RedundantControlFlowCheck.cpp
clang-tools-extra/clang-tidy/readability/RedundantControlFlowCheck.h
clang-tools-extra/clang-tidy/readability/SimplifySubscriptExprCheck.cpp
clang-tools-extra/clang-tidy/readability/SimplifySubscriptExprCheck.h

clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp

clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.h
clang-tools-extra/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
clang-tools-extra/clang-tidy/readability/UniqueptrDeleteReleaseCheck.h
clang-tools-extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp
clang-tools-extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.h

Removed: 




diff  --git 
a/clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp
index 2c78258078eae..fe25f7a7ccbcc 100644
--- a/clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp
@@ -105,10 +105,7 @@ void BracesAroundStatementsCheck::storeOptions(
 }
 
 void BracesAroundStatementsCheck::registerMatchers(MatchFinder *Finder) {
-  Finder->addMatcher(
-  ifStmt(unless(allOf(isConstexpr(), isInTemplateInstantiation(
-  .bind("if"),
-  this);
+  Finder->addMatcher(ifStmt().bind("if"), this);
   Finder->addMatcher(whileStmt().bind("while"), this);
   Finder->addMatcher(doStmt().bind("do"), this);
   Finder->addMatcher(forStmt().bind("for"), this);

diff  --git 
a/clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.h 
b/clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.h
index 7c019c6cb5521..1270cfe10d193 100644
--- a/clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.h
+++ b/clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.h
@@ -55,6 +55,9 @@ class BracesAroundStatementsCheck : public ClangTidyCheck {
   template 
   SourceLocation findRParenLoc(const IfOrWhileStmt *S, const SourceManager &SM,
const ASTContext *Context);
+  llvm::Optional getCheckTraversalKind() const override {
+return TK_IgnoreUnlessSpelledInSource;
+  }
 
 private:
   std::set ForceBracesStmts;

diff  --git a/clang-tools-extra/clang-tidy/readability/ElseAfterReturnCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/ElseAfterReturnCheck.cpp
index 89bb02e78cc63..0558b41016379 100644
--- a/clang-tools-extra/clang-tidy/readability/ElseAfterReturnCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/ElseAfterReturnCheck.cpp
@@ -171,8 +171,7 @@ void ElseAfterReturnCheck::registerPPCallbacks(const 
SourceManager &SM,
 void ElseAfterReturnCheck::registerMatchers(MatchFinder *Finder) {
   const auto InterruptsControlFlow = stmt(anyOf(
   returnStmt().bind(InterruptingStr), continueStmt().bind(InterruptingStr),
-  breakStmt().bind(InterruptingStr),
-  expr(ignoringImplicit(cxxThrowExpr().bind(InterruptingStr);
+  breakStmt().bind(InterruptingStr), 
cxxThrowExpr().bind(InterruptingStr)));
   Finder->addMatcher(
   compoundStmt(
   forEach(ifStmt(unless(isConstexpr()),

diff  --git a/clang-tools-extra/clang-tidy/readability/ElseAfterReturnCheck.h 
b/clang-tools-extra/clang-tidy/readability/ElseAfterReturnCheck.h
index 440cf4b637b73..d3fbc0ac0abe0 100644
--- a/clang-tools-extra/clang-tidy/readability/ElseAfterReturnCheck.h
++

[PATCH] D98296: [clang-tidy] Simplify readability checks to not need ignoring* matchers

2021-03-28 Thread Stephen Kelly via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGea2225a10be9: [clang-tidy] Simplify readability checks to 
not need ignoring* matchers (authored by stephenkelly).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98296

Files:
  clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp
  clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.h
  clang-tools-extra/clang-tidy/readability/ElseAfterReturnCheck.cpp
  clang-tools-extra/clang-tidy/readability/ElseAfterReturnCheck.h
  
clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp
  
clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.h
  clang-tools-extra/clang-tidy/readability/MisleadingIndentationCheck.cpp
  clang-tools-extra/clang-tidy/readability/MisleadingIndentationCheck.h
  clang-tools-extra/clang-tidy/readability/NamedParameterCheck.cpp
  clang-tools-extra/clang-tidy/readability/NamedParameterCheck.h
  clang-tools-extra/clang-tidy/readability/NonConstParameterCheck.cpp
  clang-tools-extra/clang-tidy/readability/NonConstParameterCheck.h
  clang-tools-extra/clang-tidy/readability/RedundantControlFlowCheck.cpp
  clang-tools-extra/clang-tidy/readability/RedundantControlFlowCheck.h
  clang-tools-extra/clang-tidy/readability/SimplifySubscriptExprCheck.cpp
  clang-tools-extra/clang-tidy/readability/SimplifySubscriptExprCheck.h
  
clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp
  clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.h
  clang-tools-extra/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
  clang-tools-extra/clang-tidy/readability/UniqueptrDeleteReleaseCheck.h
  clang-tools-extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp
  clang-tools-extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.h

Index: clang-tools-extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.h
===
--- clang-tools-extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.h
+++ clang-tools-extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.h
@@ -28,6 +28,9 @@
   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
   void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
+  llvm::Optional getCheckTraversalKind() const override {
+return TK_IgnoreUnlessSpelledInSource;
+  }
 
 private:
   template 
Index: clang-tools-extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp
===
--- clang-tools-extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp
+++ clang-tools-extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp
@@ -196,12 +196,11 @@
   // Sadly, we can't check whether the literal has suffix or not.
   // E.g. i32 suffix still results in 'BuiltinType::Kind::Int'.
   // And such an info is not stored in the *Literal itself.
-  Finder->addMatcher(traverse(TK_AsIs,
+  Finder->addMatcher(
   stmt(eachOf(integerLiteral().bind(IntegerLiteralCheck::Name),
   floatLiteral().bind(FloatingLiteralCheck::Name)),
unless(anyOf(hasParent(userDefinedLiteral()),
-hasAncestor(isImplicit()),
-hasAncestor(substNonTypeTemplateParmExpr()),
+hasAncestor(substNonTypeTemplateParmExpr(),
   this);
 }
 
Index: clang-tools-extra/clang-tidy/readability/UniqueptrDeleteReleaseCheck.h
===
--- clang-tools-extra/clang-tidy/readability/UniqueptrDeleteReleaseCheck.h
+++ clang-tools-extra/clang-tidy/readability/UniqueptrDeleteReleaseCheck.h
@@ -26,6 +26,9 @@
   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
   void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
+  llvm::Optional getCheckTraversalKind() const override {
+return TK_IgnoreUnlessSpelledInSource;
+  }
 
 private:
   const bool PreferResetCall;
Index: clang-tools-extra/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
===
--- clang-tools-extra/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
+++ clang-tools-extra/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
@@ -39,17 +39,14 @@
   Finder->addMatcher(
   cxxDeleteExpr(
   unless(isInTemplateInstantiation()),
-  has(expr(ignoringParenImpCasts(
-  cxxMemberCallExpr(
-  callee(
-  memberExpr(hasObjectExpression(allOf(
- unless(isTypeDependent()),
- an

[PATCH] D99465: [Clang][X86] Mark some VAES builtins as conditionally defined

2021-03-28 Thread LemonBoy via Phabricator via cfe-commits
LemonBoy created this revision.
LemonBoy added a reviewer: craig.topper.
LemonBoy requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

AMD Zen3 architecture supports the VAES instruction set but not the 512bit 
variants, add a feature gate on __AVX512F__ to avoid raising a compile error 
(due to `__m512i` being undefined) whenever a user imports the intrinsic module.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99465

Files:
  clang/lib/Headers/vaesintrin.h


Index: clang/lib/Headers/vaesintrin.h
===
--- clang/lib/Headers/vaesintrin.h
+++ clang/lib/Headers/vaesintrin.h
@@ -28,13 +28,6 @@
   (__v4di) __B);
 }
 
-static __inline__ __m512i __DEFAULT_FN_ATTRS_F
- _mm512_aesenc_epi128(__m512i __A, __m512i __B)
-{
-  return (__m512i) __builtin_ia32_aesenc512((__v8di) __A,
-  (__v8di) __B);
-}
-
 static __inline__ __m256i __DEFAULT_FN_ATTRS
  _mm256_aesdec_epi128(__m256i __A, __m256i __B)
 {
@@ -42,13 +35,6 @@
   (__v4di) __B);
 }
 
-static __inline__ __m512i __DEFAULT_FN_ATTRS_F
- _mm512_aesdec_epi128(__m512i __A, __m512i __B)
-{
-  return (__m512i) __builtin_ia32_aesdec512((__v8di) __A,
-  (__v8di) __B);
-}
-
 static __inline__ __m256i __DEFAULT_FN_ATTRS
  _mm256_aesenclast_epi128(__m256i __A, __m256i __B)
 {
@@ -56,13 +42,6 @@
   (__v4di) __B);
 }
 
-static __inline__ __m512i __DEFAULT_FN_ATTRS_F
- _mm512_aesenclast_epi128(__m512i __A, __m512i __B)
-{
-  return (__m512i) __builtin_ia32_aesenclast512((__v8di) __A,
-  (__v8di) __B);
-}
-
 static __inline__ __m256i __DEFAULT_FN_ATTRS
  _mm256_aesdeclast_epi128(__m256i __A, __m256i __B)
 {
@@ -70,6 +49,29 @@
   (__v4di) __B);
 }
 
+#ifdef __AVX512F__
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS_F
+ _mm512_aesenc_epi128(__m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_aesenc512((__v8di) __A,
+  (__v8di) __B);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS_F
+ _mm512_aesdec_epi128(__m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_aesdec512((__v8di) __A,
+  (__v8di) __B);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS_F
+ _mm512_aesenclast_epi128(__m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_aesenclast512((__v8di) __A,
+  (__v8di) __B);
+}
+
 static __inline__ __m512i __DEFAULT_FN_ATTRS_F
  _mm512_aesdeclast_epi128(__m512i __A, __m512i __B)
 {
@@ -77,6 +79,7 @@
   (__v8di) __B);
 }
 
+#endif /* __AVX512F__ */
 
 #undef __DEFAULT_FN_ATTRS
 #undef __DEFAULT_FN_ATTRS_F


Index: clang/lib/Headers/vaesintrin.h
===
--- clang/lib/Headers/vaesintrin.h
+++ clang/lib/Headers/vaesintrin.h
@@ -28,13 +28,6 @@
   (__v4di) __B);
 }
 
-static __inline__ __m512i __DEFAULT_FN_ATTRS_F
- _mm512_aesenc_epi128(__m512i __A, __m512i __B)
-{
-  return (__m512i) __builtin_ia32_aesenc512((__v8di) __A,
-  (__v8di) __B);
-}
-
 static __inline__ __m256i __DEFAULT_FN_ATTRS
  _mm256_aesdec_epi128(__m256i __A, __m256i __B)
 {
@@ -42,13 +35,6 @@
   (__v4di) __B);
 }
 
-static __inline__ __m512i __DEFAULT_FN_ATTRS_F
- _mm512_aesdec_epi128(__m512i __A, __m512i __B)
-{
-  return (__m512i) __builtin_ia32_aesdec512((__v8di) __A,
-  (__v8di) __B);
-}
-
 static __inline__ __m256i __DEFAULT_FN_ATTRS
  _mm256_aesenclast_epi128(__m256i __A, __m256i __B)
 {
@@ -56,13 +42,6 @@
   (__v4di) __B);
 }
 
-static __inline__ __m512i __DEFAULT_FN_ATTRS_F
- _mm512_aesenclast_epi128(__m512i __A, __m512i __B)
-{
-  return (__m512i) __builtin_ia32_aesenclast512((__v8di) __A,
-  (__v8di) __B);
-}
-
 static __inline__ __m256i __DEFAULT_FN_ATTRS
  _mm256_aesdeclast_epi128(__m256i __A, __m256i __B)
 {
@@ -70,6 +49,29 @@
   (__v4di) __B);
 }
 
+#ifdef __AVX512F__
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS_F
+ _mm512_aesenc_epi128(__m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_aesenc512((__v8di) __A,
+  (__v8di) __B);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS_F
+ _mm512_aesdec_epi128(__m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_aesdec512((__v8di) __A,
+  (__v8di) __B);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS_F
+ _mm512_aesenclast_epi128(__m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_aesenclast512((__v8di) __A,
+  (__v8di) __B);
+}
+
 static __inline__ __m512i __DEFAULT_FN_ATTRS_F
  _mm512_aesdeclast_epi128(__m512i __A, __m512i __B)
 {
@@ -77,6 +79,7 @@
   (__v8di) __B);
 }
 
+#endif /* __AVX512F__ */
 
 #undef __DEFAULT_FN_ATTRS
 #undef __DEFAULT_FN_ATTRS_F
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99466: Fix PR48889: assertion failure for void() in flattened ternary expression

2021-03-28 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert created this revision.
aaronpuchert added a reviewer: rsmith.
aaronpuchert requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

We treat the expression void() as CXXScalarValueInitExpr for historic
reasons probably, but void isn't a scalar type. The current standard
considers this a functional cast expression, where void is explicitly
exempted from initialization.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99466

Files:
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/test/CodeGenCXX/value-init.cpp


Index: clang/test/CodeGenCXX/value-init.cpp
===
--- clang/test/CodeGenCXX/value-init.cpp
+++ clang/test/CodeGenCXX/value-init.cpp
@@ -338,4 +338,12 @@
   struct optional : optional_data_dtor_base, optional_assign_base {};
   optional f(optional a) { return {optional(a)}; }
 }
+
+namespace PR48889 {
+  // Just make sure we don't hit an assertion, the IR is otherwise unchanged.
+  constexpr void f() {}
+  void g(bool b) {
+return b ? f() : void();
+  }
+}
 #endif
Index: clang/lib/CodeGen/CGExprScalar.cpp
===
--- clang/lib/CodeGen/CGExprScalar.cpp
+++ clang/lib/CodeGen/CGExprScalar.cpp
@@ -463,7 +463,10 @@
 return llvm::ConstantInt::get(ConvertType(E->getType()), E->getValue());
   }
   Value *VisitCXXScalarValueInitExpr(const CXXScalarValueInitExpr *E) {
-return EmitNullValue(E->getType());
+// [expr.type.conv]: if the type is cv void and the initializer is () or 
{},
+// the expression is a prvalue of type void that performs no 
initialization.
+QualType T = E->getType();
+return T->isVoidType() ? nullptr : EmitNullValue(E->getType());
   }
   Value *VisitGNUNullExpr(const GNUNullExpr *E) {
 return EmitNullValue(E->getType());


Index: clang/test/CodeGenCXX/value-init.cpp
===
--- clang/test/CodeGenCXX/value-init.cpp
+++ clang/test/CodeGenCXX/value-init.cpp
@@ -338,4 +338,12 @@
   struct optional : optional_data_dtor_base, optional_assign_base {};
   optional f(optional a) { return {optional(a)}; }
 }
+
+namespace PR48889 {
+  // Just make sure we don't hit an assertion, the IR is otherwise unchanged.
+  constexpr void f() {}
+  void g(bool b) {
+return b ? f() : void();
+  }
+}
 #endif
Index: clang/lib/CodeGen/CGExprScalar.cpp
===
--- clang/lib/CodeGen/CGExprScalar.cpp
+++ clang/lib/CodeGen/CGExprScalar.cpp
@@ -463,7 +463,10 @@
 return llvm::ConstantInt::get(ConvertType(E->getType()), E->getValue());
   }
   Value *VisitCXXScalarValueInitExpr(const CXXScalarValueInitExpr *E) {
-return EmitNullValue(E->getType());
+// [expr.type.conv]: if the type is cv void and the initializer is () or {},
+// the expression is a prvalue of type void that performs no initialization.
+QualType T = E->getType();
+return T->isVoidType() ? nullptr : EmitNullValue(E->getType());
   }
   Value *VisitGNUNullExpr(const GNUNullExpr *E) {
 return EmitNullValue(E->getType());
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D98548: [clang][Sema] Don't try to initialize implicit variable of invalid anonymous union/struct

2021-03-28 Thread Ta-Wei Tu via Phabricator via cfe-commits
TaWeiTu added a comment.

ping.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98548

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


[PATCH] D99466: Fix PR48889: assertion failure for void() in flattened ternary expression

2021-03-28 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert updated this revision to Diff 333719.
aaronpuchert added a comment.

Replace `E->getType()` argument by `T`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99466

Files:
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/test/CodeGenCXX/value-init.cpp


Index: clang/test/CodeGenCXX/value-init.cpp
===
--- clang/test/CodeGenCXX/value-init.cpp
+++ clang/test/CodeGenCXX/value-init.cpp
@@ -338,4 +338,12 @@
   struct optional : optional_data_dtor_base, optional_assign_base {};
   optional f(optional a) { return {optional(a)}; }
 }
+
+namespace PR48889 {
+  // Just make sure we don't hit an assertion, the IR is otherwise unchanged.
+  constexpr void f() {}
+  void g(bool b) {
+return b ? f() : void();
+  }
+}
 #endif
Index: clang/lib/CodeGen/CGExprScalar.cpp
===
--- clang/lib/CodeGen/CGExprScalar.cpp
+++ clang/lib/CodeGen/CGExprScalar.cpp
@@ -463,7 +463,10 @@
 return llvm::ConstantInt::get(ConvertType(E->getType()), E->getValue());
   }
   Value *VisitCXXScalarValueInitExpr(const CXXScalarValueInitExpr *E) {
-return EmitNullValue(E->getType());
+// [expr.type.conv]: if the type is cv void and the initializer is () or 
{},
+// the expression is a prvalue of type void that performs no 
initialization.
+QualType T = E->getType();
+return T->isVoidType() ? nullptr : EmitNullValue(T);
   }
   Value *VisitGNUNullExpr(const GNUNullExpr *E) {
 return EmitNullValue(E->getType());


Index: clang/test/CodeGenCXX/value-init.cpp
===
--- clang/test/CodeGenCXX/value-init.cpp
+++ clang/test/CodeGenCXX/value-init.cpp
@@ -338,4 +338,12 @@
   struct optional : optional_data_dtor_base, optional_assign_base {};
   optional f(optional a) { return {optional(a)}; }
 }
+
+namespace PR48889 {
+  // Just make sure we don't hit an assertion, the IR is otherwise unchanged.
+  constexpr void f() {}
+  void g(bool b) {
+return b ? f() : void();
+  }
+}
 #endif
Index: clang/lib/CodeGen/CGExprScalar.cpp
===
--- clang/lib/CodeGen/CGExprScalar.cpp
+++ clang/lib/CodeGen/CGExprScalar.cpp
@@ -463,7 +463,10 @@
 return llvm::ConstantInt::get(ConvertType(E->getType()), E->getValue());
   }
   Value *VisitCXXScalarValueInitExpr(const CXXScalarValueInitExpr *E) {
-return EmitNullValue(E->getType());
+// [expr.type.conv]: if the type is cv void and the initializer is () or {},
+// the expression is a prvalue of type void that performs no initialization.
+QualType T = E->getType();
+return T->isVoidType() ? nullptr : EmitNullValue(T);
   }
   Value *VisitGNUNullExpr(const GNUNullExpr *E) {
 return EmitNullValue(E->getType());
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 581b429 - Update the documentation for recent changes to statement attributes.

2021-03-28 Thread Aaron Ballman via cfe-commits

Author: Aaron Ballman
Date: 2021-03-28T09:54:36-04:00
New Revision: 581b429f7d416709f5c78338828beb705bedb396

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

LOG: Update the documentation for recent changes to statement attributes.

Adds more information about automated diagnostic reporting for statement
attributes and adds a bit more documentation about statement attributes
in general.

Added: 


Modified: 
clang/docs/InternalsManual.rst

Removed: 




diff  --git a/clang/docs/InternalsManual.rst b/clang/docs/InternalsManual.rst
index 32c8f2dad5aa6..a547154721e9e 100644
--- a/clang/docs/InternalsManual.rst
+++ b/clang/docs/InternalsManual.rst
@@ -2795,12 +2795,14 @@ implementing a keyword attribute, the parsing of the 
keyword and creation of the
 ``ParsedAttr`` object must be done manually.
 
 Eventually, ``Sema::ProcessDeclAttributeList()`` is called with a ``Decl`` and
-an ``ParsedAttr``, at which point the parsed attribute can be transformed
+a ``ParsedAttr``, at which point the parsed attribute can be transformed
 into a semantic attribute. The process by which a parsed attribute is converted
 into a semantic attribute depends on the attribute definition and semantic
 requirements of the attribute. The end result, however, is that the semantic
 attribute object is attached to the ``Decl`` object, and can be obtained by a
-call to ``Decl::getAttr()``.
+call to ``Decl::getAttr()``. Similarly, for statement attributes,
+``Sema::ProcessStmtAttributes()`` is called with a ``Stmt`` a list of
+``ParsedAttr`` objects to be converted into a semantic attribute.
 
 The structure of the semantic attribute is also governed by the attribute
 definition given in Attr.td. This definition is used to automatically generate
@@ -2820,12 +2822,13 @@ semantic) type, or one of its derivatives. Most 
attributes will derive from the
 later redeclarations of the ``Decl`` it is associated with.
 ``InheritableParamAttr`` is similar to ``InheritableAttr``, except that the
 attribute is written on a parameter instead of a declaration. If the attribute
-is intended to apply to a type instead of a declaration, such an attribute
-should derive from ``TypeAttr``, and will generally not be given an AST
-representation. (Note that this document does not cover the creation of type
-attributes.) An attribute that inherits from ``IgnoredAttr`` is parsed, but 
will
-generate an ignored attribute diagnostic when used, which may be useful when an
-attribute is supported by another vendor but not supported by clang.
+applies to statements, it should inherit from ``StmtAttr`. If the attribute is
+intended to apply to a type instead of a declaration, such an attribute should
+derive from ``TypeAttr``, and will generally not be given an AST 
representation.
+(Note that this document does not cover the creation of type attributes.) An
+attribute that inherits from ``IgnoredAttr`` is parsed, but will generate an
+ignored attribute diagnostic when used, which may be useful when an attribute 
is
+supported by another vendor but not supported by clang.
 
 The definition will specify several key pieces of information, such as the
 semantic name of the attribute, the spellings the attribute supports, the
@@ -2854,10 +2857,11 @@ are created implicitly. The following spellings are 
accepted:
   ``Declspec``  Spelled with a Microsoft-style ``__declspec(attr)`` syntax.
   ``Keyword``   The attribute is spelled as a keyword, and required custom
 parsing.
-  ``GCC``   Specifies two spellings: the first is a GNU-style spelling, and
-the second is a C++-style spelling with the ``gnu`` namespace.
-Attributes should only specify this spelling for attributes
-supported by GCC.
+  ``GCC``   Specifies two or three spellings: the first is a GNU-style
+spelling, the second is a C++-style spelling with the ``gnu``
+namespace, and the third is an optional C-style spelling with
+the ``gnu`` namespace. Attributes should only specify this
+spelling for attributes supported by GCC.
   ``Clang`` Specifies two or three spellings: the first is a GNU-style
 spelling, the second is a C++-style spelling with the ``clang``
 namespace, and the third is an optional C-style spelling with
@@ -2871,19 +2875,16 @@ are created implicitly. The following spellings are 
accepted:
 
 Subjects
 
-Attributes appertain to one or more ``Decl`` subjects. If the attribute 
attempts
-to attach to a subject that is not in the subject list, a diagnostic is issued
+Attributes appertain to one or more subjects. If the attribute attempts to 
+attach to a subject that is not in the subject list, a

[clang] c5243c6 - [clang-format] Fix aligning with linebreaks

2021-03-28 Thread Björn Schäpers via cfe-commits

Author: Björn Schäpers
Date: 2021-03-28T16:26:27+02:00
New Revision: c5243c63cda3c740d6e9c7e501f6518c21688da3

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

LOG: [clang-format] Fix aligning with linebreaks

Breaking a string literal or a function calls arguments with
AlignConsecutiveDeclarations or AlignConsecutiveAssignments did misalign
the continued line. E.g.:

void foo() {
  int myVar = 5;
  double x  = 3.14;
  auto str  = "Hello"
"World";
}

or

void foo() {
  intmyVar = 5;
  double x = 3.14;
  auto   str = "Hello"
 "World";
}

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

Added: 


Modified: 
clang/lib/Format/WhitespaceManager.cpp
clang/unittests/Format/FormatTest.cpp

Removed: 




diff  --git a/clang/lib/Format/WhitespaceManager.cpp 
b/clang/lib/Format/WhitespaceManager.cpp
index ac68fe0aa01af..6016f8d131c74 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/lib/Format/WhitespaceManager.cpp
@@ -278,6 +278,14 @@ AlignTokenSequence(unsigned Start, unsigned End, unsigned 
Column, F &&Matches,
   //  double z);
   // In the above example, we need to take special care to ensure that
   // 'double z' is indented along with it's owning function 'b'.
+  // The same holds for calling a function:
+  //   double a = foo(x);
+  //   intb = bar(foo(y),
+  //foor(z));
+  // Similar for broken string literals:
+  //   double x = 3.14;
+  //   auto s   = "Hello"
+  //  "World";
   // Special handling is required for 'nested' ternary operators.
   SmallVector ScopeStack;
 
@@ -298,8 +306,12 @@ AlignTokenSequence(unsigned Start, unsigned End, unsigned 
Column, F &&Matches,
   ScopeStack.push_back(i);
 
 bool InsideNestedScope = ScopeStack.size() != 0;
+bool ContinuedStringLiteral = i > Start &&
+  Changes[i].Tok->is(tok::string_literal) &&
+  Changes[i - 1].Tok->is(tok::string_literal);
+bool SkipMatchCheck = InsideNestedScope || ContinuedStringLiteral;
 
-if (Changes[i].NewlinesBefore > 0 && !InsideNestedScope) {
+if (Changes[i].NewlinesBefore > 0 && !SkipMatchCheck) {
   Shift = 0;
   FoundMatchOnLine = false;
 }
@@ -307,7 +319,7 @@ AlignTokenSequence(unsigned Start, unsigned End, unsigned 
Column, F &&Matches,
 // If this is the first matching token to be aligned, remember by how many
 // spaces it has to be shifted, so the rest of the changes on the line are
 // shifted by the same amount
-if (!FoundMatchOnLine && !InsideNestedScope && Matches(Changes[i])) {
+if (!FoundMatchOnLine && !SkipMatchCheck && Matches(Changes[i])) {
   FoundMatchOnLine = true;
   Shift = Column - Changes[i].StartOfTokenColumn;
   Changes[i].Spaces += Shift;
@@ -317,15 +329,41 @@ AlignTokenSequence(unsigned Start, unsigned End, unsigned 
Column, F &&Matches,
 // as mentioned in the ScopeStack comment.
 if (InsideNestedScope && Changes[i].NewlinesBefore > 0) {
   unsigned ScopeStart = ScopeStack.back();
-  if (Changes[ScopeStart - 1].Tok->is(TT_FunctionDeclarationName) ||
-  (ScopeStart > Start + 1 &&
-   Changes[ScopeStart - 2].Tok->is(TT_FunctionDeclarationName)) ||
-  Changes[i].Tok->is(TT_ConditionalExpr) ||
-  (Changes[i].Tok->Previous &&
-   Changes[i].Tok->Previous->is(TT_ConditionalExpr)))
+  auto ShouldShiftBeAdded = [&] {
+// Function declaration
+if (Changes[ScopeStart - 1].Tok->is(TT_FunctionDeclarationName))
+  return true;
+
+// Continued function declaration
+if (ScopeStart > Start + 1 &&
+Changes[ScopeStart - 2].Tok->is(TT_FunctionDeclarationName))
+  return true;
+
+// Continued function call
+if (ScopeStart > Start + 1 &&
+Changes[ScopeStart - 2].Tok->is(tok::identifier) &&
+Changes[ScopeStart - 1].Tok->is(tok::l_paren))
+  return true;
+
+// Ternary operator
+if (Changes[i].Tok->is(TT_ConditionalExpr))
+  return true;
+
+// Continued ternary operator
+if (Changes[i].Tok->Previous &&
+Changes[i].Tok->Previous->is(TT_ConditionalExpr))
+  return true;
+
+return false;
+  };
+
+  if (ShouldShiftBeAdded())
 Changes[i].Spaces += Shift;
 }
 
+if (ContinuedStringLiteral)
+  Changes[i].Spaces += Shift;
+
 assert(Shift >= 0);
 Changes[i].StartOfTokenColumn += Shift;
 if (i + 1 != Changes.size())
@@ -434,7 +472,10 @@ static unsigned AlignTokens(
 AlignCurrentSequence();
 
   // A new line starts, re-initialize line status tracking bools.
-  FoundMatchOnLine = false;
+  // Keep the match state 

[PATCH] D98214: [clang-format] Fix aligning with linebreaks

2021-03-28 Thread Björn Schäpers 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 rGc5243c63cda3: [clang-format] Fix aligning with linebreaks 
(authored by HazardyKnusperkeks).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98214

Files:
  clang/lib/Format/WhitespaceManager.cpp
  clang/unittests/Format/FormatTest.cpp

Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -14297,6 +14297,102 @@
Alignment);
 }
 
+TEST_F(FormatTest, AlignWithLineBreaks) {
+  auto Style = getLLVMStyleWithColumns(120);
+
+  EXPECT_EQ(Style.AlignConsecutiveAssignments, FormatStyle::ACS_None);
+  EXPECT_EQ(Style.AlignConsecutiveDeclarations, FormatStyle::ACS_None);
+  verifyFormat("void foo() {\n"
+   "  int myVar = 5;\n"
+   "  double x = 3.14;\n"
+   "  auto str = \"Hello \"\n"
+   " \"World\";\n"
+   "  auto s = \"Hello \"\n"
+   "   \"Again\";\n"
+   "}",
+   Style);
+
+  // clang-format off
+  verifyFormat("void foo() {\n"
+   "  const int capacityBefore = Entries.capacity();\n"
+   "  const auto newEntry = Entries.emplaceHint(std::piecewise_construct, std::forward_as_tuple(uniqueId),\n"
+   "std::forward_as_tuple(id, uniqueId, name, threadCreation));\n"
+   "  const X newEntry2 = Entries.emplaceHint(std::piecewise_construct, std::forward_as_tuple(uniqueId),\n"
+   "  std::forward_as_tuple(id, uniqueId, name, threadCreation));\n"
+   "}",
+   Style);
+  // clang-format on
+
+  Style.AlignConsecutiveAssignments = FormatStyle::ACS_Consecutive;
+  verifyFormat("void foo() {\n"
+   "  int myVar = 5;\n"
+   "  double x  = 3.14;\n"
+   "  auto str  = \"Hello \"\n"
+   "  \"World\";\n"
+   "  auto s= \"Hello \"\n"
+   "  \"Again\";\n"
+   "}",
+   Style);
+
+  // clang-format off
+  verifyFormat("void foo() {\n"
+   "  const int capacityBefore = Entries.capacity();\n"
+   "  const auto newEntry  = Entries.emplaceHint(std::piecewise_construct, std::forward_as_tuple(uniqueId),\n"
+   " std::forward_as_tuple(id, uniqueId, name, threadCreation));\n"
+   "  const X newEntry2= Entries.emplaceHint(std::piecewise_construct, std::forward_as_tuple(uniqueId),\n"
+   " std::forward_as_tuple(id, uniqueId, name, threadCreation));\n"
+   "}",
+   Style);
+  // clang-format on
+
+  Style.AlignConsecutiveAssignments = FormatStyle::ACS_None;
+  Style.AlignConsecutiveDeclarations = FormatStyle::ACS_Consecutive;
+  verifyFormat("void foo() {\n"
+   "  intmyVar = 5;\n"
+   "  double x = 3.14;\n"
+   "  auto   str = \"Hello \"\n"
+   "   \"World\";\n"
+   "  auto   s = \"Hello \"\n"
+   " \"Again\";\n"
+   "}",
+   Style);
+
+  // clang-format off
+  verifyFormat("void foo() {\n"
+   "  const int  capacityBefore = Entries.capacity();\n"
+   "  const auto newEntry = Entries.emplaceHint(std::piecewise_construct, std::forward_as_tuple(uniqueId),\n"
+   "std::forward_as_tuple(id, uniqueId, name, threadCreation));\n"
+   "  const XnewEntry2 = Entries.emplaceHint(std::piecewise_construct, std::forward_as_tuple(uniqueId),\n"
+   " std::forward_as_tuple(id, uniqueId, name, threadCreation));\n"
+   "}",
+   Style);
+  // clang-format on
+
+  Style.AlignConsecutiveAssignments = FormatStyle::ACS_Consecutive;
+  Style.AlignConsecutiveDeclarations = FormatStyle::ACS_Consecutive;
+
+  verifyFormat("void foo() {\n"
+   "  intmyVar = 5;\n"
+   "  double x = 3.14;\n"
+   "  auto   str   = \"Hello \"\n"
+   " \"World\";\n"
+   "  auto   s = \"Hello \"\n"
+   " \"Again\";\n"
+   "}",
+   Style);
+
+  // clang-format off
+  verifyFormat("void foo() {\n"
+   "  const int  capacityBefore = Entries.capacity();\n"
+   "  const auto newEntry   = Entries.emplaceHint(std::piecewise_construct, std::forward_as_tuple(uniqueId),\n

[PATCH] D83660: [analyzer] Fix a crash for dereferencing an empty llvm::Optional variable in SMTConstraintManager.h.

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

Lets see what others think about this.
Im fine with it on my part.


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

https://reviews.llvm.org/D83660

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


[PATCH] D98146: OpaquePtr: Turn inalloca into a type attribute

2021-03-28 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm closed this revision.
arsenm added a comment.

4fefed65637ec46c8c2edad6b07b5569ac61e9e5


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

https://reviews.llvm.org/D98146

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


[PATCH] D69218: [ASTMatchers] Add `cxxBaseSpecifier` matcher (non-top-level)

2021-03-28 Thread Stephen Kelly via Phabricator via cfe-commits
steveire added a comment.

@nick Sorry that getting these changes merged takes so long.

@njames93 If you have an alternative way forward, please let us know what it is.

Otherwise, this LGTM too and we should merge it soon unless there are 
objections which haven't been addressed.




Comment at: clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp:301
+TEST_F(RegistryTest, CXXBaseSpecifier) {
+  // TODO: rewrite with top-level cxxBaseSpecifier matcher when available
+  DeclarationMatcher ClassHasAnyDirectBase =

@nick Is this implemented in another MR? I don't see anything in your list of 
revisions. I think this is reasonable as is, but wondering if you intend to 
implement the top-level support too.


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

https://reviews.llvm.org/D69218

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


[PATCH] D69218: [ASTMatchers] Add `cxxBaseSpecifier` matcher (non-top-level)

2021-03-28 Thread Stephen Kelly via Phabricator via cfe-commits
steveire added a comment.

@nick I think this also might need to be rebased again, sorry.


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

https://reviews.llvm.org/D69218

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


[PATCH] D99189: [RISCV][Clang] Update new overloading rules for RVV intrinsics.

2021-03-28 Thread Zakk Chen via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG821547cabb58: [RISCV][Clang] Update new overloading rules 
for RVV intrinsics. (authored by khchen).

Changed prior to commit:
  https://reviews.llvm.org/D99189?vs=333486&id=333727#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99189

Files:
  clang/include/clang/Basic/riscv_vector.td
  clang/lib/Headers/CMakeLists.txt
  clang/test/CodeGen/RISCV/rvv-intrinsics-generic/vadd.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-generic/vfadd.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vadd.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vfadd.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vle.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vloxei.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vluxei.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vse.c
  clang/utils/TableGen/RISCVVEmitter.cpp
  clang/utils/TableGen/TableGen.cpp
  clang/utils/TableGen/TableGenBackends.h
  llvm/docs/CommandGuide/tblgen.rst
  llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn

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


[PATCH] D99465: [Clang][X86] Mark some VAES builtins as conditionally defined

2021-03-28 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added a comment.

We can't use preprocessor defines in the intrinsic header files. It prevents 
being able to use the intrinsics with attribute(target("avx512f,vaes")). What's 
preventing __m512i from being defined?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99465

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


[PATCH] D99465: [Clang][X86] Mark some VAES builtins as conditionally defined

2021-03-28 Thread LemonBoy via Phabricator via cfe-commits
LemonBoy added a comment.

In D99465#2654633 , @craig.topper 
wrote:

> We can't use preprocessor defines in the intrinsic header files. It prevents 
> being able to use the intrinsics with attribute(target("avx512f,vaes")). 
> What's preventing __m512i from being defined?

`__VAES__` is defined but `__AVX512F__` is not hence `avx512fintrin.h` is never 
included in `immintrin.h`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99465

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


[clang] 3fb40ce - [X86] Don't define vpclmulqdq or vaes intrinsics in the headers unless avx512fintrin.h has been included.

2021-03-28 Thread Craig Topper via cfe-commits

Author: Craig Topper
Date: 2021-03-28T11:26:30-07:00
New Revision: 3fb40ce167ff5f05afadf8f525ff9e17350d6d7f

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

LOG: [X86] Don't define vpclmulqdq or vaes intrinsics in the headers unless 
avx512fintrin.h has been included.

The intrinsics won't compile unless avx512fintrin.h has declared
the 512 bit types.

Added: 


Modified: 
clang/lib/Headers/immintrin.h
clang/lib/Headers/vaesintrin.h
clang/lib/Headers/vpclmulqdqintrin.h

Removed: 




diff  --git a/clang/lib/Headers/immintrin.h b/clang/lib/Headers/immintrin.h
index 22f7a520c929..56d3dadf6a33 100644
--- a/clang/lib/Headers/immintrin.h
+++ b/clang/lib/Headers/immintrin.h
@@ -72,11 +72,6 @@
 #include 
 #endif
 
-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) ||  
\
-defined(__VPCLMULQDQ__)
-#include 
-#endif
-
 /* No feature check desired due to internal checks */
 #include 
 
@@ -230,6 +225,11 @@
 #include 
 #endif
 
+#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) ||  
\
+defined(__VPCLMULQDQ__)
+#include 
+#endif
+
 #if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) ||  
\
 defined(__VAES__)
 #include 

diff  --git a/clang/lib/Headers/vaesintrin.h b/clang/lib/Headers/vaesintrin.h
index c4d5c3e75140..f3c0807bb94a 100644
--- a/clang/lib/Headers/vaesintrin.h
+++ b/clang/lib/Headers/vaesintrin.h
@@ -28,13 +28,6 @@ static __inline__ __m256i __DEFAULT_FN_ATTRS
   (__v4di) __B);
 }
 
-static __inline__ __m512i __DEFAULT_FN_ATTRS_F
- _mm512_aesenc_epi128(__m512i __A, __m512i __B)
-{
-  return (__m512i) __builtin_ia32_aesenc512((__v8di) __A,
-  (__v8di) __B);
-}
-
 static __inline__ __m256i __DEFAULT_FN_ATTRS
  _mm256_aesdec_epi128(__m256i __A, __m256i __B)
 {
@@ -42,32 +35,40 @@ static __inline__ __m256i __DEFAULT_FN_ATTRS
   (__v4di) __B);
 }
 
-static __inline__ __m512i __DEFAULT_FN_ATTRS_F
- _mm512_aesdec_epi128(__m512i __A, __m512i __B)
+static __inline__ __m256i __DEFAULT_FN_ATTRS
+ _mm256_aesenclast_epi128(__m256i __A, __m256i __B)
 {
-  return (__m512i) __builtin_ia32_aesdec512((__v8di) __A,
-  (__v8di) __B);
+  return (__m256i) __builtin_ia32_aesenclast256((__v4di) __A,
+  (__v4di) __B);
 }
 
 static __inline__ __m256i __DEFAULT_FN_ATTRS
- _mm256_aesenclast_epi128(__m256i __A, __m256i __B)
+ _mm256_aesdeclast_epi128(__m256i __A, __m256i __B)
 {
-  return (__m256i) __builtin_ia32_aesenclast256((__v4di) __A,
+  return (__m256i) __builtin_ia32_aesdeclast256((__v4di) __A,
   (__v4di) __B);
 }
 
+#ifdef __AVX512FINTRIN_H
 static __inline__ __m512i __DEFAULT_FN_ATTRS_F
- _mm512_aesenclast_epi128(__m512i __A, __m512i __B)
+ _mm512_aesenc_epi128(__m512i __A, __m512i __B)
 {
-  return (__m512i) __builtin_ia32_aesenclast512((__v8di) __A,
+  return (__m512i) __builtin_ia32_aesenc512((__v8di) __A,
   (__v8di) __B);
 }
 
-static __inline__ __m256i __DEFAULT_FN_ATTRS
- _mm256_aesdeclast_epi128(__m256i __A, __m256i __B)
+static __inline__ __m512i __DEFAULT_FN_ATTRS_F
+ _mm512_aesdec_epi128(__m512i __A, __m512i __B)
 {
-  return (__m256i) __builtin_ia32_aesdeclast256((__v4di) __A,
-  (__v4di) __B);
+  return (__m512i) __builtin_ia32_aesdec512((__v8di) __A,
+  (__v8di) __B);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS_F
+ _mm512_aesenclast_epi128(__m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_aesenclast512((__v8di) __A,
+  (__v8di) __B);
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS_F
@@ -76,7 +77,7 @@ static __inline__ __m512i __DEFAULT_FN_ATTRS_F
   return (__m512i) __builtin_ia32_aesdeclast512((__v8di) __A,
   (__v8di) __B);
 }
-
+#endif // __AVX512FINTRIN_H
 
 #undef __DEFAULT_FN_ATTRS
 #undef __DEFAULT_FN_ATTRS_F

diff  --git a/clang/lib/Headers/vpclmulqdqintrin.h 
b/clang/lib/Headers/vpclmulqdqintrin.h
index 470d83254905..44daadb07d57 100644
--- a/clang/lib/Headers/vpclmulqdqintrin.h
+++ b/clang/lib/Headers/vpclmulqdqintrin.h
@@ -19,10 +19,12 @@
(__v4di)(__m256i)(B),  \
(char)(I))
 
+#ifdef __AVX512FINTRIN_H
 #define _mm512_clmulepi64_epi128(A, B, I) \
   (__m512i)__builtin_ia32_pclmulqdq512((__v8di)(__m512i)(A),  \
(__v8di)(__m512i)(B),  \
(char)(I))
+#endif // __AVX512FINTRIN_H
 
 #endif /* __VPCLMULQDQINTRIN_H */
 



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


[PATCH] D99465: [Clang][X86] Mark some VAES builtins as conditionally defined

2021-03-28 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added a comment.

I think I've fixed this in 3fb40ce167ff5f05afadf8f525ff9e17350d6d7f 
. We need 
to use the preprocessor define that says avx512fintrin.h was included rather 
than the feature define. We already did a similar thing in gfniintrin.h.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99465

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


[clang] 53c98d8 - [Driver] Suppress libstdc++/libc++ path with -nostdinc

2021-03-28 Thread Fangrui Song via cfe-commits

Author: Fangrui Song
Date: 2021-03-28T11:30:27-07:00
New Revision: 53c98d85a8a609552448043d5512e70313b1eb1b

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

LOG: [Driver] Suppress libstdc++/libc++ path with -nostdinc

This follows GCC. Having libstdc++/libc++ include paths is not useful
anyway because libstdc++/libc++ header files cannot find features.h.

While here, suppress -stdlib++-isystem with -nostdlibinc.

Added: 


Modified: 
clang/lib/Driver/ToolChain.cpp
clang/lib/Driver/ToolChains/Gnu.cpp
clang/test/Driver/nostdincxx.cpp
clang/test/Driver/stdlibxx-isystem.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 217ba56c3351..6b747f06439f 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -916,7 +916,8 @@ void ToolChain::AddClangCXXStdlibIsystemArgs(
 const llvm::opt::ArgList &DriverArgs,
 llvm::opt::ArgStringList &CC1Args) const {
   DriverArgs.ClaimAllArgs(options::OPT_stdlibxx_isystem);
-  if (!DriverArgs.hasArg(options::OPT_nostdincxx))
+  if (!DriverArgs.hasArg(options::OPT_nostdinc, options::OPT_nostdincxx,
+ options::OPT_nostdlibinc))
 for (const auto &P :
  DriverArgs.getAllArgValues(options::OPT_stdlibxx_isystem))
   addSystemInclude(DriverArgs, CC1Args, P);

diff  --git a/clang/lib/Driver/ToolChains/Gnu.cpp 
b/clang/lib/Driver/ToolChains/Gnu.cpp
index 7136df94c528..0fe3916b008e 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2876,8 +2876,9 @@ void Generic_GCC::AddMultilibIncludeArgs(const ArgList 
&DriverArgs,
 
 void Generic_GCC::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
ArgStringList &CC1Args) const {
-  if (DriverArgs.hasArg(options::OPT_nostdlibinc) ||
-  DriverArgs.hasArg(options::OPT_nostdincxx))
+  if (DriverArgs.hasArg(options::OPT_nostdinc) ||
+  DriverArgs.hasArg(options::OPT_nostdincxx) ||
+  DriverArgs.hasArg(options::OPT_nostdlibinc))
 return;
 
   switch (GetCXXStdlibType(DriverArgs)) {

diff  --git a/clang/test/Driver/nostdincxx.cpp 
b/clang/test/Driver/nostdincxx.cpp
index dc87336ece54..3fc7a5e76842 100644
--- a/clang/test/Driver/nostdincxx.cpp
+++ b/clang/test/Driver/nostdincxx.cpp
@@ -1,4 +1,6 @@
+// RUN: not %clangxx -nostdinc %s 2>&1 | FileCheck %s
 // RUN: not %clangxx -nostdinc++ %s 2>&1 | FileCheck %s
+// RUN: not %clangxx -nostdlibinc %s 2>&1 | FileCheck %s
 // CHECK: file not found
 #include  
 

diff  --git a/clang/test/Driver/stdlibxx-isystem.cpp 
b/clang/test/Driver/stdlibxx-isystem.cpp
index 827cdf9a7c71..cadfa25c0db9 100644
--- a/clang/test/Driver/stdlibxx-isystem.cpp
+++ b/clang/test/Driver/stdlibxx-isystem.cpp
@@ -43,11 +43,19 @@
 // RUN:   FileCheck -check-prefix=NOCC1 %s
 // NOCC1-NOT: "-stdlib++-isystem" "/tmp"
 
-// It should respect -nostdinc++.
+// It should respect -nostdinc++
 // RUN: %clang -target aarch64-linux-gnu -ccc-install-dir %t/bin \
 // RUN:   -stdlib++-isystem /tmp/foo -stdlib++-isystem /tmp/bar -nostdinc++ \
 // RUN:   -fsyntax-only %s -### 2>&1 | FileCheck -check-prefix=NOSTDINCXX %s
 // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %t/bin \
 // RUN:   -stdlib++-isystem /tmp/foo -stdlib++-isystem /tmp/bar -nostdinc++ \
 // RUN:   -fsyntax-only %s -### 2>&1 | FileCheck -check-prefix=NOSTDINCXX %s
+
+// ... and -nostdinc and -nostdlibinc.
+// RUN: %clang -target aarch64-linux-gnu -ccc-install-dir %t/bin \
+// RUN:   -stdlib++-isystem /tmp/foo -stdlib++-isystem /tmp/bar -nostdinc \
+// RUN:   -fsyntax-only %s -### 2>&1 | FileCheck --check-prefix=NOSTDINCXX %s
+// RUN: %clang -target aarch64-linux-gnu -ccc-install-dir %t/bin \
+// RUN:   -stdlib++-isystem /tmp/foo -stdlib++-isystem /tmp/bar -nostdlibinc \
+// RUN:   -fsyntax-only %s -### 2>&1 | FileCheck --check-prefix=NOSTDINCXX %s
 // NOSTDINCXX-NOT: "-internal-isystem" "/tmp/foo" "-internal-isystem" 
"/tmp/bar"



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


[PATCH] D69218: [ASTMatchers] Add `cxxBaseSpecifier` matcher (non-top-level)

2021-03-28 Thread Nikita Kniazev via Phabricator via cfe-commits
nick updated this revision to Diff 333728.
nick added a comment.

In D69218#2654614 , @steveire wrote:

> @nick Sorry that getting these changes merged takes so long.
>
> @njames93 If you have an alternative way forward, please let us know what it 
> is.
>
> Otherwise, this LGTM too and we should merge it soon unless there are 
> objections which haven't been addressed.

I had a PR in Boost that took 4 years to merge, so it is nothing new to me :D

Rebased, even though there was no conflicts.


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

https://reviews.llvm.org/D69218

Files:
  clang/docs/LibASTMatchersReference.html
  clang/include/clang/ASTMatchers/ASTMatchers.h
  clang/lib/ASTMatchers/ASTMatchersInternal.cpp
  clang/lib/ASTMatchers/Dynamic/Registry.cpp
  clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
  clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
  clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp

Index: clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
===
--- clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
+++ clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
@@ -297,6 +297,17 @@
   EXPECT_TRUE(matches("int b[7];", M));
 }
 
+TEST_F(RegistryTest, CXXBaseSpecifier) {
+  // TODO: rewrite with top-level cxxBaseSpecifier matcher when available
+  DeclarationMatcher ClassHasAnyDirectBase =
+  constructMatcher("cxxRecordDecl",
+   constructMatcher("hasDirectBase",
+constructMatcher("cxxBaseSpecifier")))
+  .getTypedMatcher();
+  EXPECT_TRUE(matches("class X {}; class Y : X {};", ClassHasAnyDirectBase));
+  EXPECT_TRUE(notMatches("class X {};", ClassHasAnyDirectBase));
+}
+
 TEST_F(RegistryTest, CXXCtorInitializer) {
   Matcher CtorDecl = constructMatcher(
   "cxxConstructorDecl",
Index: clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
===
--- clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
+++ clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
@@ -320,6 +320,15 @@
 varDecl(hasType(pointsTo(ClassX);
 }
 
+TEST(HasType, TakesQualTypeMatcherAndMatchesCXXBaseSpecifier) {
+  TypeMatcher ClassX = hasDeclaration(recordDecl(hasName("X")));
+  CXXBaseSpecifierMatcher BaseClassX = cxxBaseSpecifier(hasType(ClassX));
+  DeclarationMatcher ClassHasBaseClassX =
+  cxxRecordDecl(hasDirectBase(BaseClassX));
+  EXPECT_TRUE(matches("class X {}; class Y : X {};", ClassHasBaseClassX));
+  EXPECT_TRUE(notMatches("class Z {}; class Y : Z {};", ClassHasBaseClassX));
+}
+
 TEST(HasType, TakesDeclMatcherAndMatchesExpr) {
   DeclarationMatcher ClassX = recordDecl(hasName("X"));
   EXPECT_TRUE(
@@ -337,6 +346,15 @@
 notMatches("class X {}; void y() { X *x; }", varDecl(hasType(ClassX;
 }
 
+TEST(HasType, TakesDeclMatcherAndMatchesCXXBaseSpecifier) {
+  DeclarationMatcher ClassX = recordDecl(hasName("X"));
+  CXXBaseSpecifierMatcher BaseClassX = cxxBaseSpecifier(hasType(ClassX));
+  DeclarationMatcher ClassHasBaseClassX =
+  cxxRecordDecl(hasDirectBase(BaseClassX));
+  EXPECT_TRUE(matches("class X {}; class Y : X {};", ClassHasBaseClassX));
+  EXPECT_TRUE(notMatches("class Z {}; class Y : Z {};", ClassHasBaseClassX));
+}
+
 TEST(HasType, MatchesTypedefDecl) {
   EXPECT_TRUE(matches("typedef int X;", typedefDecl(hasType(asString("int");
   EXPECT_TRUE(matches("typedef const int T;",
Index: clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
===
--- clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -4400,6 +4400,13 @@
 return;
   }
 
+  DeclarationMatcher ClassHasAnyDirectBase =
+  cxxRecordDecl(hasDirectBase(cxxBaseSpecifier()));
+  EXPECT_TRUE(notMatches("class X {};", ClassHasAnyDirectBase));
+  EXPECT_TRUE(matches("class X {}; class Y : X {};", ClassHasAnyDirectBase));
+  EXPECT_TRUE(matches("class X {}; class Y : public virtual X {};",
+  ClassHasAnyDirectBase));
+
   EXPECT_TRUE(matches(
   R"cc(
 class Base {};
Index: clang/lib/ASTMatchers/Dynamic/Registry.cpp
===
--- clang/lib/ASTMatchers/Dynamic/Registry.cpp
+++ clang/lib/ASTMatchers/Dynamic/Registry.cpp
@@ -175,6 +175,7 @@
   REGISTER_MATCHER(coreturnStmt);
   REGISTER_MATCHER(coyieldExpr);
   REGISTER_MATCHER(cudaKernelCallExpr);
+  REGISTER_MATCHER(cxxBaseSpecifier);
   REGISTER_MATCHER(cxxBindTemporaryExpr);
   REGISTER_MATCHER(cxxBoolLiteral);
   REGISTER_MATCHER(cxxCatchStmt);
Index: clang/lib/ASTMatchers/ASTMatchersInternal.cpp
===
--- clang/lib/ASTMatchers/ASTMatchersInternal.cpp
+++ clang/lib/ASTMatchers/ASTMatcher

[PATCH] D99466: Fix PR48889: assertion failure for void() in flattened ternary expression

2021-03-28 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith accepted this revision.
rsmith added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/lib/CodeGen/CGExprScalar.cpp:466-469
+// [expr.type.conv]: if the type is cv void and the initializer is () or 
{},
+// the expression is a prvalue of type void that performs no 
initialization.
+QualType T = E->getType();
+return T->isVoidType() ? nullptr : EmitNullValue(T);

Would it make sense to put this check in `EmitNullValue` instead? That would 
also cover an `InitListExpr` for `void{}` (which we currently appear to 
incorrectly reject), and an `ImplicitValueInit` for type `void` (which I don't 
think can be created legitimately at the moment, but that could just be a 
failure of imagination on my part).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99466

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


[PATCH] D69218: [ASTMatchers] Add `cxxBaseSpecifier` matcher (non-top-level)

2021-03-28 Thread Nikita Kniazev via Phabricator via cfe-commits
nick added inline comments.



Comment at: clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp:301
+TEST_F(RegistryTest, CXXBaseSpecifier) {
+  // TODO: rewrite with top-level cxxBaseSpecifier matcher when available
+  DeclarationMatcher ClassHasAnyDirectBase =

steveire wrote:
> @nick Is this implemented in another MR? I don't see anything in your list of 
> revisions. I think this is reasonable as is, but wondering if you intend to 
> implement the top-level support too.
The patch had some of the top-level matcher parts, but it cut them off when 
rebased. I have no need in it myself and I am not sure there is any kind of use 
for it.


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

https://reviews.llvm.org/D69218

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


[clang] 2a28d1d - [Driver] Linux.cpp: move resource directory before /usr/local/include for non-musl

2021-03-28 Thread Fangrui Song via cfe-commits

Author: Fangrui Song
Date: 2021-03-28T12:44:21-07:00
New Revision: 2a28d1d3b7bf2062288b46af34e33ccc543a99fa

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

LOG: [Driver] Linux.cpp: move resource directory before /usr/local/include for 
non-musl

This follows GCC and simplifies code. /usr/local/include and TOOL_INCLUDE_DIR
should not conflict with the resource directory include so users should not
observe any difference.

Added: 


Modified: 
clang/lib/Driver/ToolChains/Linux.cpp
clang/test/Driver/android-ndk-standalone.cpp
clang/test/Driver/linux-cross.cpp
clang/test/Driver/linux-header-search.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Linux.cpp 
b/clang/lib/Driver/ToolChains/Linux.cpp
index 895e76e0c448..826e937c839e 100644
--- a/clang/lib/Driver/ToolChains/Linux.cpp
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
@@ -540,14 +540,10 @@ void Linux::AddClangSystemIncludeArgs(const ArgList 
&DriverArgs,
   if (DriverArgs.hasArg(clang::driver::options::OPT_nostdinc))
 return;
 
-  if (!DriverArgs.hasArg(options::OPT_nostdlibinc)) {
-// LOCAL_INCLUDE_DIR
-addSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/local/include");
-// TOOL_INCLUDE_DIR
-AddMultilibIncludeArgs(DriverArgs, CC1Args);
-  }
-
-  // Note: in gcc, GCC_INCLUDE_DIR (private headers) precedes 
LOCAL_INCLUDE_DIR.
+  // Add 'include' in the resource directory, which is similar to
+  // GCC_INCLUDE_DIR (private headers) in GCC. Note: the include directory
+  // contains some files conflicting with system /usr/include. musl systems
+  // prefer the /usr/include copies which are more relevant.
   SmallString<128> ResourceDirInclude(D.ResourceDir);
   llvm::sys::path::append(ResourceDirInclude, "include");
   if (!DriverArgs.hasArg(options::OPT_nobuiltininc) &&
@@ -557,6 +553,11 @@ void Linux::AddClangSystemIncludeArgs(const ArgList 
&DriverArgs,
   if (DriverArgs.hasArg(options::OPT_nostdlibinc))
 return;
 
+  // LOCAL_INCLUDE_DIR
+  addSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/local/include");
+  // TOOL_INCLUDE_DIR
+  AddMultilibIncludeArgs(DriverArgs, CC1Args);
+
   // Check for configure-time C include directories.
   StringRef CIncludeDirs(C_INCLUDE_DIRS);
   if (CIncludeDirs != "") {
@@ -570,8 +571,8 @@ void Linux::AddClangSystemIncludeArgs(const ArgList 
&DriverArgs,
 return;
   }
 
-  // On Debian (and its derivatives which ship g++-multiarch-incdir.
diff ) and
-  // Android, add /usr/include/$triple if exists.
+  // On systems using multiarch and Android, add /usr/include/$triple before
+  // /usr/include.
   std::string MultiarchIncludeDir = getMultiarchTriple(D, getTriple(), 
SysRoot);
   if (!MultiarchIncludeDir.empty() &&
   D.getVFS().exists(SysRoot + "/usr/include/" + MultiarchIncludeDir))

diff  --git a/clang/test/Driver/android-ndk-standalone.cpp 
b/clang/test/Driver/android-ndk-standalone.cpp
index 8581963ae00d..d070250913b2 100644
--- a/clang/test/Driver/android-ndk-standalone.cpp
+++ b/clang/test/Driver/android-ndk-standalone.cpp
@@ -9,8 +9,8 @@
 // CHECK: {{.*}}clang{{.*}}" "-cc1"
 // CHECK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK: "-internal-isystem" "{{.*}}/include/c++/v1"
-// CHECK: "-internal-isystem" "{{.*}}/sysroot/usr/local/include"
 // CHECK: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|)}}include"
+// CHECK: "-internal-isystem" "{{.*}}/sysroot/usr/local/include"
 // CHECK: "-internal-externc-isystem" 
"{{.*}}/sysroot/usr/include/arm-linux-androideabi"
 // CHECK: "-internal-externc-isystem" "{{.*}}/sysroot/include"
 // CHECK: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
@@ -82,8 +82,8 @@
 // CHECK-ARMV7: {{.*}}clang{{.*}}" "-cc1"
 // CHECK-ARMV7: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-ARMV7: "-internal-isystem" "{{.*}}/include/c++/v1"
-// CHECK-ARMV7: "-internal-isystem" "{{.*}}/sysroot/usr/local/include"
 // CHECK-ARMV7: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|)}}include"
+// CHECK-ARMV7: "-internal-isystem" "{{.*}}/sysroot/usr/local/include"
 // CHECK-ARMV7: "-internal-externc-isystem" 
"{{.*}}/sysroot/usr/include/arm-linux-androideabi"
 // CHECK-ARMV7: "-internal-externc-isystem" "{{.*}}/sysroot/include"
 // CHECK-ARMV7: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
@@ -135,8 +135,8 @@
 // CHECK-THUMB: {{.*}}clang{{.*}}" "-cc1"
 // CHECK-THUMB: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-THUMB: "-internal-isystem" "{{.*}}/include/c++/v1"
-// CHECK-THUMB: "-internal-isystem" "{{.*}}/sysroot/usr/local/include"
 // CHECK-THUMB: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|)}}include"
+// CHECK-THUMB: "-internal-isystem" "{{.*}}/sysroot/usr/local/include"
 // CHECK-THUMB: "-internal-externc-isystem" 
"{{.*}}/sysroot/usr/include/arm-linux-androideabi"
 // CHECK-THUM

[PATCH] D98574: [Sparc] Define the same macros for -mcpu=v9 as GCC on Linux and the BSDs

2021-03-28 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg added a comment.

The NetBSD part looks ok, but also lacks proper testing. I'm not sure anyone 
but Linux cares at all otherwise as they lack 32bit SPARC support.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98574

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


[PATCH] D98864: [SystemZ][z/OS] Set maximum value to truncate attribute aligned to for static variables on z/OS target

2021-03-28 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng updated this revision to Diff 333737.
fanbo-meng set the repository for this revision to rG LLVM Github Monorepo.
fanbo-meng added a comment.

rebasing to latest master


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98864

Files:
  clang/include/clang/Basic/TargetInfo.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/Basic/TargetInfo.cpp
  clang/lib/Basic/Targets/OSTargets.h
  clang/test/CodeGen/SystemZ/zos-alignment.c


Index: clang/test/CodeGen/SystemZ/zos-alignment.c
===
--- clang/test/CodeGen/SystemZ/zos-alignment.c
+++ clang/test/CodeGen/SystemZ/zos-alignment.c
@@ -1,4 +1,16 @@
-// RUN: %clang_cc1 -emit-llvm-only -triple s390x-none-zos 
-fdump-record-layouts %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm-only -triple s390x-none-zos 
-fdump-record-layouts %s | FileCheck %s --check-prefix=CHECK
+// RUN: %clang_cc1 -emit-llvm -triple s390x-none-zos %s -o - | FileCheck %s 
--check-prefix=DECL
+
+static int __attribute__((aligned(32))) v0;
+int __attribute__((aligned(32))) v1;
+typedef int __attribute__((aligned(32))) int32;
+static int32 v2;
+int32 v3;
+int f0() { return v0 + v1 + v2 + v3; }
+// DECL:  @v0 {{.*}} align 16
+// DECL-NEXT: @v1 {{.*}} align 32
+// DECL-NEXT: @v2 {{.*}} align 16
+// DECL-NEXT: @v3 {{.*}} align 32
 
 struct s0 {
   short a:3;
Index: clang/lib/Basic/Targets/OSTargets.h
===
--- clang/lib/Basic/Targets/OSTargets.h
+++ clang/lib/Basic/Targets/OSTargets.h
@@ -794,6 +794,7 @@
   ZOSTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
   : OSTargetInfo(Triple, Opts) {
 this->WCharType = TargetInfo::UnsignedInt;
+this->MaxAlignedAttribute = 128;
 this->UseBitFieldTypeAlignment = false;
 this->UseZeroLengthBitfieldAlignment = true;
 this->UseLeadingZeroLengthBitfield = false;
Index: clang/lib/Basic/TargetInfo.cpp
===
--- clang/lib/Basic/TargetInfo.cpp
+++ clang/lib/Basic/TargetInfo.cpp
@@ -107,6 +107,7 @@
   UseLeadingZeroLengthBitfield = true;
   UseExplicitBitFieldAlignment = true;
   ZeroLengthBitfieldBoundary = 0;
+  MaxAlignedAttribute = 0;
   HalfFormat = &llvm::APFloat::IEEEhalf();
   FloatFormat = &llvm::APFloat::IEEEsingle();
   DoubleFormat = &llvm::APFloat::IEEEdouble();
Index: clang/lib/AST/ASTContext.cpp
===
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -1783,6 +1783,13 @@
 }
   }
 
+  // Some targets have hard limitation on the maximum requestable alignment in
+  // aligned attribute for static variables.
+  const unsigned MaxAlignedAttr = getTargetInfo().getMaxAlignedAttribute();
+  const auto *VD = dyn_cast(D);
+  if (MaxAlignedAttr && VD && VD->getStorageClass() == SC_Static)
+Align = std::min(Align, MaxAlignedAttr);
+
   return toCharUnitsFromBits(Align);
 }
 
Index: clang/include/clang/Basic/TargetInfo.h
===
--- clang/include/clang/Basic/TargetInfo.h
+++ clang/include/clang/Basic/TargetInfo.h
@@ -165,6 +165,10 @@
   /// If non-zero, specifies a fixed alignment value for bitfields that follow
   /// zero length bitfield, regardless of the zero length bitfield type.
   unsigned ZeroLengthBitfieldBoundary;
+
+  /// If non-zero, specifies a maximum alignment to truncate alignment
+  /// specified in the aligned attribute of a static variable to this value.
+  unsigned MaxAlignedAttribute;
 };
 
 /// OpenCL type kinds.
@@ -784,6 +788,10 @@
 return ZeroLengthBitfieldBoundary;
   }
 
+  /// Get the maximum alignment in bits for a static variable with
+  /// aligned attribute.
+  unsigned getMaxAlignedAttribute() const { return MaxAlignedAttribute; }
+
   /// Check whether explicit bitfield alignment attributes should be
   //  honored, as in "__attribute__((aligned(2))) int b : 1;".
   bool useExplicitBitFieldAlignment() const {


Index: clang/test/CodeGen/SystemZ/zos-alignment.c
===
--- clang/test/CodeGen/SystemZ/zos-alignment.c
+++ clang/test/CodeGen/SystemZ/zos-alignment.c
@@ -1,4 +1,16 @@
-// RUN: %clang_cc1 -emit-llvm-only -triple s390x-none-zos -fdump-record-layouts %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm-only -triple s390x-none-zos -fdump-record-layouts %s | FileCheck %s --check-prefix=CHECK
+// RUN: %clang_cc1 -emit-llvm -triple s390x-none-zos %s -o - | FileCheck %s --check-prefix=DECL
+
+static int __attribute__((aligned(32))) v0;
+int __attribute__((aligned(32))) v1;
+typedef int __attribute__((aligned(32))) int32;
+static int32 v2;
+int32 v3;
+int f0() { return v0 + v1 + v2 + v3; }
+// DECL:  @v0 {{.*}} align 16
+// DECL-NEXT: @v1 {{.*}} align 32
+// DECL-NEXT: @v2 {{.*}} align 16
+// DECL-NEXT: @v3 {{.*}} a

[PATCH] D99466: Fix PR48889: assertion failure for void() in flattened ternary expression

2021-03-28 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert added inline comments.



Comment at: clang/lib/CodeGen/CGExprScalar.cpp:466-469
+// [expr.type.conv]: if the type is cv void and the initializer is () or 
{},
+// the expression is a prvalue of type void that performs no 
initialization.
+QualType T = E->getType();
+return T->isVoidType() ? nullptr : EmitNullValue(T);

rsmith wrote:
> Would it make sense to put this check in `EmitNullValue` instead? That would 
> also cover an `InitListExpr` for `void{}` (which we currently appear to 
> incorrectly reject), and an `ImplicitValueInit` for type `void` (which I 
> don't think can be created legitimately at the moment, but that could just be 
> a failure of imagination on my part).
You're right, we do reject `void{}`. Perhaps something I should address first, 
so that we can have tests for both cases.

I was considering putting this in `EmitNullValue`, but then I read through the 
standard and it seems `void` isn't value/zero-initializable. Then I found 
[expr.type.conv] where it says `void()` is allowed and “performs no 
initialization.” So if we stick close to the standard it seems we should catch 
the special case here, but in `EmitNullValue` it would indeed cover both 
`void()` and `void{}`.

Regarding `void{}`: you might know that `InitListExpr`s have `void` type 
initially, and there is an assertion that it doesn't have `void` type after 
Sema ran over it. I'd have to remove that assertion, unless we give 
`InitListExpr`s a different initial type. Maybe you can comment on D98664 what 
you think about this, where I'm trying to bring `ParenListExpr` in line with 
`InitListExpr` regarding the initial type.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99466

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


[PATCH] D99005: [clang] Implement P2266 Simpler implicit move

2021-03-28 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov updated this revision to Diff 333745.
mizvekov added a comment.

So it turns out there was a pre-existing bug where ObjC++ blocks
with dependent return type were not getting copy elision.

My latest refactoring accidentally fixed this in the return statement
sema action, but unfortunately the template instantiator still expects
only FunctionDecl and crashes otherwise.

I am not sure there is an easy way to fix this, as BlockDecl
doesn't even carry a type unlike FunctionDecl, so there is no easy way
to get the return type.

This might require some surgery to fix, so for now I am just
skipping it and putting a FIXME.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99005

Files:
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaCoroutine.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/lib/Sema/SemaType.cpp
  clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
  clang/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7-cxx14.cpp
  clang/test/CXX/drs/dr3xx.cpp
  clang/test/CXX/expr/expr.prim/expr.prim.lambda/p4-cxx14.cpp
  clang/test/CXX/temp/temp.decls/temp.mem/p5.cpp
  clang/test/SemaCXX/constant-expression-cxx11.cpp
  clang/test/SemaCXX/constant-expression-cxx14.cpp
  clang/test/SemaCXX/coroutine-rvo.cpp
  clang/test/SemaCXX/coroutines.cpp
  clang/test/SemaCXX/deduced-return-type-cxx14.cpp
  clang/test/SemaCXX/return-stack-addr.cpp
  clang/test/SemaCXX/warn-return-std-move.cpp

Index: clang/test/SemaCXX/warn-return-std-move.cpp
===
--- clang/test/SemaCXX/warn-return-std-move.cpp
+++ clang/test/SemaCXX/warn-return-std-move.cpp
@@ -1,8 +1,8 @@
-// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify=cxx20_2b -fcxx-exceptions -Wreturn-std-move %s
-// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=cxx20_2b -fcxx-exceptions -Wreturn-std-move %s
-// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify=cxx11_17 -fcxx-exceptions -Wreturn-std-move %s
-// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify=cxx11_17 -fcxx-exceptions -Wreturn-std-move %s
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify=cxx11_17 -fcxx-exceptions -Wreturn-std-move %s
+// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify=cxx20_2b,cxx2b -fcxx-exceptions -Wreturn-std-move %s
+// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=cxx20_2b   -fcxx-exceptions -Wreturn-std-move %s
+// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify=cxx11_17   -fcxx-exceptions -Wreturn-std-move %s
+// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify=cxx11_17   -fcxx-exceptions -Wreturn-std-move %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify=cxx11_17   -fcxx-exceptions -Wreturn-std-move %s
 
 // RUN: %clang_cc1 -std=c++17 -fsyntax-only -fcxx-exceptions -Wreturn-std-move -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s -check-prefix=CHECK
 // RUN: %clang_cc1 -std=c++14 -fsyntax-only -fcxx-exceptions -Wreturn-std-move -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s -check-prefix=CHECK
@@ -217,8 +217,8 @@
 }
 
 // But if the return type is a reference type, then moving would be wrong.
-Derived& testRetRef1(Derived&& d) { return d; }
-Base& testRetRef2(Derived&& d) { return d; }
+Derived &testRetRef1(Derived &&d) { return d; } // cxx2b-error {{on-const lvalue reference to type 'Derived' cannot bind to a temporary of type 'Derived'}}
+Base &testRetRef2(Derived &&d) { return d; }// cxx2b-error {{non-const lvalue reference to type 'Base' cannot bind to a temporary of type 'Derived'}}
 #if __cplusplus >= 201402L
 auto&& testRetRef3(Derived&& d) { return d; }
 decltype(auto) testRetRef4(Derived&& d) { return (d); }
Index: clang/test/SemaCXX/return-stack-addr.cpp
===
--- clang/test/SemaCXX/return-stack-addr.cpp
+++ clang/test/SemaCXX/return-stack-addr.cpp
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify=expected   %s
-// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected   %s
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify=expected,cxx11 %s
+// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify=expected,cxx2b  %s
+// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,cxx11_20   %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify=expected,cxx11_20,cxx11 %s
 
 int* ret_local() {
   int x = 1;
@@ -29,7 +29,8 @@
 
 int& ret_local_ref() {
   int x = 1;
-  return x;  // expected-warning {{reference to stack memory}}
+  return x; // cxx11_20-warning {{reference to stack memory}}
+  // cxx2b-error@-1 {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
 }
 
 int* ret_local_addrOf() {
@@ -154,8 +155,10 @@
   (void) [&]() -> int& { return b; };
   (void) [=]() mutable -> int& { return a; };
   (void) [=]() mutable -> int& { return

[PATCH] D99005: [clang] Implement P2266 Simpler implicit move

2021-03-28 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov added a subscriber: rjmccall.
mizvekov added inline comments.



Comment at: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:1059
+else if (auto *F = dyn_cast(DC))
+  goto unimplemented; // FIXME: get the return type here somehow...
+else

@rjmccall Hello! Do you have any tips for fixing this one?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99005

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


[PATCH] D99005: [clang] Implement P2266 Simpler implicit move

2021-03-28 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov updated this revision to Diff 333749.
mizvekov added a comment.

small fix


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99005

Files:
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaCoroutine.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/lib/Sema/SemaType.cpp
  clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
  clang/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7-cxx14.cpp
  clang/test/CXX/drs/dr3xx.cpp
  clang/test/CXX/expr/expr.prim/expr.prim.lambda/p4-cxx14.cpp
  clang/test/CXX/temp/temp.decls/temp.mem/p5.cpp
  clang/test/SemaCXX/constant-expression-cxx11.cpp
  clang/test/SemaCXX/constant-expression-cxx14.cpp
  clang/test/SemaCXX/coroutine-rvo.cpp
  clang/test/SemaCXX/coroutines.cpp
  clang/test/SemaCXX/deduced-return-type-cxx14.cpp
  clang/test/SemaCXX/return-stack-addr.cpp
  clang/test/SemaCXX/warn-return-std-move.cpp

Index: clang/test/SemaCXX/warn-return-std-move.cpp
===
--- clang/test/SemaCXX/warn-return-std-move.cpp
+++ clang/test/SemaCXX/warn-return-std-move.cpp
@@ -1,8 +1,8 @@
-// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify=cxx20_2b -fcxx-exceptions -Wreturn-std-move %s
-// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=cxx20_2b -fcxx-exceptions -Wreturn-std-move %s
-// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify=cxx11_17 -fcxx-exceptions -Wreturn-std-move %s
-// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify=cxx11_17 -fcxx-exceptions -Wreturn-std-move %s
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify=cxx11_17 -fcxx-exceptions -Wreturn-std-move %s
+// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify=cxx20_2b,cxx2b -fcxx-exceptions -Wreturn-std-move %s
+// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=cxx20_2b   -fcxx-exceptions -Wreturn-std-move %s
+// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify=cxx11_17   -fcxx-exceptions -Wreturn-std-move %s
+// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify=cxx11_17   -fcxx-exceptions -Wreturn-std-move %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify=cxx11_17   -fcxx-exceptions -Wreturn-std-move %s
 
 // RUN: %clang_cc1 -std=c++17 -fsyntax-only -fcxx-exceptions -Wreturn-std-move -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s -check-prefix=CHECK
 // RUN: %clang_cc1 -std=c++14 -fsyntax-only -fcxx-exceptions -Wreturn-std-move -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s -check-prefix=CHECK
@@ -217,8 +217,8 @@
 }
 
 // But if the return type is a reference type, then moving would be wrong.
-Derived& testRetRef1(Derived&& d) { return d; }
-Base& testRetRef2(Derived&& d) { return d; }
+Derived &testRetRef1(Derived &&d) { return d; } // cxx2b-error {{on-const lvalue reference to type 'Derived' cannot bind to a temporary of type 'Derived'}}
+Base &testRetRef2(Derived &&d) { return d; }// cxx2b-error {{non-const lvalue reference to type 'Base' cannot bind to a temporary of type 'Derived'}}
 #if __cplusplus >= 201402L
 auto&& testRetRef3(Derived&& d) { return d; }
 decltype(auto) testRetRef4(Derived&& d) { return (d); }
Index: clang/test/SemaCXX/return-stack-addr.cpp
===
--- clang/test/SemaCXX/return-stack-addr.cpp
+++ clang/test/SemaCXX/return-stack-addr.cpp
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify=expected   %s
-// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected   %s
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify=expected,cxx11 %s
+// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify=expected,cxx2b  %s
+// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,cxx11_20   %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify=expected,cxx11_20,cxx11 %s
 
 int* ret_local() {
   int x = 1;
@@ -29,7 +29,8 @@
 
 int& ret_local_ref() {
   int x = 1;
-  return x;  // expected-warning {{reference to stack memory}}
+  return x; // cxx11_20-warning {{reference to stack memory}}
+  // cxx2b-error@-1 {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
 }
 
 int* ret_local_addrOf() {
@@ -154,8 +155,10 @@
   (void) [&]() -> int& { return b; };
   (void) [=]() mutable -> int& { return a; };
   (void) [=]() mutable -> int& { return b; };
-  (void) [&]() -> int& { int a; return a; }; // expected-warning {{reference to stack}}
-  (void) [=]() -> int& { int a; return a; }; // expected-warning {{reference to stack}}
+  (void) [&]() -> int& { int a; return a; }; // cxx11_20-warning {{reference to stack}}
+  // cxx2b-error@-1 {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
+  (void) [=]() -> int& { int a; return a; }; // cxx11_20-warning {{reference to stack}}
+  // cxx2b-error@-1 {{non-const lvalue reference to type 'int' cannot bind to

[PATCH] D99005: [clang] Implement P2266 Simpler implicit move

2021-03-28 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov updated this revision to Diff 333756.
mizvekov added a comment.

some further simplifications


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99005

Files:
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaCoroutine.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/lib/Sema/SemaType.cpp
  clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
  clang/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7-cxx14.cpp
  clang/test/CXX/drs/dr3xx.cpp
  clang/test/CXX/expr/expr.prim/expr.prim.lambda/p4-cxx14.cpp
  clang/test/CXX/temp/temp.decls/temp.mem/p5.cpp
  clang/test/SemaCXX/constant-expression-cxx11.cpp
  clang/test/SemaCXX/constant-expression-cxx14.cpp
  clang/test/SemaCXX/coroutine-rvo.cpp
  clang/test/SemaCXX/coroutines.cpp
  clang/test/SemaCXX/deduced-return-type-cxx14.cpp
  clang/test/SemaCXX/return-stack-addr.cpp
  clang/test/SemaCXX/warn-return-std-move.cpp

Index: clang/test/SemaCXX/warn-return-std-move.cpp
===
--- clang/test/SemaCXX/warn-return-std-move.cpp
+++ clang/test/SemaCXX/warn-return-std-move.cpp
@@ -1,8 +1,8 @@
-// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify=cxx20_2b -fcxx-exceptions -Wreturn-std-move %s
-// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=cxx20_2b -fcxx-exceptions -Wreturn-std-move %s
-// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify=cxx11_17 -fcxx-exceptions -Wreturn-std-move %s
-// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify=cxx11_17 -fcxx-exceptions -Wreturn-std-move %s
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify=cxx11_17 -fcxx-exceptions -Wreturn-std-move %s
+// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify=cxx20_2b,cxx2b -fcxx-exceptions -Wreturn-std-move %s
+// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=cxx20_2b   -fcxx-exceptions -Wreturn-std-move %s
+// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify=cxx11_17   -fcxx-exceptions -Wreturn-std-move %s
+// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify=cxx11_17   -fcxx-exceptions -Wreturn-std-move %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify=cxx11_17   -fcxx-exceptions -Wreturn-std-move %s
 
 // RUN: %clang_cc1 -std=c++17 -fsyntax-only -fcxx-exceptions -Wreturn-std-move -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s -check-prefix=CHECK
 // RUN: %clang_cc1 -std=c++14 -fsyntax-only -fcxx-exceptions -Wreturn-std-move -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s -check-prefix=CHECK
@@ -217,8 +217,8 @@
 }
 
 // But if the return type is a reference type, then moving would be wrong.
-Derived& testRetRef1(Derived&& d) { return d; }
-Base& testRetRef2(Derived&& d) { return d; }
+Derived &testRetRef1(Derived &&d) { return d; } // cxx2b-error {{on-const lvalue reference to type 'Derived' cannot bind to a temporary of type 'Derived'}}
+Base &testRetRef2(Derived &&d) { return d; }// cxx2b-error {{non-const lvalue reference to type 'Base' cannot bind to a temporary of type 'Derived'}}
 #if __cplusplus >= 201402L
 auto&& testRetRef3(Derived&& d) { return d; }
 decltype(auto) testRetRef4(Derived&& d) { return (d); }
Index: clang/test/SemaCXX/return-stack-addr.cpp
===
--- clang/test/SemaCXX/return-stack-addr.cpp
+++ clang/test/SemaCXX/return-stack-addr.cpp
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify=expected   %s
-// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected   %s
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify=expected,cxx11 %s
+// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify=expected,cxx2b  %s
+// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,cxx11_20   %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify=expected,cxx11_20,cxx11 %s
 
 int* ret_local() {
   int x = 1;
@@ -29,7 +29,8 @@
 
 int& ret_local_ref() {
   int x = 1;
-  return x;  // expected-warning {{reference to stack memory}}
+  return x; // cxx11_20-warning {{reference to stack memory}}
+  // cxx2b-error@-1 {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
 }
 
 int* ret_local_addrOf() {
@@ -154,8 +155,10 @@
   (void) [&]() -> int& { return b; };
   (void) [=]() mutable -> int& { return a; };
   (void) [=]() mutable -> int& { return b; };
-  (void) [&]() -> int& { int a; return a; }; // expected-warning {{reference to stack}}
-  (void) [=]() -> int& { int a; return a; }; // expected-warning {{reference to stack}}
+  (void) [&]() -> int& { int a; return a; }; // cxx11_20-warning {{reference to stack}}
+  // cxx2b-error@-1 {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
+  (void) [=]() -> int& { int a; return a; }; // cxx11_20-warning {{reference to stack}}
+  // cxx2b-error@-1 {{non-const lvalue reference to type '

[PATCH] D99009: [RISCV] [1/2] Add intrinsic for Zbr extension

2021-03-28 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:17865
+ID = Intrinsic::riscv_crc32_b;
+IntrinsicTypes = {ResultType, Ops[0]->getType()};
+break;

With the llvm_any_ty change, you'll only need ResultType here.



Comment at: llvm/include/llvm/IR/IntrinsicsRISCV.td:20
+class BitMan_GPR_Intrinsics
+: Intrinsic<[llvm_any_ty], [llvm_any_ty],
+[IntrNoMem, IntrSpeculatable, IntrWillReturn]>;

The second llvm_any_ty here should be LLVMMatchType<0> since the types need to 
be the same.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99009

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


[PATCH] D99482: [PoC][Clang][CodeGen] Do not use getelementptr for scalable struct.

2021-03-28 Thread Hsiangkai Wang via Phabricator via cfe-commits
HsiangKai created this revision.
HsiangKai added reviewers: craig.topper, efriedma, c-rhodes, sdesmalen, 
rogfer01, frasercrmck, david-arm.
Herald added a subscriber: StephenFan.
HsiangKai requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

We do not support getelementptr for scalable struct. Avoid using
getelementptr when dealing with scalable struct arguments.

Use multiple insertvalue and store the whole scalable struct at the end.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99482

Files:
  clang/lib/CodeGen/CGCall.cpp


Index: clang/lib/CodeGen/CGCall.cpp
===
--- clang/lib/CodeGen/CGCall.cpp
+++ clang/lib/CodeGen/CGCall.cpp
@@ -1298,10 +1298,14 @@
  bool DestIsVolatile) {
   // Prefer scalar stores to first-class aggregate stores.
   if (llvm::StructType *STy = dyn_cast(Val->getType())) {
-for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
-  Address EltPtr = Builder.CreateStructGEP(Dest, i);
-  llvm::Value *Elt = Builder.CreateExtractValue(Val, i);
-  Builder.CreateStore(Elt, EltPtr, DestIsVolatile);
+if (STy->containsScalableVectorType())
+  Builder.CreateStore(Val, Dest, DestIsVolatile);
+else {
+  for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
+Address EltPtr = Builder.CreateStructGEP(Dest, i);
+llvm::Value *Elt = Builder.CreateExtractValue(Val, i);
+Builder.CreateStore(Elt, EltPtr, DestIsVolatile);
+  }
 }
   } else {
 Builder.CreateStore(Val, Dest, DestIsVolatile);
@@ -2857,11 +2861,21 @@
 }
 
 assert(STy->getNumElements() == NumIRArgs);
-for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
-  auto AI = Fn->getArg(FirstIRArg + i);
-  AI->setName(Arg->getName() + ".coerce" + Twine(i));
-  Address EltPtr = Builder.CreateStructGEP(AddrToStoreInto, i);
-  Builder.CreateStore(AI, EltPtr);
+if (STy->containsScalableVectorType()) {
+  llvm::Value *Val = llvm::UndefValue::get(STy);
+  for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
+auto AI = Fn->getArg(FirstIRArg + i);
+AI->setName(Arg->getName() + ".coerce" + Twine(i));
+Val = Builder.CreateInsertValue(Val, AI, i);
+  }
+  Builder.CreateStore(Val, AddrToStoreInto);
+} else {
+  for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
+auto AI = Fn->getArg(FirstIRArg + i);
+AI->setName(Arg->getName() + ".coerce" + Twine(i));
+Address EltPtr = Builder.CreateStructGEP(AddrToStoreInto, i);
+Builder.CreateStore(AI, EltPtr);
+  }
 }
 
 if (SrcSize > DstSize) {
@@ -4920,10 +4934,18 @@
 }
 
 assert(NumIRArgs == STy->getNumElements());
-for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
-  Address EltPtr = Builder.CreateStructGEP(Src, i);
-  llvm::Value *LI = Builder.CreateLoad(EltPtr);
-  IRCallArgs[FirstIRArg + i] = LI;
+if (STy->containsScalableVectorType()) {
+  llvm::Value *Val = Builder.CreateLoad(Src);
+  for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
+llvm::Value *LI = Builder.CreateExtractValue(Val, i);
+IRCallArgs[FirstIRArg + i] = LI;
+  }
+} else {
+  for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
+Address EltPtr = Builder.CreateStructGEP(Src, i);
+llvm::Value *LI = Builder.CreateLoad(EltPtr);
+IRCallArgs[FirstIRArg + i] = LI;
+  }
 }
   } else {
 // In the simple case, just pass the coerced loaded value.


Index: clang/lib/CodeGen/CGCall.cpp
===
--- clang/lib/CodeGen/CGCall.cpp
+++ clang/lib/CodeGen/CGCall.cpp
@@ -1298,10 +1298,14 @@
  bool DestIsVolatile) {
   // Prefer scalar stores to first-class aggregate stores.
   if (llvm::StructType *STy = dyn_cast(Val->getType())) {
-for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
-  Address EltPtr = Builder.CreateStructGEP(Dest, i);
-  llvm::Value *Elt = Builder.CreateExtractValue(Val, i);
-  Builder.CreateStore(Elt, EltPtr, DestIsVolatile);
+if (STy->containsScalableVectorType())
+  Builder.CreateStore(Val, Dest, DestIsVolatile);
+else {
+  for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
+Address EltPtr = Builder.CreateStructGEP(Dest, i);
+llvm::Value *Elt = Builder.CreateExtractValue(Val, i);
+Builder.CreateStore(Elt, EltPtr, DestIsVolatile);
+  }
 }
   } else {
 Builder.CreateStore(Val, Dest, DestIsVolatile);
@@ -2857,11 +2861,21 @@
 }
 
 assert(

[PATCH] D99483: [clang][AIX] Define __STDC_NO_ATOMICS__ for c11 and above

2021-03-28 Thread David Tenty via Phabricator via cfe-commits
daltenty created this revision.
Herald added a subscriber: jfb.
daltenty requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The libc implementation on AIX does not have stdatomic.h and the requisite 
interfaces for c11 atomics, so for now it's better to set __STDC_NO_ATOMICS__


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99483

Files:
  clang/lib/Basic/Targets/OSTargets.h
  clang/test/Preprocessor/aix-nocatomics.c


Index: clang/test/Preprocessor/aix-nocatomics.c
===
--- /dev/null
+++ clang/test/Preprocessor/aix-nocatomics.c
@@ -0,0 +1,19 @@
+// The AIX library implementation of C11 atomics is incomplete, so test that 
the
+// appropriate macro is set.
+
+// 32-bit cases.
+// RUN: %clang_cc1 -E -dM -triple=powerpc-ibm-aix7.1.0.0 -std=c11 < /dev/null 
| FileCheck -match-full-lines %s
+// RUN: %clang_cc1 -E -dM -triple=powerpc-ibm-aix7.1.0.0 -std=c17 < /dev/null 
| FileCheck -match-full-lines %s
+// RUN: %clang_cc1 -E -dM -triple=powerpc-ibm-aix7.1.0.0 -std=c2x < /dev/null 
| FileCheck -match-full-lines %s
+
+// 64-bit cases.
+// RUN: %clang_cc1 -E -dM -triple=powerpc64-ibm-aix7.1.0.0 -std=c11 < 
/dev/null | FileCheck -match-full-lines %s
+// RUN: %clang_cc1 -E -dM -triple=powerpc64-ibm-aix7.1.0.0 -std=c17 < 
/dev/null | FileCheck -match-full-lines %s
+// RUN: %clang_cc1 -E -dM -triple=powerpc64-ibm-aix7.1.0.0 -std=c2x < 
/dev/null | FileCheck -match-full-lines %s
+
+// CHECK:#define __STDC_NO_ATOMICS__ 1
+
+// Check that it's not set for C before 11.
+// RUN: %clang_cc1 -E -dM -triple=powerpc64-ibm-aix7.1.0.0 -std=c99 < 
/dev/null | FileCheck -match-full-lines -check-prefix C99 %s
+
+// C99-NOT:#define __STDC_NO_ATOMICS__ 1
Index: clang/lib/Basic/Targets/OSTargets.h
===
--- clang/lib/Basic/Targets/OSTargets.h
+++ clang/lib/Basic/Targets/OSTargets.h
@@ -722,6 +722,11 @@
 if (Opts.CPlusPlus && Opts.WChar) {
   Builder.defineMacro("_WCHAR_T");
 }
+
+// The AIX library implementation of C11 atomics is not yet complete.
+if (Opts.C11 || Opts.C17 || Opts.C2x) {
+  Builder.defineMacro("__STDC_NO_ATOMICS__");
+}
   }
 
 public:


Index: clang/test/Preprocessor/aix-nocatomics.c
===
--- /dev/null
+++ clang/test/Preprocessor/aix-nocatomics.c
@@ -0,0 +1,19 @@
+// The AIX library implementation of C11 atomics is incomplete, so test that the
+// appropriate macro is set.
+
+// 32-bit cases.
+// RUN: %clang_cc1 -E -dM -triple=powerpc-ibm-aix7.1.0.0 -std=c11 < /dev/null | FileCheck -match-full-lines %s
+// RUN: %clang_cc1 -E -dM -triple=powerpc-ibm-aix7.1.0.0 -std=c17 < /dev/null | FileCheck -match-full-lines %s
+// RUN: %clang_cc1 -E -dM -triple=powerpc-ibm-aix7.1.0.0 -std=c2x < /dev/null | FileCheck -match-full-lines %s
+
+// 64-bit cases.
+// RUN: %clang_cc1 -E -dM -triple=powerpc64-ibm-aix7.1.0.0 -std=c11 < /dev/null | FileCheck -match-full-lines %s
+// RUN: %clang_cc1 -E -dM -triple=powerpc64-ibm-aix7.1.0.0 -std=c17 < /dev/null | FileCheck -match-full-lines %s
+// RUN: %clang_cc1 -E -dM -triple=powerpc64-ibm-aix7.1.0.0 -std=c2x < /dev/null | FileCheck -match-full-lines %s
+
+// CHECK:#define __STDC_NO_ATOMICS__ 1
+
+// Check that it's not set for C before 11.
+// RUN: %clang_cc1 -E -dM -triple=powerpc64-ibm-aix7.1.0.0 -std=c99 < /dev/null | FileCheck -match-full-lines -check-prefix C99 %s
+
+// C99-NOT:#define __STDC_NO_ATOMICS__ 1
Index: clang/lib/Basic/Targets/OSTargets.h
===
--- clang/lib/Basic/Targets/OSTargets.h
+++ clang/lib/Basic/Targets/OSTargets.h
@@ -722,6 +722,11 @@
 if (Opts.CPlusPlus && Opts.WChar) {
   Builder.defineMacro("_WCHAR_T");
 }
+
+// The AIX library implementation of C11 atomics is not yet complete.
+if (Opts.C11 || Opts.C17 || Opts.C2x) {
+  Builder.defineMacro("__STDC_NO_ATOMICS__");
+}
   }
 
 public:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99364: [clang][cache] Update Fuchsia-stage2.cmake to create hwasan multilibs

2021-03-28 Thread Petr Hosek via Phabricator via cfe-commits
phosek accepted this revision.
phosek added a comment.
This revision is now accepted and ready to land.

LGTM although I'm becoming worried about the impact on build times given the 
rapidly increasing number of multilib variants.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99364

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


[PATCH] D99005: [clang] Implement P2266 Simpler implicit move

2021-03-28 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:1059
+else if (auto *F = dyn_cast(DC))
+  goto unimplemented; // FIXME: get the return type here somehow...
+else

mizvekov wrote:
> @rjmccall Hello! Do you have any tips for fixing this one?
I've always found it annoying that we only store the block type on the 
`BlockExpr` and not the `BlockDecl`, so if you've got a good reason to change 
that, I'm not opposed.

That said, while I'm not an expert in how we do NRVO variable tracking, the 
code must have some ability to handle an unknown return type when just 
processing declarations by delaying some of the bookkeeping/analysis until the 
end of the function.  It's possible but quite uncommon to declare a return type 
explicitly in a block, so that's the dominant case here.  I'm actually 
surprised we do any of this tracking when we're just instantiating a variable.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99005

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