Skip to content

Commit

Permalink
Handle length modifiers in IsClassOrFunction
Browse files Browse the repository at this point in the history
This expands the handling introduced in commit 31e46a65f6 to include
the length modifiers 'short' and 'long' as mentioned back then. It
still doesn't handle the cases of multiple modifiers such as "unsigned
long long int" and "long int unsigned long" (being the same type).

Fixes root-project/root#13288
  • Loading branch information
hahnjo authored and jenkins committed Oct 13, 2023
1 parent 97485f5 commit 41e07b3
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Utils/SourceNormalization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ class MinimalPPLexer: public Lexer {
} else {
bool SeenModifier = false;
auto AnalyzeModifier = [&SeenModifier](llvm::StringRef Modifier) {
if (Modifier.equals("signed") || Modifier.equals("unsigned")) {
if (Modifier.equals("signed") || Modifier.equals("unsigned") ||
Modifier.equals("short") || Modifier.equals("long")) {
SeenModifier = true;
}
};
Expand Down
44 changes: 44 additions & 0 deletions test/Prompt/DontWrap.C
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,50 @@ suiFun(11, 12)
// CHECK: suiFun(11, 12)
// CHECK: (unsigned int) 13

long lFun(int a) {
printf("lFun(%d)\n", a);
return 15;
}

long int liFun(int a, int b) {
printf("liFun(%d, %d)\n", a, b);
return 17;
}

lFun(13)
// CHECK: lFun(13)
// CHECK: (long) 15

liFun(14, 15)
// CHECK: liFun(14, 15)
// CHECK: (long) 17


static long slFun(int a) {
printf("slFun(%d)\n", a);
return 19;
}

static long int sliFun(int a, int b) {
printf("sliFun(%d, %d)\n", a, b);
return 21;
}

slFun(16)
// CHECK: slFun(16)
// CHECK: (long) 19

sliFun(17, 18)
// CHECK: sliFun(17, 18)
// CHECK: (long) 21

long double ldFun(long double x) {
return x * x;
}

ldFun(2.0)
// CHECK: (long double) 4.0


class Test {
public:
Expand Down

0 comments on commit 41e07b3

Please sign in to comment.