diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-05-25 21:41:55 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-05-25 21:41:55 +0000 |
commit | d8e8a58ee35ab334ab9d0c2154dca029c1822e8a (patch) | |
tree | d0abce441b16aab4f55cfcfa09fe3ae6daa68f92 /include | |
parent | 3458d43b68cc2fd1cb2b2304614e1dc3419820d8 (diff) |
Only enable code patterns (e.g., try { statements } catch (...) {
statements }) in the code-completion results if explicitly requested.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104637 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/Driver/CC1Options.td | 2 | ||||
-rw-r--r-- | include/clang/Frontend/CompilerInstance.h | 2 | ||||
-rw-r--r-- | include/clang/Frontend/FrontendOptions.h | 3 | ||||
-rw-r--r-- | include/clang/Sema/CodeCompleteConsumer.h | 22 |
4 files changed, 22 insertions, 7 deletions
diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td index 892868d74c..d7079bb933 100644 --- a/include/clang/Driver/CC1Options.td +++ b/include/clang/Driver/CC1Options.td @@ -243,6 +243,8 @@ def no_code_completion_debug_printer : Flag<"-no-code-completion-debug-printer"> HelpText<"Don't use the \"debug\" code-completion print">; def code_completion_macros : Flag<"-code-completion-macros">, HelpText<"Include macros in code-completion results">; +def code_completion_patterns : Flag<"-code-completion-patterns">, + HelpText<"Include code patterns in code-completion results">; def disable_free : Flag<"-disable-free">, HelpText<"Disable freeing of memory on exit">; def help : Flag<"-help">, diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index 36720c9d14..06dc8004a6 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -519,7 +519,7 @@ public: createCodeCompletionConsumer(Preprocessor &PP, const std::string &Filename, unsigned Line, unsigned Column, bool UseDebugPrinter, bool ShowMacros, - llvm::raw_ostream &OS); + bool ShowCodePatterns, llvm::raw_ostream &OS); /// Create the frontend timer and replace any existing one with it. void createFrontendTimer(); diff --git a/include/clang/Frontend/FrontendOptions.h b/include/clang/Frontend/FrontendOptions.h index a545ac5978..c43e680009 100644 --- a/include/clang/Frontend/FrontendOptions.h +++ b/include/clang/Frontend/FrontendOptions.h @@ -79,6 +79,8 @@ public: unsigned ShowHelp : 1; ///< Show the -help text. unsigned ShowMacrosInCodeCompletion : 1; ///< Show macros in code completion /// results. + unsigned ShowCodePatternsInCodeCompletion : 1; ///< Show code patterns in code + /// completion results. unsigned ShowStats : 1; ///< Show frontend performance /// metrics and statistics. unsigned ShowTimers : 1; ///< Show timers for individual @@ -125,6 +127,7 @@ public: RelocatablePCH = 0; ShowHelp = 0; ShowMacrosInCodeCompletion = 0; + ShowCodePatternsInCodeCompletion = 0; ShowStats = 0; ShowTimers = 0; ShowVersion = 0; diff --git a/include/clang/Sema/CodeCompleteConsumer.h b/include/clang/Sema/CodeCompleteConsumer.h index 348917a7d0..0e3a5038fb 100644 --- a/include/clang/Sema/CodeCompleteConsumer.h +++ b/include/clang/Sema/CodeCompleteConsumer.h @@ -246,6 +246,10 @@ protected: /// \brief Whether to include macros in the code-completion results. bool IncludeMacros; + /// \brief Whether to include code patterns (such as for loops) within + /// the completion results. + bool IncludeCodePatterns; + /// \brief Whether the output format for the code-completion consumer is /// binary. bool OutputIsBinary; @@ -420,12 +424,17 @@ public: CodeCompleteConsumer() : IncludeMacros(false), OutputIsBinary(false) { } - CodeCompleteConsumer(bool IncludeMacros, bool OutputIsBinary) - : IncludeMacros(IncludeMacros), OutputIsBinary(OutputIsBinary) { } + CodeCompleteConsumer(bool IncludeMacros, bool IncludeCodePatterns, + bool OutputIsBinary) + : IncludeMacros(IncludeMacros), IncludeCodePatterns(IncludeCodePatterns), + OutputIsBinary(OutputIsBinary) { } /// \brief Whether the code-completion consumer wants to see macros. bool includeMacros() const { return IncludeMacros; } + /// \brief Whether the code-completion consumer wants to see code patterns. + bool includeCodePatterns() const { return IncludeCodePatterns; } + /// \brief Determine whether the output of this consumer is binary. bool isOutputBinary() const { return OutputIsBinary; } @@ -461,9 +470,9 @@ class PrintingCodeCompleteConsumer : public CodeCompleteConsumer { public: /// \brief Create a new printing code-completion consumer that prints its /// results to the given raw output stream. - PrintingCodeCompleteConsumer(bool IncludeMacros, + PrintingCodeCompleteConsumer(bool IncludeMacros, bool IncludeCodePatterns, llvm::raw_ostream &OS) - : CodeCompleteConsumer(IncludeMacros, false), OS(OS) { } + : CodeCompleteConsumer(IncludeMacros, IncludeCodePatterns, false), OS(OS) {} /// \brief Prints the finalized code-completion results. virtual void ProcessCodeCompleteResults(Sema &S, Result *Results, @@ -484,8 +493,9 @@ public: /// \brief Create a new CIndex code-completion consumer that prints its /// results to the given raw output stream in a format readable to the CIndex /// library. - CIndexCodeCompleteConsumer(bool IncludeMacros, llvm::raw_ostream &OS) - : CodeCompleteConsumer(IncludeMacros, true), OS(OS) { } + CIndexCodeCompleteConsumer(bool IncludeMacros, bool IncludeCodePatterns, + llvm::raw_ostream &OS) + : CodeCompleteConsumer(IncludeMacros, IncludeCodePatterns, true), OS(OS) {} /// \brief Prints the finalized code-completion results. virtual void ProcessCodeCompleteResults(Sema &S, Result *Results, |