diff options
Diffstat (limited to 'clang/lib/AST/DeclBase.cpp')
| -rw-r--r-- | clang/lib/AST/DeclBase.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp index 7f1ed9c691e9..98c55d6f4eba 100644 --- a/clang/lib/AST/DeclBase.cpp +++ b/clang/lib/AST/DeclBase.cpp @@ -80,7 +80,7 @@ void *Decl::operator new(std::size_t Size, const ASTContext &Context, uint64_t *PrefixPtr = (uint64_t *)Result - 1; - *PrefixPtr = ID.get(); + *PrefixPtr = ID.getRawValue(); // We leave the upper 16 bits to store the module IDs. 48 bits should be // sufficient to store a declaration ID. @@ -691,7 +691,7 @@ static AvailabilityResult CheckAvailability(ASTContext &Context, IdentifierInfo *IIEnv = A->getEnvironment(); StringRef TargetEnv = Context.getTargetInfo().getTriple().getEnvironmentName(); - StringRef EnvName = AvailabilityAttr::getPrettyEnviromentName( + StringRef EnvName = llvm::Triple::getEnvironmentTypeName( Context.getTargetInfo().getTriple().getEnvironment()); // Matching environment or no environment on attribute if (!IIEnv || (!TargetEnv.empty() && IIEnv->getName() == TargetEnv)) { @@ -1116,7 +1116,7 @@ bool Decl::isInExportDeclContext() const { while (DC && !isa<ExportDecl>(DC)) DC = DC->getLexicalParent(); - return DC && isa<ExportDecl>(DC); + return isa_and_nonnull<ExportDecl>(DC); } bool Decl::isInAnotherModuleUnit() const { @@ -1128,6 +1128,15 @@ bool Decl::isInAnotherModuleUnit() const { return M != getASTContext().getCurrentNamedModule(); } +bool Decl::isInCurrentModuleUnit() const { + auto *M = getOwningModule(); + + if (!M || !M->isNamedModule()) + return false; + + return M == getASTContext().getCurrentNamedModule(); +} + bool Decl::shouldEmitInExternalSource() const { ExternalASTSource *Source = getASTContext().getExternalSource(); if (!Source) |
