summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2011-02-26 22:09:03 +0000
committerdim <dim@FreeBSD.org>2011-02-26 22:09:03 +0000
commita0fb00f9837bd0d2e5948f16f6a6b82a7a628f51 (patch)
treeabae0246ec9156cc1a7cbb947b2b0dfe95fa3189 /tools
parent39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df (diff)
downloadFreeBSD-src-a0fb00f9837bd0d2e5948f16f6a6b82a7a628f51.zip
FreeBSD-src-a0fb00f9837bd0d2e5948f16f6a6b82a7a628f51.tar.gz
Vendor import of clang trunk r126547:
http://llvm.org/svn/llvm-project/cfe/trunk@126547
Diffstat (limited to 'tools')
-rw-r--r--tools/driver/CMakeLists.txt4
-rw-r--r--tools/driver/clang_symlink.cmake11
-rw-r--r--tools/libclang/CIndex.cpp138
-rw-r--r--tools/libclang/CMakeLists.txt14
-rwxr-xr-xtools/scan-build/scan-build117
-rw-r--r--tools/scan-view/ScanView.py2
6 files changed, 237 insertions, 49 deletions
diff --git a/tools/driver/CMakeLists.txt b/tools/driver/CMakeLists.txt
index 6dc47d6..552e7a5 100644
--- a/tools/driver/CMakeLists.txt
+++ b/tools/driver/CMakeLists.txt
@@ -33,6 +33,8 @@ add_clang_executable(clang
cc1as_main.cpp
)
+set_target_properties(clang PROPERTIES VERSION ${CLANG_EXECUTABLE_VERSION})
+
if(UNIX)
set(CLANGXX_LINK_OR_COPY create_symlink)
else()
@@ -46,6 +48,8 @@ add_custom_target(clang++ ALL
"${LLVM_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/clang${CMAKE_EXECUTABLE_SUFFIX}"
"${clang_pp}"
DEPENDS clang)
+set_target_properties(clang++ PROPERTIES FOLDER "Clang executables")
+
set_property(DIRECTORY APPEND
PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${clang_pp})
diff --git a/tools/driver/clang_symlink.cmake b/tools/driver/clang_symlink.cmake
index 40a7482..c7341cb 100644
--- a/tools/driver/clang_symlink.cmake
+++ b/tools/driver/clang_symlink.cmake
@@ -9,9 +9,16 @@ else()
set(CLANGXX_LINK_OR_COPY copy)
endif()
+# CMAKE_EXECUTABLE_SUFFIX is undefined on cmake scripts. See PR9286.
+if( WIN32 )
+ set(EXECUTABLE_SUFFIX ".exe")
+else()
+ set(EXECUTABLE_SUFFIX "")
+endif()
+
set(bindir "${CLANGXX_DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/")
-set(clang "clang${CMAKE_EXECUTABLE_SUFFIX}")
-set(clangxx "clang++${CMAKE_EXECUTABLE_SUFFIX}")
+set(clang "clang${EXECUTABLE_SUFFIX}")
+set(clangxx "clang++${EXECUTABLE_SUFFIX}")
message("Creating clang++ executable based on ${clang}")
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index e2882953..cd1b8d6 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -140,6 +140,7 @@ public:
DeclRefExprPartsKind, LabelRefVisitKind,
ExplicitTemplateArgsVisitKind,
NestedNameSpecifierVisitKind,
+ NestedNameSpecifierLocVisitKind,
DeclarationNameInfoVisitKind,
MemberRefVisitKind, SizeOfPackExprPartsKind };
protected:
@@ -310,6 +311,7 @@ public:
// Name visitor
bool VisitDeclarationNameInfo(DeclarationNameInfo Name);
bool VisitNestedNameSpecifier(NestedNameSpecifier *NNS, SourceRange Range);
+ bool VisitNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS);
// Template visitors
bool VisitTemplateParameters(const TemplateParameterList *Params);
@@ -685,6 +687,11 @@ bool CursorVisitor::VisitDeclaratorDecl(DeclaratorDecl *DD) {
if (Visit(TSInfo->getTypeLoc()))
return true;
+ // Visit the nested-name-specifier, if present.
+ if (NestedNameSpecifierLoc QualifierLoc = DD->getQualifierLoc())
+ if (VisitNestedNameSpecifierLoc(QualifierLoc))
+ return true;
+
return false;
}
@@ -718,8 +725,8 @@ bool CursorVisitor::VisitFunctionDecl(FunctionDecl *ND) {
return true;
// Visit the nested-name-specifier, if present.
- if (NestedNameSpecifier *Qualifier = ND->getQualifier())
- if (VisitNestedNameSpecifier(Qualifier, ND->getQualifierRange()))
+ if (NestedNameSpecifierLoc QualifierLoc = ND->getQualifierLoc())
+ if (VisitNestedNameSpecifierLoc(QualifierLoc))
return true;
// Visit the declaration name.
@@ -1074,8 +1081,8 @@ bool CursorVisitor::VisitNamespaceDecl(NamespaceDecl *D) {
bool CursorVisitor::VisitNamespaceAliasDecl(NamespaceAliasDecl *D) {
// Visit nested-name-specifier.
- if (NestedNameSpecifier *Qualifier = D->getQualifier())
- if (VisitNestedNameSpecifier(Qualifier, D->getQualifierRange()))
+ if (NestedNameSpecifierLoc QualifierLoc = D->getQualifierLoc())
+ if (VisitNestedNameSpecifierLoc(QualifierLoc))
return true;
return Visit(MakeCursorNamespaceRef(D->getAliasedNamespace(),
@@ -1084,9 +1091,10 @@ bool CursorVisitor::VisitNamespaceAliasDecl(NamespaceAliasDecl *D) {
bool CursorVisitor::VisitUsingDecl(UsingDecl *D) {
// Visit nested-name-specifier.
- if (NestedNameSpecifier *Qualifier = D->getTargetNestedNameDecl())
- if (VisitNestedNameSpecifier(Qualifier, D->getNestedNameRange()))
+ if (NestedNameSpecifierLoc QualifierLoc = D->getQualifierLoc()) {
+ if (VisitNestedNameSpecifierLoc(QualifierLoc))
return true;
+ }
if (Visit(MakeCursorOverloadedDeclRef(D, D->getLocation(), TU)))
return true;
@@ -1096,8 +1104,8 @@ bool CursorVisitor::VisitUsingDecl(UsingDecl *D) {
bool CursorVisitor::VisitUsingDirectiveDecl(UsingDirectiveDecl *D) {
// Visit nested-name-specifier.
- if (NestedNameSpecifier *Qualifier = D->getQualifier())
- if (VisitNestedNameSpecifier(Qualifier, D->getQualifierRange()))
+ if (NestedNameSpecifierLoc QualifierLoc = D->getQualifierLoc())
+ if (VisitNestedNameSpecifierLoc(QualifierLoc))
return true;
return Visit(MakeCursorNamespaceRef(D->getNominatedNamespaceAsWritten(),
@@ -1106,9 +1114,10 @@ bool CursorVisitor::VisitUsingDirectiveDecl(UsingDirectiveDecl *D) {
bool CursorVisitor::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) {
// Visit nested-name-specifier.
- if (NestedNameSpecifier *Qualifier = D->getTargetNestedNameSpecifier())
- if (VisitNestedNameSpecifier(Qualifier, D->getTargetNestedNameRange()))
+ if (NestedNameSpecifierLoc QualifierLoc = D->getQualifierLoc()) {
+ if (VisitNestedNameSpecifierLoc(QualifierLoc))
return true;
+ }
return VisitDeclarationNameInfo(D->getNameInfo());
}
@@ -1116,8 +1125,8 @@ bool CursorVisitor::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) {
bool CursorVisitor::VisitUnresolvedUsingTypenameDecl(
UnresolvedUsingTypenameDecl *D) {
// Visit nested-name-specifier.
- if (NestedNameSpecifier *Qualifier = D->getTargetNestedNameSpecifier())
- if (VisitNestedNameSpecifier(Qualifier, D->getTargetNestedNameRange()))
+ if (NestedNameSpecifierLoc QualifierLoc = D->getQualifierLoc())
+ if (VisitNestedNameSpecifierLoc(QualifierLoc))
return true;
return false;
@@ -1163,11 +1172,13 @@ bool CursorVisitor::VisitNestedNameSpecifier(NestedNameSpecifier *NNS,
switch (NNS->getKind()) {
case NestedNameSpecifier::Namespace:
- // FIXME: The token at this source location might actually have been a
- // namespace alias, but we don't model that. Lame!
return Visit(MakeCursorNamespaceRef(NNS->getAsNamespace(), Range.getBegin(),
TU));
+ case NestedNameSpecifier::NamespaceAlias:
+ return Visit(MakeCursorNamespaceRef(NNS->getAsNamespaceAlias(),
+ Range.getBegin(), TU));
+
case NestedNameSpecifier::TypeSpec: {
// If the type has a form where we know that the beginning of the source
// range matches up with a reference cursor. Visit the appropriate reference
@@ -1192,6 +1203,48 @@ bool CursorVisitor::VisitNestedNameSpecifier(NestedNameSpecifier *NNS,
return false;
}
+bool
+CursorVisitor::VisitNestedNameSpecifierLoc(NestedNameSpecifierLoc Qualifier) {
+ llvm::SmallVector<NestedNameSpecifierLoc, 4> Qualifiers;
+ for (; Qualifier; Qualifier = Qualifier.getPrefix())
+ Qualifiers.push_back(Qualifier);
+
+ while (!Qualifiers.empty()) {
+ NestedNameSpecifierLoc Q = Qualifiers.pop_back_val();
+ NestedNameSpecifier *NNS = Q.getNestedNameSpecifier();
+ switch (NNS->getKind()) {
+ case NestedNameSpecifier::Namespace:
+ if (Visit(MakeCursorNamespaceRef(NNS->getAsNamespace(),
+ Q.getLocalBeginLoc(),
+ TU)))
+ return true;
+
+ break;
+
+ case NestedNameSpecifier::NamespaceAlias:
+ if (Visit(MakeCursorNamespaceRef(NNS->getAsNamespaceAlias(),
+ Q.getLocalBeginLoc(),
+ TU)))
+ return true;
+
+ break;
+
+ case NestedNameSpecifier::TypeSpec:
+ case NestedNameSpecifier::TypeSpecWithTemplate:
+ if (Visit(Q.getTypeLoc()))
+ return true;
+
+ break;
+
+ case NestedNameSpecifier::Global:
+ case NestedNameSpecifier::Identifier:
+ break;
+ }
+ }
+
+ return false;
+}
+
bool CursorVisitor::VisitTemplateParameters(
const TemplateParameterList *Params) {
if (!Params)
@@ -1455,6 +1508,11 @@ bool CursorVisitor::VisitPackExpansionTypeLoc(PackExpansionTypeLoc TL) {
}
bool CursorVisitor::VisitCXXRecordDecl(CXXRecordDecl *D) {
+ // Visit the nested-name-specifier, if present.
+ if (NestedNameSpecifierLoc QualifierLoc = D->getQualifierLoc())
+ if (VisitNestedNameSpecifierLoc(QualifierLoc))
+ return true;
+
if (D->isDefinition()) {
for (CXXRecordDecl::base_class_iterator I = D->bases_begin(),
E = D->bases_end(); I != E; ++I) {
@@ -1558,6 +1616,24 @@ public:
return SourceRange(A, B);
}
};
+
+class NestedNameSpecifierLocVisit : public VisitorJob {
+public:
+ NestedNameSpecifierLocVisit(NestedNameSpecifierLoc Qualifier, CXCursor parent)
+ : VisitorJob(parent, VisitorJob::NestedNameSpecifierLocVisitKind,
+ Qualifier.getNestedNameSpecifier(),
+ Qualifier.getOpaqueData()) { }
+
+ static bool classof(const VisitorJob *VJ) {
+ return VJ->getKind() == VisitorJob::NestedNameSpecifierLocVisitKind;
+ }
+
+ NestedNameSpecifierLoc get() const {
+ return NestedNameSpecifierLoc(static_cast<NestedNameSpecifier*>(data[0]),
+ data[1]);
+ }
+};
+
class DeclarationNameInfoVisit : public VisitorJob {
public:
DeclarationNameInfoVisit(Stmt *S, CXCursor parent)
@@ -1640,6 +1716,7 @@ public:
private:
void AddDeclarationNameInfo(Stmt *S);
void AddNestedNameSpecifier(NestedNameSpecifier *NS, SourceRange R);
+ void AddNestedNameSpecifierLoc(NestedNameSpecifierLoc Qualifier);
void AddExplicitTemplateArgs(const ExplicitTemplateArgumentList *A);
void AddMemberRef(FieldDecl *D, SourceLocation L);
void AddStmt(Stmt *S);
@@ -1659,6 +1736,13 @@ void EnqueueVisitor::AddNestedNameSpecifier(NestedNameSpecifier *N,
if (N)
WL.push_back(NestedNameSpecifierVisit(N, R, Parent));
}
+
+void
+EnqueueVisitor::AddNestedNameSpecifierLoc(NestedNameSpecifierLoc Qualifier) {
+ if (Qualifier)
+ WL.push_back(NestedNameSpecifierLocVisit(Qualifier, Parent));
+}
+
void EnqueueVisitor::AddStmt(Stmt *S) {
if (S)
WL.push_back(StmtVisit(S, Parent));
@@ -1743,8 +1827,8 @@ void EnqueueVisitor::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
// but isn't.
AddTypeLoc(E->getScopeTypeInfo());
// Visit the nested-name-specifier.
- if (NestedNameSpecifier *Qualifier = E->getQualifier())
- AddNestedNameSpecifier(Qualifier, E->getQualifierRange());
+ if (NestedNameSpecifierLoc QualifierLoc = E->getQualifierLoc())
+ AddNestedNameSpecifierLoc(QualifierLoc);
// Visit base expression.
AddStmt(E->getBase());
}
@@ -1780,8 +1864,7 @@ void EnqueueVisitor::VisitDeclRefExpr(DeclRefExpr *DR) {
void EnqueueVisitor::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
AddExplicitTemplateArgs(E->getOptionalExplicitTemplateArgs());
AddDeclarationNameInfo(E);
- if (NestedNameSpecifier *Qualifier = E->getQualifier())
- AddNestedNameSpecifier(Qualifier, E->getQualifierRange());
+ AddNestedNameSpecifierLoc(E->getQualifierLoc());
}
void EnqueueVisitor::VisitDeclStmt(DeclStmt *S) {
unsigned size = WL.size();
@@ -1983,18 +2066,29 @@ bool CursorVisitor::RunVisitorWorkList(VisitorWorkList &WL) {
}
case VisitorJob::LabelRefVisitKind: {
LabelDecl *LS = cast<LabelRefVisit>(&LI)->get();
- if (Visit(MakeCursorLabelRef(LS->getStmt(),
- cast<LabelRefVisit>(&LI)->getLoc(),
- TU)))
- return true;
+ if (LabelStmt *stmt = LS->getStmt()) {
+ if (Visit(MakeCursorLabelRef(stmt, cast<LabelRefVisit>(&LI)->getLoc(),
+ TU))) {
+ return true;
+ }
+ }
continue;
}
+
case VisitorJob::NestedNameSpecifierVisitKind: {
NestedNameSpecifierVisit *V = cast<NestedNameSpecifierVisit>(&LI);
if (VisitNestedNameSpecifier(V->get(), V->getSourceRange()))
return true;
continue;
}
+
+ case VisitorJob::NestedNameSpecifierLocVisitKind: {
+ NestedNameSpecifierLocVisit *V = cast<NestedNameSpecifierLocVisit>(&LI);
+ if (VisitNestedNameSpecifierLoc(V->get()))
+ return true;
+ continue;
+ }
+
case VisitorJob::DeclarationNameInfoVisitKind: {
if (VisitDeclarationNameInfo(cast<DeclarationNameInfoVisit>(&LI)
->get()))
diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
index da72f5a..11759ee 100644
--- a/tools/libclang/CMakeLists.txt
+++ b/tools/libclang/CMakeLists.txt
@@ -30,15 +30,10 @@ add_clang_library(libclang
)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
- # dylib versioning information
- # FIXME: Is there a more CMake-ish way to handle this?
- set(LIBCLANG_VERSION 1
- CACHE STRING "Version number of the libclang library")
- set(LIBCLANG_SUBVERSION 0
- CACHE STRING "Minor version number of the libclang library")
- set(LIBCLANG_LINK_FLAGS
- "-Wl,-current_version -Wl,${LIBCLANG_VERSION}.${LIBCLANG_SUBVERSION} -Wl,-compatibility_version -Wl,1")
+ # Darwin-specific linker flags
+ set(LIBCLANG_LINK_FLAGS "-Wl,-compatibility_version -Wl,1")
+
set(LIBCLANG_LINK_FLAGS
"${LIBCLANG_LINK_FLAGS} -Wl,-dead_strip -Wl,-seg1addr -Wl,0xE0000000")
@@ -48,6 +43,9 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
INSTALL_NAME_DIR "@executable_path/../lib")
endif()
+# Versioning information
+set_target_properties(libclang PROPERTIES VERSION ${LIBCLANG_LIBRARY_VERSION})
+
if(MSVC)
# windows.h doesn't compile with /Za
get_target_property(NON_ANSI_COMPILE_FLAGS libclang COMPILE_FLAGS)
diff --git a/tools/scan-build/scan-build b/tools/scan-build/scan-build
index 80585b1..f7e521f 100755
--- a/tools/scan-build/scan-build
+++ b/tools/scan-build/scan-build
@@ -1005,12 +1005,95 @@ ADVANCED OPTIONS:
cost of speed.
ENDTEXT
-# FIXME: Print out available analyesis.
+# Query clang for list of checkers that are enabled.
+my %EnabledCheckers;
+foreach my $lang ("c", "objective-c", "objective-c++", "c++") {
+ pipe(FROM_CHILD, TO_PARENT);
+ my $pid = fork();
+ if ($pid == 0) {
+ close FROM_CHILD;
+ open(STDOUT,">&", \*TO_PARENT);
+ open(STDERR,">&", \*TO_PARENT);
+ exec $Clang, ('--analyze', '-x', $lang, '-', '-###');
+ }
+ close(TO_PARENT);
+ while(<FROM_CHILD>) {
+ foreach my $val (split /\s+/) {
+ $val =~ s/\"//g;
+ if ($val =~ /-analyzer-checker\=([^\s]+)/) {
+ $EnabledCheckers{$1} = 1;
+ }
+ }
+ }
+ waitpid($pid,0);
+ close(FROM_CHILD);
+}
+
+# Query clang for complete list of checkers.
+pipe(FROM_CHILD, TO_PARENT);
+my $pid = fork();
+if ($pid == 0) {
+ close FROM_CHILD;
+ open(STDOUT,">&", \*TO_PARENT);
+ open(STDERR,">&", \*TO_PARENT);
+ exec $Clang, ('-cc1', '-analyzer-checker-help');
+}
+close(TO_PARENT);
+my $foundCheckers = 0;
+while(<FROM_CHILD>) {
+ if (/CHECKERS:/) {
+ $foundCheckers = 1;
+ last;
+ }
+}
+if (!$foundCheckers) {
+ print " *** Could not query Clang for the list of available checkers.";
+}
+else {
+ print("\nAVAILABLE CHECKERS:\n\n");
+ my $skip = 0;
+ while(<FROM_CHILD>) {
+ if (/core\.experimental/ or /debug\./ or /unix.experimental/ or /cocoa.experimental/) {
+ $skip = 1;
+ next;
+ }
+ if ($skip) {
+ next if (!/^\s\s[^\s]/);
+ $skip = 0;
+ }
+ s/^\s\s//;
+ if (/^([^\s]+)/) {
+ # Is the checker enabled?
+ my $checker = $1;
+ my $enabled = 0;
+ my $aggregate = "";
+ foreach my $domain (split /\./, $checker) {
+ $aggregate .= $domain;
+ if ($EnabledCheckers{$aggregate}) {
+ $enabled =1;
+ last;
+ }
+ }
+
+ if ($enabled) {
+ print " + ";
+ }
+ else {
+ print " ";
+ }
+ }
+ else {
+ print " ";
+ }
+ print $_;
+ }
+}
+waitpid($pid,0);
+close(FROM_CHILD);
print <<ENDTEXT
- NOTE: "(+)" indicates that an analysis is enabled by default unless one
- or more analysis options are specified
+ NOTE: "+" indicates that an analysis is enabled by default.
BUILD OPTIONS
@@ -1074,6 +1157,9 @@ if (!@ARGV) {
exit 1;
}
+
+my $displayHelp = 0;
+
while (@ARGV) {
# Scan for options we recognize.
@@ -1081,8 +1167,9 @@ while (@ARGV) {
my $arg = $ARGV[0];
if ($arg eq "-h" or $arg eq "--help") {
- DisplayHelp();
- exit 0;
+ $displayHelp = 1;
+ shift @ARGV;
+ next;
}
if ($arg eq '-analyze-headers') {
@@ -1224,12 +1311,17 @@ while (@ARGV) {
last;
}
-if (!@ARGV) {
+if (!@ARGV and $displayHelp == 0) {
Diag("No build command specified.\n\n");
+ $displayHelp = 1;
+}
+
+if ($displayHelp) {
DisplayHelp();
exit 1;
}
+# Determine where results go.
$CmdArgs = HtmlEscape(join(' ', map(ShellEscape($_), @ARGV)));
$HtmlTitle = "${CurrentDirSuffix} - scan-build results"
unless (defined($HtmlTitle));
@@ -1238,9 +1330,7 @@ $HtmlTitle = "${CurrentDirSuffix} - scan-build results"
my $BaseDir = $HtmlDir;
$HtmlDir = GetHTMLRunDir($HtmlDir);
-# Set the appropriate environment variables.
-SetHtmlEnv(\@ARGV, $HtmlDir);
-
+# Determine the location of ccc-analyzer.
my $AbsRealBin = Cwd::realpath($RealBin);
my $Cmd = "$AbsRealBin/libexec/ccc-analyzer";
my $CmdCXX = "$AbsRealBin/libexec/c++-analyzer";
@@ -1259,27 +1349,24 @@ if (!defined $ClangSB || ! -x $ClangSB) {
Diag("Using 'clang' from path: $Clang\n");
}
+# Set the appropriate environment variables.
+SetHtmlEnv(\@ARGV, $HtmlDir);
$ENV{'CC'} = $Cmd;
$ENV{'CXX'} = $CmdCXX;
$ENV{'CLANG'} = $Clang;
$ENV{'CLANG_CXX'} = $ClangCXX;
-
if ($Verbose >= 2) {
$ENV{'CCC_ANALYZER_VERBOSE'} = 1;
}
-
if ($Verbose >= 3) {
$ENV{'CCC_ANALYZER_LOG'} = 1;
}
-
if ($AnalyzeHeaders) {
push @AnalysesToRun,"-analyzer-opt-analyze-headers";
}
-
if ($AnalyzerStats) {
push @AnalysesToRun, '-analyzer-stats';
}
-
if ($MaxLoop > 0) {
push @AnalysesToRun, '-analyzer-max-loop ' . $MaxLoop;
}
@@ -1289,11 +1376,9 @@ $ENV{'CCC_ANALYZER_ANALYSIS'} = join ' ',@AnalysesToRun;
if (defined $StoreModel) {
$ENV{'CCC_ANALYZER_STORE_MODEL'} = $StoreModel;
}
-
if (defined $ConstraintsModel) {
$ENV{'CCC_ANALYZER_CONSTRAINTS_MODEL'} = $ConstraintsModel;
}
-
if (defined $OutputFormat) {
$ENV{'CCC_ANALYZER_OUTPUT_FORMAT'} = $OutputFormat;
}
diff --git a/tools/scan-view/ScanView.py b/tools/scan-view/ScanView.py
index 837adae..c6dddba 100644
--- a/tools/scan-view/ScanView.py
+++ b/tools/scan-view/ScanView.py
@@ -641,7 +641,7 @@ File Bug</h3>
def send_head(self, fields=None):
if (self.server.options.onlyServeLocal and
self.client_address[0] != '127.0.0.1'):
- return self.send_error('401', 'Unauthorized host.')
+ return self.send_error(401, 'Unauthorized host.')
if fields is None:
fields = {}
OpenPOWER on IntegriCloud