diff options
-rw-r--r-- | lib/Serialization/ASTCommon.cpp | 13 | ||||
-rw-r--r-- | lib/Serialization/ASTCommon.h | 2 | ||||
-rw-r--r-- | lib/Serialization/ASTReader.cpp | 4 |
3 files changed, 10 insertions, 9 deletions
diff --git a/lib/Serialization/ASTCommon.cpp b/lib/Serialization/ASTCommon.cpp index 6ac4a2688d..955dc96229 100644 --- a/lib/Serialization/ASTCommon.cpp +++ b/lib/Serialization/ASTCommon.cpp @@ -87,7 +87,8 @@ unsigned serialization::ComputeHash(Selector Sel) { return R; } -const Decl *serialization::getDefinitiveDeclContext(const DeclContext *DC) { +const DeclContext * +serialization::getDefinitiveDeclContext(const DeclContext *DC) { switch (DC->getDeclKind()) { // These entities may have multiple definitions. case Decl::TranslationUnit: @@ -100,7 +101,7 @@ const Decl *serialization::getDefinitiveDeclContext(const DeclContext *DC) { case Decl::Record: if (const TagDecl *Def = cast<TagDecl>(DC)->getDefinition()) return Def; - break; + return 0; // FIXME: These can be defined in one place... except special member // functions and out-of-line definitions. @@ -122,25 +123,25 @@ const Decl *serialization::getDefinitiveDeclContext(const DeclContext *DC) { case Decl::ObjCCategory: case Decl::ObjCCategoryImpl: case Decl::ObjCImplementation: - return cast<Decl>(DC); + return DC; case Decl::ObjCProtocol: if (const ObjCProtocolDecl *Def = cast<ObjCProtocolDecl>(DC)->getDefinition()) return Def; - break; + return 0; // FIXME: These are defined in one place, but properties in class extensions // end up being back-patched into the main interface. See // Sema::HandlePropertyInClassExtension for the offending code. case Decl::ObjCInterface: - break; + return 0; default: llvm_unreachable("Unhandled DeclContext in AST reader"); } - return 0; + llvm_unreachable("Unhandled decl kind"); } bool serialization::isRedeclarableDeclKind(unsigned Kind) { diff --git a/lib/Serialization/ASTCommon.h b/lib/Serialization/ASTCommon.h index d930854231..76ef904046 100644 --- a/lib/Serialization/ASTCommon.h +++ b/lib/Serialization/ASTCommon.h @@ -68,7 +68,7 @@ unsigned ComputeHash(Selector Sel); /// single place in the source code, so they have definitive declarations /// associated with them. C++ namespaces, on the other hand, can have /// multiple definitions. -const Decl *getDefinitiveDeclContext(const DeclContext *DC); +const DeclContext *getDefinitiveDeclContext(const DeclContext *DC); /// \brief Determine whether the given declaration kind is redeclarable. bool isRedeclarableDeclKind(unsigned Kind); diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index 4e6e6db876..3acf5b5751 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -5323,8 +5323,8 @@ namespace { /// NDEBUG checking. static ModuleFile *getDefinitiveModuleFileFor(const DeclContext *DC, ASTReader &Reader) { - if (const Decl *D = getDefinitiveDeclContext(DC)) - return Reader.getOwningModuleFile(D); + if (const DeclContext *DefDC = getDefinitiveDeclContext(DC)) + return Reader.getOwningModuleFile(cast<Decl>(DefDC)); return 0; } |