From 7879b5fae258428a5ec6ebe6e3fcf94beac15b99 Mon Sep 17 00:00:00 2001 From: Torok Edwin Date: Thu, 10 Dec 2009 10:01:47 +0000 Subject: [PATCH] Comparing std::string with NULL is a bad idea, so just check whether its empty. This code was crashing always with oprofile enabled, since it tried to create a StringRef out of NULL, which run strlen on NULL. llvm-svn: 91046 --- lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp b/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp index 076e5a0ce7b..52a8f71ca34 100644 --- a/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp +++ b/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp @@ -76,7 +76,7 @@ class FilenameCache { public: const char *getFilename(MDNode *Scope) { std::string &Filename = Filenames[Scope]; - if (Filename == NULL) { + if (Filename.empty()) { DIScope S(Scope); Filename = S.getFilename(); }