diff options
author | Chris Lattner <sabre@nondot.org> | 2009-12-06 19:08:11 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-12-06 19:08:11 +0000 |
commit | a564b17dcc7daf298ffa72cde94630343bf9c31a (patch) | |
tree | 0dc4a8fb090a8b0c5a5bdf663af8d9a1d5347860 /include/clang/Parse/Action.h | |
parent | 5d1c6198cfe55f8de025902c621c0721b640ff60 (diff) |
implement PR4451, improving error recovery for a mistaken : where a :: was
intended. On the first testcase in the bug, we now produce:
cxx-decl.cpp:12:2: error: unexpected ':' in nested name specifier
y:a a2;
^
::
instead of:
t.cc:8:1: error: C++ requires a type specifier for all declarations
x:a a2;
^
t.cc:8:2: error: invalid token after top level declarator
x:a a2;
^
;
t.cc:9:11: error: use of undeclared identifier 'a2'
x::a a3 = a2;
^
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90713 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Parse/Action.h')
-rw-r--r-- | include/clang/Parse/Action.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/clang/Parse/Action.h b/include/clang/Parse/Action.h index fc56cc6847..200bd8a6b2 100644 --- a/include/clang/Parse/Action.h +++ b/include/clang/Parse/Action.h @@ -334,6 +334,20 @@ public: bool EnteringContext) { return 0; } + + /// IsInvalidUnlessNestedName - This method is used for error recovery + /// purposes to determine whether the specified identifier is only valid as + /// a nested name specifier, for example a namespace name. It is + /// conservatively correct to always return false from this method. + /// + /// The arguments are the same as those passed to ActOnCXXNestedNameSpecifier. + virtual bool IsInvalidUnlessNestedName(Scope *S, + const CXXScopeSpec &SS, + IdentifierInfo &II, + TypeTy *ObjectType, + bool EnteringContext) { + return false; + } /// ActOnCXXNestedNameSpecifier - Called during parsing of a /// nested-name-specifier that involves a template-id, e.g., |