Fix missing snapshot headers.

Bug: 184057288
Test: Run unit tests using:
Test: source build/envsetup.sh
Test: m -j nothing
Change-Id: If7402be9199313f9f03627cad662405b03b5d0fe
diff --git a/cc/library.go b/cc/library.go
index 28e4f61..f459e80 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -504,12 +504,11 @@
 			return
 		}
 		isLibcxx := strings.HasPrefix(dir, "external/libcxx/include")
-		j := 0
-		for i, header := range glob {
+		for _, header := range glob {
 			if isLibcxx {
 				// Glob all files under this special directory, because of C++ headers with no
 				// extension.
-				if !strings.HasSuffix(header, "/") {
+				if strings.HasSuffix(header, "/") {
 					continue
 				}
 			} else {
@@ -525,12 +524,8 @@
 					continue
 				}
 			}
-			if i != j {
-				glob[j] = glob[i]
-			}
-			j++
+			ret = append(ret, android.PathForSource(ctx, header))
 		}
-		glob = glob[:j]
 	}
 
 	// Collect generated headers