diff options
Diffstat (limited to 'include/clang/AST/Decl.h')
-rw-r--r-- | include/clang/AST/Decl.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index e134aed73d770..7440e7b5f1508 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -515,10 +515,22 @@ public: objcDeclQualifier = QTVal; } - const Expr *getDefaultArg() const { return DefaultArg; } - Expr *getDefaultArg() { return DefaultArg; } + const Expr *getDefaultArg() const { + assert(!hasUnparsedDefaultArg() && "Default argument is not yet parsed!"); + return DefaultArg; + } + Expr *getDefaultArg() { + assert(!hasUnparsedDefaultArg() && "Default argument is not yet parsed!"); + return DefaultArg; + } void setDefaultArg(Expr *defarg) { DefaultArg = defarg; } + /// hasDefaultArg - Determines whether this parameter has a default argument, + /// either parsed or not. + bool hasDefaultArg() const { + return DefaultArg != 0; + } + /// hasUnparsedDefaultArg - Determines whether this parameter has a /// default argument that has not yet been parsed. This will occur /// during the processing of a C++ class whose member functions have |