summaryrefslogtreecommitdiff
path: root/clang/lib/AST/Interp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2020-07-26 19:36:28 +0000
committerDimitry Andric <dim@FreeBSD.org>2020-07-26 19:36:28 +0000
commitcfca06d7963fa0909f90483b42a6d7d194d01e08 (patch)
tree209fb2a2d68f8f277793fc8df46c753d31bc853b /clang/lib/AST/Interp
parent706b4fc47bbc608932d3b491ae19a3b9cde9497b (diff)
Notes
Diffstat (limited to 'clang/lib/AST/Interp')
-rw-r--r--clang/lib/AST/Interp/Boolean.h7
-rw-r--r--clang/lib/AST/Interp/ByteCodeExprGen.h1
-rw-r--r--clang/lib/AST/Interp/Context.cpp1
-rw-r--r--clang/lib/AST/Interp/Disasm.cpp1
-rw-r--r--clang/lib/AST/Interp/Integral.h33
-rw-r--r--clang/lib/AST/Interp/Interp.cpp2
-rw-r--r--clang/lib/AST/Interp/Interp.h2
-rw-r--r--clang/lib/AST/Interp/InterpBlock.cpp (renamed from clang/lib/AST/Interp/Block.cpp)2
-rw-r--r--clang/lib/AST/Interp/InterpBlock.h (renamed from clang/lib/AST/Interp/Block.h)2
-rw-r--r--clang/lib/AST/Interp/InterpFrame.h8
-rw-r--r--clang/lib/AST/Interp/Pointer.cpp2
-rw-r--r--clang/lib/AST/Interp/Pointer.h4
-rw-r--r--clang/lib/AST/Interp/Source.h4
13 files changed, 35 insertions, 34 deletions
diff --git a/clang/lib/AST/Interp/Boolean.h b/clang/lib/AST/Interp/Boolean.h
index 3e6c8b5da9f0..2baa717311bc 100644
--- a/clang/lib/AST/Interp/Boolean.h
+++ b/clang/lib/AST/Interp/Boolean.h
@@ -85,14 +85,13 @@ class Boolean {
static Boolean max(unsigned NumBits) { return Boolean(true); }
template <typename T>
- static typename std::enable_if<std::is_integral<T>::value, Boolean>::type
- from(T Value) {
+ static std::enable_if_t<std::is_integral<T>::value, Boolean> from(T Value) {
return Boolean(Value != 0);
}
template <unsigned SrcBits, bool SrcSign>
- static typename std::enable_if<SrcBits != 0, Boolean>::type from(
- Integral<SrcBits, SrcSign> Value) {
+ static std::enable_if_t<SrcBits != 0, Boolean>
+ from(Integral<SrcBits, SrcSign> Value) {
return Boolean(!Value.isZero());
}
diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.h b/clang/lib/AST/Interp/ByteCodeExprGen.h
index 1d0e34fc991f..716f28551e58 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.h
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.h
@@ -21,6 +21,7 @@
#include "clang/AST/Decl.h"
#include "clang/AST/Expr.h"
#include "clang/AST/StmtVisitor.h"
+#include "clang/Basic/TargetInfo.h"
#include "llvm/ADT/Optional.h"
namespace clang {
diff --git a/clang/lib/AST/Interp/Context.cpp b/clang/lib/AST/Interp/Context.cpp
index e7f9ba0f010a..3bfcdfcd4c58 100644
--- a/clang/lib/AST/Interp/Context.cpp
+++ b/clang/lib/AST/Interp/Context.cpp
@@ -17,6 +17,7 @@
#include "PrimType.h"
#include "Program.h"
#include "clang/AST/Expr.h"
+#include "clang/Basic/TargetInfo.h"
using namespace clang;
using namespace clang::interp;
diff --git a/clang/lib/AST/Interp/Disasm.cpp b/clang/lib/AST/Interp/Disasm.cpp
index e77a825eb1f2..293fdd4b3256 100644
--- a/clang/lib/AST/Interp/Disasm.cpp
+++ b/clang/lib/AST/Interp/Disasm.cpp
@@ -16,6 +16,7 @@
#include "Program.h"
#include "clang/AST/DeclCXX.h"
#include "llvm/Support/Compiler.h"
+#include "llvm/Support/Format.h"
using namespace clang;
using namespace clang::interp;
diff --git a/clang/lib/AST/Interp/Integral.h b/clang/lib/AST/Interp/Integral.h
index 7cc788070de8..46cd611ee389 100644
--- a/clang/lib/AST/Interp/Integral.h
+++ b/clang/lib/AST/Interp/Integral.h
@@ -156,13 +156,12 @@ public:
}
template <typename T>
- static typename std::enable_if<std::is_integral<T>::value, Integral>::type
- from(T Value) {
+ static std::enable_if_t<std::is_integral<T>::value, Integral> from(T Value) {
return Integral(Value);
}
template <unsigned SrcBits, bool SrcSign>
- static typename std::enable_if<SrcBits != 0, Integral>::type
+ static std::enable_if_t<SrcBits != 0, Integral>
from(Integral<SrcBits, SrcSign> Value) {
return Integral(Value.V);
}
@@ -206,52 +205,52 @@ public:
private:
template <typename T>
- static typename std::enable_if<std::is_signed<T>::value, bool>::type
- CheckAddUB(T A, T B, T &R) {
+ static std::enable_if_t<std::is_signed<T>::value, bool> CheckAddUB(T A, T B,
+ T &R) {
return llvm::AddOverflow<T>(A, B, R);
}
template <typename T>
- static typename std::enable_if<std::is_unsigned<T>::value, bool>::type
- CheckAddUB(T A, T B, T &R) {
+ static std::enable_if_t<std::is_unsigned<T>::value, bool> CheckAddUB(T A, T B,
+ T &R) {
R = A + B;
return false;
}
template <typename T>
- static typename std::enable_if<std::is_signed<T>::value, bool>::type
- CheckSubUB(T A, T B, T &R) {
+ static std::enable_if_t<std::is_signed<T>::value, bool> CheckSubUB(T A, T B,
+ T &R) {
return llvm::SubOverflow<T>(A, B, R);
}
template <typename T>
- static typename std::enable_if<std::is_unsigned<T>::value, bool>::type
- CheckSubUB(T A, T B, T &R) {
+ static std::enable_if_t<std::is_unsigned<T>::value, bool> CheckSubUB(T A, T B,
+ T &R) {
R = A - B;
return false;
}
template <typename T>
- static typename std::enable_if<std::is_signed<T>::value, bool>::type
- CheckMulUB(T A, T B, T &R) {
+ static std::enable_if_t<std::is_signed<T>::value, bool> CheckMulUB(T A, T B,
+ T &R) {
return llvm::MulOverflow<T>(A, B, R);
}
template <typename T>
- static typename std::enable_if<std::is_unsigned<T>::value, bool>::type
- CheckMulUB(T A, T B, T &R) {
+ static std::enable_if_t<std::is_unsigned<T>::value, bool> CheckMulUB(T A, T B,
+ T &R) {
R = A * B;
return false;
}
template <typename T, T Min, T Max>
- static typename std::enable_if<std::is_signed<T>::value, bool>::type
+ static std::enable_if_t<std::is_signed<T>::value, bool>
CheckRange(int64_t V) {
return Min <= V && V <= Max;
}
template <typename T, T Min, T Max>
- static typename std::enable_if<std::is_unsigned<T>::value, bool>::type
+ static std::enable_if_t<std::is_unsigned<T>::value, bool>
CheckRange(int64_t V) {
return V >= 0 && static_cast<uint64_t>(V) <= Max;
}
diff --git a/clang/lib/AST/Interp/Interp.cpp b/clang/lib/AST/Interp/Interp.cpp
index 1a8109cedf76..cec3f6d6160e 100644
--- a/clang/lib/AST/Interp/Interp.cpp
+++ b/clang/lib/AST/Interp/Interp.cpp
@@ -334,7 +334,7 @@ bool CheckCallable(InterpState &S, CodePtr OpPC, Function *F) {
const SourceLocation &Loc = S.Current->getLocation(OpPC);
if (F->isVirtual()) {
- if (!S.getLangOpts().CPlusPlus2a) {
+ if (!S.getLangOpts().CPlusPlus20) {
S.CCEDiag(Loc, diag::note_constexpr_virtual_call);
return false;
}
diff --git a/clang/lib/AST/Interp/Interp.h b/clang/lib/AST/Interp/Interp.h
index c12caa639da7..a63c5a871ba3 100644
--- a/clang/lib/AST/Interp/Interp.h
+++ b/clang/lib/AST/Interp/Interp.h
@@ -869,7 +869,7 @@ inline bool ShiftRight(InterpState &S, CodePtr OpPC, const T &V, unsigned RHS) {
template <PrimType TL, PrimType TR, typename T = typename PrimConv<TL>::T>
inline bool ShiftLeft(InterpState &S, CodePtr OpPC, const T &V, unsigned RHS) {
- if (V.isSigned() && !S.getLangOpts().CPlusPlus2a) {
+ if (V.isSigned() && !S.getLangOpts().CPlusPlus20) {
// C++11 [expr.shift]p2: A signed left shift must have a non-negative
// operand, and must not overflow the corresponding unsigned type.
// C++2a [expr.shift]p2: E1 << E2 is the unique value congruent to
diff --git a/clang/lib/AST/Interp/Block.cpp b/clang/lib/AST/Interp/InterpBlock.cpp
index 5fc93eb39f4e..ed6e8910194d 100644
--- a/clang/lib/AST/Interp/Block.cpp
+++ b/clang/lib/AST/Interp/InterpBlock.cpp
@@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//
-#include "Block.h"
+#include "InterpBlock.h"
#include "Pointer.h"
using namespace clang;
diff --git a/clang/lib/AST/Interp/Block.h b/clang/lib/AST/Interp/InterpBlock.h
index 97fb9a3ca096..0ccdef221c83 100644
--- a/clang/lib/AST/Interp/Block.h
+++ b/clang/lib/AST/Interp/InterpBlock.h
@@ -1,4 +1,4 @@
-//===--- Block.h - Allocated blocks for the interpreter ---------*- C++ -*-===//
+//===-- InterpBlock.h - Allocated blocks for the interpreter -*- C++ ----*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/clang/lib/AST/Interp/InterpFrame.h b/clang/lib/AST/Interp/InterpFrame.h
index b8391b0bcf92..304e2ad66537 100644
--- a/clang/lib/AST/Interp/InterpFrame.h
+++ b/clang/lib/AST/Interp/InterpFrame.h
@@ -45,16 +45,16 @@ public:
void popArgs();
/// Describes the frame with arguments for diagnostic purposes.
- void describe(llvm::raw_ostream &OS);
+ void describe(llvm::raw_ostream &OS) override;
/// Returns the parent frame object.
- Frame *getCaller() const;
+ Frame *getCaller() const override;
/// Returns the location of the call to the frame.
- SourceLocation getCallLocation() const;
+ SourceLocation getCallLocation() const override;
/// Returns the caller.
- const FunctionDecl *getCallee() const;
+ const FunctionDecl *getCallee() const override;
/// Returns the current function.
Function *getFunction() const { return Func; }
diff --git a/clang/lib/AST/Interp/Pointer.cpp b/clang/lib/AST/Interp/Pointer.cpp
index 1a10723aaca5..ef2638e2a36b 100644
--- a/clang/lib/AST/Interp/Pointer.cpp
+++ b/clang/lib/AST/Interp/Pointer.cpp
@@ -7,8 +7,8 @@
//===----------------------------------------------------------------------===//
#include "Pointer.h"
-#include "Block.h"
#include "Function.h"
+#include "InterpBlock.h"
#include "PrimType.h"
using namespace clang;
diff --git a/clang/lib/AST/Interp/Pointer.h b/clang/lib/AST/Interp/Pointer.h
index b8fa98e24faa..f2f6e0e76018 100644
--- a/clang/lib/AST/Interp/Pointer.h
+++ b/clang/lib/AST/Interp/Pointer.h
@@ -13,12 +13,12 @@
#ifndef LLVM_CLANG_AST_INTERP_POINTER_H
#define LLVM_CLANG_AST_INTERP_POINTER_H
-#include "Block.h"
#include "Descriptor.h"
+#include "InterpBlock.h"
+#include "clang/AST/ComparisonCategories.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/Expr.h"
-#include "clang/AST/ComparisonCategories.h"
#include "llvm/ADT/PointerUnion.h"
#include "llvm/Support/raw_ostream.h"
diff --git a/clang/lib/AST/Interp/Source.h b/clang/lib/AST/Interp/Source.h
index e591c3399d7c..19c652b7331a 100644
--- a/clang/lib/AST/Interp/Source.h
+++ b/clang/lib/AST/Interp/Source.h
@@ -56,14 +56,14 @@ private:
/// Helper to decode a value or a pointer.
template <typename T>
- static typename std::enable_if<!std::is_pointer<T>::value, T>::type
+ static std::enable_if_t<!std::is_pointer<T>::value, T>
ReadHelper(const char *Ptr) {
using namespace llvm::support;
return endian::read<T, endianness::native, 1>(Ptr);
}
template <typename T>
- static typename std::enable_if<std::is_pointer<T>::value, T>::type
+ static std::enable_if_t<std::is_pointer<T>::value, T>
ReadHelper(const char *Ptr) {
using namespace llvm::support;
auto Punned = endian::read<uintptr_t, endianness::native, 1>(Ptr);