r340174 - [NFC] Don't define static function in header (UninitializedObject.h)
Andrei Elovikov via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 20 06:45:38 PDT 2018
Author: a.elovikov
Date: Mon Aug 20 06:45:38 2018
New Revision: 340174
URL: http://llvm.org/viewvc/llvm-project?rev=340174&view=rev
Log:
[NFC] Don't define static function in header (UninitializedObject.h)
Summary:
See also http://lists.llvm.org/pipermail/cfe-users/2016-January/000854.html for
the reasons why it's bad.
Reviewers: Szelethus, erichkeane
Reviewed By: Szelethus
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D50963
Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h?rev=340174&r1=340173&r2=340174&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h Mon Aug 20 06:45:38 2018
@@ -233,7 +233,7 @@ private:
/// value is undefined or not, such as ints and doubles, can be analyzed with
/// ease. This also helps ensuring that every special field type is handled
/// correctly.
-static bool isPrimitiveType(const QualType &T) {
+inline bool isPrimitiveType(const QualType &T) {
return T->isBuiltinType() || T->isEnumeralType() || T->isMemberPointerType();
}
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp?rev=340174&r1=340173&r2=340174&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp Mon Aug 20 06:45:38 2018
@@ -215,12 +215,10 @@ bool FindUninitializedFields::isPointerO
llvm_unreachable("All cases are handled!");
}
- // Temporary variable to avoid warning from -Wunused-function.
- bool IsPrimitive = isPrimitiveType(DynT->getPointeeType());
- assert((IsPrimitive || DynT->isAnyPointerType() || DynT->isReferenceType()) &&
+ assert((isPrimitiveType(DynT->getPointeeType()) || DynT->isAnyPointerType() ||
+ DynT->isReferenceType()) &&
"At this point FR must either have a primitive dynamic type, or it "
"must be a null, undefined, unknown or concrete pointer!");
- (void)IsPrimitive;
if (isPrimitiveUninit(DerefdV)) {
if (NeedsCastBack)
More information about the cfe-commits
mailing list