私は C で大きなソース コード ツリーを持っています。ソース ファイルを検索して、2 つの特定の関数 sin() と cos() の呼び出しの発生を調べ、2 つの関数に同じ引数を渡していることに興味があります。いくつかの例:
double t = sin(1.2) + cos(1.2); //match
y = sin ( x/a ); //match
z = cos(x / a );
j = sin(x) + cos(y); //no match
if (something) {
x = sin(x); // match
y = cos(x);
}
if (something)
x = sin(x); //no match!!! This is a tough case...
else
y = cos(x)
問題は、上記の内容を検索する典型的な Linux シェルで実行できるプログラム/スクリプトをどのように実装するかということです。