This patch both: 1. Provides a static checker to detect global variables which may not be initialized at compile-time 2. Verify that variables flagged as MOZ_RUNINIT are indeed initialized at runtime 3. In case of variables whose initialisation status varies based on macro definition or template parameters, just flag them as MOZ_GLOBINIT. Differential Revision: https://phabricator.services.mozilla.com/D223342
19 lines
660 B
C++
19 lines
660 B
C++
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef GlobalVariableInitializationChecker_h__
|
|
#define GlobalVariableInitializationChecker_h__
|
|
|
|
#include "plugin.h"
|
|
|
|
class GlobalVariableInitializationChecker : public BaseCheck {
|
|
public:
|
|
GlobalVariableInitializationChecker(StringRef CheckName, ContextType *Context = nullptr)
|
|
: BaseCheck(CheckName, Context) {}
|
|
void registerMatchers(MatchFinder *AstMatcher) override;
|
|
void check(const MatchFinder::MatchResult &Result) override;
|
|
};
|
|
|
|
#endif
|