Index: test/Analysis/diagnostics/report-issues-within-main-file.cpp
===================================================================
--- test/Analysis/diagnostics/report-issues-within-main-file.cpp
+++ test/Analysis/diagnostics/report-issues-within-main-file.cpp
@@ -949,7 +949,7 @@
// CHECK-NEXT: typeBad deallocator
// CHECK-NEXT: check_nameunix.MismatchedDeallocator
// CHECK-NEXT:
-// CHECK-NEXT: issue_hash_content_of_line_in_contextf21ac032efaa3d1459a5ed31f0ad44f0
+// CHECK-NEXT: issue_hash_content_of_line_in_contextf689fbd54138491e228f0f89bb02bfb2
// CHECK-NEXT: issue_context_kindfunction
// CHECK-NEXT: issue_contextmainPlusHeader
// CHECK-NEXT: issue_hash_function_offset2
Index: test/Analysis/bug_hash_test.cpp
===================================================================
--- test/Analysis/bug_hash_test.cpp
+++ test/Analysis/bug_hash_test.cpp
@@ -288,17 +288,17 @@
// CHECK-NEXT:
// CHECK-NEXT: depth0
// CHECK-NEXT: extended_message
-// CHECK-NEXT: debug.DumpBugHash$int f()$28$namespaceAA{$debug
+// CHECK-NEXT: debug.DumpBugHash$int f()$28$constexprintf(){return5;}$debug
// CHECK-NEXT: message
-// CHECK-NEXT: debug.DumpBugHash$int f()$28$namespaceAA{$debug
+// CHECK-NEXT: debug.DumpBugHash$int f()$28$constexprintf(){return5;}$debug
// CHECK-NEXT:
// CHECK-NEXT:
-// CHECK-NEXT: descriptiondebug.DumpBugHash$int f()$28$namespaceAA{$debug
+// CHECK-NEXT: descriptiondebug.DumpBugHash$int f()$28$constexprintf(){return5;}$debug
// CHECK-NEXT: categorydebug
// CHECK-NEXT: typeDump hash components
// CHECK-NEXT: check_namedebug.DumpBugHash
// CHECK-NEXT:
-// CHECK-NEXT: issue_hash_content_of_line_in_contextf8ee38da3de42e209c4afa886b5531ab
+// CHECK-NEXT: issue_hash_content_of_line_in_contextf5471f52854dc14167fe96db50c4ba5f
// CHECK-NEXT: issue_context_kindfunction
// CHECK-NEXT: issue_contextf
// CHECK-NEXT: issue_hash_function_offset0
Index: lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
===================================================================
--- lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
+++ lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
@@ -399,7 +399,7 @@
*SM);
const Decl *DeclWithIssue = D->getDeclWithIssue();
EmitString(o, GetIssueHash(*SM, L, D->getCheckName(), D->getBugType(),
- DeclWithIssue))
+ DeclWithIssue, LangOpts))
<< '\n';
// Output information about the semantic context where
Index: lib/StaticAnalyzer/Core/IssueHash.cpp
===================================================================
--- lib/StaticAnalyzer/Core/IssueHash.cpp
+++ lib/StaticAnalyzer/Core/IssueHash.cpp
@@ -127,14 +127,13 @@
}
static std::string NormalizeLine(const SourceManager &SM, FullSourceLoc &L,
- const Decl *D) {
+ const LangOptions &LangOpts) {
static StringRef Whitespaces = " \t\n";
- const LangOptions &Opts = D->getASTContext().getLangOpts();
StringRef Str = GetNthLineOfFile(SM.getBuffer(L.getFileID(), L),
L.getExpansionLineNumber());
unsigned col = Str.find_first_not_of(Whitespaces);
-
+ col++;
SourceLocation StartOfLine =
SM.translateLineCol(SM.getFileID(L), L.getExpansionLineNumber(), col);
llvm::MemoryBuffer *Buffer =
@@ -145,7 +144,7 @@
const char *BufferPos = SM.getCharacterData(StartOfLine);
Token Token;
- Lexer Lexer(SM.getLocForStartOfFile(SM.getFileID(StartOfLine)), Opts,
+ Lexer Lexer(SM.getLocForStartOfFile(SM.getFileID(StartOfLine)), LangOpts,
Buffer->getBufferStart(), BufferPos, Buffer->getBufferEnd());
size_t NextStart = 0;
@@ -175,20 +174,23 @@
std::string clang::GetIssueString(const SourceManager &SM,
FullSourceLoc &IssueLoc,
StringRef CheckerName, StringRef BugType,
- const Decl *D) {
+ const Decl *D,
+ const LangOptions &LangOpts) {
static StringRef Delimiter = "$";
return (llvm::Twine(CheckerName) + Delimiter +
GetEnclosingDeclContextSignature(D) + Delimiter +
llvm::utostr(IssueLoc.getExpansionColumnNumber()) + Delimiter +
- NormalizeLine(SM, IssueLoc, D) + Delimiter + BugType)
+ NormalizeLine(SM, IssueLoc, LangOpts) + Delimiter + BugType)
.str();
}
SmallString<32> clang::GetIssueHash(const SourceManager &SM,
FullSourceLoc &IssueLoc,
StringRef CheckerName, StringRef BugType,
- const Decl *D) {
+ const Decl *D,
+ const LangOptions &LangOpts) {
+
return GetHashOfContent(
- GetIssueString(SM, IssueLoc, CheckerName, BugType, D));
+ GetIssueString(SM, IssueLoc, CheckerName, BugType, D, LangOpts));
}
Index: lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
===================================================================
--- lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
+++ lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
@@ -255,8 +255,8 @@
os << "\n\n";
os << "\n\n";
+ << GetIssueHash(SMgr, L, D.getCheckName(), D.getBugType(), DeclWithIssue,
+ PP.getLangOpts()) << " -->\n";
os << "\n