[PATCH] D146604: [NFC] Fix uninitalized member variable use in ASTReader::ParseTargetOptions()

Sindhu Chittireddy via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 21 21:03:11 PDT 2023


schittir created this revision.
schittir added reviewers: tahonermann, shafik.
Herald added a project: All.
schittir requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Found by Coverity static analysis tool.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146604

Files:
  clang/lib/Serialization/ASTReader.cpp


Index: clang/lib/Serialization/ASTReader.cpp
===================================================================
--- clang/lib/Serialization/ASTReader.cpp
+++ clang/lib/Serialization/ASTReader.cpp
@@ -5887,6 +5887,9 @@
   TargetOpts.CPU = ReadString(Record, Idx);
   TargetOpts.TuneCPU = ReadString(Record, Idx);
   TargetOpts.ABI = ReadString(Record, Idx);
+  TargetOpts.EABIVersion = llvm::EABI::Default;
+  // Initialize CodeObjectVersion with default i.e., 4
+  TargetOpts.CodeObjectVersion = TargetOptions::CodeObjectVersionKind::COV_4;
   for (unsigned N = Record[Idx++]; N; --N) {
     TargetOpts.FeaturesAsWritten.push_back(ReadString(Record, Idx));
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146604.507221.patch
Type: text/x-patch
Size: 663 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230322/5b2c9052/attachment.bin>


More information about the cfe-commits mailing list