r182290 - Minor fix: don't crash on empty configuration file, consider empty configuration files invalid.

Chandler Carruth chandlerc at google.com
Mon May 20 11:00:13 PDT 2013


On Mon, May 20, 2013 at 3:18 PM, Alexander Kornienko <alexfh at google.com>wrote:

> Author: alexfh
> Date: Mon May 20 10:18:01 2013
> New Revision: 182290
>
> URL: http://llvm.org/viewvc/llvm-project?rev=182290&view=rev
> Log:
> Minor fix: don't crash on empty configuration file, consider empty
> configuration files invalid.
>

Test case please!


>
> Modified:
>     cfe/trunk/lib/Format/Format.cpp
>
> Modified: cfe/trunk/lib/Format/Format.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=182290&r1=182289&r2=182290&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Format/Format.cpp (original)
> +++ cfe/trunk/lib/Format/Format.cpp Mon May 20 10:18:01 2013
> @@ -201,6 +201,8 @@ bool getPredefinedStyle(StringRef Name,
>  }
>
>  llvm::error_code parseConfiguration(StringRef Text, FormatStyle *Style) {
> +  if (Text.trim().empty())
> +    return llvm::make_error_code(llvm::errc::invalid_argument);
>    llvm::yaml::Input Input(Text);
>    Input >> *Style;
>    return Input.error();
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130520/faffcb67/attachment.html>


More information about the cfe-commits mailing list