vedgy added a comment.

I have implemented the setter for the new option locally and tested it in 
KDevelop.

  void clang_CXIndex_setStorePreamblesInMemory(CXIndex CIdx,
                                               int storePreamblesInMemory) {
    if (CIdx)
      static_cast<CIndexer *>(CIdx)->setStorePreamblesInMemory(
          storePreamblesInMemory);
  }

Works as expected: new preambles are created in memory or the temporary 
directory depending on the option selected in the UI. Even if the temporary 
storage option ends up in memory, all remaining preambles are removed from the 
temporary directory on exit.

This simple setter approach was rejected in recent comments under D143418 
<https://reviews.llvm.org/D143418> for valid reasons. But this quick test 
proves that changing the option on the fly is viable. Currently I don't think 
that the option change taking effect without restarting KDevelop justifies the 
effort of implementing the setter as `clang_parseTranslationUnitWithOptions()`. 
I expect this option's value to be changed very rarely. So I don't plan to 
change preamble storage API after this review.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145974/new/

https://reviews.llvm.org/D145974

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to