aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorYaxun (Sam) Liu <yaxun.liu@amd.com>2019-12-06 12:29:31 -0500
committerYaxun (Sam) Liu <yaxun.liu@amd.com>2019-12-21 20:39:31 -0500
commit7376d9eb38914ff7b6b5f5901d32743f0ee76b5a (patch)
tree86f5f0bf5f053664f59ec66a2d762a67857d52b4 /clang/lib/Frontend/CompilerInvocation.cpp
parent5e32eb1c7a816a1902f6229f7a1f9da92678f451 (diff)
downloadllvm-7376d9eb38914ff7b6b5f5901d32743f0ee76b5a.zip
llvm-7376d9eb38914ff7b6b5f5901d32743f0ee76b5a.tar.gz
llvm-7376d9eb38914ff7b6b5f5901d32743f0ee76b5a.tar.bz2
[NFC] Separate getLastArgIntValue to Basic
getLastArgIntValue is a useful utility function to get command line argument as an integer. Currently it is in Frontend so that it can only be used by clang -cc1. Move it to basic so that it can also be used by clang driver. Differential Revision: https://reviews.llvm.org/D71080
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp27
1 files changed, 0 insertions, 27 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 93193ed..289c58e 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -3716,35 +3716,8 @@ std::string CompilerInvocation::getModuleHash() const {
return llvm::APInt(64, code).toString(36, /*Signed=*/false);
}
-template<typename IntTy>
-static IntTy getLastArgIntValueImpl(const ArgList &Args, OptSpecifier Id,
- IntTy Default,
- DiagnosticsEngine *Diags) {
- IntTy Res = Default;
- if (Arg *A = Args.getLastArg(Id)) {
- if (StringRef(A->getValue()).getAsInteger(10, Res)) {
- if (Diags)
- Diags->Report(diag::err_drv_invalid_int_value) << A->getAsString(Args)
- << A->getValue();
- }
- }
- return Res;
-}
-
namespace clang {
-// Declared in clang/Frontend/Utils.h.
-int getLastArgIntValue(const ArgList &Args, OptSpecifier Id, int Default,
- DiagnosticsEngine *Diags) {
- return getLastArgIntValueImpl<int>(Args, Id, Default, Diags);
-}
-
-uint64_t getLastArgUInt64Value(const ArgList &Args, OptSpecifier Id,
- uint64_t Default,
- DiagnosticsEngine *Diags) {
- return getLastArgIntValueImpl<uint64_t>(Args, Id, Default, Diags);
-}
-
IntrusiveRefCntPtr<llvm::vfs::FileSystem>
createVFSFromCompilerInvocation(const CompilerInvocation &CI,
DiagnosticsEngine &Diags) {