Skip to content

Commit 437889a

Browse files
author
Xiang Li
committed
Code cleanup.
1 parent 4a67a3b commit 437889a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

clang/lib/CodeGen/CGHLSLRuntime.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ namespace {
2626
void addDxilValVersion(StringRef ValVersionStr, llvm::Module &M) {
2727
// The validation of ValVersionStr is done at HLSLToolChain::TranslateArgs.
2828
// Assume ValVersionStr is legal here.
29-
auto VerPair = ValVersionStr.split(".");
30-
llvm::APInt APMajor, APMinor;
31-
32-
if (VerPair.first.getAsInteger(0, APMajor) ||
33-
VerPair.second.getAsInteger(0, APMinor)) {
29+
VersionTuple Version;
30+
if (Version.tryParse(ValVersionStr) || Version.getBuild() ||
31+
Version.getSubminor() || !Version.getMinor()) {
3432
return;
3533
}
36-
uint64_t Major = APMajor.getLimitedValue();
37-
uint64_t Minor = APMinor.getLimitedValue();
34+
35+
uint64_t Major = Version.getMajor();
36+
uint64_t Minor = Version.getMinor().getValue();
37+
3838
auto &Ctx = M.getContext();
3939
IRBuilder<> B(M.getContext());
4040
MDNode *Val = MDNode::get(Ctx, {ConstantAsMetadata::get(B.getInt32(Major)),

0 commit comments

Comments
 (0)