Skip to content

Commit b6d053e

Browse files
committed
apply suggestions from git-clang-format
1 parent 748c3b5 commit b6d053e

23 files changed

+80
-78
lines changed

clang/include/clang/AST/Expr.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4819,13 +4819,12 @@ class PPEmbedExpr final : public Expr {
48194819
Expanded,
48204820
};
48214821

4822-
PPEmbedExpr(const ASTContext &Ctx, QualType ResultTy, StringLiteral* Filename, StringLiteral* BinaryData,
4823-
SourceLocation BLoc, SourceLocation RParenLoc,
4824-
DeclContext *Context);
4822+
PPEmbedExpr(const ASTContext &Ctx, QualType ResultTy, StringLiteral *Filename,
4823+
StringLiteral *BinaryData, SourceLocation BLoc,
4824+
SourceLocation RParenLoc, DeclContext *Context);
48254825

48264826
/// Build an empty call expression.
4827-
explicit PPEmbedExpr(EmptyShell Empty)
4828-
: Expr(SourceLocExprClass, Empty) {}
4827+
explicit PPEmbedExpr(EmptyShell Empty) : Expr(SourceLocExprClass, Empty) {}
48294828

48304829
/// If the PPEmbedExpr has been resolved return the subexpression
48314830
/// representing the resolved value. Otherwise return null.

