Summary: This confuses the SIOF checker and causes false positives. This dummy deref is generated for constructors of classes that are modeled as being pointer types instead of the actual class in infer, typically for smart pointers. I do not understand how this works. The biabduction also analyses this code, so might now get confused itself. Reviewed By: jberdine Differential Revision: D6221817 fbshipit-source-id: 050c5a9master
parent
0f1bdf664d
commit
525a94e470
@ -0,0 +1,11 @@
|
||||
/*
|
||||
* Copyright (c) 2017 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
#include "smart_pointer1.h"
|
||||
|
||||
std::unique_ptr<int> InitWithConstexprStaticOK::foo_smart_pointer_;
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2017 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
// Some funkiness in infer's models of smart pointers make it add extra
|
||||
// instructions after calls to the constructors, which trips SIOF. This tests
|
||||
// the custom SIOF logic that unhacks the hack.
|
||||
|
||||
#include <memory>
|
||||
|
||||
class InitWithConstexprStaticOK {
|
||||
public:
|
||||
InitWithConstexprStaticOK() {
|
||||
if (foo_smart_pointer_) {
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
static std::unique_ptr<int> foo_smart_pointer_;
|
||||
};
|
@ -0,0 +1,11 @@
|
||||
/*
|
||||
* Copyright (c) 2017 - present Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
#include "smart_pointer1.h"
|
||||
|
||||
InitWithConstexprStaticOK initWithConstexprStaticOk;
|
Loading…
Reference in new issue