forked from OSchip/llvm-project
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:
parent
ad335cf690
commit
a2406fa9e5
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue