aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/HeaderIncludeGen.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2016-05-27 12:52:19 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2016-05-27 12:52:19 +0000
commit2787e459c824d8fe2c8e821f46413131c32916a2 (patch)
tree4b20fdbbe44f8c0cce50ea9691a4cf3bee543ec8 /clang/lib/Frontend/HeaderIncludeGen.cpp
parent7da9b82e0287704468ca79f3357d1723dbf5ce00 (diff)
downloadllvm-2787e459c824d8fe2c8e821f46413131c32916a2.zip
llvm-2787e459c824d8fe2c8e821f46413131c32916a2.tar.gz
llvm-2787e459c824d8fe2c8e821f46413131c32916a2.tar.bz2
[Frontend] StringRefize and fix bad indentation.
NFC intended. llvm-svn: 270991
Diffstat (limited to 'clang/lib/Frontend/HeaderIncludeGen.cpp')
-rw-r--r--clang/lib/Frontend/HeaderIncludeGen.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/clang/lib/Frontend/HeaderIncludeGen.cpp b/clang/lib/Frontend/HeaderIncludeGen.cpp
index 818365c..5bff4ec 100644
--- a/clang/lib/Frontend/HeaderIncludeGen.cpp
+++ b/clang/lib/Frontend/HeaderIncludeGen.cpp
@@ -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 MSStyle) {
- // Write to a temporary string to avoid unnecessary flushing on errs().
- SmallString<512> Pathname(Filename);
- if (!MSStyle)
- Lexer::Stringify(Pathname);
+ // Write to a temporary string to avoid unnecessary flushing on errs().
+ SmallString<512> Pathname(Filename);
+ if (!MSStyle)
+ Lexer::Stringify(Pathname);
- SmallString<256> Msg;
- if (MSStyle)
- Msg += "Note: including file:";
+ 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 (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';
+ if (!MSStyle)
+ Msg += ' ';
+ }
+ Msg += Pathname;
+ Msg += '\n';
- OutputFile->write(Msg.data(), Msg.size());
- OutputFile->flush();
+ *OutputFile << Msg;
+ OutputFile->flush();
}
void clang::AttachHeaderIncludeGen(Preprocessor &PP,
@@ -104,8 +104,8 @@ void clang::AttachHeaderIncludeGen(Preprocessor &PP,
// generation of Make / Ninja file dependencies for implicit includes, such
// as sanitizer blacklists. It's only important for cl.exe compatibility,
// the GNU way to generate rules is -M / -MM / -MD / -MMD.
- for (auto Header : DepOpts.ExtraDeps)
- PrintHeaderInfo(OutputFile, Header.c_str(), ShowDepth, 2, MSStyle);
+ for (const auto &Header : DepOpts.ExtraDeps)
+ PrintHeaderInfo(OutputFile, Header, ShowDepth, 2, MSStyle);
PP.addPPCallbacks(llvm::make_unique<HeaderIncludesCallback>(
&PP, ShowAllHeaders, OutputFile, DepOpts, OwnsOutputFile, ShowDepth,
MSStyle));
@@ -132,7 +132,7 @@ void HeaderIncludesCallback::FileChanged(SourceLocation Loc,
// place where we drop back to a nesting depth of 1.
if (CurrentIncludeDepth == 1 && !HasProcessedPredefines) {
if (!DepOpts.ShowIncludesPretendHeader.empty()) {
- PrintHeaderInfo(OutputFile, DepOpts.ShowIncludesPretendHeader.c_str(),
+ PrintHeaderInfo(OutputFile, DepOpts.ShowIncludesPretendHeader,
ShowDepth, 2, MSStyle);
}
HasProcessedPredefines = true;