*** This commit represents a complete reformatting of the LLDB source code

*** to conform to clang-format’s LLVM style.  This kind of mass change has
*** two obvious implications:

Firstly, merging this particular commit into a downstream fork may be a huge
effort.  Alternatively, it may be worth merging all changes up to this commit,
performing the same reformatting operation locally, and then discarding the
merge for this particular commit.  The commands used to accomplish this
reformatting were as follows (with current working directory as the root of
the repository):

    find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} +
    find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ;

The version of clang-format used was 3.9.0, and autopep8 was 1.2.4.

Secondly, “blame” style tools will generally point to this commit instead of
a meaningful prior commit.  There are alternatives available that will attempt
to look through this change and find the appropriate prior commit.  YMMV.

llvm-svn: 280751
This commit is contained in:
Kate Stone
2016-09-06 20:57:50 +00:00
parent d5aa733769
commit b9c1b51e45
2780 changed files with 556690 additions and 597060 deletions

View File

@@ -1,4 +1,5 @@
//===-- PythonExceptionStateTest.cpp ------------------------------*- C++ -*-===//
//===-- PythonExceptionStateTest.cpp ------------------------------*- C++
//-*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -9,166 +10,156 @@
#include "gtest/gtest.h"
#include "Plugins/ScriptInterpreter/Python/lldb-python.h"
#include "Plugins/ScriptInterpreter/Python/PythonDataObjects.h"
#include "Plugins/ScriptInterpreter/Python/PythonExceptionState.h"
#include "Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h"
#include "Plugins/ScriptInterpreter/Python/lldb-python.h"
#include "PythonTestSuite.h"
using namespace lldb_private;
class PythonExceptionStateTest : public PythonTestSuite
{
public:
protected:
void
RaiseException()
{
PyErr_SetString(PyExc_RuntimeError, "PythonExceptionStateTest test error");
}
class PythonExceptionStateTest : public PythonTestSuite {
public:
protected:
void RaiseException() {
PyErr_SetString(PyExc_RuntimeError, "PythonExceptionStateTest test error");
}
};
TEST_F(PythonExceptionStateTest, TestExceptionStateChecking)
{
PyErr_Clear();
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
TEST_F(PythonExceptionStateTest, TestExceptionStateChecking) {
PyErr_Clear();
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
RaiseException();
EXPECT_TRUE(PythonExceptionState::HasErrorOccurred());
RaiseException();
EXPECT_TRUE(PythonExceptionState::HasErrorOccurred());
PyErr_Clear();
PyErr_Clear();
}
TEST_F(PythonExceptionStateTest, TestAcquisitionSemantics)
{
PyErr_Clear();
PythonExceptionState no_error(false);
EXPECT_FALSE(no_error.IsError());
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
TEST_F(PythonExceptionStateTest, TestAcquisitionSemantics) {
PyErr_Clear();
PythonExceptionState no_error(false);
EXPECT_FALSE(no_error.IsError());
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
PyErr_Clear();
PyErr_Clear();
RaiseException();
PythonExceptionState error(false);
EXPECT_TRUE(error.IsError());
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
error.Discard();
PyErr_Clear();
RaiseException();
error.Acquire(false);
EXPECT_TRUE(error.IsError());
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
PyErr_Clear();
}
TEST_F(PythonExceptionStateTest, TestDiscardSemantics) {
PyErr_Clear();
// Test that discarding an exception does not restore the exception
// state even when auto-restore==true is set
RaiseException();
PythonExceptionState error(true);
EXPECT_TRUE(error.IsError());
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
error.Discard();
EXPECT_FALSE(error.IsError());
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
}
TEST_F(PythonExceptionStateTest, TestResetSemantics) {
PyErr_Clear();
// Resetting when auto-restore is true should restore.
RaiseException();
PythonExceptionState error(true);
EXPECT_TRUE(error.IsError());
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
error.Reset();
EXPECT_FALSE(error.IsError());
EXPECT_TRUE(PythonExceptionState::HasErrorOccurred());
PyErr_Clear();
// Resetting when auto-restore is false should discard.
RaiseException();
PythonExceptionState error2(false);
EXPECT_TRUE(error2.IsError());
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
error2.Reset();
EXPECT_FALSE(error2.IsError());
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
PyErr_Clear();
}
TEST_F(PythonExceptionStateTest, TestManualRestoreSemantics) {
PyErr_Clear();
RaiseException();
PythonExceptionState error(false);
EXPECT_TRUE(error.IsError());
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
error.Restore();
EXPECT_FALSE(error.IsError());
EXPECT_TRUE(PythonExceptionState::HasErrorOccurred());
PyErr_Clear();
}
TEST_F(PythonExceptionStateTest, TestAutoRestoreSemantics) {
PyErr_Clear();
// Test that using the auto-restore flag correctly restores the exception
// state on destruction, and not using the auto-restore flag correctly
// does NOT restore the state on destruction.
{
RaiseException();
PythonExceptionState error(false);
EXPECT_TRUE(error.IsError());
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
error.Discard();
}
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
PyErr_Clear();
RaiseException();
error.Acquire(false);
EXPECT_TRUE(error.IsError());
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
PyErr_Clear();
}
TEST_F(PythonExceptionStateTest, TestDiscardSemantics)
{
PyErr_Clear();
// Test that discarding an exception does not restore the exception
// state even when auto-restore==true is set
PyErr_Clear();
{
RaiseException();
PythonExceptionState error(true);
EXPECT_TRUE(error.IsError());
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
}
EXPECT_TRUE(PythonExceptionState::HasErrorOccurred());
error.Discard();
EXPECT_FALSE(error.IsError());
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
PyErr_Clear();
}
TEST_F(PythonExceptionStateTest, TestResetSemantics)
{
PyErr_Clear();
TEST_F(PythonExceptionStateTest, TestAutoRestoreChanged) {
// Test that if we re-acquire with different auto-restore semantics,
// that the new semantics are respected.
PyErr_Clear();
// Resetting when auto-restore is true should restore.
RaiseException();
PythonExceptionState error(true);
EXPECT_TRUE(error.IsError());
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
error.Reset();
EXPECT_FALSE(error.IsError());
EXPECT_TRUE(PythonExceptionState::HasErrorOccurred());
RaiseException();
PythonExceptionState error(false);
EXPECT_TRUE(error.IsError());
PyErr_Clear();
error.Reset();
EXPECT_FALSE(error.IsError());
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
// Resetting when auto-restore is false should discard.
RaiseException();
PythonExceptionState error2(false);
EXPECT_TRUE(error2.IsError());
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
error2.Reset();
EXPECT_FALSE(error2.IsError());
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
RaiseException();
error.Acquire(true);
EXPECT_TRUE(error.IsError());
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
PyErr_Clear();
}
TEST_F(PythonExceptionStateTest, TestManualRestoreSemantics)
{
PyErr_Clear();
RaiseException();
PythonExceptionState error(false);
EXPECT_TRUE(error.IsError());
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
error.Restore();
EXPECT_FALSE(error.IsError());
EXPECT_TRUE(PythonExceptionState::HasErrorOccurred());
PyErr_Clear();
}
TEST_F(PythonExceptionStateTest, TestAutoRestoreSemantics)
{
PyErr_Clear();
// Test that using the auto-restore flag correctly restores the exception
// state on destruction, and not using the auto-restore flag correctly
// does NOT restore the state on destruction.
{
RaiseException();
PythonExceptionState error(false);
EXPECT_TRUE(error.IsError());
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
}
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
PyErr_Clear();
{
RaiseException();
PythonExceptionState error(true);
EXPECT_TRUE(error.IsError());
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
}
EXPECT_TRUE(PythonExceptionState::HasErrorOccurred());
PyErr_Clear();
}
TEST_F(PythonExceptionStateTest, TestAutoRestoreChanged)
{
// Test that if we re-acquire with different auto-restore semantics,
// that the new semantics are respected.
PyErr_Clear();
RaiseException();
PythonExceptionState error(false);
EXPECT_TRUE(error.IsError());
error.Reset();
EXPECT_FALSE(error.IsError());
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
RaiseException();
error.Acquire(true);
EXPECT_TRUE(error.IsError());
EXPECT_FALSE(PythonExceptionState::HasErrorOccurred());
error.Reset();
EXPECT_FALSE(error.IsError());
EXPECT_TRUE(PythonExceptionState::HasErrorOccurred());
PyErr_Clear();
error.Reset();
EXPECT_FALSE(error.IsError());
EXPECT_TRUE(PythonExceptionState::HasErrorOccurred());
PyErr_Clear();
}