diff options
author | Chris Lattner <sabre@nondot.org> | 2009-12-10 00:21:05 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-12-10 00:21:05 +0000 |
commit | 8a9a97a660f7792aed12aceaddf447c260e17ddd (patch) | |
tree | b79b85983ee0563aef19ec4c1c258ab9f2e2cd25 /clang/lib/Parse/RAIIObjectsForParser.h | |
parent | bc49cfed847afa1b8a0aded894ab10811b9c5121 (diff) | |
download | bcm5719-llvm-8a9a97a660f7792aed12aceaddf447c260e17ddd.tar.gz bcm5719-llvm-8a9a97a660f7792aed12aceaddf447c260e17ddd.zip |
rename ExtensionRAIIObject.h -> RAIIObjectsForParser.h
llvm-svn: 91008
Diffstat (limited to 'clang/lib/Parse/RAIIObjectsForParser.h')
-rw-r--r-- | clang/lib/Parse/RAIIObjectsForParser.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/clang/lib/Parse/RAIIObjectsForParser.h b/clang/lib/Parse/RAIIObjectsForParser.h new file mode 100644 index 00000000000..d642da58d50 --- /dev/null +++ b/clang/lib/Parse/RAIIObjectsForParser.h @@ -0,0 +1,41 @@ +//===--- RAIIObjectsForParser.h - RAII helpers for the parser ---*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines and implements the some simple RAII objects that are used +// by the parser to manage bits in recursion. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_PARSE_RAII_OBJECTS_FOR_PARSER_H +#define LLVM_CLANG_PARSE_RAII_OBJECTS_FOR_PARSER_H + +#include "clang/Parse/ParseDiagnostic.h" + +namespace clang { + + /// ExtensionRAIIObject - This saves the state of extension warnings when + /// constructed and disables them. When destructed, it restores them back to + /// the way they used to be. This is used to handle __extension__ in the + /// parser. + class ExtensionRAIIObject { + void operator=(const ExtensionRAIIObject &); // DO NOT IMPLEMENT + ExtensionRAIIObject(const ExtensionRAIIObject&); // DO NOT IMPLEMENT + Diagnostic &Diags; + public: + ExtensionRAIIObject(Diagnostic &diags) : Diags(diags) { + Diags.IncrementAllExtensionsSilenced(); + } + + ~ExtensionRAIIObject() { + Diags.DecrementAllExtensionsSilenced(); + } + }; +} + +#endif |