[PATCH] D26465: [Diag] Optimize DiagnosticIDs::getDiagnosticSeverity

Olivier Goffart via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 9 10:38:58 PST 2016


ogoffart created this revision.
ogoffart added reviewers: cfe-commits, rsmith.
Herald added a subscriber: sanjoy.

DiagnosticIDs::getDiagnosticSeverity function turns out to take a lot of time in getDecomposedLoc. It is called quite often from different places. (For example from Sema::CheckTemplateArgument which attempt to emit warn_cxx98_compat_* diagnostics.)
In most cases, the diagnostics are not overridden by pragmas and the mapping from the command line is good enough. This commit adds a bit in the the first mapping which specify if we should look up the real mapping.

This saves more than 5% of the parsing time according to perf.


https://reviews.llvm.org/D26465

Files:
  include/clang/Basic/Diagnostic.h
  include/clang/Basic/DiagnosticIDs.h
  lib/Basic/Diagnostic.cpp
  lib/Basic/DiagnosticIDs.cpp
  lib/Serialization/ASTReader.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26465.77377.patch
Type: text/x-patch
Size: 5972 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161109/2c369790/attachment-0001.bin>


More information about the cfe-commits mailing list