summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/DeclSpec.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/DeclSpec.cpp')
-rw-r--r--clang/lib/Sema/DeclSpec.cpp39
1 files changed, 14 insertions, 25 deletions
diff --git a/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp
index 292898cbf03..2fad5a18ba6 100644
--- a/clang/lib/Sema/DeclSpec.cpp
+++ b/clang/lib/Sema/DeclSpec.cpp
@@ -1,4 +1,4 @@
-//===- DeclSpec.cpp - Declaration Specifier Semantic Analysis -------------===//
+//===--- DeclSpec.cpp - Declaration Specifier Semantic Analysis -----------===//
//
// The LLVM Compiler Infrastructure
//
@@ -13,36 +13,21 @@
#include "clang/Sema/DeclSpec.h"
#include "clang/AST/ASTContext.h"
-#include "clang/AST/Decl.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/Expr.h"
#include "clang/AST/LocInfoType.h"
-#include "clang/AST/PrettyPrinter.h"
-#include "clang/AST/Type.h"
#include "clang/AST/TypeLoc.h"
-#include "clang/Basic/Diagnostic.h"
-#include "clang/Basic/ExceptionSpecificationType.h"
-#include "clang/Basic/LLVM.h"
#include "clang/Basic/LangOptions.h"
-#include "clang/Basic/OpenCLOptions.h"
-#include "clang/Basic/SourceLocation.h"
-#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
-#include "clang/Sema/AttributeList.h"
#include "clang/Sema/ParsedTemplate.h"
#include "clang/Sema/Sema.h"
#include "clang/Sema/SemaDiagnostic.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
-#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/Casting.h"
-#include "llvm/Support/ErrorHandling.h"
-#include <cassert>
#include <cstring>
-#include <utility>
-
using namespace clang;
+
void UnqualifiedId::setTemplateId(TemplateIdAnnotation *TemplateId) {
assert(TemplateId && "NULL template-id annotation?");
Kind = UnqualifiedIdKind::IK_TemplateId;
@@ -150,14 +135,14 @@ void CXXScopeSpec::Adopt(NestedNameSpecifierLoc Other) {
SourceLocation CXXScopeSpec::getLastQualifierNameLoc() const {
if (!Builder.getRepresentation())
- return {};
+ return SourceLocation();
return Builder.getTemporary().getLocalBeginLoc();
}
NestedNameSpecifierLoc
CXXScopeSpec::getWithLocInContext(ASTContext &Context) const {
if (!Builder.getRepresentation())
- return {};
+ return NestedNameSpecifierLoc();
return Builder.getWithLocInContext(Context);
}
@@ -304,7 +289,7 @@ void Declarator::setDecompositionBindings(
Name.EndLocation = RSquareLoc;
// Allocate storage for bindings and stash them away.
- if (!Bindings.empty()) {
+ if (Bindings.size()) {
if (!InlineStorageUsed &&
Bindings.size() <= llvm::array_lengthof(InlineBindings)) {
BindingGroup.Bindings = InlineBindings;
@@ -321,8 +306,8 @@ void Declarator::setDecompositionBindings(
}
bool Declarator::isDeclarationOfFunction() const {
- for (const auto &i : DeclTypeInfo) {
- switch (i.Kind) {
+ for (unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
+ switch (DeclTypeInfo[i].Kind) {
case DeclaratorChunk::Function:
return true;
case DeclaratorChunk::Paren:
@@ -388,7 +373,7 @@ bool Declarator::isDeclarationOfFunction() const {
if (QT.isNull())
return false;
- if (const auto *LIT = dyn_cast<LocInfoType>(QT))
+ if (const LocInfoType *LIT = dyn_cast<LocInfoType>(QT))
QT = LIT->getType();
if (QT.isNull())
@@ -422,6 +407,7 @@ bool DeclSpec::hasTagDefinition() const {
/// getParsedSpecifiers - Return a bitmask of which flavors of specifiers this
/// declaration specifier includes.
+///
unsigned DeclSpec::getParsedSpecifiers() const {
unsigned Res = 0;
if (StorageClassSpec != SCS_unspecified ||
@@ -496,6 +482,7 @@ const char *DeclSpec::getSpecifierName(TSC C) {
llvm_unreachable("Unknown typespec!");
}
+
const char *DeclSpec::getSpecifierName(TSS S) {
switch (S) {
case TSS_unspecified: return "unspecified";
@@ -790,14 +777,16 @@ bool DeclSpec::SetTypeAltiVecVector(bool isAltiVecVector, SourceLocation Loc,
bool DeclSpec::SetTypePipe(bool isPipe, SourceLocation Loc,
const char *&PrevSpec, unsigned &DiagID,
const PrintingPolicy &Policy) {
+
if (TypeSpecType != TST_unspecified) {
PrevSpec = DeclSpec::getSpecifierName((TST)TypeSpecType, Policy);
DiagID = diag::err_invalid_decl_spec_combination;
return true;
}
- if (isPipe)
+ if (isPipe) {
TypeSpecPipe = TSP_pipe;
+ }
return false;
}
@@ -986,7 +975,7 @@ void DeclSpec::SaveWrittenBuiltinSpecs() {
writtenBS.Type = getTypeSpecType();
// Search the list of attributes for the presence of a mode attribute.
writtenBS.ModeAttr = false;
- AttributeList *attrs = getAttributes().getList();
+ AttributeList* attrs = getAttributes().getList();
while (attrs) {
if (attrs->getKind() == AttributeList::AT_Mode) {
writtenBS.ModeAttr = true;
OpenPOWER on IntegriCloud