Skip to content

Commit 19e851e

Browse files
committed
unsigned long -> uint32_t; NFC
1 parent 0720771 commit 19e851e

File tree

6 files changed

+15
-18
lines changed

6 files changed

+15
-18
lines changed

clang/include/clang/Lex/Preprocessor.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ class Preprocessor {
226226
LangOptions::FPEvalMethodKind::FEM_UnsetOnCommandLine;
227227

228228
// Next __COUNTER__ value, starts at 0.
229-
unsigned long CounterValue = 0;
229+
uint32_t CounterValue = 0;
230230

231231
enum {
232232
/// Maximum depth of \#includes.
@@ -2421,8 +2421,8 @@ class Preprocessor {
24212421
bool SawDateOrTime() const {
24222422
return DATELoc != SourceLocation() || TIMELoc != SourceLocation();
24232423
}
2424-
unsigned long getCounterValue() const { return CounterValue; }
2425-
void setCounterValue(unsigned long V) { CounterValue = V; }
2424+
uint32_t getCounterValue() const { return CounterValue; }
2425+
void setCounterValue(uint32_t V) { CounterValue = V; }
24262426

24272427
LangOptions::FPEvalMethodKind getCurrentFPEvalMethod() const {
24282428
assert(CurrentFPEvalMethod != LangOptions::FEM_UnsetOnCommandLine &&

clang/include/clang/Lex/PreprocessorOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ class PreprocessorOptions {
200200

201201
/// The initial value for __COUNTER__; typically is zero but can be set via a
202202
/// -cc1 flag for testing purposes.
203-
unsigned long InitialCounterValue = 0;
203+
uint32_t InitialCounterValue = 0;
204204

205205
public:
206206
PreprocessorOptions() : PrecompiledPreambleBytes(0, false) {}

clang/include/clang/Serialization/ASTReader.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@ class ASTReaderListener {
220220
}
221221

222222
/// Receives __COUNTER__ value.
223-
virtual void ReadCounter(const serialization::ModuleFile &M,
224-
unsigned long Value) {}
223+
virtual void ReadCounter(const serialization::ModuleFile &M, uint32_t Value) {
224+
}
225225

226226
/// This is called for each AST file loaded.
227227
virtual void visitModuleFile(StringRef Filename,
@@ -312,8 +312,7 @@ class ChainedASTReaderListener : public ASTReaderListener {
312312
bool Complain,
313313
std::string &SuggestedPredefines) override;
314314

315-
void ReadCounter(const serialization::ModuleFile &M,
316-
unsigned long Value) override;
315+
void ReadCounter(const serialization::ModuleFile &M, uint32_t Value) override;
317316
bool needsInputFileVisitation() override;
318317
bool needsSystemInputFileVisitation() override;
319318
void visitModuleFile(StringRef Filename,
@@ -353,8 +352,7 @@ class PCHValidator : public ASTReaderListener {
353352
StringRef ModuleFilename,
354353
StringRef SpecificModuleCachePath,
355354
bool Complain) override;
356-
void ReadCounter(const serialization::ModuleFile &M,
357-
unsigned long Value) override;
355+
void ReadCounter(const serialization::ModuleFile &M, uint32_t Value) override;
358356
};
359357

360358
/// ASTReaderListenter implementation to set SuggestedPredefines of

clang/lib/Frontend/ASTUnit.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ class ASTInfoCollector : public ASTReaderListener {
520520
CodeGenOptions &CodeGenOpts;
521521
std::shared_ptr<TargetOptions> &TargetOpts;
522522
IntrusiveRefCntPtr<TargetInfo> &Target;
523-
unsigned long &Counter;
523+
uint32_t &Counter;
524524
bool InitializedLanguage = false;
525525
bool InitializedHeaderSearchPaths = false;
526526

@@ -529,8 +529,7 @@ class ASTInfoCollector : public ASTReaderListener {
529529
HeaderSearchOptions &HSOpts, PreprocessorOptions &PPOpts,
530530
LangOptions &LangOpt, CodeGenOptions &CodeGenOpts,
531531
std::shared_ptr<TargetOptions> &TargetOpts,
532-
IntrusiveRefCntPtr<TargetInfo> &Target,
533-
unsigned long &Counter)
532+
IntrusiveRefCntPtr<TargetInfo> &Target, uint32_t &Counter)
534533
: PP(PP), Context(Context), HSOpts(HSOpts), PPOpts(PPOpts),
535534
LangOpt(LangOpt), CodeGenOpts(CodeGenOpts), TargetOpts(TargetOpts),
536535
Target(Target), Counter(Counter) {}
@@ -628,7 +627,7 @@ class ASTInfoCollector : public ASTReaderListener {
628627
}
629628

630629
void ReadCounter(const serialization::ModuleFile &M,
631-
unsigned long Value) override {
630+
uint32_t Value) override {
632631
Counter = Value;
633632
}
634633

@@ -874,7 +873,7 @@ std::unique_ptr<ASTUnit> ASTUnit::LoadFromASTFile(
874873
/*isysroot=*/"",
875874
/*DisableValidationKind=*/disableValid, AllowASTWithCompilerErrors);
876875

877-
unsigned long Counter = 0;
876+
uint32_t Counter = 0;
878877
AST->Reader->setListener(std::make_unique<ASTInfoCollector>(
879878
*AST->PP, AST->Ctx.get(), *AST->HSOpts, *AST->PPOpts, *AST->LangOpts,
880879
*AST->CodeGenOpts, AST->TargetOpts, AST->Target, Counter));

clang/lib/Lex/PPMacroExpansion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1741,7 +1741,7 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
17411741
getLangOpts().C2y ? diag::warn_counter : diag::ext_counter);
17421742
// __COUNTER__ expands to a simple numeric value that must be less than
17431743
// 2147483647.
1744-
constexpr unsigned long MaxPosValue = std::numeric_limits<int32_t>::max();
1744+
constexpr uint32_t MaxPosValue = std::numeric_limits<int32_t>::max();
17451745
if (CounterValue > MaxPosValue) {
17461746
Diag(Tok.getLocation(), diag::err_counter_overflow);
17471747
// Retain the maximal value so we don't issue conversion-related

clang/lib/Serialization/ASTReader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ bool ChainedASTReaderListener::ReadPreprocessorOptions(
225225
}
226226

227227
void ChainedASTReaderListener::ReadCounter(const serialization::ModuleFile &M,
228-
unsigned long Value) {
228+
uint32_t Value) {
229229
First->ReadCounter(M, Value);
230230
Second->ReadCounter(M, Value);
231231
}
@@ -973,7 +973,7 @@ bool PCHValidator::ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts,
973973
PP.getPreprocessorOpts());
974974
}
975975

976-
void PCHValidator::ReadCounter(const ModuleFile &M, unsigned long Value) {
976+
void PCHValidator::ReadCounter(const ModuleFile &M, uint32_t Value) {
977977
PP.setCounterValue(Value);
978978
}
979979

0 commit comments

Comments
 (0)