mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
...rather than a raw pointer that points to a buffer with space for N elements. Just because we *can* get N from context doesn't mean it's convenient/safe. No functionality change. Swift SVN r11488
35 lines
1.2 KiB
C++
35 lines
1.2 KiB
C++
//===--- Attr.cpp - Swift Language Attr ASTs ------------------------------===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See http://swift.org/LICENSE.txt for license information
|
|
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file implements routines relating to declaration attributes.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "swift/AST/Attr.h"
|
|
#include "swift/AST/ASTContext.h"
|
|
#include "swift/AST/Decl.h"
|
|
#include "swift/AST/Module.h"
|
|
#include "swift/AST/Types.h"
|
|
|
|
using namespace swift;
|
|
|
|
/// A statically-allocated empty set of attributes.
|
|
const DeclAttributes Decl::EmptyAttrs;
|
|
|
|
DeclAttributes &Decl::getMutableAttrs() {
|
|
// If we don't have mutable attribute storage yet, allocate some.
|
|
if (&getAttrs() == &EmptyAttrs)
|
|
AttrsAndIsObjC = {getASTContext().Allocate<DeclAttributes>(),
|
|
AttrsAndIsObjC.getInt()};
|
|
return *const_cast<DeclAttributes*>(&getAttrs());
|
|
}
|