summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorDavid Goldman <dallasftball@gmail.com>2019-04-04 20:13:22 +0000
committerDavid Goldman <dallasftball@gmail.com>2019-04-04 20:13:22 +0000
commit19d21854e92ed3acdeee17a6c2dd106f9e9dd058 (patch)
tree777c450c969afdf33dbe0c8bd839cd36c637df48 /clang/lib/AST/Decl.cpp
parente028de43cd5fcad19736cd9b3352ef8530419ba9 (diff)
downloadbcm5719-llvm-19d21854e92ed3acdeee17a6c2dd106f9e9dd058.tar.gz
bcm5719-llvm-19d21854e92ed3acdeee17a6c2dd106f9e9dd058.zip
Special case ObjCPropertyDecl for printing
ObjCPropertyDecl should use the category interface as a context similar to what is done for methods. Previously category methods would be printed as `::property`; now they are printed as `Class::property`. llvm-svn: 357720
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r--clang/lib/AST/Decl.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index d197707df42..00014d01115 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -1531,10 +1531,16 @@ void NamedDecl::printQualifiedName(raw_ostream &OS,
const PrintingPolicy &P) const {
const DeclContext *Ctx = getDeclContext();
- // For ObjC methods, look through categories and use the interface as context.
+ // For ObjC methods and properties, look through categories and use the
+ // interface as context.
if (auto *MD = dyn_cast<ObjCMethodDecl>(this))
if (auto *ID = MD->getClassInterface())
Ctx = ID;
+ if (auto *PD = dyn_cast<ObjCPropertyDecl>(this)) {
+ if (auto *MD = PD->getGetterMethodDecl())
+ if (auto *ID = MD->getClassInterface())
+ Ctx = ID;
+ }
if (Ctx->isFunctionOrMethod()) {
printName(OS);
OpenPOWER on IntegriCloud