diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/DeclBase.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Basic/CMakeLists.txt | 1 | ||||
-rw-r--r-- | clang/lib/Basic/ObjCRuntime.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Basic/VersionTuple.cpp | 100 | ||||
-rw-r--r-- | clang/lib/Driver/ToolChain.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Driver/ToolChains/Cuda.h | 4 | ||||
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 2 |
9 files changed, 10 insertions, 111 deletions
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp index 3db886957c0..7b7febdc410 100644 --- a/clang/lib/AST/DeclBase.cpp +++ b/clang/lib/AST/DeclBase.cpp @@ -34,7 +34,6 @@ #include "clang/Basic/PartialDiagnostic.h" #include "clang/Basic/SourceLocation.h" #include "clang/Basic/TargetInfo.h" -#include "clang/Basic/VersionTuple.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/PointerIntPair.h" #include "llvm/ADT/SmallVector.h" @@ -42,6 +41,7 @@ #include "llvm/Support/Casting.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MathExtras.h" +#include "llvm/Support/VersionTuple.h" #include "llvm/Support/raw_ostream.h" #include <algorithm> #include <cassert> diff --git a/clang/lib/Basic/CMakeLists.txt b/clang/lib/Basic/CMakeLists.txt index 2e394916b52..e82f451dea1 100644 --- a/clang/lib/Basic/CMakeLists.txt +++ b/clang/lib/Basic/CMakeLists.txt @@ -93,7 +93,6 @@ add_clang_library(clangBasic Targets/XCore.cpp TokenKinds.cpp Version.cpp - VersionTuple.cpp VirtualFileSystem.cpp Warnings.cpp XRayInstr.cpp diff --git a/clang/lib/Basic/ObjCRuntime.cpp b/clang/lib/Basic/ObjCRuntime.cpp index 15f38d1156a..8fa0afbe03f 100644 --- a/clang/lib/Basic/ObjCRuntime.cpp +++ b/clang/lib/Basic/ObjCRuntime.cpp @@ -13,8 +13,8 @@ //===----------------------------------------------------------------------===// #include "clang/Basic/ObjCRuntime.h" -#include "clang/Basic/VersionTuple.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Support/VersionTuple.h" #include "llvm/Support/raw_ostream.h" #include <cstddef> #include <string> diff --git a/clang/lib/Basic/VersionTuple.cpp b/clang/lib/Basic/VersionTuple.cpp deleted file mode 100644 index 7a9176a808e..00000000000 --- a/clang/lib/Basic/VersionTuple.cpp +++ /dev/null @@ -1,100 +0,0 @@ -//===- VersionTuple.cpp - Version Number Handling ---------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements the VersionTuple class, which represents a version in -// the form major[.minor[.subminor]]. -// -//===----------------------------------------------------------------------===// -#include "clang/Basic/VersionTuple.h" -#include "llvm/Support/raw_ostream.h" - -using namespace clang; - -std::string VersionTuple::getAsString() const { - std::string Result; - { - llvm::raw_string_ostream Out(Result); - Out << *this; - } - return Result; -} - -raw_ostream& clang::operator<<(raw_ostream &Out, - const VersionTuple &V) { - Out << V.getMajor(); - if (Optional<unsigned> Minor = V.getMinor()) - Out << '.' << *Minor; - if (Optional<unsigned> Subminor = V.getSubminor()) - Out << '.' << *Subminor; - if (Optional<unsigned> Build = V.getBuild()) - Out << '.' << *Build; - return Out; -} - -static bool parseInt(StringRef &input, unsigned &value) { - assert(value == 0); - if (input.empty()) return true; - - char next = input[0]; - input = input.substr(1); - if (next < '0' || next > '9') return true; - value = (unsigned) (next - '0'); - - while (!input.empty()) { - next = input[0]; - if (next < '0' || next > '9') return false; - input = input.substr(1); - value = value * 10 + (unsigned) (next - '0'); - } - - return false; -} - -bool VersionTuple::tryParse(StringRef input) { - unsigned major = 0, minor = 0, micro = 0, build = 0; - - // Parse the major version, [0-9]+ - if (parseInt(input, major)) return true; - - if (input.empty()) { - *this = VersionTuple(major); - return false; - } - - // If we're not done, parse the minor version, \.[0-9]+ - if (input[0] != '.') return true; - input = input.substr(1); - if (parseInt(input, minor)) return true; - - if (input.empty()) { - *this = VersionTuple(major, minor); - return false; - } - - // If we're not done, parse the micro version, \.[0-9]+ - if (input[0] != '.') return true; - input = input.substr(1); - if (parseInt(input, micro)) return true; - - if (input.empty()) { - *this = VersionTuple(major, minor, micro); - return false; - } - - // If we're not done, parse the micro version, \.[0-9]+ - if (input[0] != '.') return true; - input = input.substr(1); - if (parseInt(input, build)) return true; - - // If we have characters left over, it's an error. - if (!input.empty()) return true; - - *this = VersionTuple(major, minor, micro, build); - return false; -} diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp index a3799ac6138..a56a0380541 100644 --- a/clang/lib/Driver/ToolChain.cpp +++ b/clang/lib/Driver/ToolChain.cpp @@ -13,7 +13,6 @@ #include "ToolChains/Clang.h" #include "clang/Basic/ObjCRuntime.h" #include "clang/Basic/Sanitizers.h" -#include "clang/Basic/VersionTuple.h" #include "clang/Basic/VirtualFileSystem.h" #include "clang/Config/config.h" #include "clang/Driver/Action.h" @@ -29,6 +28,7 @@ #include "llvm/ADT/Triple.h" #include "llvm/ADT/Twine.h" #include "llvm/Config/llvm-config.h" +#include "llvm/MC/MCTargetOptions.h" #include "llvm/Option/Arg.h" #include "llvm/Option/ArgList.h" #include "llvm/Option/OptTable.h" @@ -36,9 +36,9 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" -#include "llvm/MC/MCTargetOptions.h" #include "llvm/Support/TargetParser.h" #include "llvm/Support/TargetRegistry.h" +#include "llvm/Support/VersionTuple.h" #include <cassert> #include <cstddef> #include <cstring> diff --git a/clang/lib/Driver/ToolChains/Cuda.h b/clang/lib/Driver/ToolChains/Cuda.h index 057eb220c2a..99d5a4a628c 100644 --- a/clang/lib/Driver/ToolChains/Cuda.h +++ b/clang/lib/Driver/ToolChains/Cuda.h @@ -11,14 +11,14 @@ #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_CUDA_H #include "clang/Basic/Cuda.h" -#include "clang/Basic/VersionTuple.h" #include "clang/Driver/Action.h" #include "clang/Driver/Multilib.h" -#include "clang/Driver/ToolChain.h" #include "clang/Driver/Tool.h" +#include "clang/Driver/ToolChain.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallSet.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/VersionTuple.h" #include <set> #include <vector> diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index b10155da96c..a959cdb2347 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -23,7 +23,6 @@ #include "clang/Basic/SourceLocation.h" #include "clang/Basic/TargetOptions.h" #include "clang/Basic/Version.h" -#include "clang/Basic/VersionTuple.h" #include "clang/Basic/VirtualFileSystem.h" #include "clang/Basic/Visibility.h" #include "clang/Basic/XRayInstr.h" @@ -76,6 +75,7 @@ #include "llvm/Support/Path.h" #include "llvm/Support/Process.h" #include "llvm/Support/Regex.h" +#include "llvm/Support/VersionTuple.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetOptions.h" #include <algorithm> diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 4dd79720270..89dff67446a 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -61,7 +61,6 @@ #include "clang/Basic/TargetOptions.h" #include "clang/Basic/TokenKinds.h" #include "clang/Basic/Version.h" -#include "clang/Basic/VersionTuple.h" #include "clang/Frontend/PCHContainerOperations.h" #include "clang/Lex/HeaderSearch.h" #include "clang/Lex/HeaderSearchOptions.h" @@ -104,8 +103,8 @@ #include "llvm/ADT/iterator_range.h" #include "llvm/Bitcode/BitstreamReader.h" #include "llvm/Support/Casting.h" -#include "llvm/Support/Compression.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/Compression.h" #include "llvm/Support/DJB.h" #include "llvm/Support/Endian.h" #include "llvm/Support/Error.h" @@ -115,6 +114,7 @@ #include "llvm/Support/Path.h" #include "llvm/Support/SaveAndRestore.h" #include "llvm/Support/Timer.h" +#include "llvm/Support/VersionTuple.h" #include "llvm/Support/raw_ostream.h" #include <algorithm> #include <cassert> diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index c1f552e536a..1e3a098b09e 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -53,7 +53,6 @@ #include "clang/Basic/TargetInfo.h" #include "clang/Basic/TargetOptions.h" #include "clang/Basic/Version.h" -#include "clang/Basic/VersionTuple.h" #include "clang/Lex/HeaderSearch.h" #include "clang/Lex/HeaderSearchOptions.h" #include "clang/Lex/MacroInfo.h" @@ -97,6 +96,7 @@ #include "llvm/Support/OnDiskHashTable.h" #include "llvm/Support/Path.h" #include "llvm/Support/SHA1.h" +#include "llvm/Support/VersionTuple.h" #include "llvm/Support/raw_ostream.h" #include <algorithm> #include <cassert> |