summaryrefslogtreecommitdiff
path: root/clang/lib/Lex/DependencyDirectivesScanner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Lex/DependencyDirectivesScanner.cpp')
-rw-r--r--clang/lib/Lex/DependencyDirectivesScanner.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/clang/lib/Lex/DependencyDirectivesScanner.cpp b/clang/lib/Lex/DependencyDirectivesScanner.cpp
index fda54d314eef..0971daa1f366 100644
--- a/clang/lib/Lex/DependencyDirectivesScanner.cpp
+++ b/clang/lib/Lex/DependencyDirectivesScanner.cpp
@@ -62,17 +62,14 @@ struct DirectiveWithTokens {
struct Scanner {
Scanner(StringRef Input,
SmallVectorImpl<dependency_directives_scan::Token> &Tokens,
- DiagnosticsEngine *Diags, SourceLocation InputSourceLoc,
- const LangOptions &LangOpts)
+ DiagnosticsEngine *Diags, SourceLocation InputSourceLoc)
: Input(Input), Tokens(Tokens), Diags(Diags),
- InputSourceLoc(InputSourceLoc),
- LangOpts(getLangOptsForDepScanning(LangOpts)),
- TheLexer(InputSourceLoc, this->LangOpts, Input.begin(), Input.begin(),
+ InputSourceLoc(InputSourceLoc), LangOpts(getLangOptsForDepScanning()),
+ TheLexer(InputSourceLoc, LangOpts, Input.begin(), Input.begin(),
Input.end()) {}
- static LangOptions
- getLangOptsForDepScanning(const LangOptions &invocationLangOpts) {
- LangOptions LangOpts(invocationLangOpts);
+ static LangOptions getLangOptsForDepScanning() {
+ LangOptions LangOpts;
// Set the lexer to use 'tok::at' for '@', instead of 'tok::unknown'.
LangOpts.ObjC = true;
LangOpts.LineComment = true;
@@ -703,7 +700,7 @@ bool Scanner::lex_Pragma(const char *&First, const char *const End) {
SmallVector<dependency_directives_scan::Token> DiscardTokens;
const char *Begin = Buffer.c_str();
Scanner PragmaScanner{StringRef(Begin, Buffer.size()), DiscardTokens, Diags,
- InputSourceLoc, LangOptions()};
+ InputSourceLoc};
PragmaScanner.TheLexer.setParsingPreprocessorDirective(true);
if (PragmaScanner.lexPragma(Begin, Buffer.end()))
@@ -953,10 +950,9 @@ bool Scanner::scan(SmallVectorImpl<Directive> &Directives) {
bool clang::scanSourceForDependencyDirectives(
StringRef Input, SmallVectorImpl<dependency_directives_scan::Token> &Tokens,
- SmallVectorImpl<Directive> &Directives, const LangOptions &LangOpts,
- DiagnosticsEngine *Diags, SourceLocation InputSourceLoc) {
- return Scanner(Input, Tokens, Diags, InputSourceLoc, LangOpts)
- .scan(Directives);
+ SmallVectorImpl<Directive> &Directives, DiagnosticsEngine *Diags,
+ SourceLocation InputSourceLoc) {
+ return Scanner(Input, Tokens, Diags, InputSourceLoc).scan(Directives);
}
void clang::printDependencyDirectivesAsSource(