summaryrefslogtreecommitdiffstats
path: root/clang/tools
diff options
context:
space:
mode:
authorMatt Beaumont-Gay <matthewbg@google.com>2013-06-24 16:12:35 +0000
committerMatt Beaumont-Gay <matthewbg@google.com>2013-06-24 16:12:35 +0000
commit4cd3c9adf93715720153cc6fedf0cb0cc7583170 (patch)
tree0abf5e5dfdc60136edc5f65d404f6929e95e88f9 /clang/tools
parentb64e776268474296a7e79886d6dc6b0059beec91 (diff)
downloadbcm5719-llvm-4cd3c9adf93715720153cc6fedf0cb0cc7583170.tar.gz
bcm5719-llvm-4cd3c9adf93715720153cc6fedf0cb0cc7583170.zip
Add some invalid-decl checks to clang_Type_getOffsetOf.
print-size-type.cpp was checking for specific record layout output for invalid decls; I've removed the checks but left the records as tests for not crashing. llvm-svn: 184751
Diffstat (limited to 'clang/tools')
-rw-r--r--clang/tools/libclang/CXType.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/tools/libclang/CXType.cpp b/clang/tools/libclang/CXType.cpp
index 148241597a3..4b602efa8cc 100644
--- a/clang/tools/libclang/CXType.cpp
+++ b/clang/tools/libclang/CXType.cpp
@@ -733,11 +733,13 @@ long long clang_Type_getOffsetOf(CXType PT, const char *S) {
return CXTypeLayoutError_Invalid;
const RecordDecl *RD =
dyn_cast_or_null<RecordDecl>(cxcursor::getCursorDecl(PC));
- if (!RD)
+ if (!RD || RD->isInvalidDecl())
return CXTypeLayoutError_Invalid;
RD = RD->getDefinition();
if (!RD)
return CXTypeLayoutError_Incomplete;
+ if (RD->isInvalidDecl())
+ return CXTypeLayoutError_Invalid;
QualType RT = GetQualType(PT);
if (RT->isIncompleteType())
return CXTypeLayoutError_Incomplete;
OpenPOWER on IntegriCloud