fix up syntax errors
[c11llvm.git] / isAtomicCall.hpp
index 11e5e68..99e7532 100644 (file)
@@ -6,12 +6,18 @@ bool isAtomicCall(Instruction *I)
 {
        if ( auto *CI = dyn_cast<CallInst>(I) ) {
                Function *fun = CI->getCalledFunction();
 {
        if ( auto *CI = dyn_cast<CallInst>(I) ) {
                Function *fun = CI->getCalledFunction();
+               if (fun == NULL)
+                       return false;
+
                StringRef funName = fun->getName();
 
                StringRef funName = fun->getName();
 
-               if ( (CI->isTailCall() && funName.contains("atomic_")) ||
-                       funName.contains("atomic_compare_exchange_") ) {
+               // todo: come up with better rules for function name checking
+               if ( funName.contains("atomic_") ) {
                        // printArgs(CI);
                        return true;
                        // printArgs(CI);
                        return true;
+               } else if (funName.contains("atomic") ) {
+                       // errs() << "intercepted atomic calls: " << *I << "\n";
+                       return true;
                }
        }
 
                }
        }