|
@@ -127,14 +127,13 @@ static StringRef GetNthLineOfFile(llvm::MemoryBuffer *Buffer, int Line) {
|
|
}
|
|
}
|
|
|
|
|
|
static std::string NormalizeLine(const SourceManager &SM, FullSourceLoc &L,
|
|
static std::string NormalizeLine(const SourceManager &SM, FullSourceLoc &L,
|
|
- const Decl *D) {
|
|
|
|
|
|
+ const LangOptions &LangOpts) {
|
|
static StringRef Whitespaces = " \t\n";
|
|
static StringRef Whitespaces = " \t\n";
|
|
|
|
|
|
- const LangOptions &Opts = D->getASTContext().getLangOpts();
|
|
|
|
StringRef Str = GetNthLineOfFile(SM.getBuffer(L.getFileID(), L),
|
|
StringRef Str = GetNthLineOfFile(SM.getBuffer(L.getFileID(), L),
|
|
L.getExpansionLineNumber());
|
|
L.getExpansionLineNumber());
|
|
unsigned col = Str.find_first_not_of(Whitespaces);
|
|
unsigned col = Str.find_first_not_of(Whitespaces);
|
|
-
|
|
|
|
|
|
+ col++;
|
|
SourceLocation StartOfLine =
|
|
SourceLocation StartOfLine =
|
|
SM.translateLineCol(SM.getFileID(L), L.getExpansionLineNumber(), col);
|
|
SM.translateLineCol(SM.getFileID(L), L.getExpansionLineNumber(), col);
|
|
llvm::MemoryBuffer *Buffer =
|
|
llvm::MemoryBuffer *Buffer =
|
|
@@ -145,7 +144,7 @@ static std::string NormalizeLine(const SourceManager &SM, FullSourceLoc &L,
|
|
const char *BufferPos = SM.getCharacterData(StartOfLine);
|
|
const char *BufferPos = SM.getCharacterData(StartOfLine);
|
|
|
|
|
|
Token Token;
|
|
Token Token;
|
|
- Lexer Lexer(SM.getLocForStartOfFile(SM.getFileID(StartOfLine)), Opts,
|
|
|
|
|
|
+ Lexer Lexer(SM.getLocForStartOfFile(SM.getFileID(StartOfLine)), LangOpts,
|
|
Buffer->getBufferStart(), BufferPos, Buffer->getBufferEnd());
|
|
Buffer->getBufferStart(), BufferPos, Buffer->getBufferEnd());
|
|
|
|
|
|
size_t NextStart = 0;
|
|
size_t NextStart = 0;
|
|
@@ -175,20 +174,23 @@ static llvm::SmallString<32> GetHashOfContent(StringRef Content) {
|
|
std::string clang::GetIssueString(const SourceManager &SM,
|
|
std::string clang::GetIssueString(const SourceManager &SM,
|
|
FullSourceLoc &IssueLoc,
|
|
FullSourceLoc &IssueLoc,
|
|
StringRef CheckerName, StringRef BugType,
|
|
StringRef CheckerName, StringRef BugType,
|
|
- const Decl *D) {
|
|
|
|
|
|
+ const Decl *D,
|
|
|
|
+ const LangOptions &LangOpts) {
|
|
static StringRef Delimiter = "$";
|
|
static StringRef Delimiter = "$";
|
|
|
|
|
|
return (llvm::Twine(CheckerName) + Delimiter +
|
|
return (llvm::Twine(CheckerName) + Delimiter +
|
|
GetEnclosingDeclContextSignature(D) + Delimiter +
|
|
GetEnclosingDeclContextSignature(D) + Delimiter +
|
|
llvm::utostr(IssueLoc.getExpansionColumnNumber()) + Delimiter +
|
|
llvm::utostr(IssueLoc.getExpansionColumnNumber()) + Delimiter +
|
|
- NormalizeLine(SM, IssueLoc, D) + Delimiter + BugType)
|
|
|
|
|
|
+ NormalizeLine(SM, IssueLoc, LangOpts) + Delimiter + BugType)
|
|
.str();
|
|
.str();
|
|
}
|
|
}
|
|
|
|
|
|
SmallString<32> clang::GetIssueHash(const SourceManager &SM,
|
|
SmallString<32> clang::GetIssueHash(const SourceManager &SM,
|
|
FullSourceLoc &IssueLoc,
|
|
FullSourceLoc &IssueLoc,
|
|
StringRef CheckerName, StringRef BugType,
|
|
StringRef CheckerName, StringRef BugType,
|
|
- const Decl *D) {
|
|
|
|
|
|
+ const Decl *D,
|
|
|
|
+ const LangOptions &LangOpts) {
|
|
|
|
+
|
|
return GetHashOfContent(
|
|
return GetHashOfContent(
|
|
- GetIssueString(SM, IssueLoc, CheckerName, BugType, D));
|
|
|
|
|
|
+ GetIssueString(SM, IssueLoc, CheckerName, BugType, D, LangOpts));
|
|
}
|
|
}
|