forked from OSchip/llvm-project
[Frontend] StringRefize and fix bad indentation.
NFC intended. llvm-svn: 270991
This commit is contained in:
parent
7da9b82e02
commit
2787e459c8
|
@ -49,31 +49,31 @@ public:
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PrintHeaderInfo(raw_ostream *OutputFile, const char* Filename,
|
static void PrintHeaderInfo(raw_ostream *OutputFile, StringRef Filename,
|
||||||
bool ShowDepth, unsigned CurrentIncludeDepth,
|
bool ShowDepth, unsigned CurrentIncludeDepth,
|
||||||
bool MSStyle) {
|
bool MSStyle) {
|
||||||
// Write to a temporary string to avoid unnecessary flushing on errs().
|
// Write to a temporary string to avoid unnecessary flushing on errs().
|
||||||
SmallString<512> Pathname(Filename);
|
SmallString<512> Pathname(Filename);
|
||||||
|
if (!MSStyle)
|
||||||
|
Lexer::Stringify(Pathname);
|
||||||
|
|
||||||
|
SmallString<256> Msg;
|
||||||
|
if (MSStyle)
|
||||||
|
Msg += "Note: including file:";
|
||||||
|
|
||||||
|
if (ShowDepth) {
|
||||||
|
// The main source file is at depth 1, so skip one dot.
|
||||||
|
for (unsigned i = 1; i != CurrentIncludeDepth; ++i)
|
||||||
|
Msg += MSStyle ? ' ' : '.';
|
||||||
|
|
||||||
if (!MSStyle)
|
if (!MSStyle)
|
||||||
Lexer::Stringify(Pathname);
|
Msg += ' ';
|
||||||
|
}
|
||||||
|
Msg += Pathname;
|
||||||
|
Msg += '\n';
|
||||||
|
|
||||||
SmallString<256> Msg;
|
*OutputFile << Msg;
|
||||||
if (MSStyle)
|
OutputFile->flush();
|
||||||
Msg += "Note: including file:";
|
|
||||||
|
|
||||||
if (ShowDepth) {
|
|
||||||
// The main source file is at depth 1, so skip one dot.
|
|
||||||
for (unsigned i = 1; i != CurrentIncludeDepth; ++i)
|
|
||||||
Msg += MSStyle ? ' ' : '.';
|
|
||||||
|
|
||||||
if (!MSStyle)
|
|
||||||
Msg += ' ';
|
|
||||||
}
|
|
||||||
Msg += Pathname;
|
|
||||||
Msg += '\n';
|
|
||||||
|
|
||||||
OutputFile->write(Msg.data(), Msg.size());
|
|
||||||
OutputFile->flush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void clang::AttachHeaderIncludeGen(Preprocessor &PP,
|
void clang::AttachHeaderIncludeGen(Preprocessor &PP,
|
||||||
|
@ -104,8 +104,8 @@ void clang::AttachHeaderIncludeGen(Preprocessor &PP,
|
||||||
// generation of Make / Ninja file dependencies for implicit includes, such
|
// generation of Make / Ninja file dependencies for implicit includes, such
|
||||||
// as sanitizer blacklists. It's only important for cl.exe compatibility,
|
// as sanitizer blacklists. It's only important for cl.exe compatibility,
|
||||||
// the GNU way to generate rules is -M / -MM / -MD / -MMD.
|
// the GNU way to generate rules is -M / -MM / -MD / -MMD.
|
||||||
for (auto Header : DepOpts.ExtraDeps)
|
for (const auto &Header : DepOpts.ExtraDeps)
|
||||||
PrintHeaderInfo(OutputFile, Header.c_str(), ShowDepth, 2, MSStyle);
|
PrintHeaderInfo(OutputFile, Header, ShowDepth, 2, MSStyle);
|
||||||
PP.addPPCallbacks(llvm::make_unique<HeaderIncludesCallback>(
|
PP.addPPCallbacks(llvm::make_unique<HeaderIncludesCallback>(
|
||||||
&PP, ShowAllHeaders, OutputFile, DepOpts, OwnsOutputFile, ShowDepth,
|
&PP, ShowAllHeaders, OutputFile, DepOpts, OwnsOutputFile, ShowDepth,
|
||||||
MSStyle));
|
MSStyle));
|
||||||
|
@ -132,7 +132,7 @@ void HeaderIncludesCallback::FileChanged(SourceLocation Loc,
|
||||||
// place where we drop back to a nesting depth of 1.
|
// place where we drop back to a nesting depth of 1.
|
||||||
if (CurrentIncludeDepth == 1 && !HasProcessedPredefines) {
|
if (CurrentIncludeDepth == 1 && !HasProcessedPredefines) {
|
||||||
if (!DepOpts.ShowIncludesPretendHeader.empty()) {
|
if (!DepOpts.ShowIncludesPretendHeader.empty()) {
|
||||||
PrintHeaderInfo(OutputFile, DepOpts.ShowIncludesPretendHeader.c_str(),
|
PrintHeaderInfo(OutputFile, DepOpts.ShowIncludesPretendHeader,
|
||||||
ShowDepth, 2, MSStyle);
|
ShowDepth, 2, MSStyle);
|
||||||
}
|
}
|
||||||
HasProcessedPredefines = true;
|
HasProcessedPredefines = true;
|
||||||
|
|
Loading…
Reference in New Issue