From f9e2ca2ab17197472bbde11fe6cc6115c2a5dc09 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Wed, 26 Dec 2018 17:44:40 +0000 Subject: [PATCH] Ignore ConstantExpr in IgnoreParens Summary: This moves it up from IgnoreParenImpCasts to IgnoreParens, so that more helpers ignore it. For most clients, this ensures that these helpers behave the same with and without C++17 enabled, which is what appears to introduce these new expression nodes. Fixes PR39881 Reviewers: void, rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55853 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350068 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/Expr.cpp | 8 ++++---- test/CodeGenCXX/mangle-ms-templates.cpp | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 11191c4682..6aa1199add 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -2596,6 +2596,10 @@ Expr* Expr::IgnoreParens() { continue; } } + if (ConstantExpr *CE = dyn_cast(E)) { + E = CE->getSubExpr(); + continue; + } return E; } } @@ -2718,10 +2722,6 @@ Expr *Expr::IgnoreParenImpCasts() { E = NTTP->getReplacement(); continue; } - if (ConstantExpr *CE = dyn_cast(E)) { - E = CE->getSubExpr(); - continue; - } return E; } } diff --git a/test/CodeGenCXX/mangle-ms-templates.cpp b/test/CodeGenCXX/mangle-ms-templates.cpp index 6055465537..469a23afc8 100644 --- a/test/CodeGenCXX/mangle-ms-templates.cpp +++ b/test/CodeGenCXX/mangle-ms-templates.cpp @@ -1,5 +1,7 @@ // RUN: %clang_cc1 -std=c++11 -fms-compatibility-version=19 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=i386-pc-win32 | FileCheck %s // RUN: %clang_cc1 -std=c++11 -fms-compatibility-version=19 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=x86_64-pc-win32 | FileCheck -check-prefix X64 %s +// RUN: %clang_cc1 -std=c++17 -fms-compatibility-version=19 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=i386-pc-win32 | FileCheck %s +// RUN: %clang_cc1 -std=c++17 -fms-compatibility-version=19 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=x86_64-pc-win32 | FileCheck -check-prefix X64 %s template class Class { -- 2.40.0