Merge pull request #13333 from geoffw0/macroname

C++: Make Macro.getName() more efficient.
This commit is contained in:
Mathias Vorreiter Pedersen
2023-05-31 13:56:58 -07:00
committed by GitHub

View File

@@ -34,7 +34,7 @@ class Macro extends PreprocessorDirective, @ppd_define {
* Gets the name of the macro. For example, `MAX` in
* `#define MAX(x,y) (((x)>(y))?(x):(y))`.
*/
string getName() { result = this.getHead().splitAt("(", 0) }
string getName() { result = this.getHead().regexpCapture("([^(]*+).*", 1) }
/** Holds if the macro has name `name`. */
predicate hasName(string name) { this.getName() = name }