Skip to content

Commit 0318746

Browse files
committed
[llvm] clang-format changes for AsmParser, BinaryFormat, Bitcode, and Bitstream libraries
1 parent 6f8866e commit 0318746

File tree

14 files changed

+89
-76
lines changed

14 files changed

+89
-76
lines changed

llvm/include/llvm/AsmParser/Parser.h

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
#ifndef LLVM_ASMPARSER_PARSER_H
1414
#define LLVM_ASMPARSER_PARSER_H
1515

16-
#include "llvm/Support/Compiler.h"
1716
#include "llvm/ADT/STLFunctionalExtras.h"
1817
#include "llvm/ADT/StringRef.h"
18+
#include "llvm/Support/Compiler.h"
1919
#include <memory>
2020
#include <optional>
2121

@@ -45,9 +45,9 @@ typedef llvm::function_ref<std::optional<std::string>(StringRef, StringRef)>
4545
/// \param Context Context in which to allocate globals info.
4646
/// \param Slots The optional slot mapping that will be initialized during
4747
/// parsing.
48-
LLVM_ABI std::unique_ptr<Module> parseAssemblyFile(StringRef Filename, SMDiagnostic &Err,
49-
LLVMContext &Context,
50-
SlotMapping *Slots = nullptr);
48+
LLVM_ABI std::unique_ptr<Module>
49+
parseAssemblyFile(StringRef Filename, SMDiagnostic &Err, LLVMContext &Context,
50+
SlotMapping *Slots = nullptr);
5151

