Skip to content

Commit 277ab85

Browse files
committed
[clang] Make PreprocessorOptions reference const
1 parent 115a77d commit 277ab85

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

clang/include/clang/Lex/Preprocessor.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class Preprocessor {
140140
friend class VariadicMacroScopeGuard;
141141

142142
llvm::unique_function<void(const clang::Token &)> OnToken;
143-
std::shared_ptr<PreprocessorOptions> PPOpts;
143+
std::shared_ptr<const PreprocessorOptions> PPOpts;
144144
DiagnosticsEngine *Diags;
145145
const LangOptions &LangOpts;
146146
const TargetInfo *Target = nullptr;
@@ -1165,7 +1165,7 @@ class Preprocessor {
11651165
void updateOutOfDateIdentifier(const IdentifierInfo &II) const;
11661166

11671167
public:
1168-
Preprocessor(std::shared_ptr<PreprocessorOptions> PPOpts,
1168+
Preprocessor(std::shared_ptr<const PreprocessorOptions> PPOpts,
11691169
DiagnosticsEngine &diags, const LangOptions &LangOpts,
11701170
SourceManager &SM, HeaderSearch &Headers,
11711171
ModuleLoader &TheModuleLoader,
@@ -1197,7 +1197,7 @@ class Preprocessor {
11971197

11981198
/// Retrieve the preprocessor options used to initialize this
11991199
/// preprocessor.
1200-
PreprocessorOptions &getPreprocessorOpts() const { return *PPOpts; }
1200+
const PreprocessorOptions &getPreprocessorOpts() const { return *PPOpts; }
12011201

12021202
DiagnosticsEngine &getDiagnostics() const { return *Diags; }
12031203
void setDiagnostics(DiagnosticsEngine &D) { Diags = &D; }

clang/lib/Lex/Preprocessor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ LLVM_INSTANTIATE_REGISTRY(PragmaHandlerRegistry)
7777

7878
ExternalPreprocessorSource::~ExternalPreprocessorSource() = default;
7979

80-
Preprocessor::Preprocessor(std::shared_ptr<PreprocessorOptions> PPOpts,
80+
Preprocessor::Preprocessor(std::shared_ptr<const PreprocessorOptions> PPOpts,
8181
DiagnosticsEngine &diags, const LangOptions &opts,
8282
SourceManager &SM, HeaderSearch &Headers,
8383
ModuleLoader &TheModuleLoader,

0 commit comments

Comments
 (0)