diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-01-07 22:25:55 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-01-07 22:25:55 +0000 |
commit | db70052b65d4cce4e6dd69581381cf30be121cd6 (patch) | |
tree | 7eb6e50f47f9e965350a6c36c870c63e74eaaa35 /clang/lib/Sema/SemaExpr.cpp | |
parent | 07c0f285ba92148f5793959c386dc2ba8f0cc7f7 (diff) | |
download | bcm5719-llvm-db70052b65d4cce4e6dd69581381cf30be121cd6.tar.gz bcm5719-llvm-db70052b65d4cce4e6dd69581381cf30be121cd6.zip |
Remove bogus check for template specialization from self-comparison warning.
The important check is that we're not within a template *instantiation*, which
we check separately.
llvm-svn: 321977
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index e9e65fc1fc5..39b532309d7 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -9300,16 +9300,6 @@ QualType Sema::CheckShiftOperands(ExprResult &LHS, ExprResult &RHS, return LHSType; } -static bool IsWithinTemplateSpecialization(Decl *D) { - if (DeclContext *DC = D->getDeclContext()) { - if (isa<ClassTemplateSpecializationDecl>(DC)) - return true; - if (FunctionDecl *FD = dyn_cast<FunctionDecl>(DC)) - return FD->isFunctionTemplateSpecialization(); - } - return false; -} - /// If two different enums are compared, raise a warning. static void checkEnumComparison(Sema &S, SourceLocation Loc, Expr *LHS, Expr *RHS) { @@ -9621,14 +9611,13 @@ static void diagnoseTautologicalComparison(Sema &S, SourceLocation Loc, // // NOTE: Don't warn about comparison expressions resulting from macro // expansion. Also don't warn about comparisons which are only self - // comparisons within a template specialization. The warnings should catch + // comparisons within a template instantiation. The warnings should catch // obvious cases in the definition of the template anyways. The idea is to // warn when the typed comparison operator will always evaluate to the same // result. ValueDecl *DL = getCompareDecl(LHSStripped); ValueDecl *DR = getCompareDecl(RHSStripped); - if (DL && DR && declaresSameEntity(DL, DR) && - !IsWithinTemplateSpecialization(DL)) { + if (DL && DR && declaresSameEntity(DL, DR)) { StringRef Result; switch (Opc) { case BO_EQ: case BO_LE: case BO_GE: |