Revert over-eager unique_ptr conversion.

This test wants to observe PPCallbacks after they have been moved into the
preprocessor. That doesn't work if the pointer has been moved away.

llvm-svn: 217481
This commit is contained in:
Benjamin Kramer 2014-09-10 09:35:49 +00:00
parent ad335cf690
commit a2406fa9e5
1 changed files with 6 additions and 6 deletions

View File

@ -111,15 +111,15 @@ struct TestPPCallbacks : public PPCallbacks {
};
class TestPPCallbacksFrontendAction : public PreprocessorFrontendAction {
std::unique_ptr<TestPPCallbacks> Callbacks;
TestPPCallbacks *Callbacks;
public:
TestPPCallbacksFrontendAction(std::unique_ptr<TestPPCallbacks> C)
: Callbacks(std::move(C)), SeenEnd(false) {}
TestPPCallbacksFrontendAction(TestPPCallbacks *C)
: Callbacks(C), SeenEnd(false) {}
void ExecuteAction() override {
Preprocessor &PP = getCompilerInstance().getPreprocessor();
PP.addPPCallbacks(std::move(Callbacks));
PP.addPPCallbacks(std::unique_ptr<TestPPCallbacks>(Callbacks));
PP.EnterMainSourceFile();
}
void EndSourceFileAction() override { SeenEnd = Callbacks->SeenEnd; }
@ -140,8 +140,8 @@ TEST(PreprocessorFrontendAction, EndSourceFile) {
Compiler.setInvocation(Invocation);
Compiler.createDiagnostics();
std::unique_ptr<TestPPCallbacks> Callbacks(new TestPPCallbacks);
TestPPCallbacksFrontendAction TestAction(std::move(Callbacks));
TestPPCallbacks *Callbacks = new TestPPCallbacks;
TestPPCallbacksFrontendAction TestAction(Callbacks);
ASSERT_FALSE(Callbacks->SeenEnd);
ASSERT_FALSE(TestAction.SeenEnd);
ASSERT_TRUE(Compiler.ExecuteAction(TestAction));