Skip to content

Commit 975293f

Browse files
committed
[Bitcode] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 312760
1 parent 0e8c4bb commit 975293f

File tree

11 files changed

+311
-157
lines changed

11 files changed

+311
-157
lines changed

llvm/include/llvm/Bitcode/BitcodeReader.h

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- llvm/Bitcode/BitcodeReader.h - Bitcode reader ----*- C++ -*-===//
1+
//===- llvm/Bitcode/BitcodeReader.h - Bitcode reader ------------*- C++ -*-===//
22
//
33
// The LLVM Compiler Infrastructure
44
//
@@ -14,18 +14,23 @@
1414
#ifndef LLVM_BITCODE_BITCODEREADER_H
1515
#define LLVM_BITCODE_BITCODEREADER_H
1616

17+
#include "llvm/ADT/ArrayRef.h"
18+
#include "llvm/ADT/StringRef.h"
1719
#include "llvm/Bitcode/BitCodes.h"
18-
#include "llvm/IR/DiagnosticInfo.h"
1920
#include "llvm/IR/ModuleSummaryIndex.h"
2021
#include "llvm/Support/Endian.h"
2122
#include "llvm/Support/Error.h"
2223
#include "llvm/Support/ErrorOr.h"
2324
#include "llvm/Support/MemoryBuffer.h"
25+
#include <cstdint>
2426
#include <memory>
25-
27+
#include <string>
28+
#include <system_error>
29+
#include <vector>
2630
namespace llvm {
27-
class LLVMContext;
28-
class Module;
31+
32+
class LLVMContext;
33+
class Module;
2934

3035
// These functions are for converting Expected/Error values to
3136
// ErrorOr/std::error_code for compatibility with legacy clients. FIXME:
@@ -81,6 +86,7 @@ namespace llvm {
8186
StringRef getBuffer() const {
8287
return StringRef((const char *)Buffer.begin(), Buffer.size());
8388
}
89+
8490
StringRef getStrtab() const { return Strtab; }
8591

8692
StringRef getModuleIdentifier() const { return ModuleIdentifier; }
@@ -182,7 +188,6 @@ namespace llvm {
182188

183189
/// isBitcodeWrapper - Return true if the given bytes are the magic bytes
184190
/// for an LLVM IR bitcode wrapper.
185-
///
186191
inline bool isBitcodeWrapper(const unsigned char *BufPtr,
187192
const unsigned char *BufEnd) {
188193
// See if you can find the hidden message in the magic bytes :-).
@@ -196,7 +201,6 @@ namespace llvm {
196201

197202
/// isRawBitcode - Return true if the given bytes are the magic bytes for
198203
/// raw LLVM IR bitcode (without a wrapper).
199-
///
200204
inline bool isRawBitcode(const unsigned char *BufPtr,
201205
const unsigned char *BufEnd) {
202206
// These bytes sort of have a hidden message, but it's not in
@@ -210,7 +214,6 @@ namespace llvm {
210214

211215
/// isBitcode - Return true if the given bytes are the magic bytes for
212216
/// LLVM IR bitcode, either with or without a wrapper.
213-
///
214217
inline bool isBitcode(const unsigned char *BufPtr,
215218
const unsigned char *BufEnd) {
216219
return isBitcodeWrapper(BufPtr, BufEnd) ||
@@ -258,10 +261,12 @@ namespace llvm {
258261
return std::error_code(static_cast<int>(E), BitcodeErrorCategory());
259262
}
260263

261-
} // End llvm namespace
264+
} // end namespace llvm
262265

263266
namespace std {
267+
264268
template <> struct is_error_code_enum<llvm::BitcodeError> : std::true_type {};
265-
}
266269

267-
#endif
270+
} // end namespace std
271+
272+
#endif // LLVM_BITCODE_BITCODEREADER_H

llvm/include/llvm/Bitcode/BitcodeWriter.h

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- llvm/Bitcode/BitcodeWriter.h - Bitcode writers ----*- C++ -*-===//
1+
//===- llvm/Bitcode/BitcodeWriter.h - Bitcode writers -----------*- C++ -*-===//
22
//
33
// The LLVM Compiler Infrastructure
44
//
@@ -14,14 +14,20 @@
1414
#ifndef LLVM_BITCODE_BITCODEWRITER_H
1515
#define LLVM_BITCODE_BITCODEWRITER_H
1616

17+
#include "llvm/ADT/StringRef.h"
1718
#include "llvm/IR/ModuleSummaryIndex.h"
1819
#include "llvm/MC/StringTableBuilder.h"
20+
#include "llvm/Support/Allocator.h"
21+
#include <map>
22+
#include <memory>
1923
#include <string>
24+
#include <vector>
2025

2126
namespace llvm {
22-
class BitstreamWriter;
23-
class Module;
24-
class raw_ostream;
27+
28+
class BitstreamWriter;
29+
class Module;
30+
class raw_ostream;
2531

2632
class BitcodeWriter {
2733
SmallVectorImpl<char> &Buffer;
@@ -39,7 +45,7 @@ namespace llvm {
3945

4046
std::vector<Module *> Mods;
4147

42-
public:
48+
public:
4349
/// Create a BitcodeWriter that writes to Buffer.
4450
BitcodeWriter(SmallVectorImpl<char> &Buffer);
4551

@@ -145,6 +151,7 @@ namespace llvm {
145151
void WriteIndexToFile(const ModuleSummaryIndex &Index, raw_ostream &Out,
146152
const std::map<std::string, GVSummaryMapTy>
147153
*ModuleToSummariesForIndex = nullptr);
148-
} // End llvm namespace
149154

150-
#endif
155+
} // end namespace llvm
156+
157+
#endif // LLVM_BITCODE_BITCODEWRITER_H

llvm/include/llvm/Bitcode/BitstreamReader.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class BitstreamBlockInfo {
4343
unsigned BlockID;
4444
std::vector<std::shared_ptr<BitCodeAbbrev>> Abbrevs;
4545
std::string Name;
46-
std::vector<std::pair<unsigned, std::string> > RecordNames;
46+
std::vector<std::pair<unsigned, std::string>> RecordNames;
4747
};
4848

4949
private:
@@ -88,7 +88,7 @@ class SimpleBitstreamCursor {
8888
/// follow the word size of the host machine for efficiency. We use word_t in
8989
/// places that are aware of this to make it perfectly explicit what is going
9090
/// on.
91-
typedef size_t word_t;
91+
using word_t = size_t;
9292

9393
private:
9494
word_t CurWord = 0;

0 commit comments

Comments
 (0)