================
@@ -239,13 +239,19 @@ static bool 
parseFileExtensions(llvm::ArrayRef<std::string> AllFileExtensions,
 void ClangTidyContext::setCurrentFile(StringRef File) {
   CurrentFile = std::string(File);
   CurrentOptions = getOptionsForFile(CurrentFile);
-  CheckFilter = std::make_unique<CachedGlobList>(*getOptions().Checks);
-  WarningAsErrorFilter =
-      std::make_unique<CachedGlobList>(*getOptions().WarningsAsErrors);
-  if (!parseFileExtensions(*getOptions().HeaderFileExtensions,
+  CheckFilter = std::make_unique<CachedGlobList>(
+      StringRef(getOptions().Checks.value_or("")));
+  WarningAsErrorFilter = std::make_unique<CachedGlobList>(
+      StringRef(getOptions().WarningsAsErrors.value_or("")));
+  static const std::vector<std::string> EmptyFileExtensions;
+  if (!parseFileExtensions(getOptions().HeaderFileExtensions
----------------
zeyi2 wrote:

I think this is required, rewriting this to:
`if 
(!parseFileExtensions(getOptions().HeaderFileExtensions.value_or(EmptyFileExtensions),...`
causes a test failures, same as the below one.

https://github.com/llvm/llvm-project/pull/170004
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to