summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/tools/clang/lib/Frontend/PrintPreprocessedOutput.cpp
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2019-01-27 16:42:12 +0000
committerpatrick <patrick@openbsd.org>2019-01-27 16:42:12 +0000
commitb773203fb58f3ef282fb69c832d8710cab5bc82d (patch)
treee75913f147570fbd75169647b144df85b88a038c /gnu/llvm/tools/clang/lib/Frontend/PrintPreprocessedOutput.cpp
parenttweak errno in previous (diff)
downloadwireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.tar.xz
wireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.zip
Import LLVM 7.0.1 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/tools/clang/lib/Frontend/PrintPreprocessedOutput.cpp')
-rw-r--r--gnu/llvm/tools/clang/lib/Frontend/PrintPreprocessedOutput.cpp37
1 files changed, 20 insertions, 17 deletions
diff --git a/gnu/llvm/tools/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/gnu/llvm/tools/clang/lib/Frontend/PrintPreprocessedOutput.cpp
index 2e023294f1e..69cd072ea57 100644
--- a/gnu/llvm/tools/clang/lib/Frontend/PrintPreprocessedOutput.cpp
+++ b/gnu/llvm/tools/clang/lib/Frontend/PrintPreprocessedOutput.cpp
@@ -130,7 +130,8 @@ public:
StringRef FileName, bool IsAngled,
CharSourceRange FilenameRange, const FileEntry *File,
StringRef SearchPath, StringRef RelativePath,
- const Module *Imported) override;
+ const Module *Imported,
+ SrcMgr::CharacteristicKind FileType) override;
void Ident(SourceLocation Loc, StringRef str) override;
void PragmaMessage(SourceLocation Loc, StringRef Namespace,
PragmaMessageKind Kind, StringRef Str) override;
@@ -159,7 +160,7 @@ public:
}
bool MoveToLine(unsigned LineNo);
- bool AvoidConcat(const Token &PrevPrevTok, const Token &PrevTok,
+ bool AvoidConcat(const Token &PrevPrevTok, const Token &PrevTok,
const Token &Tok) {
return ConcatInfo.AvoidConcat(PrevPrevTok, PrevTok, Tok);
}
@@ -247,7 +248,7 @@ PrintPPOutputPPCallbacks::startNewLineIfNeeded(bool ShouldUpdateCurrentLine) {
++CurLine;
return true;
}
-
+
return false;
}
@@ -261,11 +262,11 @@ void PrintPPOutputPPCallbacks::FileChanged(SourceLocation Loc,
// Unless we are exiting a #include, make sure to skip ahead to the line the
// #include directive was at.
SourceManager &SourceMgr = SM;
-
+
PresumedLoc UserLoc = SourceMgr.getPresumedLoc(Loc);
if (UserLoc.isInvalid())
return;
-
+
unsigned NewLine = UserLoc.getLine();
if (Reason == PPCallbacks::EnterFile) {
@@ -280,7 +281,7 @@ void PrintPPOutputPPCallbacks::FileChanged(SourceLocation Loc,
// off by one. We can do better by simply incrementing NewLine here.
NewLine += 1;
}
-
+
CurLine = NewLine;
CurFilename.clear();
@@ -291,7 +292,7 @@ void PrintPPOutputPPCallbacks::FileChanged(SourceLocation Loc,
startNewLineIfNeeded(/*ShouldUpdateCurrentLine=*/false);
return;
}
-
+
if (!Initialized) {
WriteLineInfo(CurLine);
Initialized = true;
@@ -320,15 +321,17 @@ void PrintPPOutputPPCallbacks::FileChanged(SourceLocation Loc,
}
}
-void PrintPPOutputPPCallbacks::InclusionDirective(SourceLocation HashLoc,
- const Token &IncludeTok,
- StringRef FileName,
- bool IsAngled,
- CharSourceRange FilenameRange,
- const FileEntry *File,
- StringRef SearchPath,
- StringRef RelativePath,
- const Module *Imported) {
+void PrintPPOutputPPCallbacks::InclusionDirective(
+ SourceLocation HashLoc,
+ const Token &IncludeTok,
+ StringRef FileName,
+ bool IsAngled,
+ CharSourceRange FilenameRange,
+ const FileEntry *File,
+ StringRef SearchPath,
+ StringRef RelativePath,
+ const Module *Imported,
+ SrcMgr::CharacteristicKind FileType) {
// In -dI mode, dump #include directives prior to dumping their content or
// interpretation.
if (DumpIncludeDirectives) {
@@ -752,7 +755,7 @@ static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok,
} else if (Tok.isLiteral() && !Tok.needsCleaning() &&
Tok.getLiteralData()) {
OS.write(Tok.getLiteralData(), Tok.getLength());
- } else if (Tok.getLength() < 256) {
+ } else if (Tok.getLength() < llvm::array_lengthof(Buffer)) {
const char *TokPtr = Buffer;
unsigned Len = PP.getSpelling(Tok, TokPtr);
OS.write(TokPtr, Len);