[cfe-commits] [PATCH] Speed up parsing of global declarations.
Manuel Klimek
klimek at google.com
Tue Dec 11 05:00:32 PST 2012
- Merge branch 'master' into fix-speed
- Incorperate review feedback.
http://llvm-reviews.chandlerc.com/D197
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D197?vs=480&id=495#toc
Files:
lib/Basic/DiagnosticIDs.cpp
lib/Sema/SemaDecl.cpp
Index: lib/Basic/DiagnosticIDs.cpp
===================================================================
--- lib/Basic/DiagnosticIDs.cpp
+++ lib/Basic/DiagnosticIDs.cpp
@@ -222,12 +222,20 @@
return SFINAE_Report;
}
+/// \brief Cache lookup of the DiagID -> ClassInfo ID mapping.
+static std::pair<unsigned, bool> DiagnosticClassCache[diag::DIAG_UPPER_LIMIT];
+
/// getBuiltinDiagClass - Return the class field of the diagnostic.
///
static unsigned getBuiltinDiagClass(unsigned DiagID) {
+ if (DiagnosticClassCache[DiagID].second) {
+ return DiagnosticClassCache[DiagID].first;
+ }
+ unsigned DiagClass = ~0U;
if (const StaticDiagInfoRec *Info = GetDiagInfo(DiagID))
- return Info->Class;
- return ~0U;
+ DiagClass = Info->Class;
+ DiagnosticClassCache[DiagID] = std::make_pair(DiagClass, true);
+ return DiagClass;
}
//===----------------------------------------------------------------------===//
Index: lib/Sema/SemaDecl.cpp
===================================================================
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -7232,7 +7232,10 @@
}
}
- if (var->isThisDeclarationADefinition() &&
+ if (getDiagnostics().getDiagnosticLevel(
+ diag::warn_missing_variable_declarations,
+ var->getLocation()) &&
+ var->isThisDeclarationADefinition() &&
var->getLinkage() == ExternalLinkage) {
// Find a previous declaration that's not a definition.
VarDecl *prev = var->getPreviousDecl();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D197.2.patch
Type: text/x-patch
Size: 1516 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121211/85ce00c7/attachment.bin>
More information about the cfe-commits
mailing list