aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Serialization/ASTReader.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Serialization/ASTReader.h')
-rw-r--r--include/clang/Serialization/ASTReader.h44
1 files changed, 31 insertions, 13 deletions
diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h
index f97f545852f4..37bea48d8846 100644
--- a/include/clang/Serialization/ASTReader.h
+++ b/include/clang/Serialization/ASTReader.h
@@ -1,9 +1,8 @@
//===- ASTReader.h - AST File Reader ----------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -57,7 +56,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator.h"
#include "llvm/ADT/iterator_range.h"
-#include "llvm/Bitcode/BitstreamReader.h"
+#include "llvm/Bitstream/BitstreamReader.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/MemoryBuffer.h"
@@ -98,7 +97,7 @@ class HeaderSearchOptions;
class LangOptions;
class LazyASTUnresolvedSet;
class MacroInfo;
-class MemoryBufferCache;
+class InMemoryModuleCache;
class NamedDecl;
class NamespaceDecl;
class ObjCCategoryDecl;
@@ -441,9 +440,6 @@ private:
/// The module manager which manages modules and their dependencies
ModuleManager ModuleMgr;
- /// The cache that manages memory buffers for PCM files.
- MemoryBufferCache &PCMCache;
-
/// A dummy identifier resolver used to merge TU-scope declarations in
/// C, for the cases where we don't have a Sema object to provide a real
/// identifier resolver.
@@ -1441,6 +1437,7 @@ private:
void Error(StringRef Msg) const;
void Error(unsigned DiagID, StringRef Arg1 = StringRef(),
StringRef Arg2 = StringRef()) const;
+ void Error(llvm::Error &&Err) const;
public:
/// Load the AST file and validate its contents against the given
@@ -1482,8 +1479,8 @@ public:
///
/// \param ReadTimer If non-null, a timer used to track the time spent
/// deserializing.
- ASTReader(Preprocessor &PP, ASTContext *Context,
- const PCHContainerReader &PCHContainerRdr,
+ ASTReader(Preprocessor &PP, InMemoryModuleCache &ModuleCache,
+ ASTContext *Context, const PCHContainerReader &PCHContainerRdr,
ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
StringRef isysroot = "", bool DisableValidation = false,
bool AllowASTWithCompilerErrors = false,
@@ -2224,6 +2221,9 @@ public:
llvm::APFloat ReadAPFloat(const RecordData &Record,
const llvm::fltSemantics &Sem, unsigned &Idx);
+ /// Read an APValue
+ APValue ReadAPValue(const RecordData &Record, unsigned &Idx);
+
// Read a string
static std::string ReadString(const RecordData &Record, unsigned &Idx);
@@ -2235,6 +2235,10 @@ public:
// Read a path
std::string ReadPath(ModuleFile &F, const RecordData &Record, unsigned &Idx);
+ // Read a path
+ std::string ReadPath(StringRef BaseDirectory, const RecordData &Record,
+ unsigned &Idx);
+
// Skip a path
static void SkipPath(const RecordData &Record, unsigned &Idx) {
SkipString(Record, Idx);
@@ -2376,7 +2380,8 @@ public:
/// Reads a record with id AbbrevID from Cursor, resetting the
/// internal state.
- unsigned readRecord(llvm::BitstreamCursor &Cursor, unsigned AbbrevID);
+ Expected<unsigned> readRecord(llvm::BitstreamCursor &Cursor,
+ unsigned AbbrevID);
/// Is this a module file for a module (rather than a PCH or similar).
bool isModule() const { return F->isModule(); }
@@ -2430,6 +2435,14 @@ public:
ID);
}
+ ExplicitSpecifier readExplicitSpec() {
+ uint64_t Kind = readInt();
+ bool HasExpr = Kind & 0x1;
+ Kind = Kind >> 1;
+ return ExplicitSpecifier(HasExpr ? readExpr() : nullptr,
+ static_cast<ExplicitSpecKind>(Kind));
+ }
+
void readExceptionSpec(SmallVectorImpl<QualType> &ExceptionStorage,
FunctionProtoType::ExceptionSpecInfo &ESI) {
return Reader->readExceptionSpec(*F, ExceptionStorage, ESI, Record, Idx);
@@ -2604,6 +2617,8 @@ public:
return Reader->ReadSourceRange(*F, Record, Idx);
}
+ APValue readAPValue() { return Reader->ReadAPValue(Record, Idx); }
+
/// Read an integral value, advancing Idx.
llvm::APInt readAPInt() {
return Reader->ReadAPInt(Record, Idx);
@@ -2666,7 +2681,10 @@ struct SavedStreamPosition {
: Cursor(Cursor), Offset(Cursor.GetCurrentBitNo()) {}
~SavedStreamPosition() {
- Cursor.JumpToBit(Offset);
+ if (llvm::Error Err = Cursor.JumpToBit(Offset))
+ llvm::report_fatal_error(
+ "Cursor should always be able to go back, failed: " +
+ toString(std::move(Err)));
}
private: