[FileCollector] Ignore empty paths.
authorJonas Devlieghere <jonas@devlieghere.com>
Wed, 20 Nov 2019 18:38:55 +0000 (10:38 -0800)
committerJonas Devlieghere <jonas@devlieghere.com>
Wed, 20 Nov 2019 18:57:44 +0000 (10:57 -0800)
Don't insert empty strings into the StringSet<> because that triggers an
assert in its implementation.

llvm/include/llvm/Support/FileCollector.h

index 19429bd3e9b471d6a41b281beed242cd83baf88c..079fe3efab9d3353bebaacbfdce455d49b750956 100644 (file)
@@ -46,7 +46,11 @@ public:
 private:
   void addFileImpl(StringRef SrcPath);
 
-  bool markAsSeen(StringRef Path) { return Seen.insert(Path).second; }
+  bool markAsSeen(StringRef Path) {
+    if (Path.empty())
+      return false;
+    return Seen.insert(Path).second;
+  }
 
   bool getRealPath(StringRef SrcPath, SmallVectorImpl<char> &Result);