[cfe-commits] r84457 - /cfe/trunk/include/clang/AST/Decl.h
Daniel Dunbar
daniel at zuster.org
Sun Oct 18 18:21:12 PDT 2009
Author: ddunbar
Date: Sun Oct 18 20:21:12 2009
New Revision: 84457
URL: http://llvm.org/viewvc/llvm-project?rev=84457&view=rev
Log:
Update NamedDecl::getName() to work for empty names.
- I'm not sure this is ideal, but otherwise clients must be overly careful when handling decl's which can have empty names.
Modified:
cfe/trunk/include/clang/AST/Decl.h
Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=84457&r1=84456&r2=84457&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Sun Oct 18 20:21:12 2009
@@ -100,8 +100,8 @@
/// This requires that the declaration have a name and that it be a simple
/// identifier.
llvm::StringRef getName() const {
- assert(getIdentifier() && "Name is not a simple identifier");
- return getIdentifier()->getName();
+ assert(Name.isIdentifier() && "Name is not a simple identifier");
+ return getIdentifier() ? getIdentifier()->getName() : "";
}
/// getNameAsCString - Get the name of identifier for this declaration as a
@@ -110,8 +110,8 @@
//
// FIXME: Deprecated, move clients to getName().
const char *getNameAsCString() const {
- assert(getIdentifier() && "Name is not a simple identifier");
- return getIdentifier()->getNameStart();
+ assert(Name.isIdentifier() && "Name is not a simple identifier");
+ return getIdentifier() ? getIdentifier()->getNameStart() : "";
}
/// getNameAsString - Get a human-readable name for the declaration, even if
More information about the cfe-commits
mailing list