mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2025-12-27 12:54:00 -05:00
The code here assumes a top-level AST subtree can be in 3 states: 1. The header line indicates it's system code (e.g. includes `/usr` etc.) 2. The header line indicates it's user code (includes `<source>`) 3. The header contains no such info (typically it includes `<invalid sloc>`) For the 3rd case this PR looks-ahead inside the current subtree and decides based on its contents. This is enough to filter out `<vector>` or `<string>` contents, as demonstrated in issue #5889 (added a test). This solution holds also for the case from issue #3849.
6 lines
89 B
C++
6 lines
89 B
C++
#include <string>
|
|
std::string square(int& num) {
|
|
num *= num;
|
|
return "success";
|
|
}
|