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.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 829bc9a1046..63501d92915 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -6085,6 +6085,14 @@ static void handleDestroyAttr(Sema &S, Decl *D, const ParsedAttr &A) {
handleSimpleAttributeWithExclusions<NoDestroyAttr, AlwaysDestroyAttr>(S, D, A);
}
+static void handleUninitializedAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
+ assert(cast<VarDecl>(D)->getStorageDuration() == SD_Automatic &&
+ "uninitialized is only valid on automatic duration variables");
+ unsigned Index = AL.getAttributeSpellingListIndex();
+ D->addAttr(::new (S.Context)
+ UninitializedAttr(AL.getLoc(), S.Context, Index));
+}
+
//===----------------------------------------------------------------------===//
// Top Level Sema Entry Points
//===----------------------------------------------------------------------===//
@@ -6776,6 +6784,10 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D,
case ParsedAttr::AT_NoDestroy:
handleDestroyAttr(S, D, AL);
break;
+
+ case ParsedAttr::AT_Uninitialized:
+ handleUninitializedAttr(S, D, AL);
+ break;
}
}
OpenPOWER on IntegriCloud