[cfe-dev] Diff between createTranslationUnit and parseTranslationUnit?
Douglas Gregor
dgregor at apple.com
Wed Dec 28 06:54:45 PST 2011
On Dec 12, 2011, at 7:13 PM, Seth Willits wrote:
>
> What's the difference between clang_createTranslationUnitFromSourceFile and clang_parseTranslationUnit? The latter obviously has an additional options parameter, but besides that, is there anything? Is parse a superseding method? It's really not clear from the documentation when you would use one versus the other.
>
> I did catch that clang_reparseTranslationUnit's documentation says "The translation unit must originally have been built with clang_createTranslationUnitFromSourceFile." I don't know if that *really* means it couldn't come from clang_parseTranslationUnit, and thus there's some big difference between the two, or it's just a documentation mistake.
>
clang_createTranslationUnitFromSourceFile is the "old" API. It should be documented as deprecated, and eventually removed.
clang_parseTranslationUnit() is the replacement for clang_TranslationUnitFromSourceFile().
- Doug
More information about the cfe-dev
mailing list