|
@@ -1,4 +1,4 @@
|
|
-//===-- ASTReader.cpp - AST File Reader -----------------------------------===//
|
|
|
|
|
|
+//===- ASTReader.cpp - AST File Reader ------------------------------------===//
|
|
//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
//
|
|
@@ -19,28 +19,41 @@
|
|
#include "clang/AST/ASTMutationListener.h"
|
|
#include "clang/AST/ASTMutationListener.h"
|
|
#include "clang/AST/ASTUnresolvedSet.h"
|
|
#include "clang/AST/ASTUnresolvedSet.h"
|
|
#include "clang/AST/Decl.h"
|
|
#include "clang/AST/Decl.h"
|
|
|
|
+#include "clang/AST/DeclBase.h"
|
|
#include "clang/AST/DeclCXX.h"
|
|
#include "clang/AST/DeclCXX.h"
|
|
|
|
+#include "clang/AST/DeclFriend.h"
|
|
#include "clang/AST/DeclGroup.h"
|
|
#include "clang/AST/DeclGroup.h"
|
|
#include "clang/AST/DeclObjC.h"
|
|
#include "clang/AST/DeclObjC.h"
|
|
#include "clang/AST/DeclTemplate.h"
|
|
#include "clang/AST/DeclTemplate.h"
|
|
|
|
+#include "clang/AST/DeclarationName.h"
|
|
#include "clang/AST/Expr.h"
|
|
#include "clang/AST/Expr.h"
|
|
#include "clang/AST/ExprCXX.h"
|
|
#include "clang/AST/ExprCXX.h"
|
|
|
|
+#include "clang/AST/ExternalASTSource.h"
|
|
#include "clang/AST/NestedNameSpecifier.h"
|
|
#include "clang/AST/NestedNameSpecifier.h"
|
|
#include "clang/AST/ODRHash.h"
|
|
#include "clang/AST/ODRHash.h"
|
|
#include "clang/AST/RawCommentList.h"
|
|
#include "clang/AST/RawCommentList.h"
|
|
|
|
+#include "clang/AST/TemplateBase.h"
|
|
|
|
+#include "clang/AST/TemplateName.h"
|
|
#include "clang/AST/Type.h"
|
|
#include "clang/AST/Type.h"
|
|
|
|
+#include "clang/AST/TypeLoc.h"
|
|
#include "clang/AST/TypeLocVisitor.h"
|
|
#include "clang/AST/TypeLocVisitor.h"
|
|
#include "clang/AST/UnresolvedSet.h"
|
|
#include "clang/AST/UnresolvedSet.h"
|
|
#include "clang/Basic/CommentOptions.h"
|
|
#include "clang/Basic/CommentOptions.h"
|
|
|
|
+#include "clang/Basic/Diagnostic.h"
|
|
#include "clang/Basic/DiagnosticOptions.h"
|
|
#include "clang/Basic/DiagnosticOptions.h"
|
|
#include "clang/Basic/ExceptionSpecificationType.h"
|
|
#include "clang/Basic/ExceptionSpecificationType.h"
|
|
#include "clang/Basic/FileManager.h"
|
|
#include "clang/Basic/FileManager.h"
|
|
#include "clang/Basic/FileSystemOptions.h"
|
|
#include "clang/Basic/FileSystemOptions.h"
|
|
|
|
+#include "clang/Basic/IdentifierTable.h"
|
|
|
|
+#include "clang/Basic/LLVM.h"
|
|
#include "clang/Basic/LangOptions.h"
|
|
#include "clang/Basic/LangOptions.h"
|
|
#include "clang/Basic/MemoryBufferCache.h"
|
|
#include "clang/Basic/MemoryBufferCache.h"
|
|
|
|
+#include "clang/Basic/Module.h"
|
|
#include "clang/Basic/ObjCRuntime.h"
|
|
#include "clang/Basic/ObjCRuntime.h"
|
|
#include "clang/Basic/OperatorKinds.h"
|
|
#include "clang/Basic/OperatorKinds.h"
|
|
|
|
+#include "clang/Basic/PragmaKinds.h"
|
|
#include "clang/Basic/Sanitizers.h"
|
|
#include "clang/Basic/Sanitizers.h"
|
|
|
|
+#include "clang/Basic/SourceLocation.h"
|
|
#include "clang/Basic/SourceManager.h"
|
|
#include "clang/Basic/SourceManager.h"
|
|
#include "clang/Basic/SourceManagerInternals.h"
|
|
#include "clang/Basic/SourceManagerInternals.h"
|
|
#include "clang/Basic/Specifiers.h"
|
|
#include "clang/Basic/Specifiers.h"
|
|
@@ -57,41 +70,61 @@
|
|
#include "clang/Lex/PreprocessingRecord.h"
|
|
#include "clang/Lex/PreprocessingRecord.h"
|
|
#include "clang/Lex/Preprocessor.h"
|
|
#include "clang/Lex/Preprocessor.h"
|
|
#include "clang/Lex/PreprocessorOptions.h"
|
|
#include "clang/Lex/PreprocessorOptions.h"
|
|
|
|
+#include "clang/Lex/Token.h"
|
|
|
|
+#include "clang/Sema/ObjCMethodList.h"
|
|
#include "clang/Sema/Scope.h"
|
|
#include "clang/Sema/Scope.h"
|
|
#include "clang/Sema/Sema.h"
|
|
#include "clang/Sema/Sema.h"
|
|
#include "clang/Sema/Weak.h"
|
|
#include "clang/Sema/Weak.h"
|
|
|
|
+#include "clang/Serialization/ASTBitCodes.h"
|
|
#include "clang/Serialization/ASTDeserializationListener.h"
|
|
#include "clang/Serialization/ASTDeserializationListener.h"
|
|
|
|
+#include "clang/Serialization/ContinuousRangeMap.h"
|
|
#include "clang/Serialization/GlobalModuleIndex.h"
|
|
#include "clang/Serialization/GlobalModuleIndex.h"
|
|
|
|
+#include "clang/Serialization/Module.h"
|
|
|
|
+#include "clang/Serialization/ModuleFileExtension.h"
|
|
#include "clang/Serialization/ModuleManager.h"
|
|
#include "clang/Serialization/ModuleManager.h"
|
|
#include "clang/Serialization/SerializationDiagnostic.h"
|
|
#include "clang/Serialization/SerializationDiagnostic.h"
|
|
#include "llvm/ADT/APFloat.h"
|
|
#include "llvm/ADT/APFloat.h"
|
|
#include "llvm/ADT/APInt.h"
|
|
#include "llvm/ADT/APInt.h"
|
|
#include "llvm/ADT/APSInt.h"
|
|
#include "llvm/ADT/APSInt.h"
|
|
|
|
+#include "llvm/ADT/ArrayRef.h"
|
|
|
|
+#include "llvm/ADT/DenseMap.h"
|
|
|
|
+#include "llvm/ADT/FoldingSet.h"
|
|
#include "llvm/ADT/Hashing.h"
|
|
#include "llvm/ADT/Hashing.h"
|
|
|
|
+#include "llvm/ADT/IntrusiveRefCntPtr.h"
|
|
|
|
+#include "llvm/ADT/None.h"
|
|
|
|
+#include "llvm/ADT/Optional.h"
|
|
|
|
+#include "llvm/ADT/STLExtras.h"
|
|
|
|
+#include "llvm/ADT/SmallPtrSet.h"
|
|
#include "llvm/ADT/SmallString.h"
|
|
#include "llvm/ADT/SmallString.h"
|
|
|
|
+#include "llvm/ADT/SmallVector.h"
|
|
#include "llvm/ADT/StringExtras.h"
|
|
#include "llvm/ADT/StringExtras.h"
|
|
|
|
+#include "llvm/ADT/StringMap.h"
|
|
|
|
+#include "llvm/ADT/StringRef.h"
|
|
#include "llvm/ADT/Triple.h"
|
|
#include "llvm/ADT/Triple.h"
|
|
|
|
+#include "llvm/ADT/iterator_range.h"
|
|
#include "llvm/Bitcode/BitstreamReader.h"
|
|
#include "llvm/Bitcode/BitstreamReader.h"
|
|
|
|
+#include "llvm/Support/Casting.h"
|
|
#include "llvm/Support/Compression.h"
|
|
#include "llvm/Support/Compression.h"
|
|
#include "llvm/Support/Compiler.h"
|
|
#include "llvm/Support/Compiler.h"
|
|
|
|
+#include "llvm/Support/Endian.h"
|
|
#include "llvm/Support/Error.h"
|
|
#include "llvm/Support/Error.h"
|
|
#include "llvm/Support/ErrorHandling.h"
|
|
#include "llvm/Support/ErrorHandling.h"
|
|
#include "llvm/Support/FileSystem.h"
|
|
#include "llvm/Support/FileSystem.h"
|
|
#include "llvm/Support/MemoryBuffer.h"
|
|
#include "llvm/Support/MemoryBuffer.h"
|
|
#include "llvm/Support/Path.h"
|
|
#include "llvm/Support/Path.h"
|
|
#include "llvm/Support/SaveAndRestore.h"
|
|
#include "llvm/Support/SaveAndRestore.h"
|
|
|
|
+#include "llvm/Support/Timer.h"
|
|
#include "llvm/Support/raw_ostream.h"
|
|
#include "llvm/Support/raw_ostream.h"
|
|
#include <algorithm>
|
|
#include <algorithm>
|
|
#include <cassert>
|
|
#include <cassert>
|
|
|
|
+#include <cstddef>
|
|
#include <cstdint>
|
|
#include <cstdint>
|
|
#include <cstdio>
|
|
#include <cstdio>
|
|
-#include <cstring>
|
|
|
|
#include <ctime>
|
|
#include <ctime>
|
|
#include <iterator>
|
|
#include <iterator>
|
|
#include <limits>
|
|
#include <limits>
|
|
#include <map>
|
|
#include <map>
|
|
#include <memory>
|
|
#include <memory>
|
|
-#include <new>
|
|
|
|
#include <string>
|
|
#include <string>
|
|
#include <system_error>
|
|
#include <system_error>
|
|
#include <tuple>
|
|
#include <tuple>
|
|
@@ -171,19 +204,23 @@ bool ChainedASTReaderListener::ReadPreprocessorOptions(
|
|
SuggestedPredefines) ||
|
|
SuggestedPredefines) ||
|
|
Second->ReadPreprocessorOptions(PPOpts, Complain, SuggestedPredefines);
|
|
Second->ReadPreprocessorOptions(PPOpts, Complain, SuggestedPredefines);
|
|
}
|
|
}
|
|
|
|
+
|
|
void ChainedASTReaderListener::ReadCounter(const serialization::ModuleFile &M,
|
|
void ChainedASTReaderListener::ReadCounter(const serialization::ModuleFile &M,
|
|
unsigned Value) {
|
|
unsigned Value) {
|
|
First->ReadCounter(M, Value);
|
|
First->ReadCounter(M, Value);
|
|
Second->ReadCounter(M, Value);
|
|
Second->ReadCounter(M, Value);
|
|
}
|
|
}
|
|
|
|
+
|
|
bool ChainedASTReaderListener::needsInputFileVisitation() {
|
|
bool ChainedASTReaderListener::needsInputFileVisitation() {
|
|
return First->needsInputFileVisitation() ||
|
|
return First->needsInputFileVisitation() ||
|
|
Second->needsInputFileVisitation();
|
|
Second->needsInputFileVisitation();
|
|
}
|
|
}
|
|
|
|
+
|
|
bool ChainedASTReaderListener::needsSystemInputFileVisitation() {
|
|
bool ChainedASTReaderListener::needsSystemInputFileVisitation() {
|
|
return First->needsSystemInputFileVisitation() ||
|
|
return First->needsSystemInputFileVisitation() ||
|
|
Second->needsSystemInputFileVisitation();
|
|
Second->needsSystemInputFileVisitation();
|
|
}
|
|
}
|
|
|
|
+
|
|
void ChainedASTReaderListener::visitModuleFile(StringRef Filename,
|
|
void ChainedASTReaderListener::visitModuleFile(StringRef Filename,
|
|
ModuleKind Kind) {
|
|
ModuleKind Kind) {
|
|
First->visitModuleFile(Filename, Kind);
|
|
First->visitModuleFile(Filename, Kind);
|
|
@@ -216,7 +253,7 @@ void ChainedASTReaderListener::readModuleFileExtension(
|
|
// PCH validator implementation
|
|
// PCH validator implementation
|
|
//===----------------------------------------------------------------------===//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
-ASTReaderListener::~ASTReaderListener() {}
|
|
|
|
|
|
+ASTReaderListener::~ASTReaderListener() = default;
|
|
|
|
|
|
/// \brief Compare the given set of language options against an existing set of
|
|
/// \brief Compare the given set of language options against an existing set of
|
|
/// language options.
|
|
/// language options.
|
|
@@ -409,17 +446,16 @@ bool PCHValidator::ReadTargetOptions(const TargetOptions &TargetOpts,
|
|
|
|
|
|
namespace {
|
|
namespace {
|
|
|
|
|
|
- typedef llvm::StringMap<std::pair<StringRef, bool /*IsUndef*/> >
|
|
|
|
- MacroDefinitionsMap;
|
|
|
|
- typedef llvm::DenseMap<DeclarationName, SmallVector<NamedDecl *, 8> >
|
|
|
|
- DeclsMap;
|
|
|
|
|
|
+using MacroDefinitionsMap =
|
|
|
|
+ llvm::StringMap<std::pair<StringRef, bool /*IsUndef*/>>;
|
|
|
|
+using DeclsMap = llvm::DenseMap<DeclarationName, SmallVector<NamedDecl *, 8>>;
|
|
|
|
|
|
-} // end anonymous namespace
|
|
|
|
|
|
+} // namespace
|
|
|
|
|
|
static bool checkDiagnosticGroupMappings(DiagnosticsEngine &StoredDiags,
|
|
static bool checkDiagnosticGroupMappings(DiagnosticsEngine &StoredDiags,
|
|
DiagnosticsEngine &Diags,
|
|
DiagnosticsEngine &Diags,
|
|
bool Complain) {
|
|
bool Complain) {
|
|
- typedef DiagnosticsEngine::Level Level;
|
|
|
|
|
|
+ using Level = DiagnosticsEngine::Level;
|
|
|
|
|
|
// Check current mappings for new -Werror mappings, and the stored mappings
|
|
// Check current mappings for new -Werror mappings, and the stored mappings
|
|
// for cases that were explicitly mapped to *not* be errors that are now
|
|
// for cases that were explicitly mapped to *not* be errors that are now
|
|
@@ -603,8 +639,8 @@ static bool checkPreprocessorOptions(const PreprocessorOptions &PPOpts,
|
|
std::pair<StringRef, bool> Existing = ExistingMacros[MacroName];
|
|
std::pair<StringRef, bool> Existing = ExistingMacros[MacroName];
|
|
|
|
|
|
// Check whether we know anything about this macro name or not.
|
|
// Check whether we know anything about this macro name or not.
|
|
- llvm::StringMap<std::pair<StringRef, bool /*IsUndef*/> >::iterator Known
|
|
|
|
- = ASTFileMacros.find(MacroName);
|
|
|
|
|
|
+ llvm::StringMap<std::pair<StringRef, bool /*IsUndef*/>>::iterator Known =
|
|
|
|
+ ASTFileMacros.find(MacroName);
|
|
if (!Validate || Known == ASTFileMacros.end()) {
|
|
if (!Validate || Known == ASTFileMacros.end()) {
|
|
// FIXME: Check whether this identifier was referenced anywhere in the
|
|
// FIXME: Check whether this identifier was referenced anywhere in the
|
|
// AST file. If so, we should reject the AST file. Unfortunately, this
|
|
// AST file. If so, we should reject the AST file. Unfortunately, this
|
|
@@ -770,6 +806,7 @@ unsigned ASTSelectorLookupTrait::ComputeHash(Selector Sel) {
|
|
std::pair<unsigned, unsigned>
|
|
std::pair<unsigned, unsigned>
|
|
ASTSelectorLookupTrait::ReadKeyDataLength(const unsigned char*& d) {
|
|
ASTSelectorLookupTrait::ReadKeyDataLength(const unsigned char*& d) {
|
|
using namespace llvm::support;
|
|
using namespace llvm::support;
|
|
|
|
+
|
|
unsigned KeyLen = endian::readNext<uint16_t, little, unaligned>(d);
|
|
unsigned KeyLen = endian::readNext<uint16_t, little, unaligned>(d);
|
|
unsigned DataLen = endian::readNext<uint16_t, little, unaligned>(d);
|
|
unsigned DataLen = endian::readNext<uint16_t, little, unaligned>(d);
|
|
return std::make_pair(KeyLen, DataLen);
|
|
return std::make_pair(KeyLen, DataLen);
|
|
@@ -778,6 +815,7 @@ ASTSelectorLookupTrait::ReadKeyDataLength(const unsigned char*& d) {
|
|
ASTSelectorLookupTrait::internal_key_type
|
|
ASTSelectorLookupTrait::internal_key_type
|
|
ASTSelectorLookupTrait::ReadKey(const unsigned char* d, unsigned) {
|
|
ASTSelectorLookupTrait::ReadKey(const unsigned char* d, unsigned) {
|
|
using namespace llvm::support;
|
|
using namespace llvm::support;
|
|
|
|
+
|
|
SelectorTable &SelTable = Reader.getContext().Selectors;
|
|
SelectorTable &SelTable = Reader.getContext().Selectors;
|
|
unsigned N = endian::readNext<uint16_t, little, unaligned>(d);
|
|
unsigned N = endian::readNext<uint16_t, little, unaligned>(d);
|
|
IdentifierInfo *FirstII = Reader.getLocalIdentifier(
|
|
IdentifierInfo *FirstII = Reader.getLocalIdentifier(
|
|
@@ -838,6 +876,7 @@ unsigned ASTIdentifierLookupTraitBase::ComputeHash(const internal_key_type& a) {
|
|
std::pair<unsigned, unsigned>
|
|
std::pair<unsigned, unsigned>
|
|
ASTIdentifierLookupTraitBase::ReadKeyDataLength(const unsigned char*& d) {
|
|
ASTIdentifierLookupTraitBase::ReadKeyDataLength(const unsigned char*& d) {
|
|
using namespace llvm::support;
|
|
using namespace llvm::support;
|
|
|
|
+
|
|
unsigned DataLen = endian::readNext<uint16_t, little, unaligned>(d);
|
|
unsigned DataLen = endian::readNext<uint16_t, little, unaligned>(d);
|
|
unsigned KeyLen = endian::readNext<uint16_t, little, unaligned>(d);
|
|
unsigned KeyLen = endian::readNext<uint16_t, little, unaligned>(d);
|
|
return std::make_pair(KeyLen, DataLen);
|
|
return std::make_pair(KeyLen, DataLen);
|
|
@@ -868,6 +907,7 @@ static bool readBit(unsigned &Bits) {
|
|
|
|
|
|
IdentID ASTIdentifierLookupTrait::ReadIdentifierID(const unsigned char *d) {
|
|
IdentID ASTIdentifierLookupTrait::ReadIdentifierID(const unsigned char *d) {
|
|
using namespace llvm::support;
|
|
using namespace llvm::support;
|
|
|
|
+
|
|
unsigned RawID = endian::readNext<uint32_t, little, unaligned>(d);
|
|
unsigned RawID = endian::readNext<uint32_t, little, unaligned>(d);
|
|
return Reader.getGlobalIdentifierID(F, RawID >> 1);
|
|
return Reader.getGlobalIdentifierID(F, RawID >> 1);
|
|
}
|
|
}
|
|
@@ -885,6 +925,7 @@ IdentifierInfo *ASTIdentifierLookupTrait::ReadData(const internal_key_type& k,
|
|
const unsigned char* d,
|
|
const unsigned char* d,
|
|
unsigned DataLen) {
|
|
unsigned DataLen) {
|
|
using namespace llvm::support;
|
|
using namespace llvm::support;
|
|
|
|
+
|
|
unsigned RawID = endian::readNext<uint32_t, little, unaligned>(d);
|
|
unsigned RawID = endian::readNext<uint32_t, little, unaligned>(d);
|
|
bool IsInteresting = RawID & 0x01;
|
|
bool IsInteresting = RawID & 0x01;
|
|
|
|
|
|
@@ -1027,6 +1068,7 @@ unsigned DeclarationNameKey::getHash() const {
|
|
ModuleFile *
|
|
ModuleFile *
|
|
ASTDeclContextNameLookupTrait::ReadFileRef(const unsigned char *&d) {
|
|
ASTDeclContextNameLookupTrait::ReadFileRef(const unsigned char *&d) {
|
|
using namespace llvm::support;
|
|
using namespace llvm::support;
|
|
|
|
+
|
|
uint32_t ModuleFileID = endian::readNext<uint32_t, little, unaligned>(d);
|
|
uint32_t ModuleFileID = endian::readNext<uint32_t, little, unaligned>(d);
|
|
return Reader.getLocalModuleFile(F, ModuleFileID);
|
|
return Reader.getLocalModuleFile(F, ModuleFileID);
|
|
}
|
|
}
|
|
@@ -1034,6 +1076,7 @@ ASTDeclContextNameLookupTrait::ReadFileRef(const unsigned char *&d) {
|
|
std::pair<unsigned, unsigned>
|
|
std::pair<unsigned, unsigned>
|
|
ASTDeclContextNameLookupTrait::ReadKeyDataLength(const unsigned char *&d) {
|
|
ASTDeclContextNameLookupTrait::ReadKeyDataLength(const unsigned char *&d) {
|
|
using namespace llvm::support;
|
|
using namespace llvm::support;
|
|
|
|
+
|
|
unsigned KeyLen = endian::readNext<uint16_t, little, unaligned>(d);
|
|
unsigned KeyLen = endian::readNext<uint16_t, little, unaligned>(d);
|
|
unsigned DataLen = endian::readNext<uint16_t, little, unaligned>(d);
|
|
unsigned DataLen = endian::readNext<uint16_t, little, unaligned>(d);
|
|
return std::make_pair(KeyLen, DataLen);
|
|
return std::make_pair(KeyLen, DataLen);
|
|
@@ -1079,6 +1122,7 @@ void ASTDeclContextNameLookupTrait::ReadDataInto(internal_key_type,
|
|
unsigned DataLen,
|
|
unsigned DataLen,
|
|
data_type_builder &Val) {
|
|
data_type_builder &Val) {
|
|
using namespace llvm::support;
|
|
using namespace llvm::support;
|
|
|
|
+
|
|
for (unsigned NumDecls = DataLen / 4; NumDecls; --NumDecls) {
|
|
for (unsigned NumDecls = DataLen / 4; NumDecls; --NumDecls) {
|
|
uint32_t LocalID = endian::readNext<uint32_t, little, unaligned>(d);
|
|
uint32_t LocalID = endian::readNext<uint32_t, little, unaligned>(d);
|
|
Val.insert(Reader.getGlobalDeclID(F, LocalID));
|
|
Val.insert(Reader.getGlobalDeclID(F, LocalID));
|
|
@@ -1278,7 +1322,9 @@ resolveFileRelativeToOriginalDir(const std::string &Filename,
|
|
const std::string &CurrDir) {
|
|
const std::string &CurrDir) {
|
|
assert(OriginalDir != CurrDir &&
|
|
assert(OriginalDir != CurrDir &&
|
|
"No point trying to resolve the file if the PCH dir didn't change");
|
|
"No point trying to resolve the file if the PCH dir didn't change");
|
|
|
|
+
|
|
using namespace llvm::sys;
|
|
using namespace llvm::sys;
|
|
|
|
+
|
|
SmallString<128> filePath(Filename);
|
|
SmallString<128> filePath(Filename);
|
|
fs::make_absolute(filePath);
|
|
fs::make_absolute(filePath);
|
|
assert(path::is_absolute(OriginalDir));
|
|
assert(path::is_absolute(OriginalDir));
|
|
@@ -1672,6 +1718,7 @@ bool HeaderFileInfoTrait::EqualKey(internal_key_ref a, internal_key_ref b) {
|
|
std::pair<unsigned, unsigned>
|
|
std::pair<unsigned, unsigned>
|
|
HeaderFileInfoTrait::ReadKeyDataLength(const unsigned char*& d) {
|
|
HeaderFileInfoTrait::ReadKeyDataLength(const unsigned char*& d) {
|
|
using namespace llvm::support;
|
|
using namespace llvm::support;
|
|
|
|
+
|
|
unsigned KeyLen = (unsigned) endian::readNext<uint16_t, little, unaligned>(d);
|
|
unsigned KeyLen = (unsigned) endian::readNext<uint16_t, little, unaligned>(d);
|
|
unsigned DataLen = (unsigned) *d++;
|
|
unsigned DataLen = (unsigned) *d++;
|
|
return std::make_pair(KeyLen, DataLen);
|
|
return std::make_pair(KeyLen, DataLen);
|
|
@@ -1680,6 +1727,7 @@ HeaderFileInfoTrait::ReadKeyDataLength(const unsigned char*& d) {
|
|
HeaderFileInfoTrait::internal_key_type
|
|
HeaderFileInfoTrait::internal_key_type
|
|
HeaderFileInfoTrait::ReadKey(const unsigned char *d, unsigned) {
|
|
HeaderFileInfoTrait::ReadKey(const unsigned char *d, unsigned) {
|
|
using namespace llvm::support;
|
|
using namespace llvm::support;
|
|
|
|
+
|
|
internal_key_type ikey;
|
|
internal_key_type ikey;
|
|
ikey.Size = off_t(endian::readNext<uint64_t, little, unaligned>(d));
|
|
ikey.Size = off_t(endian::readNext<uint64_t, little, unaligned>(d));
|
|
ikey.ModTime = time_t(endian::readNext<uint64_t, little, unaligned>(d));
|
|
ikey.ModTime = time_t(endian::readNext<uint64_t, little, unaligned>(d));
|
|
@@ -1691,8 +1739,9 @@ HeaderFileInfoTrait::ReadKey(const unsigned char *d, unsigned) {
|
|
HeaderFileInfoTrait::data_type
|
|
HeaderFileInfoTrait::data_type
|
|
HeaderFileInfoTrait::ReadData(internal_key_ref key, const unsigned char *d,
|
|
HeaderFileInfoTrait::ReadData(internal_key_ref key, const unsigned char *d,
|
|
unsigned DataLen) {
|
|
unsigned DataLen) {
|
|
- const unsigned char *End = d + DataLen;
|
|
|
|
using namespace llvm::support;
|
|
using namespace llvm::support;
|
|
|
|
+
|
|
|
|
+ const unsigned char *End = d + DataLen;
|
|
HeaderFileInfo HFI;
|
|
HeaderFileInfo HFI;
|
|
unsigned Flags = *d++;
|
|
unsigned Flags = *d++;
|
|
// FIXME: Refactor with mergeHeaderFileInfo in HeaderSearch.cpp.
|
|
// FIXME: Refactor with mergeHeaderFileInfo in HeaderSearch.cpp.
|
|
@@ -1813,7 +1862,7 @@ namespace {
|
|
unsigned PriorGeneration;
|
|
unsigned PriorGeneration;
|
|
unsigned &NumIdentifierLookups;
|
|
unsigned &NumIdentifierLookups;
|
|
unsigned &NumIdentifierLookupHits;
|
|
unsigned &NumIdentifierLookupHits;
|
|
- IdentifierInfo *Found;
|
|
|
|
|
|
+ IdentifierInfo *Found = nullptr;
|
|
|
|
|
|
public:
|
|
public:
|
|
IdentifierLookupVisitor(StringRef Name, unsigned PriorGeneration,
|
|
IdentifierLookupVisitor(StringRef Name, unsigned PriorGeneration,
|
|
@@ -1822,10 +1871,7 @@ namespace {
|
|
: Name(Name), NameHash(ASTIdentifierLookupTrait::ComputeHash(Name)),
|
|
: Name(Name), NameHash(ASTIdentifierLookupTrait::ComputeHash(Name)),
|
|
PriorGeneration(PriorGeneration),
|
|
PriorGeneration(PriorGeneration),
|
|
NumIdentifierLookups(NumIdentifierLookups),
|
|
NumIdentifierLookups(NumIdentifierLookups),
|
|
- NumIdentifierLookupHits(NumIdentifierLookupHits),
|
|
|
|
- Found()
|
|
|
|
- {
|
|
|
|
- }
|
|
|
|
|
|
+ NumIdentifierLookupHits(NumIdentifierLookupHits) {}
|
|
|
|
|
|
bool operator()(ModuleFile &M) {
|
|
bool operator()(ModuleFile &M) {
|
|
// If we've already searched this module file, skip it now.
|
|
// If we've already searched this module file, skip it now.
|
|
@@ -1858,7 +1904,7 @@ namespace {
|
|
IdentifierInfo *getIdentifierInfo() const { return Found; }
|
|
IdentifierInfo *getIdentifierInfo() const { return Found; }
|
|
};
|
|
};
|
|
|
|
|
|
-} // end anonymous namespace
|
|
|
|
|
|
+} // namespace
|
|
|
|
|
|
void ASTReader::updateOutOfDateIdentifier(IdentifierInfo &II) {
|
|
void ASTReader::updateOutOfDateIdentifier(IdentifierInfo &II) {
|
|
// Note that we are loading an identifier.
|
|
// Note that we are loading an identifier.
|
|
@@ -1985,10 +2031,9 @@ void ASTReader::resolvePendingMacro(IdentifierInfo *II,
|
|
MD = PP.AllocateDefMacroDirective(MI, Loc);
|
|
MD = PP.AllocateDefMacroDirective(MI, Loc);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- case MacroDirective::MD_Undefine: {
|
|
|
|
|
|
+ case MacroDirective::MD_Undefine:
|
|
MD = PP.AllocateUndefMacroDirective(Loc);
|
|
MD = PP.AllocateUndefMacroDirective(Loc);
|
|
break;
|
|
break;
|
|
- }
|
|
|
|
case MacroDirective::MD_Visibility:
|
|
case MacroDirective::MD_Visibility:
|
|
bool isPublic = Record[Idx++];
|
|
bool isPublic = Record[Idx++];
|
|
MD = PP.AllocateVisibilityMacroDirective(Loc, isPublic);
|
|
MD = PP.AllocateVisibilityMacroDirective(Loc, isPublic);
|
|
@@ -2124,7 +2169,7 @@ InputFile ASTReader::getInputFile(ModuleFile &F, unsigned ID, bool Complain) {
|
|
if (Complain) {
|
|
if (Complain) {
|
|
// Build a list of the PCH imports that got us here (in reverse).
|
|
// Build a list of the PCH imports that got us here (in reverse).
|
|
SmallVector<ModuleFile *, 4> ImportStack(1, &F);
|
|
SmallVector<ModuleFile *, 4> ImportStack(1, &F);
|
|
- while (ImportStack.back()->ImportedBy.size() > 0)
|
|
|
|
|
|
+ while (!ImportStack.back()->ImportedBy.empty())
|
|
ImportStack.push_back(ImportStack.back()->ImportedBy[0]);
|
|
ImportStack.push_back(ImportStack.back()->ImportedBy[0]);
|
|
|
|
|
|
// The top-level PCH is stale.
|
|
// The top-level PCH is stale.
|
|
@@ -2622,7 +2667,7 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) {
|
|
case llvm::BitstreamEntry::Error:
|
|
case llvm::BitstreamEntry::Error:
|
|
Error("error at end of module block in AST file");
|
|
Error("error at end of module block in AST file");
|
|
return Failure;
|
|
return Failure;
|
|
- case llvm::BitstreamEntry::EndBlock: {
|
|
|
|
|
|
+ case llvm::BitstreamEntry::EndBlock:
|
|
// Outside of C++, we do not store a lookup map for the translation unit.
|
|
// Outside of C++, we do not store a lookup map for the translation unit.
|
|
// Instead, mark it as needing a lookup map to be built if this module
|
|
// Instead, mark it as needing a lookup map to be built if this module
|
|
// contains any declarations lexically within it (which it always does!).
|
|
// contains any declarations lexically within it (which it always does!).
|
|
@@ -2635,7 +2680,6 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) {
|
|
}
|
|
}
|
|
|
|
|
|
return Success;
|
|
return Success;
|
|
- }
|
|
|
|
case llvm::BitstreamEntry::SubBlock:
|
|
case llvm::BitstreamEntry::SubBlock:
|
|
switch (Entry.ID) {
|
|
switch (Entry.ID) {
|
|
case DECLTYPES_BLOCK_ID:
|
|
case DECLTYPES_BLOCK_ID:
|
|
@@ -2995,8 +3039,20 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) {
|
|
|
|
|
|
case PP_CONDITIONAL_STACK:
|
|
case PP_CONDITIONAL_STACK:
|
|
if (!Record.empty()) {
|
|
if (!Record.empty()) {
|
|
|
|
+ unsigned Idx = 0, End = Record.size() - 1;
|
|
|
|
+ bool ReachedEOFWhileSkipping = Record[Idx++];
|
|
|
|
+ llvm::Optional<Preprocessor::PreambleSkipInfo> SkipInfo;
|
|
|
|
+ if (ReachedEOFWhileSkipping) {
|
|
|
|
+ SourceLocation HashToken = ReadSourceLocation(F, Record, Idx);
|
|
|
|
+ SourceLocation IfTokenLoc = ReadSourceLocation(F, Record, Idx);
|
|
|
|
+ bool FoundNonSkipPortion = Record[Idx++];
|
|
|
|
+ bool FoundElse = Record[Idx++];
|
|
|
|
+ SourceLocation ElseLoc = ReadSourceLocation(F, Record, Idx);
|
|
|
|
+ SkipInfo.emplace(HashToken, IfTokenLoc, FoundNonSkipPortion,
|
|
|
|
+ FoundElse, ElseLoc);
|
|
|
|
+ }
|
|
SmallVector<PPConditionalInfo, 4> ConditionalStack;
|
|
SmallVector<PPConditionalInfo, 4> ConditionalStack;
|
|
- for (unsigned Idx = 0, N = Record.size() - 1; Idx < N; /* in loop */) {
|
|
|
|
|
|
+ while (Idx < End) {
|
|
auto Loc = ReadSourceLocation(F, Record, Idx);
|
|
auto Loc = ReadSourceLocation(F, Record, Idx);
|
|
bool WasSkipping = Record[Idx++];
|
|
bool WasSkipping = Record[Idx++];
|
|
bool FoundNonSkip = Record[Idx++];
|
|
bool FoundNonSkip = Record[Idx++];
|
|
@@ -3004,7 +3060,7 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) {
|
|
ConditionalStack.push_back(
|
|
ConditionalStack.push_back(
|
|
{Loc, WasSkipping, FoundNonSkip, FoundElse});
|
|
{Loc, WasSkipping, FoundNonSkip, FoundElse});
|
|
}
|
|
}
|
|
- PP.setReplayablePreambleConditionalStack(ConditionalStack);
|
|
|
|
|
|
+ PP.setReplayablePreambleConditionalStack(ConditionalStack, SkipInfo);
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
@@ -3158,7 +3214,7 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
- case DECL_UPDATE_OFFSETS: {
|
|
|
|
|
|
+ case DECL_UPDATE_OFFSETS:
|
|
if (Record.size() % 2 != 0) {
|
|
if (Record.size() % 2 != 0) {
|
|
Error("invalid DECL_UPDATE_OFFSETS block in AST file");
|
|
Error("invalid DECL_UPDATE_OFFSETS block in AST file");
|
|
return Failure;
|
|
return Failure;
|
|
@@ -3174,9 +3230,8 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) {
|
|
PendingUpdateRecord(ID, D, /*JustLoaded=*/false));
|
|
PendingUpdateRecord(ID, D, /*JustLoaded=*/false));
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
- }
|
|
|
|
|
|
|
|
- case OBJC_CATEGORIES_MAP: {
|
|
|
|
|
|
+ case OBJC_CATEGORIES_MAP:
|
|
if (F.LocalNumObjCCategoriesInMap != 0) {
|
|
if (F.LocalNumObjCCategoriesInMap != 0) {
|
|
Error("duplicate OBJC_CATEGORIES_MAP record in AST file");
|
|
Error("duplicate OBJC_CATEGORIES_MAP record in AST file");
|
|
return Failure;
|
|
return Failure;
|
|
@@ -3185,7 +3240,6 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) {
|
|
F.LocalNumObjCCategoriesInMap = Record[0];
|
|
F.LocalNumObjCCategoriesInMap = Record[0];
|
|
F.ObjCCategoriesMap = (const ObjCCategoriesInfo *)Blob.data();
|
|
F.ObjCCategoriesMap = (const ObjCCategoriesInfo *)Blob.data();
|
|
break;
|
|
break;
|
|
- }
|
|
|
|
|
|
|
|
case OBJC_CATEGORIES:
|
|
case OBJC_CATEGORIES:
|
|
F.ObjCCategories.swap(Record);
|
|
F.ObjCCategories.swap(Record);
|
|
@@ -3199,7 +3253,7 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) {
|
|
CUDASpecialDeclRefs.push_back(getGlobalDeclID(F, Record[I]));
|
|
CUDASpecialDeclRefs.push_back(getGlobalDeclID(F, Record[I]));
|
|
break;
|
|
break;
|
|
|
|
|
|
- case HEADER_SEARCH_TABLE: {
|
|
|
|
|
|
+ case HEADER_SEARCH_TABLE:
|
|
F.HeaderFileInfoTableData = Blob.data();
|
|
F.HeaderFileInfoTableData = Blob.data();
|
|
F.LocalNumHeaderFileInfos = Record[1];
|
|
F.LocalNumHeaderFileInfos = Record[1];
|
|
if (Record[0]) {
|
|
if (Record[0]) {
|
|
@@ -3216,7 +3270,6 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) {
|
|
PP.getHeaderSearchInfo().SetExternalLookup(this);
|
|
PP.getHeaderSearchInfo().SetExternalLookup(this);
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
- }
|
|
|
|
|
|
|
|
case FP_PRAGMA_OPTIONS:
|
|
case FP_PRAGMA_OPTIONS:
|
|
// Later tables overwrite earlier ones.
|
|
// Later tables overwrite earlier ones.
|
|
@@ -3284,6 +3337,7 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) {
|
|
ReadSourceLocation(F, Record, I).getRawEncoding());
|
|
ReadSourceLocation(F, Record, I).getRawEncoding());
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
+
|
|
case DELETE_EXPRS_TO_ANALYZE:
|
|
case DELETE_EXPRS_TO_ANALYZE:
|
|
for (unsigned I = 0, N = Record.size(); I != N;) {
|
|
for (unsigned I = 0, N = Record.size(); I != N;) {
|
|
DelayedDeleteExprs.push_back(getGlobalDeclID(F, Record[I++]));
|
|
DelayedDeleteExprs.push_back(getGlobalDeclID(F, Record[I++]));
|
|
@@ -3297,7 +3351,7 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) {
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
- case IMPORTED_MODULES: {
|
|
|
|
|
|
+ case IMPORTED_MODULES:
|
|
if (!F.isModule()) {
|
|
if (!F.isModule()) {
|
|
// If we aren't loading a module (which has its own exports), make
|
|
// If we aren't loading a module (which has its own exports), make
|
|
// all of the imported modules visible.
|
|
// all of the imported modules visible.
|
|
@@ -3313,7 +3367,6 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
- }
|
|
|
|
|
|
|
|
case MACRO_OFFSET: {
|
|
case MACRO_OFFSET: {
|
|
if (F.LocalNumMacros != 0) {
|
|
if (F.LocalNumMacros != 0) {
|
|
@@ -3339,10 +3392,9 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
- case LATE_PARSED_TEMPLATE: {
|
|
|
|
|
|
+ case LATE_PARSED_TEMPLATE:
|
|
LateParsedTemplates.append(Record.begin(), Record.end());
|
|
LateParsedTemplates.append(Record.begin(), Record.end());
|
|
break;
|
|
break;
|
|
- }
|
|
|
|
|
|
|
|
case OPTIMIZE_PRAGMA_OPTIONS:
|
|
case OPTIMIZE_PRAGMA_OPTIONS:
|
|
if (Record.size() != 1) {
|
|
if (Record.size() != 1) {
|
|
@@ -3424,8 +3476,7 @@ void ASTReader::ReadModuleOffsetMap(ModuleFile &F) const {
|
|
}
|
|
}
|
|
|
|
|
|
// Continuous range maps we may be updating in our module.
|
|
// Continuous range maps we may be updating in our module.
|
|
- typedef ContinuousRangeMap<uint32_t, int, 2>::Builder
|
|
|
|
- RemapBuilder;
|
|
|
|
|
|
+ using RemapBuilder = ContinuousRangeMap<uint32_t, int, 2>::Builder;
|
|
RemapBuilder SLocRemap(F.SLocRemap);
|
|
RemapBuilder SLocRemap(F.SLocRemap);
|
|
RemapBuilder IdentifierRemap(F.IdentifierRemap);
|
|
RemapBuilder IdentifierRemap(F.IdentifierRemap);
|
|
RemapBuilder MacroRemap(F.MacroRemap);
|
|
RemapBuilder MacroRemap(F.MacroRemap);
|
|
@@ -3589,7 +3640,6 @@ ASTReader::ReadModuleMapFileBlock(RecordData &Record, ModuleFile &F,
|
|
return Success;
|
|
return Success;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
/// \brief Move the given method to the back of the global list of methods.
|
|
/// \brief Move the given method to the back of the global list of methods.
|
|
static void moveMethodToBackOfGlobalList(Sema &S, ObjCMethodDecl *Method) {
|
|
static void moveMethodToBackOfGlobalList(Sema &S, ObjCMethodDecl *Method) {
|
|
// Find the entry for this selector in the method pool.
|
|
// Find the entry for this selector in the method pool.
|
|
@@ -4242,7 +4292,7 @@ ASTReader::ASTReadResult ASTReader::readUnhashedControlBlockImpl(
|
|
// Read all of the records in the options block.
|
|
// Read all of the records in the options block.
|
|
RecordData Record;
|
|
RecordData Record;
|
|
ASTReadResult Result = Success;
|
|
ASTReadResult Result = Success;
|
|
- while (1) {
|
|
|
|
|
|
+ while (true) {
|
|
llvm::BitstreamEntry Entry = Stream.advance();
|
|
llvm::BitstreamEntry Entry = Stream.advance();
|
|
|
|
|
|
switch (Entry.Kind) {
|
|
switch (Entry.Kind) {
|
|
@@ -4262,11 +4312,10 @@ ASTReader::ASTReadResult ASTReader::readUnhashedControlBlockImpl(
|
|
Record.clear();
|
|
Record.clear();
|
|
switch (
|
|
switch (
|
|
(UnhashedControlBlockRecordTypes)Stream.readRecord(Entry.ID, Record)) {
|
|
(UnhashedControlBlockRecordTypes)Stream.readRecord(Entry.ID, Record)) {
|
|
- case SIGNATURE: {
|
|
|
|
|
|
+ case SIGNATURE:
|
|
if (F)
|
|
if (F)
|
|
std::copy(Record.begin(), Record.end(), F->Signature.data());
|
|
std::copy(Record.begin(), Record.end(), F->Signature.data());
|
|
break;
|
|
break;
|
|
- }
|
|
|
|
case DIAGNOSTIC_OPTIONS: {
|
|
case DIAGNOSTIC_OPTIONS: {
|
|
bool Complain = (ClientLoadCapabilities & ARR_OutOfDate) == 0;
|
|
bool Complain = (ClientLoadCapabilities & ARR_OutOfDate) == 0;
|
|
if (Listener && ValidateDiagnosticOptions &&
|
|
if (Listener && ValidateDiagnosticOptions &&
|
|
@@ -4595,9 +4644,7 @@ namespace {
|
|
ExistingTargetOpts(ExistingTargetOpts),
|
|
ExistingTargetOpts(ExistingTargetOpts),
|
|
ExistingPPOpts(ExistingPPOpts),
|
|
ExistingPPOpts(ExistingPPOpts),
|
|
ExistingModuleCachePath(ExistingModuleCachePath),
|
|
ExistingModuleCachePath(ExistingModuleCachePath),
|
|
- FileMgr(FileMgr)
|
|
|
|
- {
|
|
|
|
- }
|
|
|
|
|
|
+ FileMgr(FileMgr) {}
|
|
|
|
|
|
bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain,
|
|
bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain,
|
|
bool AllowCompatibleDifferences) override {
|
|
bool AllowCompatibleDifferences) override {
|
|
@@ -4627,7 +4674,7 @@ namespace {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
-} // end anonymous namespace
|
|
|
|
|
|
+} // namespace
|
|
|
|
|
|
bool ASTReader::readASTFileControlBlock(
|
|
bool ASTReader::readASTFileControlBlock(
|
|
StringRef Filename, FileManager &FileMgr,
|
|
StringRef Filename, FileManager &FileMgr,
|
|
@@ -4711,15 +4758,12 @@ bool ASTReader::readASTFileControlBlock(
|
|
StringRef Blob;
|
|
StringRef Blob;
|
|
unsigned RecCode = Stream.readRecord(Entry.ID, Record, &Blob);
|
|
unsigned RecCode = Stream.readRecord(Entry.ID, Record, &Blob);
|
|
switch ((ControlRecordTypes)RecCode) {
|
|
switch ((ControlRecordTypes)RecCode) {
|
|
- case METADATA: {
|
|
|
|
|
|
+ case METADATA:
|
|
if (Record[0] != VERSION_MAJOR)
|
|
if (Record[0] != VERSION_MAJOR)
|
|
return true;
|
|
return true;
|
|
-
|
|
|
|
if (Listener.ReadFullVersionInformation(Blob))
|
|
if (Listener.ReadFullVersionInformation(Blob))
|
|
return true;
|
|
return true;
|
|
-
|
|
|
|
break;
|
|
break;
|
|
- }
|
|
|
|
case MODULE_NAME:
|
|
case MODULE_NAME:
|
|
Listener.ReadModuleName(Blob);
|
|
Listener.ReadModuleName(Blob);
|
|
break;
|
|
break;
|
|
@@ -5027,10 +5071,9 @@ ASTReader::ReadSubmoduleBlock(ModuleFile &F, unsigned ClientLoadCapabilities) {
|
|
// them here.
|
|
// them here.
|
|
break;
|
|
break;
|
|
|
|
|
|
- case SUBMODULE_TOPHEADER: {
|
|
|
|
|
|
+ case SUBMODULE_TOPHEADER:
|
|
CurrentModule->addTopHeaderFilename(Blob);
|
|
CurrentModule->addTopHeaderFilename(Blob);
|
|
break;
|
|
break;
|
|
- }
|
|
|
|
|
|
|
|
case SUBMODULE_UMBRELLA_DIR: {
|
|
case SUBMODULE_UMBRELLA_DIR: {
|
|
std::string Dirname = Blob;
|
|
std::string Dirname = Blob;
|
|
@@ -5067,7 +5110,7 @@ ASTReader::ReadSubmoduleBlock(ModuleFile &F, unsigned ClientLoadCapabilities) {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
- case SUBMODULE_IMPORTS: {
|
|
|
|
|
|
+ case SUBMODULE_IMPORTS:
|
|
for (unsigned Idx = 0; Idx != Record.size(); ++Idx) {
|
|
for (unsigned Idx = 0; Idx != Record.size(); ++Idx) {
|
|
UnresolvedModuleRef Unresolved;
|
|
UnresolvedModuleRef Unresolved;
|
|
Unresolved.File = &F;
|
|
Unresolved.File = &F;
|
|
@@ -5078,9 +5121,8 @@ ASTReader::ReadSubmoduleBlock(ModuleFile &F, unsigned ClientLoadCapabilities) {
|
|
UnresolvedModuleRefs.push_back(Unresolved);
|
|
UnresolvedModuleRefs.push_back(Unresolved);
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
- }
|
|
|
|
|
|
|
|
- case SUBMODULE_EXPORTS: {
|
|
|
|
|
|
+ case SUBMODULE_EXPORTS:
|
|
for (unsigned Idx = 0; Idx + 1 < Record.size(); Idx += 2) {
|
|
for (unsigned Idx = 0; Idx + 1 < Record.size(); Idx += 2) {
|
|
UnresolvedModuleRef Unresolved;
|
|
UnresolvedModuleRef Unresolved;
|
|
Unresolved.File = &F;
|
|
Unresolved.File = &F;
|
|
@@ -5095,12 +5137,11 @@ ASTReader::ReadSubmoduleBlock(ModuleFile &F, unsigned ClientLoadCapabilities) {
|
|
// the parsed, unresolved exports around.
|
|
// the parsed, unresolved exports around.
|
|
CurrentModule->UnresolvedExports.clear();
|
|
CurrentModule->UnresolvedExports.clear();
|
|
break;
|
|
break;
|
|
- }
|
|
|
|
- case SUBMODULE_REQUIRES: {
|
|
|
|
|
|
+
|
|
|
|
+ case SUBMODULE_REQUIRES:
|
|
CurrentModule->addRequirement(Blob, Record[0], PP.getLangOpts(),
|
|
CurrentModule->addRequirement(Blob, Record[0], PP.getLangOpts(),
|
|
PP.getTargetInfo());
|
|
PP.getTargetInfo());
|
|
break;
|
|
break;
|
|
- }
|
|
|
|
|
|
|
|
case SUBMODULE_LINK_LIBRARY:
|
|
case SUBMODULE_LINK_LIBRARY:
|
|
CurrentModule->LinkLibraries.push_back(
|
|
CurrentModule->LinkLibraries.push_back(
|
|
@@ -5450,7 +5491,7 @@ struct PPEntityComp {
|
|
const ASTReader &Reader;
|
|
const ASTReader &Reader;
|
|
ModuleFile &M;
|
|
ModuleFile &M;
|
|
|
|
|
|
- PPEntityComp(const ASTReader &Reader, ModuleFile &M) : Reader(Reader), M(M) { }
|
|
|
|
|
|
+ PPEntityComp(const ASTReader &Reader, ModuleFile &M) : Reader(Reader), M(M) {}
|
|
|
|
|
|
bool operator()(const PPEntityOffset &L, const PPEntityOffset &R) const {
|
|
bool operator()(const PPEntityOffset &L, const PPEntityOffset &R) const {
|
|
SourceLocation LHS = getLoc(L);
|
|
SourceLocation LHS = getLoc(L);
|
|
@@ -5473,7 +5514,7 @@ struct PPEntityComp {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
-} // end anonymous namespace
|
|
|
|
|
|
+} // namespace
|
|
|
|
|
|
PreprocessedEntityID ASTReader::findPreprocessedEntity(SourceLocation Loc,
|
|
PreprocessedEntityID ASTReader::findPreprocessedEntity(SourceLocation Loc,
|
|
bool EndsAfter) const {
|
|
bool EndsAfter) const {
|
|
@@ -5489,7 +5530,9 @@ PreprocessedEntityID ASTReader::findPreprocessedEntity(SourceLocation Loc,
|
|
return findNextPreprocessedEntity(SLocMapI);
|
|
return findNextPreprocessedEntity(SLocMapI);
|
|
|
|
|
|
ModuleFile &M = *SLocMapI->second;
|
|
ModuleFile &M = *SLocMapI->second;
|
|
- typedef const PPEntityOffset *pp_iterator;
|
|
|
|
|
|
+
|
|
|
|
+ using pp_iterator = const PPEntityOffset *;
|
|
|
|
+
|
|
pp_iterator pp_begin = M.PreprocessedEntityOffsets;
|
|
pp_iterator pp_begin = M.PreprocessedEntityOffsets;
|
|
pp_iterator pp_end = pp_begin + M.NumPreprocessedEntities;
|
|
pp_iterator pp_end = pp_begin + M.NumPreprocessedEntities;
|
|
|
|
|
|
@@ -5567,12 +5610,10 @@ namespace {
|
|
/// \brief Visitor used to search for information about a header file.
|
|
/// \brief Visitor used to search for information about a header file.
|
|
class HeaderFileInfoVisitor {
|
|
class HeaderFileInfoVisitor {
|
|
const FileEntry *FE;
|
|
const FileEntry *FE;
|
|
-
|
|
|
|
Optional<HeaderFileInfo> HFI;
|
|
Optional<HeaderFileInfo> HFI;
|
|
|
|
|
|
public:
|
|
public:
|
|
- explicit HeaderFileInfoVisitor(const FileEntry *FE)
|
|
|
|
- : FE(FE) { }
|
|
|
|
|
|
+ explicit HeaderFileInfoVisitor(const FileEntry *FE) : FE(FE) {}
|
|
|
|
|
|
bool operator()(ModuleFile &M) {
|
|
bool operator()(ModuleFile &M) {
|
|
HeaderFileInfoLookupTable *Table
|
|
HeaderFileInfoLookupTable *Table
|
|
@@ -5592,7 +5633,7 @@ namespace {
|
|
Optional<HeaderFileInfo> getHeaderFileInfo() const { return HFI; }
|
|
Optional<HeaderFileInfo> getHeaderFileInfo() const { return HFI; }
|
|
};
|
|
};
|
|
|
|
|
|
-} // end anonymous namespace
|
|
|
|
|
|
+} // namespace
|
|
|
|
|
|
HeaderFileInfo ASTReader::GetHeaderFileInfo(const FileEntry *FE) {
|
|
HeaderFileInfo ASTReader::GetHeaderFileInfo(const FileEntry *FE) {
|
|
HeaderFileInfoVisitor Visitor(FE);
|
|
HeaderFileInfoVisitor Visitor(FE);
|
|
@@ -6113,6 +6154,7 @@ QualType ASTReader::readTypeRecord(unsigned Index) {
|
|
Protos.push_back(ReadDeclAs<ObjCProtocolDecl>(*Loc.F, Record, Idx));
|
|
Protos.push_back(ReadDeclAs<ObjCProtocolDecl>(*Loc.F, Record, Idx));
|
|
return Context.getObjCTypeParamType(Decl, Protos);
|
|
return Context.getObjCTypeParamType(Decl, Protos);
|
|
}
|
|
}
|
|
|
|
+
|
|
case TYPE_OBJC_OBJECT: {
|
|
case TYPE_OBJC_OBJECT: {
|
|
unsigned Idx = 0;
|
|
unsigned Idx = 0;
|
|
QualType Base = readType(*Loc.F, Record, Idx);
|
|
QualType Base = readType(*Loc.F, Record, Idx);
|
|
@@ -6309,7 +6351,9 @@ void ASTReader::readExceptionSpec(ModuleFile &ModuleFile,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-class clang::TypeLocReader : public TypeLocVisitor<TypeLocReader> {
|
|
|
|
|
|
+namespace clang {
|
|
|
|
+
|
|
|
|
+class TypeLocReader : public TypeLocVisitor<TypeLocReader> {
|
|
ModuleFile *F;
|
|
ModuleFile *F;
|
|
ASTReader *Reader;
|
|
ASTReader *Reader;
|
|
const ASTReader::RecordData &Record;
|
|
const ASTReader::RecordData &Record;
|
|
@@ -6344,6 +6388,8 @@ public:
|
|
void VisitArrayTypeLoc(ArrayTypeLoc);
|
|
void VisitArrayTypeLoc(ArrayTypeLoc);
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+} // namespace clang
|
|
|
|
+
|
|
void TypeLocReader::VisitQualifiedTypeLoc(QualifiedTypeLoc TL) {
|
|
void TypeLocReader::VisitQualifiedTypeLoc(QualifiedTypeLoc TL) {
|
|
// nothing to do
|
|
// nothing to do
|
|
}
|
|
}
|
|
@@ -6460,23 +6506,28 @@ void TypeLocReader::VisitFunctionProtoTypeLoc(FunctionProtoTypeLoc TL) {
|
|
void TypeLocReader::VisitFunctionNoProtoTypeLoc(FunctionNoProtoTypeLoc TL) {
|
|
void TypeLocReader::VisitFunctionNoProtoTypeLoc(FunctionNoProtoTypeLoc TL) {
|
|
VisitFunctionTypeLoc(TL);
|
|
VisitFunctionTypeLoc(TL);
|
|
}
|
|
}
|
|
|
|
+
|
|
void TypeLocReader::VisitUnresolvedUsingTypeLoc(UnresolvedUsingTypeLoc TL) {
|
|
void TypeLocReader::VisitUnresolvedUsingTypeLoc(UnresolvedUsingTypeLoc TL) {
|
|
TL.setNameLoc(ReadSourceLocation());
|
|
TL.setNameLoc(ReadSourceLocation());
|
|
}
|
|
}
|
|
|
|
+
|
|
void TypeLocReader::VisitTypedefTypeLoc(TypedefTypeLoc TL) {
|
|
void TypeLocReader::VisitTypedefTypeLoc(TypedefTypeLoc TL) {
|
|
TL.setNameLoc(ReadSourceLocation());
|
|
TL.setNameLoc(ReadSourceLocation());
|
|
}
|
|
}
|
|
|
|
+
|
|
void TypeLocReader::VisitTypeOfExprTypeLoc(TypeOfExprTypeLoc TL) {
|
|
void TypeLocReader::VisitTypeOfExprTypeLoc(TypeOfExprTypeLoc TL) {
|
|
TL.setTypeofLoc(ReadSourceLocation());
|
|
TL.setTypeofLoc(ReadSourceLocation());
|
|
TL.setLParenLoc(ReadSourceLocation());
|
|
TL.setLParenLoc(ReadSourceLocation());
|
|
TL.setRParenLoc(ReadSourceLocation());
|
|
TL.setRParenLoc(ReadSourceLocation());
|
|
}
|
|
}
|
|
|
|
+
|
|
void TypeLocReader::VisitTypeOfTypeLoc(TypeOfTypeLoc TL) {
|
|
void TypeLocReader::VisitTypeOfTypeLoc(TypeOfTypeLoc TL) {
|
|
TL.setTypeofLoc(ReadSourceLocation());
|
|
TL.setTypeofLoc(ReadSourceLocation());
|
|
TL.setLParenLoc(ReadSourceLocation());
|
|
TL.setLParenLoc(ReadSourceLocation());
|
|
TL.setRParenLoc(ReadSourceLocation());
|
|
TL.setRParenLoc(ReadSourceLocation());
|
|
TL.setUnderlyingTInfo(GetTypeSourceInfo());
|
|
TL.setUnderlyingTInfo(GetTypeSourceInfo());
|
|
}
|
|
}
|
|
|
|
+
|
|
void TypeLocReader::VisitDecltypeTypeLoc(DecltypeTypeLoc TL) {
|
|
void TypeLocReader::VisitDecltypeTypeLoc(DecltypeTypeLoc TL) {
|
|
TL.setNameLoc(ReadSourceLocation());
|
|
TL.setNameLoc(ReadSourceLocation());
|
|
}
|
|
}
|
|
@@ -6530,10 +6581,12 @@ void TypeLocReader::VisitSubstTemplateTypeParmTypeLoc(
|
|
SubstTemplateTypeParmTypeLoc TL) {
|
|
SubstTemplateTypeParmTypeLoc TL) {
|
|
TL.setNameLoc(ReadSourceLocation());
|
|
TL.setNameLoc(ReadSourceLocation());
|
|
}
|
|
}
|
|
|
|
+
|
|
void TypeLocReader::VisitSubstTemplateTypeParmPackTypeLoc(
|
|
void TypeLocReader::VisitSubstTemplateTypeParmPackTypeLoc(
|
|
SubstTemplateTypeParmPackTypeLoc TL) {
|
|
SubstTemplateTypeParmPackTypeLoc TL) {
|
|
TL.setNameLoc(ReadSourceLocation());
|
|
TL.setNameLoc(ReadSourceLocation());
|
|
}
|
|
}
|
|
|
|
+
|
|
void TypeLocReader::VisitTemplateSpecializationTypeLoc(
|
|
void TypeLocReader::VisitTemplateSpecializationTypeLoc(
|
|
TemplateSpecializationTypeLoc TL) {
|
|
TemplateSpecializationTypeLoc TL) {
|
|
TL.setTemplateKeywordLoc(ReadSourceLocation());
|
|
TL.setTemplateKeywordLoc(ReadSourceLocation());
|
|
@@ -6546,6 +6599,7 @@ void TypeLocReader::VisitTemplateSpecializationTypeLoc(
|
|
Reader->GetTemplateArgumentLocInfo(
|
|
Reader->GetTemplateArgumentLocInfo(
|
|
*F, TL.getTypePtr()->getArg(i).getKind(), Record, Idx));
|
|
*F, TL.getTypePtr()->getArg(i).getKind(), Record, Idx));
|
|
}
|
|
}
|
|
|
|
+
|
|
void TypeLocReader::VisitParenTypeLoc(ParenTypeLoc TL) {
|
|
void TypeLocReader::VisitParenTypeLoc(ParenTypeLoc TL) {
|
|
TL.setLParenLoc(ReadSourceLocation());
|
|
TL.setLParenLoc(ReadSourceLocation());
|
|
TL.setRParenLoc(ReadSourceLocation());
|
|
TL.setRParenLoc(ReadSourceLocation());
|
|
@@ -6656,13 +6710,11 @@ QualType ASTReader::GetType(TypeID ID) {
|
|
case PREDEF_TYPE_BOOL_ID:
|
|
case PREDEF_TYPE_BOOL_ID:
|
|
T = Context.BoolTy;
|
|
T = Context.BoolTy;
|
|
break;
|
|
break;
|
|
-
|
|
|
|
case PREDEF_TYPE_CHAR_U_ID:
|
|
case PREDEF_TYPE_CHAR_U_ID:
|
|
case PREDEF_TYPE_CHAR_S_ID:
|
|
case PREDEF_TYPE_CHAR_S_ID:
|
|
// FIXME: Check that the signedness of CharTy is correct!
|
|
// FIXME: Check that the signedness of CharTy is correct!
|
|
T = Context.CharTy;
|
|
T = Context.CharTy;
|
|
break;
|
|
break;
|
|
-
|
|
|
|
case PREDEF_TYPE_UCHAR_ID:
|
|
case PREDEF_TYPE_UCHAR_ID:
|
|
T = Context.UnsignedCharTy;
|
|
T = Context.UnsignedCharTy;
|
|
break;
|
|
break;
|
|
@@ -6776,19 +6828,15 @@ QualType ASTReader::GetType(TypeID ID) {
|
|
case PREDEF_TYPE_AUTO_DEDUCT:
|
|
case PREDEF_TYPE_AUTO_DEDUCT:
|
|
T = Context.getAutoDeductType();
|
|
T = Context.getAutoDeductType();
|
|
break;
|
|
break;
|
|
-
|
|
|
|
case PREDEF_TYPE_AUTO_RREF_DEDUCT:
|
|
case PREDEF_TYPE_AUTO_RREF_DEDUCT:
|
|
T = Context.getAutoRRefDeductType();
|
|
T = Context.getAutoRRefDeductType();
|
|
break;
|
|
break;
|
|
-
|
|
|
|
case PREDEF_TYPE_ARC_UNBRIDGED_CAST:
|
|
case PREDEF_TYPE_ARC_UNBRIDGED_CAST:
|
|
T = Context.ARCUnbridgedCastTy;
|
|
T = Context.ARCUnbridgedCastTy;
|
|
break;
|
|
break;
|
|
-
|
|
|
|
case PREDEF_TYPE_BUILTIN_FN:
|
|
case PREDEF_TYPE_BUILTIN_FN:
|
|
T = Context.BuiltinFnTy;
|
|
T = Context.BuiltinFnTy;
|
|
break;
|
|
break;
|
|
-
|
|
|
|
case PREDEF_TYPE_OMP_ARRAY_SECTION:
|
|
case PREDEF_TYPE_OMP_ARRAY_SECTION:
|
|
T = Context.OMPArraySectionTy;
|
|
T = Context.OMPArraySectionTy;
|
|
break;
|
|
break;
|
|
@@ -7275,7 +7323,7 @@ public:
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
-} // end anonymous namespace
|
|
|
|
|
|
+} // namespace
|
|
|
|
|
|
void ASTReader::FindFileRegionDecls(FileID File,
|
|
void ASTReader::FindFileRegionDecls(FileID File,
|
|
unsigned Offset, unsigned Length,
|
|
unsigned Offset, unsigned Length,
|
|
@@ -7471,30 +7519,25 @@ void ASTReader::PrintStats() {
|
|
NumVisibleDeclContextsRead, TotalVisibleDeclContexts,
|
|
NumVisibleDeclContextsRead, TotalVisibleDeclContexts,
|
|
((float)NumVisibleDeclContextsRead/TotalVisibleDeclContexts
|
|
((float)NumVisibleDeclContextsRead/TotalVisibleDeclContexts
|
|
* 100));
|
|
* 100));
|
|
- if (TotalNumMethodPoolEntries) {
|
|
|
|
|
|
+ if (TotalNumMethodPoolEntries)
|
|
std::fprintf(stderr, " %u/%u method pool entries read (%f%%)\n",
|
|
std::fprintf(stderr, " %u/%u method pool entries read (%f%%)\n",
|
|
NumMethodPoolEntriesRead, TotalNumMethodPoolEntries,
|
|
NumMethodPoolEntriesRead, TotalNumMethodPoolEntries,
|
|
((float)NumMethodPoolEntriesRead/TotalNumMethodPoolEntries
|
|
((float)NumMethodPoolEntriesRead/TotalNumMethodPoolEntries
|
|
* 100));
|
|
* 100));
|
|
- }
|
|
|
|
- if (NumMethodPoolLookups) {
|
|
|
|
|
|
+ if (NumMethodPoolLookups)
|
|
std::fprintf(stderr, " %u/%u method pool lookups succeeded (%f%%)\n",
|
|
std::fprintf(stderr, " %u/%u method pool lookups succeeded (%f%%)\n",
|
|
NumMethodPoolHits, NumMethodPoolLookups,
|
|
NumMethodPoolHits, NumMethodPoolLookups,
|
|
((float)NumMethodPoolHits/NumMethodPoolLookups * 100.0));
|
|
((float)NumMethodPoolHits/NumMethodPoolLookups * 100.0));
|
|
- }
|
|
|
|
- if (NumMethodPoolTableLookups) {
|
|
|
|
|
|
+ if (NumMethodPoolTableLookups)
|
|
std::fprintf(stderr, " %u/%u method pool table lookups succeeded (%f%%)\n",
|
|
std::fprintf(stderr, " %u/%u method pool table lookups succeeded (%f%%)\n",
|
|
NumMethodPoolTableHits, NumMethodPoolTableLookups,
|
|
NumMethodPoolTableHits, NumMethodPoolTableLookups,
|
|
((float)NumMethodPoolTableHits/NumMethodPoolTableLookups
|
|
((float)NumMethodPoolTableHits/NumMethodPoolTableLookups
|
|
* 100.0));
|
|
* 100.0));
|
|
- }
|
|
|
|
-
|
|
|
|
- if (NumIdentifierLookupHits) {
|
|
|
|
|
|
+ if (NumIdentifierLookupHits)
|
|
std::fprintf(stderr,
|
|
std::fprintf(stderr,
|
|
" %u / %u identifier table lookups succeeded (%f%%)\n",
|
|
" %u / %u identifier table lookups succeeded (%f%%)\n",
|
|
NumIdentifierLookupHits, NumIdentifierLookups,
|
|
NumIdentifierLookupHits, NumIdentifierLookups,
|
|
(double)NumIdentifierLookupHits*100.0/NumIdentifierLookups);
|
|
(double)NumIdentifierLookupHits*100.0/NumIdentifierLookups);
|
|
- }
|
|
|
|
|
|
|
|
if (GlobalIndex) {
|
|
if (GlobalIndex) {
|
|
std::fprintf(stderr, "\n");
|
|
std::fprintf(stderr, "\n");
|
|
@@ -7514,7 +7557,8 @@ dumpModuleIDMap(StringRef Name,
|
|
if (Map.begin() == Map.end())
|
|
if (Map.begin() == Map.end())
|
|
return;
|
|
return;
|
|
|
|
|
|
- typedef ContinuousRangeMap<Key, ModuleFile *, InitialCapacity> MapType;
|
|
|
|
|
|
+ using MapType = ContinuousRangeMap<Key, ModuleFile *, InitialCapacity>;
|
|
|
|
+
|
|
llvm::errs() << Name << ":\n";
|
|
llvm::errs() << Name << ":\n";
|
|
for (typename MapType::const_iterator I = Map.begin(), IEnd = Map.end();
|
|
for (typename MapType::const_iterator I = Map.begin(), IEnd = Map.end();
|
|
I != IEnd; ++I) {
|
|
I != IEnd; ++I) {
|
|
@@ -7711,7 +7755,7 @@ namespace clang {
|
|
StringRef Next() override;
|
|
StringRef Next() override;
|
|
};
|
|
};
|
|
|
|
|
|
-} // end namespace clang
|
|
|
|
|
|
+} // namespace clang
|
|
|
|
|
|
ASTIdentifierIterator::ASTIdentifierIterator(const ASTReader &Reader,
|
|
ASTIdentifierIterator::ASTIdentifierIterator(const ASTReader &Reader,
|
|
bool SkipModules)
|
|
bool SkipModules)
|
|
@@ -7769,7 +7813,7 @@ public:
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
-} // end anonymous namespace.
|
|
|
|
|
|
+} // namespace
|
|
|
|
|
|
IdentifierIterator *ASTReader::getIdentifiers() {
|
|
IdentifierIterator *ASTReader::getIdentifiers() {
|
|
if (!loadGlobalIndex()) {
|
|
if (!loadGlobalIndex()) {
|
|
@@ -7791,19 +7835,17 @@ namespace serialization {
|
|
ASTReader &Reader;
|
|
ASTReader &Reader;
|
|
Selector Sel;
|
|
Selector Sel;
|
|
unsigned PriorGeneration;
|
|
unsigned PriorGeneration;
|
|
- unsigned InstanceBits;
|
|
|
|
- unsigned FactoryBits;
|
|
|
|
- bool InstanceHasMoreThanOneDecl;
|
|
|
|
- bool FactoryHasMoreThanOneDecl;
|
|
|
|
|
|
+ unsigned InstanceBits = 0;
|
|
|
|
+ unsigned FactoryBits = 0;
|
|
|
|
+ bool InstanceHasMoreThanOneDecl = false;
|
|
|
|
+ bool FactoryHasMoreThanOneDecl = false;
|
|
SmallVector<ObjCMethodDecl *, 4> InstanceMethods;
|
|
SmallVector<ObjCMethodDecl *, 4> InstanceMethods;
|
|
SmallVector<ObjCMethodDecl *, 4> FactoryMethods;
|
|
SmallVector<ObjCMethodDecl *, 4> FactoryMethods;
|
|
|
|
|
|
public:
|
|
public:
|
|
ReadMethodPoolVisitor(ASTReader &Reader, Selector Sel,
|
|
ReadMethodPoolVisitor(ASTReader &Reader, Selector Sel,
|
|
unsigned PriorGeneration)
|
|
unsigned PriorGeneration)
|
|
- : Reader(Reader), Sel(Sel), PriorGeneration(PriorGeneration),
|
|
|
|
- InstanceBits(0), FactoryBits(0), InstanceHasMoreThanOneDecl(false),
|
|
|
|
- FactoryHasMoreThanOneDecl(false) {}
|
|
|
|
|
|
+ : Reader(Reader), Sel(Sel), PriorGeneration(PriorGeneration) {}
|
|
|
|
|
|
bool operator()(ModuleFile &M) {
|
|
bool operator()(ModuleFile &M) {
|
|
if (!M.SelectorLookupTable)
|
|
if (!M.SelectorLookupTable)
|
|
@@ -7851,14 +7893,16 @@ namespace serialization {
|
|
|
|
|
|
unsigned getInstanceBits() const { return InstanceBits; }
|
|
unsigned getInstanceBits() const { return InstanceBits; }
|
|
unsigned getFactoryBits() const { return FactoryBits; }
|
|
unsigned getFactoryBits() const { return FactoryBits; }
|
|
|
|
+
|
|
bool instanceHasMoreThanOneDecl() const {
|
|
bool instanceHasMoreThanOneDecl() const {
|
|
return InstanceHasMoreThanOneDecl;
|
|
return InstanceHasMoreThanOneDecl;
|
|
}
|
|
}
|
|
|
|
+
|
|
bool factoryHasMoreThanOneDecl() const { return FactoryHasMoreThanOneDecl; }
|
|
bool factoryHasMoreThanOneDecl() const { return FactoryHasMoreThanOneDecl; }
|
|
};
|
|
};
|
|
|
|
|
|
-} // end namespace serialization
|
|
|
|
-} // end namespace clang
|
|
|
|
|
|
+} // namespace serialization
|
|
|
|
+} // namespace clang
|
|
|
|
|
|
/// \brief Add the given set of methods to the method list.
|
|
/// \brief Add the given set of methods to the method list.
|
|
static void addMethodsToPool(Sema &S, ArrayRef<ObjCMethodDecl *> Methods,
|
|
static void addMethodsToPool(Sema &S, ArrayRef<ObjCMethodDecl *> Methods,
|
|
@@ -8001,7 +8045,7 @@ void ASTReader::ReadUnusedLocalTypedefNameCandidates(
|
|
}
|
|
}
|
|
|
|
|
|
void ASTReader::ReadReferencedSelectors(
|
|
void ASTReader::ReadReferencedSelectors(
|
|
- SmallVectorImpl<std::pair<Selector, SourceLocation> > &Sels) {
|
|
|
|
|
|
+ SmallVectorImpl<std::pair<Selector, SourceLocation>> &Sels) {
|
|
if (ReferencedSelectorsData.empty())
|
|
if (ReferencedSelectorsData.empty())
|
|
return;
|
|
return;
|
|
|
|
|
|
@@ -8019,7 +8063,7 @@ void ASTReader::ReadReferencedSelectors(
|
|
}
|
|
}
|
|
|
|
|
|
void ASTReader::ReadWeakUndeclaredIdentifiers(
|
|
void ASTReader::ReadWeakUndeclaredIdentifiers(
|
|
- SmallVectorImpl<std::pair<IdentifierInfo *, WeakInfo> > &WeakIDs) {
|
|
|
|
|
|
+ SmallVectorImpl<std::pair<IdentifierInfo *, WeakInfo>> &WeakIDs) {
|
|
if (WeakUndeclaredIdentifiers.empty())
|
|
if (WeakUndeclaredIdentifiers.empty())
|
|
return;
|
|
return;
|
|
|
|
|
|
@@ -8051,7 +8095,7 @@ void ASTReader::ReadUsedVTables(SmallVectorImpl<ExternalVTableUse> &VTables) {
|
|
}
|
|
}
|
|
|
|
|
|
void ASTReader::ReadPendingInstantiations(
|
|
void ASTReader::ReadPendingInstantiations(
|
|
- SmallVectorImpl<std::pair<ValueDecl *, SourceLocation> > &Pending) {
|
|
|
|
|
|
+ SmallVectorImpl<std::pair<ValueDecl *, SourceLocation>> &Pending) {
|
|
for (unsigned Idx = 0, N = PendingInstantiations.size(); Idx < N;) {
|
|
for (unsigned Idx = 0, N = PendingInstantiations.size(); Idx < N;) {
|
|
ValueDecl *D = cast<ValueDecl>(GetDecl(PendingInstantiations[Idx++]));
|
|
ValueDecl *D = cast<ValueDecl>(GetDecl(PendingInstantiations[Idx++]));
|
|
SourceLocation Loc
|
|
SourceLocation Loc
|
|
@@ -8763,11 +8807,10 @@ ASTReader::ReadNestedNameSpecifier(ModuleFile &F,
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
- case NestedNameSpecifier::Global: {
|
|
|
|
|
|
+ case NestedNameSpecifier::Global:
|
|
NNS = NestedNameSpecifier::GlobalSpecifier(Context);
|
|
NNS = NestedNameSpecifier::GlobalSpecifier(Context);
|
|
// No associated value, and there can't be a prefix.
|
|
// No associated value, and there can't be a prefix.
|
|
break;
|
|
break;
|
|
- }
|
|
|
|
|
|
|
|
case NestedNameSpecifier::Super: {
|
|
case NestedNameSpecifier::Super: {
|
|
CXXRecordDecl *RD = ReadDeclAs<CXXRecordDecl>(F, Record, Idx);
|
|
CXXRecordDecl *RD = ReadDeclAs<CXXRecordDecl>(F, Record, Idx);
|
|
@@ -8944,7 +8987,7 @@ void ASTReader::ReadComments() {
|
|
ASTContext &Context = getContext();
|
|
ASTContext &Context = getContext();
|
|
std::vector<RawComment *> Comments;
|
|
std::vector<RawComment *> Comments;
|
|
for (SmallVectorImpl<std::pair<BitstreamCursor,
|
|
for (SmallVectorImpl<std::pair<BitstreamCursor,
|
|
- serialization::ModuleFile *> >::iterator
|
|
|
|
|
|
+ serialization::ModuleFile *>>::iterator
|
|
I = CommentsCursors.begin(),
|
|
I = CommentsCursors.begin(),
|
|
E = CommentsCursors.end();
|
|
E = CommentsCursors.end();
|
|
I != E; ++I) {
|
|
I != E; ++I) {
|
|
@@ -9034,7 +9077,7 @@ std::string ASTReader::getOwningModuleNameForDiagnostic(const Decl *D) {
|
|
return M->ModuleName;
|
|
return M->ModuleName;
|
|
|
|
|
|
// Not from a module.
|
|
// Not from a module.
|
|
- return "";
|
|
|
|
|
|
+ return {};
|
|
}
|
|
}
|
|
|
|
|
|
void ASTReader::finishPendingActions() {
|
|
void ASTReader::finishPendingActions() {
|
|
@@ -9044,8 +9087,8 @@ void ASTReader::finishPendingActions() {
|
|
!PendingUpdateRecords.empty()) {
|
|
!PendingUpdateRecords.empty()) {
|
|
// If any identifiers with corresponding top-level declarations have
|
|
// If any identifiers with corresponding top-level declarations have
|
|
// been loaded, load those declarations now.
|
|
// been loaded, load those declarations now.
|
|
- typedef llvm::DenseMap<IdentifierInfo *, SmallVector<Decl *, 2> >
|
|
|
|
- TopLevelDeclsMap;
|
|
|
|
|
|
+ using TopLevelDeclsMap =
|
|
|
|
+ llvm::DenseMap<IdentifierInfo *, SmallVector<Decl *, 2>>;
|
|
TopLevelDeclsMap TopLevelDecls;
|
|
TopLevelDeclsMap TopLevelDecls;
|
|
|
|
|
|
while (!PendingIdentifierInfos.empty()) {
|
|
while (!PendingIdentifierInfos.empty()) {
|
|
@@ -10412,7 +10455,7 @@ void ASTReader::diagnoseOdrViolations() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if (Diagnosed == true)
|
|
|
|
|
|
+ if (Diagnosed)
|
|
continue;
|
|
continue;
|
|
|
|
|
|
Diag(FirstDecl->getLocation(),
|
|
Diag(FirstDecl->getLocation(),
|