]> granicus.if.org Git - clang/commitdiff
[NFC] Don't define static function in header (UninitializedObject.h)
authorAndrei Elovikov <andrei.elovikov@intel.com>
Mon, 20 Aug 2018 13:45:38 +0000 (13:45 +0000)
committerAndrei Elovikov <andrei.elovikov@intel.com>
Mon, 20 Aug 2018 13:45:38 +0000 (13:45 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@340174 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp

index ee9bcecb4ef4a8e490219b20af7ab96cab10ca58..bcecfb76ce5bdd1ba1467043072cba8f58a723bc 100644 (file)
@@ -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();
 }
 
index e459d984f728e20ffc3623bb43041a442ee76495..5817ea775f2053ef348578ea29a0a79b1839ee18 100644 (file)
@@ -215,12 +215,10 @@ bool FindUninitializedFields::isPointerOrReferenceUninit(
     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)