}
void Generic_GCC::GCCInstallationDetector::print(raw_ostream &OS) const {
- for (SmallVectorImpl<std::string>::const_iterator
+ for (std::set<std::string>::const_iterator
I = CandidateGCCInstallPaths.begin(),
E = CandidateGCCInstallPaths.end();
I != E; ++I)
llvm::error_code EC;
for (llvm::sys::fs::directory_iterator LI(LibDir + LibSuffix, EC), LE;
!EC && LI != LE; LI = LI.increment(EC)) {
- CandidateGCCInstallPaths.push_back(LI->path());
StringRef VersionText = llvm::sys::path::filename(LI->path());
GCCVersion CandidateVersion = GCCVersion::Parse(VersionText);
+ if (CandidateVersion.Major != -1) // Filter obviously bad entries.
+ if (!CandidateGCCInstallPaths.insert(LI->path()).second)
+ continue; // Saw this path before; no need to look at it again.
if (CandidateVersion.isOlderThan(4, 1, 1))
continue;
if (CandidateVersion <= Version)
#include "clang/Driver/ToolChain.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/Compiler.h"
-
#include <vector>
+#include <set>
namespace clang {
namespace driver {
// We retain the list of install paths that were considered and rejected in
// order to print out detailed information in verbose mode.
- SmallVector<std::string, 4> CandidateGCCInstallPaths;
+ std::set<std::string> CandidateGCCInstallPaths;
public:
GCCInstallationDetector(const Driver &D, const llvm::Triple &TargetTriple,