diff options
Diffstat (limited to 'include/clang/Lex')
-rw-r--r-- | include/clang/Lex/PPCallbacks.h | 8 | ||||
-rw-r--r-- | include/clang/Lex/PTHManager.h | 1 | ||||
-rw-r--r-- | include/clang/Lex/Preprocessor.h | 18 |
3 files changed, 19 insertions, 8 deletions
diff --git a/include/clang/Lex/PPCallbacks.h b/include/clang/Lex/PPCallbacks.h index 987d6167c6..19e8521ea1 100644 --- a/include/clang/Lex/PPCallbacks.h +++ b/include/clang/Lex/PPCallbacks.h @@ -16,6 +16,7 @@ #include "clang/Lex/DirectoryLookup.h" #include "clang/Basic/SourceLocation.h" +#include "clang/Basic/DiagnosticIDs.h" #include "llvm/ADT/StringRef.h" #include <string> @@ -157,10 +158,9 @@ public: } /// PragmaDiagnostic - This callback is invoked when a - /// #pragma gcc diagnostic directive is read. - /// Mapping is an element of the diag::Mapping enum. + /// #pragma gcc dianostic directive is read. virtual void PragmaDiagnostic(SourceLocation Loc, StringRef Namespace, - unsigned mapping, StringRef Str) { + diag::Mapping mapping, StringRef Str) { } /// MacroExpands - This is called by @@ -303,7 +303,7 @@ public: } virtual void PragmaDiagnostic(SourceLocation Loc, StringRef Namespace, - unsigned mapping, StringRef Str) { + diag::Mapping mapping, StringRef Str) { First->PragmaDiagnostic(Loc, Namespace, mapping, Str); Second->PragmaDiagnostic(Loc, Namespace, mapping, Str); } diff --git a/include/clang/Lex/PTHManager.h b/include/clang/Lex/PTHManager.h index 6ae3a7167e..25a49038a8 100644 --- a/include/clang/Lex/PTHManager.h +++ b/include/clang/Lex/PTHManager.h @@ -17,6 +17,7 @@ #include "clang/Lex/PTHLexer.h" #include "clang/Basic/LangOptions.h" #include "clang/Basic/IdentifierTable.h" +#include "clang/Basic/Diagnostic.h" #include "llvm/ADT/DenseMap.h" #include "llvm/Support/Allocator.h" #include <string> diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h index 77dc2348a5..9c3b64abb0 100644 --- a/include/clang/Lex/Preprocessor.h +++ b/include/clang/Lex/Preprocessor.h @@ -21,6 +21,7 @@ #include "clang/Lex/TokenLexer.h" #include "clang/Lex/PTHManager.h" #include "clang/Basic/Builtins.h" +#include "clang/Basic/Diagnostic.h" #include "clang/Basic/IdentifierTable.h" #include "clang/Basic/SourceLocation.h" #include "llvm/ADT/DenseMap.h" @@ -60,7 +61,7 @@ class ModuleLoader; /// like the #include stack, token expansion, etc. /// class Preprocessor : public llvm::RefCountedBase<Preprocessor> { - DiagnosticsEngine *Diags; + DiagnosticsEngine *Diags; LangOptions &Features; const TargetInfo *Target; FileManager &FileMgr; @@ -728,7 +729,12 @@ public: bool isCodeCompletionReached() const { return CodeCompletionReached; } /// \brief Note that we hit the code-completion point. - void setCodeCompletionReached(); + void setCodeCompletionReached() { + assert(isCodeCompletionEnabled() && "Code-completion not enabled!"); + CodeCompletionReached = true; + // Silence any diagnostics that occur after we hit the code-completion. + getDiagnostics().setSuppressAllDiagnostics(true); + } /// \brief The location of the currently-active #pragma clang /// arc_cf_code_audited begin. Returns an invalid location if there @@ -758,9 +764,13 @@ public: /// Diag - Forwarding function for diagnostics. This emits a diagnostic at /// the specified Token's location, translating the token's start /// position in the current buffer into a SourcePosition object for rendering. - DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID) const; + DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID) const { + return Diags->Report(Loc, DiagID); + } - DiagnosticBuilder Diag(const Token &Tok, unsigned DiagID) const; + DiagnosticBuilder Diag(const Token &Tok, unsigned DiagID) const { + return Diags->Report(Tok.getLocation(), DiagID); + } /// getSpelling() - Return the 'spelling' of the token at the given /// location; does not go up to the spelling location or down to the |