clang/include/clang/Basic/FileManager.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,9 @@ class FileManager : public RefCountedBase<FileManager> {
282282
getBufferForFile(StringRef Filename, bool isVolatile = false,
283283
bool RequiresNullTerminator = true,
284284
std::optional<int64_t> MaybeLimit = std::nullopt) {
285-
return getBufferForFileImpl(Filename, /*FileSize=*/(MaybeLimit ? *MaybeLimit : -1), isVolatile,
286-
RequiresNullTerminator);
285+
return getBufferForFileImpl(Filename,
286+
/*FileSize=*/(MaybeLimit ? *MaybeLimit : -1),
287+
isVolatile, RequiresNullTerminator);
287288
}
288289

289290
private:

clang/include/clang/Frontend/PreprocessorOutputOptions.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ class PreprocessorOutputOptions {
2222
unsigned ShowMacroComments : 1; ///< Show comments, even in macros.
2323
unsigned ShowMacros : 1; ///< Print macro definitions.
2424
unsigned ShowIncludeDirectives : 1; ///< Print includes, imports etc. within preprocessed output.
25-
unsigned ShowEmbedDirectives : 1; ///< Print embeds, etc. within preprocessed output.
25+
unsigned ShowEmbedDirectives : 1; ///< Print embeds, etc. within preprocessed
26+
///< output.
2627
unsigned RewriteIncludes : 1; ///< Preprocess include directives only.
2728
unsigned RewriteImports : 1; ///< Include contents of transitively-imported modules.
2829
unsigned MinimizeWhitespace : 1; ///< Ignore whitespace from input.

clang/include/clang/Lex/PPEmbedParameters.h

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

16-
#include "clang/Lex/Token.h"
1716
#include "clang/Lex/PPDirectiveParameter.h"
17+
#include "clang/Lex/Token.h"
1818
#include "llvm/ADT/SmallVector.h"
1919

2020
namespace clang {
@@ -25,7 +25,8 @@ class PPEmbedParameterOffset : public PPDirectiveParameter {
2525
public:
2626
size_t Offset;
2727

28-
PPEmbedParameterOffset(size_t Offset, SourceLocation Start, SourceLocation End)
28+
PPEmbedParameterOffset(size_t Offset, SourceLocation Start,
29+
SourceLocation End)
2930
: Offset(Offset), PPDirectiveParameter(Start, End) {}
3031
};
3132

@@ -35,8 +36,7 @@ class PPEmbedParameterLimit : public PPDirectiveParameter {
3536
public:
3637
size_t Limit;
3738

38-
PPEmbedParameterLimit(size_t Limit, SourceLocation Start,
39-
SourceLocation End)
39+
PPEmbedParameterLimit(size_t Limit, SourceLocation Start, SourceLocation End)
4040
: Limit(Limit), PPDirectiveParameter(Start, End) {}
4141
};
4242

@@ -47,7 +47,7 @@ class PPEmbedParameterPrefix : public PPDirectiveParameter {
4747
SmallVector<Token, 2> Tokens;
4848

4949
PPEmbedParameterPrefix(SmallVector<Token, 2> Tokens, SourceLocation Start,
50-
SourceLocation End)
50+
SourceLocation End)
5151
: Tokens(std::move(Tokens)), PPDirectiveParameter(Start, End) {}
5252
};
5353

@@ -58,7 +58,7 @@ class PPEmbedParameterSuffix : public PPDirectiveParameter {
5858
SmallVector<Token, 2> Tokens;
5959

6060
PPEmbedParameterSuffix(SmallVector<Token, 2> Tokens, SourceLocation Start,
61-
SourceLocation End)
61+
SourceLocation End)
6262
: Tokens(std::move(Tokens)), PPDirectiveParameter(Start, End) {}
6363
};
6464

clang/include/clang/Lex/Preprocessor.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1816,7 +1816,8 @@ class Preprocessor {
18161816
/// Parses a simple integer literal to get its numeric value. Floating
18171817
/// point literals and user defined literals are rejected. Used primarily to
18181818
/// handle pragmas that accept integer arguments.
1819-
bool parseSimpleIntegerLiteral(Token &Tok, uint64_t &Value, bool WithLex = true);
1819+
bool parseSimpleIntegerLiteral(Token &Tok, uint64_t &Value,
1820+
bool WithLex = true);
18201821

18211822
/// Disables macro expansion everywhere except for preprocessor directives.
18221823
void SetMacroExpansionOnlyInDirectives() {

clang/include/clang/Sema/Sema.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6130,7 +6130,8 @@ class Sema final {
61306130
StringRef GetLocationName(PPEmbedExprContext Context) const;
61316131

61326132
bool DiagnosePPEmbedExpr(Expr *&E, SourceLocation ContextLocation,
6133-
PPEmbedExprContext Context, bool SingleAllowed = true);
6133+
PPEmbedExprContext Context,
6134+
bool SingleAllowed = true);
61346135

61356136
// Build a potentially resolved SourceLocExpr.
61366137
ExprResult BuildSourceLocExpr(SourceLocExpr::IdentKind Kind,

clang/lib/AST/Expr.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2330,19 +2330,18 @@ APValue SourceLocExpr::EvaluateInContext(const ASTContext &Ctx,
23302330
}
23312331

23322332
PPEmbedExpr::PPEmbedExpr(const ASTContext &Ctx, QualType ResultTy,
2333-
StringLiteral *Filename,
2334-
StringLiteral *BinaryData,
2335-
SourceLocation BLoc,
2336-
SourceLocation RParenLoc,
2337-
DeclContext *ParentContext)
2333+
StringLiteral *Filename, StringLiteral *BinaryData,
2334+
SourceLocation BLoc, SourceLocation RParenLoc,
2335+
DeclContext *ParentContext)
23382336
: Expr(PPEmbedExprClass, ResultTy, VK_PRValue, OK_Ordinary),
2339-
BuiltinLoc(BLoc), RParenLoc(RParenLoc), ParentContext(ParentContext), Filename(Filename), BinaryData(BinaryData) {
2337+
BuiltinLoc(BLoc), RParenLoc(RParenLoc), ParentContext(ParentContext),
2338+
Filename(Filename), BinaryData(BinaryData) {
23402339
setDependence(ExprDependence::None);
23412340
}
23422341

23432342
size_t PPEmbedExpr::getDataElementCount(ASTContext &Context) const {
2344-
return getDataStringLiteral()->getByteLength() /
2345-
(Context.getTypeSize(getType()) / Context.getTypeSize(Context.CharTy));
2343+
return getDataStringLiteral()->getByteLength() /
2344+
(Context.getTypeSize(getType()) / Context.getTypeSize(Context.CharTy));
23462345
}
23472346

23482347
InitListExpr::InitListExpr(const ASTContext &C, SourceLocation lbraceloc,

clang/lib/AST/ExprClassification.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ static Cl::Kinds ClassifyInternal(ASTContext &Ctx, const Expr *E) {
205205
return Cl::CL_PRValue;
206206

207207
case Expr::PPEmbedExprClass:
208-
// Nominally, this just goes through as a PRValue until we actually expand it and check it.
208+
// Nominally, this just goes through as a PRValue until we actually expand
209+
// it and check it.
209210
return Cl::CL_PRValue;
210211

211212
// Make HLSL this reference-like

clang/lib/AST/StmtProfile.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2284,9 +2284,7 @@ void StmtProfiler::VisitSourceLocExpr(const SourceLocExpr *E) {
22842284
VisitExpr(E);
22852285
}
22862286

2287-
void StmtProfiler::VisitPPEmbedExpr(const PPEmbedExpr *E) {
2288-
VisitExpr(E);
2289-
}
2287+
void StmtProfiler::VisitPPEmbedExpr(const PPEmbedExpr *E) { VisitExpr(E); }
22902288

22912289
void StmtProfiler::VisitRecoveryExpr(const RecoveryExpr *E) { VisitExpr(E); }
22922290

clang/lib/Basic/FileManager.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,6 @@ FileManager::getBufferForFile(FileEntryRef FE, bool isVolatile,
549549
if (MaybeLimit)
550550
FileSize = *MaybeLimit;
551551

552-
553552
// If there's a high enough chance that the file have changed since we
554553
// got its size, force a stat before opening it.
555554
if (isVolatile || Entry->isNamedPipe())

clang/lib/Basic/IdentifierTable.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,8 @@ tok::PPKeywordKind IdentifierInfo::getPPKeywordID() const {
422422
// collisions (if there were, the switch below would complain about duplicate
423423
// case values). Note that this depends on 'if' being null terminated.
424424

425-
#define HASH(LEN, FIRST, THIRD) \
426-
(LEN << 6) + (((FIRST-'a') - (THIRD-'a')) & 63)
425+
#define HASH(LEN, FIRST, THIRD) \
426+
(LEN << 6) + (((FIRST - 'a') - (THIRD - 'a')) & 63)
427427
#define CASE(LEN, FIRST, THIRD, NAME) \
428428
case HASH(LEN, FIRST, THIRD): \
429429
return memcmp(Name, #NAME, LEN) ? tok::pp_not_keyword : tok::pp_ ## NAME
@@ -438,7 +438,7 @@ tok::PPKeywordKind IdentifierInfo::getPPKeywordID() const {
438438
CASE( 4, 'e', 's', else);
439439
CASE( 4, 'l', 'n', line);
440440
CASE( 4, 's', 'c', sccs);
441-
CASE( 5, 'e', 'b', embed);
441+
CASE(5, 'e', 'b', embed);
442442
CASE( 5, 'e', 'd', endif);
443443
CASE( 5, 'e', 'r', error);
444444
CASE( 5, 'i', 'e', ident);

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1324,7 +1324,8 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA,
13241324

13251325
Args.AddAllArgs(CmdArgs,
13261326
{options::OPT_D, options::OPT_U, options::OPT_I_Group,
1327-
options::OPT_F, options::OPT_index_header_map, options::OPT_EmbedPath_Group});
1327+
options::OPT_F, options::OPT_index_header_map,
1328+
options::OPT_EmbedPath_Group});
13281329

13291330
// Add -Wp, and -Xpreprocessor if using the preprocessor.
13301331

clang/lib/Format/TokenAnnotator.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,8 +1399,7 @@ class AnnotatingParser {
13991399
if (Tok->isOneOf(Keywords.kw___has_include,
14001400
Keywords.kw___has_include_next)) {
14011401
parseHasInclude();
1402-
}
1403-
else if (Tok->is(Keywords.kw___has_embed)) {
1402+
} else if (Tok->is(Keywords.kw___has_embed)) {
14041403
parseHasEmbed();
14051404
}
14061405
if (Style.isCSharp() && Tok->is(Keywords.kw_where) && Tok->Next &&

clang/lib/Frontend/DependencyFile.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ struct DepCollectorPPCallbacks : public PPCallbacks {
6565
/*IsMissing=*/false);
6666
}
6767

68-
void EmbedDirective(SourceLocation HashLoc,
69-
StringRef FileName, bool IsAngled,
70-
CharSourceRange FilenameRange, CharSourceRange ParametersRange,
71-
OptionalFileEntryRef File, StringRef SearchPath,
72-
StringRef RelativePath) override {
68+
void EmbedDirective(SourceLocation HashLoc, StringRef FileName, bool IsAngled,
69+
CharSourceRange FilenameRange,
70+
CharSourceRange ParametersRange,
71+
OptionalFileEntryRef File, StringRef SearchPath,
72+
StringRef RelativePath) override {
7373
if (!File)
7474
DepCollector.maybeAddDependency(FileName,
7575
/*FromModule*/ false,
@@ -97,14 +97,13 @@ struct DepCollectorPPCallbacks : public PPCallbacks {
9797
}
9898

9999
void HasEmbed(SourceLocation Loc, StringRef SpelledFilename, bool IsAngled,
100-
OptionalFileEntryRef File) override {
100+
OptionalFileEntryRef File) override {
101101
if (!File)
102102
return;
103103
StringRef Filename =
104104
llvm::sys::path::remove_leading_dotslash(File->getName());
105105
DepCollector.maybeAddDependency(Filename,
106-
/*FromModule=*/false,
107-
false,
106+
/*FromModule=*/false, false,
108107
/*IsModuleFile=*/false,
109108
&PP.getFileManager(),
110109
/*IsMissing=*/false);

clang/lib/Frontend/PrintPreprocessedOutput.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,10 @@ class PrintPPOutputPPCallbacks : public PPCallbacks {
107107

108108
public:
109109
PrintPPOutputPPCallbacks(Preprocessor &pp, raw_ostream *os, bool lineMarkers,
110-
bool defines, bool DumpIncludeDirectives, bool DumpEmbedDirectives,
111-
bool UseLineDirectives, bool MinimizeWhitespace,
112-
bool DirectivesOnly, bool KeepSystemIncludes)
110+
bool defines, bool DumpIncludeDirectives,
111+
bool DumpEmbedDirectives, bool UseLineDirectives,
112+
bool MinimizeWhitespace, bool DirectivesOnly,
113+
bool KeepSystemIncludes)
113114
: PP(pp), SM(PP.getSourceManager()), ConcatInfo(PP), OS(os),
114115
DisableLineMarkers(lineMarkers), DumpDefines(defines),
115116
DumpIncludeDirectives(DumpIncludeDirectives),
@@ -414,7 +415,7 @@ void PrintPPOutputPPCallbacks::EmbedDirective(
414415
if (DumpEmbedDirectives) {
415416
MoveToLine(HashLoc, /*RequireStartOfLine=*/true);
416417
*OS << "#embed " << (IsAngled ? '<' : '"') << FileName
417-
<< (IsAngled ? '>' : '"') << " /* clang -E -dE */";
418+
<< (IsAngled ? '>' : '"') << " /* clang -E -dE */";
418419
setEmittedDirectiveOnThisLine();
419420
}
420421
}
@@ -1002,8 +1003,9 @@ void clang::DoPrintPreprocessedInput(Preprocessor &PP, raw_ostream *OS,
10021003

10031004
PrintPPOutputPPCallbacks *Callbacks = new PrintPPOutputPPCallbacks(
10041005
PP, OS, !Opts.ShowLineMarkers, Opts.ShowMacros,
1005-
Opts.ShowIncludeDirectives, Opts.ShowEmbedDirectives, Opts.UseLineDirectives,
1006-
Opts.MinimizeWhitespace, Opts.DirectivesOnly, Opts.KeepSystemIncludes);
1006+
Opts.ShowIncludeDirectives, Opts.ShowEmbedDirectives,
1007+
Opts.UseLineDirectives, Opts.MinimizeWhitespace, Opts.DirectivesOnly,
1008+
Opts.KeepSystemIncludes);
10071009

10081010
// Expand macros in pragmas with -fms-extensions. The assumption is that
10091011
// the majority of pragmas in such a file will be Microsoft pragmas.

clang/lib/Frontend/Rewrite/InclusionRewriter.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -463,27 +463,27 @@ void InclusionRewriter::Process(FileID FileId,
463463
// Add line marker to indicate we're returning from an included
464464
// file.
465465
LineInfoExtra = " 2";
466-
}
467-
// fix up lineinfo (since commented out directive changed line
468-
// numbers) for inclusions that were skipped due to header guards
469-
WriteLineInfo(FileName, Line, FileType, LineInfoExtra);
470-
break;
466+
}
467+
// fix up lineinfo (since commented out directive changed line
468+
// numbers) for inclusions that were skipped due to header guards
469+
WriteLineInfo(FileName, Line, FileType, LineInfoExtra);
470+
break;
471471
}
472472
case tok::pp_pragma: {
473473
StringRef Identifier = NextIdentifierName(RawLex, RawToken);
474474
if (Identifier == "clang" || Identifier == "GCC") {
475475
if (NextIdentifierName(RawLex, RawToken) == "system_header") {
476476
// keep the directive in, commented out
477477
CommentOutDirective(RawLex, HashToken, FromFile, LocalEOL,
478-
NextToWrite, Line);
478+
NextToWrite, Line);
479479
// update our own type
480480
FileType = SM.getFileCharacteristic(RawToken.getLocation());
481481
WriteLineInfo(FileName, Line, FileType);
482482
}
483483
} else if (Identifier == "once") {
484484
// keep the directive in, commented out
485485
CommentOutDirective(RawLex, HashToken, FromFile, LocalEOL,
486-
NextToWrite, Line);
486+
NextToWrite, Line);
487487
WriteLineInfo(FileName, Line, FileType);
488488
}
489489
break;
@@ -535,7 +535,7 @@ void InclusionRewriter::Process(FileID FileId,
535535
OutputContentUpTo(FromFile, NextToWrite,
536536
SM.getFileOffset(RawToken.getLocation()) +
537537
RawToken.getLength(),
538-
LocalEOL, Line, /*EnsureNewline=*/ true);
538+
LocalEOL, Line, /*EnsureNewline=*/true);
539539
WriteLineInfo(FileName, Line, FileType);
540540
RawLex.SetKeepWhitespaceMode(false);
541541
break;

clang/lib/Lex/PPMacroExpansion.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,7 +1321,8 @@ int Preprocessor::EvaluateHasEmbed(Token &Tok, IdentifierInfo *II) {
13211321
SourceLocation FilenameLoc = Tok.getLocation();
13221322
Token FilenameTok = Tok;
13231323

1324-
Preprocessor::LexEmbedParametersResult Params = this->LexEmbedParameters(Tok, true, false);
1324+
Preprocessor::LexEmbedParametersResult Params =
1325+
this->LexEmbedParameters(Tok, true, false);
13251326
if (!Params.Successful) {
13261327
if (Tok.isNot(tok::eod))
13271328
this->DiscardUntilEndOfDirective();
@@ -1339,7 +1340,6 @@ int Preprocessor::EvaluateHasEmbed(Token &Tok, IdentifierInfo *II) {
13391340
return VALUE__STDC_EMBED_NOT_FOUND__;
13401341
}
13411342

1342-
13431343
SmallString<128> FilenameBuffer;
13441344
SmallString<256> RelativePath;
13451345
StringRef Filename = this->getSpelling(FilenameTok, FilenameBuffer);
@@ -1351,11 +1351,10 @@ int Preprocessor::EvaluateHasEmbed(Token &Tok, IdentifierInfo *II) {
13511351
assert(!Filename.empty());
13521352
const FileEntry *LookupFromFile =
13531353
this->getCurrentFileLexer() ? this->getCurrentFileLexer()->getFileEntry()
1354-
: nullptr;
1354+
: nullptr;
13551355
OptionalFileEntryRef MaybeFileEntry =
13561356
this->LookupEmbedFile(FilenameLoc, Filename, isAngled, false,
1357-
LookupFromFile, nullptr,
1358-
&RelativePath);
1357+
LookupFromFile, nullptr, &RelativePath);
13591358
if (Callbacks) {
13601359
Callbacks->HasEmbed(LParenLoc, Filename, isAngled, MaybeFileEntry);
13611360
}

clang/lib/Lex/Preprocessor.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,7 +1411,8 @@ bool Preprocessor::FinishLexStringLiteral(Token &Result, std::string &String,
14111411
return true;
14121412
}
14131413

1414-
bool Preprocessor::parseSimpleIntegerLiteral(Token &Tok, uint64_t &Value, bool WithLex) {
1414+
bool Preprocessor::parseSimpleIntegerLiteral(Token &Tok, uint64_t &Value,
1415+
bool WithLex) {
14151416
assert(Tok.is(tok::numeric_constant));
14161417
SmallString<8> IntegerBuffer;
14171418
bool NumberInvalid = false;
@@ -1427,7 +1428,7 @@ bool Preprocessor::parseSimpleIntegerLiteral(Token &Tok, uint64_t &Value, bool W
14271428
if (Literal.GetIntegerValue(APVal))
14281429
return false;
14291430
if (WithLex)
1430-
Lex(Tok);
1431+
Lex(Tok);
14311432
Value = APVal.getLimitedValue();
14321433
return true;
14331434
}

clang/lib/Parse/ParseExpr.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,9 +1059,9 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
10591059
isVectorLiteral, NotPrimaryExpression);
10601060

10611061
case tok::identifier:
1062-
ParseIdentifier: { // primary-expression: identifier
1063-
// unqualified-id: identifier
1064-
// constant: enumeration-constant
1062+
ParseIdentifier: { // primary-expression: identifier
1063+
// unqualified-id: identifier
1064+
// constant: enumeration-constant
10651065
// Turn a potentially qualified name into a annot_typename or
10661066
// annot_cxxscope if it would be valid. This handles things like x::y, etc.
10671067
if (getLangOpts().CPlusPlus) {
@@ -2915,7 +2915,7 @@ ExprResult Parser::ParseBuiltinPrimaryExpression() {
29152915
}
29162916
const auto OnDecodeError = [&](const llvm::ErrorInfoBase &) {
29172917
Diag(Base64Str->getExprLoc(),
2918-
diag::err_builtin_pp_embed_invalid_argument)
2918+
diag::err_builtin_pp_embed_invalid_argument)
29192919
<< "expected a valid base64 encoded string";
29202920
};
29212921
llvm::Error Err = llvm::decodeBase64(Base64Str->getBytes(), BinaryData);

0 commit comments

Comments
 (0)