aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/include/clang/AST/ASTImporter.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/clang/include/clang/AST/ASTImporter.h')
-rw-r--r--contrib/llvm-project/clang/include/clang/AST/ASTImporter.h52
1 files changed, 14 insertions, 38 deletions
diff --git a/contrib/llvm-project/clang/include/clang/AST/ASTImporter.h b/contrib/llvm-project/clang/include/clang/AST/ASTImporter.h
index 17e673a8471a..4ffd91384657 100644
--- a/contrib/llvm-project/clang/include/clang/AST/ASTImporter.h
+++ b/contrib/llvm-project/clang/include/clang/AST/ASTImporter.h
@@ -14,7 +14,7 @@
#ifndef LLVM_CLANG_AST_ASTIMPORTER_H
#define LLVM_CLANG_AST_ASTIMPORTER_H
-#include "clang/AST/APValue.h"
+#include "clang/AST/ASTImportError.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclarationName.h"
#include "clang/AST/ExprCXX.h"
@@ -27,9 +27,8 @@
#include "clang/Basic/SourceLocation.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
-#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallVector.h"
-#include "llvm/Support/Error.h"
+#include <optional>
#include <utility>
namespace clang {
@@ -49,33 +48,6 @@ class TagDecl;
class TranslationUnitDecl;
class TypeSourceInfo;
- class ImportError : public llvm::ErrorInfo<ImportError> {
- public:
- /// \brief Kind of error when importing an AST component.
- enum ErrorKind {
- NameConflict, /// Naming ambiguity (likely ODR violation).
- UnsupportedConstruct, /// Not supported node or case.
- Unknown /// Other error.
- };
-
- ErrorKind Error;
-
- static char ID;
-
- ImportError() : Error(Unknown) {}
- ImportError(const ImportError &Other) : Error(Other.Error) {}
- ImportError &operator=(const ImportError &Other) {
- Error = Other.Error;
- return *this;
- }
- ImportError(ErrorKind Error) : Error(Error) { }
-
- std::string toString() const;
-
- void log(raw_ostream &OS) const override;
- std::error_code convertToErrorCode() const override;
- };
-
// \brief Returns with a list of declarations started from the canonical decl
// then followed by subsequent decls in the translation unit.
// This gives a canonical list for each entry in the redecl chain.
@@ -259,7 +231,7 @@ class TypeSourceInfo;
/// imported. The same declaration may or may not be included in
/// ImportedDecls. This map is updated continuously during imports and never
/// cleared (like ImportedDecls).
- llvm::DenseMap<Decl *, ImportError> ImportDeclErrors;
+ llvm::DenseMap<Decl *, ASTImportError> ImportDeclErrors;
/// Mapping from the already-imported declarations in the "to"
/// context to the corresponding declarations in the "from" context.
@@ -286,6 +258,7 @@ class TypeSourceInfo;
FoundDeclsTy findDeclsInToCtx(DeclContext *DC, DeclarationName Name);
void AddToLookupTable(Decl *ToD);
+ llvm::Error ImportAttrs(Decl *ToD, Decl *FromD);
protected:
/// Can be overwritten by subclasses to implement their own import logic.
@@ -332,7 +305,7 @@ class TypeSourceInfo;
/// \param From Object to import.
/// \return Error information (success or error).
template <typename ImportT>
- LLVM_NODISCARD llvm::Error importInto(ImportT &To, const ImportT &From) {
+ [[nodiscard]] llvm::Error importInto(ImportT &To, const ImportT &From) {
auto ToOrErr = Import(From);
if (ToOrErr)
To = *ToOrErr;
@@ -379,6 +352,9 @@ class TypeSourceInfo;
return Import(const_cast<Decl *>(FromD));
}
+ llvm::Expected<InheritedConstructor>
+ Import(const InheritedConstructor &From);
+
/// Return the copy of the given declaration in the "to" context if
/// it has already been imported from the "from" context. Otherwise return
/// nullptr.
@@ -392,7 +368,7 @@ class TypeSourceInfo;
/// in the "to" context was imported. If it was not imported or of the wrong
/// type a null value is returned.
template <typename DeclT>
- llvm::Optional<DeclT *> getImportedFromDecl(const DeclT *ToD) const {
+ std::optional<DeclT *> getImportedFromDecl(const DeclT *ToD) const {
auto FromI = ImportedFromDecls.find(ToD);
if (FromI == ImportedFromDecls.end())
return {};
@@ -507,7 +483,7 @@ class TypeSourceInfo;
/// Import the definition of the given declaration, including all of
/// the declarations it contains.
- LLVM_NODISCARD llvm::Error ImportDefinition(Decl *From);
+ [[nodiscard]] llvm::Error ImportDefinition(Decl *From);
/// Cope with a name conflict when importing a declaration into the
/// given context.
@@ -589,10 +565,10 @@ class TypeSourceInfo;
/// Return if import of the given declaration has failed and if yes
/// the kind of the problem. This gives the first error encountered with
/// the node.
- llvm::Optional<ImportError> getImportDeclErrorIfAny(Decl *FromD) const;
+ std::optional<ASTImportError> getImportDeclErrorIfAny(Decl *FromD) const;
/// Mark (newly) imported declaration with error.
- void setImportDeclError(Decl *From, ImportError Error);
+ void setImportDeclError(Decl *From, ASTImportError Error);
/// Determine whether the given types are structurally
/// equivalent.
@@ -602,8 +578,8 @@ class TypeSourceInfo;
/// Determine the index of a field in its parent record.
/// F should be a field (or indirect field) declaration.
/// \returns The index of the field in its parent context (starting from 0).
- /// On error `None` is returned (parent context is non-record).
- static llvm::Optional<unsigned> getFieldIndex(Decl *F);
+ /// On error `std::nullopt` is returned (parent context is non-record).
+ static std::optional<unsigned> getFieldIndex(Decl *F);
};
} // namespace clang