aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
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);