[llvm-branch-commits] [clang-tools-extra] 39930d6 - Add new website to release notes.

2020-03-16 Thread via llvm-branch-commits

Author: Sam McCall
Date: 2020-03-16T11:51:51+01:00
New Revision: 39930d67fffb086cabd08bccdc26ca6ad99b3339

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

LOG: Add new website to release notes.

Added: 


Modified: 
clang-tools-extra/docs/ReleaseNotes.rst

Removed: 




diff  --git a/clang-tools-extra/docs/ReleaseNotes.rst 
b/clang-tools-extra/docs/ReleaseNotes.rst
index 10a48ea5f86a..fbd55e36d6fd 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -32,6 +32,8 @@ infrastructure are described first, followed by tool-specific 
sections.
 Improvements to clangd
 --
 
+- clangd documentation is now found at https://clangd.llvm.org/
+
 - Go-to-definition, hover, find-references etc use a new mechanism to identify
   what is under the cursor, which is (hopefully) more consistent and accurate.
 



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


[llvm-branch-commits] [clang] 9e0bd5e - [Concepts] Fix incorrect DeclContext for transformed RequiresExprBodyDecl

2020-03-16 Thread Saar Raz via llvm-branch-commits

Author: Saar Raz
Date: 2020-03-17T07:49:16+02:00
New Revision: 9e0bd5ec03cbc8d53048e92ddf7fd25bca17e912

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

LOG: [Concepts] Fix incorrect DeclContext for transformed RequiresExprBodyDecl

We would assign the incorrect DeclContext when transforming the 
RequiresExprBodyDecl, causing incorrect
handling of 'this' inside RequiresExprBodyDecls (bug #45162).

Assign the current context as the DeclContext of the transformed decl.

(cherry picked from commit 9769e1ee9acc33638449b50ac394b5ee2d4efb60)

Added: 


Modified: 
clang/lib/Sema/TreeTransform.h
clang/test/SemaTemplate/instantiate-requires-expr.cpp

Removed: 




diff  --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 805fe6684205..0305954a278e 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -11303,7 +11303,7 @@ 
TreeTransform::TransformRequiresExpr(RequiresExpr *E) {
   SemaRef, Sema::ExpressionEvaluationContext::Unevaluated);
 
   RequiresExprBodyDecl *Body = RequiresExprBodyDecl::Create(
-  getSema().Context, E->getBody()->getDeclContext(),
+  getSema().Context, getSema().CurContext,
   E->getBody()->getBeginLoc());
 
   Sema::ContextRAII SavedContext(getSema(), Body, /*NewThisContext*/false);

diff  --git a/clang/test/SemaTemplate/instantiate-requires-expr.cpp 
b/clang/test/SemaTemplate/instantiate-requires-expr.cpp
index 927bc1bf8f12..ba82fc1313fc 100644
--- a/clang/test/SemaTemplate/instantiate-requires-expr.cpp
+++ b/clang/test/SemaTemplate/instantiate-requires-expr.cpp
@@ -164,6 +164,19 @@ namespace expr_requirement {
   struct r3 {};
 
   using r3i = r3; // expected-error{{constraints not 
satisfied for class template 'r3' [with Ts = ]}}
+
+  template
+  struct r4 {
+  constexpr int foo() {
+if constexpr (requires { this->invalid(); })
+  return 1;
+else
+  return 0;
+  }
+
+  constexpr void invalid() requires false { }
+  };
+  static_assert(r4{}.foo() == 0);
 }
 
 namespace nested_requirement {



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


[llvm-branch-commits] [clang] 135744c - [Concepts] Fix incorrect control flow when TryAnnotateTypeConstraint annotates an invalid template-id

2020-03-16 Thread Saar Raz via llvm-branch-commits

Author: Saar Raz
Date: 2020-03-17T07:49:42+02:00
New Revision: 135744ce689569e7c64033bb5812572d3000239b

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

LOG: [Concepts] Fix incorrect control flow when TryAnnotateTypeConstraint 
annotates an invalid template-id

TryAnnotateTypeConstraint could annotate a template-id which doesn't end up 
being a type-constraint,
in which case control flow would incorrectly flow into ParseImplicitInt.

Reenter the loop in this case.
Enable relevant tests for C++20. This required disabling typo-correction during 
TryAnnotateTypeConstraint
and changing a test case which is broken due to a separate bug (will be 
reported and handled separately).

(cherry picked from commit 19fccc52ff2c1da1f93d9317c34769bd9bab8ac8)

Added: 


Modified: 
clang/include/clang/Sema/Sema.h
clang/lib/Parse/ParseDecl.cpp
clang/lib/Parse/ParseTemplate.cpp
clang/lib/Sema/SemaTemplate.cpp
clang/test/SemaCXX/invalid-member-expr.cpp
clang/test/SemaCXX/typo-correction.cpp
clang/test/SemaTemplate/ms-lookup-template-base-classes.cpp

Removed: 




diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 033f7af6f2f3..842e49602274 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -6885,7 +6885,8 @@ class Sema final {
   QualType ObjectType, bool EnteringContext,
   bool &MemberOfUnknownSpecialization,
   SourceLocation TemplateKWLoc = SourceLocation(),
-  AssumedTemplateKind *ATK = nullptr);
+  AssumedTemplateKind *ATK = nullptr,
+  bool Disambiguation = false);
 
   TemplateNameKind isTemplateName(Scope *S,
   CXXScopeSpec &SS,
@@ -6894,7 +6895,8 @@ class Sema final {
   ParsedType ObjectType,
   bool EnteringContext,
   TemplateTy &Template,
-  bool &MemberOfUnknownSpecialization);
+  bool &MemberOfUnknownSpecialization,
+  bool Disambiguation = false);
 
   /// Try to resolve an undeclared template name as a type template.
   ///

