Improved error messages for structs.
This change also adds two new tests for anonymous structures (both with and
without an associated typedef). I have also updated test.py to support a more
verbose output for dumping the actual test commands that are executed.
Change-Id: Ic1edc8d4e98c2017611430eb581c335146ccc927
diff --git a/slang_rs_backend.cpp b/slang_rs_backend.cpp
index 332b28e..9430a1e 100644
--- a/slang_rs_backend.cpp
+++ b/slang_rs_backend.cpp
@@ -106,10 +106,11 @@
namespace {
-bool ValidateVar(clang::VarDecl *VD) {
+bool ValidateVar(clang::VarDecl *VD, clang::Diagnostic *Diags,
+ clang::SourceManager *SM) {
llvm::StringRef TypeName;
const clang::Type *T = VD->getType().getTypePtr();
- if (!RSExportType::NormalizeType(T, TypeName)) {
+ if (!RSExportType::NormalizeType(T, TypeName, Diags, SM)) {
return false;
}
return true;
@@ -125,15 +126,8 @@
if (DI->getKind() == clang::Decl::Var) {
clang::VarDecl *VD = (clang::VarDecl*) (*DI);
if (VD->getLinkage() == clang::ExternalLinkage) {
- if (!ValidateVar(VD)) {
+ if (!ValidateVar(VD, &Diags, &C.getSourceManager())) {
valid = false;
- VD = VD->getCanonicalDecl();
- Diags.Report(clang::FullSourceLoc(VD->getLocation(),
- C.getSourceManager()),
- Diags.getCustomDiagID(clang::Diagnostic::Error,
- "variable cannot be "
- "exported: '%0'"))
- << VD->getName();
}
}
}
@@ -142,7 +136,7 @@
return valid;
}
-} // end namespace
+} // namespace
void RSBackend::HandleTranslationUnitPre(clang::ASTContext &C) {
clang::TranslationUnitDecl *TUDecl = C.getTranslationUnitDecl();