Skip to content

Commit f5b11a1

Browse files
apply clang-tidy suggestions
1 parent 18afba5 commit f5b11a1

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

lib/CppInterOp/CppInterOp.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "CppInterOp/CppInterOp.h"
1111

1212
#include "Compatibility.h"
13+
#include "CppInterOpInterpreter.h"
1314

1415
#include "clang/AST/Attrs.inc"
1516
#include "clang/AST/CXXInheritance.h"
@@ -60,7 +61,9 @@
6061
#include "llvm/Support/raw_ostream.h"
6162

6263
#include <algorithm>
64+
#include <atomic>
6365
#include <cassert>
66+
#include <chrono>
6467
#include <cstddef>
6568
#include <deque>
6669
#include <iterator>
@@ -71,6 +74,7 @@
7174
#include <sstream>
7275
#include <stack>
7376
#include <string>
77+
#include <thread>
7478
#include <unordered_map>
7579
#include <utility>
7680
#include <vector>
@@ -95,6 +99,7 @@ namespace Cpp {
9599
using namespace clang;
96100
using namespace llvm;
97101
using namespace std;
102+
using namespace std::chrono_literals;
98103

99104
#define NULLPTR (static_cast<void*>(nullptr))
100105

@@ -403,7 +408,7 @@ bool IsDebugOutputEnabled() {
403408
return llvm::DebugFlag;
404409
}
405410

406-
static void InstantiateFunctionDefinition(Decl* D, Interpreter& I) {
411+
static void InstantiateFunctionDefinition(Decl* D, compat::Interpreter& I) {
407412
if (auto* FD = llvm::dyn_cast_or_null<FunctionDecl>(D)) {
408413
compat::SynthesizingCodeRAII RAII(&I);
409414
I.getSema().InstantiateFunctionDefinition(SourceLocation(), FD,
@@ -940,7 +945,7 @@ static TCppIndex_t GetNumBases(compat::Interpreter& I,
940945
}
941946

942947
TCppIndex_t GetNumBases(TCppScope_t klass) {
943-
auto* D = (Decl*)klass;
948+
auto* D = static_cast<Decl*>(klass);
944949
if (auto* CXXRD = llvm::dyn_cast_or_null<CXXRecordDecl>(D)) {
945950
auto& IF = getInterpInfo(CXXRD);
946951
LOCK(IF);
@@ -2175,16 +2180,16 @@ static TCppType_t GetTypeFromScope(clang::Decl* D, compat::Interpreter& I) {
21752180

21762181
TCppType_t GetTypeFromScope(TCppScope_t klass) {
21772182
if (!klass)
2178-
return 0;
2183+
return nullptr;
21792184

2180-
auto* D = (Decl*)klass;
2185+
auto* D = static_cast<Decl*>(klass);
21812186
return GetTypeFromScope(D, *getInterpInfo(D));
21822187
}
21832188

21842189
// Internal functions that are not needed outside the library are
21852190
// encompassed in an anonymous namespace as follows.
21862191
namespace {
2187-
static std::atomic<unsigned long long> gWrapperSerial = 0LL;
2192+
std::atomic<unsigned long long> gWrapperSerial = 0LL;
21882193

21892194
enum EReferenceType { kNotReference, kLValueReference, kRValueReference };
21902195

0 commit comments

Comments
 (0)