aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-09-27 22:38:19 +0000
committerDouglas Gregor <dgregor@apple.com>2011-09-27 22:38:19 +0000
commit30c42404202d2e2512e51efc6066bd614cfdb5a4 (patch)
tree5ac5699fb4d6d06231673b2e9a4887e4870684fb /lib/AST/ASTContext.cpp
parent3240fe3b715327c8fda6f5a3bc8a092b1fce82a7 (diff)
When 'bool' is not a built-in type but is defined as a macro, print
'bool' rather than '_Bool' within types, to make things a bit more readable. Fixes <rdar://problem/10063263>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140650 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r--lib/AST/ASTContext.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index fa0ebc8a86..9a9c95aa2d 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -231,11 +231,11 @@ ASTContext::ASTContext(LangOptions& LOpts, SourceManager &SM,
BlockDescriptorExtendedType(0), cudaConfigureCallDecl(0),
NullTypeSourceInfo(QualType()),
SourceMgr(SM), LangOpts(LOpts),
- AddrSpaceMap(0), Target(t),
+ AddrSpaceMap(0), Target(t), PrintingPolicy(LOpts),
Idents(idents), Selectors(sels),
BuiltinInfo(builtins),
DeclarationNames(*this),
- ExternalSource(0), Listener(0), PrintingPolicy(LOpts),
+ ExternalSource(0), Listener(0),
LastSDM(0, 0),
UniqueBlockByRefTypeID(0)
{
@@ -4385,7 +4385,7 @@ void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string& S,
= TemplateSpecializationType::PrintTemplateArgumentList(
TemplateArgs.data(),
TemplateArgs.size(),
- (*this).PrintingPolicy);
+ (*this).getPrintingPolicy());
S += TemplateArgsStr;
}
@@ -6475,6 +6475,12 @@ MangleContext *ASTContext::createMangleContext() {
CXXABI::~CXXABI() {}
+PrintingPolicy ASTContext::getPrintingPolicy() const {
+ PrintingPolicy.Bool
+ = LangOpts.Bool || Idents.get("bool").hasMacroDefinition();
+ return PrintingPolicy;
+}
+
size_t ASTContext::getSideTableAllocatedMemory() const {
return ASTRecordLayouts.getMemorySize()
+ llvm::capacity_in_bytes(ObjCLayouts)