summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2019-09-15 16:05:20 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2019-09-15 16:05:20 +0000
commit556fbfec1359694290fe9798fa84a50033370b21 (patch)
tree89ca0fc498e14fc3dc1dbf7d6c7873a04e433b2f /clang/lib/Serialization
parent4f234aaf2c9801364d1855dc82466c4a307360cb (diff)
downloadbcm5719-llvm-556fbfec1359694290fe9798fa84a50033370b21.tar.gz
bcm5719-llvm-556fbfec1359694290fe9798fa84a50033370b21.zip
[OpenMP] Fix OMPClauseReader::readClause() uninitialized variable warning. NFCI.
Fixes static analyzer uninitialized variable warning for the OMPClause - the function appears to cover all cases, but I've added an assertion to make sure. llvm-svn: 371934
Diffstat (limited to 'clang/lib/Serialization')
-rw-r--r--clang/lib/Serialization/ASTReader.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 10b2a5c4f9d..fcb437e0cb1 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -12202,7 +12202,7 @@ Expected<unsigned> ASTRecordReader::readRecord(llvm::BitstreamCursor &Cursor,
////===----------------------------------------------------------------------===//
OMPClause *OMPClauseReader::readClause() {
- OMPClause *C;
+ OMPClause *C = nullptr;
switch (Record.readInt()) {
case OMPC_if:
C = new (Context) OMPIfClause();
@@ -12403,6 +12403,8 @@ OMPClause *OMPClauseReader::readClause() {
C = OMPAllocateClause::CreateEmpty(Context, Record.readInt());
break;
}
+ assert(C && "Unknown OMPClause type");
+
Visit(C);
C->setLocStart(Record.readSourceLocation());
C->setLocEnd(Record.readSourceLocation());
OpenPOWER on IntegriCloud