C++: Make getExpandedArgument more robust

This make the predicate give back sensible results on (upgraded) databases
where we do not have expanded arguments, and avoid having to write case
distinctions in places where we would want to use `getExpandedArgument`.
This commit is contained in:
Jeroen Ketema
2025-11-19 12:49:54 +01:00
parent e235e0473a
commit fe3f90e041

View File

@@ -107,7 +107,11 @@ class Compilation extends @compilation {
* includes the arguments from that file, rather than just taking the
* argument literally.
*/
string getExpandedArgument(int i) { compilation_expanded_args(this, i, result) }
string getExpandedArgument(int i) {
if exists(string arg | compilation_expanded_args(this, _, arg))
then compilation_expanded_args(this, i, result)
else result = this.getArgument(i)
}
/**
* Gets the total amount of CPU time spent processing all the files in the