Skip to content

Commit f111cf9

Browse files
committed
[clang][cli] Specify correct integer width for -fbuild-session-timestamp
This fixes an issue where large integer values were rejected as invalid. Reviewed By: arphaman Differential Revision: https://reviews.llvm.org/D94101
1 parent 28a326e commit f111cf9

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1767,7 +1767,7 @@ def fmodules_search_all : Flag <["-"], "fmodules-search-all">, Group<f_Group>,
17671767
def fbuild_session_timestamp : Joined<["-"], "fbuild-session-timestamp=">,
17681768
Group<i_Group>, Flags<[CC1Option]>, MetaVarName<"<time since Epoch in seconds>">,
17691769
HelpText<"Time when the current build session started">,
1770-
MarshallingInfoStringInt<"HeaderSearchOpts->BuildSessionTimestamp">;
1770+
MarshallingInfoStringInt<"HeaderSearchOpts->BuildSessionTimestamp", "0", "uint64_t">;
17711771
def fbuild_session_file : Joined<["-"], "fbuild-session-file=">,
17721772
Group<i_Group>, MetaVarName<"<file>">,
17731773
HelpText<"Use the last modification time of <file> as the build session timestamp">;

clang/unittests/Frontend/CompilerInvocationTest.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,18 @@ TEST_F(CommandLineTest, CanGenerateCC1COmmandLineSeparateEnumDefault) {
368368
ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("pic"))));
369369
}
370370

371+
// Wide integer option.
372+
373+
TEST_F(CommandLineTest, WideIntegerHighValue) {
374+
const char *Args[] = {"-fbuild-session-timestamp=1609827494445723662"};
375+
376+
CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
377+
378+
ASSERT_FALSE(Diags->hasErrorOccurred());
379+
ASSERT_EQ(Invocation.getHeaderSearchOpts().BuildSessionTimestamp,
380+
1609827494445723662ull);
381+
}
382+
371383
// Tree of boolean options that can be (directly or transitively) implied by
372384
// their parent:
373385
//

0 commit comments

Comments
 (0)