UninitializedObjectChecker.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. //===----- UninitializedObjectChecker.cpp ------------------------*- C++ -*-==//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This file defines a checker that reports uninitialized fields in objects
  10. // created after a constructor call.
  11. //
  12. // To read about command line options and how the checker works, refer to the
  13. // top of the file and inline comments in UninitializedObject.h.
  14. //
  15. // Some of the logic is implemented in UninitializedPointee.cpp, to reduce the
  16. // complexity of this file.
  17. //
  18. //===----------------------------------------------------------------------===//
  19. #include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
  20. #include "UninitializedObject.h"
  21. #include "clang/ASTMatchers/ASTMatchFinder.h"
  22. #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
  23. #include "clang/StaticAnalyzer/Core/Checker.h"
  24. #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
  25. #include "clang/StaticAnalyzer/Core/PathSensitive/DynamicTypeMap.h"
  26. using namespace clang;
  27. using namespace clang::ento;
  28. using namespace clang::ast_matchers;
  29. /// We'll mark fields (and pointee of fields) that are confirmed to be
  30. /// uninitialized as already analyzed.
  31. REGISTER_SET_WITH_PROGRAMSTATE(AnalyzedRegions, const MemRegion *)
  32. namespace {
  33. class UninitializedObjectChecker
  34. : public Checker<check::EndFunction, check::DeadSymbols> {
  35. std::unique_ptr<BuiltinBug> BT_uninitField;
  36. public:
  37. // The fields of this struct will be initialized when registering the checker.
  38. UninitObjCheckerOptions Opts;
  39. UninitializedObjectChecker()
  40. : BT_uninitField(new BuiltinBug(this, "Uninitialized fields")) {}
  41. void checkEndFunction(const ReturnStmt *RS, CheckerContext &C) const;
  42. void checkDeadSymbols(SymbolReaper &SR, CheckerContext &C) const;
  43. };
  44. /// A basic field type, that is not a pointer or a reference, it's dynamic and
  45. /// static type is the same.
  46. class RegularField final : public FieldNode {
  47. public:
  48. RegularField(const FieldRegion *FR) : FieldNode(FR) {}
  49. virtual void printNoteMsg(llvm::raw_ostream &Out) const override {
  50. Out << "uninitialized field ";
  51. }
  52. virtual void printPrefix(llvm::raw_ostream &Out) const override {}
  53. virtual void printNode(llvm::raw_ostream &Out) const override {
  54. Out << getVariableName(getDecl());
  55. }
  56. virtual void printSeparator(llvm::raw_ostream &Out) const override {
  57. Out << '.';
  58. }
  59. };
  60. /// Represents that the FieldNode that comes after this is declared in a base
  61. /// of the previous FieldNode. As such, this descendant doesn't wrap a
  62. /// FieldRegion, and is purely a tool to describe a relation between two other
  63. /// FieldRegion wrapping descendants.
  64. class BaseClass final : public FieldNode {
  65. const QualType BaseClassT;
  66. public:
  67. BaseClass(const QualType &T) : FieldNode(nullptr), BaseClassT(T) {
  68. assert(!T.isNull());
  69. assert(T->getAsCXXRecordDecl());
  70. }
  71. virtual void printNoteMsg(llvm::raw_ostream &Out) const override {
  72. llvm_unreachable("This node can never be the final node in the "
  73. "fieldchain!");
  74. }
  75. virtual void printPrefix(llvm::raw_ostream &Out) const override {}
  76. virtual void printNode(llvm::raw_ostream &Out) const override {
  77. Out << BaseClassT->getAsCXXRecordDecl()->getName() << "::";
  78. }
  79. virtual void printSeparator(llvm::raw_ostream &Out) const override {}
  80. virtual bool isBase() const override { return true; }
  81. };
  82. } // end of anonymous namespace
  83. // Utility function declarations.
  84. /// Returns the region that was constructed by CtorDecl, or nullptr if that
  85. /// isn't possible.
  86. static const TypedValueRegion *
  87. getConstructedRegion(const CXXConstructorDecl *CtorDecl,
  88. CheckerContext &Context);
  89. /// Checks whether the object constructed by \p Ctor will be analyzed later
  90. /// (e.g. if the object is a field of another object, in which case we'd check
  91. /// it multiple times).
  92. static bool willObjectBeAnalyzedLater(const CXXConstructorDecl *Ctor,
  93. CheckerContext &Context);
  94. /// Checks whether RD contains a field with a name or type name that matches
  95. /// \p Pattern.
  96. static bool shouldIgnoreRecord(const RecordDecl *RD, StringRef Pattern);
  97. /// Checks _syntactically_ whether it is possible to access FD from the record
  98. /// that contains it without a preceding assert (even if that access happens
  99. /// inside a method). This is mainly used for records that act like unions, like
  100. /// having multiple bit fields, with only a fraction being properly initialized.
  101. /// If these fields are properly guarded with asserts, this method returns
  102. /// false.
  103. ///
  104. /// Since this check is done syntactically, this method could be inaccurate.
  105. static bool hasUnguardedAccess(const FieldDecl *FD, ProgramStateRef State);
  106. //===----------------------------------------------------------------------===//
  107. // Methods for UninitializedObjectChecker.
  108. //===----------------------------------------------------------------------===//
  109. void UninitializedObjectChecker::checkEndFunction(
  110. const ReturnStmt *RS, CheckerContext &Context) const {
  111. const auto *CtorDecl = dyn_cast_or_null<CXXConstructorDecl>(
  112. Context.getLocationContext()->getDecl());
  113. if (!CtorDecl)
  114. return;
  115. if (!CtorDecl->isUserProvided())
  116. return;
  117. if (CtorDecl->getParent()->isUnion())
  118. return;
  119. // This avoids essentially the same error being reported multiple times.
  120. if (willObjectBeAnalyzedLater(CtorDecl, Context))
  121. return;
  122. const TypedValueRegion *R = getConstructedRegion(CtorDecl, Context);
  123. if (!R)
  124. return;
  125. FindUninitializedFields F(Context.getState(), R, Opts);
  126. std::pair<ProgramStateRef, const UninitFieldMap &> UninitInfo =
  127. F.getResults();
  128. ProgramStateRef UpdatedState = UninitInfo.first;
  129. const UninitFieldMap &UninitFields = UninitInfo.second;
  130. if (UninitFields.empty()) {
  131. Context.addTransition(UpdatedState);
  132. return;
  133. }
  134. // There are uninitialized fields in the record.
  135. ExplodedNode *Node = Context.generateNonFatalErrorNode(UpdatedState);
  136. if (!Node)
  137. return;
  138. PathDiagnosticLocation LocUsedForUniqueing;
  139. const Stmt *CallSite = Context.getStackFrame()->getCallSite();
  140. if (CallSite)
  141. LocUsedForUniqueing = PathDiagnosticLocation::createBegin(
  142. CallSite, Context.getSourceManager(), Node->getLocationContext());
  143. // For Plist consumers that don't support notes just yet, we'll convert notes
  144. // to warnings.
  145. if (Opts.ShouldConvertNotesToWarnings) {
  146. for (const auto &Pair : UninitFields) {
  147. auto Report = llvm::make_unique<BugReport>(
  148. *BT_uninitField, Pair.second, Node, LocUsedForUniqueing,
  149. Node->getLocationContext()->getDecl());
  150. Context.emitReport(std::move(Report));
  151. }
  152. return;
  153. }
  154. SmallString<100> WarningBuf;
  155. llvm::raw_svector_ostream WarningOS(WarningBuf);
  156. WarningOS << UninitFields.size() << " uninitialized field"
  157. << (UninitFields.size() == 1 ? "" : "s")
  158. << " at the end of the constructor call";
  159. auto Report = llvm::make_unique<BugReport>(
  160. *BT_uninitField, WarningOS.str(), Node, LocUsedForUniqueing,
  161. Node->getLocationContext()->getDecl());
  162. for (const auto &Pair : UninitFields) {
  163. Report->addNote(Pair.second,
  164. PathDiagnosticLocation::create(Pair.first->getDecl(),
  165. Context.getSourceManager()));
  166. }
  167. Context.emitReport(std::move(Report));
  168. }
  169. void UninitializedObjectChecker::checkDeadSymbols(SymbolReaper &SR,
  170. CheckerContext &C) const {
  171. ProgramStateRef State = C.getState();
  172. for (const MemRegion *R : State->get<AnalyzedRegions>()) {
  173. if (!SR.isLiveRegion(R))
  174. State = State->remove<AnalyzedRegions>(R);
  175. }
  176. }
  177. //===----------------------------------------------------------------------===//
  178. // Methods for FindUninitializedFields.
  179. //===----------------------------------------------------------------------===//
  180. FindUninitializedFields::FindUninitializedFields(
  181. ProgramStateRef State, const TypedValueRegion *const R,
  182. const UninitObjCheckerOptions &Opts)
  183. : State(State), ObjectR(R), Opts(Opts) {
  184. isNonUnionUninit(ObjectR, FieldChainInfo(ChainFactory));
  185. // In non-pedantic mode, if ObjectR doesn't contain a single initialized
  186. // field, we'll assume that Object was intentionally left uninitialized.
  187. if (!Opts.IsPedantic && !isAnyFieldInitialized())
  188. UninitFields.clear();
  189. }
  190. bool FindUninitializedFields::addFieldToUninits(FieldChainInfo Chain,
  191. const MemRegion *PointeeR) {
  192. const FieldRegion *FR = Chain.getUninitRegion();
  193. assert((PointeeR || !isDereferencableType(FR->getDecl()->getType())) &&
  194. "One must also pass the pointee region as a parameter for "
  195. "dereferenceable fields!");
  196. if (State->getStateManager().getContext().getSourceManager().isInSystemHeader(
  197. FR->getDecl()->getLocation()))
  198. return false;
  199. if (Opts.IgnoreGuardedFields && !hasUnguardedAccess(FR->getDecl(), State))
  200. return false;
  201. if (State->contains<AnalyzedRegions>(FR))
  202. return false;
  203. if (PointeeR) {
  204. if (State->contains<AnalyzedRegions>(PointeeR)) {
  205. return false;
  206. }
  207. State = State->add<AnalyzedRegions>(PointeeR);
  208. }
  209. State = State->add<AnalyzedRegions>(FR);
  210. UninitFieldMap::mapped_type NoteMsgBuf;
  211. llvm::raw_svector_ostream OS(NoteMsgBuf);
  212. Chain.printNoteMsg(OS);
  213. return UninitFields.insert({FR, std::move(NoteMsgBuf)}).second;
  214. }
  215. bool FindUninitializedFields::isNonUnionUninit(const TypedValueRegion *R,
  216. FieldChainInfo LocalChain) {
  217. assert(R->getValueType()->isRecordType() &&
  218. !R->getValueType()->isUnionType() &&
  219. "This method only checks non-union record objects!");
  220. const RecordDecl *RD = R->getValueType()->getAsRecordDecl()->getDefinition();
  221. if (!RD) {
  222. IsAnyFieldInitialized = true;
  223. return true;
  224. }
  225. if (!Opts.IgnoredRecordsWithFieldPattern.empty() &&
  226. shouldIgnoreRecord(RD, Opts.IgnoredRecordsWithFieldPattern)) {
  227. IsAnyFieldInitialized = true;
  228. return false;
  229. }
  230. bool ContainsUninitField = false;
  231. // Are all of this non-union's fields initialized?
  232. for (const FieldDecl *I : RD->fields()) {
  233. const auto FieldVal =
  234. State->getLValue(I, loc::MemRegionVal(R)).castAs<loc::MemRegionVal>();
  235. const auto *FR = FieldVal.getRegionAs<FieldRegion>();
  236. QualType T = I->getType();
  237. // If LocalChain already contains FR, then we encountered a cyclic
  238. // reference. In this case, region FR is already under checking at an
  239. // earlier node in the directed tree.
  240. if (LocalChain.contains(FR))
  241. return false;
  242. if (T->isStructureOrClassType()) {
  243. if (isNonUnionUninit(FR, LocalChain.add(RegularField(FR))))
  244. ContainsUninitField = true;
  245. continue;
  246. }
  247. if (T->isUnionType()) {
  248. if (isUnionUninit(FR)) {
  249. if (addFieldToUninits(LocalChain.add(RegularField(FR))))
  250. ContainsUninitField = true;
  251. } else
  252. IsAnyFieldInitialized = true;
  253. continue;
  254. }
  255. if (T->isArrayType()) {
  256. IsAnyFieldInitialized = true;
  257. continue;
  258. }
  259. SVal V = State->getSVal(FieldVal);
  260. if (isDereferencableType(T) || V.getAs<nonloc::LocAsInteger>()) {
  261. if (isDereferencableUninit(FR, LocalChain))
  262. ContainsUninitField = true;
  263. continue;
  264. }
  265. if (isPrimitiveType(T)) {
  266. if (isPrimitiveUninit(V)) {
  267. if (addFieldToUninits(LocalChain.add(RegularField(FR))))
  268. ContainsUninitField = true;
  269. }
  270. continue;
  271. }
  272. llvm_unreachable("All cases are handled!");
  273. }
  274. // Checking bases. The checker will regard inherited data members as direct
  275. // fields.
  276. const auto *CXXRD = dyn_cast<CXXRecordDecl>(RD);
  277. if (!CXXRD)
  278. return ContainsUninitField;
  279. for (const CXXBaseSpecifier &BaseSpec : CXXRD->bases()) {
  280. const auto *BaseRegion = State->getLValue(BaseSpec, R)
  281. .castAs<loc::MemRegionVal>()
  282. .getRegionAs<TypedValueRegion>();
  283. // If the head of the list is also a BaseClass, we'll overwrite it to avoid
  284. // note messages like 'this->A::B::x'.
  285. if (!LocalChain.isEmpty() && LocalChain.getHead().isBase()) {
  286. if (isNonUnionUninit(BaseRegion, LocalChain.replaceHead(
  287. BaseClass(BaseSpec.getType()))))
  288. ContainsUninitField = true;
  289. } else {
  290. if (isNonUnionUninit(BaseRegion,
  291. LocalChain.add(BaseClass(BaseSpec.getType()))))
  292. ContainsUninitField = true;
  293. }
  294. }
  295. return ContainsUninitField;
  296. }
  297. bool FindUninitializedFields::isUnionUninit(const TypedValueRegion *R) {
  298. assert(R->getValueType()->isUnionType() &&
  299. "This method only checks union objects!");
  300. // TODO: Implement support for union fields.
  301. return false;
  302. }
  303. bool FindUninitializedFields::isPrimitiveUninit(const SVal &V) {
  304. if (V.isUndef())
  305. return true;
  306. IsAnyFieldInitialized = true;
  307. return false;
  308. }
  309. //===----------------------------------------------------------------------===//
  310. // Methods for FieldChainInfo.
  311. //===----------------------------------------------------------------------===//
  312. bool FieldChainInfo::contains(const FieldRegion *FR) const {
  313. for (const FieldNode &Node : Chain) {
  314. if (Node.isSameRegion(FR))
  315. return true;
  316. }
  317. return false;
  318. }
  319. /// Prints every element except the last to `Out`. Since ImmutableLists store
  320. /// elements in reverse order, and have no reverse iterators, we use a
  321. /// recursive function to print the fieldchain correctly. The last element in
  322. /// the chain is to be printed by `FieldChainInfo::print`.
  323. static void printTail(llvm::raw_ostream &Out,
  324. const FieldChainInfo::FieldChain L);
  325. // FIXME: This function constructs an incorrect string in the following case:
  326. //
  327. // struct Base { int x; };
  328. // struct D1 : Base {}; struct D2 : Base {};
  329. //
  330. // struct MostDerived : D1, D2 {
  331. // MostDerived() {}
  332. // }
  333. //
  334. // A call to MostDerived::MostDerived() will cause two notes that say
  335. // "uninitialized field 'this->x'", but we can't refer to 'x' directly,
  336. // we need an explicit namespace resolution whether the uninit field was
  337. // 'D1::x' or 'D2::x'.
  338. void FieldChainInfo::printNoteMsg(llvm::raw_ostream &Out) const {
  339. if (Chain.isEmpty())
  340. return;
  341. const FieldNode &LastField = getHead();
  342. LastField.printNoteMsg(Out);
  343. Out << '\'';
  344. for (const FieldNode &Node : Chain)
  345. Node.printPrefix(Out);
  346. Out << "this->";
  347. printTail(Out, Chain.getTail());
  348. LastField.printNode(Out);
  349. Out << '\'';
  350. }
  351. static void printTail(llvm::raw_ostream &Out,
  352. const FieldChainInfo::FieldChain L) {
  353. if (L.isEmpty())
  354. return;
  355. printTail(Out, L.getTail());
  356. L.getHead().printNode(Out);
  357. L.getHead().printSeparator(Out);
  358. }
  359. //===----------------------------------------------------------------------===//
  360. // Utility functions.
  361. //===----------------------------------------------------------------------===//
  362. static const TypedValueRegion *
  363. getConstructedRegion(const CXXConstructorDecl *CtorDecl,
  364. CheckerContext &Context) {
  365. Loc ThisLoc =
  366. Context.getSValBuilder().getCXXThis(CtorDecl, Context.getStackFrame());
  367. SVal ObjectV = Context.getState()->getSVal(ThisLoc);
  368. auto *R = ObjectV.getAsRegion()->getAs<TypedValueRegion>();
  369. if (R && !R->getValueType()->getAsCXXRecordDecl())
  370. return nullptr;
  371. return R;
  372. }
  373. static bool willObjectBeAnalyzedLater(const CXXConstructorDecl *Ctor,
  374. CheckerContext &Context) {
  375. const TypedValueRegion *CurrRegion = getConstructedRegion(Ctor, Context);
  376. if (!CurrRegion)
  377. return false;
  378. const LocationContext *LC = Context.getLocationContext();
  379. while ((LC = LC->getParent())) {
  380. // If \p Ctor was called by another constructor.
  381. const auto *OtherCtor = dyn_cast<CXXConstructorDecl>(LC->getDecl());
  382. if (!OtherCtor)
  383. continue;
  384. const TypedValueRegion *OtherRegion =
  385. getConstructedRegion(OtherCtor, Context);
  386. if (!OtherRegion)
  387. continue;
  388. // If the CurrRegion is a subregion of OtherRegion, it will be analyzed
  389. // during the analysis of OtherRegion.
  390. if (CurrRegion->isSubRegionOf(OtherRegion))
  391. return true;
  392. }
  393. return false;
  394. }
  395. static bool shouldIgnoreRecord(const RecordDecl *RD, StringRef Pattern) {
  396. llvm::Regex R(Pattern);
  397. for (const FieldDecl *FD : RD->fields()) {
  398. if (R.match(FD->getType().getAsString()))
  399. return true;
  400. if (R.match(FD->getName()))
  401. return true;
  402. }
  403. return false;
  404. }
  405. static const Stmt *getMethodBody(const CXXMethodDecl *M) {
  406. if (isa<CXXConstructorDecl>(M))
  407. return nullptr;
  408. if (!M->isDefined())
  409. return nullptr;
  410. return M->getDefinition()->getBody();
  411. }
  412. static bool hasUnguardedAccess(const FieldDecl *FD, ProgramStateRef State) {
  413. if (FD->getAccess() == AccessSpecifier::AS_public)
  414. return true;
  415. const auto *Parent = dyn_cast<CXXRecordDecl>(FD->getParent());
  416. if (!Parent)
  417. return true;
  418. Parent = Parent->getDefinition();
  419. assert(Parent && "The record's definition must be avaible if an uninitialized"
  420. " field of it was found!");
  421. ASTContext &AC = State->getStateManager().getContext();
  422. auto FieldAccessM = memberExpr(hasDeclaration(equalsNode(FD))).bind("access");
  423. auto AssertLikeM = callExpr(callee(functionDecl(
  424. anyOf(hasName("exit"), hasName("panic"), hasName("error"),
  425. hasName("Assert"), hasName("assert"), hasName("ziperr"),
  426. hasName("assfail"), hasName("db_error"), hasName("__assert"),
  427. hasName("__assert2"), hasName("_wassert"), hasName("__assert_rtn"),
  428. hasName("__assert_fail"), hasName("dtrace_assfail"),
  429. hasName("yy_fatal_error"), hasName("_XCAssertionFailureHandler"),
  430. hasName("_DTAssertionFailureHandler"),
  431. hasName("_TSAssertionFailureHandler")))));
  432. auto NoReturnFuncM = callExpr(callee(functionDecl(isNoReturn())));
  433. auto GuardM =
  434. stmt(anyOf(ifStmt(), switchStmt(), conditionalOperator(), AssertLikeM,
  435. NoReturnFuncM))
  436. .bind("guard");
  437. for (const CXXMethodDecl *M : Parent->methods()) {
  438. const Stmt *MethodBody = getMethodBody(M);
  439. if (!MethodBody)
  440. continue;
  441. auto Accesses = match(stmt(hasDescendant(FieldAccessM)), *MethodBody, AC);
  442. if (Accesses.empty())
  443. continue;
  444. const auto *FirstAccess = Accesses[0].getNodeAs<MemberExpr>("access");
  445. assert(FirstAccess);
  446. auto Guards = match(stmt(hasDescendant(GuardM)), *MethodBody, AC);
  447. if (Guards.empty())
  448. return true;
  449. const auto *FirstGuard = Guards[0].getNodeAs<Stmt>("guard");
  450. assert(FirstGuard);
  451. if (FirstAccess->getBeginLoc() < FirstGuard->getBeginLoc())
  452. return true;
  453. }
  454. return false;
  455. }
  456. std::string clang::ento::getVariableName(const FieldDecl *Field) {
  457. // If Field is a captured lambda variable, Field->getName() will return with
  458. // an empty string. We can however acquire it's name from the lambda's
  459. // captures.
  460. const auto *CXXParent = dyn_cast<CXXRecordDecl>(Field->getParent());
  461. if (CXXParent && CXXParent->isLambda()) {
  462. assert(CXXParent->captures_begin());
  463. auto It = CXXParent->captures_begin() + Field->getFieldIndex();
  464. if (It->capturesVariable())
  465. return llvm::Twine("/*captured variable*/" +
  466. It->getCapturedVar()->getName())
  467. .str();
  468. if (It->capturesThis())
  469. return "/*'this' capture*/";
  470. llvm_unreachable("No other capture type is expected!");
  471. }
  472. return Field->getName();
  473. }
  474. void ento::registerUninitializedObjectChecker(CheckerManager &Mgr) {
  475. auto Chk = Mgr.registerChecker<UninitializedObjectChecker>();
  476. AnalyzerOptions &AnOpts = Mgr.getAnalyzerOptions();
  477. UninitObjCheckerOptions &ChOpts = Chk->Opts;
  478. ChOpts.IsPedantic =
  479. AnOpts.getCheckerBooleanOption(Chk, "Pedantic", /*DefaultVal*/ false);
  480. ChOpts.ShouldConvertNotesToWarnings = AnOpts.getCheckerBooleanOption(
  481. Chk, "NotesAsWarnings", /*DefaultVal*/ false);
  482. ChOpts.CheckPointeeInitialization = AnOpts.getCheckerBooleanOption(
  483. Chk, "CheckPointeeInitialization", /*DefaultVal*/ false);
  484. ChOpts.IgnoredRecordsWithFieldPattern =
  485. AnOpts.getCheckerStringOption(Chk, "IgnoreRecordsWithField",
  486. /*DefaultVal*/ "");
  487. ChOpts.IgnoreGuardedFields =
  488. AnOpts.getCheckerBooleanOption(Chk, "IgnoreGuardedFields",
  489. /*DefaultVal*/ false);
  490. }
  491. bool ento::shouldRegisterUninitializedObjectChecker(const LangOptions &LO) {
  492. return true;
  493. }