diff  --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index cdc3506d5c68..6353e14bc41a 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -3252,6 +3252,9 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
   goto DoneWithDeclSpec;
 if (isTypeConstraintAnnotation())
   continue;
+if (NextToken().is(tok::annot_template_id))
+  // Might have been annotated by TryAnnotateTypeConstraint.
+  continue;
 // Eat the scope spec so the identifier is current.
 ConsumeAnnotationToken();
 ParsedAttributesWithRange Attrs(AttrFactory);
@@ -3405,6 +3408,9 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
   goto DoneWithDeclSpec;
 if (isTypeConstraintAnnotation())
   continue;
+if (Tok.is(tok::annot_template_id))
+  // Might have been annotated by TryAnnotateTypeConstraint.
+  continue;
 ParsedAttributesWithRange Attrs(AttrFactory);
 if (ParseImplicitInt(DS, nullptr, TemplateInfo, AS, DSContext, Attrs)) 
{
   if (!Attrs.empty()) {

diff  --git a/clang/lib/Parse/ParseTemplate.cpp 
b/clang/lib/Parse/ParseTemplate.cpp
index 3bc4e3596f12..609640576e9e 100644
--- a/clang/lib/Parse/ParseTemplate.cpp
+++ b/clang/lib/Parse/ParseTemplate.cpp
@@ -710,7 +710,8 @@ bool Parser::TryAnnotateTypeConstraint() {
   /*ObjectType=*/ParsedType(),
   /*EnteringContext=*/false,
   PossibleConcept,
-  MemberOfUnknownSpecialization);
+  MemberOfUnknownSpecialization,
+  /*Disambiguation=*/true);
 if (MemberOfUnknownSpecialization || !PossibleConcept ||
 TNK != TNK_Concept_template) {
   if (SS.isNotEmpty())

diff  --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 4f577a3cf748..c38c724ed9b0 100755
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -174,7 +174,8 @@ TemplateNameKind Sema::isTemplateName(Scope *S,
   ParsedType ObjectTypePtr,
   bool EnteringContext,
   TemplateTy &TemplateResult,
-  bool &MemberOfUnk