about summary refs log tree commit diff
path: root/llvm_mode
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-05-07 08:08:20 +0200
committervan Hauser <vh@thc.org>2020-05-07 08:08:20 +0200
commit140053502bd5ce162ab7e6bfbb151494381d704c (patch)
tree6a4718027fc5c3bbc5d0a41ac5dd67670bdc5ceb /llvm_mode
parent01b5aa123df8200f6c071f6ee1f3c05722b12fee (diff)
downloadafl++-140053502bd5ce162ab7e6bfbb151494381d704c.tar.gz
import transform fix into autodict, code-format
Diffstat (limited to 'llvm_mode')
-rw-r--r--llvm_mode/afl-clang-fast.c6
-rw-r--r--llvm_mode/afl-llvm-lto-instrim.so.cc24
-rw-r--r--llvm_mode/afl-llvm-lto-instrumentation.so.cc24
3 files changed, 36 insertions, 18 deletions
diff --git a/llvm_mode/afl-clang-fast.c b/llvm_mode/afl-clang-fast.c
index 1f3463eb..42b02bdd 100644
--- a/llvm_mode/afl-clang-fast.c
+++ b/llvm_mode/afl-clang-fast.c
@@ -716,9 +716,11 @@ int main(int argc, char **argv, char **envp) {
     }
 
   }
-  
+
   if (instrument_opt_mode && lto_mode)
-    FATAL("CTX and NGRAM can not be used in LTO mode (and would make LTO useless)");
+    FATAL(
+        "CTX and NGRAM can not be used in LTO mode (and would make LTO "
+        "useless)");
 
   if (!instrument_opt_mode) {
 
diff --git a/llvm_mode/afl-llvm-lto-instrim.so.cc b/llvm_mode/afl-llvm-lto-instrim.so.cc
index 9fd3e3ec..f862e091 100644
--- a/llvm_mode/afl-llvm-lto-instrim.so.cc
+++ b/llvm_mode/afl-llvm-lto-instrim.so.cc
@@ -346,11 +346,15 @@ struct InsTrimLTO : public ModulePass {
                   if (auto *Var =
                           dyn_cast<GlobalVariable>(Ptr->getOperand(0))) {
 
-                    if (auto *Array = dyn_cast<ConstantDataArray>(
-                            Var->getInitializer())) {
+                    if (Var->hasInitializer()) {
 
-                      HasStr2 = true;
-                      Str2 = Array->getAsString().str();
+                      if (auto *Array = dyn_cast<ConstantDataArray>(
+                              Var->getInitializer())) {
+
+                        HasStr2 = true;
+                        Str2 = Array->getAsString().str();
+
+                      }
 
                     }
 
@@ -419,11 +423,15 @@ struct InsTrimLTO : public ModulePass {
                   if (auto *Var =
                           dyn_cast<GlobalVariable>(Ptr->getOperand(0))) {
 
-                    if (auto *Array = dyn_cast<ConstantDataArray>(
-                            Var->getInitializer())) {
+                    if (Var->hasInitializer()) {
+
+                      if (auto *Array = dyn_cast<ConstantDataArray>(
+                              Var->getInitializer())) {
+
+                        HasStr1 = true;
+                        Str1 = Array->getAsString().str();
 
-                      HasStr1 = true;
-                      Str1 = Array->getAsString().str();
+                      }
 
                     }
 
diff --git a/llvm_mode/afl-llvm-lto-instrumentation.so.cc b/llvm_mode/afl-llvm-lto-instrumentation.so.cc
index 79081d37..0e353fdf 100644
--- a/llvm_mode/afl-llvm-lto-instrumentation.so.cc
+++ b/llvm_mode/afl-llvm-lto-instrumentation.so.cc
@@ -326,11 +326,15 @@ bool AFLLTOPass::runOnModule(Module &M) {
 
                 if (auto *Var = dyn_cast<GlobalVariable>(Ptr->getOperand(0))) {
 
-                  if (auto *Array =
-                          dyn_cast<ConstantDataArray>(Var->getInitializer())) {
+                  if (Var->hasInitializer()) {
 
-                    HasStr2 = true;
-                    Str2 = Array->getAsString().str();
+                    if (auto *Array = dyn_cast<ConstantDataArray>(
+                            Var->getInitializer())) {
+
+                      HasStr2 = true;
+                      Str2 = Array->getAsString().str();
+
+                    }
 
                   }
 
@@ -398,11 +402,15 @@ bool AFLLTOPass::runOnModule(Module &M) {
 
                 if (auto *Var = dyn_cast<GlobalVariable>(Ptr->getOperand(0))) {
 
-                  if (auto *Array =
-                          dyn_cast<ConstantDataArray>(Var->getInitializer())) {
+                  if (Var->hasInitializer()) {
+
+                    if (auto *Array = dyn_cast<ConstantDataArray>(
+                            Var->getInitializer())) {
+
+                      HasStr1 = true;
+                      Str1 = Array->getAsString().str();
 
-                    HasStr1 = true;
-                    Str1 = Array->getAsString().str();
+                    }
 
                   }