Skip to content

Commit ed1156b

Browse files
author
ematejska
authored
Merge pull request #5664 from ematejska/master
Adding getSwiftRevision().
2 parents 9875f3b + 1fa8dd4 commit ed1156b

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

include/swift/Basic/Version.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ std::pair<unsigned, unsigned> getSwiftNumericVersion();
149149
std::string getSwiftFullVersion(Version effectiveLanguageVersion =
150150
Version::getCurrentLanguageVersion());
151151

152+
/// Retrieves the repository revision number (or identifer) from which
153+
/// this Swift was built.
154+
std::string getSwiftRevision();
155+
152156
} // end namespace version
153157
} // end namespace swift
154158

lib/Basic/Version.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,14 @@ std::string getSwiftFullVersion(Version effectiveVersion) {
406406
return OS.str();
407407
}
408408

409+
std::string getSwiftRevision() {
410+
#ifdef SWIFT_REVISION
411+
return SWIFT_REVISION;
412+
#else
413+
return "";
414+
#endif
415+
}
416+
409417
} // end namespace version
410418
} // end namespace swift
411419

0 commit comments

Comments
 (0)