diff options
Diffstat (limited to 'clang/lib/AST')
-rw-r--r-- | clang/lib/AST/ASTConcept.cpp | 56 | ||||
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 1 | ||||
-rw-r--r-- | clang/lib/AST/CMakeLists.txt | 1 | ||||
-rw-r--r-- | clang/lib/AST/Decl.cpp | 2 | ||||
-rw-r--r-- | clang/lib/AST/ExprCXX.cpp | 17 |
5 files changed, 9 insertions, 68 deletions
diff --git a/clang/lib/AST/ASTConcept.cpp b/clang/lib/AST/ASTConcept.cpp deleted file mode 100644 index 3446a6a6da1..00000000000 --- a/clang/lib/AST/ASTConcept.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//===--- ASTConcept.cpp - Concepts Related AST Data Structures --*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -/// -/// \file -/// \brief This file defines AST data structures related to concepts. -/// -//===----------------------------------------------------------------------===// - -#include "clang/AST/ASTConcept.h" -#include "clang/AST/ASTContext.h" -using namespace clang; - -ASTConstraintSatisfaction::ASTConstraintSatisfaction(const ASTContext &C, - const ConstraintSatisfaction &Satisfaction): - NumRecords{Satisfaction.Details.size()}, - IsSatisfied{Satisfaction.IsSatisfied} { - for (unsigned I = 0; I < NumRecords; ++I) { - auto &Detail = Satisfaction.Details[I]; - if (Detail.second.is<Expr *>()) - new (getTrailingObjects<UnsatisfiedConstraintRecord>() + I) - UnsatisfiedConstraintRecord{Detail.first, - UnsatisfiedConstraintRecord::second_type( - Detail.second.get<Expr *>())}; - else { - auto &SubstitutionDiagnostic = - *Detail.second.get<std::pair<SourceLocation, std::string> *>(); - unsigned MessageSize = SubstitutionDiagnostic.second.size(); - char *Mem = new (C) char[MessageSize + 1]; - memcpy(Mem, SubstitutionDiagnostic.second.c_str(), MessageSize); - Mem[MessageSize + 1] = '\0'; - auto *NewSubstDiag = new (C) std::pair<SourceLocation, StringRef>( - SubstitutionDiagnostic.first, StringRef(Mem)); - new (getTrailingObjects<UnsatisfiedConstraintRecord>() + I) - UnsatisfiedConstraintRecord{Detail.first, - UnsatisfiedConstraintRecord::second_type( - NewSubstDiag)}; - } - } -} - - -ASTConstraintSatisfaction * -ASTConstraintSatisfaction::Create(const ASTContext &C, - const ConstraintSatisfaction &Satisfaction) { - std::size_t size = - totalSizeToAlloc<UnsatisfiedConstraintRecord>( - Satisfaction.Details.size()); - void *Mem = C.Allocate(size, alignof(ASTConstraintSatisfaction)); - return new (Mem) ASTConstraintSatisfaction(C, Satisfaction); -} diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index cdd05c02ef3..cda51ec755a 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -14,7 +14,6 @@ #include "CXXABI.h" #include "Interp/Context.h" #include "clang/AST/APValue.h" -#include "clang/AST/ASTConcept.h" #include "clang/AST/ASTMutationListener.h" #include "clang/AST/ASTTypeTraits.h" #include "clang/AST/Attr.h" diff --git a/clang/lib/AST/CMakeLists.txt b/clang/lib/AST/CMakeLists.txt index 1ede58cc9ed..5bae40c8653 100644 --- a/clang/lib/AST/CMakeLists.txt +++ b/clang/lib/AST/CMakeLists.txt @@ -14,7 +14,6 @@ clang_tablegen(Opcodes.inc add_clang_library(clangAST APValue.cpp - ASTConcept.cpp ASTConsumer.cpp ASTContext.cpp ASTDiagnostic.cpp diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 03fb55db14e..66446626c2e 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -4585,7 +4585,7 @@ LabelDecl *LabelDecl::CreateDeserialized(ASTContext &C, unsigned ID) { } void LabelDecl::setMSAsmLabel(StringRef Name) { -char *Buffer = new (getASTContext(), 1) char[Name.size() + 1]; + char *Buffer = new (getASTContext(), 1) char[Name.size() + 1]; memcpy(Buffer, Name.data(), Name.size()); Buffer[Name.size()] = '\0'; MSAsmName = Buffer; diff --git a/clang/lib/AST/ExprCXX.cpp b/clang/lib/AST/ExprCXX.cpp index a6252d45b26..904928bdf28 100644 --- a/clang/lib/AST/ExprCXX.cpp +++ b/clang/lib/AST/ExprCXX.cpp @@ -1755,19 +1755,18 @@ ConceptSpecializationExpr::ConceptSpecializationExpr(ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, SourceLocation ConceptNameLoc, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten, - ArrayRef<TemplateArgument> ConvertedArgs, - const ConstraintSatisfaction *Satisfaction) + ArrayRef<TemplateArgument> ConvertedArgs, Optional<bool> IsSatisfied) : Expr(ConceptSpecializationExprClass, C.BoolTy, VK_RValue, OK_Ordinary, /*TypeDependent=*/false, // All the flags below are set in setTemplateArguments. - /*ValueDependent=*/!Satisfaction, /*InstantiationDependent=*/false, + /*ValueDependent=*/!IsSatisfied.hasValue(), + /*InstantiationDependent=*/false, /*ContainsUnexpandedParameterPacks=*/false), NestedNameSpec(NNS), TemplateKWLoc(TemplateKWLoc), ConceptNameLoc(ConceptNameLoc), FoundDecl(FoundDecl), - NamedConcept(NamedConcept), NumTemplateArgs(ConvertedArgs.size()), - Satisfaction(Satisfaction ? - ASTConstraintSatisfaction::Create(C, *Satisfaction) : - nullptr) { + NamedConcept(NamedConcept, IsSatisfied ? *IsSatisfied : true), + NumTemplateArgs(ConvertedArgs.size()) { + setTemplateArguments(ArgsAsWritten, ConvertedArgs); } @@ -1814,13 +1813,13 @@ ConceptSpecializationExpr::Create(ASTContext &C, NestedNameSpecifierLoc NNS, ConceptDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten, ArrayRef<TemplateArgument> ConvertedArgs, - const ConstraintSatisfaction *Satisfaction) { + Optional<bool> IsSatisfied) { void *Buffer = C.Allocate(totalSizeToAlloc<TemplateArgument>( ConvertedArgs.size())); return new (Buffer) ConceptSpecializationExpr(C, NNS, TemplateKWLoc, ConceptNameLoc, FoundDecl, NamedConcept, ArgsAsWritten, - ConvertedArgs, Satisfaction); + ConvertedArgs, IsSatisfied); } ConceptSpecializationExpr * |