5252
/// The function is a secondary interface to the LLVM Assembly Parser. It parses
5353
/// an ASCII string that (presumably) contains LLVM Assembly code. It returns a
@@ -60,10 +60,9 @@ LLVM_ABI std::unique_ptr<Module> parseAssemblyFile(StringRef Filename, SMDiagnos
6060
/// \param Context Context in which to allocate globals info.
6161
/// \param Slots The optional slot mapping that will be initialized during
6262
/// parsing.
63-
LLVM_ABI std::unique_ptr<Module> parseAssemblyString(StringRef AsmString,
64-
SMDiagnostic &Err,
65-
LLVMContext &Context,
66-
SlotMapping *Slots = nullptr);
63+
LLVM_ABI std::unique_ptr<Module>
64+
parseAssemblyString(StringRef AsmString, SMDiagnostic &Err,
65+
LLVMContext &Context, SlotMapping *Slots = nullptr);
6766

6867
/// Holds the Module and ModuleSummaryIndex returned by the interfaces
6968
/// that parse both.
@@ -141,10 +140,9 @@ LLVM_ABI std::unique_ptr<Module> parseAssembly(
141140
/// parsing.
142141
///
143142
/// parseAssemblyFileWithIndex is a wrapper around this function.
144-
LLVM_ABI ParsedModuleAndIndex parseAssemblyWithIndex(MemoryBufferRef F,
145-
SMDiagnostic &Err,
146-
LLVMContext &Context,
147-
SlotMapping *Slots = nullptr);
143+
LLVM_ABI ParsedModuleAndIndex
144+
parseAssemblyWithIndex(MemoryBufferRef F, SMDiagnostic &Err,
145+
LLVMContext &Context, SlotMapping *Slots = nullptr);
148146

149147
/// Parse LLVM Assembly for summary index from a MemoryBuffer.
150148
///
@@ -183,16 +181,17 @@ LLVM_ABI bool parseAssemblyInto(
183181
/// \param Slots The optional slot mapping that will restore the parsing state
184182
/// of the module.
185183
/// \return null on error.
186-
LLVM_ABI Constant *parseConstantValue(StringRef Asm, SMDiagnostic &Err, const Module &M,
187-
const SlotMapping *Slots = nullptr);
184+
LLVM_ABI Constant *parseConstantValue(StringRef Asm, SMDiagnostic &Err,
185+
const Module &M,
186+
const SlotMapping *Slots = nullptr);
188187

189188
/// Parse a type in the given string.
190189
///
191190
/// \param Slots The optional slot mapping that will restore the parsing state
192191
/// of the module.
193192
/// \return null on error.
194193
LLVM_ABI Type *parseType(StringRef Asm, SMDiagnostic &Err, const Module &M,
195-
const SlotMapping *Slots = nullptr);
194+
const SlotMapping *Slots = nullptr);
196195

197196
/// Parse a string \p Asm that starts with a type.
198197
/// \p Read[out] gives the number of characters that have been read to parse
@@ -201,13 +200,14 @@ LLVM_ABI Type *parseType(StringRef Asm, SMDiagnostic &Err, const Module &M,
201200
/// \param Slots The optional slot mapping that will restore the parsing state
202201
/// of the module.
203202
/// \return null on error.
204-
LLVM_ABI Type *parseTypeAtBeginning(StringRef Asm, unsigned &Read, SMDiagnostic &Err,
205-
const Module &M, const SlotMapping *Slots = nullptr);
206-
207-
LLVM_ABI DIExpression *parseDIExpressionBodyAtBeginning(StringRef Asm, unsigned &Read,
208-
SMDiagnostic &Err,
209-
const Module &M,
210-
const SlotMapping *Slots);
203+
LLVM_ABI Type *parseTypeAtBeginning(StringRef Asm, unsigned &Read,
204+
SMDiagnostic &Err, const Module &M,
205+
const SlotMapping *Slots = nullptr);
206+
207+
LLVM_ABI DIExpression *
208+
parseDIExpressionBodyAtBeginning(StringRef Asm, unsigned &Read,
209+
SMDiagnostic &Err, const Module &M,
210+
const SlotMapping *Slots);
211211

212212
} // End llvm namespace
213213

llvm/include/llvm/BinaryFormat/AMDGPUMetadataVerifier.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
#ifndef LLVM_BINARYFORMAT_AMDGPUMETADATAVERIFIER_H
1717
#define LLVM_BINARYFORMAT_AMDGPUMETADATAVERIFIER_H
1818

19-
#include "llvm/Support/Compiler.h"
2019
#include "llvm/ADT/STLFunctionalExtras.h"
2120
#include "llvm/ADT/StringRef.h"
2221
#include "llvm/BinaryFormat/MsgPackReader.h"
22+
#include "llvm/Support/Compiler.h"
2323

2424
#include <cstddef>
2525
#include <optional>

llvm/include/llvm/BinaryFormat/DXContainer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
#ifndef LLVM_BINARYFORMAT_DXCONTAINER_H
1414
#define LLVM_BINARYFORMAT_DXCONTAINER_H
1515

16-
#include "llvm/Support/Compiler.h"
1716
#include "llvm/ADT/StringRef.h"
17+
#include "llvm/Support/Compiler.h"
1818
#include "llvm/Support/Error.h"
1919
#include "llvm/Support/SwapByteOrder.h"
2020
#include "llvm/TargetParser/Triple.h"

llvm/include/llvm/BinaryFormat/Dwarf.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,7 @@ LLVM_ABI StringRef AttributeString(unsigned Attribute);
980980
LLVM_ABI StringRef FormEncodingString(unsigned Encoding);
981981
LLVM_ABI StringRef OperationEncodingString(unsigned Encoding);
982982
LLVM_ABI StringRef SubOperationEncodingString(unsigned OpEncoding,
983-
unsigned SubOpEncoding);
983+
unsigned SubOpEncoding);
984984
LLVM_ABI StringRef AttributeEncodingString(unsigned Encoding);
985985
LLVM_ABI StringRef DecimalSignString(unsigned Sign);
986986
LLVM_ABI StringRef EndianityString(unsigned Endian);
@@ -1026,7 +1026,7 @@ LLVM_ABI StringRef RLEString(unsigned RLE);
10261026
LLVM_ABI unsigned getTag(StringRef TagString);
10271027
LLVM_ABI unsigned getOperationEncoding(StringRef OperationEncodingString);
10281028
LLVM_ABI unsigned getSubOperationEncoding(unsigned OpEncoding,
1029-
StringRef SubOperationEncodingString);
1029+
StringRef SubOperationEncodingString);
10301030
LLVM_ABI unsigned getVirtuality(StringRef VirtualityString);
10311031
LLVM_ABI unsigned getEnumKind(StringRef EnumKindString);
10321032
LLVM_ABI unsigned getLanguage(StringRef LanguageString);
@@ -1137,11 +1137,12 @@ inline uint8_t getUnitLengthFieldByteSize(DwarfFormat Format) {
11371137
/// \returns std::optional<uint8_t> value with the fixed byte size or
11381138
/// std::nullopt if \p Form doesn't have a fixed byte size.
11391139
LLVM_ABI std::optional<uint8_t> getFixedFormByteSize(dwarf::Form Form,
1140-
FormParams Params);
1140+
FormParams Params);
11411141

11421142
/// Tells whether the specified form is defined in the specified version,
11431143
/// or is an extension if extensions are allowed.
1144-
LLVM_ABI bool isValidFormForVersion(Form F, unsigned Version, bool ExtensionsOk = true);
1144+
LLVM_ABI bool isValidFormForVersion(Form F, unsigned Version,
1145+
bool ExtensionsOk = true);
11451146

11461147
/// Returns the symbolic string representing Val when used as a value
11471148
/// for attribute Attr.

llvm/include/llvm/BinaryFormat/ELF.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
#ifndef LLVM_BINARYFORMAT_ELF_H
2020
#define LLVM_BINARYFORMAT_ELF_H
2121

