Implement semantic analysis for the GNU flexible array initialization
extension. The interaction with designated initializers is a
bit... interesting... but we follow GNU's lead and don't permit too
much crazy code in this area.
Also, make the "excess initializers" error message a bit more
informative.
Addresses PR2561: http://llvm.org/bugs/show_bug.cgi?id=2561
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63785 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index 03a6b3c..028c9eb 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -50,11 +50,13 @@
"Invalid modifier for DeclarationName argument");
} else {
assert(Kind == Diagnostic::ak_nameddecl);
- assert(ModLen == 1 && Modifier[0] == 'q' && ArgLen == 0 &&
+ if (ModLen == 1 && Modifier[0] == 'q' && ArgLen == 0)
+ S = reinterpret_cast<NamedDecl*>(Val)->getQualifiedNameAsString();
+ else {
+ assert(ModLen == 0 && ArgLen == 0 &&
"Invalid modifier for NamedDecl* argument");
-
- S = reinterpret_cast<NamedDecl*>(Val)->getQualifiedNameAsString();
-
+ S = reinterpret_cast<NamedDecl*>(Val)->getNameAsString();
+ }
}
Output.append(S.begin(), S.end());
}