saveTranslationUnit: Save a parsed translation unit

View source: R/clangGen.R

saveTranslationUnitR Documentation

Save a parsed translation unit

Description

saveTranslationUnit writes a parsed translation unit into a serialized representation of that translation unit to a file that can then be reread back into memory. In many cases, we can just recreat the translation unit from the source code. However, this provides a way to work without the source code, parser options and command line arguments.

The translation unit needs to have been created without any errors.

We query the set of flags for saving a translation unit via defaultSaveOptions. This is a value we can pass via the options parameter of saveTranslationUnit.

Usage

saveTranslationUnit(TU, FileName, options = 0)
defaultSaveOptions(TU)

Arguments

TU

a translation unit object. This is rarely specified by the caller but created implicitly via createTU.

FileName

the fully-qualified name of the source code file

options

options for saving the translation unit. This is a collection of values fromthe CXSaveTranslationUnit_Flags object, but this is should always be 0 at present

Value

saveTranslationUnit returns a CXSaveError error indicating success or the nature of the error.

defaultSaveOptions returns an integer value.

Author(s)

Duncan Temple Lang

References

libclang http://clang.llvm.org/doxygen/group__CINDEX.html

See Also

createTU


omegahat/RClangSimple documentation built on Jan. 17, 2024, 6:27 p.m.