nik updated this revision to Diff 125129. nik added a comment. Rebased only.
Repository: rC Clang https://reviews.llvm.org/D39903 Files: include/clang-c/Index.h test/Index/print-display-names.cpp tools/c-index-test/c-index-test.c tools/libclang/CIndex.cpp tools/libclang/libclang.exports
Index: tools/libclang/libclang.exports =================================================================== --- tools/libclang/libclang.exports +++ tools/libclang/libclang.exports @@ -176,6 +176,8 @@ clang_getCursorCompletionString clang_getCursorDefinition clang_getCursorDisplayName +clang_getCursorPrintingPolicy +clang_getCursorPrettyPrinted clang_getCursorExtent clang_getCursorExceptionSpecificationType clang_getCursorKind @@ -355,3 +357,56 @@ clang_EvalResult_getAsDouble clang_EvalResult_getAsStr clang_EvalResult_dispose +clang_PrintingPolicy_dispose +clang_PrintingPolicy_getIndentation +clang_PrintingPolicy_getSuppressSpecifiers +clang_PrintingPolicy_getSuppressTagKeyword +clang_PrintingPolicy_getIncludeTagDefinition +clang_PrintingPolicy_getSuppressScope +clang_PrintingPolicy_getSuppressUnwrittenScope +clang_PrintingPolicy_getSuppressInitializers +clang_PrintingPolicy_getConstantArraySizeAsWritten +clang_PrintingPolicy_getAnonymousTagLocations +clang_PrintingPolicy_getSuppressStrongLifetime +clang_PrintingPolicy_getSuppressLifetimeQualifiers +clang_PrintingPolicy_getSuppressTemplateArgsInCXXConstructors +clang_PrintingPolicy_getBool +clang_PrintingPolicy_getRestrict +clang_PrintingPolicy_getAlignof +clang_PrintingPolicy_getUnderscoreAlignof +clang_PrintingPolicy_getUseVoidForZeroParams +clang_PrintingPolicy_getTerseOutput +clang_PrintingPolicy_getPolishForDeclaration +clang_PrintingPolicy_getHalf +clang_PrintingPolicy_getMSWChar +clang_PrintingPolicy_getIncludeNewlines +clang_PrintingPolicy_getMSVCFormatting +clang_PrintingPolicy_getConstantsAsWritten +clang_PrintingPolicy_getSuppressImplicitBase +clang_PrintingPolicy_getFullyQualifiedName +clang_PrintingPolicy_setIndentation +clang_PrintingPolicy_setSuppressSpecifiers +clang_PrintingPolicy_setSuppressTagKeyword +clang_PrintingPolicy_setIncludeTagDefinition +clang_PrintingPolicy_setSuppressScope +clang_PrintingPolicy_setSuppressUnwrittenScope +clang_PrintingPolicy_setSuppressInitializers +clang_PrintingPolicy_setConstantArraySizeAsWritten +clang_PrintingPolicy_setAnonymousTagLocations +clang_PrintingPolicy_setSuppressStrongLifetime +clang_PrintingPolicy_setSuppressLifetimeQualifiers +clang_PrintingPolicy_setSuppressTemplateArgsInCXXConstructors +clang_PrintingPolicy_setBool +clang_PrintingPolicy_setRestrict +clang_PrintingPolicy_setAlignof +clang_PrintingPolicy_setUnderscoreAlignof +clang_PrintingPolicy_setUseVoidForZeroParams +clang_PrintingPolicy_setTerseOutput +clang_PrintingPolicy_setPolishForDeclaration +clang_PrintingPolicy_setHalf +clang_PrintingPolicy_setMSWChar +clang_PrintingPolicy_setIncludeNewlines +clang_PrintingPolicy_setMSVCFormatting +clang_PrintingPolicy_setConstantsAsWritten +clang_PrintingPolicy_setSuppressImplicitBase +clang_PrintingPolicy_setFullyQualifiedName Index: tools/libclang/CIndex.cpp =================================================================== --- tools/libclang/CIndex.cpp +++ tools/libclang/CIndex.cpp @@ -4649,6 +4649,107 @@ return cxstring::createSet(Manglings); } +CXPrintingPolicy clang_getCursorPrintingPolicy(CXCursor C) { + if (clang_Cursor_isNull(C)) + return 0; + return new PrintingPolicy(getCursorContext(C).getPrintingPolicy()); +} + +void clang_PrintingPolicy_dispose(CXPrintingPolicy policy) { + if (policy) + delete static_cast<PrintingPolicy *>(policy); +} + +#define DEFINE_PRINTING_POLICY_GETTER(name) \ + unsigned clang_PrintingPolicy_get##name(CXPrintingPolicy policy) { \ + if (!policy) \ + return 0; \ + return static_cast<PrintingPolicy *>(policy)->name; \ + } +DEFINE_PRINTING_POLICY_GETTER(Indentation) +DEFINE_PRINTING_POLICY_GETTER(SuppressSpecifiers) +DEFINE_PRINTING_POLICY_GETTER(SuppressTagKeyword) +DEFINE_PRINTING_POLICY_GETTER(IncludeTagDefinition) +DEFINE_PRINTING_POLICY_GETTER(SuppressScope) +DEFINE_PRINTING_POLICY_GETTER(SuppressUnwrittenScope) +DEFINE_PRINTING_POLICY_GETTER(SuppressInitializers) +DEFINE_PRINTING_POLICY_GETTER(ConstantArraySizeAsWritten) +DEFINE_PRINTING_POLICY_GETTER(AnonymousTagLocations) +DEFINE_PRINTING_POLICY_GETTER(SuppressStrongLifetime) +DEFINE_PRINTING_POLICY_GETTER(SuppressLifetimeQualifiers) +DEFINE_PRINTING_POLICY_GETTER(SuppressTemplateArgsInCXXConstructors) +DEFINE_PRINTING_POLICY_GETTER(Bool) +DEFINE_PRINTING_POLICY_GETTER(Restrict) +DEFINE_PRINTING_POLICY_GETTER(Alignof) +DEFINE_PRINTING_POLICY_GETTER(UnderscoreAlignof) +DEFINE_PRINTING_POLICY_GETTER(UseVoidForZeroParams) +DEFINE_PRINTING_POLICY_GETTER(TerseOutput) +DEFINE_PRINTING_POLICY_GETTER(PolishForDeclaration) +DEFINE_PRINTING_POLICY_GETTER(Half) +DEFINE_PRINTING_POLICY_GETTER(MSWChar) +DEFINE_PRINTING_POLICY_GETTER(IncludeNewlines) +DEFINE_PRINTING_POLICY_GETTER(MSVCFormatting) +DEFINE_PRINTING_POLICY_GETTER(ConstantsAsWritten) +DEFINE_PRINTING_POLICY_GETTER(SuppressImplicitBase) +DEFINE_PRINTING_POLICY_GETTER(FullyQualifiedName) +#undef DEFINE_PRINTING_POLICY_GETTER + +#define DEFINE_PRINTING_POLICY_SETTER(name) \ + void clang_PrintingPolicy_set##name(CXPrintingPolicy policy, \ + unsigned value) { \ + if (!policy) \ + return; \ + static_cast<PrintingPolicy *>(policy)->name = value; \ + } +DEFINE_PRINTING_POLICY_SETTER(Indentation) +DEFINE_PRINTING_POLICY_SETTER(SuppressSpecifiers) +DEFINE_PRINTING_POLICY_SETTER(SuppressTagKeyword) +DEFINE_PRINTING_POLICY_SETTER(IncludeTagDefinition) +DEFINE_PRINTING_POLICY_SETTER(SuppressScope) +DEFINE_PRINTING_POLICY_SETTER(SuppressUnwrittenScope) +DEFINE_PRINTING_POLICY_SETTER(SuppressInitializers) +DEFINE_PRINTING_POLICY_SETTER(ConstantArraySizeAsWritten) +DEFINE_PRINTING_POLICY_SETTER(AnonymousTagLocations) +DEFINE_PRINTING_POLICY_SETTER(SuppressStrongLifetime) +DEFINE_PRINTING_POLICY_SETTER(SuppressLifetimeQualifiers) +DEFINE_PRINTING_POLICY_SETTER(SuppressTemplateArgsInCXXConstructors) +DEFINE_PRINTING_POLICY_SETTER(Bool) +DEFINE_PRINTING_POLICY_SETTER(Restrict) +DEFINE_PRINTING_POLICY_SETTER(Alignof) +DEFINE_PRINTING_POLICY_SETTER(UnderscoreAlignof) +DEFINE_PRINTING_POLICY_SETTER(UseVoidForZeroParams) +DEFINE_PRINTING_POLICY_SETTER(TerseOutput) +DEFINE_PRINTING_POLICY_SETTER(PolishForDeclaration) +DEFINE_PRINTING_POLICY_SETTER(Half) +DEFINE_PRINTING_POLICY_SETTER(MSWChar) +DEFINE_PRINTING_POLICY_SETTER(IncludeNewlines) +DEFINE_PRINTING_POLICY_SETTER(MSVCFormatting) +DEFINE_PRINTING_POLICY_SETTER(ConstantsAsWritten) +DEFINE_PRINTING_POLICY_SETTER(SuppressImplicitBase) +DEFINE_PRINTING_POLICY_SETTER(FullyQualifiedName) +#undef DEFINE_PRINTING_POLICY_SETTER + +CXString clang_getCursorPrettyPrinted(CXCursor C, CXPrintingPolicy cxPolicy) { + if (clang_Cursor_isNull(C)) + return cxstring::createEmpty(); + + if (clang_isDeclaration(C.kind)) { + const Decl *D = getCursorDecl(C); + if (!D) + return cxstring::createEmpty(); + + SmallString<128> Str; + llvm::raw_svector_ostream OS(Str); + PrintingPolicy *UserPolicy = static_cast<PrintingPolicy *>(cxPolicy); + D->print(OS, UserPolicy ? *UserPolicy + : getCursorContext(C).getPrintingPolicy()); + + return cxstring::createDup(OS.str()); + } + + return cxstring::createEmpty(); +} + CXString clang_getCursorDisplayName(CXCursor C) { if (!clang_isDeclaration(C.kind)) return clang_getCursorSpelling(C); Index: tools/c-index-test/c-index-test.c =================================================================== --- tools/c-index-test/c-index-test.c +++ tools/c-index-test/c-index-test.c @@ -86,6 +86,60 @@ return options; } +#define SET_POLICY_FROM_ENV(nameTag, policySetterName) \ + { \ + char *value = getenv("CINDEXTEST_PRINTINGPOLICY_" nameTag); \ + if (value) \ + policySetterName(Policy, (unsigned) strtoul(value, 0L, 10)); \ + } +static void ModifyPrintingPolicyAccordingToEnv(CXPrintingPolicy Policy) { + SET_POLICY_FROM_ENV("INDENTATION", clang_PrintingPolicy_setIndentation); + SET_POLICY_FROM_ENV("SUPPRESSSPECIFIERS", + clang_PrintingPolicy_setSuppressSpecifiers); + SET_POLICY_FROM_ENV("SUPPRESSTAGKEYWORD", + clang_PrintingPolicy_setSuppressTagKeyword); + SET_POLICY_FROM_ENV("INCLUDETAGDEFINITION", + clang_PrintingPolicy_setIncludeTagDefinition); + SET_POLICY_FROM_ENV("SUPPRESSSCOPE", clang_PrintingPolicy_setSuppressScope); + SET_POLICY_FROM_ENV("SUPPRESSUNWRITTENSCOPE", + clang_PrintingPolicy_setSuppressUnwrittenScope); + SET_POLICY_FROM_ENV("SUPPRESSINITIALIZERS", + clang_PrintingPolicy_setSuppressInitializers); + SET_POLICY_FROM_ENV("CONSTANTARRAYSIZEASWRITTEN", + clang_PrintingPolicy_setConstantArraySizeAsWritten); + SET_POLICY_FROM_ENV("ANONYMOUSTAGLOCATIONS", + clang_PrintingPolicy_setAnonymousTagLocations); + SET_POLICY_FROM_ENV("SUPPRESSSTRONGLIFETIME", + clang_PrintingPolicy_setSuppressStrongLifetime); + SET_POLICY_FROM_ENV("SUPPRESSLIFETIMEQUALIFIERS", + clang_PrintingPolicy_setSuppressLifetimeQualifiers); + SET_POLICY_FROM_ENV( + "SUPPRESSTEMPLATEARGSINCXXCONSTRUCTORS", + clang_PrintingPolicy_setSuppressTemplateArgsInCXXConstructors); + SET_POLICY_FROM_ENV("BOOL", clang_PrintingPolicy_setBool); + SET_POLICY_FROM_ENV("RESTRICT", clang_PrintingPolicy_setRestrict); + SET_POLICY_FROM_ENV("ALIGNOF", clang_PrintingPolicy_setAlignof); + SET_POLICY_FROM_ENV("UNDERSCOREALIGNOF", + clang_PrintingPolicy_setUnderscoreAlignof); + SET_POLICY_FROM_ENV("USEVOIDFORZEROPARAMS", + clang_PrintingPolicy_setUseVoidForZeroParams); + SET_POLICY_FROM_ENV("TERSEOUTPUT", clang_PrintingPolicy_setTerseOutput); + SET_POLICY_FROM_ENV("POLISHFORDECLARATION", + clang_PrintingPolicy_setPolishForDeclaration); + SET_POLICY_FROM_ENV("HALF", clang_PrintingPolicy_setHalf); + SET_POLICY_FROM_ENV("MSWCHAR", clang_PrintingPolicy_setMSWChar); + SET_POLICY_FROM_ENV("INCLUDENEWLINES", + clang_PrintingPolicy_setIncludeNewlines); + SET_POLICY_FROM_ENV("MSVCFORMATTING", clang_PrintingPolicy_setMSVCFormatting); + SET_POLICY_FROM_ENV("CONSTANTSASWRITTEN", + clang_PrintingPolicy_setConstantsAsWritten); + SET_POLICY_FROM_ENV("SUPPRESSIMPLICITBASE", + clang_PrintingPolicy_setSuppressImplicitBase); + SET_POLICY_FROM_ENV("FULLYQUALIFIEDNAME", + clang_PrintingPolicy_setFullyQualifiedName); +} +#undef SET_POLICY_FROM_ENV + /** \brief Returns 0 in case of success, non-zero in case of a failure. */ static int checkForErrors(CXTranslationUnit TU); @@ -356,7 +410,11 @@ PrintExtent(stdout, begin_line, begin_column, end_line, end_column); } -int want_display_name = 0; +static enum DisplayType { + DisplayType_Spelling, + DisplayType_DisplayName, + DisplayType_Pretty +} wanted_display_type = DisplayType_Spelling; static void printVersion(const char *Prefix, CXVersion Version) { if (Version.Major < 0) @@ -656,6 +714,26 @@ return (int)lhs->col - (int)rhs->col; } +static CXString CursorToText(CXCursor Cursor) { + CXString text; + + switch (wanted_display_type) { + case DisplayType_Spelling: + return clang_getCursorSpelling(Cursor); + case DisplayType_DisplayName: + return clang_getCursorDisplayName(Cursor); + case DisplayType_Pretty: { + CXPrintingPolicy Policy = clang_getCursorPrintingPolicy(Cursor); + ModifyPrintingPolicyAccordingToEnv(Policy); + text = clang_getCursorPrettyPrinted(Cursor, Policy); + clang_PrintingPolicy_dispose(Policy); + return text; + } + } + + return text; +} + static void PrintCursor(CXCursor Cursor, const char *CommentSchemaFile) { CXTranslationUnit TU = clang_Cursor_getTranslationUnit(Cursor); if (clang_isInvalid(Cursor.kind)) { @@ -682,8 +760,7 @@ int I; ks = clang_getCursorKindSpelling(Cursor.kind); - string = want_display_name? clang_getCursorDisplayName(Cursor) - : clang_getCursorSpelling(Cursor); + string = CursorToText(Cursor); printf("%s=%s", clang_getCString(ks), clang_getCString(string)); clang_disposeString(ks); @@ -1682,7 +1759,12 @@ else if (!strcmp(filter, "all-display") || !strcmp(filter, "local-display")) { ck = NULL; - want_display_name = 1; + wanted_display_type = DisplayType_DisplayName; + } + else if (!strcmp(filter, "all-pretty") || + !strcmp(filter, "local-pretty")) { + ck = NULL; + wanted_display_type = DisplayType_Pretty; } else if (!strcmp(filter, "none")) K = (enum CXCursorKind) ~0; else if (!strcmp(filter, "category")) K = CXCursor_ObjCCategoryDecl; @@ -1749,8 +1831,11 @@ unsigned I; Idx = clang_createIndex(/* excludeDeclsFromPCH */ - (!strcmp(filter, "local") || - !strcmp(filter, "local-display"))? 1 : 0, + (!strcmp(filter, "local") || + !strcmp(filter, "local-display") || + !strcmp(filter, "local-pretty")) + ? 1 + : 0, /* displayDiagnostics=*/1); if ((CommentSchemaFile = parse_comments_schema(argc, argv))) { Index: test/Index/print-display-names.cpp =================================================================== --- test/Index/print-display-names.cpp +++ test/Index/print-display-names.cpp @@ -12,9 +12,20 @@ template<> void g<int>(ClassTmpl<int, int>); -// RUN: c-index-test -test-load-source all-display %s | FileCheck %s -// CHECK: print-display-names.cpp:2:7: ClassTemplate=ClassTmpl<T, typename>:2:7 -// CHECK: print-display-names.cpp:6:16: ClassDecl=ClassTmpl<Integer, Integer>:6:16 (Definition) -// CHECK: print-display-names.cpp:8:6: FunctionDecl=f(ClassTmpl<float, Integer>):8:6 -// CHECK: print-display-names.cpp:11:6: FunctionTemplate=g(ClassTmpl<T, T>):11:6 -// CHECK: print-display-names.cpp:13:17: FunctionDecl=g<>(ClassTmpl<int, int>):13:17 [Specialization of g:11:6] +// RUN: c-index-test -test-load-source all-display %s | FileCheck %s --check-prefix=DISPLAY_NAME +// DISPLAY_NAME: print-display-names.cpp:2:7: ClassTemplate=ClassTmpl<T, typename>:2:7 +// DISPLAY_NAME: print-display-names.cpp:6:16: ClassDecl=ClassTmpl<Integer, Integer>:6:16 (Definition) +// DISPLAY_NAME: print-display-names.cpp:8:6: FunctionDecl=f(ClassTmpl<float, Integer>):8:6 +// DISPLAY_NAME: print-display-names.cpp:11:6: FunctionTemplate=g(ClassTmpl<T, T>):11:6 +// DISPLAY_NAME: print-display-names.cpp:13:17: FunctionDecl=g<>(ClassTmpl<int, int>):13:17 [Specialization of g:11:6] + +// RUN: env CINDEXTEST_PRINTINGPOLICY_TERSEOUTPUT=1 c-index-test -test-load-source all-pretty %s | FileCheck %s --check-prefix=PRETTY +// PRETTY: print-display-names.cpp:2:7: ClassTemplate=template <typename T, typename > class ClassTmpl {}:2:7 (Definition) Extent=[1:1 - 2:20] +// PRETTY: print-display-names.cpp:4:13: TypedefDecl=typedef int Integer:4:13 (Definition) Extent=[4:1 - 4:20] +// PRETTY: print-display-names.cpp:6:16: ClassDecl=template<> class ClassTmpl<int, int> {}:6:16 (Definition) [Specialization of ClassTmpl:2:7] Extent=[6:1 - 6:43] +// PRETTY: print-display-names.cpp:8:6: FunctionDecl=void f(ClassTmpl<float, Integer> p):8:6 Extent=[8:1 - 8:36] +// PRETTY: print-display-names.cpp:8:34: ParmDecl=ClassTmpl<float, Integer> p:8:34 (Definition) Extent=[8:8 - 8:35] +// PRETTY: print-display-names.cpp:11:6: FunctionTemplate=template <typename T> void g(ClassTmpl<T, T>):11:6 Extent=[10:1 - 11:24] +// PRETTY: print-display-names.cpp:11:23: ParmDecl=ClassTmpl<T, T>:11:23 (Definition) Extent=[11:8 - 11:23] +// PRETTY: print-display-names.cpp:13:17: FunctionDecl=template<> void g<int>(ClassTmpl<int, int>):13:17 [Specialization of g:11:6] [Template arg 0: kind: 1, type: int] Extent=[13:1 - 13:44] +// PRETTY: print-display-names.cpp:13:43: ParmDecl=ClassTmpl<int, int>:13:43 (Definition) Extent=[13:24 - 13:43] Index: include/clang-c/Index.h =================================================================== --- include/clang-c/Index.h +++ include/clang-c/Index.h @@ -32,7 +32,7 @@ * compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable. */ #define CINDEX_VERSION_MAJOR 0 -#define CINDEX_VERSION_MINOR 43 +#define CINDEX_VERSION_MINOR 44 #define CINDEX_VERSION_ENCODE(major, minor) ( \ ((major) * 10000) \ @@ -4056,6 +4056,427 @@ unsigned pieceIndex, unsigned options); +/** + * \brief A policy controlling the pretty printing for e.g. + * \c clang_getCursorPrettyPrinted. + */ +typedef void *CXPrintingPolicy; + +/** + * \brief Retrieve the default policy for the cursor. + * + * The policy should be released after use with \c + * clang_PrintingPolicy_dispose. + */ +CINDEX_LINKAGE CXPrintingPolicy clang_getCursorPrintingPolicy(CXCursor); + +/** + * \brief Release a printing policy. + */ +CINDEX_LINKAGE void clang_PrintingPolicy_dispose(CXPrintingPolicy); + +/** + * \brief Set the Indentation property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +CINDEX_LINKAGE unsigned clang_PrintingPolicy_getIndentation(CXPrintingPolicy); + +/** + * \brief Get the SuppressSpecifiers property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +CINDEX_LINKAGE unsigned + clang_PrintingPolicy_getSuppressSpecifiers(CXPrintingPolicy); + +/** + * \brief Get the SuppressTagKeyword property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +CINDEX_LINKAGE unsigned + clang_PrintingPolicy_getSuppressTagKeyword(CXPrintingPolicy); + +/** + * \brief Get the IncludeTagDefinition property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +CINDEX_LINKAGE unsigned + clang_PrintingPolicy_getIncludeTagDefinition(CXPrintingPolicy); + +/** + * \brief Get the SuppressScope property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +CINDEX_LINKAGE unsigned clang_PrintingPolicy_getSuppressScope(CXPrintingPolicy); + +/** + * \brief Get the SuppressUnwrittenScope property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +CINDEX_LINKAGE unsigned + clang_PrintingPolicy_getSuppressUnwrittenScope(CXPrintingPolicy); + +/** + * \brief Get the SuppressInitializers property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +CINDEX_LINKAGE unsigned + clang_PrintingPolicy_getSuppressInitializers(CXPrintingPolicy); + +/** + * \brief Get the ConstantArraySizeAsWritten property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +CINDEX_LINKAGE unsigned + clang_PrintingPolicy_getConstantArraySizeAsWritten(CXPrintingPolicy); + +/** + * \brief Get the AnonymousTagLocations property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +CINDEX_LINKAGE unsigned + clang_PrintingPolicy_getAnonymousTagLocations(CXPrintingPolicy); + +/** + * \brief Get the SuppressStrongLifetime property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +CINDEX_LINKAGE unsigned + clang_PrintingPolicy_getSuppressStrongLifetime(CXPrintingPolicy); + +/** + * \brief Get the SuppressLifetimeQualifiers property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +CINDEX_LINKAGE unsigned + clang_PrintingPolicy_getSuppressLifetimeQualifiers(CXPrintingPolicy); + +/** + * \brief Get the SuppressTemplateArgsInCXXConstructors property of a + * CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +CINDEX_LINKAGE unsigned + clang_PrintingPolicy_getSuppressTemplateArgsInCXXConstructors( + CXPrintingPolicy); + +/** + * \brief Get the Bool property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +CINDEX_LINKAGE unsigned clang_PrintingPolicy_getBool(CXPrintingPolicy); + +/** + * \brief Get the Restrict property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +CINDEX_LINKAGE unsigned clang_PrintingPolicy_getRestrict(CXPrintingPolicy); + +/** + * \brief Get the Alignof property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +CINDEX_LINKAGE unsigned clang_PrintingPolicy_getAlignof(CXPrintingPolicy); + +/** + * \brief Get the UnderscoreAlignof property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +CINDEX_LINKAGE unsigned + clang_PrintingPolicy_getUnderscoreAlignof(CXPrintingPolicy); + +/** + * \brief Get the UseVoidForZeroParams property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +CINDEX_LINKAGE unsigned + clang_PrintingPolicy_getUseVoidForZeroParams(CXPrintingPolicy); + +/** + * \brief Get the TerseOutput property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +CINDEX_LINKAGE unsigned clang_PrintingPolicy_getTerseOutput(CXPrintingPolicy); + +/** + * \brief Get the PolishForDeclaration property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +CINDEX_LINKAGE unsigned + clang_PrintingPolicy_getPolishForDeclaration(CXPrintingPolicy); + +/** + * \brief Get the Half property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +CINDEX_LINKAGE unsigned clang_PrintingPolicy_getHalf(CXPrintingPolicy); + +/** + * \brief Get the MSWChar property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +CINDEX_LINKAGE unsigned clang_PrintingPolicy_getMSWChar(CXPrintingPolicy); + +/** + * \brief Get the IncludeNewlines property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +CINDEX_LINKAGE unsigned + clang_PrintingPolicy_getIncludeNewlines(CXPrintingPolicy); + +/** + * \brief Get the MSVCFormatting property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +CINDEX_LINKAGE unsigned + clang_PrintingPolicy_getMSVCFormatting(CXPrintingPolicy); + +/** + * \brief Get the ConstantsAsWritten property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +CINDEX_LINKAGE unsigned + clang_PrintingPolicy_getConstantsAsWritten(CXPrintingPolicy); + +/** + * \brief Get the SuppressImplicitBase property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +CINDEX_LINKAGE unsigned + clang_PrintingPolicy_getSuppressImplicitBase(CXPrintingPolicy); + +/** + * \brief Get the FullyQualifiedName property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +CINDEX_LINKAGE unsigned + clang_PrintingPolicy_getFullyQualifiedName(CXPrintingPolicy); + +/** + * \brief Set the Indentation property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +void clang_PrintingPolicy_setIndentation(CXPrintingPolicy, unsigned); + +/** + * \brief Set the SuppressSpecifiers property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +void clang_PrintingPolicy_setSuppressSpecifiers(CXPrintingPolicy, unsigned); + +/** + * \brief Set the SuppressTagKeyword property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +void clang_PrintingPolicy_setSuppressTagKeyword(CXPrintingPolicy, unsigned); + +/** + * \brief Set the IncludeTagDefinition property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +void clang_PrintingPolicy_setIncludeTagDefinition(CXPrintingPolicy, unsigned); + +/** + * \brief Set the SuppressScope property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +void clang_PrintingPolicy_setSuppressScope(CXPrintingPolicy, unsigned); + +/** + * \brief Set the SuppressUnwrittenScope property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +void clang_PrintingPolicy_setSuppressUnwrittenScope(CXPrintingPolicy, unsigned); + +/** + * \brief Set the SuppressInitializers property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +void clang_PrintingPolicy_setSuppressInitializers(CXPrintingPolicy, unsigned); + +/** + * \brief Set the ConstantArraySizeAsWritten property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +void clang_PrintingPolicy_setConstantArraySizeAsWritten(CXPrintingPolicy, + unsigned); + +/** + * \brief Set the AnonymousTagLocations property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +void clang_PrintingPolicy_setAnonymousTagLocations(CXPrintingPolicy, unsigned); + +/** + * \brief Set the SuppressStrongLifetime property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +void clang_PrintingPolicy_setSuppressStrongLifetime(CXPrintingPolicy, unsigned); + +/** + * \brief Set the SuppressLifetimeQualifiers property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +void clang_PrintingPolicy_setSuppressLifetimeQualifiers(CXPrintingPolicy, + unsigned); + +/** + * \brief Set the SuppressTemplateArgsInCXXConstructors property of a + * CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +void clang_PrintingPolicy_setSuppressTemplateArgsInCXXConstructors( + CXPrintingPolicy, unsigned); + +/** + * \brief Set the Bool property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +void clang_PrintingPolicy_setBool(CXPrintingPolicy, unsigned); + +/** + * \brief Set the Restrict property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +void clang_PrintingPolicy_setRestrict(CXPrintingPolicy, unsigned); + +/** + * \brief Set the Alignof property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +void clang_PrintingPolicy_setAlignof(CXPrintingPolicy, unsigned); + +/** + * \brief Set the UnderscoreAlignof property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +void clang_PrintingPolicy_setUnderscoreAlignof(CXPrintingPolicy, unsigned); + +/** + * \brief Set the UseVoidForZeroParams property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +void clang_PrintingPolicy_setUseVoidForZeroParams(CXPrintingPolicy, unsigned); + +/** + * \brief Set the TerseOutput property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +void clang_PrintingPolicy_setTerseOutput(CXPrintingPolicy, unsigned); + +/** + * \brief Set the PolishForDeclaration property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +void clang_PrintingPolicy_setPolishForDeclaration(CXPrintingPolicy, unsigned); + +/** + * \brief Set the Half property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +void clang_PrintingPolicy_setHalf(CXPrintingPolicy, unsigned); + +/** + * \brief Set the MSWChar property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +void clang_PrintingPolicy_setMSWChar(CXPrintingPolicy, unsigned); + +/** + * \brief Set the IncludeNewlines property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +void clang_PrintingPolicy_setIncludeNewlines(CXPrintingPolicy, unsigned); + +/** + * \brief Set the MSVCFormatting property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +void clang_PrintingPolicy_setMSVCFormatting(CXPrintingPolicy, unsigned); + +/** + * \brief Set the ConstantsAsWritten property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +void clang_PrintingPolicy_setConstantsAsWritten(CXPrintingPolicy, unsigned); + +/** + * \brief Set the SuppressImplicitBase property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +void clang_PrintingPolicy_setSuppressImplicitBase(CXPrintingPolicy, unsigned); + +/** + * \brief Set the FullyQualifiedName property of a CXPrintingPolicy. + * + * See \c clang::PrintingPolicy for more information. + */ +void clang_PrintingPolicy_setFullyQualifiedName(CXPrintingPolicy, unsigned); + +/** + * \brief Pretty print declarations. + * + * \param cursor The cursor representing a declaration. + * + * \param policy The policy to control the entities being printed. If + * NULL, a default policy is used. + * + * \returns The pretty printed declaration or the empty string for + * other cursors. + */ +CINDEX_LINKAGE CXString clang_getCursorPrettyPrinted(CXCursor cursor, + CXPrintingPolicy policy); + /** * \brief Retrieve the display name for the entity referenced by this cursor. *
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits