]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/clang/StaticAnalyzer/Core/IssueHash.h
Vendor import of clang trunk r338150:
[FreeBSD/FreeBSD.git] / include / clang / StaticAnalyzer / Core / IssueHash.h
1 //===---------- IssueHash.h - Generate identification hashes ----*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_STATICANALYZER_CORE_ISSUE_HASH_H
10 #define LLVM_CLANG_STATICANALYZER_CORE_ISSUE_HASH_H
11
12 #include "llvm/ADT/SmallString.h"
13
14 namespace clang {
15 class Decl;
16 class SourceManager;
17 class FullSourceLoc;
18 class LangOptions;
19
20 /// Get an MD5 hash to help identify bugs.
21 ///
22 /// This function returns a hash that helps identify bugs within a source file.
23 /// This identification can be utilized to diff diagnostic results on different
24 /// snapshots of a projects, or maintain a database of suppressed diagnotics.
25 ///
26 /// The hash contains the normalized text of the location associated with the
27 /// diagnostic. Normalization means removing the whitespaces. The associated
28 /// location is the either the last location of a diagnostic path or a uniqueing
29 /// location. The bugtype and the name of the checker is also part of the hash.
30 /// The last component is the string representation of the enclosing declaration
31 /// of the associated location.
32 /// 
33 /// In case a new hash is introduced, the old one should still be maintained for
34 /// a while. One should not introduce a new hash for every change, it is
35 /// possible to introduce experimental hashes that may change in the future.
36 /// Such hashes should be marked as experimental using a comment in the plist
37 /// files.
38 llvm::SmallString<32> GetIssueHash(const SourceManager &SM,
39                                    FullSourceLoc &IssueLoc,
40                                    llvm::StringRef CheckerName,
41                                    llvm::StringRef BugType, const Decl *D,
42                                    const LangOptions &LangOpts);
43
44 /// Get the string representation of issue hash. See GetIssueHash() for
45 /// more information.
46 std::string GetIssueString(const SourceManager &SM, FullSourceLoc &IssueLoc,
47                            llvm::StringRef CheckerName, llvm::StringRef BugType,
48                            const Decl *D, const LangOptions &LangOpts);
49 } // namespace clang
50
51 #endif