summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorJames Y Knight <jyknight@google.com>2019-05-06 21:37:59 +0000
committerJames Y Knight <jyknight@google.com>2019-05-06 21:37:59 +0000
commit1fe312b34b742599be26a144b5318a1c9bfc65d4 (patch)
tree7bf4b78a5027fb0e58974ed4c15cae5cbc53523e /clang/lib/Sema
parent214de0f8eeeb41e074467a9ba98714479d28a54d (diff)
downloadbcm5719-llvm-1fe312b34b742599be26a144b5318a1c9bfc65d4.tar.gz
bcm5719-llvm-1fe312b34b742599be26a144b5318a1c9bfc65d4.zip
PR41183: Don't emit strict-prototypes warning for an implicit function
declaration. It should emit _only_ an implicit-function-declaration warning, not both of them. Differential Revision: https://reviews.llvm.org/D59711 llvm-svn: 360084
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaType.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index 318c6761731..86bf90818c9 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -5010,7 +5010,10 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
break;
case DeclaratorChunk::Function: {
const DeclaratorChunk::FunctionTypeInfo &FTI = DeclType.Fun;
- if (FTI.NumParams == 0 && !FTI.isVariadic)
+ // We supress the warning when there's no LParen location, as this
+ // indicates the declaration was an implicit declaration, which gets
+ // warned about separately via -Wimplicit-function-declaration.
+ if (FTI.NumParams == 0 && !FTI.isVariadic && FTI.getLParenLoc().isValid())
S.Diag(DeclType.Loc, diag::warn_strict_prototypes)
<< IsBlock
<< FixItHint::CreateInsertion(FTI.getRParenLoc(), "void");
OpenPOWER on IntegriCloud