Index: include/clang/StaticAnalyzer/Core/IssueHash.h =================================================================== --- include/clang/StaticAnalyzer/Core/IssueHash.h +++ include/clang/StaticAnalyzer/Core/IssueHash.h @@ -15,6 +15,7 @@ class Decl; class SourceManager; class FullSourceLoc; +class LangOptions; /// \brief Get an MD5 hash to help identify bugs. /// @@ -37,13 +38,14 @@ llvm::SmallString<32> GetIssueHash(const SourceManager &SM, FullSourceLoc &IssueLoc, llvm::StringRef CheckerName, - llvm::StringRef BugType, const Decl *D); + llvm::StringRef BugType, const Decl *D, + const LangOptions &LangOpts); /// \brief Get the string representation of issue hash. See GetIssueHash() for /// more information. std::string GetIssueString(const SourceManager &SM, FullSourceLoc &IssueLoc, llvm::StringRef CheckerName, llvm::StringRef BugType, - const Decl *D); + const Decl *D, const LangOptions &LangOpts); } // namespace clang #endif Index: lib/Basic/SourceManager.cpp =================================================================== --- lib/Basic/SourceManager.cpp +++ lib/Basic/SourceManager.cpp @@ -1718,7 +1718,7 @@ unsigned Col) const { // Lines are used as a one-based index into a zero-based array. This assert // checks for possible buffer underruns. - assert(Line != 0 && "Passed a zero-based line"); + assert(Line && Col && "Line and column should start from 1!"); if (FID.isInvalid()) return SourceLocation(); Index: lib/StaticAnalyzer/Checkers/DebugCheckers.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/DebugCheckers.cpp +++ lib/StaticAnalyzer/Checkers/DebugCheckers.cpp @@ -230,11 +230,12 @@ if (!N) return; + const LangOptions &Opts = C.getLangOpts(); const SourceManager &SM = C.getSourceManager(); FullSourceLoc FL(S->getLocStart(), SM); std::string HashContent = GetIssueString(SM, FL, getCheckName().getName(), BT->getCategory(), - C.getLocationContext()->getDecl()); + C.getLocationContext()->getDecl(), Opts); C.emitReport(llvm::make_unique(*BT, HashContent, N)); } 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 -// 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: 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