From b2707c0ec47334d500118efe9b52e6fddcaf4240 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Sun, 15 Sep 2019 16:05:20 +0000 Subject: [PATCH] [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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371934 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Serialization/ASTReader.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index 10b2a5c4f9..fcb437e0cb 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/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()); -- 2.40.0