aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-06-30 22:19:00 +0000
committerTed Kremenek <kremenek@apple.com>2009-06-30 22:19:00 +0000
commit1bc5bbf39a26d2604884216a511bd51aec1784f6 (patch)
tree29799bdb38233c45f12690853d4b562433813db0
parent5ac3dfc24bd2d8c5c0d9955f5de33c97e6aaaadf (diff)
Fix: <rdar://problem/7021553> clang -fsyntax-only crashes (in ParseDeclarationSpecifiers ... from ParseObjCTypeName)
Another case where we should use SmallVector::data() instead of taking the address of element 0 of a SmallVector when the SmallVector has no elements. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74556 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Parse/ParseDecl.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index ff602e8ba7..4a3532c410 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -802,7 +802,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
SourceLocation EndProtoLoc;
llvm::SmallVector<DeclPtrTy, 8> ProtocolDecl;
ParseObjCProtocolReferences(ProtocolDecl, false, EndProtoLoc);
- DS.setProtocolQualifiers(&ProtocolDecl[0], ProtocolDecl.size());
+ DS.setProtocolQualifiers(ProtocolDecl.data(), ProtocolDecl.size());
DS.SetRangeEnd(EndProtoLoc);
continue;
@@ -859,7 +859,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
SourceLocation EndProtoLoc;
llvm::SmallVector<DeclPtrTy, 8> ProtocolDecl;
ParseObjCProtocolReferences(ProtocolDecl, false, EndProtoLoc);
- DS.setProtocolQualifiers(&ProtocolDecl[0], ProtocolDecl.size());
+ DS.setProtocolQualifiers(ProtocolDecl.data(), ProtocolDecl.size());
DS.SetRangeEnd(EndProtoLoc);
@@ -1066,7 +1066,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
SourceLocation EndProtoLoc;
llvm::SmallVector<DeclPtrTy, 8> ProtocolDecl;
ParseObjCProtocolReferences(ProtocolDecl, false, EndProtoLoc);
- DS.setProtocolQualifiers(&ProtocolDecl[0], ProtocolDecl.size());
+ DS.setProtocolQualifiers(ProtocolDecl.data(), ProtocolDecl.size());
DS.SetRangeEnd(EndProtoLoc);
Diag(Loc, diag::warn_objc_protocol_qualifier_missing_id)
@@ -1179,7 +1179,7 @@ bool Parser::ParseOptionalTypeSpecifier(DeclSpec &DS, int& isInvalid,
SourceLocation EndProtoLoc;
llvm::SmallVector<DeclPtrTy, 8> ProtocolDecl;
ParseObjCProtocolReferences(ProtocolDecl, false, EndProtoLoc);
- DS.setProtocolQualifiers(&ProtocolDecl[0], ProtocolDecl.size());
+ DS.setProtocolQualifiers(ProtocolDecl.data(), ProtocolDecl.size());
DS.SetRangeEnd(EndProtoLoc);
return true;