[llvm-commits] [llvm] r91046 - /llvm/trunk/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp

Torok Edwin edwintorok at gmail.com
Thu Dec 10 02:01:47 PST 2009


Author: edwin
Date: Thu Dec 10 04:01:47 2009
New Revision: 91046

URL: http://llvm.org/viewvc/llvm-project?rev=91046&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp

Modified: llvm/trunk/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp?rev=91046&r1=91045&r2=91046&view=diff

==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp Thu Dec 10 04:01:47 2009
@@ -76,7 +76,7 @@
  public:
   const char *getFilename(MDNode *Scope) {
     std::string &Filename = Filenames[Scope];
-    if (Filename == NULL) {
+    if (Filename.empty()) {
       DIScope S(Scope);
       Filename = S.getFilename();
     }





More information about the llvm-commits mailing list