[clang-tools-extra] r207407 - Try to fix the build. newFrontendActionFactory was changed to return a unique_ptr.

Benjamin Kramer benny.kra at gmail.com
Mon Apr 28 07:50:20 PDT 2014


On 28.04.2014, at 16:15, Nico Weber <thakis at chromium.org> wrote:

> Thanks!
> 
> Is this the recommended style for unique_ptr temporaries? It's not
> very obvious that the result of newFrontendActionFactory will be freed
> at the end of the statement this way (possibly because I just haven't
> seen it much yet).

I doubt that we have a preferred style for this. I agree that the lifetime isn't obvious here, I just wanted to keep the changes to a minimum.

- Ben

> On Mon, Apr 28, 2014 at 3:06 AM, Benjamin Kramer
> <benny.kra at googlemail.com> wrote:
>> Author: d0k
>> Date: Mon Apr 28 05:06:50 2014
>> New Revision: 207407
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=207407&view=rev
>> Log:
>> Try to fix the build. newFrontendActionFactory was changed to return a unique_ptr.
>> 
>> Modified:
>>    clang-tools-extra/trunk/clang-modernize/tool/ClangModernize.cpp
>>    clang-tools-extra/trunk/remove-cstr-calls/RemoveCStrCalls.cpp
>>    clang-tools-extra/trunk/tool-template/ToolTemplate.cpp
>>    clang-tools-extra/trunk/unittests/clang-modernize/TransformTest.cpp
>> 
>> Modified: clang-tools-extra/trunk/clang-modernize/tool/ClangModernize.cpp
>> URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-modernize/tool/ClangModernize.cpp?rev=207407&r1=207406&r2=207407&view=diff
>> ==============================================================================
>> --- clang-tools-extra/trunk/clang-modernize/tool/ClangModernize.cpp (original)
>> +++ clang-tools-extra/trunk/clang-modernize/tool/ClangModernize.cpp Mon Apr 28 05:06:50 2014
>> @@ -469,7 +469,7 @@ int main(int argc, const char **argv) {
>> 
>>   if (FinalSyntaxCheck) {
>>     ClangTool SyntaxTool(*Compilations, SourcePaths);
>> -    if (SyntaxTool.run(newFrontendActionFactory<SyntaxOnlyAction>()) != 0)
>> +    if (SyntaxTool.run(newFrontendActionFactory<SyntaxOnlyAction>().get()) != 0)
>>       return 1;
>>   }
>> 
>> 
>> Modified: clang-tools-extra/trunk/remove-cstr-calls/RemoveCStrCalls.cpp
>> URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/remove-cstr-calls/RemoveCStrCalls.cpp?rev=207407&r1=207406&r2=207407&view=diff
>> ==============================================================================
>> --- clang-tools-extra/trunk/remove-cstr-calls/RemoveCStrCalls.cpp (original)
>> +++ clang-tools-extra/trunk/remove-cstr-calls/RemoveCStrCalls.cpp Mon Apr 28 05:06:50 2014
>> @@ -233,5 +233,5 @@ int main(int argc, const char **argv) {
>>                   callee(methodDecl(hasName(StringCStrMethod))),
>>                   on(id("arg", expr())))))),
>>       &Callback);
>> -  return Tool.runAndSave(newFrontendActionFactory(&Finder));
>> +  return Tool.runAndSave(newFrontendActionFactory(&Finder).get());
>> }
>> 
>> Modified: clang-tools-extra/trunk/tool-template/ToolTemplate.cpp
>> URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/tool-template/ToolTemplate.cpp?rev=207407&r1=207406&r2=207407&view=diff
>> ==============================================================================
>> --- clang-tools-extra/trunk/tool-template/ToolTemplate.cpp (original)
>> +++ clang-tools-extra/trunk/tool-template/ToolTemplate.cpp Mon Apr 28 05:06:50 2014
>> @@ -103,5 +103,5 @@ int main(int argc, const char **argv) {
>> // Use Finder.addMatcher(...) to define the patterns in the AST that you
>> // want to match against. You are not limited to just one matcher!
>> 
>> -  return Tool.run(newFrontendActionFactory(&Finder));
>> +  return Tool.run(newFrontendActionFactory(&Finder).get());
>> }
>> 
>> Modified: clang-tools-extra/trunk/unittests/clang-modernize/TransformTest.cpp
>> URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clang-modernize/TransformTest.cpp?rev=207407&r1=207406&r2=207407&view=diff
>> ==============================================================================
>> --- clang-tools-extra/trunk/unittests/clang-modernize/TransformTest.cpp (original)
>> +++ clang-tools-extra/trunk/unittests/clang-modernize/TransformTest.cpp Mon Apr 28 05:06:50 2014
>> @@ -153,7 +153,8 @@ TEST(Transform, Timings) {
>>   // handleEndSource() calls to it.
>>   CallbackForwarder Callbacks(T);
>> 
>> -  Tool.run(clang::tooling::newFrontendActionFactory(&Factory, &Callbacks));
>> +  Tool.run(
>> +      clang::tooling::newFrontendActionFactory(&Factory, &Callbacks).get());
>> 
>>   EXPECT_TRUE(Factory.Called);
>>   Transform::TimingVec::const_iterator I = T.timing_begin();
>> @@ -271,7 +272,7 @@ TEST(Transform, isFileModifiable) {
>>   DummyTransform T("dummy", Options);
>>   MatchFinder Finder;
>>   Finder.addMatcher(varDecl().bind("decl"), new ModifiableCallback(T));
>> -  Tool.run(tooling::newFrontendActionFactory(&Finder));
>> +  Tool.run(tooling::newFrontendActionFactory(&Finder).get());
>> }
>> 
>> TEST(VersionTest, Interface) {
>> 
>> 
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits





More information about the cfe-commits mailing list