diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2018-08-02 17:33:11 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2018-08-02 17:33:11 +0000 |
commit | c7e70c433efc6953dc3888b9fbf9f3512d7da2b0 (patch) | |
tree | 27425930fc0c91650a7f3527fcac8e0f92907b90 /utils | |
parent | 486754660bb926339aefcf012a3f848592babb8b (diff) |
Notes
Diffstat (limited to 'utils')
-rw-r--r-- | utils/TableGen/ClangAttrEmitter.cpp | 9 | ||||
-rwxr-xr-x | utils/analyzer/CmpRuns.py | 14 | ||||
-rw-r--r-- | utils/analyzer/SATestBuild.py | 18 |
3 files changed, 24 insertions, 17 deletions
diff --git a/utils/TableGen/ClangAttrEmitter.cpp b/utils/TableGen/ClangAttrEmitter.cpp index 0bf7a07cf6e14..6b3df825808f6 100644 --- a/utils/TableGen/ClangAttrEmitter.cpp +++ b/utils/TableGen/ClangAttrEmitter.cpp @@ -3305,11 +3305,16 @@ static std::string GenerateAppertainsTo(const Record &Attr, raw_ostream &OS) { // Otherwise, generate an appertainsTo check specific to this attribute which // checks all of the given subjects against the Decl passed in. Return the // name of that check to the caller. + // + // If D is null, that means the attribute was not applied to a declaration + // at all (for instance because it was applied to a type), or that the caller + // has determined that the check should fail (perhaps prior to the creation + // of the declaration). std::string FnName = "check" + Attr.getName().str() + "AppertainsTo"; std::stringstream SS; SS << "static bool " << FnName << "(Sema &S, const ParsedAttr &Attr, "; SS << "const Decl *D) {\n"; - SS << " if ("; + SS << " if (!D || ("; for (auto I = Subjects.begin(), E = Subjects.end(); I != E; ++I) { // If the subject has custom code associated with it, generate a function // for it. The function cannot be inlined into this check (yet) because it @@ -3325,7 +3330,7 @@ static std::string GenerateAppertainsTo(const Record &Attr, raw_ostream &OS) { if (I + 1 != E) SS << " && "; } - SS << ") {\n"; + SS << ")) {\n"; SS << " S.Diag(Attr.getLoc(), diag::"; SS << (Warn ? "warn_attribute_wrong_decl_type_str" : "err_attribute_wrong_decl_type_str"); diff --git a/utils/analyzer/CmpRuns.py b/utils/analyzer/CmpRuns.py index 1b8fe7bd698dd..7c9744727e905 100755 --- a/utils/analyzer/CmpRuns.py +++ b/utils/analyzer/CmpRuns.py @@ -312,11 +312,11 @@ def compareStats(resultsA, resultsB): # Only apply highlighting when writing to TTY and it's not Windows if sys.stdout.isatty() and os.name != 'nt': if valB != 0: - ratio = (valB - valA) / valB - if ratio < -0.2: - report = Colors.GREEN + report + Colors.CLEAR - elif ratio > 0.2: - report = Colors.RED + report + Colors.CLEAR + ratio = (valB - valA) / valB + if ratio < -0.2: + report = Colors.GREEN + report + Colors.CLEAR + elif ratio > 0.2: + report = Colors.RED + report + Colors.CLEAR print "\t %s %s" % (kkey, report) def dumpScanBuildResultsDiff(dirA, dirB, opts, deleteEmpty=True, @@ -324,7 +324,7 @@ def dumpScanBuildResultsDiff(dirA, dirB, opts, deleteEmpty=True, # Load the run results. resultsA = loadResults(dirA, opts, opts.rootA, deleteEmpty) resultsB = loadResults(dirB, opts, opts.rootB, deleteEmpty) - if resultsA.stats: + if opts.show_stats: compareStats(resultsA, resultsB) if opts.stats_only: return @@ -399,6 +399,8 @@ def generate_option_parser(): Requires matplotlib") parser.add_option("--stats-only", action="store_true", dest="stats_only", default=False, help="Only show statistics on reports") + parser.add_option("--show-stats", action="store_true", dest="show_stats", + default=False, help="Show change in statistics") return parser diff --git a/utils/analyzer/SATestBuild.py b/utils/analyzer/SATestBuild.py index 4da025aa53b3a..ea95ee289e99f 100644 --- a/utils/analyzer/SATestBuild.py +++ b/utils/analyzer/SATestBuild.py @@ -60,9 +60,9 @@ import threading import time import Queue -#------------------------------------------------------------------------------ +############################################################################### # Helper functions. -#------------------------------------------------------------------------------ +############################################################################### Local = threading.local() Local.stdout = sys.stdout @@ -91,9 +91,9 @@ def getProjectMapPath(): ProjectMapPath = os.path.join(os.path.abspath(os.curdir), ProjectMapFile) if not os.path.exists(ProjectMapPath): - Local.stdout.write("Error: Cannot find the Project Map file " - + ProjectMapPath - + "\nRunning script for the wrong directory?\n") + Local.stdout.write("Error: Cannot find the Project Map file " + + ProjectMapPath + + "\nRunning script for the wrong directory?\n") sys.exit(1) return ProjectMapPath @@ -108,9 +108,9 @@ def getSBOutputDirName(IsReferenceBuild): else: return SBOutputDirName -#------------------------------------------------------------------------------ +############################################################################### # Configuration setup. -#------------------------------------------------------------------------------ +############################################################################### # Find Clang for static analysis. @@ -185,9 +185,9 @@ Checkers = ",".join([ Verbose = 0 -#------------------------------------------------------------------------------ +############################################################################### # Test harness logic. -#------------------------------------------------------------------------------ +############################################################################### def runCleanupScript(Dir, PBuildLogFile): |