[PATCH] Fix for bug 17427 - Assertion failed: "Computed __func__ length differs from type!"

Richard Smith richard at metafoo.co.uk
Mon Sep 29 17:13:52 PDT 2014


================
Comment at: include/clang/AST/Expr.h:1184-1185
@@ +1183,4 @@
+
+  void setIdentType(IdentType IT) { Type = IT; }
+  void setFunctionNameRef(VarDecl *D) { FNRef = D; };
+
----------------
You can delete these and directly set the members from `ASTStmtReader`.

================
Comment at: lib/AST/Expr.cpp:468
@@ +467,3 @@
+  }
+}
+
----------------
You need an `llvm_unreachable` here to shut up GCC's `-Wreturn-type`.

================
Comment at: lib/Sema/SemaExpr.cpp:2969-2973
@@ +2968,7 @@
+    if (ND == nullptr || !DC->containsDecl(ND)) {
+      ND = VarDecl::Create(Context, DC, currentDecl->getLocation(),
+                           currentDecl->getLocation(), Id, ResTy,
+                           Context.getTrivialTypeSourceInfo(ResTy), SC_Static);
+      AddInitializerToDecl(ND, SL, /*DirectInit*/ true,
+                           /*TypeMayContainAuto*/ false);
+      if (S)
----------------
Please remove the static local variable for now; we're discussing this on the standard reflectors and the requirement for this may soon be removed. The above doesn't completely fix the ABI problem anyway (if two compilers did this and came up with different strings, they could give `__func__` different types). Sorry for the change in direction here.

http://reviews.llvm.org/D5365






More information about the cfe-commits mailing list