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

Alexey Bataev a.bataev at hotmail.com
Tue Sep 30 02:41:28 PDT 2014


Richard, thanks for the review!

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

================
Comment at: lib/AST/Expr.cpp:468
@@ +467,3 @@
+  }
+}
+
----------------
rsmith wrote:
> You need an `llvm_unreachable` here to shut up GCC's `-Wreturn-type`.
Ok, I'll break in case for PrettyFunctionNoVirtual and llvm_unreachable at the end of the method.

================
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)
----------------
rsmith wrote:
> 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.
Ok, I'll return back to StringLiteral then.

http://reviews.llvm.org/D5365






More information about the cfe-commits mailing list