From: Simon Pilgrim Date: Sun, 15 Sep 2019 16:05:20 +0000 (+0000) Subject: [OpenMP] Fix OMPClauseReader::readClause() uninitialized variable warning. NFCI. X-Git-Tag: llvmorg-11-init~9176 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=556fbfec1359694290fe9798fa84a50033370b21;p=platform%2Fupstream%2Fllvm.git [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 --- diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 10b2a5c..fcb437e 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -12202,7 +12202,7 @@ Expected 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());