Skip to content

Commit 8a486f7

Browse files
committed
Set the minimum possible version to 0 instead of 1
The default value of the Version parameter in get<Lang><Enum>Name() was 0, which was not in the range [1, 0x7fffffff]. To fix this, it was either to change the default value to 1, or to lower the minimum version to 0. The latter seemed like a better choice, since 0 is a natural choice for a lower bound on version numbers.
1 parent a40f63f commit 8a486f7

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

llvm/include/llvm/Frontend/Directive/DirectiveBase.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ class DirectiveLanguage {
5252
}
5353

5454
// Base class for versioned entities.
55-
class Versioned<int min = 1, int max = 0x7FFFFFFF> {
55+
class Versioned<int min = 0, int max = 0x7FFFFFFF> {
5656
// Mininum version number where this object is valid.
5757
int minVersion = min;
5858

5959
// Maximum version number where this object is valid.
6060
int maxVersion = max;
6161
}
6262

63-
class Spelling<string s, int min = 1, int max = 0x7FFFFFFF>
63+
class Spelling<string s, int min = 0, int max = 0x7FFFFFFF>
6464
: Versioned<min, max> {
6565
string spelling = s;
6666
}

llvm/include/llvm/Frontend/Directive/Spelling.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ namespace llvm::directive {
1717

1818
struct VersionRange {
1919
static constexpr int MaxValue = std::numeric_limits<int>::max();
20-
int Min = 1;
20+
// The default "Version" value in get<Lang><Enum>Name() is 0, include that
21+
// in the maximum range.
22+
int Min = 0;
2123
int Max = MaxValue;
2224
};
2325

0 commit comments

Comments
 (0)