summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-02-03 23:41:12 +0000
committerDouglas Gregor <dgregor@apple.com>2011-02-03 23:41:12 +0000
commit149239651d33b2787246097daf2326351a85ba77 (patch)
treec23c052252b8a019bdacbcf5c96699955f8c1a8a /clang/lib/Basic
parentcd25b86fb9e8da5bb42266157890bd6a411cca27 (diff)
downloadbcm5719-llvm-149239651d33b2787246097daf2326351a85ba77.tar.gz
bcm5719-llvm-149239651d33b2787246097daf2326351a85ba77.zip
If any Fix-Its attached to a diagnostic have invalid source locations
or source locations that refer into a macro instantiation, delete all of the Fix-Its on that diagnostic. llvm-svn: 124833
Diffstat (limited to 'clang/lib/Basic')
-rw-r--r--clang/lib/Basic/DiagnosticIDs.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Basic/DiagnosticIDs.cpp b/clang/lib/Basic/DiagnosticIDs.cpp
index 8efeb6897d0..8725e7f9c0c 100644
--- a/clang/lib/Basic/DiagnosticIDs.cpp
+++ b/clang/lib/Basic/DiagnosticIDs.cpp
@@ -560,6 +560,19 @@ bool DiagnosticIDs::ProcessDiag(Diagnostic &Diag) const {
Diag.SetDelayedDiagnostic(diag::fatal_too_many_errors);
}
+ // If we have any Fix-Its, make sure that all of the Fix-Its point into
+ // source locations that aren't macro instantiations. If any point into
+ // macro instantiations, remove all of the Fix-Its.
+ for (unsigned I = 0, N = Diag.NumFixItHints; I != N; ++I) {
+ const FixItHint &FixIt = Diag.FixItHints[I];
+ if (FixIt.RemoveRange.isInvalid() ||
+ FixIt.RemoveRange.getBegin().isMacroID() ||
+ FixIt.RemoveRange.getEnd().isMacroID()) {
+ Diag.NumFixItHints = 0;
+ break;
+ }
+ }
+
// Finally, report it.
Diag.Client->HandleDiagnostic((Diagnostic::Level)DiagLevel, Info);
if (Diag.Client->IncludeInDiagnosticCounts()) {
OpenPOWER on IntegriCloud