[llvm] r303694 - Sema: allow imaginary constants via GNU extension if UDL overloads not present.

Tim Northover via llvm-commits llvm-commits at lists.llvm.org
Tue May 23 14:41:50 PDT 2017


Author: tnorthover
Date: Tue May 23 16:41:49 2017
New Revision: 303694

URL: http://llvm.org/viewvc/llvm-project?rev=303694&view=rev
Log:
Sema: allow imaginary constants via GNU extension if UDL overloads not present.

C++14 added user-defined literal support for complex numbers so that you can
write something like "complex<double> val = 2i". However, there is an existing
GNU extension supporting this syntax and interpreting the result as a _Complex
type.

This changes parsing so that such literals are interpreted in terms of C++14's
operators if an overload is present but otherwise falls back to the original
GNU extension.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=303694&r1=303693&r2=303694&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Tue May 23 16:41:49 2017
@@ -2394,9 +2394,12 @@ void SelectionDAGBuilder::visitIndirectB
 }
 
 void SelectionDAGBuilder::visitUnreachable(const UnreachableInst &I) {
-  if (DAG.getTarget().Options.TrapUnreachable)
+  errs() << "WARNING: trap\n";
+  if (DAG.getTarget().Options.TrapUnreachable) {
     DAG.setRoot(
         DAG.getNode(ISD::TRAP, getCurSDLoc(), MVT::Other, DAG.getRoot()));
+
+  }
 }
 
 void SelectionDAGBuilder::visitFSub(const User &I) {




More information about the llvm-commits mailing list