[PATCH] D55853: Ignore ConstantExpr in IgnoreParenNoopCasts

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 18 13:56:23 PST 2018


rnk created this revision.
rnk added reviewers: void, rsmith.

It is ignored by IgnoreParenImpCasts, so it seems reasonable to ignore
it here as well. Besides, this preserves behavior from before this AST
node was added.

Fixes PR39881


https://reviews.llvm.org/D55853

Files:
  clang/lib/AST/Expr.cpp
  clang/test/CodeGenCXX/mangle-ms-templates.cpp


Index: clang/test/CodeGenCXX/mangle-ms-templates.cpp
===================================================================
--- clang/test/CodeGenCXX/mangle-ms-templates.cpp
+++ clang/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<typename T>
 class Class {
Index: clang/lib/AST/Expr.cpp
===================================================================
--- clang/lib/AST/Expr.cpp
+++ clang/lib/AST/Expr.cpp
@@ -2719,6 +2719,11 @@
       continue;
     }
 
+    if (ConstantExpr *CE = dyn_cast<ConstantExpr>(E)) {
+      E = CE->getSubExpr();
+      continue;
+    }
+
     return E;
   }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55853.178781.patch
Type: text/x-patch
Size: 1292 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181218/528be9e5/attachment.bin>


More information about the cfe-commits mailing list