summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclAttr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclAttr.cpp74
1 files changed, 37 insertions, 37 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 320eabd5ec2..f6caff6b7d2 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -1051,7 +1051,7 @@ static void handleConsumableAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
<< AL.getName() << AANT_ArgumentIdentifier;
return;
}
-
+
D->addAttr(::new (S.Context)
ConsumableAttr(AL.getRange(), S.Context, DefaultState,
AL.getAttributeSpellingListIndex()));
@@ -1061,30 +1061,30 @@ static bool checkForConsumableClass(Sema &S, const CXXMethodDecl *MD,
const ParsedAttr &AL) {
ASTContext &CurrContext = S.getASTContext();
QualType ThisType = MD->getThisType(CurrContext)->getPointeeType();
-
+
if (const CXXRecordDecl *RD = ThisType->getAsCXXRecordDecl()) {
if (!RD->hasAttr<ConsumableAttr>()) {
S.Diag(AL.getLoc(), diag::warn_attr_on_unconsumable_class) <<
RD->getNameAsString();
-
+
return false;
}
}
-
+
return true;
}
static void handleCallableWhenAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
if (!checkAttributeAtLeastNumArgs(S, AL, 1))
return;
-
+
if (!checkForConsumableClass(S, cast<CXXMethodDecl>(D), AL))
return;
-
+
SmallVector<CallableWhenAttr::ConsumedState, 3> States;
for (unsigned ArgIndex = 0; ArgIndex < AL.getNumArgs(); ++ArgIndex) {
CallableWhenAttr::ConsumedState CallableState;
-
+
StringRef StateString;
SourceLocation Loc;
if (AL.isArgIdent(ArgIndex)) {
@@ -1102,10 +1102,10 @@ static void handleCallableWhenAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
<< AL.getName() << StateString;
return;
}
-
+
States.push_back(CallableState);
}
-
+
D->addAttr(::new (S.Context)
CallableWhenAttr(AL.getRange(), S.Context, States.data(),
States.size(), AL.getAttributeSpellingListIndex()));
@@ -1113,7 +1113,7 @@ static void handleCallableWhenAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
static void handleParamTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
ParamTypestateAttr::ConsumedState ParamState;
-
+
if (AL.isArgIdent(0)) {
IdentifierLoc *Ident = AL.getArgAsIdent(0);
StringRef StateString = Ident->Ident->getName();
@@ -1129,7 +1129,7 @@ static void handleParamTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
AL.getName() << AANT_ArgumentIdentifier;
return;
}
-
+
// FIXME: This check is currently being done in the analysis. It can be
// enabled here only after the parser propagates attributes at
// template specialization definition, not declaration.
@@ -1141,7 +1141,7 @@ static void handleParamTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
// ReturnType.getAsString();
// return;
//}
-
+
D->addAttr(::new (S.Context)
ParamTypestateAttr(AL.getRange(), S.Context, ParamState,
AL.getAttributeSpellingListIndex()));
@@ -1149,7 +1149,7 @@ static void handleParamTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
static void handleReturnTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
ReturnTypestateAttr::ConsumedState ReturnState;
-
+
if (AL.isArgIdent(0)) {
IdentifierLoc *IL = AL.getArgAsIdent(0);
if (!ReturnTypestateAttr::ConvertStrToConsumedState(IL->Ident->getName(),
@@ -1163,7 +1163,7 @@ static void handleReturnTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
AL.getName() << AANT_ArgumentIdentifier;
return;
}
-
+
// FIXME: This check is currently being done in the analysis. It can be
// enabled here only after the parser propagates attributes at
// template specialization definition, not declaration.
@@ -1175,9 +1175,9 @@ static void handleReturnTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
//} else if (const CXXConstructorDecl *Constructor =
// dyn_cast<CXXConstructorDecl>(D)) {
// ReturnType = Constructor->getThisType(S.getASTContext())->getPointeeType();
- //
+ //
//} else {
- //
+ //
// ReturnType = cast<FunctionDecl>(D)->getCallResultType();
//}
//
@@ -1197,7 +1197,7 @@ static void handleReturnTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
static void handleSetTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
if (!checkForConsumableClass(S, cast<CXXMethodDecl>(D), AL))
return;
-
+
SetTypestateAttr::ConsumedState NewState;
if (AL.isArgIdent(0)) {
IdentifierLoc *Ident = AL.getArgAsIdent(0);
@@ -1212,7 +1212,7 @@ static void handleSetTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
AL.getName() << AANT_ArgumentIdentifier;
return;
}
-
+
D->addAttr(::new (S.Context)
SetTypestateAttr(AL.getRange(), S.Context, NewState,
AL.getAttributeSpellingListIndex()));
@@ -1221,8 +1221,8 @@ static void handleSetTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
static void handleTestTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
if (!checkForConsumableClass(S, cast<CXXMethodDecl>(D), AL))
return;
-
- TestTypestateAttr::ConsumedState TestState;
+
+ TestTypestateAttr::ConsumedState TestState;
if (AL.isArgIdent(0)) {
IdentifierLoc *Ident = AL.getArgAsIdent(0);
StringRef Param = Ident->Ident->getName();
@@ -1236,7 +1236,7 @@ static void handleTestTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
AL.getName() << AANT_ArgumentIdentifier;
return;
}
-
+
D->addAttr(::new (S.Context)
TestTypestateAttr(AL.getRange(), S.Context, TestState,
AL.getAttributeSpellingListIndex()));
@@ -1980,7 +1980,7 @@ static void handleAnalyzerNoReturnAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
return;
}
}
-
+
D->addAttr(::new (S.Context)
AnalyzerNoReturnAttr(AL.getRange(), S.Context,
AL.getAttributeSpellingListIndex()));
@@ -2343,7 +2343,7 @@ static void handleAvailabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
return;
IdentifierLoc *Platform = AL.getArgAsIdent(0);
unsigned Index = AL.getAttributeSpellingListIndex();
-
+
IdentifierInfo *II = Platform->Ident;
if (AvailabilityAttr::getPrettyPlatformName(II->getName()).empty())
S.Diag(Platform->Loc, diag::warn_availability_unknown_platform)
@@ -2533,7 +2533,7 @@ static void handleVisibilityAttr(Sema &S, Decl *D, const ParsedAttr &AL,
<< AL.getName() << TypeStr;
return;
}
-
+
// Complain about attempts to use protected visibility on targets
// (like Darwin) that don't support it.
if (type == VisibilityAttr::Protected &&
@@ -2604,7 +2604,7 @@ static void handleObjCNSObject(Sema &S, Decl *D, const ParsedAttr &AL) {
// @property (retain, nonatomic) struct Bork *Q __attribute__((NSObject));
//
// In this case it follows tradition and suppresses an error in the above
- // case.
+ // case.
S.Diag(D->getLocation(), diag::warn_nsobject_attribute);
}
D->addAttr(::new (S.Context)
@@ -2752,14 +2752,14 @@ static void handleWarnUnusedResult(Sema &S, Decl *D, const ParsedAttr &AL) {
<< AL.getName() << 1;
return;
}
-
+
// If this is spelled as the standard C++17 attribute, but not in C++17, warn
// about using it as an extension.
if (!S.getLangOpts().CPlusPlus17 && AL.isCXX11Attribute() &&
!AL.getScopeName())
S.Diag(AL.getLoc(), diag::ext_cxx17_attr) << AL.getName();
- D->addAttr(::new (S.Context)
+ D->addAttr(::new (S.Context)
WarnUnusedResultAttr(AL.getRange(), S.Context,
AL.getAttributeSpellingListIndex()));
}
@@ -2892,7 +2892,7 @@ bool Sema::checkSectionName(SourceLocation LiteralLoc, StringRef SecName) {
std::string Error = Context.getTargetInfo().isValidSectionSpecifier(SecName);
if (!Error.empty()) {
Diag(LiteralLoc, diag::err_attribute_section_invalid_for_target) << Error
- << 1 /*'section'*/;
+ << 1 /*'section'*/;
return false;
}
return true;
@@ -3191,7 +3191,7 @@ static void handleInitPriorityAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
S.Diag(AL.getLoc(), diag::warn_attribute_ignored) << AL.getName();
return;
}
-
+
if (S.getCurFunctionOrMethodDecl()) {
S.Diag(AL.getLoc(), diag::err_init_priority_object_attr);
AL.setInvalid();
@@ -3269,10 +3269,10 @@ static void handleFormatAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
// Check for supported formats.
FormatAttrKind Kind = getFormatAttrKind(Format);
-
+
if (Kind == IgnoredFormat)
return;
-
+
if (Kind == InvalidFormat) {
S.Diag(AL.getLoc(), diag::warn_attribute_type_not_supported)
<< AL.getName() << II->getName();
@@ -3454,7 +3454,7 @@ static void handleAnnotateAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
if (I->getAnnotation() == Str)
return;
}
-
+
D->addAttr(::new (S.Context)
AnnotateAttr(AL.getRange(), S.Context, Str,
AL.getAttributeSpellingListIndex()));
@@ -4595,7 +4595,7 @@ static void handleTypeTagForDatatypeAttr(Sema &S, Decl *D,
<< AL.getName() << 1 << AANT_ArgumentIdentifier;
return;
}
-
+
if (!checkAttributeNumArgs(S, AL, 1))
return;
@@ -4819,7 +4819,7 @@ static void handleObjCReturnsInnerPointerAttr(Sema &S, Decl *D,
const ParsedAttr &Attrs) {
const int EP_ObjCMethod = 1;
const int EP_ObjCProperty = 2;
-
+
SourceLocation loc = Attrs.getLoc();
QualType resultType;
if (isa<ObjCMethodDecl>(D))
@@ -4887,7 +4887,7 @@ static void handleObjCBridgeAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
return;
}
}
-
+
D->addAttr(::new (S.Context)
ObjCBridgeAttr(AL.getRange(), S.Context, Parm->Ident,
AL.getAttributeSpellingListIndex()));
@@ -4901,7 +4901,7 @@ static void handleObjCBridgeMutableAttr(Sema &S, Decl *D,
S.Diag(D->getLocStart(), diag::err_objc_attr_not_id) << AL.getName() << 0;
return;
}
-
+
D->addAttr(::new (S.Context)
ObjCBridgeMutableAttr(AL.getRange(), S.Context, Parm->Ident,
AL.getAttributeSpellingListIndex()));
@@ -5195,7 +5195,7 @@ static void handleMSP430InterruptAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
if (!AL.isArgExpr(0)) {
S.Diag(AL.getLoc(), diag::err_attribute_argument_type) << AL.getName()
<< AANT_ArgumentIntegerConstant;
- return;
+ return;
}
// FIXME: Check for decl - it should be void ()(void).
OpenPOWER on IntegriCloud