chris.laplante created this revision.
chris.laplante added a reviewer: krememek.
Herald added subscribers: cfe-commits, Charusso, dkrupp, donat.nagy, Szelethus, 
dexonsmith, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun.
Herald added a project: clang.

Current code assumes flags in CompilerLinkerOptionMap don't use =.


Repository:
  rC Clang

https://reviews.llvm.org/D66569

Files:
  clang/tools/scan-build/libexec/ccc-analyzer


Index: clang/tools/scan-build/libexec/ccc-analyzer
===================================================================
--- clang/tools/scan-build/libexec/ccc-analyzer
+++ clang/tools/scan-build/libexec/ccc-analyzer
@@ -498,7 +498,8 @@
 # Process the arguments.
 foreach (my $i = 0; $i < scalar(@ARGV); ++$i) {
   my $Arg = $ARGV[$i];
-  my ($ArgKey) = split /=/,$Arg,2;
+  my @ArgParts = split /=/,$Arg,2;
+  my $ArgKey = @ArgParts[0];
 
   # Be friendly to "" in the argument list.
   if (!defined($ArgKey)) {
@@ -566,10 +567,12 @@
     push @CompileOpts,$Arg;
     push @LinkOpts,$Arg;
 
-    while ($Cnt > 0) {
-      ++$i; --$Cnt;
-      push @CompileOpts, $ARGV[$i];
-      push @LinkOpts, $ARGV[$i];
+    if (scalar @ArgParts == 1) {
+      while ($Cnt > 0) {
+        ++$i; --$Cnt;
+        push @CompileOpts, $ARGV[$i];
+        push @LinkOpts, $ARGV[$i];
+      }
     }
     next;
   }


Index: clang/tools/scan-build/libexec/ccc-analyzer
===================================================================
--- clang/tools/scan-build/libexec/ccc-analyzer
+++ clang/tools/scan-build/libexec/ccc-analyzer
@@ -498,7 +498,8 @@
 # Process the arguments.
 foreach (my $i = 0; $i < scalar(@ARGV); ++$i) {
   my $Arg = $ARGV[$i];
-  my ($ArgKey) = split /=/,$Arg,2;
+  my @ArgParts = split /=/,$Arg,2;
+  my $ArgKey = @ArgParts[0];
 
   # Be friendly to "" in the argument list.
   if (!defined($ArgKey)) {
@@ -566,10 +567,12 @@
     push @CompileOpts,$Arg;
     push @LinkOpts,$Arg;
 
-    while ($Cnt > 0) {
-      ++$i; --$Cnt;
-      push @CompileOpts, $ARGV[$i];
-      push @LinkOpts, $ARGV[$i];
+    if (scalar @ArgParts == 1) {
+      while ($Cnt > 0) {
+        ++$i; --$Cnt;
+        push @CompileOpts, $ARGV[$i];
+        push @LinkOpts, $ARGV[$i];
+      }
     }
     next;
   }
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to