Phase 2 of making the Decl class more lightweight...
Move Identifier/Loc instance variables (and associated getters/setters) down from Decl to ScopedDecl/FieldDecl.
Objc AST's can now inherit from Decl without getting instance variables and types that are C specific. For now, I am keeping NextDeclarator, since I believe it may be useful to ObjC. If not, it can be moved later.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41934 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/Decl.cpp b/AST/Decl.cpp
index e845329..4b668c2 100644
--- a/AST/Decl.cpp
+++ b/AST/Decl.cpp
@@ -112,7 +112,13 @@
Decl::~Decl() {
}
-const char *Decl::getName() const {
+const char *FieldDecl::getName() const {
+ if (const IdentifierInfo *II = getIdentifier())
+ return II->getName();
+ return "";
+}
+
+const char *ScopedDecl::getName() const {
if (const IdentifierInfo *II = getIdentifier())
return II->getName();
return "";