================
@@ -3416,6 +3437,27 @@ llvm::DIMacroFile 
*CGDebugInfo::CreateTempMacroFile(llvm::DIMacroFile *Parent,
   return DBuilder.createTempMacroFile(Parent, Line, FName);
 }
 
+llvm::DILocation *CGDebugInfo::CreateTrapFailureMessageFor(
+    llvm::DebugLoc TrapLocation, StringRef Prefix, StringRef FailureMsg) {
+  // Create debug info that describes a fake function whose name is the failure
+  // message.
+  std::string FuncName(Prefix);
+  if (!FailureMsg.empty()) {
+    // A space in the function name identifies this as not being a real 
function
+    // because it's not a valid symbol name.
+    FuncName += ": ";
+    FuncName += FailureMsg;
+  }
+
+  assert(FuncName.size() > 0);
+  assert(FuncName.find(' ') != std::string::npos &&
----------------
delcypher wrote:

@ahatanak 
> I think it means Prefix is required to have a space only when FailureMsg is 
> empty. If FailureMsg is empty, FuncName is the same as Prefix, so the checks 
> seem correct to me. @delcypher is that correct?

The actually intent here was to ensure the artificial function has a space in 
it. That's it, nothing more complicated than that. The check is done on the 
final function name and not earlier so the assert doesn't need to care about 
the prefix.

The origin of requiring a space was based on an off-hand comment (I think) 
@adrian-prantl made a while back to me that having a space in the function name 
(in C at least) would not be a valid function identifier (and therefore 
wouldn't conflict with any existing function).

https://github.com/llvm/llvm-project/pull/79230
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to