@@ -984,34 +984,26 @@ static std::optional<CXXStandardLibraryVersionInfo>
984984getCXXStandardLibraryVersion (Preprocessor &PP, StringRef MacroName,
985985 CXXStandardLibraryVersionInfo::Library Lib) {
986986 MacroInfo *Macro = PP.getMacroInfo (PP.getIdentifierInfo (MacroName));
987- if (!Macro)
987+ if (!Macro || Macro-> getNumTokens () != 1 || !Macro-> isObjectLike () )
988988 return std::nullopt ;
989989
990- if (Macro->getNumTokens () != 1 || !Macro->isObjectLike ()) {
991- Macro->dump ();
992- return std::nullopt ;
993- }
994-
995990 const Token &RevisionDateTok = Macro->getReplacementToken (0 );
996991
997992 bool Invalid = false ;
998993 llvm::SmallVector<char , 10 > Buffer;
999994 llvm::StringRef RevisionDate =
1000995 PP.getSpelling (RevisionDateTok, Buffer, &Invalid);
1001996 if (!Invalid) {
1002- llvm::errs () << RevisionDate << " \n " ;
1003- unsigned Value;
997+ std::uint64_t Value;
1004998 // We don't use NumericParser to avoid diagnostics
1005- if (!RevisionDate.consumeInteger (10 , Value)) {
1006- llvm::errs () << " Value:" << Value << " \n " ;
999+ if (!RevisionDate.consumeInteger (10 , Value))
10071000 return CXXStandardLibraryVersionInfo{Lib, Value};
1008- }
10091001 }
10101002 return CXXStandardLibraryVersionInfo{CXXStandardLibraryVersionInfo::Unknown,
10111003 0 };
10121004}
10131005
1014- std::optional<unsigned > Preprocessor::getStdLibCxxVersion () {
1006+ std::optional<uint64_t > Preprocessor::getStdLibCxxVersion () {
10151007 if (!CXXStandardLibraryVersion)
10161008 CXXStandardLibraryVersion = getCXXStandardLibraryVersion (
10171009 *this , " __GLIBCXX__" , CXXStandardLibraryVersionInfo::LibStdCXX);
@@ -1024,10 +1016,10 @@ std::optional<unsigned> Preprocessor::getStdLibCxxVersion() {
10241016 return std::nullopt ;
10251017}
10261018
1027- bool Preprocessor::NeedsStdLibCxxWorkaroundBefore (unsigned FixedVersion) {
1019+ bool Preprocessor::NeedsStdLibCxxWorkaroundBefore (uint64_t FixedVersion) {
10281020 assert (FixedVersion >= 2000'00'00 && FixedVersion <= 2100'00'00 &&
10291021 " invalid value for __GLIBCXX__" );
1030- std::optional<unsigned > Ver = getStdLibCxxVersion ();
1022+ std::optional<std:: uint64_t > Ver = getStdLibCxxVersion ();
10311023 if (!Ver)
10321024 return false ;
10331025 return *Ver < FixedVersion;
0 commit comments