We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The following is causing crash:
$ cat algo.ii template < int > struct Vec ; template < typename > struct vector ; struct Mat { template < typename _Tp > operator vector< _Tp >() const; template < typename , int n > operator Vec< n >() const; void isSubmatrix() ; void elemSize() ; void elemSize1() ; void type() ; void depth() ; void channels() ; void step1() ; void empty() ; void total() ; void updateContinuityFlag(); void forEach_impl(); }; void rawInOut(); template < typename _Tp > Mat::operator vector< _Tp >() const { } template < typename , int n > Mat::operator Vec< n >() const { { ; "opencv2/core/mat.inl.hpp"; ( 1119); } ; Vec< n > v; };
$ /usr/libexec/cvise/clang_delta --transformation=remove-unused-function --counter=1 --to-counter=14 algo.ii Segmentation fault (core dumped)
The text was updated successfully, but these errors were encountered:
With the following patch:
diff --git a/clang_delta/RemoveUnusedFunction.cpp b/clang_delta/RemoveUnusedFunction.cpp index e136037..fd67de1 100644 --- a/clang_delta/RemoveUnusedFunction.cpp +++ b/clang_delta/RemoveUnusedFunction.cpp @@ -473,6 +473,7 @@ void RemoveUnusedFunction::removeOneFunctionDecl(const FunctionDecl *FD) if (!FD->isInExternCContext() && !FD->isInExternCXXContext()) { SourceLocation FuncLocStart = getFunctionOuterLocStart(FD); + std::string FDNameStr = FD->getNameAsString(); if (FuncLocStart.isInvalid()) return; // This is a workaround to cases where we have function declaration @@ -491,6 +492,10 @@ void RemoveUnusedFunction::removeOneFunctionDecl(const FunctionDecl *FD) } LocEnd = getFunctionLocEnd(FuncLocStart, LocEnd, FD); + + fprintf (stderr, "fname=%s - %s - %s\n", FDNameStr.c_str (), FuncLocStart.printToString(*SrcManager).c_str(), + LocEnd.printToString(*SrcManager).c_str() ); + if (SrcManager->isWrittenInMainFile(FuncLocStart) && SrcManager->isWrittenInMainFile(LocEnd)) TheRewriter.RemoveText(SourceRange(FuncLocStart, LocEnd));
one can see the following overlapping ranges:
./clang_delta/clang_delta --transformation=remove-unused-function --counter=1 --to-counter=14 algo.ii fname=rawInOut - algo.ii:18:3 - algo.ii:18:18 fname=forEach_impl - algo.ii:16:3 - algo.ii:16:22 fname=updateContinuityFlag - algo.ii:15:4 - algo.ii:15:31 fname=total - algo.ii:14:4 - algo.ii:14:17 fname=empty - algo.ii:13:4 - algo.ii:13:17 fname=step1 - algo.ii:12:4 - algo.ii:12:17 fname=channels - algo.ii:11:4 - algo.ii:11:20 fname=depth - algo.ii:10:4 - algo.ii:10:17 fname=type - algo.ii:9:4 - algo.ii:9:16 fname=elemSize1 - algo.ii:8:4 - algo.ii:8:21 fname=elemSize - algo.ii:7:4 - algo.ii:7:20 fname=isSubmatrix - algo.ii:6:4 - algo.ii:6:23 fname=operator Vec<n> - algo.ii:5:4 - algo.ii:5:58 fname=operator Vec<n> - algo.ii:21:3 - algo.ii:25:2 fname=operator vector<type-parameter-0-0> - algo.ii:4:4 - algo.ii:4:59 fname=operator vector<type-parameter-0-0> - algo.ii:19:3 - algo.ii:22:9 Segmentation fault (core dumped)
Sorry, something went wrong.
Thank you for the bug report!
chenyang78
No branches or pull requests
The following is causing crash:
The text was updated successfully, but these errors were encountered: