forked from OSchip/llvm-project
clang::tooling::Diagnostic: Don't store offset in the scratch space.
These offsets are useless (and even harmful in certain cases) in exported diagnostics. The test will be added to clang-tidy, since it's the main user of the clang::tooling::Diagnostic class. llvm-svn: 347372
This commit is contained in:
parent
af17a3866b
commit
b2ac7eec42
|
@ -23,10 +23,15 @@ DiagnosticMessage::DiagnosticMessage(llvm::StringRef Message)
|
|||
DiagnosticMessage::DiagnosticMessage(llvm::StringRef Message,
|
||||
const SourceManager &Sources,
|
||||
SourceLocation Loc)
|
||||
: Message(Message) {
|
||||
: Message(Message), FileOffset(0) {
|
||||
assert(Loc.isValid() && Loc.isFileID());
|
||||
FilePath = Sources.getFilename(Loc);
|
||||
FileOffset = Sources.getFileOffset(Loc);
|
||||
|
||||
// Don't store offset in the scratch space. It doesn't tell anything to the
|
||||
// user. Moreover, it depends on the history of macro expansions and thus
|
||||
// prevents deduplication of warnings in headers.
|
||||
if (!FilePath.empty())
|
||||
FileOffset = Sources.getFileOffset(Loc);
|
||||
}
|
||||
|
||||
Diagnostic::Diagnostic(llvm::StringRef DiagnosticName,
|
||||
|
|
Loading…
Reference in New Issue