22-
#include "llvm/Support/Compiler.h"
2322
#include "llvm/ADT/StringRef.h"
23+
#include "llvm/Support/Compiler.h"
2424
#include "llvm/TargetParser/Triple.h"
2525
#include <cstdint>
2626
#include <cstring>

llvm/include/llvm/BinaryFormat/MachO.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,8 +1706,9 @@ enum CPUSubTypeRISCV {
17061706

17071707
LLVM_ABI Expected<uint32_t> getCPUType(const Triple &T);
17081708
LLVM_ABI Expected<uint32_t> getCPUSubType(const Triple &T);
1709-
LLVM_ABI Expected<uint32_t> getCPUSubType(const Triple &T, unsigned PtrAuthABIVersion,
1710-
bool PtrAuthKernelABIVersion);
1709+
LLVM_ABI Expected<uint32_t> getCPUSubType(const Triple &T,
1710+
unsigned PtrAuthABIVersion,
1711+
bool PtrAuthKernelABIVersion);
17111712

17121713
struct x86_thread_state32_t {
17131714
uint32_t eax;

llvm/include/llvm/BinaryFormat/MsgPackDocument.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
#ifndef LLVM_BINARYFORMAT_MSGPACKDOCUMENT_H
1818
#define LLVM_BINARYFORMAT_MSGPACKDOCUMENT_H
1919

20-
#include "llvm/Support/Compiler.h"
2120
#include "llvm/BinaryFormat/MsgPackReader.h"
21+
#include "llvm/Support/Compiler.h"
2222
#include <map>
2323

2424
namespace llvm {

llvm/include/llvm/BinaryFormat/Wasm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
#ifndef LLVM_BINARYFORMAT_WASM_H
1515
#define LLVM_BINARYFORMAT_WASM_H
1616

17-
#include "llvm/Support/Compiler.h"
1817
#include "llvm/ADT/ArrayRef.h"
1918
#include "llvm/ADT/SmallVector.h"
2019
#include "llvm/ADT/StringRef.h"
20+
#include "llvm/Support/Compiler.h"
2121
#include <optional>
2222

2323
namespace llvm {

llvm/include/llvm/BinaryFormat/XCOFF.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -375,14 +375,14 @@ enum SymbolAuxType : uint8_t {
375375
LLVM_ABI StringRef getMappingClassString(XCOFF::StorageMappingClass SMC);
376376
LLVM_ABI StringRef getRelocationTypeString(XCOFF::RelocationType Type);
377377
LLVM_ABI StringRef getTCPUString(XCOFF::CFileCpuId TCPU);
378-
LLVM_ABI Expected<SmallString<32>> parseParmsType(uint32_t Value, unsigned FixedParmsNum,
379-
unsigned FloatingParmsNum);
380-
LLVM_ABI Expected<SmallString<32>> parseParmsTypeWithVecInfo(uint32_t Value,
381-
unsigned FixedParmsNum,
382-
unsigned FloatingParmsNum,
383-
unsigned VectorParmsNum);
378+
LLVM_ABI Expected<SmallString<32>> parseParmsType(uint32_t Value,
379+
unsigned FixedParmsNum,
380+
unsigned FloatingParmsNum);
381+
LLVM_ABI Expected<SmallString<32>>
382+
parseParmsTypeWithVecInfo(uint32_t Value, unsigned FixedParmsNum,
383+
unsigned FloatingParmsNum, unsigned VectorParmsNum);
384384
LLVM_ABI Expected<SmallString<32>> parseVectorParmsType(uint32_t Value,
385-
unsigned ParmsNum);
385+
unsigned ParmsNum);
386386

387387
struct TracebackTable {
388388
enum LanguageID : uint8_t {
@@ -491,7 +491,8 @@ enum ExtendedTBTableFlag : uint8_t {
491491
TB_LONGTBTABLE2 = 0x01 ///< Additional tbtable extension exists.
492492
};
493493

494-
LLVM_ABI StringRef getNameForTracebackTableLanguageId(TracebackTable::LanguageID LangId);
494+
LLVM_ABI StringRef
495+
getNameForTracebackTableLanguageId(TracebackTable::LanguageID LangId);
495496
LLVM_ABI SmallString<32> getExtendedTBTableFlagString(uint8_t Flag);
496497
LLVM_ABI XCOFF::CFileCpuId getCpuID(StringRef CPU);
497498

llvm/include/llvm/Bitcode/BitcodeAnalyzer.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
#ifndef LLVM_BITCODE_BITCODEANALYZER_H
1414
#define LLVM_BITCODE_BITCODEANALYZER_H
1515

16-
#include "llvm/Support/Compiler.h"
1716
#include "llvm/ADT/ArrayRef.h"
1817
#include "llvm/ADT/StringRef.h"
1918
#include "llvm/Bitstream/BitstreamReader.h"
19+
#include "llvm/Support/Compiler.h"
2020
#include "llvm/Support/Error.h"
2121
#include <map>
2222
#include <optional>
@@ -84,14 +84,15 @@ class BitcodeAnalyzer {
8484
std::map<unsigned, PerBlockIDStats> BlockIDStats;
8585

8686
public:
87-
LLVM_ABI BitcodeAnalyzer(StringRef Buffer,
87+
LLVM_ABI
88+
BitcodeAnalyzer(StringRef Buffer,
8889
std::optional<StringRef> BlockInfoBuffer = std::nullopt);
8990
/// Analyze the bitcode file.
9091
LLVM_ABI Error analyze(std::optional<BCDumpOptions> O = std::nullopt,
91-
std::optional<StringRef> CheckHash = std::nullopt);
92+
std::optional<StringRef> CheckHash = std::nullopt);
9293
/// Print stats about the bitcode file.
9394
LLVM_ABI void printStats(BCDumpOptions O,
94-
std::optional<StringRef> Filename = std::nullopt);
95+
std::optional<StringRef> Filename = std::nullopt);
9596

9697
private:
9798
/// Read a block, updating statistics, etc.

llvm/include/llvm/Bitcode/BitcodeReader.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
#ifndef LLVM_BITCODE_BITCODEREADER_H
1414
#define LLVM_BITCODE_BITCODEREADER_H
1515

16-
#include "llvm/Support/Compiler.h"
1716
#include "llvm/ADT/ArrayRef.h"
1817
#include "llvm/ADT/StringRef.h"
1918
#include "llvm/Bitstream/BitCodeEnums.h"
2019
#include "llvm/IR/GlobalValue.h"
20+
#include "llvm/Support/Compiler.h"
2121
#include "llvm/Support/Endian.h"
2222
#include "llvm/Support/Error.h"
2323
#include "llvm/Support/ErrorOr.h"
@@ -61,7 +61,8 @@ typedef std::function<void(Metadata **, unsigned, GetTypeByIDTy,
6161
// ErrorOr/std::error_code for compatibility with legacy clients. FIXME:
6262
// Remove these functions once no longer needed by the C and libLTO APIs.
6363

64-
LLVM_ABI std::error_code errorToErrorCodeAndEmitErrors(LLVMContext &Ctx, Error Err);
64+
LLVM_ABI std::error_code errorToErrorCodeAndEmitErrors(LLVMContext &Ctx,
65+
Error Err);
6566

6667
template <typename T>
6768
ErrorOr<T> expectedToErrorOrAndEmitErrors(LLVMContext &Ctx, Expected<T> Val) {
@@ -172,7 +173,8 @@ struct ParserCallbacks {
172173
/// symbol table should prefer to use irsymtab::read instead of this function
173174
/// because it creates a reader for the irsymtab and handles upgrading bitcode
174175
/// files without a symbol table or with an old symbol table.
175-
LLVM_ABI Expected<BitcodeFileContents> getBitcodeFileContents(MemoryBufferRef Buffer);
176+
LLVM_ABI Expected<BitcodeFileContents>
177+
getBitcodeFileContents(MemoryBufferRef Buffer);
176178

177179
/// Returns a list of modules in the specified bitcode buffer.
178180
LLVM_ABI Expected<std::vector<BitcodeModule>>
@@ -204,12 +206,14 @@ struct ParserCallbacks {
204206

205207
/// Return true if \p Buffer contains a bitcode file with ObjC code (category
206208
/// or class) in it.
207-
LLVM_ABI Expected<bool> isBitcodeContainingObjCCategory(MemoryBufferRef Buffer);
209+
LLVM_ABI Expected<bool>
210+
isBitcodeContainingObjCCategory(MemoryBufferRef Buffer);
208211

209212
/// Read the header of the specified bitcode buffer and extract just the
210213
/// producer string information. If successful, this returns a string. On
211214
/// error, this returns "".
212-
LLVM_ABI Expected<std::string> getBitcodeProducerString(MemoryBufferRef Buffer);
215+
LLVM_ABI Expected<std::string>
216+
getBitcodeProducerString(MemoryBufferRef Buffer);
213217

214218
/// Read the specified bitcode file, returning the module.
215219
LLVM_ABI Expected<std::unique_ptr<Module>>
@@ -225,7 +229,7 @@ struct ParserCallbacks {
225229

226230
/// Parse the specified bitcode buffer and merge the index into CombinedIndex.
227231
LLVM_ABI Error readModuleSummaryIndex(MemoryBufferRef Buffer,
228-
ModuleSummaryIndex &CombinedIndex);
232+
ModuleSummaryIndex &CombinedIndex);
229233

230234
/// Parse the module summary index out of an IR file and return the module
231235
/// summary index object if found, or an empty summary if not. If Path refers

0 commit comments

Comments
 (0)