Skip to content

Commit a9811fe

Browse files
committed
Swift: Make Macro.getName() more efficient.
1 parent 6867e94 commit a9811fe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cpp/ql/lib/semmle/code/cpp/Macro.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Macro extends PreprocessorDirective, @ppd_define {
3434
* Gets the name of the macro. For example, `MAX` in
3535
* `#define MAX(x,y) (((x)>(y))?(x):(y))`.
3636
*/
37-
string getName() { result = this.getHead().splitAt("(", 0) }
37+
string getName() { result = this.getHead().regexpCapture("([^(]*+).*", 1) }
3838

3939
/** Holds if the macro has name `name`. */
4040
predicate hasName(string name) { this.getName() = name }

0 commit comments

Comments
 (0)