xref: /llvm-project/flang/include/flang/Common/Version.h (revision d9f0d9a1452ed78e943423c9fbbd63674625f7f5)
1 //===- Version.h - Flang Version Number ---------------------*- Fortran -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 ///
9 /// \file
10 /// Defines version macros and version-related utility functions
11 /// for Flang.
12 ///
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef FORTRAN_COMMON_VERSION_H
16 #define FORTRAN_COMMON_VERSION_H
17 
18 #include "flang/Version.inc"
19 #include "llvm/ADT/StringRef.h"
20 
21 namespace Fortran::common {
22 /// Retrieves the repository path (e.g., Git path) that
23 /// identifies the particular Flang branch, tag, or trunk from which this
24 /// Flang was built.
25 std::string getFlangRepositoryPath();
26 
27 /// Retrieves the repository path from which LLVM was built.
28 ///
29 /// This supports LLVM residing in a separate repository from flang.
30 std::string getLLVMRepositoryPath();
31 
32 /// Retrieves the repository revision number (or identifier) from which
33 /// this Flang was built.
34 std::string getFlangRevision();
35 
36 /// Retrieves the repository revision number (or identifier) from which
37 /// LLVM was built.
38 ///
39 /// If Flang and LLVM are in the same repository, this returns the same
40 /// string as getFlangRevision.
41 std::string getLLVMRevision();
42 
43 /// Retrieves the full repository version that is an amalgamation of
44 /// the information in getFlangRepositoryPath() and getFlangRevision().
45 std::string getFlangFullRepositoryVersion();
46 
47 /// Retrieves a string representing the complete flang version,
48 /// which includes the flang version number, the repository version,
49 /// and the vendor tag.
50 std::string getFlangFullVersion();
51 
52 /// Like getFlangFullVersion(), but with a custom tool name.
53 std::string getFlangToolFullVersion(llvm::StringRef ToolName);
54 } // namespace Fortran::common
55 
56 #endif // FORTRAN_COMMON_VERSION_H
57