[PATCH] D50963: [NFC] Don't define static function in header (UninitializedObject.h)
Andrei Elovikov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 20 03:30:20 PDT 2018
a.elovikov created this revision.
a.elovikov added reviewers: Szelethus, erichkeane.
See also http://lists.llvm.org/pipermail/cfe-users/2016-January/000854.html for
the reasons why it's bad.
https://reviews.llvm.org/D50963
Files:
clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp
Index: clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp
+++ clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp
@@ -215,12 +215,10 @@
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)
Index: clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
+++ clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
@@ -233,7 +233,7 @@
/// 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();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50963.161458.patch
Type: text/x-patch
Size: 1653 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180820/a2bad974/attachment.bin>
More information about the cfe-commits
mailing list