summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/Diagnostic.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-04-12 21:53:11 +0000
committerChris Lattner <sabre@nondot.org>2010-04-12 21:53:11 +0000
commit97a8e43a02797f9b62a3a6bfcbabef38ee4bf3b0 (patch)
tree3d6340271f6f243a7d6420b0a97fee30a156d4e0 /clang/lib/Basic/Diagnostic.cpp
parent4ed2925b91503b75b2a984a810c95f6ba09ac719 (diff)
downloadbcm5719-llvm-97a8e43a02797f9b62a3a6bfcbabef38ee4bf3b0.tar.gz
bcm5719-llvm-97a8e43a02797f9b62a3a6bfcbabef38ee4bf3b0.zip
fix PR6814 - Only print [-pedantic] on a diagnostic if -pedantic
actually turned it on. If a diag is produced by a warning which is an extension but defaults to on, and has no warning group, don't print any option info. llvm-svn: 101071
Diffstat (limited to 'clang/lib/Basic/Diagnostic.cpp')
-rw-r--r--clang/lib/Basic/Diagnostic.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/clang/lib/Basic/Diagnostic.cpp b/clang/lib/Basic/Diagnostic.cpp
index 1eeb25b8770..bd1d6e8b70e 100644
--- a/clang/lib/Basic/Diagnostic.cpp
+++ b/clang/lib/Basic/Diagnostic.cpp
@@ -287,11 +287,18 @@ bool Diagnostic::isBuiltinNote(unsigned DiagID) {
}
/// isBuiltinExtensionDiag - Determine whether the given built-in diagnostic
-/// ID is for an extension of some sort.
+/// ID is for an extension of some sort. This also returns EnabledByDefault,
+/// which is set to indicate whether the diagnostic is ignored by default (in
+/// which case -pedantic enables it) or treated as a warning/error by default.
///
-bool Diagnostic::isBuiltinExtensionDiag(unsigned DiagID) {
- return DiagID < diag::DIAG_UPPER_LIMIT &&
- getBuiltinDiagClass(DiagID) == CLASS_EXTENSION;
+bool Diagnostic::isBuiltinExtensionDiag(unsigned DiagID,
+ bool &EnabledByDefault) {
+ if (DiagID >= diag::DIAG_UPPER_LIMIT ||
+ getBuiltinDiagClass(DiagID) != CLASS_EXTENSION)
+ return false;
+
+ EnabledByDefault = StaticDiagInfo[DiagID].Mapping != diag::MAP_IGNORE;
+ return true;
}
OpenPOWER on IntegriCloud