whether the ast element is definied inside the header file
(loc: &SourceLocation, headers: &Vec<PathBuf>)
| 163 | |
| 164 | /// whether the ast element is definied inside the header file |
| 165 | fn is_defined_in_headers(loc: &SourceLocation, headers: &Vec<PathBuf>) -> bool { |
| 166 | for header in headers { |
| 167 | if let Some(loc) = &loc.spelling_loc { |
| 168 | let file_path = PathBuf::from(loc.file.to_string()); |
| 169 | if file_path.eq(header) { |
| 170 | return true; |
| 171 | } |
| 172 | } |
| 173 | if let Some(loc) = &loc.expansion_loc { |
| 174 | let file_path = PathBuf::from(loc.file.to_string()); |
| 175 | if file_path.eq(header) { |
| 176 | return true; |
| 177 | } |
| 178 | } |
| 179 | } |
| 180 | false |
| 181 | } |
| 182 | |
| 183 | /// LLMs tends to re-declare the provided API in code. |
| 184 | /// Those duplicate definitions cause link error, thus those duplicated definitions need to be removed. |
no test coverage detected