rsmith added inline comments.

================
Comment at: lib/Basic/Diagnostic.cpp:179
+
+  // 2nd most frequent case: L is before the first diag state change.
+  FullSourceLoc FirstStateChangePos = DiagStatePoints[1].Loc;
----------------
It's surprising to me that this would be particularly frequent.

I suspect what you're actually seeing is a consequence of a bug in how we 
manage `DiagStatePoint`s with modules. It looks like 
`ASTReader::InitializeContext` is called once per top-level PCM file that we 
load, and its call to `ReadPragmaDiagnosticMappings` adds entries to the 
`DiagStatePoints` list regardless of whether they've already been added. So, 
we'll end up with duplicates in the `DiagStatePoints` list, and it won't even 
be in translation unit order.

Can you take a look at the `DiagStatePoints` list for a translation unit where 
you see a performance problem and check whether it seems reasonable?


https://reviews.llvm.org/D28207



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to