diff options
author | John McCall <rjmccall@apple.com> | 2010-08-20 18:27:03 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-08-20 18:27:03 +0000 |
commit | 8b0666cf7910b9a10f57af8b5597a61e67fe8e89 (patch) | |
tree | ce1c9bee64b70777200c85581ef5307f9434e3e5 /clang/lib/Sema/Action.cpp | |
parent | b145bbaf4b8b7d3ea0997d43d3f1bc65085a6ece (diff) | |
download | bcm5719-llvm-8b0666cf7910b9a10f57af8b5597a61e67fe8e89.tar.gz bcm5719-llvm-8b0666cf7910b9a10f57af8b5597a61e67fe8e89.zip |
Another step in the process of making the parser depend on Sema:
- move DeclSpec &c into the Sema library
- move ParseAST into the Parse library
Reflect this change in a thousand different includes.
Reflect this change in the link orders.
llvm-svn: 111667
Diffstat (limited to 'clang/lib/Sema/Action.cpp')
-rw-r--r-- | clang/lib/Sema/Action.cpp | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/clang/lib/Sema/Action.cpp b/clang/lib/Sema/Action.cpp new file mode 100644 index 00000000000..db0779f8b36 --- /dev/null +++ b/clang/lib/Sema/Action.cpp @@ -0,0 +1,103 @@ +//===--- Action.cpp - Implement the Action class --------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements the Action interface. +// +//===----------------------------------------------------------------------===// + +#include "clang/Sema/DeclSpec.h" +#include "clang/Sema/Scope.h" +#include "clang/Basic/TargetInfo.h" +#include "llvm/Support/Allocator.h" +#include "llvm/Support/RecyclingAllocator.h" +#include "llvm/Support/raw_ostream.h" +using namespace clang; + +void PrettyStackTraceActionsDecl::print(llvm::raw_ostream &OS) const { + if (Loc.isValid()) { + Loc.print(OS, SM); + OS << ": "; + } + OS << Message; + + std::string Name = Actions.getDeclName(TheDecl); + if (!Name.empty()) + OS << " '" << Name << '\''; + + OS << '\n'; +} + +/// Out-of-line virtual destructor to provide home for ActionBase class. +ActionBase::~ActionBase() {} + +/// Out-of-line virtual destructor to provide home for Action class. +Action::~Action() {} + +Action::ObjCMessageKind Action::getObjCMessageKind(Scope *S, + IdentifierInfo *Name, + SourceLocation NameLoc, + bool IsSuper, + bool HasTrailingDot, + TypeTy *&ReceiverType) { + ReceiverType = 0; + + if (IsSuper && !HasTrailingDot && S->isInObjcMethodScope()) + return ObjCSuperMessage; + + if (TypeTy *TyName = getTypeName(*Name, NameLoc, S)) { + DeclSpec DS; + const char *PrevSpec = 0; + unsigned DiagID = 0; + if (!DS.SetTypeSpecType(DeclSpec::TST_typename, NameLoc, PrevSpec, + DiagID, TyName)) { + DS.SetRangeEnd(NameLoc); + Declarator DeclaratorInfo(DS, Declarator::TypeNameContext); + TypeResult Ty = ActOnTypeName(S, DeclaratorInfo); + if (!Ty.isInvalid()) + ReceiverType = Ty.get(); + } + return ObjCClassMessage; + } + + return ObjCInstanceMessage; +} + +// Defined out-of-line here because of dependecy on AttributeList +Action::DeclPtrTy Action::ActOnUsingDirective(Scope *CurScope, + SourceLocation UsingLoc, + SourceLocation NamespcLoc, + CXXScopeSpec &SS, + SourceLocation IdentLoc, + IdentifierInfo *NamespcName, + AttributeList *AttrList) { + + // FIXME: Parser seems to assume that Action::ActOn* takes ownership over + // passed AttributeList, however other actions don't free it, is it + // temporary state or bug? + delete AttrList; + return DeclPtrTy(); +} + +// Defined out-of-line here because of dependency on AttributeList +Action::DeclPtrTy Action::ActOnUsingDeclaration(Scope *CurScope, + AccessSpecifier AS, + bool HasUsingKeyword, + SourceLocation UsingLoc, + CXXScopeSpec &SS, + UnqualifiedId &Name, + AttributeList *AttrList, + bool IsTypeName, + SourceLocation TypenameLoc) { + + // FIXME: Parser seems to assume that Action::ActOn* takes ownership over + // passed AttributeList, however other actions don't free it, is it + // temporary state or bug? + delete AttrList; + return DeclPtrTy(); +} |