[PATCH] D94101: [clang][cli] Specify correct integer width for -fbuild-session-timestamp
Jan Svoboda via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 5 10:47:05 PST 2021
jansvoboda11 created this revision.
jansvoboda11 added a reviewer: arphaman.
Herald added a subscriber: dang.
jansvoboda11 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
This fixes an issue where large integer values were rejected as invalid.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D94101
Files:
clang/include/clang/Driver/Options.td
clang/unittests/Frontend/CompilerInvocationTest.cpp
Index: clang/unittests/Frontend/CompilerInvocationTest.cpp
===================================================================
--- clang/unittests/Frontend/CompilerInvocationTest.cpp
+++ clang/unittests/Frontend/CompilerInvocationTest.cpp
@@ -368,6 +368,18 @@
ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("pic"))));
}
+// Wide integer option.
+
+TEST_F(CommandLineTest, WideIntegerHighValue) {
+ const char *Args[] = {"-fbuild-session-timestamp=1609827494445723662"};
+
+ CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);
+
+ ASSERT_FALSE(Diags->hasErrorOccurred());
+ ASSERT_EQ(Invocation.getHeaderSearchOpts().BuildSessionTimestamp,
+ 1609827494445723662ull);
+}
+
// Tree of boolean options that can be (directly or transitively) implied by
// their parent:
//
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -1767,7 +1767,7 @@
def fbuild_session_timestamp : Joined<["-"], "fbuild-session-timestamp=">,
Group<i_Group>, Flags<[CC1Option]>, MetaVarName<"<time since Epoch in seconds>">,
HelpText<"Time when the current build session started">,
- MarshallingInfoStringInt<"HeaderSearchOpts->BuildSessionTimestamp">;
+ MarshallingInfoStringInt<"HeaderSearchOpts->BuildSessionTimestamp", "0", "uint64_t">;
def fbuild_session_file : Joined<["-"], "fbuild-session-file=">,
Group<i_Group>, MetaVarName<"<file>">,
HelpText<"Use the last modification time of <file> as the build session timestamp">;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94101.314662.patch
Type: text/x-patch
Size: 1598 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210105/e347a059/attachment.bin>
More information about the cfe-commits
mailing list