aboutsummaryrefslogtreecommitdiff
path: root/lib/Serialization/ASTCommon.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2013-01-22 17:08:30 +0000
committerDouglas Gregor <dgregor@apple.com>2013-01-22 17:08:30 +0000
commite0d2066ab8812cbaa16d79af5f2c9fb6bd52d2e2 (patch)
treeb8b47f8c4d8865d261e4b8a44b27f4a0e8258fb5 /lib/Serialization/ASTCommon.cpp
parent3a344f9fc7a62ad0a8d26b2a1ccf5e4989720d0c (diff)
Make getDefinitiveDeclContext() actually return a DeclContext, as one
would expect, and clean up the return/break inconsistencies. Thanks, Sebastian! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173171 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTCommon.cpp')
-rw-r--r--lib/Serialization/ASTCommon.cpp13
1 files changed, 7 insertions, 6 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) {