clang  10.0.0svn
IssueHash.h
Go to the documentation of this file.
1 //===---------- IssueHash.h - Generate identification hashes ----*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 #ifndef LLVM_CLANG_STATICANALYZER_CORE_ISSUE_HASH_H
9 #define LLVM_CLANG_STATICANALYZER_CORE_ISSUE_HASH_H
10 
11 #include "llvm/ADT/SmallString.h"
12 
13 namespace clang {
14 class Decl;
15 class SourceManager;
16 class FullSourceLoc;
17 class LangOptions;
18 
19 /// Get an MD5 hash to help identify bugs.
20 ///
21 /// This function returns a hash that helps identify bugs within a source file.
22 /// This identification can be utilized to diff diagnostic results on different
23 /// snapshots of a projects, or maintain a database of suppressed diagnotics.
24 ///
25 /// The hash contains the normalized text of the location associated with the
26 /// diagnostic. Normalization means removing the whitespaces. The associated
27 /// location is the either the last location of a diagnostic path or a uniqueing
28 /// location. The bugtype and the name of the checker is also part of the hash.
29 /// The last component is the string representation of the enclosing declaration
30 /// of the associated location.
31 ///
32 /// In case a new hash is introduced, the old one should still be maintained for
33 /// a while. One should not introduce a new hash for every change, it is
34 /// possible to introduce experimental hashes that may change in the future.
35 /// Such hashes should be marked as experimental using a comment in the plist
36 /// files.
37 llvm::SmallString<32> GetIssueHash(const SourceManager &SM,
38  FullSourceLoc &IssueLoc,
39  llvm::StringRef CheckerName,
40  llvm::StringRef BugType, const Decl *D,
41  const LangOptions &LangOpts);
42 
43 /// Get the string representation of issue hash. See GetIssueHash() for
44 /// more information.
45 std::string GetIssueString(const SourceManager &SM, FullSourceLoc &IssueLoc,
46  llvm::StringRef CheckerName, llvm::StringRef BugType,
47  const Decl *D, const LangOptions &LangOpts);
48 } // namespace clang
49 
50 #endif
llvm::SmallString< 32 > GetIssueHash(const SourceManager &SM, FullSourceLoc &IssueLoc, llvm::StringRef CheckerName, llvm::StringRef BugType, const Decl *D, const LangOptions &LangOpts)
Get an MD5 hash to help identify bugs.
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
const SourceManager & SM
Definition: Format.cpp:1667
Dataflow Directional Tag Classes.
std::string GetIssueString(const SourceManager &SM, FullSourceLoc &IssueLoc, llvm::StringRef CheckerName, llvm::StringRef BugType, const Decl *D, const LangOptions &LangOpts)
Get the string representation of issue hash.