[llvm] a9bb669 - [FileCollector] Ignore empty paths.

Jonas Devlieghere via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 20 10:57:59 PST 2019


Author: Jonas Devlieghere
Date: 2019-11-20T10:57:44-08:00
New Revision: a9bb669e59f4b2270caa8a35128ca3b2de0595fe

URL: https://github.com/llvm/llvm-project/commit/a9bb669e59f4b2270caa8a35128ca3b2de0595fe
DIFF: https://github.com/llvm/llvm-project/commit/a9bb669e59f4b2270caa8a35128ca3b2de0595fe.diff

LOG: [FileCollector] Ignore empty paths.

Don't insert empty strings into the StringSet<> because that triggers an
assert in its implementation.

Added: 
    

Modified: 
    llvm/include/llvm/Support/FileCollector.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/FileCollector.h b/llvm/include/llvm/Support/FileCollector.h
index 19429bd3e9b4..079fe3efab9d 100644
--- a/llvm/include/llvm/Support/FileCollector.h
+++ b/llvm/include/llvm/Support/FileCollector.h
@@ -46,7 +46,11 @@ class FileCollector {
 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);
 


        


More information about the llvm-commits mailing list