summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2013-07-24 22:58:51 +0000
committerFariborz Jahanian <fjahanian@apple.com>2013-07-24 22:58:51 +0000
commitb64e95f49ea3197fc453c6986adf5f8941a0d104 (patch)
tree3e34c698d888d302f2d933a40c9a199b65a73889 /clang/lib/AST
parentfd50283c3c4be8f46d13ea1aae45de025f3a4e59 (diff)
downloadbcm5719-llvm-b64e95f49ea3197fc453c6986adf5f8941a0d104.tar.gz
bcm5719-llvm-b64e95f49ea3197fc453c6986adf5f8941a0d104.zip
Documentation parsing: if typedef name is being declared
via a macro, try using declaration's starting location. This is improvement over not having a valid location and dropping comment altogether. // rdar://14348912 llvm-svn: 187085
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/ASTContext.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 8a252f8e73b..8e7b13eff08 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -133,8 +133,14 @@ RawComment *ASTContext::getRawCommentForDeclNoCache(const Decl *D) const {
isa<RedeclarableTemplateDecl>(D) ||
isa<ClassTemplateSpecializationDecl>(D))
DeclLoc = D->getLocStart();
- else
+ else {
DeclLoc = D->getLocation();
+ // If location of the typedef name is in a macro, it is because being
+ // declared via a macro. Try using declaration's starting location
+ // as the "declaration location".
+ if (DeclLoc.isMacroID() && isa<TypedefDecl>(D))
+ DeclLoc = D->getLocStart();
+ }
// If the declaration doesn't map directly to a location in a file, we
// can't find the comment.
OpenPOWER on IntegriCloud