aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-09-12 18:10:20 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-09-12 18:10:20 +0000
commit2fe0997427d92388e66e7573f4b043e7ba285ef0 (patch)
tree4bd997baeb9b15f973a2b4e5b0a43e675a209697 /lib/Sema/SemaDecl.cpp
parentf1d80f12bb49a42098dfb1966a032c0951da30f4 (diff)
Add --suppress-system-warnings (on by default, use =0 to disable)
- For investigating warnings in system headers / builtins. - Currently also enables the behavior that allows silent redefinition of types in system headers. Conceptually these are separate but I didn't feel it was worth two options (or changing LangOptions). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56163 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 726372356e..2f4350766a 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -276,11 +276,13 @@ TypedefDecl *Sema::MergeTypeDefDecl(TypedefDecl *New, Decl *OldD) {
// *either* declaration is in a system header. The code below implements
// this adhoc compatibility rule. FIXME: The following code will not
// work properly when compiling ".i" files (containing preprocessed output).
- SourceManager &SrcMgr = Context.getSourceManager();
- if (SrcMgr.isInSystemHeader(Old->getLocation()))
- return New;
- if (SrcMgr.isInSystemHeader(New->getLocation()))
- return New;
+ if (PP.getDiagnostics().getSuppressSystemWarnings()) {
+ SourceManager &SrcMgr = Context.getSourceManager();
+ if (SrcMgr.isInSystemHeader(Old->getLocation()))
+ return New;
+ if (SrcMgr.isInSystemHeader(New->getLocation()))
+ return New;
+ }
Diag(New->getLocation(), diag::err_redefinition, New->getName());
Diag(Old->getLocation(), diag::err_previous_definition);